Пример #1
0
 }
 $dbStatement = Util::getDbConnection()->prepare("UPDATE Link " . "SET IsCreated = 'Y' " . "WHERE SourceEpisodeID = :parentToUpdate " . "AND TargetEpisodeID = :episodeToUpdate");
 $dbStatement->bindParam(":parentToUpdate", $parentToUpdate, PDO::PARAM_INT);
 $dbStatement->bindParam(":episodeToUpdate", $episodeToUpdate, PDO::PARAM_INT);
 $dbStatement->execute();
 if ($dbStatement->rowCount() != 1) {
     throw new HardStoryException("Unable to update the link record.");
 }
 for ($i = 0; $i < $linkCount; $i++) {
     $var1 = "option" . $i;
     $var2 = "backlink" . $i;
     if (!empty(${$var1})) {
         if (${$var2} != 0) {
             Util::createLink($episodeToUpdate, ${$var2}, ${$var1}, true);
         } else {
             $newEpisode = Util::createEpisode($episodeToUpdate, $scheme);
             Util::createLink($episodeToUpdate, $newEpisode, ${$var1}, false);
         }
     }
 }
 if ($adminEmail != "-") {
     // send a notification email to the administrator
     Util::extensionNotification($adminEmail, $parentToUpdate, $episodeToUpdate, $authorName);
     // send a notification email (if applicable) to the author of the parent episode
     $dbStatement = Util::getDbConnection()->prepare("SELECT AuthorNotify, " . "AuthorEmail " . "FROM Episode " . "WHERE EpisodeID = :parentToUpdate");
     $dbStatement->bindParam(":parentToUpdate", $parentToUpdate, PDO::PARAM_INT);
     $dbStatement->execute();
     $row = $dbStatement->fetch(PDO::FETCH_NUM);
     if (!$row) {
         throw new HardStoryException("Problem fetching parent episode row from the database.");
     }