function postCon($id, $action) { switch ($action) { case '1': deletePost($id); break; case '2': cancleInformPost($id); default: break; } }
} } if ($err) { error($err); } } extract($_POST); extract($_GET); $iniv = array('action', 'res', 'no', 'pwd', 'page'); foreach ($iniv as $iniva) { if (!isset(${$iniva})) { ${$iniva} = ""; } } init(); switch ($action) { case 'post': addPost(); break; case 'delete': deletePost($no, $pwd); default: if ($res) { // 回應模式輸出 $page = isset($_GET['page']) ? $_GET['page'] : 'RE_PAGE_MAX'; if (!($page == 'all' || $page == 'RE_PAGE_MAX')) { $page = intval($_GET['page']); } } showPost($res, $page); }
<?php // table.php require_once "functions.php"; require_once "header.php"; $text_list = getTextData(); //var_dump($car_list); $emailtable = getEmailData(); //kas kasutaja tahab kustutada // kas aadressireal on ?delete=??!??!?! if (isset($_GET["delete"])) { // saadan kaasa id, mida kustutada deletePost($_GET["delete"]); } ?> <table border=1 align="center" > <tr> <th>ID</th> <th>user_id</th> <th>text</th> </tr> <?php // iga massiivis olema elemendi kohta // count($car_list) - massiivi pikkus for ($i = 0; $i < count($text_list); $i++) { // $i = $i +1; sama mis $i += 1; sama mis $i++; // tavaline rida echo "<tr>"; echo "<td>" . $text_list[$i]->post_kd . "</td>";
$form_valid = false; } // action taken if form filled in correctly... if ($form_valid == true) { updatePost($_GET['id'], $_SESSION['userId'], $_POST['title'], $_POST['editor1'], $_POST['category']); // variables set to createPost function for insertion into db... header('Location: ?page=cmsUpdated&goto=cmsPostsTable'); } } $id = $_GET['id']; $post = getPostById($id); include VIEWS . 'contentCMSUpdate.php'; break; case 'delete': $id = $_GET['id']; if (!empty($_POST)) { if ($_POST['deleteConf'] == 'Yes') { deletePost($id); header('Location: ?page=cmsUpdated&goto=cmsPostsTable'); } elseif ($_POST['deleteConf'] == 'No') { header('Location: ?page=cmsPostsTable'); } } $post = getPostById($id); include VIEWS . 'contentCMSDelete.php'; break; } } else { $posts = getAllPostsCMS(); include VIEWS . 'contentCMSPostsTable.php'; }
<?php session_start(); !$_SESSION['login'] ? header('location:index.php') : ''; include 'koneksi.php'; include 'fungsi_delete.php'; $id_post = $_GET['id']; deletePost($con, $id_post);
buildIndex(); // trigger themes rebuildThemes('post'); openBoard($boardName); if ($shadow) { // lock thread $query = prepare(sprintf("UPDATE `posts_%s` SET `locked` = 1 WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $postID, PDO::PARAM_INT); $query->execute() or error(db_error($query)); $post = array('mod' => true, 'subject' => '', 'email' => '', 'name' => $config['mod']['shadow_name'], 'capcode' => $config['mod']['shadow_capcode'], 'trip' => '', 'body' => sprintf($config['mod']['shadow_mesage'], '>>>/' . $targetBoard . '/' . $newID), 'password' => '', 'has_file' => false, 'thread' => $postID, 'op' => false); markup($post['body']); $botID = post($post); buildThread($postID); header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['dir']['res'] . sprintf($config['file_page'], $postID) . '#' . $botID, true, $config['redirect_http']); } else { deletePost($postID); buildIndex(); openBoard($targetBoard); header('Location: ?/' . sprintf($config['board_path'], $board['uri']) . $config['dir']['res'] . sprintf($config['file_page'], $newID), true, $config['redirect_http']); } } else { $body = '<fieldset><legend>Move thread</legend>' . '<form action="?/' . $boardName . '/move/' . $postID . '" method="post">' . '<table>'; $boards = listBoards(); if (count($boards) <= 1) { error(_('No board to move to; there is only one.')); } $__boards = ''; foreach ($boards as &$_board) { if ($_board['uri'] == $board['uri']) { continue; }
// Commit the post to the database. $post['id'] = $id = post($post); if (!$tor) { insertFloodPost($post); } // Update statistics for this board. updateStatisticsForPost($post); // Handle cyclical threads if (!$post['op'] && isset($thread['cycle']) && $thread['cycle']) { // Query is a bit weird due to "This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'" (MariaDB Ver 15.1 Distrib 10.0.17-MariaDB, for Linux (x86_64)) $query = prepare(sprintf('SELECT `id` FROM ``posts_%s`` WHERE `thread` = :thread AND `id` NOT IN (SELECT `id` FROM (SELECT `id` FROM ``posts_%s`` WHERE `thread` = :thread ORDER BY `id` DESC LIMIT :limit) i)', $board['uri'], $board['uri'])); $query->bindValue(':thread', $post['thread']); $query->bindValue(':limit', $config['cycle_limit'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); while ($dpost = $query->fetch()) { deletePost($dpost['id'], false, false); } } if (isset($post['antispam_hash'])) { incrementSpamHash($post['antispam_hash']); } if (isset($post['tracked_cites']) && !empty($post['tracked_cites'])) { $insert_rows = array(); foreach ($post['tracked_cites'] as $cite) { $insert_rows[] = '(' . $pdo->quote($board['uri']) . ', ' . (int) $id . ', ' . $pdo->quote($cite[0]) . ', ' . (int) $cite[1] . ')'; } query('INSERT INTO ``cites`` VALUES ' . implode(', ', $insert_rows)) or error(db_error()); } if (!$post['op'] && !isset($_POST['no-bump']) && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($thread['cycle'] || $config['reply_limit'] == 0 || $numposts['replies'] + 1 < $config['reply_limit'])) { bumpThread($post['thread']); }
<?php require_once '../phpInclude/dbconn.php'; require_once '../phpInclude/AdminClass.php'; $share_id = $_REQUEST['share_id']; if (!empty($share_id)) { deletePost($share_id); $success = "1"; $msg = "post deleted!"; } else { $success = "0"; $msg = "Incomplete Parameters!"; } echo json_encode(array("success" => $success, "msg" => $msg));
<?php require_once 'include.php'; $act = $_REQUEST['act']; if ($act === 'signup') { $msg = signup(); } elseif ($act === 'login') { $msg = login(); } elseif ($act === 'logout') { $msg = logout(); } elseif ($act === 'post') { $msg = post(); } elseif ($act === 'deletePost') { $msg = deletePost(); } elseif ($act === 'likePost') { $msg = likePost(); } elseif ($act === 'commentPost') { $msg = commentPost(); } elseif ($act === 'deleteComment') { $msg = deleteComment(); } elseif ($act === 'changeInfo') { $msg = changeInfo(); } elseif ($act === 'readNotify') { $msg = readNotify(); } elseif ($act === 'markAllRead') { $msg = markAllRead(); } ?> <!DOCTYPE HTML> <html> <head>
<?php session_start(); function deletePost($dataTodelete, $prevData) { return str_replace($dataTodelete, "", $prevData); } $blogId = $_SESSION['blogId']; $filePath = '../@' . $blogId . '/index.php'; $prevData = file_get_contents($filePath); $nextData = deletePost($_POST["d"], $prevData); if (file_put_contents($filePath, $nextData)) { die("deleted"); } else { die("error"); } //die(htmlentities($newPostContent)); ?>
<?php require MODELES . 'membres/checkAdmin.php'; if (checkAdmin()) { require MODELES . '/faq/getPosts.php'; if (isset($_GET['id']) && ($post = getPosts($_GET['id']))) { // si on a posté le formulaire : require MODELES . 'backoffice/deletePost.php'; if (deletePost($_GET['id'])) { $message = 'Suppression réussie !'; } else { $message = 'Oups ! Une erreur s\'est produite...'; } } else { echo 'Invalid parameter'; exit; } require VUES . 'backoffice/deletefaq.php'; }
<?php require 'functions.php'; $url = 'profile.php'; $postId = $_POST['postIdName']; deletePost($postId); header('Location: ' . $url);
<?php require_once 'lib/common.php'; require_once 'lib/list-posts.php'; session_start(); // Don't let non-auth users access this screen if (!isLoggedin()) { redirectAndExit('index.php'); } if ($_POST) { $deleteResponse = $_POST['delete-post']; if ($deleteResponse) { $keys = array_keys($deleteResponse); $deletePostId = $keys[0]; if ($deletePostId) { deletePost(getPDO(), $deletePostId); redirectAndExit('list-posts.php'); } } } // Connect to the database, run a query $pdo = getPDO(); $posts = getAllPosts($pdo); ?> <!DOCTYPE html> <html> <head> <title> A blog application | Blog posts</title>
// print_r($_SESSION); // echo "</pre>"; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['postText'])) { $postText = $_POST['postText']; writePost($db, $user_id, $postText); // 2重投稿防止のためにリロードする処理 header('Location: index.php'); exit; } } if (isset($_GET['delete_post_id'])) { $post = getPost($db, $_GET['delete_post_id']); if ($user_id == $post[0]['user_id']) { $delete_post_id = $_GET['delete_post_id']; deletePost($db, $delete_post_id); header('Location: ' . $_SERVER['SCRIPT_NAME']); exit; } else { http_response_code(403); print "unauthorized access"; exit; } } ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>index - Ditter</title>
<?php require "session.php"; require "init.php"; require "header.php"; require 'function.php'; deletePost($_GET["id"]); header('Location: connect.php'); exit;
<?php include_once "dbinfo.inc.oop.php"; $pid = $_GET['pid']; if ($pid == "") { header('Location: myprofile.php'); } $delete = deletePost($pid); if ($delete) { header('Location: myprofile.php?success'); } else { header('Location: myprofile.php?error'); }
function mod_deletebyip($boardName, $post, $global = false) { global $config, $mod, $board; $global = (bool) $global; if (!openBoard($boardName)) { error($config['error']['noboard']); } if (!$global && !hasPermission($config['mod']['deletebyip'], $boardName)) { error($config['error']['noaccess']); } if ($global && !hasPermission($config['mod']['deletebyip_global'], $boardName)) { error($config['error']['noaccess']); } // Find IP address $query = prepare(sprintf('SELECT `ip` FROM ``posts_%s`` WHERE `id` = :id', $boardName)); $query->bindValue(':id', $post); $query->execute() or error(db_error($query)); if (!($ip = $query->fetchColumn())) { error($config['error']['invalidpost']); } $boards = $global ? listBoards() : array(array('uri' => $boardName)); $query = ''; foreach ($boards as $_board) { $query .= sprintf("SELECT `thread`, `id`, '%s' AS `board` FROM ``posts_%s`` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', '', $query); $query = prepare($query); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); if ($query->rowCount() < 1) { error($config['error']['invalidpost']); } @set_time_limit($config['mod']['rebuild_timelimit']); $threads_to_rebuild = array(); $threads_deleted = array(); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); deletePost($post['id'], false, false); rebuildThemes('post-delete', $board['uri']); if ($post['thread']) { $threads_to_rebuild[$post['board']][$post['thread']] = true; } else { $threads_deleted[$post['board']][$post['id']] = true; } } foreach ($threads_to_rebuild as $_board => $_threads) { openBoard($_board); foreach ($_threads as $_thread => $_dummy) { if ($_dummy && !isset($threads_deleted[$_board][$_thread])) { buildThread($_thread); } } buildIndex(); } if ($global) { $board = false; } // Record the action modLog("Deleted all posts by IP address: <a href=\"?/IP/{$ip}\">{$ip}</a>"); // Redirect header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']); }
<?php dbconnect(); /* If a choice is made, it will be processed here */ if (isset($_POST['submit'])) { $submit = $_POST['submit']; $pid = $_POST['pid']; $tid = $_POST['tid']; $uid = $_POST['uid']; if ($submit == 'Approve') { $res = dbquery("UPDATE posts\n\t\t\t\t\t\t\tSET approved = 1\n\t\t\t\t\t\t\tWHERE pid=:pid;", array('pid' => $pid)); $date = time(); updateStats($tid, $uid, $date, false, 1); $res = dbquery("UPDATE threads SET approved = 1 WHERE tid=:tid;", array('tid' => $tid)); } elseif ($submit == 'Decline') { deletePost($pid, $tid); } } echo "These messages await your approval:"; /* Selecting all posts that aren't approved */ $res = dbquery("SELECT * FROM posts, users\n\t\t\t\t\tWHERE approved = 0 AND posts.uid = users.uid\n\t\t\t\t\tORDER BY date;"); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $title = $row['title']; $content = $row['content']; $date = $row['date']; $username = $row['username']; $pid = $row['pid']; $tid = $row['tid']; $uid = $row['uid']; echo " <div class='post'>\n\t\t\t\t <div class='post-content'>\n\t\t\t\t\t\t<h3>{$title}</h3>\n\t\t\t\t\t\t<p>{$content}</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='post-data'>\n\t\t\t\t\t\t<p>{$username}</p>\n\t\t\t\t\t\t<p>{$date}</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>"; echo " <form method='post'>\n\t\t\t\t\t<input type='hidden' name='pid' value={$pid}>\n\t\t\t\t\t<input type='hidden' name='tid' value={$tid}>\n\t\t\t\t\t<input type='hidden' name='uid' value={$uid}>\n\t\t\t\t\t<div class='buttons mngbtns options'>\n\t\t\t\t\t\t<button type='submit' name='submit' id='approve' value='Approve'>\n\t\t\t\t\t\t\tApprove\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<button type='submit' name='submit' id='decline' value='Decline'>\n\t\t\t\t\t\t\tDecline\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</form>";
<?php //session_start(); include ("phpFunctions.php"); //$temppostid = $_GET['postid']; deletePost($_GET['postid']); redirect("main.php"); exit(); ?>
function common_projektneStrane() { //debug mod aktivan global $userid, $user_nastavnik, $user_student, $conf_files_path, $user_siteadmin; $predmet = intval($_REQUEST['predmet']); $ag = intval($_REQUEST['ag']); $projekat = intval($_REQUEST['projekat']); $action = $_REQUEST['action']; //for project page only: $section = $_REQUEST['section']; $subaction = $_REQUEST['subaction']; $id = intval($_REQUEST['id']); //editing links, rss.... if ($user_student && !$user_siteadmin) { $actualProject = getActualProjectForUserInPredmet($userid, $predmet, $ag); if ($actualProject[id] != $projekat) { //user is not in this project in this predmet...hijack attempt? zamgerlog("projektne strane: korisnik nije na projektu {$projekat} (pp{$predmet}, ag{$ag})", 3); zamgerlog2("nije na projektu", $projekat); return; } } $params = getPredmetParams($predmet, $ag); $project = getProject($projekat); $members = fetchProjectMembers($project[id]); if ($params[zakljucani_projekti] == 0) { zamgerlog("projektne strane: jos nisu otvorene! (pp{$predmet}, ag{$ag})", 3); zamgerlog2("svi projekti su jos otkljucani", $predmet, $ag); return; } if ($user_student && !$user_siteadmin) { $linkPrefix = "?sta=student/projekti&akcija=projektnastranica&projekat={$projekat}&predmet={$predmet}&ag={$ag}"; } elseif ($user_nastavnik) { $linkPrefix = "?sta=nastavnik/projekti&akcija=projektna_stranica&projekat={$projekat}&predmet={$predmet}&ag={$ag}"; } else { return; } ?> <h2><?php echo filtered_output_string($project[naziv]); ?> </h2> <div class="links"> <ul class="clearfix"> <li><a href="<?php echo $linkPrefix; ?> ">Početna strana</a></li> <li><a href="<?php echo $linkPrefix . "§ion=info"; ?> ">Informacije o projektu</a></li> <li><a href="<?php echo $linkPrefix . "§ion=links"; ?> ">Korisni linkovi</a></li> <li><a href="<?php echo $linkPrefix . "§ion=rss"; ?> ">RSS feedovi</a></li> <li><a href="<?php echo $linkPrefix . "§ion=bl"; ?> ">Članci</a></li> <li><a href="<?php echo $linkPrefix . "§ion=file"; ?> ">Fajlovi</a></li> <li class="last"><a href="<?php echo $linkPrefix . "§ion=bb"; ?> ">Grupa za diskusiju</a></li> </ul> </div> <?php if (!isset($section)) { //display project start page ?> <div id="mainWrapper" class="clearfix"> <div id="leftBlocks"> <div class="blockRow clearfix"> <div class="block" id="latestPosts"> <a class="blockTitle" href="<?php echo $linkPrefix . "§ion=bb"; ?> " title="Grupa za diskusiju">Najnoviji postovi</a> <div class="items"> <?php $latestPosts = fetchLatestPostsForProject($project[id], 4); foreach ($latestPosts as $post) { ?> <div class="item"> <span class="date"><?php echo date('d.m H:i ', mysql2time($post[vrijeme])); ?> </span> <a href="<?php echo $linkPrefix . "§ion=bb&subaction=view&tid={$post['tema']}#p{$post['id']}"; ?> " title="<?php echo $post['naslov']; ?> " target="_blank"><?php $maxLen = 100; $len = strlen($post[naslov]); echo filtered_output_string(substr($post['naslov'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </a> <span class="author"> - <?php echo filtered_output_string($post[osoba][prezime] . ' ' . $post[osoba][ime]); ?> </span> <div class="desc"><?php $maxLen = 200; $len = strlen($post[tekst]); echo filtered_output_string(substr($post['tekst'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </div><!--desc--> </div><!--item--> <?php } ?> </div><!--items--> </div><!--block--> </div><!--blockRow--> <div class="blockRow clearfix"> <div class="block" id="latestArticles"> <a class="blockTitle" href="<?php echo $linkPrefix . "§ion=bl"; ?> " title="Članci">Najnoviji članci</a> <div class="items"> <?php $latestArticles = fetchArticlesForProject($project[id], 0, 4); foreach ($latestArticles as $article) { $author = getAuthorOfArticle($article[id]); ?> <div class="item"> <span class="date"><?php echo date('d.m H:i ', mysql2time($article[vrijeme])); ?> </span> <a href="<?php echo $linkPrefix . "§ion=bl&subaction=view&id={$article['id']}"; ?> " title="<?php echo $article['naslov']; ?> " target="_blank"><?php $maxLen = 100; $len = strlen($article[naslov]); echo filtered_output_string(substr($article['naslov'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </a> <span class="author"> - <?php echo filtered_output_string($author[prezime] . ' ' . $author[ime]); ?> </span> <div class="desc"><?php $maxLen = 200; $len = strlen($article[tekst]); echo filtered_output_string(substr($article['tekst'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </div><!--desc--> </div><!--item--> <?php } ?> </div><!--items--> </div><!--block--> </div><!--blockRow--> </div><!--leftBlocks--> <div id="rightBlocks" class="clearfix"> <div class="blockRow"> <div class="block" id="latestLinks"> <a class="blockTitle" href="<?php echo $linkPrefix . "§ion=links"; ?> " title="Korisni linkovi">Korisni linkovi</a> <div class="items"> <?php //get latest entries $links = fetchLinksForProject($project[id], 0, 4); foreach ($links as $link) { $url = $link[url]; $scheme = parse_url($url); $scheme = $scheme['scheme']; if ($scheme == '') { //only www part $url = 'http://' . $url; } $maxLen = 150; $len = strlen($link[naziv]); if ($len > $maxLen) { echo '...'; } $author = getAuthorOfLink($link[id]); ?> <div class="item"> <a href="<?php echo $url; ?> " title="<?php echo $link['naziv']; ?> " target="_blank"><?php $maxLen = 35; $len = strlen($link[naziv]); echo filtered_output_string(substr($link['naziv'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </a> <span class="author"> - <?php echo filtered_output_string($author[prezime] . ' ' . $author[ime]); ?> </span> <?php if ($link[opis] != '') { ?> <div class="desc"><?php $maxLen = 200; $len = strlen($link[opis]); echo filtered_output_string(substr($link['opis'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </div><!--desc--> <?php } ?> </div><!--item--> <?php } //foreach ?> </div><!--items--> </div><!--block--> </div><!--blockRow--> <div class="blockRow"> <div class="block" id="latestRSS"> <a class="blockTitle" href="<?php echo $linkPrefix . "§ion=rss"; ?> " title="RSS feedovi">RSS feedovi</a> <div class="items"> <?php //get latest entries $links = fetchRSSForProject($project[id], 0, 4); foreach ($links as $link) { $url = $link[url]; $scheme = parse_url($url); $scheme = $scheme['scheme']; if ($scheme == '') { //only www part $url = 'http://' . $url; } $maxLen = 150; $len = strlen($link[naziv]); if ($len > $maxLen) { echo '...'; } $author = getAuthorOfRSS($link[id]); ?> <div class="item"> <a href="<?php echo $url; ?> " title="<?php echo $link['naziv']; ?> " target="_blank"><?php $maxLen = 35; $len = strlen($link[naziv]); echo filtered_output_string(substr($link['naziv'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </a> <span class="author"> - <?php echo filtered_output_string($author[prezime] . ' ' . $author[ime]); ?> </span> <?php if ($link[opis] != '') { ?> <div class="desc"><?php $maxLen = 200; $len = strlen($link[opis]); echo filtered_output_string(substr($link['opis'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </div><!--desc--> <?php } ?> </div><!--item--> <?php } //foreach ?> </div><!--items--> </div><!--block--> </div><!--blockRow--> <div class="blockRow"> <div class="block" id="latestFiles"> <a class="blockTitle" href="<?php echo $linkPrefix . "§ion=file"; ?> " title="Fajlovi">Fajlovi</a> <div class="items"> <?php //get latest entries $files = fetchFilesForProjectLatestRevisions($project[id], 0, 4); foreach ($files as $file) { $author = getAuthorOfFile($file[id]); ?> <div class="item"> <span class="date"><?php echo date('d.m H:i ', mysql2time($file[vrijeme])); ?> </span> <a href="<?php echo "index.php?sta=common/attachment&tip=projekat&projekat={$projekat}&id={$file['id']}"; ?> " title="<?php echo $file['filename']; ?> " ><?php $maxLen = 100; $len = strlen($file[filename]); echo filtered_output_string(substr($file['filename'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </a> <span class="author"> - <?php echo filtered_output_string($author[prezime] . ' ' . $author[ime]); ?> </span> </div><!--item--> <?php } //foreach ?> </div><!--items--> </div><!--block--> </div><!--blockRow--> </div><!--rightBlocks--> </div><!--mainWrapper--> <?php } else { if ($section == 'info') { // display project info ?> <h2>Informacije o projektu</h2> <table class="projekti" border="0" cellspacing="0" cellpadding="2"> <tr> <th width="200" align="left" valign="top" scope="row">Naziv</th> <td width="490" align="left" valign="top"><?php echo filtered_output_string($project['naziv']); ?> </td> </tr> <tr> <th width="200" align="left" valign="top" scope="row">Prijavljeni studenti</th> <td width="490" align="left" valign="top"> <?php if (empty($members)) { echo 'Nema prijavljenih studenata.'; } else { ?> <ul> <?php foreach ($members as $member) { ?> <li><?php echo filtered_output_string($member[prezime] . ' ' . $member[ime] . ', ' . $member[brindexa]); ?> </li> <?php } ?> </ul> <?php } ?> </td> </tr> <tr> <th width="200" align="left" valign="top" scope="row">Opis</th> <td width="490" align="left" valign="top"><?php echo filtered_output_string($project['opis']); ?> </td> </tr> </table> <?php } elseif ($section == 'links') { //links management $linkPrefix .= '§ion=links'; ?> <h2>Korisni linkovi</h2> <div class="links" id="link"> <ul class="clearfix"> <li><a href="<?php echo $linkPrefix; ?> ">Lista linkova</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=add"; ?> ">Novi link</a></li> </ul> </div> <?php if (!isset($subaction)) { $rowsPerPage = 20; $pageNum = 1; if (isset($_REQUEST['page'])) { $pageNum = $_REQUEST['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; //display links for this project, with links to edit and delete $links = fetchLinksForProject($project[id], $offset, $rowsPerPage); foreach ($links as $link) { if (isUserAuthorOfLink($link[id], $userid)) { ?> <div class="links" id="link"> <ul class="clearfix"> <li><a href="<?php echo $linkPrefix . "&subaction=edit&id={$link['id']}"; ?> ">Uredi</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=del&id={$link['id']}"; ?> ">Briši</a></li> </ul> </div> <?php } //if user is author of this item ?> <table class="linkovi" border="0" cellspacing="0" cellpadding="2"> <tr> <th width="200" align="left" valign="top" scope="row">URL</th> <td width="490" align="left" valign="top"> <?php $url = $link[url]; $scheme = parse_url($url); $scheme = $scheme['scheme']; if ($scheme == '') { //only www part $url = 'http://' . $url; } ?> <a href="<?php echo $url; ?> " title="<?php echo $link['naziv']; ?> " target="_blank"><?php echo filtered_output_string($link[naziv]); ?> </a> </td> </tr> <?php if ($link['opis'] != '') { ?> <tr> <th width="200" align="left" valign="top" scope="row">Opis</th> <td width="490" align="left" valign="top"><?php echo filtered_output_string($link['opis']); ?> </td> </tr> <?php } //opis ?> </table> <?php } //foreach link $numrows = getCountLinksForProject($project[id]); $maxPage = ceil($numrows / $rowsPerPage); $self = $linkPrefix; if ($maxPage > 0) { echo "<span class=\"newsPages\">"; if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"{$self}&page={$page}\">[Prethodna]</a> "; $first = " <a href=\"{$self}&page=1\">[Prva]</a> "; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"{$self}&page={$page}\">[Sljedeća]</a> "; $last = " <a href=\"{$self}&page={$maxPage}\">[Zadnja]</a> "; } echo $first . $prev . " Strana <strong>{$pageNum}</strong> od ukupno <strong>{$maxPage}</strong> " . $next . $last; echo "</span>"; //newsPages span } } else { if ($subaction == 'add') { if (!isset($_REQUEST['submit'])) { ?> <h3>Novi link</h3> <?php print genform("POST", "addForm"); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naziv *</span> <span class="formw"><input name="naziv" type="text" id="naziv" size="70" /></span> </div> <div class="row"> <span class="label">URL *</span> <span class="formw"><input name="url" type="text" id="url" size="70" /></span> </div> <div class="row"> <span class="label">Opis</span> <span class="formw"><textarea name="opis" cols="60" rows="15" wrap="physical" id="opis"></textarea></span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_links('add'); if ($errorText == '') { nicemessage('Novi link uspješno dodan.'); zamgerlog("dodao link na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("dodao link na projektu", $projekat); $link = $linkPrefix; } else { niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'edit') { if (!isUserAuthorOfLink($id, $userid)) { return; } //edit item if (!isset($_REQUEST['submit'])) { $entry = getLink($id); ?> <h3>Uredi link</h3> <?php print genform("POST", "editForm"); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naziv *</span> <span class="formw"><input name="naziv" type="text" id="naziv" size="70" value="<?php echo $entry['naziv']; ?> " /></span> </div> <div class="row"> <span class="label">URL *</span> <span class="formw"><input name="url" type="text" id="url" size="70" value="<?php echo $entry['url']; ?> " /></span> </div> <div class="row"> <span class="label">Opis</span> <span class="formw"><textarea name="opis" cols="60" rows="15" wrap="physical" id="opis"><?php echo $entry['opis']; ?> </textarea></span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_links('edit'); if ($errorText == '') { nicemessage('Uspješno ste uredili link.'); zamgerlog("uredio link na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("uredio link na projektu", $projekat); $link = $linkPrefix; } else { //an error occured trying to process the form niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'del') { if (!isUserAuthorOfLink($id, $userid)) { return; } //delete item if (isset($id) && is_int($id) && $id > 0) { if (!isset($_REQUEST['c'])) { echo "Da li ste sigurni da zelite obrisati ovaj link?<br />"; echo '<a href="' . $linkPrefix . '&subaction=del&id=' . $id . '&c=true">Da</a> | <a href="' . $linkPrefix . '">Odustani</a>'; } else { if ($_REQUEST['c'] == 'true') { //delete the record if (deleteLink($id)) { nicemessage('Uspješno ste obrisali link.'); zamgerlog("obrisao link na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("obrisao link na projektu", $projekat); $link = $linkPrefix; } else { niceerror('Doslo je do greske prilikom brisanja linka. Molimo kontaktirajte administratora.'); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } } //else isset c get parameter } //id is okay } //subaction == del } //subaction set } elseif ($section == 'rss') { //links management $linkPrefix .= '§ion=rss'; ?> <h2>RSS feedovi</h2> <div class="links clearfix" id="rss"> <ul> <li><a href="<?php echo $linkPrefix; ?> ">Lista RSS feedova</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=add"; ?> ">Novi RSS feed</a></li> </ul> </div> <?php if (!isset($subaction)) { $rowsPerPage = 20; $pageNum = 1; if (isset($_REQUEST['page'])) { $pageNum = $_REQUEST['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; //display links for this project, with links to edit and delete $feeds = fetchRSSForProject($project[id], $offset, $rowsPerPage); foreach ($feeds as $link) { if (isUserAuthorOfRSS($link[id], $userid)) { ?> <div class="links clearfix" id="rss"> <ul> <li><a href="<?php echo $linkPrefix . "&subaction=edit&id={$link['id']}"; ?> ">Uredi</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=del&id={$link['id']}"; ?> ">Briši</a></li> </ul> </div> <?php } //if user is author of this item ?> <table class="rss" border="0" cellspacing="0" cellpadding="2"> <tr> <th width="200" align="left" valign="top" scope="row">URL</th> <td width="490" align="left" valign="top"> <?php $url = $link[url]; $scheme = parse_url($url); $scheme = $scheme['scheme']; if ($scheme == '') { //only www part $url = 'http://' . $url; } ?> <a href="<?php echo $url; ?> " title="<?php echo $link['naziv']; ?> " target="_blank"><?php echo filtered_output_string($link[naziv]); ?> </a> </td> </tr> <?php if ($link['opis'] != '') { ?> <tr> <th width="200" align="left" valign="top" scope="row">Opis</th> <td width="490" align="left" valign="top"><?php echo filtered_output_string($link['opis']); ?> </td> </tr> <?php } //opis ?> <tr> <td colspan="2"> <?php global $conf_files_path; //Ukljucimo koristenje globalne varijable koja pokazuje na privatni direktorij sa datotekama koji nije dostupan preko weba $hashfromURL = hash("md5", $url); $cachefile = ""; //Provjeri postojanost $conf_files_path/cache/rss direktorija if (file_exists($conf_files_path . "/cache")) { if (!file_exists($conf_files_path . "/cache/rss")) { mkdir($conf_files_path . "/cache/rss"); } $cachefile = $conf_files_path . "/cache/rss/" . $hashfromURL . ".html"; } else { if (mkdir($conf_files_path . "/cache")) { if (mkdir($conf_files_path . "/cache/rss/")) { $cachefile = $conf_files_path . "/cache/rss/" . $hashfromURL . ".html"; } } } $cachetime = 5 * 60; //5 minuta TODO:Pri deployment-u povecati na sat-dva. //Serviraj is kesha ako je mladji od $cachetime if (file_exists($cachefile) && time() - filemtime($cachefile) < $cachetime) { include $cachefile; print "RSS ucitan iz kesha!"; } else { //Ucitaj RSS ponovo $XMLfilename = $url; //Pocni dump buffera ob_start(); include "lib/rss2html.php"; //HTML parsiran sadrzaj RSS-a //Otvori kesh fajl za pisanje $fp = fopen($cachefile, 'w'); //Sacuvaj sadrzaj izlaznog buffer-a u fajl fwrite($fp, ob_get_contents()); //zatvori fajl fclose($fp); //Posalji izlaz na browser ob_end_flush(); print "RSS osvjezen - feed ponovo ucitan!"; } ?> </td> </tr> </table> <?php } //foreach link $numrows = getCountRSSForProject($project[id]); $maxPage = ceil($numrows / $rowsPerPage); $self = $linkPrefix; if ($maxPage > 0) { echo "<span class=\"newsPages\">"; if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"{$self}&page={$page}\">[Prethodna]</a> "; $first = " <a href=\"{$self}&page=1\">[Prva]</a> "; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"{$self}&page={$page}\">[Sljedeća]</a> "; $last = " <a href=\"{$self}&page={$maxPage}\">[Zadnja]</a> "; } echo $first . $prev . " Strana <strong>{$pageNum}</strong> od ukupno <strong>{$maxPage}</strong> " . $next . $last; echo "</span>"; //newsPages span } } else { if ($subaction == 'add') { if (!isset($_REQUEST['submit'])) { ?> <h3>Novi RSS feed</h3> <?php print genform("POST", "addForm"); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naziv *</span> <span class="formw"><input name="naziv" type="text" id="naziv" size="70" /></span> </div> <div class="row"> <span class="label">URL *</span> <span class="formw"><input name="url" type="text" id="url" size="70" /></span> </div> <div class="row"> <span class="label">Opis</span> <span class="formw"><textarea name="opis" cols="60" rows="15" wrap="physical" id="opis"></textarea></span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_rss('add'); if ($errorText == '') { nicemessage('Novi RSS feed uspješno dodan.'); zamgerlog("dodao novi rss feed na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("dodao rss feed na projektu", $projekat); $link = $linkPrefix; } else { niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'edit') { if (!isUserAuthorOfRSS($id, $userid)) { return; } //edit item if (!isset($_REQUEST['submit'])) { $entry = getRSS($id); ?> <h3>Uredi RSS feed</h3> <?php print genform("POST", "editForm"); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naziv *</span> <span class="formw"><input name="naziv" type="text" id="naziv" size="70" value="<?php echo $entry['naziv']; ?> " /></span> </div> <div class="row"> <span class="label">URL *</span> <span class="formw"><input name="url" type="text" id="url" size="70" value="<?php echo $entry['url']; ?> " /></span> </div> <div class="row"> <span class="label">Opis</span> <span class="formw"><textarea name="opis" cols="60" rows="15" wrap="physical" id="opis"><?php echo $entry['opis']; ?> </textarea></span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_rss('edit'); if ($errorText == '') { nicemessage('Uspješno ste uredili RSS feed.'); zamgerlog("uredio rss feed na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("uredio rss feed na projektu", $projekat); $link = $linkPrefix; } else { //an error occured trying to process the form niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'del') { if (!isUserAuthorOfRSS($id, $userid)) { return; } //delete item if (isset($id) && is_int($id) && $id > 0) { if (!isset($_REQUEST['c'])) { echo "Da li ste sigurni da zelite obrisati ovaj RSS feed?<br />"; echo '<a href="' . $linkPrefix . '&subaction=del&id=' . $id . '&c=true">Da</a> | <a href="' . $linkPrefix . '">Odustani</a>'; } else { if ($_REQUEST['c'] == 'true') { //delete the record if (deleteRSS($id)) { nicemessage('Uspješno ste obrisali RSS feed.'); zamgerlog("obrisao rss feed na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("obrisao rss feed na projektu", $projekat); $link = $linkPrefix; } else { niceerror('Doslo je do greske prilikom brisanja RSS feeda. Molimo kontaktirajte administratora.'); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } } //else isset c get parameter } //id is okay } //subaction == del } //subaction set } elseif ($section == 'bl') { //links management $linkPrefix .= '§ion=bl'; ?> <h2>Članci</h2> <div class="links clearfix" id="bl"> <ul> <li><a href="<?php echo $linkPrefix; ?> ">Lista članaka</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=add"; ?> ">Novi članak</a></li> </ul> </div> <?php if (!isset($subaction)) { $rowsPerPage = 20; $pageNum = 1; if (isset($_REQUEST['page'])) { $pageNum = $_REQUEST['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $articles = fetchArticlesForProject($project[id], $offset, $rowsPerPage); foreach ($articles as $article) { ?> <div class="article_summary clearfix"> <?php if (!empty($article[slika])) { ?> <div class="imgCont"> <a href="<?php echo "index.php?sta=common/articleImageDownload&projekat={$projekat}&predmet={$predmet}&ag={$ag}&a={$article['id']}&u={$article['osoba']}&i={$article['slika']}"; ?> " target="_blank"> <img src="<?php echo "index.php?sta=common/articleImageDownload&projekat={$projekat}&predmet={$predmet}&ag={$ag}&a={$article['id']}&u={$article['osoba']}&i={$article['slika']}"; ?> " /> </a> </div> <?php } ?> <div class="contentCont" <?php if (empty($article[slika])) { echo 'style="margin-left: 0;"'; } ?> > <h1> <a href="<?php echo $linkPrefix . "&subaction=view&id={$article['id']}"; ?> " title="<?php echo $article['naslov']; ?> "><?php echo filtered_output_string($article['naslov']); ?> </a> </h1> <div class="details"> <?php $author = getAuthorOfArticle($article[id]); ?> Autor: <?php echo filtered_output_string($author[ime] . ' ' . $author[prezime]); ?> <br /> Datum: <?php echo date('d.m.Y', strtotime($article[vrijeme])); ?> </div><!--details--> <?php if (isUserAuthorOfArticle($article[id], $userid) == true) { ?> <div class="buttons"> <a href="<?php echo $linkPrefix . "&subaction=edit&id={$article['id']}"; ?> " title="Uredi ovaj članak">Uredi</a> | <a href="<?php echo $linkPrefix . "&subaction=del&id={$article['id']}"; ?> " title="Briši ovaj članak">Briši</a> </div><!--buttons--> <?php } ?> <div class="text"> <?php $len = strlen($article[tekst]); if (!empty($article[slika])) { $maxLen = 400; } else { $maxLen = 800; } echo filtered_output_string(substr($article['tekst'], 0, $maxLen - 1)); if ($len > $maxLen) { echo '...'; } ?> </div><!--text--> </div><!--contentCont--> </div><!--article_summary--> <?php } //foreach article $numrows = getCountArticlesForProject($project[id]); $maxPage = ceil($numrows / $rowsPerPage); $self = $linkPrefix; if ($maxPage > 0) { echo "<span class=\"newsPages\">"; if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"{$self}&page={$page}\">[Prethodna]</a> "; $first = " <a href=\"{$self}&page=1\">[Prva]</a> "; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"{$self}&page={$page}\">[Sljedeća]</a> "; $last = " <a href=\"{$self}&page={$maxPage}\">[Zadnja]</a> "; } echo $first . $prev . " Strana <strong>{$pageNum}</strong> od ukupno <strong>{$maxPage}</strong> " . $next . $last; echo "</span>"; //newsPages span } } else { if ($subaction == 'view') { $article = getArticle($id); if (empty($article)) { zamgerlog("projektne strane: nepostojeci clanak sa IDom {$id}, projekat {$projekat} (pp{$predmet}, ag{$ag})", 3); zamgerlog2("nepostojeci clanak na projektu", $id, $projekat); return; } ?> <div class="article_full clearfix"> <div class="contentCont clearfix"> <h1> <a href="<?php echo $linkPrefix . "?subaction=view&id={$article['id']}"; ?> " title="<?php echo $article['naslov']; ?> "><?php echo filtered_output_string($article['naslov']); ?> </a> </h1> <div class="details"> <?php $author = getAuthorOfArticle($article[id]); ?> Autor: <?php echo filtered_output_string($author[ime] . ' ' . $author[prezime]); ?> <br /> Datum: <?php echo date('d.m.Y', strtotime($article[vrijeme])); ?> </div><!--details--> <?php if (isUserAuthorOfArticle($article[id], $userid) == true) { ?> <div class="buttons"> <a href="<?php echo $linkPrefix . "&subaction=edit&id={$article['id']}"; ?> " title="Uredi ovaj članak">Uredi</a> | <a href="<?php echo $linkPrefix . "&subaction=del&id={$article['id']}"; ?> " title="Briši ovaj članak">Briši</a> </div><!--buttons--> <?php } ?> <?php if (!empty($article[slika])) { ?> <div class="imgCont"> <a href="<?php echo "index.php?sta=common/articleImageDownload&projekat={$projekat}&predmet={$predmet}&ag={$ag}&a={$article['id']}&u={$article['osoba']}&i={$article['slika']}"; ?> " target="_blank"> <img src="<?php echo "index.php?sta=common/articleImageDownload&projekat={$projekat}&predmet={$predmet}&ag={$ag}&a={$article['id']}&u={$article['osoba']}&i={$article['slika']}"; ?> " /> </a> </div> <?php } ?> <div class="text"><?php echo filtered_output_string($article['tekst']); ?> </div><!--text--> </div><!--contentCont--> </div><!--article_full--> <a id="backLink" href="<?php echo $linkPrefix; ?> ">Povratak na listu članaka</a> <?php } elseif ($subaction == 'add') { if (!isset($_REQUEST['submit'])) { ?> <h3>Novi članak</h3> <?php print genform("POST", "addForm\" enctype=\"multipart/form-data\" "); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naslov *</span> <span class="formw"><input name="naslov" type="text" id="naslov" size="70" /></span> </div> <div class="row"> <span class="label">Tekst</span> <span class="formw"><textarea name="tekst" cols="60" rows="15" wrap="physical" id="tekst"></textarea></span> </div> <div class="row"> <span class="label">Slika</span> <span class="formw"> <input name="image" type="file" id="image" size="60" /> </span><br /><br /> Dozvoljeni tipovi slike: jpg, jpeg, gif, png <br /> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_bl('add'); if ($errorText == '') { nicemessage('Novi članak uspješno dodan.'); zamgerlog("dodao novi clanak na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("dodao clanak na projektu", $projekat); $link = $linkPrefix; } else { niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'edit') { if (!isUserAuthorOfArticle($id, $userid)) { return; } //edit item if (!isset($_REQUEST['submit'])) { $entry = getArticle($id); ?> <h3>Uredi članak</h3> <?php print genform("POST", "editForm\" enctype=\"multipart/form-data\" "); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naslov *</span> <span class="formw"><input name="naslov" type="text" id="naslov" size="70" value="<?php echo $entry['naslov']; ?> " /></span> </div> <div class="row"> <span class="label">Tekst</span> <span class="formw"><textarea name="tekst" cols="60" rows="15" wrap="physical" id="tekst"><?php echo $entry['tekst']; ?> </textarea></span> </div> <?php if ($entry['slika'] != '') { //if the image exists, display it ?> <div class="row"> <span class="label">Trenutna slika</span> <span class="formw"><img src="<?php echo "index.php?sta=common/articleImageDownload&projekat={$projekat}&predmet={$predmet}&ag={$ag}&a={$article['id']}&u={$entry['osoba']}&i={$entry['slika']}"; ?> " /> </span> </div> <div class="row"> <span class="label">Briši sliku</span> <span class="formw"><input name="delete" type="checkbox" id="delete" value="delete" /></span> </div> <?php } //if image is present ?> <div class="row"> <span class="label"><?php if ($entry['slika'] != '') { echo "ILI: Zamijeni sliku"; } else { echo "Slika"; } ?> </span> <span class="formw"> <input name="image" type="file" id="image" size="50" /> </span><br /><br /> Dozvoljeni tipovi slike: jpg, jpeg, gif, png <br /> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_bl('edit'); if ($errorText == '') { nicemessage('Uspješno ste uredili članak.'); zamgerlog("uredio clanak na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("uredio clanak na projektu", $projekat); $link = $linkPrefix; } else { //an error occured trying to process the form niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'del') { //delete item if (isset($id) && is_int($id) && $id > 0) { if (isUserAuthorOfArticle($id, $userid) == false) { return; } if (!isset($_REQUEST['c'])) { echo "Da li ste sigurni da zelite obrisati ovaj članak? <br />"; echo '<a href="' . $linkPrefix . '&subaction=del&id=' . $id . '&c=true">Da</a> | <a href="' . $linkPrefix . '">Odustani</a>'; } else { if ($_REQUEST['c'] == 'true') { //delete the record if (deleteArticle($id)) { nicemessage('Uspješno ste obrisali članak.'); zamgerlog("obrisao clanak na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("obrisao clanak na projektu", $projekat); $link = $linkPrefix; } else { niceerror('Došlo je do greske prilikom brisanja članka. Molimo kontaktirajte administratora.'); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } } //else isset c get parameter } //id is okay } //subaction == del } //subaction set } elseif ($section == 'file') { //files management $linkPrefix .= '§ion=file'; ?> <h2>Fajlovi</h2> <div class="links clearfix" id="rss"> <ul> <li><a href="<?php echo $linkPrefix; ?> ">Lista fajlova</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=add"; ?> ">Novi fajl</a></li> </ul> </div> <?php if (!isset($subaction)) { $rowsPerPage = 20; $pageNum = 1; if (isset($_REQUEST['page'])) { $pageNum = $_REQUEST['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; //display files for this project, with links to edit and delete $files = fetchFilesForProjectAllRevisions($project[id], $offset, $rowsPerPage); ?> <table class="files_table" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col" class="creation_date">Datum kreiranja</th> <th scope="col" class="author">Autor</th> <th scope="col" class="revision">Revizija</th> <th scope="col" class="name">Naziv</th> <th scope="col" class="filesize">Veličina</th> <th scope="col" class="options">Opcije</th> </tr> <?php foreach ($files as $file) { $lastRevisionId = 0; $firstRevisionId = count($file) > 0 ? count($file) - 1 : 0; $author = getAuthorOfFile($file[$lastRevisionId][id]); ?> <tr> <td class="creation_date"><?php echo date('d.m.Y H:i:s', mysql2time($file[$lastRevisionId][vrijeme])); ?> </td><!--vrijeme--> <td class="author"><?php echo filtered_output_string($author['ime'] . ' ' . $author['prezime']); ?> </td><!--author--> <td class="revision">v<?php echo $file[$lastRevisionId][revizija]; ?> </td><!--revizija--> <td class="filename"><?php if (count($file) > 1) { ?> <a href="#" onclick="toggleFileRevisions('file_<?php echo $file[$lastRevisionId][id]; ?> _revisions')"><?php echo filtered_output_string($file[$lastRevisionId][filename]); ?> </a> <?php } else { ?> <?php echo filtered_output_string($file[$lastRevisionId][filename]); ?> <?php } ?> </td><!--filename--> <td class="filesize"><?php $lokacijafajlova = "{$conf_files_path}/projekti/fajlovi/{$projekat}/" . $file[$lastRevisionId][osoba] . "/" . $file[$lastRevisionId][filename] . '/v' . $file[$lastRevisionId][revizija] . '/'; $filepath = $lokacijafajlova . $file[$lastRevisionId][filename]; $filesize = filesize($filepath); echo nicesize($filesize); ?> </td><!--filesize--> <td class="options"> <a href="<?php echo 'index.php?sta=common/attachment' . "&tip=projekat&projekat={$projekat}&id=" . $file[$lastRevisionId][id]; ?> ">Snimi</a> <?php if (isUserAuthorOfFile($file[$lastRevisionId][id], $userid)) { ?> <a href="<?php echo $linkPrefix . "&subaction=edit&id=" . $file[$firstRevisionId]['id']; ?> ">Uredi</a> <a href="<?php echo $linkPrefix . "&subaction=del&id=" . $file[$firstRevisionId]['id']; ?> ">Briši</a> <?php } //if user is author of this item ?> </td><!--options--> </tr><!--file_leading--> <?php if (count($file) > 1) { for ($i = 1; $i < count($file); $i++) { $revision = $file[$i]; $author = getAuthorOfFile($revision[id]); ?> <tr class="file_<?php echo $file[$lastRevisionId][id]; ?> _revisions" style="display: none;" id="file_revisions"> <td class="creation_date"><?php echo date('d.m.Y H:i:s', mysql2time($revision[vrijeme])); ?> </td><!--vrijeme--> <td class="author"><?php echo filtered_output_string($author['ime'] . ' ' . $author['prezime']); ?> </td><!--author--> <td class="revision">v<?php echo $revision[revizija]; ?> </td><!--revizija--> <td class="filename"><?php echo filtered_output_string($revision[filename]); ?> </td><!--filename--> <td class="filesize"><?php $lokacijafajlova = "{$conf_files_path}/projekti/fajlovi/{$projekat}/" . $revision[osoba] . "/" . $revision[filename] . '/v' . $revision[revizija] . '/'; $filepath = $lokacijafajlova . $revision[filename]; $filesize = filesize($filepath); echo nicesize($filesize); ?> </td><!--filesize--> <td class="options"> <a href="<?php echo 'index.php?sta=common/attachment' . "&tip=projekat&projekat={$projekat}&id=" . $revision[id]; ?> ">Snimi</a> </td><!--options--> </tr><!--file_revision--> <?php } //foreach revision } //if count files > 1 } //foreach file ?> </table> <!--files_table--> <?php $numrows = getCountFilesForProjectWithoutRevisions($project[id]); $maxPage = ceil($numrows / $rowsPerPage); $self = $linkPrefix; if ($maxPage > 0) { echo "<span class=\"newsPages\">"; if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"{$self}&page={$page}\">[Prethodna]</a> "; $first = " <a href=\"{$self}&page=1\">[Prva]</a> "; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"{$self}&page={$page}\">[Sljedeća]</a> "; $last = " <a href=\"{$self}&page={$maxPage}\">[Zadnja]</a> "; } echo $first . $prev . " Strana <strong>{$pageNum}</strong> od ukupno <strong>{$maxPage}</strong> " . $next . $last; echo "</span>"; //newsPages span } ?> <script type="text/javascript"> function getElementsByClassName( strClassName, obj ) { var ar = arguments[2] || new Array(); var re = new RegExp("\\b" + strClassName + "\\b", "g"); if ( re.test(obj.className) ) { ar.push( obj ); } for ( var i = 0; i < obj.childNodes.length; i++ ) getElementsByClassName( strClassName, obj.childNodes[i], ar ); return ar; } function toggleFileRevisions(divID) { var aryClassElements = getElementsByClassName( divID, document.body ); for ( var i = 0; i < aryClassElements.length; i++ ) { if (aryClassElements[i].style.display == '') aryClassElements[i].style.display = 'none'; else aryClassElements[i].style.display = ''; } } </script> <?php } else { if ($subaction == 'add') { if (!isset($_REQUEST['submit'])) { ?> <h3>Novi fajl</h3> <?php print genform("POST", "addForm\" enctype=\"multipart/form-data\" "); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <b>Limit za upload je 20MB.</b> <br /> <div class="row"> <span class="label">Fajl *</span> <span class="formw"> <input name="filename" type="file" id="filename" size="60" /> <input type="hidden" name="MAX_FILE_SIZE" value="20971520"> </span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_file('add'); if ($errorText == '') { nicemessage('Novi fajl uspješno dodan.'); zamgerlog("dodao novi fajl na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("dodao fajl na projektu", $projekat); $link = $linkPrefix; } else { niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'edit') { if (!isUserAuthorOfFile($id, $userid)) { return; } if (!isThisFileFirstRevision($id)) { return; } //edit item if (!isset($_REQUEST['submit'])) { $entry = getFileFirstRevision($id); $lastRevisionEntry = getFileLastRevision($id); ?> <h3>Uredi fajl</h3> <?php print genform("POST", "editForm\" enctype=\"multipart/form-data\" "); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <b>Limit za upload je 20MB.</b> <br /> <div class="row"> <span class="label">Trenutni fajl</span> <span class="formw"><a href="<?php echo 'index.php?sta=common/attachment' . "&tip=projekat&projekat={$projekat}&id=" . $lastRevisionEntry[id]; ?> " > <?php echo filtered_output_string($lastRevisionEntry[filename]); ?> </a> </span> </div> <div class="row"> <span class="label">Zamijeni fajl</span> <span class="formw"> <input name="filename" type="file" id="filename" size="50" /> <input type="hidden" name="MAX_FILE_SIZE" value="20971520"> </span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_file('edit'); if ($errorText == '') { nicemessage('Uspješno ste uredili fajl.'); zamgerlog("uredio fajl na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("uredio fajl na projektu", $projekat); $link = $linkPrefix; } else { //an error occured trying to process the form niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'del') { if (!isUserAuthorOfFile($id, $userid)) { return; } if (!isThisFileFirstRevision($id)) { return; } //delete item if (isset($id) && is_int($id) && $id > 0) { if (!isset($_REQUEST['c'])) { echo "Da li ste sigurni da zelite obrisati ovaj fajl? Obrisacete sve revizije fajla sa servera.<br />"; echo '<a href="' . $linkPrefix . '&subaction=del&id=' . $id . '&c=true">Da</a> | <a href="' . $linkPrefix . '">Odustani</a>'; } else { if ($_REQUEST['c'] == 'true') { //delete the record if (deleteFile($id)) { nicemessage('Uspješno ste obrisali fajl.'); zamgerlog("obrisao fajl na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("obrisao fajl na projektu", $projekat); $link = $linkPrefix; } else { niceerror('Doslo je do greske prilikom brisanja fajla. Molimo kontaktirajte administratora.'); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } } //else isset c get parameter } //id is okay } //subaction == del } //subaction set } elseif ($section == 'bb') { //links management $linkPrefix .= '§ion=bb'; ?> <h2>Grupa za diskusiju</h2> <div class="links clearfix" id="bl"> <ul> <li><a href="<?php echo $linkPrefix; ?> ">Lista tema</a></li> <li><a href="<?php echo $linkPrefix . "&subaction=add"; ?> ">Nova tema</a></li> </ul> </div> <?php if (!isset($subaction)) { $rowsPerPage = 20; $pageNum = 1; if (isset($_REQUEST['page'])) { $pageNum = $_REQUEST['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $threads = fetchThreadsForProject($project[id], $offset, $rowsPerPage); $numrows = getCountThreadsForProject($project[id]); ?> <div id="threadList"> <div class="threadRow caption clearfix"> <div class="threadInfo"> <div class="views">Pregleda</div><!--views--> <div class="lastReply">Zadnji odgovor</div><!--lastReply--> <div class="replies">Odgovora</div><!--replies--> </div><!--threadInfo--> <div class="title">Teme (<?php echo $numrows; ?> )</div><!--title--> </div><!--threadRow caption--> <?php foreach ($threads as $key => $thread) { ?> <div class="threadRow clearfix<?php if ($key % 2) { echo ' pattern'; } ?> "> <div class="threadInfo"> <div class="views"><?php echo intval($thread[pregleda]); ?> </div><!--views--> <div class="lastReply"><?php echo date('d.m.Y H:i:s', mysql2time($thread[zadnji_post][vrijeme])); ?> <br /><?php echo filtered_output_string($thread[zadnji_post][osoba][prezime] . ' ' . $thread[zadnji_post][osoba][ime]); ?> </div><!--lastReply--> <div class="replies"><?php echo intval($thread[broj_odgovora]); ?> </div><!--replies--> </div><!--threadInfo--> <div class="title"><a href="<?php echo $linkPrefix . "&subaction=view&tid={$thread['id']}"; ?> " title="<?php echo $thread['naslov']; ?> "><?php echo filtered_output_string($thread[naslov]); ?> </a></div><!--title--> <div class="author"><?php echo filtered_output_string($thread[prvi_post][osoba][prezime] . ' ' . $thread[prvi_post][osoba][ime]); ?> </div><!--author--> </div><!--threadRow caption--> <?php } //foreach thread ?> </div><!--threadList--> <?php $maxPage = ceil($numrows / $rowsPerPage); $self = $linkPrefix; if ($maxPage > 0) { echo "<span class=\"newsPages\">"; if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"{$self}&page={$page}\">[Prethodna]</a> "; $first = " <a href=\"{$self}&page=1\">[Prva]</a> "; } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"{$self}&page={$page}\">[Sljedeća]</a> "; $last = " <a href=\"{$self}&page={$maxPage}\">[Zadnja]</a> "; } echo $first . $prev . " Strana <strong>{$pageNum}</strong> od ukupno <strong>{$maxPage}</strong> " . $next . $last; echo "</span>"; //newsPages span } } else { if ($subaction == 'view') { $tid = intval($_REQUEST[tid]); $thread = getThreadAndPosts($tid); if (empty($thread)) { zamgerlog("projektne strane: nepostojeci thread sa IDom {$id}, projekat {$projekat} (pp{$predmet}, ag{$ag})", 3); zamgerlog2("nepostojeci thread na projektu", $id, $projekat); return; } incrementThreadViewCount($thread[id]); ?> <div id="fullThread"> <?php foreach ($thread[posts] as $post) { ?> <div class="post"><a name="p<?php echo $post[id]; ?> "> <div id="post_<?php echo $post[id]; ?> _header" class="header clearfix" onclick="toggleShowPost('post_<?php echo $post[id]; ?> ')"> <div class="buttons"> <a href="<?php echo $linkPrefix . "&subaction=add&tid={$post['tema']}&id={$post['id']}"; ?> " title="Odgovori na ovaj post">Odgovori</a> <?php if (isUserAuthorOfPost($post[id], $userid) == true) { ?> | <a href="<?php echo $linkPrefix . "&subaction=edit&tid={$post['tema']}&id={$post['id']}"; ?> " title="Uredi vlastiti post">Uredi</a> | <a href="<?php echo $linkPrefix . "&subaction=del&tid={$post['tema']}&id={$post['id']}"; ?> " title="Obriši vlastiti post">Obriši</a> <?php } ?> </div> <div class="maininfo"> <div class="date"><?php echo date('d.m.Y H:i:s', mysql2time($post[vrijeme])); ?> </div> <div class="author"><?php echo filtered_output_string($post[osoba][prezime] . ' ' . $post[osoba][ime]); ?> </div> - <div class="title"><?php echo filtered_output_string($post[naslov]); ?> </div> </div> </div><!--header--> <div class="text" id="post_<?php echo $post[id]; ?> _text"><?php echo filtered_output_string($post[tekst]); ?> </div><!--text--> </div><!--post--> <?php } //foreach post ?> </div><!--fullThread--> <script type="text/javascript"> function toggleShowPost(divID) { header = document.getElementById(divID + '_header'); text = document.getElementById(divID + '_text'); if (text.style.display == 'block' || text.style.display == '') { text.style.display = 'none'; header.style.backgroundColor = '#F5F5F5'; header.style.color = 'black'; } else { text.style.display = 'block'; header.style.backgroundColor = '#EEEEEE'; } } </script> <?php } elseif ($subaction == 'add') { $threadID = intval($_REQUEST['tid']); if ($threadID <= 0) { $thread = false; } else { $thread = true; } if ($thread == true) { $postInfo = getPostInfoForThread($threadID, $id); $extendedThreadInfo = array(); getExtendedInfoForThread($threadID, $extendedThreadInfo); if (empty($postInfo)) { zamgerlog("projektne strane: odgovor na nepostojeci post {$id}, projekat {$projekat} (pp{$predmet})", 3); zamgerlog2("odgovor na nepostojeci post na projektu", $id, $projekat); return; } } if (!isset($_REQUEST['submit'])) { ?> <h3><?php if ($thread == true) { echo 'Novi odgovor'; } else { echo 'Nova tema'; } ?> </h3> <?php print genform("POST", "addForm"); ?> <?php if ($thread == true) { ?> <input type="hidden" name="tid" value="<?php echo $threadID; ?> " /> <?php } ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naslov *</span> <span class="formw"><input name="naslov" type="text" id="naslov" size="70" <?php if ($thread == true) { ?> value="RE: <?php echo $extendedThreadInfo['naslov']; ?> "<?php } ?> /></span> </div> <div class="row"> <span class="label">Tekst *</span> <span class="formw"><textarea name="tekst" cols="60" rows="15" wrap="physical" id="tekst"></textarea></span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_bb('add', $thread, $threadID); if ($errorText == '') { if ($thread == true) { nicemessage('Novi odgovor uspješno dodan.'); zamgerlog("dodao novi odgovor na diskusiju ID {$threadID}, projekat {$projekat} (pp{$predmet})", 2); zamgerlog2("dodao odgovor na diskusiju", $threadID, $projekat); } else { nicemessage('Nova tema uspješno dodana.'); zamgerlog("dodao novu temu na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("dodao temu na projektu", $projekat); } if (!empty($_REQUEST[tid])) { $link = $linkPrefix . "&subaction=view&tid={$_REQUEST['tid']}"; } else { $link = $linkPrefix; } } else { niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'edit') { //edit item if (isUserAuthorOfPost($id, $userid) == false) { zamgerlog("pokusava urediti post {$id} a nije autor, projekat {$projekat} (pp{$predmet})", 3); zamgerlog2("pokusava urediti post a nije autor", $id, $projekat); return; } $threadID = intval($_REQUEST[tid]); if ($threadID <= 0) { zamgerlog("pokusava urediti nepostojeci post {$id}, projekat {$projekat} (pp{$predmet})", 3); zamgerlog2("pokusava urediti nepostojeci post", $id, $projekat); return; } if (!isset($_REQUEST['submit'])) { $entry = getPost($id); if (empty($entry)) { zamgerlog("pokusava urediti nepostojeci post {$id}, projekat {$projekat} (pp{$predmet})", 3); zamgerlog2("pokusava urediti nepostojeci post", $id, $projekat); return; } ?> <h3>Uredi post</h3> <?php print genform("POST", "editForm"); ?> <div id="formDiv"> Polja sa * su obavezna. <br /> <div class="row"> <span class="label">Naslov *</span> <span class="formw"><input name="naslov" type="text" id="naslov" size="70" value="<?php echo $entry['naslov']; ?> " /></span> </div> <div class="row"> <span class="label">Tekst *</span> <span class="formw"><textarea name="tekst" cols="60" rows="15" wrap="physical" id="tekst"><?php echo $entry['tekst']; ?> </textarea></span> </div> <div class="row"> <span class="formw" style="margin-left:150px;"><input name="submit" type="submit" id="submit" value="Potvrdi"/></span> </div> </div><!--formDiv--> </form> <?php } else { $errorText = formProcess_bb('edit', $thread, $threadID); if ($errorText == '') { nicemessage('Uspješno ste uredili post.'); zamgerlog("uredio vlastiti BB post {$id}, projekat {$projekat} (pp{$predmet})", 2); zamgerlog2("uredio vlastiti post", $id, $projekat); $link = $linkPrefix . "&subaction=view&tid={$_REQUEST['tid']}"; } else { //an error occured trying to process the form niceerror($errorText); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } //submitted the form } elseif ($subaction == 'del') { //delete item if (isset($id) && is_int($id) && $id > 0) { if (isUserAuthorOfPost($id, $userid) == false) { zamgerlog("pokusava izbrisati post {$id} a nije autor, projekat {$projekat} (pp{$predmet})", 3); zamgerlog2("pokusava izbrisati post a nije autor", $id, $projekat); return; } $threadID = intval($_REQUEST[tid]); if ($threadID <= 0) { zamgerlog("pokusava izbrisati nepostojeci post {$id}, projekat {$projekat} (pp{$predmet})", 3); zamgerlog2("pokusava izbrisati nepostojeci post", $id, $projekat); return; } if (!isset($_REQUEST['c'])) { echo "Da li ste sigurni da zelite obrisati ovaj post? <br />"; echo '<a href="' . $linkPrefix . '&subaction=del&tid=' . $threadID . '&id=' . $id . '&c=true">Da</a> | <a href="' . $linkPrefix . '">Odustani</a>'; } else { if ($_REQUEST['c'] == 'true') { //delete the record if (deletePost($id)) { nicemessage('Uspješno ste obrisali post.'); zamgerlog("obrisao post na projektu {$projekat} (pp{$predmet})", 2); zamgerlog2("obrisao post na projektu", $projekat); if (getCountPostsInThread($threadID) > 0) { $link = $linkPrefix . "&subaction=view&tid={$_REQUEST['tid']}"; } else { $link = $linkPrefix; } } else { niceerror('Došlo je do greske prilikom brisanja posta. Molimo kontaktirajte administratora.'); $link = "javascript:history.back();"; } nicemessage('<a href="' . $link . '">Povratak.</a>'); } } //else isset c get parameter } //id is okay } //subaction == del } //subaction set } //section == bb (forum) } //else - section is set }
function clean() { global $board, $config; $offset = round($config['max_pages'] * $config['threads_per_page']); // I too wish there was an easier way of doing this... $query = prepare(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset, 9001", $board['uri'])); $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->execute() or error(db_error($query)); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { deletePost($post['id'], false, false); } }
function mod_deletebyip($boardName, $post, $global = false) { global $config, $mod, $board; $global = (bool) $global; if (!openBoard($boardName)) { error($config['error']['noboard']); } if (!$global && !hasPermission($config['mod']['deletebyip'], $boardName)) { error($config['error']['noaccess']); } if ($global && !hasPermission($config['mod']['deletebyip_global'], $boardName)) { error($config['error']['noaccess']); } // Find IP address $query = prepare(sprintf('SELECT `ip` FROM `posts_%s` WHERE `id` = :id', $boardName)); $query->bindValue(':id', $post); $query->execute() or error(db_error($query)); if (!($ip = $query->fetchColumn(0))) { error($config['error']['invalidpost']); } $boards = $global ? listBoards() : array(array('uri' => $boardName)); $query = ''; foreach ($boards as $_board) { $query .= sprintf("SELECT `id`, '%s' AS `board` FROM `posts_%s` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', '', $query); $query = prepare($query); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); if ($query->rowCount() < 1) { error($config['error']['invalidpost']); } $boards = array(); while ($post = $query->fetch()) { openBoard($post['board']); $boards[] = $post['board']; deletePost($post['id'], false); } $boards = array_unique($boards); foreach ($boards as $_board) { openBoard($_board); buildIndex(); } if ($global) { $board = false; } // Record the action modLog("Deleted all posts by IP address: <a href=\"?/IP/{$ip}\">{$ip}</a>"); // Redirect header('Location: ?/' . sprintf($config['board_path'], $boardName) . $config['file_index'], true, $config['redirect_http']); }
<?php /** **author:future *新建百科 */ require_once 'base.php'; require_once 'console.php'; $postid = $_POST['postid']; deletePost($postid); qa_redirect_raw('console_page.php');
*/ // now it may be an idea to do a if(!defined('IN_BBLOG')) die "hacking attempt" type thing but // i'm not sure it's needed, as without this file being included it hasn't connected to the // database, and all the functions it calls are in the $loq object. function identify_admin_archives() { return array('name' => 'archives', 'type' => 'builtin', 'nicename' => 'Archives Admin', 'description' => 'Edit archives', 'authors' => 'Eaden McKee, Tobias Schlottke', 'licence' => 'GPL', 'help' => ''); } $loq->assign('form_type', 'edit'); $loq->get_modifiers(); $actions = array('delete', 'edit', 'postedit', 'filter', 'allowcomments'); if (isset($_POST['action']) && in_array($_POST['action'], $actions)) { $postid = intval($_POST['postid']); switch ($_POST['action']) { case 'delete': deletePost($loq, $postid); break; case 'edit': editPost($loq, $postid); break; case 'postedit': savePost($loq, $postid); break; case 'filter': filterDisplay($loq); break; case 'allowcomments': allowComments($loq, $postid); break; default: //Unknown - handle this error
print postComment(); } if (isset($_POST['reply'])) { print replyComment(); } if (isset($_POST['profile_pic'])) { print changeProfilePic(); } if (isset($_POST['changeInfo'])) { print changeInfo(); } if (isset($_POST['del_user'])) { deleteUser(); } if (isset($_POST['del_post'])) { print deletePost(); } if (isset($_POST['del_comment'])) { print deleteComment(); } if (isset($_POST['recycle'])) { print recycle(); } if (isset($_POST['follow'])) { print follow(); } if (isset($_POST['unfollow'])) { print follow(); } print '</h3><button type="button" id="hide_btn" class="button">close</button>'; print '</div>';
<?php include 'db-connection.php'; require 'posts.php'; session_start(); $post_id = filter_input(INPUT_POST, 'postId'); $user_id = $_SESSION['user_id']; $status = deletePost($post_id, $user_id); echo $status;
function clean($pid = false) { global $board, $config; $offset = round($config['max_pages'] * $config['threads_per_page']); // I too wish there was an easier way of doing this... $query = prepare(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset, 9001", $board['uri'])); $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->execute() or error(db_error($query)); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { deletePost($post['id'], false, false); if ($pid) { modLog("Automatically deleting thread #{$post['id']} due to new thread #{$pid}"); } } // Bump off threads with X replies earlier, spam prevention method if ($config['early_404']) { $offset = round($config['early_404_page'] * $config['threads_per_page']); $query = prepare(sprintf("SELECT `id` AS `thread_id`, (SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset, 9001", $board['uri'], $board['uri'])); $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->execute() or error(db_error($query)); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { if ($post['reply_count'] < $config['early_404_replies']) { deletePost($post['thread_id'], false, false); if ($pid) { modLog("Automatically deleting thread #{$post['thread_id']} due to new thread #{$pid} (early 404 is set, #{$post['thread_id']} had {$post['reply_count']} replies)"); } } } } }
if ($dbPosts->delete($key)) { // Reindex tags, this function is in 70.posts.php reIndexTagsPosts(); Alert::set($Language->g('The post has been deleted successfully')); Redirect::page('admin', 'manage-posts'); } else { Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the post.'); } } // ============================================================================ // Main before POST // ============================================================================ // ============================================================================ // POST Method // ============================================================================ if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['delete-post'])) { deletePost($_POST['key']); } else { editPost($_POST); } } // ============================================================================ // Main after POST // ============================================================================ if (!$dbPosts->postExists($layout['parameters'])) { Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to get the post: ' . $layout['parameters']); Redirect::page('admin', 'manage-posts'); } $_Post = buildPost($layout['parameters']); $layout['title'] .= ' - ' . $Language->g('Edit post') . ' - ' . $_Post->title();
switch ($op) { case 'new': newForm(); break; case 'edit': newForm(1); break; case 'saveretedit': saveEdited(0); break; case 'saveedit': case 'publishedit': saveEdited(1); break; case 'delete': deletePost(); break; case 'trackbacks': include 'trackbacks.php'; break; case 'waiting': showPosts(0); break; case 'approved': showPosts(1); break; case 'status-waiting': set_posts_status('waiting'); break; case 'status-draft': set_posts_status('draft');
<?php require "php/topbar.php"; ?> <body> <div class="maindiv"> <?php session_start(); require_once "php/database.php"; require_once "php/storedprocedures.php"; require_once "php/error.php"; if (isset($_GET['confirm']) && $_GET['confirm'] == 'Delete') { $db = connectToDatabase(); if ($db) { $info = multigetPostDetails($db, $_SESSION['id'], array($_GET['postid']))[$_GET['postid']]; $results = deletePost($db, $_SESSION['id'], $_GET['postid'], $_SESSION['token']); switch ($results[SP::ERROR]) { case ERR::OK: echo "<p>Post deleted successfully. Back to <a href='threadview.php?threadid=" . $info[POST::THREAD_ID] . "'thread</p>"; break; case ERR::PERMIS_FAIL: echo "<p>You are not permitted to do this.</p>"; break; case ERR::TOKEN_EXPIRED: case ERR::TOKEN_FAIL: case ERR::USER_NO_TOKEN: header("Location: logout.php?error=" . $results[SP::ERROR]); break; default: echo "<p>Error: " . $ERRORS[$results[SP::ERROR]] . "</p>"; break;