Skip to content

Instantly share code, notes, and snippets.

@phenix-factory
Last active March 16, 2016 11:31
Show Gist options
  • Select an option

  • Save phenix-factory/e0fe83f68f949fec44d2 to your computer and use it in GitHub Desktop.

Select an option

Save phenix-factory/e0fe83f68f949fec44d2 to your computer and use it in GitHub Desktop.
SPIP: auteurs_objet
<?php
/**
* Fonction générique qui permet de renvoyer les auteurs d'un objet
*
* @param string $objet
* @param int $id_objet
* @param string $cond
* @access public
* @return array
*/
function auteurs_objet($objet, $id_objet, $cond = '') {
// Pour les distrait qui utiliserai id_articles ou articles
// alors qu'il faut utiliser l'objet au singulier
$objet = objet_type($objet);
$where = array(
'objet='.sql_quote($objet),
'id_objet='.intval($id_objet)
);
if (!empty($cond)) {
$where[] = $cond;
}
return sql_allfetsel(
'id_auteur',
'spip_auteurs_liens',
$where
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment