Ejemplo n.º 1
0
function login($path, $action, $title, $content)
{
    $content['UserNav']->Active("Login");
    $content['Title'] = "Super Secret Login Form";
    if ($_POST) {
        if ($_POST['Password'] == LOGIN_PASSWORD) {
            $_SESSION['bypass'] = true;
            $content['Body'] = "YOU DID IT FRIEND!!<br /><br />You will now be brought back to your previous page.";
            $content['Body'] .= Redirect(str_replace("//", "/", "/{$path}"));
        } elseif ($_POST['Password'] == ADMIN_PASSWORD) {
            $_SESSION['bypass'] = true;
            $_SESSION['admin'] = true;
            $content['Body'] = "Wow, you're an admin!!<br /><br />You will now be brought back to your previous page.";
            $content['Body'] .= Redirect(str_replace("//", "/", "/{$path}"));
        } else {
            $content['Body'] = "nope";
        }
    } else {
        if (!empty($_SESSION['bypass'])) {
            $content['Body'] .= "<b>Hey, you're already logged in!</b><br>";
        }
        $content['Body'] .= "Protip: The super secret password is the same as the PIBDGAF ichc password.";
        $Form['_Options'] = "action:" . str_replace("//", "/", "/{$path}/?login") . ";";
        $Form['Password']['Text'] = "Password:"******"name:Password; type:password;";
        $Form['Submit']['Form'] = "type:submit; value:Submit;";
        $content['Body'] .= Format($Form, Form);
    }
    return array($title, $content);
}
Ejemplo n.º 2
0
function source($path, $action, $title, $content)
{
    $Head = '<meta name="robots" content="noindex, nofollow" />';
    $content['PageNav']->Active("Page History");
    if (is_numeric($action[1])) {
        $PageQuery = mysql_query("SELECT `AccountID`,`EditTime`,`Name`,`Description`,`Title`,`Content` FROM `Wiki_Edits` WHERE `ID`='{$action['1']}' and `Archived` = 0");
        list($AccountID, $PageEditTime, $PageName, $PageDescription, $PageTitle, $PageContent) = mysql_fetch_array($PageQuery);
        $Form['_Options'] = "action:;";
        $Form['Name']['Text'] = "Name:";
        $Form['Name']['Form'] = "id:Name; name:Name; value:{" . $PageName . "}; maxlength:32;";
        $Form['Title']['Text'] = "Title:";
        $Form['Title']['Form'] = "name:Title; value:x{" . $PageTitle . "}x; maxlength:255;";
        $Form['Content']['Text'] = "Content:";
        $Form['Content']['Form'] = "name:Content; value:x{" . $PageContent . "}x; type:textarea; cols:80; rows:12;";
        $Form['Description']['Text'] = "Description:";
        $Form['Description']['Form'] = "name:Description; value:x{" . $PageDescription . "}x; size: 80; maxlength:255;";
        $content['Title'] = "Viewing Source of: {$PageTitle}";
        $content['Body'] .= Format($Form, Form);
        date_default_timezone_set('America/New_York');
        //			$PageEditTime = date("F j\, Y G:i:s", $PageEditTime)." EST";
        $PageEditTime = formatTime($PageEditTime);
        $content['Footer'] = "This page is an old revision made by <b><a href='/names?id={$AccountID}'>{$PageName}</a></b> on {$PageEditTime}.";
    }
    return array($title, $content);
}
Ejemplo n.º 3
0
function action_rename($path, $action, $title, $content)
{
    // Make sure user is an admin
    if (!$_SESSION['admin']) {
        $title[] = "Nope";
        $content['Body'] = "get out.";
        return array($title, $content);
    }
    if (!empty($_POST)) {
        $path = mysql_real_escape_string($path);
        $page_query = mysql_query("Select ID from `Wiki_Pages` where Path = '{$path}' limit 1");
        list($page_id) = mysql_fetch_array($page_query);
        // We can only change the path of an existing page...
        if ($page_id) {
            $new = str_replace(" ", "-", $_POST['new']);
            mysql_query("Update `Wiki_Pages` set `Path` = '" . mysql_real_escape_string($new) . "' where ID = '{$page_id}'");
            $content['Title'] = "Page renamed!";
            $content['Body'] = "<p>The old page <b>{$path}</b> has been renamed to <a href='/{$new}'>{$_POST['new']}</a></p>";
        } else {
            $content['Title'] = "There was an error!";
            $content['Body'] = "<p>You tried to rename a page that doesn't exist!</p>";
        }
    } else {
        $content['Title'] = "Rename this page";
        $Form['_Options'] = "action:" . str_replace("//", "/", "/{$path}?rename") . ";";
        $Form['Old']['Text'] = "Old Path";
        $Form['Old']['Form'] = "name:old; type:text; readonly:true; value:{$path};";
        $Form['New']['Text'] = "New Path";
        $Form['New']['Form'] = "name:new; type:text;";
        $Form['Submit']['Form'] = "type:submit; value:Submit;";
        $content['Body'] .= Format($Form, Form);
    }
    return array($title, $content);
}
Ejemplo n.º 4
0
function archive($path, $action, $title, $content)
{
    // Make sure user is an admin
    if (!$_SESSION['admin']) {
        $title[] = "Nope";
        $content['Body'] = "get out.";
        return array($title, $content);
    }
    // If we're archiving a specific edit
    if (is_numeric($action[1])) {
        if ($_POST['confirmed']) {
            mysql_query("Update `Wiki_Edits` set `Archived` = '1' where `ID` = '{$action[1]}'");
            $content['Body'] = "<p><b>Edit archived!</b></p>";
        } else {
            $content['Title'] = "Are you sure you want to archive this edit?";
            $content['Body'] = "<p><b>Doing so will remove this edit from the page history.</b></p>";
            $Form['_Options'] = "action:" . str_replace("//", "/", "/{$path}/?archive/{$action[1]}") . ";";
            $Form['Confirmed']['Text'] = "Are you sure?";
            $Form['Confirmed']['Form'] = "name:confirmed; type:hidden; value:true";
            $Form['Submit']['Form'] = "type:submit; value:Yes;";
            $content['Body'] .= Format($Form, Form);
        }
    } else {
        if ($_POST['confirmed']) {
            // Get the page ID
            $PageQuery = mysql_query("SELECT `ID` FROM `Wiki_Pages` WHERE `Path`='{$path}'");
            list($pageID) = mysql_fetch_array($PageQuery);
            if ($pageID) {
                mysql_query("Update `Wiki_Edits` set `Archived` = '1' where `PageID` = '{$pageID}'");
                mysql_query("Delete from `Wiki_Tags` where `pageID` = '{$pageID}'");
                mysql_query("Delete from `Wiki_Pages` where `ID` = '{$pageID}'");
                $content['Body'] = "<p><b>Page archived!</b></p>";
            } else {
                $content['Body'] = "<p><b>This isn't a page you goose.</b></p>";
            }
        } else {
            $content['Title'] = "Are you sure you want to archive this page?";
            $content['Body'] = "<p><b>Doing so will remove this page from the wiki and all edits will be archived.</b></p>";
            $Form['_Options'] = "action:" . str_replace("//", "/", "/{$path}/?archive") . ";";
            $Form['Confirmed']['Text'] = "Are you sure?";
            $Form['Confirmed']['Form'] = "name:confirmed; type:hidden; value:true";
            $Form['Submit']['Form'] = "type:submit; value:Yes;";
            $content['Body'] .= Format($Form, Form);
        }
    }
    return array($title, $content);
}
Ejemplo n.º 5
0
function druckstatusR(&$r)
{
    $tname = $r->RecordSource;
    if (IsNull($tname)) {
        $tname = 'Keine Tabelle';
    }
    if (Left($tname, 7) == 'SELECT ') {
        $tname = 'SQL direkt';
    }
    if (!is_a($r, 'AmberObject')) {
        $Rname = 'Falscher Parameter!!!';
    } else {
        $Rname = $r->Name;
    }
    $d = ' am ' . Format(Now(), 'ddd dd.mmm.yyyy') . ' um ' . Format(Now(), 'hh.nn');
    $s = $_SERVER['SERVER_NAME'];
    return 'Bericht: [' . $Rname . '] Tabelle/Abfrage: (' . $tname . ')' . $d . ' Server: [' . $s . ']';
}
Ejemplo n.º 6
0
function replace($path, $action, $title, $content)
{
    // Make sure user is an admin
    if (!$_SESSION['admin']) {
        $title[] = "Nope";
        $content['Body'] = "get out.";
        return array($title, $content);
    }
    if (!empty($_POST)) {
        $count = array('pages' => 0, 'edits' => 0);
        // Loop through all pages
        $pageQuery = mysql_query("Select `ID`, `Content` from `Wiki_Pages`");
        while (list($pageID, $pageContent) = mysql_fetch_array($pageQuery)) {
            $pageContent = str_replace($_POST['find'], $_POST['replace'], $pageContent);
            $pageContent = mysql_real_escape_string($pageContent);
            mysql_query("Update `Wiki_Pages` set `Content` = '{$pageContent}' where `ID` = '{$pageID}'");
            unset($pageID, $pageContent);
            $count['pages']++;
        }
        // Loop through all edits
        $editQuery = mysql_query("Select `ID`, `Content` from `Wiki_Edits`");
        while (list($editID, $editContent) = mysql_fetch_array($editQuery)) {
            $editContent = str_replace($_POST['find'], $_POST['replace'], $editContent);
            $editContent = mysql_real_escape_string($editContent);
            mysql_query("Update `Wiki_Edits` set `Content` = '{$editContent}' where `ID` = '{$editID}'");
            unset($editID, $editContent);
            $count['edits']++;
        }
        $content['Title'] = "Wiki updated!";
        $content['Body'] = "<p>{$count['pages']} pages modified.</p>";
        $content['Body'] .= "<p>{$count['edits']} edits modified.</p>";
    } else {
        $content['Title'] = "Find and replace things!";
        $content['Body'] = "<p><b>WARNING: Doing this will replace every occurence of a string in all pages and edits.</b></p>";
        $Form['_Options'] = "action:" . str_replace("//", "/", "/?replace") . ";";
        $Form['Find']['Text'] = "Find";
        $Form['Find']['Form'] = "name:find; type:text;";
        $Form['Replace']['Text'] = "Replace";
        $Form['Replace']['Form'] = "name:replace; type:text;";
        $Form['Submit']['Form'] = "type:submit; value:Submit;";
        $content['Body'] .= Format($Form, Form);
    }
    return array($title, $content);
}
Ejemplo n.º 7
0
function doThreadPreview($tid)
{
    global $mobileLayout;
    if ($mobileLayout) {
        return;
    }
    $rPosts = Query("\n\t\tselect\n\t\t\t{posts}.id, {posts}.date, {posts}.num, {posts}.deleted, {posts}.options, {posts}.mood, {posts}.ip,\n\t\t\t{posts_text}.text, {posts_text}.text, {posts_text}.revision,\n\t\t\tu.(_userfields)\n\t\tfrom {posts}\n\t\tleft join {posts_text} on {posts_text}.pid = {posts}.id and {posts_text}.revision = {posts}.currentrevision\n\t\tleft join {users} u on u.id = {posts}.user\n\t\twhere thread={0} and deleted=0\n\t\torder by date desc limit 0, 20", $tid);
    if (NumRows($rPosts)) {
        $posts = "";
        while ($post = Fetch($rPosts)) {
            $cellClass = ($cellClass + 1) % 2;
            $poster = getDataPrefix($post, "u_");
            $nosm = $post['options'] & 2;
            $nobr = $post['options'] & 4;
            $posts .= Format("\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\" style=\"width: 15%; vertical-align: top;\">\n\t\t\t\t\t{1}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell{0}\">\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertQuote({2});\">" . __("Quote") . "</button>\n\t\t\t\t\t<button style=\"float: right;\" onclick=\"insertChanLink({2});\">" . __("Link") . "</button>\n\t\t\t\t\t{3}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t", $cellClass, UserLink($poster), $post['id'], CleanUpPost($post['text'], $poster['name'], $nosm));
        }
        Write("\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"2\">" . __("Thread review") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t", $posts);
    }
}
Ejemplo n.º 8
0
         if ($setting[0][0] == "#") {
             continue;
         }
         if ($setting[0][0] == "\$") {
             registerSetting(substr($setting[0], 1), $setting[1]);
         } else {
             $plugins[$plugin][$setting[0]] = $setting[1];
         }
         $minver = 220;
         //we introduced these plugins in 2.2.0 so assume this.
         if ($setting[0] == "minversion") {
             $minver = (int) $setting[1];
         }
     }
     if ($minver > $misc['version']) {
         Report(Format("Disabled plugin \"{0}\" -- meant for a later version.", $plugin), 1);
         rename("./plugins/" . $plugin . "/plugin.settings", "./plugins/" . $plugin . "/plugin.disabled");
         unset($plugins[$plugin]);
         continue;
     }
     $dir = "./plugins/" . $plugins[$plugin]['dir'];
     $pdir = @opendir($dir);
     while ($f = readdir($pdir)) {
         if (substr($f, strlen($f) - 4, 4) == ".php") {
             $pluginbuckets[substr($f, 0, strlen($f) - 4)][] = $plugins[$plugin]['dir'];
         }
     }
 } else {
     unset($plugins[$plugin]);
     continue;
 }
Ejemplo n.º 9
0
<?php

if ($loguserid && isset($_GET['action']) && $_GET['action'] == "markallread") {
    Query("REPLACE INTO {threadsread} (id,thread,date) SELECT {0}, {threads}.id, {1} FROM {threads}", $loguserid, time());
    redirectAction("board");
}
$links = new PipeMenu();
if ($loguserid) {
    $links->add(new PipeMenuLinkEntry(__("Mark all forums read"), "board", 0, "action=markallread", "ok"));
}
makeLinks($links);
makeBreadcrumbs(new PipeMenu());
if (!$mobileLayout) {
    $statData = Fetch(Query("SELECT\n\t\t(SELECT COUNT(*) FROM {threads}) AS numThreads,\n\t\t(SELECT COUNT(*) FROM {posts}) AS numPosts,\n\t\t(SELECT COUNT(*) FROM {users}) AS numUsers,\n\t\t(select count(*) from {posts} where date > {0}) AS newToday,\n\t\t(select count(*) from {posts} where date > {1}) AS newLastHour,\n\t\t(select count(*) from {users} where lastposttime > {2}) AS numActive", time() - 86400, time() - 3600, time() - 2592000));
    $stats = Format(__("{0} and {1} total"), Plural($statData["numThreads"], __("thread")), Plural($statData["numPosts"], __("post")));
    $stats .= "<br />" . format(__("{0} today, {1} last hour"), Plural($statData["newToday"], __("new post")), $statData["newLastHour"]);
    $percent = $statData["numUsers"] ? ceil(100 / $statData["numUsers"] * $statData["numActive"]) : 0;
    $lastUser = Query("select u.(_userfields) from {users} u order by u.regdate desc limit 1");
    if (numRows($lastUser)) {
        $lastUser = getDataPrefix(Fetch($lastUser), "u_");
        $last = format(__("{0}, {1} active ({2}%)"), Plural($statData["numUsers"], __("registered user")), $statData["numActive"], $percent) . "<br />" . format(__("Newest: {0}"), UserLink($lastUser));
    } else {
        $last = __("No registered users") . "<br />&nbsp;";
    }
    write("\n\t\t<table class=\"outline margin width100\" style=\"overflow: auto;\">\n\t\t\t<tr class=\"cell2 center\" style=\"overflow: auto;\">\n\t\t\t<td>\n\t\t\t\t<div style=\"float: left; width: 25%;\">&nbsp;<br />&nbsp;</div>\n\t\t\t\t<div style=\"float: right; width: 25%;\">{1}</div>\n\t\t\t\t<div class=\"center\">\n\t\t\t\t\t{0}\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t", $stats, $last);
}
printRefreshCode();
makeForumListing(0);
Ejemplo n.º 10
0
                }
            }
        }
    }
    return $plugindata;
}
$rPlugins = Query("select * from {enabledplugins}");
while ($plugin = Fetch($rPlugins)) {
    $plugin = $plugin["plugin"];
    try {
        $res = getPluginData($plugin);
        if (!isset($res["nomobile"]) || !$mobileLayout) {
            $plugins[$plugin] = $res;
        }
    } catch (BadPluginException $e) {
        Report(Format("Disabled plugin \"{0}\" -- {1}", $plugin, $e->getMessage()));
        Query("delete from {enabledplugins} where plugin={0}", $plugin);
    }
    Settings::checkPlugin($plugin);
}
if ($loguser['pluginsettings'] != "") {
    $settings = unserialize($loguser['pluginsettings']);
    if (!is_array($settings)) {
        $settings = array();
    }
    foreach ($settings as $setName => $setVal) {
        if (array_key_exists($setName, $pluginSettings)) {
            $pluginSettings[$setName]["value"] = stripslashes(urldecode($setVal));
        }
    }
}
Ejemplo n.º 11
0
    }
}
if (isset($_POST['actionpreview']) || isset($_POST['actionpost'])) {
    $prefill = $_POST['text'];
    if ($_POST['nopl']) {
        $nopl = "checked=\"checked\"";
    }
    if ($_POST['nosm']) {
        $nosm = "checked=\"checked\"";
    }
} else {
    $prefill = $post['text'];
    if ($post['options'] & 1) {
        $nopl = "checked=\"checked\"";
    }
    if ($post['options'] & 2) {
        $nosm = "checked=\"checked\"";
    }
    $_POST['mood'] = $post['mood'];
}
if ($_POST['mood']) {
    $moodSelects[(int) $_POST['mood']] = "selected=\"selected\" ";
}
$moodOptions = Format("<option {0}value=\"0\">" . __("[Default avatar]") . "</option>\n", $moodSelects[0]);
$rMoods = Query("select mid, name from {moodavatars} where uid={0} order by mid asc", $post['user']);
while ($mood = Fetch($rMoods)) {
    $moodOptions .= Format("<option {0}value=\"{1}\">{2}</option>\n", $moodSelects[$mood['mid']], $mood['mid'], htmlspecialchars($mood['name']));
}
$form = "\n\t<form name=\"postform\" action=\"" . actionLink("editpost") . "\" method=\"post\">\n\t\t<table class=\"outline margin width100\">\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t" . __("Edit Post") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell0\">\n\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">" . htmlspecialchars($prefill) . "</textarea>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"submit\" name=\"actionpost\" value=\"" . __("Edit") . "\" />\n\t\t\t\t\t<input type=\"submit\" name=\"actionpreview\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t{$moodOptions}\n\t\t\t\t\t</select>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" {$pid} />&nbsp;" . __("Disable post layout", 1) . "\n\t\t\t\t\t</label>\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" {$nosm} />&nbsp;" . __("Disable smilies", 1) . "\n\t\t\t\t\t</label>\n\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$pid}\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"key\" value=\"" . $loguser['token'] . "\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>";
doPostForm($form);
doThreadPreview($tid);
Ejemplo n.º 12
0
            //			$result['text'] = str_replace("<!--", "~#~", str_replace("-->", "~#~", $result['text']));
            $snippet = MakeSnippet($result['text'], $terms);
            $userlink = UserLink(getDataPrefix($result, "u_"));
            $threadlink = makeThreadLink($result);
            $posturl = actionLink("thread", "", "pid=" . $result['pid'] . "#" . $result['pid']);
            if ($snippet != "") {
                $totalResults++;
                $results .= "\n\t<tr class=\"cell0\">\n\t\t<td class=\"smallFonts\">\n\t\t\t{$userlink}\n\t\t</td>\n\t\t<td>\n\t\t\t{$snippet}\n\t\t</td>\n\t\t<td class=\"smallFonts\">\n\t\t\t{$threadlink}\n\t\t</td>\n\t\t<td class=\"smallFonts\">\n\t\t\t&raquo;&nbsp;<a href=\"{$posturl}\">{$result['pid']}</a>\n\t\t</td>\n\t</tr>";
            }
        }
        if ($results != "") {
            $final .= "\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"4\">Text results</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th>User</th>\n\t\t<th>Text</th>\n\t\t<th>Thread</th>\n\t\t<th>ID</th>\n\t</tr>\n\t{$results}\n</table>";
        }
    }
    if ($totalResults == 0) {
        Alert(Format("No results for \"{0}\".", htmlspecialchars($searchQuery)), "Search");
    } else {
        Write("\n<div class=\"outline header2 cell2 margin\" style=\"text-align: center; font-size: 130%;\">\n\t{0}\n</div>\n{1}\n", Plural($totalResults, "result"), $final);
    }
}
function MakeSnippet($text, $terms, $title = false)
{
    $text = strip_tags($text);
    if (!$title) {
        $text = preg_replace("/(\\[\\/?)(\\w+)([^\\]]*\\])/i", "", $text);
    }
    $lines = explode("\n", $text);
    $terms = implode("|", $terms);
    $contextlines = 3;
    $max = 50;
    $pat1 = "/(.*)(" . $terms . ")(.{0," . $max . "})/i";
Ejemplo n.º 13
0
         $Form['_Options'] = "action:" . str_replace("//", "/", "/{$Path}/?Register") . ";";
         $Form['Name']['Text'] = "Name:";
         $Form['Name']['Form'] = "name:Name; value:{$Name};";
         $Form['Email']['Text'] = "Email:";
         $Form['Email']['Form'] = "name:Email; value:{$Email};";
         $Form['Email']['SubText'] = "&nbsp;";
         $Form['Password']['Text'] = "Password:"******"name:Password; type:password;";
         $Form['Confirm']['Text'] = "&nbsp;";
         $Form['Confirm']['Form'] = "name:Confirm; type:password;";
         $Form['Confirm']['SubText'] = "Retype password to make sure you did it right!";
         $Form['Captcha']['Form'] = "type:plaintext; value:" . recaptcha_get_html(RECAPTCHA_PUBLIC, null, 1);
         $Form['Submit']['Form'] = "type:submit; value:Submit;";
         $Content['Body'] .= "<br />";
         $Content['Body'] .= "<div class='big'><div class='big'><div class='big'>FUN FACT THIS PAGE DOES NOT WORK, IT HAS NEVER WORKED, STOP TRYING TO USE IT LOL</div></div>Seriously, just start editing pages. You don't need an account. :)</div>";
         $Content['Body'] .= Format($Form, Form);
     }
     break;
 case "logout":
     $Content['UserNav']->Active("Logout");
     if ($_SESSION['Name']) {
         session_unset();
         setcookie("sid", "", time() - 2629743, "/", ".wetfish.net");
         $Content['Body'] = "<b>Logging out...</b> <meta http-equiv='refresh' content='2;url=/{$Path}'>";
     } else {
         $Content['Body'] = "<b>Ohh you so silly!</b>";
     }
     break;
 default:
     // If you're on a page and there is no action, view it!
     if (empty($Action) || !is_string($Action[0])) {
Ejemplo n.º 14
0
 function testFormat_Mix()
 {
     #  $this->assertEquals('a s-  tt.mm.jjdf',  Format("as df", "@ @-@ tt.mm.jj"), 'Test1');
     #  $this->assertEquals('1 2-3 tt.mm.jj456',  Format('123456', '@ @-@ tt.mm.jj'), 'Test2');
     $this->assertEquals('123456', Format("123456", "#"), 'Test11');
     #  $this->assertEquals('12-34#56',     Format("123456", "&&-&&#"), 'Test12');
     $this->assertEquals('12345&&-&&6', Format("123456", "#&&-&&#"), 'Test13');
     $this->assertEquals('123456&&-&&', Format("123456", "#&&-&&"), 'Test14');
     $this->assertEquals('1#&&-&&', Format("123456", "m#&&-&&"), 'Test21');
     //###dispens### $this->assertEquals('03.01.2238#&&-&&',  Format("123456", "dd.mm.yyyy#&&-&&"), 'Test22');
     // there are actually 3 distinct Format functions for date, number and string
     // each behaves diffrent. decision, which to call is made by the first Format relevant character on the Left
     //###dispens### $this->assertEquals(' birt03a3: #&&-&& 03.01.2238',      Format("123456", " birthday: #&&-&& dd.mm.yyyy"), 'Test31');
     #  $this->assertEquals('birthday: #34-56 dd.mm.yyyy',       Format("123456", "!birthday: #&&-&& dd.mm.yyyy"), 'Test32');
     $this->assertEquals('12345birthday: 6&&-&& dd,mm.yyyy', Format("123456", "#birthday: #&&-&& dd.mm.yyyy"), 'Test33');
     // separation of Format parts (positive, negative, zero and NULL) is done inside the different Format functions
     $this->assertEquals('123456,00', Format("+123456", "#.00;&&-&&-&&"), 'Test41');
     $this->assertEquals('&&-&&-&&', Format("-123456", "#.00;&&-&&-&&"), 'Test42');
     #  $this->assertEquals('+1-23-456',      Format("+123456", "&&-&&-&&;#.00"), 'Test43');
     #  $this->assertEquals('-1-23-456',      Format("-123456", "&&-&&-&&;#.00"), 'Test44');
     //###dispens### $this->assertEquals('.&&-00-01',      Format("2004-01-01","/&&-00-dd"), 'Test51');
     $this->assertEquals(':&&-00-01', Format("2004-01-01", ":&&-00-dd"), 'Test52');
 }
Ejemplo n.º 15
0
 function printNormal()
 {
     // FIXME: This is specific to MySQL!!
     if ($this->Value == '0000-00-00 00:00:00') {
         $this->Value = null;
     }
     $this->_exporter->printNormal($this, Format($this->Value, strval($this->Format), $this->DecimalPlaces));
     return $this->stdHeight();
     ### FIX THIS: CanGrow.....
 }
Ejemplo n.º 16
0
if ($loguser['powerlevel'] < 3) {
    Kill(__("You're not an administrator. There is nothing for you here."));
}
$title = __("Administration");
$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("Admin"), "admin"));
makeBreadcrumbs($crumbs);
$cell2 = 1;
function cell2($content)
{
    global $cell2;
    $cell2 = $cell2 == 1 ? 0 : 1;
    Write("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t</tr>\n\t", $cell2, $content);
}
Write("\n\t<table class=\"outline margin width50 floatright\">\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Information") . "\n\t\t\t</th>\n\t\t</tr>\n");
cell2(Format("\n\n\t\t\t\t" . __("Last viewcount milestone") . "\n\t\t\t</td>\n\t\t\t<td style=\"width: 60%;\">\n\t\t\t\t{0}\n\t\t\t", $misc['milestone']));
$bucket = "adminright";
include "./lib/pluginloader.php";
write("\n\t</table>\n");
$cell2 = 1;
Write("\n\t<table class=\"outline margin width25\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("Admin tools") . "\n\t\t\t</th>\n\t\t</tr>\n");
cell2(actionLinkTag(__("Recalculate statistics"), "recalc"));
cell2(actionLinkTag(__("Last Known Browsers"), "lastknownbrowsers"));
cell2(actionLinkTag(__("Manage IP bans"), "ipbans"));
cell2(actionLinkTag(__("Manage forum list"), "editfora"));
cell2(actionLinkTag(__("Manage plugins"), "pluginmanager"));
cell2(actionLinkTag(__("Edit settings"), "editsettings"));
cell2(actionLinkTag(__("Edit smilies"), "editsmilies"));
cell2(actionLinkTag(__("Optimize tables"), "optimize"));
cell2(actionLinkTag(__("View log"), "log"));
cell2(actionLinkTag(__("Update table structure"), "updateschema"));
Ejemplo n.º 17
0
        die(header("Location: thread.php?id=" . (int) $_GET['tid']));
    } else {
        if (isset($_GET['uid']) && (int) $_GET['uid'] > 0) {
            die(header("Location: profile.php?id=" . (int) $_GET['uid']));
        } else {
            if (isset($_GET['pid']) && (int) $_GET['pid'] > 0) {
                die(header("Location: thread.php?pid=" . (int) $_GET['pid'] . "#" . (int) $_GET['pid']));
            }
        }
    }
}
include "lib/common.php";
$numThreads = FetchResult("select count(*) from threads");
$numPosts = FetchResult("select count(*) from posts");
//$stats = Plural($numThreads, "thread")." and ".Plural($numPosts,"post")." total";
$stats = Format(__("{0} and {1} total"), Plural($numThreads, __("thread")), Plural($numPosts, __("post")));
$newToday = FetchResult("select count(*) from posts where date > " . (time() - 86400));
$newLastHour = FetchResult("select count(*) from posts where date > " . (time() - 3600));
$stats .= "<br />" . format(__("{0} today, {1} last hour"), Plural($newToday, __("new post")), $newLastHour);
$numUsers = FetchResult("select count(*) from users");
$numActive = FetchResult("select count(*) from users where lastposttime > " . (time() - 2592000));
//30 days
$percent = $numUsers ? ceil(100 / $numUsers * $numActive) : 0;
$rLastUser = Query("select id,name,displayname,powerlevel,sex from users order by regdate desc limit 1");
$lastUser = Fetch($rLastUser);
$last = format(__("{0}, {1} active ({2}%)"), Plural($numUsers, __("registered user")), $numActive, $percent) . "<br />" . format(__("Newest: {0}"), UserLink($lastUser));
$onlineUsers = OnlineUsers();
$pl = $loguser['powerlevel'];
if ($pl < 0) {
    $pl = 0;
}
Ejemplo n.º 18
0
        $mod .= "<label><input type=\"checkbox\" name=\"unlock\">&nbsp;" . __("Open thread", 1) . "</label>\n";
    }
    if (!$thread['sticky']) {
        $mod .= "<label><input type=\"checkbox\" name=\"stick\">&nbsp;" . __("Sticky", 1) . "</label>\n";
    } else {
        $mod .= "<label><input type=\"checkbox\" name=\"unstick\">&nbsp;" . __("Unstick", 1) . "</label>\n";
    }
    $mod .= "\n\n";
}
write("\n\t<table style=\"width: 100%;\">\n\t\t<tr>\n\t\t\t<td style=\"vertical-align: top; border: none;\">\n\t\t\t\t<form action=\"newreply.php\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"ninja\" value=\"{0}\" />\n\t\t\t\t\t<table class=\"outline margin width100\">\n\t\t\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\t\t\t\t" . __("New reply") . "\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"uname\">\n\t\t\t\t\t\t\t\t\t" . __("User name", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" id=\"uname\" name=\"username\" value=\"{1}\" size=\"32\" maxlength=\"32\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"cell1\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"upass\">\n\t\t\t\t\t\t\t\t\t" . __("Password") . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"password\" id=\"upass\" name=\"password\" value=\"{2}\" size=\"32\" maxlength=\"32\" />\n\t\t\t\t\t\t\t\t<img src=\"img/icons/icon5.png\" title=\"" . __("If you want to post under another account without having to log out, enter that account's user name and password here. Leave the password field blank to use the current account ({10}).") . "\" alt=\"[?]\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"cell0\">\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label for=\"text\">\n\t\t\t\t\t\t\t\t\t" . __("Post") . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<textarea id=\"text\" name=\"text\" rows=\"16\" style=\"width: 98%;\">{3}</textarea>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"cell2\">\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Post") . "\" /> \n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Preview") . "\" />\n\t\t\t\t\t\t\t\t<select size=\"1\" name=\"mood\">\n\t\t\t\t\t\t\t\t\t{4}\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nopl\" {5} />&nbsp;" . __("Disable post layout", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nosm\" {6} />&nbsp;" . __("Disable smilies", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"nobr\" {9} />&nbsp;" . __("Disable auto-<br>", 1) . "\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{7}\" />\n\t\t\t\t\t\t\t\t{8}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</form>\n\t\t\t</td>\n\t\t\t<td style=\"width: 20%; vertical-align: top; border: none;\">\n", $ninja, htmlval($postingAsUser['name']), $_POST['password'], $prefill, $moodOptions, $nopl, $nosm, $tid, $mod, $nobr, htmlspecialchars($loguser['name']));
DoSmileyBar();
DoPostHelp();
write("\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n");
$qPosts = "select ";
$qPosts .= "posts.id, posts.date, posts.num, posts.deleted, posts.options, posts.mood, posts.ip, posts_text.text, posts_text.text, posts_text.revision, users.id as uid, users.name, users.displayname, users.rankset, users.powerlevel, users.sex, users.posts";
$qPosts .= " from posts left join posts_text on posts_text.pid = posts.id and posts_text.revision = posts.currentrevision left join users on users.id = posts.user";
$qPosts .= " where thread=" . $tid . " and deleted=0 order by date desc limit 0, 20";
$rPosts = Query($qPosts);
if (NumRows($rPosts)) {
    $posts = "";
    while ($post = Fetch($rPosts)) {
        $cellClass = ($cellClass + 1) % 2;
        $poster = $post;
        $poster['id'] = $post['uid'];
        $nosm = $post['options'] & 2;
        $nobr = $post['options'] & 4;
        $posts .= Format("\n\t\t<tr>\n\t\t\t<td class=\"cell2\" style=\"width: 15%; vertical-align: top;\">\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td class=\"cell{0}\">\n\t\t\t\t<button style=\"float: right;\" onclick=\"insertQuote({2});\">" . __("Quote") . "</button>\n\t\t\t\t<button style=\"float: right;\" onclick=\"insertChanLink({2});\">" . __("Link") . "</button>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, UserLink($poster), $post['id'], CleanUpPost($post['text'], $poster['name'], $nosm, $nobr));
    }
    Write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"2\">" . __("Thread review") . "</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $posts);
}
MakeCrumbs(array(__("Main") => "./", $forum['title'] => "forum.php?id=" . $fid, $titleandtags => "thread.php?id=" . $tid, __("New reply") => ""), $links);
Ejemplo n.º 19
0
    if (NumRows($search)) {
        $results = "";
        while ($result = Fetch($search)) {
            $result['text'] = str_replace("<!--", "~#~", str_replace("-->", "~#~", $result['text']));
            $snippet = MakeSnippet(htmlspecialchars($result['text']), $terms);
            if ($snippet != "") {
                $results .= Format("\n\t<tr class=\"cell0\">\n\t\t<td class=\"smallFonts\">\n\t\t\t{3}\n\t\t</td>\n\t\t<td>\n\t\t\t{0}\n\t\t</td>\n\t\t<td class=\"smallFonts\">\n\t\t\t<a href=\"./?tid={4}\">{2}</a>\n\t\t</td>\n\t\t<td class=\"smallFonts\">\n\t\t\t&raquo;&nbsp;<a href=\"./?pid={1}\">{1}</a>\n\t\t</td>\n\t</tr>\n", $snippet, $result['pid'], $result['title'], UserLink($result, "user"), $result['thread']);
            }
        }
        if ($results != "") {
            $final .= Format("\n<table class=\"outline margin\">\n\t<tr class=\"header0\">\n\t\t<th colspan=\"4\">Text results</th>\n\t</tr>\n\t<tr class=\"header1\">\n\t\t<th>User</th>\n\t\t<th>Text</th>\n\t\t<th>Thread</th>\n\t\t<th>ID</th>\n\t</tr>\n\t{0}\n</table>\n", $results);
            $totalResults += NumRows($search);
        }
    }
    if ($totalResults == 0) {
        Alert(Format("No results for \"{0}\".", htmlspecialchars($_GET['q'])), "Search");
    } else {
        Write("\n<div class=\"outline header2 cell2 margin\" style=\"text-align: center; font-size: 130%;\">\n\t{0}\n</div>\n{1}\n", Plural($totalResults, "result"), $final);
    }
}
function MakeSnippet($text, $terms, $title = false)
{
    $text = strip_tags($text);
    if (!$title) {
        $text = preg_replace("/(\\[\\/?)(\\w+)([^\\]]*\\])/i", "", $text);
    }
    $lines = explode("\n", $text);
    $terms = implode("|", $terms);
    $contextlines = 3;
    $max = 50;
    $pat1 = "/(.*)(" . $terms . ")(.{0," . $max . "})/i";
Ejemplo n.º 20
0
            for ($i = 1; $i < $n; $i++) {
                $pl .= " <a href=\"thread.php?id=" . $thread['id'] . "&amp;from=" . $i * $ppp . "\">" . ($i + 1) . "</a>";
            }
            $pl .= " &hellip; ";
            for ($i = $numpages - $n + 1; $i <= $numpages; $i++) {
                $pl .= " <a href=\"thread.php?id=" . $thread['id'] . "&amp;from=" . $i * $ppp . "\">" . ($i + 1) . "</a>";
            }
        }
        if ($pl) {
            $pl = " <span class=\"smallFonts\">[<a href=\"thread.php?id=" . $thread['id'] . "\">1</a>" . $pl . "]</span>";
        }
        $lastLink = "";
        if ($thread['lastpostid']) {
            $lastLink = " <a href=\"thread.php?pid=" . $thread['lastpostid'] . "#" . $thread['lastpostid'] . "\">&raquo;</a>";
        }
        $forumList .= Format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td class=\"cell2 threadIcon\">{1}</td>\n\t\t\t<td class=\"threadIcon\" style=\"border-right: 0px none;\">\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td style=\"border-left: 0px none;\">\n\t\t\t\t{3}\n\t\t\t\t<a href=\"thread.php?id={4}\">\n\t\t\t\t\t{5}\n\t\t\t\t</a>\n\t\t\t\t{6}\n\t\t\t\t{7}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{8}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{9}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{10}\n\t\t\t</td>\n\t\t\t<td class=\"smallFonts center\">\n\t\t\t\t{11}<br />\n\t\t\t\t" . __("by") . " {12} {13}</td>\n\t\t</tr>\n", $cellClass, $NewIcon, $ThreadIcon, $poll, $thread['id'], strip_tags($thread['title']), $pl, $tags, UserLink($starter), $thread['replies'], $thread['views'], cdate($dateformat, $thread['lastpostdate']), UserLink($last), $lastLink);
    }
    Write("\n\t<table class=\"outline margin width100\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 20px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 16px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 60%;\">" . __("Title") . "</th>\n\t\t\t<th>" . __("Started by") . "</th>\n\t\t\t<th>" . __("Replies") . "</th>\n\t\t\t<th>" . __("Views") . "</th>\n\t\t\t<th>" . __("Last post") . "</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $forumList);
} else {
    if ($forum['minpowerthread'] > $loguser['powerlevel']) {
        Alert(__("You cannot start any threads here."), __("Empty forum"));
    } elseif ($loguserid) {
        Alert(format(__("Would you like to {0}post something{1}?"), "<a href=\"newthread.php?id=" . $fid . "\">", "</a>"), __("Empty forum"));
    } else {
        Alert(format(__("{0}Log in{1} so you can post something."), "<a href=\"login.php\">", "</a>"), __("Empty forum"));
    }
}
if ($pagelinks) {
    Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
MakeCrumbs(array(__("Main") => "./", $forum['title'] => "forum.php?id=" . $fid), $links);
Ejemplo n.º 21
0
function PowerSelect($id, $s)
{
    $r = Format('
				<select name="{0}">
	', $id);
    if ($s < 0) {
        $s = 0;
    } else {
        if ($s > 3) {
            $s = 3;
        }
    }
    $powers = array(0 => __("Regular"), 1 => __("Local mod"), 2 => __("Full mod"), 3 => __("Admin"));
    foreach ($powers as $k => $v) {
        $r .= Format('
					<option value="{0}"{2}>{1}</option>
		', $k, $v, $k == $s ? ' selected="selected"' : '');
    }
    $r .= '
				</select>';
    return $r;
}
Ejemplo n.º 22
0
<?php

$footerExtensionsA .= Format("\n\t\t\t<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" style=\"font-size: 10px; float: right; clear: both;\">\n\t\t\t\t<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\" />\n\t\t\t\t<input type=\"image\" src=\"plugins/paypal/paypal.png\" name=\"submit\" alt=\"Donate with PayPal!\" style=\"box-shadow: 0px 0px 5px white\"/>\n\t\t\t\t<input type=\"hidden\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----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-----END PKCS7-----\n\t\t\t\t\" />\n\t\t\t</div>\n\t\t</form>\n");
Ejemplo n.º 23
0
function GetFileContent($unitId, &$filename)
{
    // generate the unit's file
    $unitInfos = GetUnitInfos($unitId);
    $items = GetItemsInUnit($unitId);
    if (!is_array($items)) {
        die($items);
    }
    $filename = str_replace(".pas", ".dtx", $unitInfos["Name"]);
    $unitSummary = $unitInfos["Description"];
    $unitDescription = "";
    if (!(strpos($unitSummary, "\r\n") === 0)) {
        $unitDescription = substr($unitSummary, strpos($unitSummary, "\r\n") + 2);
        $unitSummary = substr($unitSummary, 0, strpos($unitSummary, "\r\n"));
    }
    $content = "";
    $content .= "##Package: " . $unitInfos["Package"] . "\r\n";
    $content .= "##Status: " . $unitInfos["Status"] . "\r\n";
    $content .= "----------------------------------------------------------------------------------------------------\r\n";
    $content .= "@@" . str_replace(".dtx", ".pas", $unitInfos["Name"]) . "\r\n";
    $content .= "Summary\r\n";
    $content .= Format($unitSummary);
    $content .= "Author\r\n";
    $content .= Format($unitInfos["Author"]);
    if ($unitDescription != "") {
        $content .= "Description\r\n";
        $content .= Format($unitDescription);
    }
    $content .= "\r\n";
    // generate for all other items
    foreach ($items as $item) {
        $content .= "----------------------------------------------------------------------------------------------------\r\n";
        $content .= "@@" . $item["Name"] . "\r\n";
        if ($item["Extras"] != "") {
            $content .= $item["Extras"] . "\r\n";
        }
        if ($item["JVCLInfo"] != "") {
            $content .= "JVCLInfo\r\n";
            $content .= Format($item["JVCLInfo"]);
        }
        if ($item["Summary"] != "") {
            $content .= "Summary\r\n";
            $content .= Format($item["Summary"]);
        }
        if ($item["Description"] != "") {
            $content .= "Description\r\n";
            $content .= Format($item["Description"]);
        }
        if ($item["Parameters"] != "") {
            $content .= "Parameters\r\n";
            $content .= Format($item["Parameters"]);
        }
        if ($item["ReturnValue"] != "") {
            $content .= "Return value\r\n";
            $content .= Format($item["ReturnValue"]);
        }
        $seeAlsoString = GetSeeAlsoString($item);
        if ($seeAlsoString != "") {
            $content .= "See Also\r\n";
            $content .= Format($seeAlsoString);
        }
        $content .= "\r\n";
    }
    return $content;
}
Ejemplo n.º 24
0
function makePost($post, $type, $params = array())
{
    global $loguser, $loguserid, $usergroups, $isBot, $blocklayouts;
    $poster = getDataPrefix($post, 'u_');
    $post['userlink'] = UserLink($poster);
    LoadBlockLayouts();
    $pltype = Settings::get('postLayoutType');
    $isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]);
    $post['type'] = $type;
    $post['formattedDate'] = formatdate($post['date']);
    if (!HasPermission('admin.viewips')) {
        $post['ip'] = '';
    } else {
        $post['ip'] = htmlspecialchars($post['ip']);
    }
    // TODO IP formatting?
    if ($post['deleted'] && $type == POST_NORMAL) {
        $post['deluserlink'] = UserLink(getDataPrefix($post, 'du_'));
        $post['delreason'] = htmlspecialchars($post['reason']);
        $links = array();
        if (HasPermission('mod.deleteposts', $params['fid'])) {
            $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
            $links['view'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",true); return false;\">" . __("View") . "</a>";
        }
        $post['links'] = $links;
        RenderTemplate('postbox_deleted', array('post' => $post));
        return;
    }
    $links = array();
    if ($type != POST_SAMPLE) {
        $forum = $params['fid'];
        $thread = $params['tid'];
        $notclosed = !$post['closed'] || HasPermission('mod.closethreads', $forum);
        $extraLinks = array();
        if (!$isBot) {
            if ($type == POST_DELETED_SNOOP) {
                if ($notclosed && HasPermission('mod.deleteposts', $forum)) {
                    $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
                }
                $links['close'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",false); return false;\">" . __("Close") . "</a>";
            } else {
                if ($type == POST_NORMAL) {
                    if ($notclosed) {
                        if ($loguserid && HasPermission('forum.postreplies', $forum) && !$params['noreplylinks']) {
                            $links['quote'] = actionLinkTag(__("Quote"), "newreply", $thread, "quote=" . $post['id']);
                        }
                        $editrights = 0;
                        if ($poster['id'] == $loguserid && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum)) {
                            $links['edit'] = actionLinkTag(__("Edit"), "editpost", $post['id']);
                            $editrights++;
                        }
                        if ($poster['id'] == $loguserid && HasPermission('user.deleteownposts') || HasPermission('mod.deleteposts', $forum)) {
                            if ($post['id'] != $post['firstpostid']) {
                                $link = htmlspecialchars(actionLink('editpost', $post['id'], 'delete=1&key=' . $loguser['token']));
                                $onclick = HasPermission('mod.deleteposts', $forum) ? " onclick=\"deletePost(this);return false;\"" : ' onclick="if(!confirm(\'Really delete this post?\'))return false;"';
                                $links['delete'] = "<a href=\"{$link}\"{$onclick}>" . __('Delete') . "</a>";
                            }
                            $editrights++;
                        }
                        if ($editrights < 2 && HasPermission('user.reportposts')) {
                            $links['report'] = actionLinkTag(__('Report'), 'reportpost', $post['id']);
                        }
                    }
                    // plugins should add to $extraLinks
                    $bucket = "topbar";
                    include __DIR__ . "/pluginloader.php";
                }
            }
            $links['extra'] = $extraLinks;
        }
        //Threadlinks for listpost.php
        if ($params['threadlink']) {
            $thread = array();
            $thread['id'] = $post['thread'];
            $thread['title'] = $post['threadname'];
            $thread['forum'] = $post['fid'];
            $post['threadlink'] = makeThreadLink($thread);
        } else {
            $post['threadlink'] = '';
        }
        //Revisions
        if ($post['revision']) {
            $ru_link = UserLink(getDataPrefix($post, "ru_"));
            $revdetail = ' ' . format(__('by {0} on {1}'), $ru_link, formatdate($post['revdate']));
            if (HasPermission('mod.editposts', $forum)) {
                $post['revdetail'] = "<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . Format(__('rev. {0}'), $post['revision']) . "</a>" . $revdetail;
            } else {
                $post['revdetail'] = Format(__('rev. {0}'), $post['revision']) . $revdetail;
            }
        }
        //</revisions>
    }
    $post['links'] = $links;
    // POST SIDEBAR
    $sidebar = array();
    // quit abusing custom syndromes you unoriginal fuckers
    $poster['title'] = preg_replace('@Affected by \'?.*?Syndrome\'?@si', '', $poster['title']);
    $sidebar['rank'] = GetRank($poster['rankset'], $poster['posts']);
    if ($poster['title']) {
        $sidebar['title'] = strip_tags(CleanUpPost($poster['title'], '', true), '<b><strong><i><em><span><s><del><img><a><br/><br><small>');
    } else {
        $sidebar['title'] = htmlspecialchars($usergroups[$poster['primarygroup']]['title']);
    }
    $sidebar['syndrome'] = GetSyndrome(getActivity($poster['id']));
    if ($post['mood'] > 0) {
        if (file_exists(DATA_DIR . "avatars/" . $poster['id'] . "_" . $post['mood'])) {
            $sidebar['avatar'] = "<img src=\"" . DATA_URL . "avatars/" . $poster['id'] . "_" . $post['mood'] . "\" alt=\"\">";
        }
    } else {
        if ($poster['picture']) {
            $pic = str_replace('$root/', DATA_URL, $poster['picture']);
            $sidebar['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\">";
        }
    }
    $lastpost = $poster['lastposttime'] ? timeunits(time() - $poster['lastposttime']) : "none";
    $lastview = timeunits(time() - $poster['lastactivity']);
    if (!$post['num']) {
        $sidebar['posts'] = $poster['posts'];
    } else {
        $sidebar['posts'] = $post['num'] . '/' . $poster['posts'];
    }
    $sidebar['since'] = cdate($loguser['dateformat'], $poster['regdate']);
    $sidebar['lastpost'] = $lastpost;
    $sidebar['lastview'] = $lastview;
    if ($poster['lastactivity'] > time() - 300) {
        $sidebar['isonline'] = __("User is <strong>online</strong>");
    }
    $sidebarExtra = array();
    $bucket = "sidebar";
    include __DIR__ . "/pluginloader.php";
    $sidebar['extra'] = $sidebarExtra;
    $post['sidebar'] = $sidebar;
    // OTHER STUFF
    $post['haslayout'] = false;
    $post['fulllayout'] = false;
    if (!$isBlocked) {
        $poster['postheader'] = $pltype ? trim($poster['postheader']) : '';
        $poster['signature'] = trim($poster['signature']);
        $post['haslayout'] = $poster['postheader'] ? 1 : 0;
        $post['fulllayout'] = $poster['fulllayout'] && $post['haslayout'] && $pltype == 2;
        if (!$post['haslayout'] && $poster['signature']) {
            $poster['signature'] = '<div class="signature">' . $poster['signature'] . '</div>';
        }
    } else {
        $poster['postheader'] = '';
        $poster['signature'] = '';
    }
    $post['contents'] = makePostText($post, $poster);
    //PRINT THE POST!
    RenderTemplate('postbox', array('post' => $post));
}
Ejemplo n.º 25
0
}
if ($user['birthday']) {
    $temp[__("Birthday")] = formatBirthday($user['birthday']);
}
if (count($temp)) {
    $profileParts[__("Personal information")] = $temp;
}
if ($user['bio']) {
    $profileParts[__('Bio')] = CleanUpPost($user['bio']);
}
$badgersR = Query("select * from {badges} where owner={0} order by color", $id);
if (NumRows($badgersR)) {
    $badgers = "";
    $colors = array("bronze", "silver", "gold", "platinum");
    while ($badger = Fetch($badgersR)) {
        $badgers .= Format("<span class=\"badge {0}\">{1}</span> ", $colors[$badger['color']], $badger['name']);
    }
    $profileParts['General information']['Badges'] = $badgers;
}
$bucket = "profileTable";
include BOARD_ROOT . "lib/pluginloader.php";
$cpp = 15;
$total = FetchResult("SELECT\n\t\t\t\t\t\tcount(*)\n\t\t\t\t\tFROM {usercomments}\n\t\t\t\t\tWHERE uid={0}", $id);
$from = (int) $_GET["from"];
if (!isset($_GET["from"])) {
    $from = 0;
}
$realFrom = $total - $from - $cpp;
$realLen = $cpp;
if ($realFrom < 0) {
    $realLen += $realFrom;
Ejemplo n.º 26
0
        $Location = "Tutorial";
        $Content[]['Title'] = "Make Your Own... Tutorial!";
        $Content[]['Text'] = "Oh wow, oh wow. You must be very hungry for knowledge. I kinda want to, like, put your dick in my mouth. Er, I mean, you must want another example of a programming project to learn from! I'm not going to do much explaining, since by this point, I assume you should be able to figure it out on your own, but if you'd like to know how I threw this all together, you can download the source <a href=\"http://wetfish.net/php/index.txt\">here</a>.";
        $Content[]['Text'] = "Writing a tutorial really is pretty fun, believe it or not. It's kind of like a challenge to yourself, to see if you really know something well enough to explain it simply to others. If you're interested in writing your own tutorials, or helping out with an upcoming project, you should get in contact with <a href=\"irc://irc.wetfish.net/wetfish\">someone on irc</a> and ask wtf to do.";
        $Content[]['Text'] = "If you have any questions or comments, once agan, feel free to <a href=\"irc://irc.wetfish.net/wetfish\">yell at someone on IRC</a>!";
        $Content = Format($Content);
        break;
    default:
        $Location = "Introduction";
        $Content[]['Title'] = "An Introduction to PHP";
        $Content[]['Text'] = "Hmm, where to start, where to start.";
        $Content[]['Text'] = "PHP! Yes, this is a PHP tutorial. But what is PHP? Well, it's a recursive acronym, but I won't get into that. More importantly, it's a flexible language you can use to make websites (and a lot of other cool stuff). When you write something in PHP, you generally upload it to a server with a PHP interpreter, then anyone with a web browser and an internet connection should be able to see it!";
        $Content[]['Text'] = "But what do you need to start writing in PHP? Not much, not much at all! Any text editor that lets you save plain text, like notepad or mousepad, will do just fine. You'll also need an FTP client; I generally use <a href=\"http://filezilla-project.org/\" target=\"_blank\">FileZilla</a>, but there are some FireFox addons people have said are just as good. Since this is a Wetfish tutorial, I'm assuming you, the wonderful reader, already have a Wetfish account, which means you already have a server with a PHP interpreter! If you don't have a Wetfish account, you can always <a href=\"irc://irc.wetfish.net/wetfish\">join us on IRC</a> and beg raychjkl for one.";
        $Content[]['Text'] = "With that said, this tutorial assumes you have prior knowledge of basic HTML and CSS. Honestly, if you don't know HTML, it shouldn't make too much of a difference, so long as you feel confident enough in being able to pick it up as you go along. If you really want a place to learn some basic HTML first, check out <a href=\"http://www.w3schools.com/html/html_intro.asp\" target=\"_blank\">W3Schools</a>.";
        $Content[]['Text'] = "Now, let's get started...";
        $Content = Format($Content);
        break;
}
$TableOfContents['Introduction'] = "<a href=\"/php/\">Introduction</a>";
$TableOfContents['Basics'] = "<a href=\"?Go=basics\">Basics</a>";
//variables, arrays, echo, inc/decriment, print_r
$TableOfContents['Blocks'] = "<a href=\"?Go=blocks\">Blocks</a>";
//if, operators (not), elseif, else, switch
$TableOfContents['Loops'] = "<a href=\"?Go=loops\">Loops</a>";
//while, for, foreach
$TableOfContents['Functions'] = "<a href=\"?Go=functions\">Functions</a>";
//writing your own, predefined functions (empty, strlen, is_numeric)
$TableOfContents['Input'] = "<a href=\"?Go=input\">Input</a>";
//$_GET, $_POST, $_COOKIE
$TableOfContents['Error Handling'] = "<a href=\"?Go=errors\">Error Handling</a>";
//Clean(), basics of mysql injection
Ejemplo n.º 27
0
Archivo: push.php Proyecto: szisa/orz
<?php

if (isset($_GET["code"]) && isset($_GET["name"]) && isset($_GET["website"])) {
    $_DB = array("server" => "127.0.0.1", "database" => "isa", "user" => "root", "passwd" => "12345678");
    $data = array("code" => Format($_GET["code"]), "name" => Format($_GET["name"]), "website" => Format($_GET["website"]));
    if ($data["code"] != "" && $data["name"] != "") {
        $sql = "insert into `isa_js_push` (`name`, `code`, `website`, `create`) values ('" . $data["name"] . "', '" . $data["code"] . "', '" . $data["website"] . "', now())";
        $con = new mysqli($_DB["server"], $_DB["user"], $_DB["passwd"], $_DB["database"]);
        if ($con->connect_errno) {
            $error = "Failed to connect to database: (" . $con->connect_errno . ") " . $con->connect_error;
            echo json_encode(array("status" => "error", "msg" => $error));
        } else {
            if (false == $con->query($sql)) {
                $error = "Failed to push data: " . $con->error;
                echo json_encode(array("status" => "error", "msg" => $error . ":" . $sql));
            } else {
                echo json_encode(array("status" => "ok", "msg" => ""));
            }
            $con->close();
        }
    } else {
        echo json_encode(array("status" => "error", "msg" => "error param."));
    }
} else {
    echo json_encode($_GET);
}
function Format($value)
{
    $value = htmlspecialchars($value, ENT_QUOTES);
    $value = addslashes($value);
    return $value;