예제 #1
0
 /**
  * AddFlux
  *
  * Fonction qui ajoute un flux rss
  *
  * @return array;
  */
 public function addFlux()
 {
     $xml = simplexml_load_file($_POST['url']);
     $nom = $xml->channel->title;
     if (isset($xml->channel->lastBuildDate)) {
         $last = $xml->channel->lastBuildDate;
         $date = strftime("%Y-%m-%d %H:%M:%S", strtotime($last));
         //converti la date rss en timestamp unix puis en format Y-m-d H:m:s
     } else {
         $date = date("Y-m-d H:i:s");
     }
     $table = "`flux`";
     $infos = array("`id_user`" => "?", "`name_flux`" => "?", "`url`" => "?", "`last_update`" => "?");
     $placeholder = array($_SESSION['rss']['id_user'], $nom, $_POST['url'], $date);
     parent::ajouter($table, $infos, $placeholder);
     $erreur[] = "Flux ajoute.";
     return $erreur;
 }