本文整理汇总了PHP中Core::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::assign方法的具体用法?PHP Core::assign怎么用?PHP Core::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: VALUES
$username = $core->CurrentUser()->Name;
// 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");
示例2: elseif
$action = "home";
}
$result = 0;
if (isset($_GET["read"]) && is_numeric(@$_GET["read"])) {
$note = $cms->ReadNotepad($_GET["read"]);
$_POST["id"] = $note->ID;
$_POST["title"] = $note->Title;
if ($cms->IsIGB()) {
$_POST["text"] = strip_tags($note->Text);
} else {
$_POST["text"] = $note->Text;
}
$action = "read";
} elseif ($action == "home") {
$titles = $cms->GetNotepadTitles();
$cms->assign("titles", $titles);
} elseif ($action == "newdone") {
if ($_POST["submit"] == "Save") {
if (empty($_POST["title"]) || empty($_POST["text"])) {
$action = "new";
$result = 1;
} else {
$cms->NewNotepad($_POST["title"], $_POST["text"]);
$cms->Goto("notepad.php");
}
} else {
$cms->Goto("notepad.php");
}
} elseif ($action == "editdone") {
if ($_POST["submit"] == "Save") {
if (empty($_POST["title"]) || empty($_POST["text"])) {
示例3: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
$step = @$_POST["step"];
if (empty($step)) {
$step = 1;
}
$result = 0;
$cms->assign("apiuserid", @$_POST["apiuserid"]);
$cms->assign("apikey", @$_POST["apikey"]);
$cms->assign("charid", @$_POST["charid"]);
$cms->assign("charname", @$_POST["charname"]);
$cms->assign("corpname", @$_POST["corpname"]);
$cms->assign("corpticker", @$_POST["corpticker"]);
$cms->assign("corpid", @$_POST["corpid"]);
if ($step == 2) {
if (empty($_POST["apiuserid"]) | empty($_POST["apikey"])) {
$result = 1;
$step = 1;
} else {
$res = $cms->GetUserCharacters($_POST["apiuserid"], $_POST["apikey"]);
if ($res === FALSE) {
$result = 2;
$step = 1;
} elseif (empty($res)) {
$result = 3;
$step = 1;
} elseif (count($res) == 1) {
$result = 4;
$step = 2;
示例4: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
$result = 0;
$cms->assign("username", @$_POST["username"]);
$cms->assign("apiuserid", @$_POST["apiuserid"]);
$cms->assign("apikey", @$_POST["apikey"]);
if (isset($_POST["submit"])) {
if (empty($_POST["apiuserid"]) || empty($_POST["apikey"])) {
$result = 1;
} elseif (empty($_POST["username"])) {
$result = 7;
} elseif (empty($_POST["password1"]) || empty($_POST["password2"])) {
$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;
示例5: Core
<?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');
示例6: Core
<?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');
示例7: elseif
$action = @$_GET["action"];
if (empty($action)) {
$action = "plugins";
}
$result = 0;
if (isset($_GET["edit"]) && is_numeric(@$_GET["edit"])) {
if (!isset($_POST["id"])) {
$plugin = $cms->ReadPlugIn($_GET["edit"]);
$_POST["id"] = $plugin->ID;
$_POST["title"] = $plugin->Title;
$_POST["releasecontrol"] = $plugin->Release;
$_POST["accesscontrol"] = $plugin->ReadAccess;
$_POST["showigb"] = $plugin->ShowIGB ? "on" : "";
$_POST["showadmin"] = $plugin->ShowAdmin ? "on" : "";
}
$cms->assign("id", @$_POST["id"]);
$cms->assign("title", @$_POST["title"]);
$cms->assign("releasecontrol", @$_POST["releasecontrol"]);
$cms->assign("accesscontrol", @$_POST["accesscontrol"]);
$cms->assign("showigb", @$_POST["showigb"]);
$cms->assign("showadmin", @$_POST["showadmin"]);
$action = "edit";
} elseif ($action == "editdone" && is_numeric(@$_POST["id"])) {
if ($_POST["submit"] == "Save") {
if (empty($_POST["title"])) {
$action = "edit";
$result = 1;
$cms->assign("id", @$_POST["id"]);
$cms->assign("title", @$_POST["title"]);
$cms->assign("releasecontrol", @$_POST["releasecontrol"]);
$cms->assign("accesscontrol", @$_POST["accesscontrol"]);
示例8: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
$ismoderator = $cms->CurrentUser()->HasPortalRole(User::MDYN_CEO) || $cms->CurrentUser()->HasPortalRole(User::MDYN_ForumModerator) || $cms->CurrentUser()->HasPortalRole(User::MDYN_Administrator) || $cms->CurrentUser()->HasEVERole(User::EVE_Director) ? 1 : 0;
$cms->assign("ismoderator", $ismoderator);
$cms->assign("pagetitle", " | Forums");
if (isset($_GET["category"]) && is_numeric(@$_GET["category"])) {
$access = $cms->CanReadCategory($_GET["category"]);
if ($access == 0) {
$cms->Goto("access.php");
}
if ($access == 2) {
$cms->Goto("forums.php?getcategorypassword=" . $_GET["category"]);
}
$page = 0;
if (isset($_GET["page"]) && is_numeric(@$_GET["page"])) {
$page = $_GET["page"] - 1;
}
$pagecount = floor($cms->ReadForumTopicCount($_GET["category"]) / 20) + 1;
if ($pagecount < 0) {
$pagecount = 0;
}
if ($page < 0) {
$page = 0;
}
if ($page > $pagecount - 1) {
$page = $pagecount - 1;
}
$cat = $cms->ReadForumCategory($_GET["category"]);
$topics = $cms->ReadForumTopics($_GET["category"], $page * 20);
示例9: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
$action = @$_GET["action"];
if (empty($action)) {
$action = "home";
}
$result = 0;
$isadmin = $cms->CurrentUser()->HasPortalRole(User::MDYN_CEO) || $cms->CurrentUser()->HasPortalRole(User::MDYN_Administrator) || $cms->CurrentUser()->HasEVERole(User::EVE_Director) ? 1 : 0;
$cms->assign("isadmin", $isadmin);
if ($cms->CurrentUser()->HasPortalRole(User::MDYN_CanSubmitNews) || $cms->CurrentUser()->AccessRight() >= 3) {
$cms->assign("canpost", true);
}
if (isset($_GET["read"]) && is_numeric(@$_GET["read"])) {
// Show news item from the archive
$note = $cms->ReadNewsItem($_GET["read"]);
$_POST["id"] = $note->ID;
$_POST["title"] = $note->Title;
$_POST["text"] = $note->Text;
$_POST["readaccess"] = $note->ReadAccess;
$cms->assign("author", $note->AuthorName);
$cms->assign("date", $note->Date);
$cms->assign("editid", $isadmin == true || $cms->CurrentUser()->AccessRight() >= 4 || $note->Author == $cms->CurrentUser()->ID ? $note->ID : 0);
$action = "read";
} elseif (isset($_GET["edit"]) && is_numeric(@$_GET["edit"])) {
$note = $cms->ReadNewsItem($_GET["edit"]);
$_POST["id"] = $note->ID;
$_POST["title"] = $note->Title;
$_POST["text"] = $note->Text;
$_POST["readaccess"] = $note->ReadAccess;
示例10: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
$action = @$_GET["action"];
if (empty($action)) {
$action = "home";
}
$result = 0;
$isadmin = $cms->CurrentUser()->HasPortalRole(User::MDYN_CEO) || $cms->CurrentUser()->HasPortalRole(User::MDYN_Administrator) || $cms->CurrentUser()->HasEVERole(User::EVE_Director) ? 1 : 0;
$cms->assign("isadmin", $isadmin);
if ($cms->CurrentUser()->HasPortalRole(User::MDYN_CanSubmitCalendar) || $cms->CurrentUser()->AccessRight() >= 3) {
$cms->assign("canpost", true);
}
// All corp members can post
if ($cms->CurrentUser()->AccessRight() >= 2) {
$cms->assign("canpost", true);
}
if (isset($_GET["view"])) {
// List all calendar entries
$allcalendar = $cms->ReadCalendarAll();
$calendar = array();
foreach ($allcalendar as $item) {
if (date("Ymd", strtotime($item->Date)) == $_GET["view"]) {
$calendar[] = $item;
}
}
$cms->assign("view", date("Y-m-d", strtotime($_GET["view"])));
$cms->assign("calendar", $calendar);
$action = "view";
} elseif (isset($_GET["read"]) && is_numeric(@$_GET["read"])) {
示例11: while
$portalid = $core->CurrentUser()->ID;
}
if ($template == "" || empty($template) || $template < 0) {
$template = 0;
}
if ($templatepost == "" || empty($templatepost) || $templatepost < 0) {
$templatepost = 0;
}
if ($return == "" || empty($return) || $return < 0) {
$return = 0;
}
if ($action == "home") {
$result = $core->SQL("SELECT * FROM operations_params");
while ($row = mysql_fetch_assoc($result)) {
if ($row["Name"] == "IndexDate") {
$core->assign("indexdate", $row["Value"]);
}
if ($row["Name"] == "IndexTime") {
$core->assign("indextime", $row["Value"]);
}
}
} elseif ($action == "qtc7" || $action == "qtc30") {
$timeperiod = 7;
if ($action == "qtc30") {
$timeperiod = 30;
}
$raw = file_get_contents("http://www.starvingpoet.net/feeds/mmi.xml");
if ($raw !== FALSE) {
$xml = new SimpleXMLElement($raw);
$date = $xml["date"];
$date = substr($date, 0, 4) . "-" . substr($date, 4, 2) . "-" . substr($date, 6, 2);
示例12: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
if ($cms->CurrentUser()->Name == "Guest") {
header("Location: access.php");
exit;
}
$action = @$_GET["action"];
$result = 0;
if (isset($_GET["user"]) && is_numeric(@$_GET["user"])) {
$cms->assign('showuser', $cms->GetUserFromID($_GET["user"]));
$cms->assign('posts', $cms->ForumRepliesByAuthor($_GET["user"]));
$_GET["action"] = "user";
} elseif ($action == "editdone") {
if ($_POST["submit"] == "Save") {
$cms->EditUserInfo($_POST["timezone"], $_POST["email"], $_POST["im"], $_POST["dob_Year"] . "-" . $_POST["dob_Month"] . "-" . $_POST["dob_Day"], $_POST["location"]);
if (!empty($_POST["apiuserid"]) && !empty($_POST["apikey"])) {
$cms->EditUserAPIInfo($_POST["apiuserid"], $_POST["apikey"]);
}
$settings = 0;
if (@$_POST["showgamenews"] == "on") {
$settings = $settings | User::ShowGameNews;
}
if (@$_POST["showdevblogs"] == "on") {
$settings = $settings | User::ShowDevBlogs;
}
if (@$_POST["showrpnews"] == "on") {
$settings = $settings | User::ShowRPNews;
}
if (@$_POST["showtqstatus"] == "on") {
示例13: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
if (!$cms->AccessCheck(User::EVE_Director, array(User::MDYN_CEO, User::MDYN_Administrator, User::MDYN_Developer))) {
$cms->Goto("access.php");
}
$action = @$_GET["action"];
if (empty($action)) {
$action = "cronjobs";
}
$result = 0;
$crontypes = array("Hourly at xx:00", "Hourly at xx:30", "Daily at 00:00 GMT", "Daily at 11:00 GMT", "Daily at 12:00 GMT", "Weekly on Mondays at 00:00 GMT", "Weekly on Wednesdays at 00:00 GMT", "Weekly on Fridays at 00:00 GMT", "Weekly on Saturdays at 00:00 GMT", "Weekly on Sundays at 00:00 GMT");
$cms->assign("crontypes", $crontypes);
if (isset($_GET["edit"]) && is_numeric(@$_GET["edit"])) {
if (!isset($_POST["id"])) {
$job = $cms->ReadCronJob($_GET["edit"]);
$_POST["id"] = $job->ID;
$_POST["title"] = $job->Title;
$_POST["type"] = $job->ScheduleType;
$_POST["source"] = $job->Source;
}
$cms->assign("id", @$_POST["id"]);
$cms->assign("title", @$_POST["title"]);
$cms->assign("type", @$_POST["type"]);
$cms->assign("source", @$_POST["source"]);
$action = "edit";
} elseif ($action == "editdone") {
if ($_POST["submit"] == "Save") {
if (empty($_POST["title"]) || empty($_POST["source"])) {
$action = "edit";
示例14: elseif
if (!$cms->AccessCheck(User::EVE_Director, array(User::MDYN_CEO, User::MDYN_Administrator))) {
$cms->Goto("access.php");
}
$action = @$_GET["action"];
if (empty($action)) {
$action = "users";
}
$result = 0;
if (isset($_GET["edit"]) && is_numeric(@$_GET["edit"])) {
if (!isset($_POST["id"])) {
$note = $cms->ReadArticle($_GET["edit"]);
$_POST["id"] = $note->ID;
$_POST["title"] = $note->Title;
$_POST["text"] = $note->Text;
}
$cms->assign("id", @$_POST["id"]);
$cms->assign("title", @$_POST["title"]);
$cms->assign("text", @$_POST["text"]);
$action = "edit";
} elseif ($action == "editdone") {
if ($_POST["submit"] == "Save") {
if (empty($_POST["title"]) || empty($_POST["text"])) {
$action = "edit";
$result = 1;
$cms->assign("id", @$_POST["id"]);
$cms->assign("title", @$_POST["title"]);
$cms->assign("text", @$_POST["text"]);
} else {
if ($_POST["id"] == 1 || $_POST["id"] == 2) {
$cms->EditArticle($_POST["id"], $_POST["title"], $_POST["text"], 0, 4);
} else {
示例15: Core
<?php
require_once '../core/core.class.php';
$cms = new Core();
$article = $cms->ReadArticle(4);
$cms->assign("help", $article);
$cms->display('help.tpl');