//********************* $fileC = file("db/Users/" . $_SESSION['user']->getUserId() . ".dat", FILE_IGNORE_NEW_LINES); $fileC[3] = trim($fileC[3]) + 1; $fileC[4] = trim($fileC[4]) + 1; $str = ""; foreach ($fileC as $line) { $str .= $line . "\n"; } file_put_contents("db/Users/" . $_SESSION['user']->getUserId() . ".dat", $str); //******************** $fileC = file("db/forumList.dat", FILE_IGNORE_NEW_LINES); $str = ""; foreach ($fileC as $statistic) { $temp = new Forum($statistic); if ($temp->getForumId() == $_SESSION['forum']->getForumId()) { $str .= $temp->getForumId() . "~" . $temp->getForumName() . "~" . $temp->getDescription() . "~" . ($temp->getTotalTopics() + 1) . "~" . ($temp->getTotalPosts() + 1) . "\n"; } else { $str .= $statistic . "\n"; } } file_put_contents("db/forumList.dat", $str); //********************* $fhTemp = fopen("db/Topics/" . $_GET['forumId'] . "temp.dat", "w"); $fh = fopen("db/Topics/" . $_GET['forumId'] . ".dat", "r"); fwrite($fhTemp, $total . "\n" . time() . "\n"); while (!feof($fh)) { $a = trim(fgets($fh)); $b = trim(fgets($fh)); if ($a != "" && $b != "") { fwrite($fhTemp, $a . "\n" . $b . "\n"); }
/** * Update forum. * * @param Forum $f */ public static function updateForum(Forum $f) { global $db; $db->query("\n\t\t\t\tUPDATE forums\n\t\t\t\tSET category_id = :cid,\n\t\t\t\t\ttitle = :title,\n\t\t\t\t\tdescription = :desc,\n\t\t\t\t\t`order` = :order,\n\t\t\t\t\tclosed = :closed\n\t\t\t\tWHERE id = :fid\n\t\t\t", array($f->getCategoryID(), $f->getTitle(), $f->getDescription(), $f->getOrder(), $f->isClosed() ? 1 : 0, $f->getID())); }