本文整理汇总了PHP中DataBase::Current方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::Current方法的具体用法?PHP DataBase::Current怎么用?PHP DataBase::Current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::Current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$template = new Template();
$template->load("plugin_changepassword_changepassword");
$template->show_if('PASSWORD_WRONG', false);
$template->show_if('SUCCESSFUL', false);
$template->show_if('OLD_PASSWORD_WRONG', false);
if (isset($_REQUEST['old_password']) && !empty($_REQUEST['old_password']) && is_string($_REQUEST['old_password']) && isset($_REQUEST['new_password']) && !empty($_REQUEST['new_password']) && is_string($_REQUEST['new_password']) && isset($_REQUEST['confirm_password']) && !empty($_REQUEST['confirm_password']) && is_string($_REQUEST['confirm_password'])) {
$old_password = DataBase::Current()->EscapeString($_REQUEST['old_password']);
$new_password = DataBase::Current()->EscapeString($_REQUEST['new_password']);
$confirm_password = DataBase::Current()->EscapeString($_REQUEST['confirm_password']);
if ($new_password != $confirm_password) {
$template->show_if('PASSWORD_WRONG', true);
} else {
$password = DataBase::Current()->EscapeString(md5($new_password . Settings::getInstance()->get("salt")));
$old_password = DataBase::Current()->EscapeString(md5($old_password . Settings::getInstance()->get("salt")));
$db_password = DataBase::Current()->ReadField("SELECT `password` FROM `{'dbprefix'}user` WHERE `id` = '" . User::Current()->id . "'; ");
if ($db_password && $db_password != null) {
if ($db_password != $old_password) {
$template->show_if('OLD_PASSWORD_WRONG', true);
} else {
DataBase::Current()->Execute("UPDATE `{'dbprefix'}user` SET `password` = '" . $password . "' WHERE `id` = '" . User::Current()->id . "'; ");
$template->show_if('SUCCESSFUL', true);
EventManager::raiseEvent("plugin_changepassword_change", array('old_password' => $old_password, 'new_password' => $password, 'userid' => User::Current()->id));
Cache::clear("tables", "userlist");
}
} else {
//Der User ist nicht in der Datenbank aufgeführt.
}
}
}
$template->assign_var('ACTION', UrlRewriting::GetUrlByAlias($this->page->alias));
echo $template->getCode();
}
示例2: display
public function display()
{
$form = new Form(2);
$form->submit();
$GLOBALS['editinglanguage'] = new Language($_GET['language']);
$table = new Table();
$token = new TableColumn("token", "Token");
$translation = new TableFunctionColumn("token", Language::DirectTranslate("TRANSLATION"));
$translation->functionName = "TranslationEditor_GetString";
$translation->autoWidth = true;
$languagetoken = new TableColumn("'" . DataBase::Current()->EscapeString($_GET['language']) . "' as language", "Language");
$languagetoken->value = $_GET['language'];
$languagetoken->visible = false;
$table->columns->add($token);
$table->columns->add($translation);
$table->columns->add($languagetoken);
$table->name = "{'dbprefix'}language_tokens";
$table->actions = "translation_tokens";
$table->orderBy = "token";
$table->size = -1;
$table->display();
$newModule = Language::DirectTranslateHtml("NEW_MODULE");
echo "<h2>" . $newModule . "</h2>";
$form->display();
}
示例3: getCode
/**
*
* @return string
*/
public function getCode()
{
if (isset($_POST['save'])) {
foreach ($_POST as $property => $value) {
if ($property != "save" && $property != "roles") {
$settings = Settings::getRootInstance()->specify($this->areaType, $this->area);
if ($this->dir != "" && $this->dir != "/") {
$settings = $settings->dir($this->dir);
}
$settings->set($property, $value, $this->role);
}
}
Settings::forceReload();
Cache::clear();
Language::GetGlobal()->ClearCache();
if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) {
exit;
} else {
die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>");
}
$changed = true;
}
$template = new Template();
$template->load($this->template);
if ($this->area != "global" || $this->areaType != "global") {
$roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
} else {
$roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
}
$roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name");
if ($roles) {
foreach ($roles as $role) {
if ($this->role == $role->id) {
$roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
} else {
$roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>";
}
}
}
$roleselector .= "</select>";
$template->assign_var("ROLES", $roleselector);
if ($this->area != "global" || $this->areaType != "global") {
$template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1");
} else {
$template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1");
}
$rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role);
if ($rows) {
foreach ($rows as $row) {
$index = $template->add_loop_item("SETTINGS");
$template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']);
$template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description']));
$control = new $row['type']();
$control->name = $row['name'];
$control->value = $row['value'];
$template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode());
}
}
return $template->getCode();
}
示例4: getCode
/**
*
* @return string
*/
public function getCode()
{
$res = "";
if ($this->cacheName != "" && Cache::contains("tables", $this->cacheName)) {
$res = Cache::getData("tables", $this->cacheName);
} else {
$res = "<table class='datatable'>";
$this->columns->actions = $this->actions;
$res .= $this->columns->getHeaderCode();
$res .= "<tbody>";
$rows_found = false;
if ($rows = DataBase::Current()->ReadRows($this->getSelect())) {
foreach ($rows as $row) {
$rows_found = true;
$res .= $this->columns->getBodyCode($row);
}
}
if (!$rows_found) {
$text = Language::GetGlobal()->Translate($this->noDataText);
$res .= "<tr><td colspan='" . $this->columns->count() . "'>" . htmlentities($text) . "</td></tr>";
}
$res .= "</tbody>";
$res .= "</table>";
if ($this->cacheName) {
Cache::setData("tables", $this->cacheName, $res);
}
}
return $res;
}
示例5: removeHandler
/**
*
* @param string $file
* @param string $event
* @return mixed
*/
public static function removeHandler($file, $event)
{
$file = DataBase::Current()->EscapeString($file);
$event = DataBase::Current()->EscapeString($event);
Cache::clear("eventmanager", "handler");
return DataBase::Current()->Execute("DELETE FROM {'dbprefix'}events WHERE event = '" . $event . "' AND file = '" . $file . "'");
}
示例6: save
/**
*
* @param int $dashboard
* @param int $column
* @param int $row
* @return boolean
*/
public function save($dashboard, $column, $row)
{
$dashboard = DataBase::Current()->EscapeString($dashboard);
$row = DataBase::Current()->EscapeString($row);
$column = DataBase::Current()->EscapeString($column);
$path = DataBase::Current()->EscapeString($this->path);
return DataBase::Current()->Execute("INSERT INTO {'dbprefix'}dashboards (alias, col, row, path) VALUES ('" . $dashboard . "','" . $column . "','" . $row . "','" . $path . "')");
}
示例7: __construct
public function __construct($id)
{
$id = DataBase::Current()->EscapeString($id);
if ($obj = DataBase::Current()->ReadRow("SELECT * FROM {'dbprefix'}data_validator WHERE id = '" . $id . "'")) {
$this->id = $obj->id;
$this->name = $obj->name;
$this->regex = $obj->regex;
$this->message = $obj->message;
$this->htmlCode = $obj->htmlCode;
}
}
示例8: loadActions
protected function loadActions()
{
$category = DataBase::Current()->EscapeString($this->category);
$actions = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}actionlists WHERE category='" . $category . "' ORDER BY id");
foreach ($actions as $action) {
$newAction = new Action();
$newAction->setID($action->id);
$newAction->setIcon($action->icon);
$newAction->setDestination($action->destination);
$newAction->setLabel($action->label);
$this->actions[] = $newAction;
}
}
示例9: deactivate
/**
*
* @return boolean
*/
public function deactivate()
{
$res = false;
if ($this->isActivated()) {
$path = DataBase::Current()->EscapeString($this->path);
@(include Settings::getValue("root") . "system/plugins/" . $path . "/deactivate.php");
foreach ($this->supportedLanguages as $language) {
Language::DropLanguagePack("plugin_" . $path, $language);
}
$res = DataBase::Current()->Execute("DELETE FROM {'dbprefix'}activated_plugins WHERE path = '" . $path . "'");
EventManager::RaiseEvent("deactivated_plugin", array("plugininfo", $this));
}
return $res;
}
示例10: displayEvents
private function displayEvents()
{
echo "<h2>" . Language::DirectTranslateHtml("EVENTS") . "</h2>";
$table = new Table();
$name = new TableColumn("UPPER(name)", "Name");
$table->columns->add($name);
$description = new TableColumn("CONCAT('{LANG:',UPPER(name),'_EVENTDESCRIPTION}')", Language::GetGlobal()->getString("WILL_BE_RAISED"));
$description->autoWidth = true;
$table->columns->add($description);
$table->condition = "dataType = '" . DataBase::Current()->EscapeString($_GET['show']) . "'";
$table->name = "{'dbprefix'}datatype_events";
$table->orderBy = "name";
$table->display();
}
示例11: getOverdued
/**
*
* @param int $limit
* @return Task
*/
public static function getOverdued($limit = 1)
{
$res = array();
$limit = DataBase::Current()->EscapeString($limit);
$tasks = DataBase::Current()->readRows("SELECT * FROM {'dbprefix'}tasks WHERE DATE_ADD(lastExecution, INTERVAL `interval` MINUTE) < NOW() or lastExecution IS NULL or DATE_ADD(lastExecution, INTERVAL `interval` MINUTE) IS NULL LIMIT 0," . $limit);
foreach ($tasks as $task) {
$newTask = new Task();
$newTask->setScript($task->script);
$newTask->setInterval($task->interval);
$newTask->setLastExecution($task->lastExecution);
$res[] = $newTask;
}
return $res;
}
示例12: display
public function display()
{
$settings = new SettingsForm();
$settings->role = 3;
$settings->url = UrlRewriting::GetUrlByAlias($_GET['include']);
if (isset($_GET['areatype'])) {
$settings->areaType = $_GET['areatype'];
}
if (isset($_GET['area'])) {
$settings->area = $_GET['area'];
}
if (isset($_GET['role'])) {
$settings->role = $_GET['role'];
}
$settings->display();
?>
<div style="margin-left:500px;">
<h2>Skins</h2>
<?php
$skins = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}skins WHERE LOWER(name) IN (SELECT DISTINCT name FROM {'dbprefix'}settings WHERE areaType = 'skins' AND area = {'dbprefix'}skins.name)");
if ($skins) {
foreach ($skins as $skin) {
$url = UrlRewriting::GetUrlByAlias("admin/settings", "areatype=skins&area=" . urlencode($skin->name));
echo "<a href=\"" . $url . "\">" . $skin->name . "</a><br />";
}
}
?>
<h2>Plugins</h2>
<?php
$plugins = new PluginList();
$plugins->loadAll();
foreach ($plugins->plugins as $plugin) {
if ($plugin->configurationFile != '') {
$url = UrlRewriting::GetUrlByAlias("admin/pluginsettings", "plugin=" . $plugin->path);
?>
<a href="<?php
echo $url;
?>
"><?php
echo $plugin->name;
?>
</a><br />
<?php
}
}
?>
</div>
<?php
}
示例13: validate
/**
*
* @param array $params
* @return boolean
*/
public function validate($params)
{
$select = $this->select;
foreach ($params as $key => $value) {
$select = str_ireplace("{VAR:" . strtoupper($key) . "}", DataBase::Current()->EscapeString($value), $select);
}
$res = DataBase::Current()->ReadField($select) > 0;
if (!$res) {
$message = $this->message;
foreach ($params as $key => $value) {
$message = str_ireplace("{VAR:" . strtoupper($key) . "}", DataBase::Current()->EscapeString($value), $message);
}
$this->finalMessage = $message;
}
return $res;
}
示例14: save
public function save()
{
$keywords = DataBase::Current()->EscapeString($this->keywords);
$description = DataBase::Current()->EscapeString($this->description);
$robots = DataBase::Current()->EscapeString($this->robots);
DataBase::Current()->Execute("DELETE FROM {'dbprefix'}meta_local WHERE page = '" . $this->pageid . "'");
if (trim($keywords) != "") {
DataBase::Current()->Execute("INSERT INTO {'dbprefix'}meta_local (page, name , content)\n VALUES('" . $this->pageid . "','keywords','" . $keywords . "')");
}
if (trim($description) != "") {
DataBase::Current()->Execute("insert into {'dbprefix'}meta_local (page, name , content)\n VALUES('" . $this->pageid . "','description','" . $description . "')");
}
if (trim(strtolower($robots)) != 'index, follow') {
DataBase::Current()->Execute("insert into {'dbprefix'}meta_local (page, name , content)\n VALUES('" . $this->pageid . "','robots','" . $robots . "')");
}
}
示例15: getByDataType
/**
*
* @param DataType $dataType
* @return array
*/
public static function getByDataType(DataType $dataType)
{
$res = array();
$dataTypeID = DataBase::Current()->EscapeString($dataType->getID());
$fields = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}datafields WHERE datatype = '" . $dataTypeID . "'");
foreach ($fields as $field) {
$fieldObj = new DataField();
$fieldObj->id = $field->id;
$fieldObj->dataTypeID = $field->dataType;
$fieldObj->dataType = $dataType;
$fieldObj->displayName = $field->displayName;
$fieldObj->dataName = $field->dataName;
$fieldObj->validatorID = $field->validator;
$res[] = $fieldObj;
}
return $res;
}