本文整理汇总了PHP中SafeDB函数的典型用法代码示例。如果您正苦于以下问题:PHP SafeDB函数的具体用法?PHP SafeDB怎么用?PHP SafeDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SafeDB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($HtmlName, $Action = '', $Method = 'post', $OtherParams = '')
{
$this->htmlName = SafeDB($HtmlName, 255, str);
$this->action = SafeDB($Action, 255, str);
$this->method = SafeDB($Method, 255, str);
$this->otherParams = $OtherParams;
}
示例2: SmiliesReplace
/**
* Парсер смайликов.
* @param $text
* @return void
*/
function SmiliesReplace(&$text)
{
static $codes = null;
if (!isset($codes)) {
$codes = array();
$smilies_dir = System::config('general/smilies_dir');
$smilies = System::database()->Select('smilies');
// Пусть отключенные смайлики тоже парсятся
foreach ($smilies as $smile) {
$sub_codes = explode(',', $smile['code']);
$smile_file = SafeDB($smile['file'], 255, str);
if ($smile['desc'] != '') {
$title = SafeDB($smile['desc'], 255, str);
} else {
$title = SafeDB(GetFileName($smile_file, true), 255, str);
}
foreach ($sub_codes as $code) {
$code = trim($code);
if ($code != '') {
$codes[$code] = '<img src="' . RealPath2($smilies_dir . $smile_file) . '" title="' . $title . '">';
}
}
}
}
$text = strtr($text, $codes);
}
示例3: CatEditor
/**
* Редактор категорий
* @param null $CatId
* @param null $ToId
* @param string $OtherUrlParams
* @return void
*/
public function CatEditor($CatId = null, $ToId = null, $OtherUrlParams = '')
{
$title = '';
$desc = '';
$icon = '';
$boxtitle = 'Добавить категорию';
$save_met = $this->save_met;
if ($CatId != null) {
$cat = System::database()->SelectOne($this->Table, "`id`='{$CatId}'");
$title = SafeDB($cat['title'], 255, str);
$desc = SafeDB($cat['description'], 0, str, false);
$icon = SafeDB($cat['icon'], 255, str);
$parent = SafeDB($cat['parent'], 11, int);
$boxtitle = 'Редактирование категории';
$save_met = $this->save_met . '&' . $this->id_par_name . '=' . $CatId;
$cmd = 'Сохранить изменения';
} else {
if ($ToId != null) {
$parent = $ToId;
} elseif (isset($_GET['_cat_adto'])) {
$parent = SafeEnv($_GET['_cat_adto'], 11, int);
} else {
$parent = -1;
}
$cmd = 'Добавить';
}
$cats_data = $this->GetCatsData($parent, false, true, $CatId, true);
FormRow('В категорию', System::site()->Select('cat', $cats_data, false, $parent == -1 ? 'class="autofocus"' : ''));
FormRow('Имя категории', System::site()->Edit('title', $title, false, 'maxlength="250" style="width:400px;"' . ($parent != -1 ? 'class="autofocus"' : '')));
FormRow('Иконка', System::site()->Edit('icon', $icon, false, 'maxlength="250" style="width:400px;"'));
FormTextRow('Описание', System::site()->HtmlEditor('desc', $desc));
AddCenterBox($boxtitle);
AddForm('<form action="' . ADMIN_FILE . '?exe=' . $this->module . '&' . $this->action_par_name . '=' . $save_met . $OtherUrlParams . '" method="post">', System::site()->Button('Отмена', 'onclick="history.go(-1);"') . System::site()->Submit($cmd));
}
示例4: IndexForumEditTopic
function IndexForumEditTopic()
{
global $forum_lang;
if (!System::user()->Auth) {
System::site()->AddTextBox($forum_lang['forum'], '<p align="center">' . $forum_lang['error_auth'] . '</p>');
return;
}
$topic = SafeEnv($_GET['topic'], 11, int);
$post = System::database()->Select('forum_posts', "`object`='{$topic}' and `delete`='0'");
SortArray($post, 'id', false);
System::database()->Select('forum_topics', "`id`='{$topic}'");
$topic = System::database()->FetchRow();
if ($topic['delete'] == 0 || System::config('forum/basket') == false) {
$title = '';
if (SafeDB($topic['starter_id'], 11, str) == System::user()->Get('u_id') or System::user()->IsAdmin()) {
$title = SafeDB($topic['title'], 0, str);
}
if (System::user()->Get('u_id') == $post[0]['user_id'] || System::user()->isAdmin()) {
ForumRenderPostForm(true, 0, SafeEnv($_GET['topic'], 11, int), SafeDB($post[0]['id'], 11, int), SafeDB($post[0]['message'], 0, str, false, true), $title);
} else {
System::site()->AddTextBox($forum_lang['forum'], '<p align="center">' . $forum_lang['no_right_comment_edit'] . '</p>');
return;
}
} else {
System::site()->AddTextBox($forum_lang['topic_basket_current_post'], '<p align="center">' . $forum_lang['topic_basket_post'] . '<br><input type="button" value="' . $forum_lang['back'] . '"onclick="history.back();"></p>');
}
}
示例5: ___SitemapPluginForum
function ___SitemapPluginForum($Forum, $Level, $i, $c)
{
global $forums_tree;
$forum_config = $forums_tree->GetForumConfigRecursive($Forum['id'], ACCESS_ALL);
if (!$forum_config['access']) {
return false;
}
SitemapAddObject($Level, $Forum['title'], Ufu('index.php?name=forum&op=showforum&forum=' . SafeDB($Forum['id'], 11, int), 'forum/{forum}/'));
}
示例6: getconf_TemplatesList
function getconf_TemplatesList($name)
{
$r = array();
$templates = System::database()->Select('templates', "`admin`='0'");
foreach ($templates as $t) {
$r[] = array(SafeDB($t['folder'], 255, str), SafeDB($t['name'], 255, str));
}
return $r;
}
示例7: IndexForumMarkRead
function IndexForumMarkRead()
{
$mark_forums = array();
// Форумы на которых устанавливать метки
$forums_tree = ForumTree::Instance();
if (isset($_GET['forum'])) {
// Только внутри определённого форума
$forum = SafeDB($_GET['forum'], 11, int);
$mark_forums = $forums_tree->GetAllAccessForumId($forum);
} else {
// На всех форумах
$mark_forums = $forums_tree->GetAllAccessForumId();
}
$user_id = System::user()->Get('u_id');
if (System::user()->Auth) {
// Загружаем данные о прочтении тем пользователем
$read_data = Forum_Marker_GetReadData();
// Загружаем топики (агрегированы по forum_id)
$topics = ForumCacheGetTopics();
$del_where = '';
$insert_values = array();
$time = time();
foreach ($mark_forums as $forum_id) {
if (!isset($topics[$forum_id])) {
continue;
}
foreach ($topics[$forum_id] as $topic) {
$tid = SafeEnv($topic['id'], 11, int);
// Не прочитана или метка устарела
if (!isset($read_data[$topic['id']])) {
$insert_values[] = "'{$user_id}','{$tid}','{$time}'";
// Добавить новую метку
} elseif ($read_data[$topic['id']]['date'] < $topic['last_post']) {
$del_where .= "(`tid`='{$tid}' and `mid`= '{$user_id}') or ";
// Удалить текущую метку
$insert_values[] = "'{$user_id}','{$tid}','{$time}'";
// Добавить новую метку
}
}
}
// Удаляем устаревшие метки
if ($del_where != '') {
$del_where = substr($del_where, 0, -4);
// Удаляем .or.
System::database()->Delete('forum_topics_read', $del_where);
}
// Добавляем новые метки
// TODO: В будущем нужно перейти на InnoDB и использовать транзакции как в MySQL так и в FilesDB.
if (count($insert_values) > 0) {
foreach ($insert_values as $vals) {
System::database()->Insert('forum_topics_read', $vals);
}
}
}
GO(GetSiteUrl() . Ufu('index.php?name=forum' . (isset($forum) ? '&op=showforum&forum=' . $forum : ''), 'forum/' . (isset($forum) ? '{forum}/' : '')));
}
示例8: PrintEmail
/**
* Вывод адреса электронной почты в админке
* @param string $Email
* @param string $Name
* @return string
*/
function PrintEmail($Email, $Name = '')
{
$Email = SafeDB($Email, 255, str);
$Name = SafeDB($Name, 255, str);
if ($Email == '') {
return ' ';
} else {
return '<a href="mailto:' . $Email . '">' . ($Name != '' ? $Name : $Email) . '</a>';
}
}
示例9: ShowCats
/**
* Выводит данные каталога.
* @param type $cat_id
*/
public function ShowCats($cat_id)
{
$vars = array();
$cats = $this->GetChildTree($cat_id);
$c = count($cats);
if ($c > 0) {
System::site()->AddTemplatedBox('', $this->catTemplate);
System::site()->AddBlock('cats', true, true, 'cat');
for ($i = 0; $i < $c; $i++) {
$id = SafeDB($cats[$i]['id'], 11, int);
$vars['url'] = Ufu('index.php?name=' . $this->moduleName . '&' . $this->id_par_name . '=' . $id, $this->moduleName . '/{' . $this->id_par_name . '}/');
$vars['title2'] = SafeDB($cats[$i]['title'], 255, str);
$vars['title'] = '<a href="' . $vars['url'] . '">' . $vars['title2'] . '</a>';
if (file_exists($cats[$i]['icon'])) {
$vars['icon_url'] = SafeDB(RealPath2($cats[$i]['icon']), 255, str);
} else {
$vars['icon_url'] = 'images/cat.gif';
}
$vars['icon'] = '<img border="0" src="' . $vars['icon_url'] . '" />';
$vars['description'] = $cats[$i]['description'];
$counters = $this->GetCountersRecursive($id);
$vars['count'] = $counters['files'];
$vars['cat_count'] = $counters['cats'];
// Выодим подкатегории
$childs = '';
$sub = '';
if (isset($cats[$i][TREE_CHILD_ID])) {
for ($j = 0, $k = count($cats[$i][TREE_CHILD_ID]); $j < $k; $j++) {
$child_id = SafeDB($cats[$i][TREE_CHILD_ID][$j]['id'], 11, int);
$child_counters = $this->GetCountersRecursive($child_id);
$link = Ufu('index.php?name=' . $this->moduleName . '&' . $this->id_par_name . '=' . $child_id, $this->moduleName . '/{' . $this->id_par_name . '}/');
$sub .= '<a href="' . $link . '">' . $cats[$i][TREE_CHILD_ID][$j]['title'] . '</a>' . ' (' . $child_counters['files'] . '), ';
}
$childs .= substr($sub, 0, -2) . '.';
}
$vars['childs_cats'] = $childs;
System::site()->AddSubBlock('cats', true, $vars);
}
if ($cat_id == 0 && function_exists($this->NumItems)) {
$text = '<br>' . $this->NumItemsCaption . call_user_func($this->NumItems);
} else {
$text = '';
}
System::site()->AddBlock('cat_caption', true, false, '', '', $text);
} elseif ($cat_id == 0) {
System::site()->AddTextBox('', '<p align="center">Категорий пока нет.</p>');
}
}
示例10: AuditWriteReferer
/**
* Записывает реферал в базу данных.
* @param $referer
*/
function AuditWriteReferer($referer)
{
if (trim($referer) != '' && !IsMainHost($referer)) {
$referer = SafeEnv(Url($referer), 255, str);
$count = 1;
System::database()->Select('referers', "`referer`='{$referer}'");
if (System::database()->NumRows() > 0) {
$ref = System::database()->FetchRow();
$count = SafeDB($ref['count'], 11, int);
$count++;
System::database()->Update('referers', "count='{$count}'", "`referer`='{$referer}'");
} else {
$values = Values('', $referer, $count);
System::database()->Insert('referers', $values);
}
}
}
示例11: IndexForumCloseTopic
function IndexForumCloseTopic()
{
if (!System::user()->isAdmin()) {
HackOff();
return;
}
if (CheckGet('topic')) {
$topic_id = SafeEnv($_GET['topic'], 11, int);
} else {
System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_data']);
return;
}
System::database()->Select('forum_topics', "`id`='{$topic_id}'");
$topic = System::database()->FetchRow();
$forum_id = SafeDB($topic['forum_id'], 11, int);
System::database()->Update('forum_topics', "`close_topics`='1'", "`id`='{$topic_id}'");
GO(Ufu('index.php?name=forum&op=showforum&forum=' . $forum_id, 'forum/{forum}/'));
}
示例12: IndexForumEditPosts
function IndexForumEditPosts()
{
global $forum_lang;
if (!System::user()->isAdmin()) {
System::site()->AddTextBox($forum_lang['forum'], '<p align="center">' . $forum_lang['error_no_right_edit'] . '.</p>');
return;
}
if (!isset($_POST['posts'])) {
System::site()->AddTextBox($forum_lang['forum'], '<p align="center">' . $forum_lang['error_no_messages'] . '</p><br><a href="javascript:history.go(-1)">' . System::site()->Button($forum_lang['back']) . '</a>');
return;
}
if (isset($_GET['ok']) && $_GET['ok'] == '1') {
$posts_ids = SafeEnv(explode(',', $_POST['posts']), 11, int);
$moderation_result = ForumModerationPosts($_GET['edit'], $posts_ids, true);
if ($moderation_result) {
if (isset($_GET['back'])) {
GoRefererUrl($_GET['back']);
} else {
GO($_POST['backurl']);
}
}
} else {
$posts_ids = array();
foreach (array_keys($_POST['posts']) as $post_id) {
$posts_ids[] = SafeEnv($post_id, 11, int);
}
$do = SafeDB($_POST['do'], 255, str);
$form_url = 'index.php?name=forum&op=edit_posts&edit=' . $do . '&ok=1';
if (isset($_GET['back'])) {
$form_url .= '&back=' . SafeDB($_GET['back'], 10, str);
}
$vars['lang_premoderation'] = $forum_lang['moderation_messages'];
$vars['posts_count'] = count($posts_ids);
$vars['form_action'] = $form_url;
$vars['form_name'] = 'forum_delete';
$vars['posts'] = implode(',', $posts_ids);
$vars['backurl'] = $_SERVER['HTTP_REFERER'];
$vars['reason'] = System::config('forum/basket') && $do == 'deleteposts';
$vars['lang_do'] = ForumModerationPosts($do, $posts_ids, false);
System::site()->AddTemplatedBox($vars['lang_do'], 'module/forum_moderation.html');
System::site()->AddBlock('forum_moderation', true, false, 'mod');
System::site()->SetVars('forum_moderation', $vars);
}
}
示例13: AdminCacheMain
function AdminCacheMain()
{
AddCenterBox('Очистка кэша');
if (!System::cache()->Enabled) {
if (USE_CACHE) {
System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Папка "' . System::cache()->Path . '" не доступна для записи. Функция кэширования отключена.');
} else {
System::admin()->HighlightError('<strong style="color: #FF0000;">Внимание!</strong> Функция кэширования отключена в конфигурационном файле "config/config.php".');
}
}
$text = '<table cellspacing="0" cellpadding="0" class="cfgtable">';
$text .= '<tr><th>Группа</th><th>Папка</th><th>Записей</th><th>Занимаемое место</th><th>Функции</th></tr>';
$num_rows = 0;
$total_size = 0;
$groups = System::cache()->GetGroups();
foreach ($groups as $g) {
$file_size = 0;
$num_files = 0;
$folder = System::cache()->Path . $g;
$files = scandir($folder);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
$f = $folder . '/' . $file;
if (!is_dir($f)) {
$file_size += filesize($f);
}
$num_files++;
}
}
$func = SpeedButton('Очистить', ADMIN_FILE . '?exe=cache&a=clear&group=' . SafeDB($g, 255, str), 'images/admin/cleanup.png');
$rows = floor($num_files / 2);
$text .= '<tr>' . '<td>' . SafeDB($g, 255, str) . '</td>' . '<td>' . SafeDB($folder, 255, str) . '</td>' . '<td>' . $rows . '</td>' . '<td>' . FormatFileSize($file_size) . '</td>' . '<td>' . $func . '</td>' . '</tr>';
$num_rows += $rows;
$total_size += $file_size;
}
$text .= '</table><br />';
$text .= 'Итого <b>' . count($groups) . '</b> групп(ы), <b>' . $num_rows . '</b> записей и <b>' . FormatFileSize($total_size) . '</b> занято. ' . System::admin()->SpeedButton('Очистить все группы', ADMIN_FILE . '?exe=cache&a=cleanup', '', true, true);
$text .= '<br /><br />';
AddText($text);
}
示例14: define
/*
* LinkorCMS 1.4
* © 2012 LinkorCMS Development Group
*/
define('RSS_SCRIPT', true);
define('VALID_RUN', true);
require 'config/init.php';
// Конфигурация и инициализация
@header("Content-Type: text/xml");
@header("Cache-Control: no-cache");
@header("Pragma: no-cache");
$rss_title = 'Новости на ' . System::config('general/site_url');
$rss_link = System::config('general/site_url');
$rss_description = 'RSS канал сайта ' . System::config('general/site_url') . '.';
$rss = new RssChannel($rss_title, $rss_link, $rss_description);
$rss->pubDate = gmdate('D, d M Y H:i:s') . ' GMT';
$rss->generator = CMS_NAME . ' ' . CMS_VERSION;
$rss->managingEditor = 'support@linkorcms.ru';
$rss->webMaster = System::config('general/site_email');
$num = 10;
// Пока максимум 10 заголовков по умолчанию
$news = System::database()->Select('news', "`enabled`='1'", $num, 'date', true);
foreach ($news as $s) {
$title = SafeDB($s['title'], 255, str);
$description = SafeDB($s['start_text'], 4048, str);
$link = HtmlChars(GetSiteUrl() . Ufu('index.php?name=news&op=readfull&news=' . $s['id'] . '&topic=' . $s['topic_id'], 'news/{topic}/{news}/'));
$pubDate = gmdate('D, d M Y H:i:s', $s['date']) . ' GMT';
$rss->AddItem($title, $description, $link, $pubDate, $link);
}
echo $rss->Generate();
示例15: header
<?php
/*
* LinkorCMS 1.4
* © 2012 LinkorCMS Development Group
*/
if (!defined('VALID_RUN')) {
header("HTTP/1.1 404 Not Found");
exit;
}
$table = SafeEnv($_GET['name'], 255, str);
$index = SafeEnv($_GET['index'], 11, int);
$where = '';
if (isset($_GET['where'])) {
$where = $_GET['where'];
}
$rows = System::database()->Select($table, $where);
$row = $rows[$index];
$row2 = array();
$columns = System::database()->GetTableColumns($table);
foreach ($columns as $col) {
$row2[] = $row[$col['name']];
}
$row2 = SafeEnv($row2, 0, str);
$code_vals = Values($row2);
$install_code = "System::database()->Insert('{$table}',\"{$code_vals}\");" . EOL;
System::admin()->AddCenterBox('PHP код вставки');
System::admin()->FormRow('Установка', $site->TextArea('code', $install_code, 'style="width: 800px; height: 200px;" class="autofocus selectall"'));
System::admin()->AddForm('', $site->Button('Назад', 'onclick="history.go(-1);"'));
AdminFdbAdminGenTableMenu(SafeDB($table, 255, str));