Exemple #1
2
 public function run()
 {
     $static_found = false;
     foreach (Core::get_system('static_views') as $view) {
         /** Verify a static template for the url does not exist */
         $dir = opendir(Core::get_system('views') . '/' . $view);
         while ($file = readdir($dir)) {
             /** This is a template file that has a url specific extension */
             $exploded = explode('.', $file);
             if (strpos($file, '.tpl') && $exploded[1] === current(Core::get_args())) {
                 $static_found = true;
             }
         }
         closedir($dir);
         if ($static_found) {
             break;
         }
     }
     /** Handle 404 Errors */
     if (current(Core::get_args()) !== 'default' && $static_found === false) {
         Core::error('404');
     } else {
         /** Display the default page or 404*/
         Core::display();
     }
 }
        $result = 4;
    } elseif ($_POST["password1"] != $_POST["password2"]) {
        $result = 5;
    } else {
        $result = $cms->CoreSQL("SELECT * FROM users WHERE Name='" . $cms->SQLEscape($_POST["username"]) . "' OR FIND_IN_SET('" . $cms->SQLEscape($_POST["username"]) . "', Alts) LIMIT 1");
        if (mysql_num_rows($result) == 0) {
            $result = 6;
        } else {
            $res = $cms->GetUserCharacters($_POST["apiuserid"], $_POST["apikey"]);
            if ($res === FALSE) {
                $result = 2;
            } elseif (empty($res)) {
                $result = 3;
            } elseif (count($res) > 0) {
                foreach ($res as $char) {
                    if ($char["Name"] == $_POST["username"]) {
                        $result = 8;
                        $cms->CoreSQL("UPDATE users SET Password='******' WHERE Name='" . $cms->SQLEscape($_POST["username"]) . "' OR FIND_IN_SET('" . $cms->SQLEscape($_POST["username"]) . "', Alts) LIMIT 1");
                        break;
                    }
                }
                if ($result != 8) {
                    $result = 6;
                }
            }
        }
    }
}
$cms->assign('result', $result);
$cms->display('newpassword.tpl');
Exemple #3
0
 /** Default test functionality */
 public function run()
 {
     $value = Core::get_args(1);
     $use = array('date', 'email', 'ip', 'url', 'password', 'username', 'name', 'alpha', 'numeric', 'int', 'float', 'alphanumeric');
     $results = array();
     foreach (get_class_methods(get_class($this)) as $method) {
         if (method_exists($this, $method) && in_array($method, $use)) {
             $results[$method] = $this->{$method}($value);
         }
     }
     Core::set_response($results);
     Core::display('json');
 }
    foreach ($itemsdb as $item) {
        $val = explode("=", $item);
        $opvalue += $allitems[$val[0]] * $val[1];
    }
    $opvalue = number_format($opvalue, 0);
    // Display to the user
    $core->assign("opdate", $opdate);
    $core->assign("players", $players);
    $core->assign("items", $itemsdisplay);
    $core->assign("notes", $notes);
    $core->assign("opvalue", $opvalue);
}
$result = $core->SQL("SELECT * FROM `operations_groups` WHERE Active = 1 ORDER BY `DisplayOrder`, `GroupID`");
while ($row = mysql_fetch_assoc($result)) {
    $ogroupid[$row['id']] = $row['id'];
    $ogroupName[$row['id']] = $core->SQLUnEscape($row['Name']);
    $ogroupSubtext[$row['id']] = $core->SQLUnEscape($row['Subtext']);
    $ogroupGroupID[$row['id']] = $row['GroupID'];
    $ogroupDisplayOrder[$row['id']] = $row['DisplayOrder'];
    $ogroupCheckbox[$row['id']] = $row['Checkbox'];
}
$core->assign("ogroupid", $ogroupid);
$core->assign("ogroupName", $ogroupName);
$core->assign("ogroupSubtext", $ogroupSubtext);
$core->assign("ogroupGroupID", $ogroupGroupID);
$core->assign("ogroupDisplayOrder", $ogroupDisplayOrder);
$core->assign("ogroupCheckbox", $ogroupCheckbox);
$core->assign("action", $action);
$core->assign("result", @$_GET["result"]);
$core->display($core->PlugInPath . "payoutsubmission/payoutsubmission.tpl");
    $ops = array();
    $total = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $opvalue = 0;
        $players = array();
        $playersdb = explode(",", $row["Players"]);
        foreach ($playersdb as $player) {
            $players[] = $names[$player];
        }
        $items = array();
        $itemsdb = explode(",", $row["Items"]);
        foreach ($itemsdb as $item) {
            $val = explode("=", $item);
            $items[$val[0]] = $val[1];
            $opvalue += $allitems[$val[0]] * $val[1];
        }
        $total += $opvalue;
        $opvalue = number_format($opvalue, 0);
        $ops[] = array("ID" => $row["id"], "Value" => $opvalue, "Leader" => $names[$row["Leader"]], "Players" => implode(",", $players), "Date" => $core->GMTToLocal($row["Date"]), "OpDate" => $row["OpDate"], "Notes" => $core->SQLUnEscape($row["Notes"]));
    }
    $total = number_format($total, 0);
    $core->assign("total", $total);
    $core->assign("ops", $ops);
    $core->assign("opcount", count($ops));
}
$core->assign("action", $action);
$core->display($core->PlugInPath . "payoutmanagement/payoutmanagement.tpl");
function cmp($a, $b)
{
    return strcasecmp($a[1], $b[1]);
}
            $cms->assign("allusers", $cms->GetRegisteredUserNames());
        }
    }
} elseif ($step == 3) {
    $cms->assign("charid", $_POST["char"]);
    $cms->assign("charname", $_POST["name_" . $_POST["char"]]);
    $cms->assign("corpname", $_POST["corp_" . $_POST["char"]]);
    $cms->assign("corpticker", $_POST["corpticker_" . $_POST["char"]]);
    $cms->assign("corpid", $_POST["corpid_" . $_POST["char"]]);
    if ($cms->CharacterIDExists($_POST["char"])) {
        $res = $cms->GetUserCharacters($_POST["apiuserid"], $_POST["apikey"]);
        $cms->assign("characters", $res);
        $cms->assign("allusers", $cms->GetRegisteredUserNames());
        $result = 8;
        $step = 2;
    }
} elseif ($step == 4) {
    if (empty($_POST["password1"]) || empty($_POST["password2"])) {
        $result = 6;
        $step = 3;
    } elseif ($_POST["password1"] != $_POST["password2"]) {
        $result = 7;
        $step = 3;
    } else {
        $cms->RegisterNewUser($_POST["apiuserid"], $_POST["apikey"], $_POST["charid"], $_POST["charname"], $_POST["password1"], $_POST["corpid"], $_POST["corpname"], $_POST["corpticker"]);
    }
}
$cms->assign("step", $step);
$cms->assign("result", $result);
$cms->display('register.tpl');
Exemple #7
0
 public static function error($type)
 {
     self::run_hook('core_error', array($type));
     switch ($type) {
         case '403':
             self::run_hook('core_error_403', array($type));
             header('HTTP/1.0 403 Forbidden');
             Core::set_args(array('403'));
             Core::display();
             break;
         case '404':
             self::run_hook('core_error_404', array($type));
             header('HTTP/1.0 404 Not Found');
             Core::set_args(array('404'));
             Core::display();
             break;
     }
 }
<?php

require_once '../core/core.class.php';
$cms = new Core();
if (!$cms->AccessCheck()) {
    header("Location: access.php");
    exit;
}
$article = $cms->ReadArticle(3);
$cms->assign("quickinfo", $article);
$cms->display('quickinfo.tpl');
            $cms->Goto("articles.php");
        }
    } elseif ($_POST["submit"] == "Delete" && is_numeric(@$_POST["id"])) {
        $cms->DeleteArticle($_POST["id"]);
        $cms->Goto("articles.php");
    } else {
        $cms->Goto("articles.php");
    }
} elseif ($action == "newcomment" && is_numeric(@$_POST["article"])) {
    $id = $_POST["article"];
    $text = @$_POST["text"];
    if (!empty($text)) {
        $cms->NewArticleComment($id, $text);
    }
    $cms->Goto("articles.php?read=" . $id);
}
if (!isset($_POST["readaccess"])) {
    $_POST["readaccess"] = 2;
}
if (!isset($_POST["writeaccess"])) {
    $_POST["writeaccess"] = 4;
}
$cms->assign("action", $action);
$cms->assign("result", $result);
$cms->assign("id", @$_POST["id"]);
$cms->assign("title", @$_POST["title"]);
$cms->assign("text", @$_POST["text"]);
$cms->assign("readaccess", @$_POST["readaccess"]);
$cms->assign("writeaccess", @$_POST["writeaccess"]);
$cms->display('articles.tpl');
Exemple #10
0
 public function search()
 {
     /** Do we have a search string and a model to search? */
     if (isset($_GET['query']) && isset($this->model)) {
         $query = urldecode($_GET['query']);
         $model = Model::load($this->model);
         $search_fields = array();
         foreach ($model->getSchema() as $key => $val) {
             foreach ($val as $k => $v) {
                 if ($k == 'search' && $v) {
                     $search_fields[] = $key;
                     break;
                 }
             }
         }
         $search_on = array();
         foreach ($_GET as $key => $value) {
             if (in_array($key, $search_fields)) {
                 $search_on[] = $key;
             }
         }
         if (count($search_on) === 0) {
             $search_on = $search_fields;
         }
         $where = array();
         foreach ($search_on as $key) {
             $where[$key] = $query;
         }
         Core::set_response($model->get(array('where' => $where, 'search' => true)));
         Core::display('json');
     }
 }
<?php

require_once '../core/core.class.php';
$cms = new Core();
if (isset($_GET["delete"]) && is_numeric(@$_GET["delete"]) && $cms->CurrentUser()->HasPortalRole(User::MDYN_Administrator)) {
    $cms->CoreSQL("DELETE FROM feedback WHERE id=" . $_GET["delete"] . " LIMIT 1");
    $cms->Goto("feedback.php");
} elseif ($cms->CurrentUser()->HasPortalRole(User::MDYN_Administrator)) {
    $feedbacks = array();
    $result = $cms->CoreSQL("SELECT * FROM feedback");
    while ($row = mysql_fetch_assoc($result)) {
        $feedbacks[] = array($cms->SQLUnEscape($row["Name"]), $cms->SQLUnEscape($row["EMail"]), $cms->SQLUnEscape($row["APIUserID"]), $cms->SQLUnEscape($row["APIKey"]), $cms->SQLUnEscape($row["Notes"]), $row["id"], $cms->GMTToLocal($row["Date"]));
    }
    $cms->assign("feedbacks", $feedbacks);
} elseif (@$_GET["result"] == "1") {
    $cms->assign("result", 1);
} elseif (@$_POST["submit"] == "Submit") {
    $query = "INSERT INTO feedback (Date,Name,Email,APIUserID,APIKey,Notes) VALUES (";
    $query .= "'" . $cms->GMTTime() . "',";
    $query .= "'" . $cms->SQLEscape($_POST["name"]) . "',";
    $query .= "'" . $cms->SQLEscape($_POST["email"]) . "',";
    $query .= "'" . $cms->SQLEscape($_POST["apiuserid"]) . "',";
    $query .= "'" . $cms->SQLEscape($_POST["apikey"]) . "',";
    $query .= "'" . $cms->SQLEscape($_POST["notes"]) . "')";
    $cms->CoreSQL($query);
    $cms->Goto("feedback.php?result=1");
}
$cms->display('feedback.tpl');
<?php

require_once '../core/core.class.php';
$cms = new Core();
$cms->display('notfound.tpl');
    // Online characters
    $onlinechars = "";
    $chars = $cms->GetOnlineCharacters();
    if (!empty($chars)) {
        $onlinechars = "<p>";
        foreach ($chars as $id => $char) {
            $onlinechars .= "<a href=\"profile.php?user="******"\">" . $char . "</a><br />";
        }
        $onlinechars .= "</p>";
    }
    $cms->assign('onlinechars', $onlinechars);
    // Plug-in XML feeds
    $feeds = $cms->ReadPlugInFeedbacks();
    $cms->assign('pluginfeeds', $feeds);
}
$cms->display('home.tpl');
// *******************************************************
// Returns the skill in training
// *******************************************************
function GetSkillInTraining()
{
    global $cms;
    if ($cms->CurrentUser()->IsGuest) {
        return "";
    }
    $raw = $cms->APIQuery("http://api.eve-online.com/char/SkillInTraining.xml.aspx");
    if ($raw == FALSE) {
        return array(0, "<p>Could not connect to the API server.</p>");
    }
    $xml = new SimpleXMLElement($raw);
    if ((int) $xml->error['code'] > 0) {
<?php

require_once '../core/core.class.php';
$cms = new Core();
$article = $cms->ReadArticle(2);
$cms->assign("policies", $article);
$cms->display('policies.tpl');
        $eveprices[] = array("UnitPrice" => number_format($unit, 2), "Quantity" => number_format($row["Quantity"], 0), "Cost" => number_format($price, 0), "EveTypeID" => $row["EveTypeID"], "Name" => $core->SQLUnEscape($row["Name"]), "Icon" => $row["Icon"]);
    }
    mysql_free_result($result);
    $core->assign("eveprices", $eveprices);
    $core->assign("totaleveprice", number_format($total));
} elseif ($action == "editdone") {
    if ($_POST["submit"] == "Save") {
        $id = $_POST["id"];
        $price = $_POST["price"];
        $allyprice = $_POST["allyprice"];
        $core->SQL("UPDATE production_items SET Price=" . $price . ",AlliancePrice=" . $allyprice . " WHERE id=" . $id . " LIMIT 1");
    }
    $core->Goto("index.php");
}
$core->assign('action', $action);
$core->display($core->PlugInPath . "productionprices/productionprices.tpl");
// *************************************************************************
// Update's the Production Item's Price in the "production_items" database
// *************************************************************************
function changeprice($id, $percent, $group)
{
    global $core;
    //  $id = $_GET["edit"];
    $result = $core->SQL("SELECT EveTypeID,Name,Price,AlliancePrice,GroupName FROM production_items WHERE id=" . $id);
    $row = mysql_fetch_assoc($result);
    $eveid = $row["EveTypeID"];
    $core->assign("id", $id);
    $core->assign("name", $core->SQLUnEscape($row["Name"]));
    $core->assign("groupname", $core->SQLUnEscape($row["GroupName"]));
    $core->assign("price", number_format($row["Price"], 0, '.', ''));
    $core->assign("allyprice", number_format($row["AlliancePrice"], 0, '.', ''));
<?php

require_once '../core/core.class.php';
$cms = new Core();
if (isset($_GET["unsubscribe"]) && is_numeric(@$_GET["unsubscribe"])) {
    $cms->UnSubscribeForumTopic($_GET["unsubscribe"]);
}
// List all signed-up events
$calendar = $cms->ReadCalendarSignups();
$cms->assign("calendar", $calendar);
// Subscribed topics
$subs = $cms->GetForumSubscriptions();
$cms->assign('subscriptions', $subs);
$cms->display('signups.tpl');
    $core->Goto("index.php?action=admin");
} elseif ($action == "comment") {
    $id = $_POST["image"];
    $text = @$_POST["comment"];
    if (!empty($text)) {
        $core->SQL("INSERT INTO gallery_comments (Image,Date,User,Comment) VALUES (" . $id . ",'" . $core->GMTTime() . "'," . $core->CurrentUser()->ID . ",'" . $core->SQLEscape($text) . "')");
    }
    $core->Goto("index.php?show=" . $id);
} elseif ($action == "deletecomment") {
    $id = $_GET["deletecomment"];
    $core->SQL("DELETE FROM gallery_comments WHERE id=" . $id);
    $core->Goto("index.php?show=" . $_GET["image"]);
}
$core->assign("action", $action);
$core->assign("result", @$_GET["result"]);
$core->display($core->PlugInPath . "gallery/gallery.tpl");
// *****************************************************
// Check if the thumbnail for the given image exists
// Create the thumbnail if necessary
// *****************************************************
function CheckThumb($path, $owner, $id, $ext)
{
    $name = $owner . "_" . $id . "." . $ext;
    $thumb = $owner . "_" . $id . "_thumb.jpg";
    if (file_exists($path . DIRECTORY_SEPARATOR . $name)) {
        if (!file_exists($path . DIRECTORY_SEPARATOR . $thumb)) {
            if ($ext == "gif") {
                $im = @imagecreatefromgif($path . DIRECTORY_SEPARATOR . $name);
            } elseif ($ext == "jpg") {
                $im = @imagecreatefromjpeg($path . DIRECTORY_SEPARATOR . $name);
            } elseif ($ext == "png") {
    $id = $_GET["delete"];
    $result = $core->SQL("SELECT id,Status,Count FROM production_orders WHERE id={$id}");
    while ($row = mysql_fetch_assoc($result)) {
        $confirmstatus = $row["Status"];
        $confirmcount = $row["Count"];
    }
    mysql_free_result($result);
    if ($confirmstatus == 4 || $confirmstatus == 6 || $confirmcount == 0) {
        $core->SQL("UPDATE production_orders SET IsDeleted=1 WHERE id=" . $id . " LIMIT 1");
        $core->Goto("index.php");
    } else {
        $core->Goto("index.php?result=1");
    }
}
$core->assign('action', $action);
$core->display($core->PlugInPath . "productionmanagement/productionmanagement.tpl");
function StatusName($status)
{
    // Status
    // 0 - New Order
    // 1 - Need BPC
    // 2 - Need Materials
    // 3 - Producing
    // 4 - Contracted
    // 5 - Paid
    // 6 - Rescinded
    // 7 - Producing < 7 Days
    // 8 - Producing < 14 Days
    // 9 - Producing < 21 Days
    // 10 - Queued Unk Eta
    $names = array("New Order", "Need BPC", "Need Materials", "Producing", "Contracted", "Paid", "Rescinded", "Producing < 7 Days", "Producing < 14 Days", "Producing < 21 Days", "Queued Unk Eta");
<?php

require_once '../core/core.class.php';
$cms = new Core();
// Login user
$username = @$_POST["username"];
$password = @$_POST["password"];
if ($cms->Login($username, $password)) {
    @session_start;
    if (isset($_SESSION["lastpage"])) {
        $lastpage = $_SESSION["lastpage"];
        unset($_SESSION["lastpage"]);
        if (stripos($lastpage, "login.php") !== FALSE || stripos($lastpage, "newpassword.php") !== FALSE || stripos($lastpage, "register.php") !== FALSE) {
            $cms->Goto("home.php");
        } else {
            $cms->Goto($lastpage);
        }
    } else {
        $cms->Goto("home.php");
    }
} else {
    $cms->Log("Login error. Wrong username (" . $username . ") or password.");
}
$cms->display('login.tpl');
    $cms->Goto("admin.php");
} elseif ($action == "log") {
    $page = @$_GET["page"];
    if (empty($page)) {
        $page = "1";
    }
    $pagesize = 50;
    $count = $cms->LogCount();
    $pagecount = ceil($count / $pagesize);
    $cms->assign("logs", $cms->ReadLog(($page - 1) * $pagesize, $pagesize));
    $cms->assign("page", $page);
    $cms->assign("pagecount", $pagecount);
}
$cms->assign("action", $action);
$cms->assign("result", $result);
$cms->display('admin.tpl');
function cmp($a, $b)
{
    return strcasecmp($a["Name"], $b["Name"]);
}
function objcmp($a, $b)
{
    if ($a->IsCEO()) {
        return -1;
    } elseif ($b->IsCEO()) {
        return 1;
    }
    if ($a->IsDirector() && !$b->IsDirector()) {
        return -1;
    } elseif ($b->IsDirector() && !$a->IsDirector()) {
        return 1;
        // 3 - Rejected
        // 4 - Paid
        // 5 - Deleted
        if ($row["Status"] == 4) {
            $canedit = false;
        }
        if ($core->IsIGB()) {
            $canedit = false;
        }
        $ops[] = array("ID" => $row["id"], "Leader" => $names[$row["Leader"]], "Players" => implode(",", $players), "Date" => $core->GMTToLocal($row["Date"]), "OpDate" => $row["OpDate"], "Status" => $row["Status"], "CanEdit" => $canedit);
    }
    $core->assign("ops", $ops);
}
$result = $core->SQL("SELECT * FROM `operations_groups` ORDER BY `DisplayOrder`, `GroupID`");
while ($row = mysql_fetch_assoc($result)) {
    $ogroupid[$row['id']] = $row['id'];
    $ogroupName[$row['id']] = $core->SQLUnEscape($row['Name']);
    $ogroupSubtext[$row['id']] = $core->SQLUnEscape($row['Subtext']);
    $ogroupGroupID[$row['id']] = $row['GroupID'];
    $ogroupDisplayOrder[$row['id']] = $row['DisplayOrder'];
    $ogroupCheckbox[$row['id']] = $row['Checkbox'];
}
$core->assign("ogroupid", $ogroupid);
$core->assign("ogroupName", $ogroupName);
$core->assign("ogroupSubtext", $ogroupSubtext);
$core->assign("ogroupGroupID", $ogroupGroupID);
$core->assign("ogroupDisplayOrder", $ogroupDisplayOrder);
$core->assign("ogroupCheckbox", $ogroupCheckbox);
$core->assign("action", $action);
$core->display($core->PlugInPath . "payoutview/payoutview.tpl");
if (isset($_POST['ip']) && !empty(trim($_POST['ip']))) {
    $ipAddress = $_POST['ip'];
} else {
    $ipAddress = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : getenv('REMOTE_ADDR');
    if ($ipAddress == '::1') {
        $ipAddress = '127.0.0.1';
    }
}
/**
 * 指派要呈現的樣板變數和資料
 */
$smarty->assign(array('title' => 'HSDN - IP Information and Spam Check', 'subTitle' => 'IP Information and Spam Check', 'ipAddr' => $ipAddress, 'ipGeo' => _ip2geo($ipAddress), 'spamCheck' => _ipSpamCheck($ipAddress)));
/**
 * 指定要呈現資料的樣板名稱
 */
$smarty->display('main.html');
/**
 * 檢查IP是否被列為Spam來源
 * @param  String $ipAddress IP位址
 * @return Array             檢查結果
 */
function _ipSpamCheck($ipAddress)
{
    $revip = implode(".", array_reverse(explode(".", $ipAddress, 4), false));
    /**
     * 使用的SPAM檢查服務
     * Abuseat: http://www.abuseat.org/faq.html
     * Barracuda: http://www.barracudacentral.org/rbl/how-to-use
     * Sorbs: http://www.sorbs.net/general/using.shtml
     * Spamcop: https://www.spamcop.net/fom-serve/cache/291.html
     * Spamhaus: https://www.spamhaus.org/faq/section/DNSBL%2520Usage#202
            $result["Shares"] = $xml->result->shares;
            $result[] = "";
            $result["Description"] = $xml->result->description;
            $result["Web&nbsp;Site"] = empty($xml->result->url) ? "" : "<a href='" . $xml->result->url . "'>" . $xml->result->url . "</a>";
            $error = "";
        }
    }
    $core->assign("action", "corp");
    $core->assign("error", $error);
    $core->assign("result", $result);
} else {
    $users = $core->GetAllUsers(true, true);
    usort($users, "objcmp");
    $core->assign("users", $users);
}
$core->display($core->PlugInPath . 'orgchart/orgchart.tpl');
// Sorts users by role then name
function objcmp($a, $b)
{
    if ($a->IsCEO()) {
        return -1;
    } elseif ($b->IsCEO()) {
        return 1;
    }
    if ($a->IsDirector() && !$b->IsDirector()) {
        return -1;
    } elseif ($b->IsDirector() && !$a->IsDirector()) {
        return 1;
    }
    if ($a->IsManager() && !$b->IsManager()) {
        return -1;
<?php

require_once '../core/core.class.php';
$cms = new Core();
$cms->display('feeds.tpl');
Exemple #25
0
<?php

if (!file_exists("config/parameters.yml")) {
    echo "you should install the app before playing !<br/>";
    echo "./config/install.sh<br/>";
    die;
}
require_once 'library/Core.php';
$core = new Core();
$core->loadTron();
$core->display();
    }
    $result = $cms->CoreSQL("SELECT COUNT(t1.ReplyCount) AS RowCount,t2.Name,t2.id FROM forum_topics AS t1 LEFT JOIN users AS t2 ON t1.AuthorID=t2.id WHERE t2.Name!='Guest' GROUP BY t1.AuthorID ORDER BY RowCount DESC LIMIT 20");
    $members = array();
    while ($row = mysql_fetch_assoc($result)) {
        $members[] = array("URL" => "profile.php?user="******"id"], "Title" => $cms->SQLUnescape($row["Name"]), "Data" => $row["RowCount"]);
    }
    $cms->assign("mostviewed", $mostviewed);
    $cms->assign("mostreplied", $mostreplied);
    $cms->assign("members", $members);
    $cms->assign("pagetitle", " | Forums | Statistics");
    $cms->assign("action", "stats");
} elseif (@$_GET["action"] == "members") {
    $result = $cms->CoreSQL("SELECT id,Name,CorporationName,CorporationTicker FROM users WHERE Name!='Guest' ORDER BY Name ASC");
    $members = array();
    while ($row = mysql_fetch_assoc($result)) {
        $members[] = array("URL" => "profile.php?user="******"id"], "Title" => $cms->SQLUnescape($row["Name"]), "Data" => $cms->SQLUnescape($row["CorporationName"]) . " [" . $cms->SQLUnescape($row["CorporationTicker"]) . "]");
    }
    $cms->assign("members", $members);
    $cms->assign("pagetitle", " | Forums | Members");
    $cms->assign("action", "members");
} else {
    // List all categories
    $cats = $cms->ReadForumCategories();
    $cms->assign("cats", $cats);
    // Hot topics
    $hottopics = $cms->ReadHotForumTopics();
    $cms->assign("hottopics", $hottopics);
    $cms->assign("action", "home");
}
$cms->display('forums.tpl');
// Browser string
$browser = @$_SERVER["HTTP_USER_AGENT"];
if (empty($browser)) {
    $browser = "Unknown";
}
// Save username and browser string in our database
// SQL($query) is a method of the Core object that runs a SQL query on the plugin database
// SQLEscape($string) is also a Core method that is a shorthand for mysql_real_escape_string($string)
$core->SQL("INSERT INTO `browserstats` (`User`, `Browser`) VALUES ('" . $core->SQLEscape($username) . "', '" . $core->SQLEscape($browser) . "') ON DUPLICATE KEY UPDATE `Browser`='" . $core->SQLEscape($browser) . "'");
// Read the database
$result = $core->SQL("SELECT * FROM `browserstats`");
$browserstats = array();
while ($row = mysql_fetch_assoc($result)) {
    $br = new Browser($core->SQLUnEscape($row["Browser"]));
    $browsername = "{$br->Platform}, {$br->Name} {$br->Version}";
    if (isset($browserstats[$browsername])) {
        $browserstats[$browsername] += 1;
    } else {
        $browserstats[$browsername] = 1;
    }
}
// We have the browser stats in an array. Now assign it to a Smarty template variable
// So that it will be availabe in the Smarty template.
// You can assign any type of variable: numbers, strings, arrays, objects... all work
// The format is $core->assign("template_variable_name", "variable_value")
$core->assign("browserstats", $browserstats);
// We are done. Last step is to display our Smarty template
// PlugInPath is a property of the Core object that returns the absolute path to the main plugin directory.
// Relative paths do not work here.
$core->display($core->PlugInPath . "browserstats/browserstats.tpl");
<?php

require_once '../core/core.class.php';
$cms = new Core();
$cms->display('access.tpl');
?>

        $cms->assign("toid", $toid);
        $action = "compose";
    } else {
        $cms->Goto("mail.php");
    }
} elseif ($action == "delete") {
    $cms->DeleteMail($message);
    $cms->Goto("mail.php");
} elseif ($action == "do") {
    $todo = $_POST["dowhat"];
    $ids = array();
    foreach ($_POST as $key => $value) {
        if (substr($key, 0, 8) == "mailitem" && $value == "on") {
            $ids[] = substr($key, 8);
        }
    }
    if ($todo == "delete") {
        $cms->DeleteMail($ids);
    } elseif ($todo == "markread") {
        $cms->MarkMailRead($ids, true);
    } elseif ($todo == "markunread") {
        $cms->MarkMailRead($ids, false);
    }
    $cms->Goto("mail.php?action=" . $_POST["mailbox"]);
}
$cms->assign("action", $action);
$cms->assign("folder", $folder);
$cms->assign("message", $message);
$cms->assign("result", $result);
$cms->display('mail.tpl');
<?php

require_once '../core/core.class.php';
$cms = new Core();
$article = $cms->ReadArticle(4);
$cms->assign("help", $article);
$cms->display('help.tpl');