Ejemplo n.º 1
0
Archivo: lib.php Proyecto: lursu/morgue
 /**
  * save forum links belonging to a certain event to the database
  *
  * @param $event_id - numeric ID of the event to store for
  * @param $- a map of the forum info with the following keys
  *            -- event_id => postmortem event this belongs to
  *            -- *optional* id => existing forum entry id
  *            -- link => the link to save
  *            -- comment => text describing the linked forum post's contents
  * @param $conn - a PDO connection object
  *
  * @returns ( "status" => self::OK ) on success
  * or ( "status" => self::ERROR, "error" => "an error message" ) on failure
  */
 static function save_forum_links($forum_links, $conn = null)
 {
     $conn = $conn ?: Persistence::get_database_object();
     if (is_null($conn)) {
         return array("status" => self::ERROR, "error" => "Couldn't get connection object.");
     }
     try {
         $forum = Persistence::save_forum($forum_links, $conn);
     } catch (PDOException $e) {
         return array("status" => self::ERROR, "error" => $e->getMessage());
     }
     return array("status" => self::OK);
 }