예제 #1
0
<?php

include "common.php";
outHtml1("Move Topic");
outHtml2("Move Topic:", $_SERVER['HTTP_REFERER']);
?>
		
		<p style="margin-left: 5%;">Click on the forum to which the topic is going to be moved.</p>
		
		<table class='list' style="margin-top: 10px; margin-bottom: 10px; font-family: Trebuchet MS;">
			<tr><td class="listcell"  style="background: url(images/bar.png) repeat-x; color: white;"><u>Forum</u></td></tr>
		</table>
		
		<?php 
$forumArr = array();
$fileC = file("db/forumList.dat");
foreach ($fileC as $line) {
    $temp = new Forum($line);
    if ($temp->getForumId() != $_GET['forumId']) {
        array_push($forumArr, $temp);
    }
}
echo "<table class='list'>";
foreach ($forumArr as $item) {
    echo "<tr>\r\n\t\t\t\t\t\t<td class='listcell'><a href='moveTopicExecute.php?oldForumId=" . $_GET['forumId'] . "&topicId=" . $_GET['topicId'] . "&forumId=" . $item->getForumId() . "'>" . $item->getForumName() . "</a></td>\r\n\t\t\t\t\t</tr>";
}
echo "</table>";
?>

<?php 
outHtml3();
예제 #2
0
$name = stripslashes($_POST['name']);
$name = str_replace("\n", "", $name);
$name = str_replace("\r\n", "", $name);
$name = str_replace("\r", "", $name);
$name = str_replace("~", "", $name);
$description = stripslashes($_POST['description']);
$description = str_replace("\n", "", $description);
$description = str_replace("\r\n", "", $description);
$description = str_replace("\r", "", $description);
$description = str_replace("~", "", $description);
$description = substr($description, 3, strlen($description) - 7);
if (trim($name) == "") {
    header("Location: forumListEdit.php?forumId=" . $_GET['forumId'] . "&error=1");
    exit;
}
if (trim($description) == "") {
    header("Location: forumListEdit.php?forumId=" . $_GET['forumId'] . "&error=2");
    exit;
}
$fileC = file("db/forumList.dat", FILE_IGNORE_NEW_LINES);
$str = "";
foreach ($fileC as $statistic) {
    $temp = new Forum($statistic);
    if ($temp->getForumId() == $_GET['forumId']) {
        $str .= $temp->getForumId() . "~" . $name . "~" . $description . "~" . $temp->getTotalTopics() . "~" . $temp->getTotalPosts() . "\n";
    } else {
        $str .= $statistic . "\n";
    }
}
file_put_contents("db/forumList.dat", $str);
header("Location: index.php");
예제 #3
0
file_put_contents("db/Topics/" . $total . "/posts.dat", $str . "\n");
//*********************
$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");
예제 #4
0
     if ($a != "") {
         fwrite($fhTemp, $a . "\n");
     }
     fclose($fh);
     fclose($fhTemp);
     unlink("db/forumList.dat");
     rename("db/forumListtemp.dat", "db/forumList.dat");
 } else {
     if ($_GET['mode'] == 'delete') {
         $fhTemp = fopen("db/forumListtemp.dat", "w");
         $fh = fopen("db/forumList.dat", "r");
         while (!feof($fh)) {
             $a = trim(fgets($fh));
             if ($a != "") {
                 $item = new Forum($a);
                 if ($item->getForumId() != $_GET['forumId']) {
                     fwrite($fhTemp, $a . "\n");
                 }
             }
         }
         fclose($fh);
         fclose($fhTemp);
         unlink("db/forumList.dat");
         rename("db/forumListtemp.dat", "db/forumList.dat");
         unlink("db/Topics/" . $_GET['forumId'] . ".dat");
         unlink("db/Topics/" . $_GET['forumId'] . "sticky.dat");
         //***********************
         $fileC = file("db/forumStatistics.dat", FILE_IGNORE_NEW_LINES);
         $fileC[0] = trim($fileC[0]) - 1;
         $str = "";
         foreach ($fileC as $statistic) {