本文整理汇总了PHP中cmsCore::validateForm方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::validateForm方法的具体用法?PHP cmsCore::validateForm怎么用?PHP cmsCore::validateForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::validateForm方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dbHide
}
}
if ($opt == 'hide_banner') {
if (!isset($_REQUEST['item'])) {
if (isset($_REQUEST['item_id'])) {
dbHide('cms_banners', $_REQUEST['item_id']);
}
echo '1';
exit;
} else {
dbHideList('cms_banners', $_REQUEST['item']);
cmsCore::redirectBack();
}
}
if ($opt == 'submit' || $opt == 'update') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$item_id = cmsCore::request('item_id', 'int', 0);
$title = cmsCore::request('title', 'str', $_LANG['AD_UNTITLED_BANNER']);
$link = cmsCore::request('b_link', 'str');
$typeimg = cmsCore::request('typeimg', 'str');
$maxhits = cmsCore::request('maxhits', 'int');
$maxuser = 0;
$published = cmsCore::request('published', 'int', 0);
$position = cmsCore::request('position', 'str');
if (@$_FILES['picture']['size']) {
$ext = mb_strtolower(pathinfo($_FILES['picture']['name'], PATHINFO_EXTENSION));
if (!in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'swf'))) {
cmsCore::addSessionMessage($_LANG['AD_INCORRECT_FILE_TYPE'], 'error');
cmsCore::redirectBack();
示例2: applet_config
function applet_config()
{
// получаем оригинальный конфиг
$config = cmsConfig::getDefaultConfig();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_SITE_SETTING'];
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
$do = cmsCore::request('do', 'str', 'list');
if ($do == 'save') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$newCFG = array();
$newCFG['sitename'] = stripslashes(cmsCore::request('sitename', 'str', ''));
$newCFG['title_and_sitename'] = cmsCore::request('title_and_sitename', 'int', 0);
$newCFG['title_and_page'] = cmsCore::request('title_and_page', 'int', 0);
$newCFG['hometitle'] = stripslashes(cmsCore::request('hometitle', 'str', ''));
$newCFG['homecom'] = cmsCore::request('homecom', 'str', '');
$newCFG['siteoff'] = cmsCore::request('siteoff', 'int', 0);
$newCFG['debug'] = cmsCore::request('debug', 'int', 0);
$newCFG['offtext'] = htmlspecialchars(cmsCore::request('offtext', 'str', ''), ENT_QUOTES);
$newCFG['keywords'] = cmsCore::request('keywords', 'str', '');
$newCFG['metadesc'] = cmsCore::request('metadesc', 'str', '');
$newCFG['seourl'] = cmsCore::request('seourl', 'int', 0);
$newCFG['lang'] = cmsCore::request('lang', 'str', 'ru');
$newCFG['is_change_lang'] = cmsCore::request('is_change_lang', 'int', 0);
$newCFG['sitemail'] = cmsCore::request('sitemail', 'str', '');
$newCFG['sitemail_name'] = cmsCore::request('sitemail_name', 'str', '');
$newCFG['wmark'] = cmsCore::request('wmark', 'str', '');
$newCFG['template'] = cmsCore::request('template', 'str', '');
$newCFG['splash'] = cmsCore::request('splash', 'int', 0);
$newCFG['slight'] = cmsCore::request('slight', 'int', 0);
$newCFG['db_host'] = $config['db_host'];
$newCFG['db_base'] = $config['db_base'];
$newCFG['db_user'] = $config['db_user'];
$newCFG['db_pass'] = $config['db_pass'];
$newCFG['db_prefix'] = $config['db_prefix'];
$newCFG['show_pw'] = cmsCore::request('show_pw', 'int', 0);
$newCFG['last_item_pw'] = cmsCore::request('last_item_pw', 'int', 0);
$newCFG['index_pw'] = cmsCore::request('index_pw', 'int', 0);
$newCFG['fastcfg'] = cmsCore::request('fastcfg', 'int', 0);
$newCFG['mailer'] = cmsCore::request('mailer', 'str', '');
$newCFG['smtpsecure'] = cmsCore::request('smtpsecure', 'str', '');
$newCFG['smtpauth'] = cmsCore::request('smtpauth', 'int', 0);
$newCFG['smtpuser'] = cmsCore::inRequest('smtpuser') ? cmsCore::request('smtpuser', 'str', '') : $config['smtpuser'];
$newCFG['smtppass'] = cmsCore::inRequest('smtppass') ? cmsCore::request('smtppass', 'str', '') : $config['smtppass'];
$newCFG['smtphost'] = cmsCore::request('smtphost', 'str', '');
$newCFG['smtpport'] = cmsCore::request('smtpport', 'int', '25');
$newCFG['timezone'] = cmsCore::request('timezone', 'str', '');
$newCFG['timediff'] = cmsCore::request('timediff', 'str', '');
$newCFG['user_stats'] = cmsCore::request('user_stats', 'int', 0);
$newCFG['allow_ip'] = cmsCore::request('allow_ip', 'str', '');
if (cmsConfig::saveToFile($newCFG)) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
}
cmsCore::clearCache();
cmsCore::redirect('index.php?view=config');
}
?>
<div>
<?php
cpCheckWritable('/includes/config.inc.php');
?>
<div id="config_tabs" class="uitabs">
<ul id="tabs">
<li><a href="#basic"><span><?php
echo $_LANG['AD_SITE'];
?>
</span></a></li>
<li><a href="#home"><span><?php
echo $_LANG['AD_MAIN'];
?>
</span></a></li>
<li><a href="#design"><span><?php
echo $_LANG['AD_DESIGN'];
?>
</span></a></li>
<li><a href="#time"><span><?php
echo $_LANG['AD_TIME'];
?>
</span></a></li>
<li><a href="#database"><span><?php
echo $_LANG['AD_DB'];
?>
</span></a></li>
<li><a href="#mail"><span><?php
echo $_LANG['AD_POST'];
?>
</span></a></li>
//.........这里部分代码省略.........
示例3: applet_plugins
function applet_plugins()
{
global $_LANG;
$inCore = cmsCore::getInstance();
$GLOBALS['cp_page_title'] = $_LANG['AD_PLUGINS'];
cpAddPathway($_LANG['AD_PLUGINS'], 'index.php?view=plugins');
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
// ===================================================================================== //
if ($do == 'hide') {
dbHide('cms_plugins', $id);
echo '1';
exit;
}
// ===================================================================================== //
if ($do == 'show') {
dbShow('cms_plugins', $id);
echo '1';
exit;
}
// ===================================================================================== //
if ($do == 'list') {
$toolmenu = array();
$toolmenu[1]['icon'] = 'install.gif';
$toolmenu[1]['title'] = $_LANG['AD_INSTALL_PLUGINS'];
$toolmenu[1]['link'] = '?view=install&do=plugin';
cpToolMenu($toolmenu);
$plugin_id = cmsCore::request('installed', 'str', '');
if ($plugin_id) {
$task = cmsCore::request('task', 'str', 'install');
if ($task == 'install' || $task == 'upgrade') {
$plugin = $inCore->loadPlugin($plugin_id);
$task_str = $task == 'install' ? $_LANG['AD_IS_INSTALL'] : $_LANG['AD_IS_UPDATE'];
echo '<div style="color:green;margin-top:12px;margin-bottom:5px;">' . $_LANG['AD_PLUGIN'] . ' <strong>"' . $plugin->info['title'] . '"</strong> ' . $task_str . '. ' . $_LANG['AD_ENABLE_PLUGIN'] . '.</div>';
}
if ($task == 'remove') {
echo '<div style="color:green;margin-top:12px;margin-bottom:5px;">' . $_LANG['AD_REMOVE_PLUGIN_OK'] . '.</div>';
}
}
$fields = array();
$fields[0]['title'] = 'id';
$fields[0]['field'] = 'id';
$fields[0]['width'] = '20';
$fields[1]['title'] = $_LANG['TITLE'];
$fields[1]['field'] = 'title';
$fields[1]['width'] = '250';
$fields[2]['title'] = $_LANG['DESCRIPTION'];
$fields[2]['field'] = 'description';
$fields[2]['width'] = '';
$fields[3]['title'] = $_LANG['AD_AUTHOR'];
$fields[3]['field'] = 'author';
$fields[3]['width'] = '160';
$fields[4]['title'] = $_LANG['AD_VERSION'];
$fields[4]['field'] = 'version';
$fields[4]['width'] = '50';
$fields[5]['title'] = $_LANG['AD_FOLDER'];
$fields[5]['field'] = 'plugin';
$fields[5]['width'] = '100';
$fields[6]['title'] = $_LANG['AD_ENABLE'];
$fields[6]['field'] = 'published';
$fields[6]['width'] = '60';
$actions = array();
$actions[0]['title'] = $_LANG['AD_CONFIG'];
$actions[0]['icon'] = 'config.gif';
$actions[0]['link'] = '?view=plugins&do=config&id=%id%';
$actions[1]['title'] = $_LANG['DELETE'];
$actions[1]['icon'] = 'delete.gif';
$actions[1]['confirm'] = $_LANG['AD_REMOVE_PLUGIN_FROM'];
$actions[1]['link'] = '?view=install&do=remove_plugin&id=%id%';
cpListTable('cms_plugins', $fields, $actions);
}
// ===================================================================================== //
if ($do == 'save_config') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', 0);
$config = cmsCore::request('config', 'array_str');
if (!$config || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $config);
cmsUser::clearCsrfToken();
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
// ===================================================================================== //
if ($do == 'config') {
$plugin_name = $inCore->getPluginById($id);
if (!$plugin_name) {
cmsCore::error404();
}
$plugin = $inCore->loadPlugin($plugin_name);
$config = $inCore->loadPluginConfig($plugin_name);
$GLOBALS['cp_page_title'] = $plugin->info['title'];
cpAddPathway($plugin->info['title'], 'index.php?view=plugins&do=config&id=' . $id);
//.........这里部分代码省略.........
示例4: applet_arhive
function applet_arhive()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
$GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES_ARCHIVE'];
$cfg = $inCore->loadComponentConfig('content');
$cfg_arhive = $inCore->loadComponentConfig('arhive');
cmsCore::loadModel('content');
$model = new cms_model_content();
cpAddPathway($_LANG['AD_ARTICLE_SITE'], 'index.php?view=tree');
cpAddPathway($_LANG['AD_ARTICLES_ARCHIVE'], 'index.php?view=arhive');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'saveconfig') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$cfg['source'] = cmsCore::request('source', 'str', '');
$inCore->saveComponentConfig('arhive', $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('?view=arhive&do=config');
}
if ($do == 'config') {
$toolmenu = array();
$toolmenu[0]['icon'] = 'folders.gif';
$toolmenu[0]['title'] = $_LANG['AD_LIST_OF_ARTICLES'];
$toolmenu[0]['link'] = '?view=arhive';
cpToolMenu($toolmenu);
cpAddPathway($_LANG['AD_SETTINGS'], 'index.php?view=arhive&do=config');
?>
<form action="index.php?view=arhive&do=saveconfig" method="post" name="optform" target="_self" id="form1">
<input type="hidden" name="csrf_token" value="<?php
echo cmsUser::getCsrfToken();
?>
" />
<table width="609" border="0" cellpadding="10" cellspacing="0" class="proptable">
<tr>
<td valign="top"><strong><?php
echo $_LANG['AD_SOURCE_MATERIALS'];
?>
</strong></td>
<td width="100" valign="top">
<select name="source" id="source" style="width:285px">
<option value="content" <?php
if ($cfg_arhive['source'] == 'content') {
echo 'selected="selected"';
}
?>
><?php
echo $_LANG['AD_ARTICLE_SITE'];
?>
</option>
<option value="arhive" <?php
if ($cfg_arhive['source'] == 'arhive') {
echo 'selected="selected"';
}
?>
><?php
echo $_LANG['AD_ARTICLES_ARCHIVE'];
?>
</option>
<option value="both" <?php
if ($cfg_arhive['source'] == 'both') {
echo 'selected="selected"';
}
?>
><?php
echo $_LANG['AD_CATALOG_AND_ARCHIVE'];
?>
</option>
</select>
</td>
</tr>
</table>
<p>
<input name="opt" type="hidden" value="saveconfig" />
<input name="save" type="submit" id="save" value="<?php
echo $_LANG['SAVE'];
?>
" />
<input name="back" type="button" id="back" value="<?php
echo $_LANG['CANCEL'];
?>
" onclick="window.location.href='index.php?view=arhive';" />
</p>
</form>
<?php
}
if ($do == 'list') {
$toolmenu = array();
$toolmenu[0]['icon'] = 'config.gif';
$toolmenu[0]['title'] = $_LANG['AD_SETTINGS'];
$toolmenu[0]['link'] = '?view=arhive&do=config';
$toolmenu[1]['icon'] = 'delete.gif';
$toolmenu[1]['title'] = $_LANG['AD_DELETE_SELECTED'];
$toolmenu[1]['link'] = "javascript:checkSel('?view=arhive&do=delete&multiple=1');";
cpToolMenu($toolmenu);
//TABLE COLUMNS
$fields = array();
//.........这里部分代码省略.........
示例5: photos
//.........这里部分代码省略.........
}
if (mb_strstr($photo['NSDiffer'], 'club')) {
cmsCore::halt();
}
if (!$inUser->is_admin) {
cmsCore::halt();
}
if (!cmsCore::inRequest('move_photo')) {
cmsPage::initTemplate('components', 'com_photos_move')->assign('form_action', '/photos/movephoto' . $photo['id'] . '.html')->assign('html', $inPhoto->getAlbumsOption('', $photo['album_id']))->display('com_photos_move.tpl');
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
} else {
$album = cmsCore::callEvent('GET_PHOTO_ALBUM', $inDB->getNsCategory('cms_photo_albums', cmsCore::request('album_id', 'int')));
if (!$album) {
cmsCore::halt();
}
if (!$album['public'] && !$inUser->is_admin) {
cmsCore::error404();
}
// Смотрим ограничения загрузки в сутки
$today_uploaded = $album['uplimit'] ? $model->loadedByUser24h($inUser->id, $album['id']) : 0;
if (!$inUser->is_admin && $album['uplimit'] && $today_uploaded >= $album['uplimit']) {
cmsCore::jsonOutput(array('error' => true, 'text' => '<strong>' . $_LANG['MAX_UPLOAD_IN_DAY'] . '</strong> ' . $_LANG['CAN_UPLOAD_TOMORROW']));
}
$inDB->query("UPDATE cms_photo_files SET album_id = '{$album['id']}' WHERE id = '{$photo['id']}'");
cmsActions::updateLog('add_photo', array('target' => $album['title'], 'target_url' => '/photos/' . $album['id'], 'target_id' => $album['id']), $photo['id']);
cmsCore::addSessionMessage($_LANG['PHOTO_MOVED'], 'info');
cmsCore::jsonOutput(array('error' => false, 'redirect' => '/photos/' . $album['id']));
}
}
/////////////////////////////// PHOTO DELETE /////////////////////////////////////////////////////////////////////////////////////////
if ($do == 'delphoto') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id) {
cmsCore::halt();
}
if (!cmsCore::validateForm()) {
cmsCore::halt();
}
$photo = cmsCore::callEvent('GET_PHOTO', $inPhoto->getPhoto($id));
if (!$photo) {
cmsCore::halt();
}
if (mb_strstr($photo['NSDiffer'], 'club')) {
cmsCore::halt();
}
$is_author = $photo['user_id'] == $inUser->id && $inUser->id;
if (!$inUser->is_admin && !$is_author) {
cmsCore::halt();
}
$inPhoto->deletePhoto($photo, $model->initUploadClass($inDB->getNsCategory('cms_photo_albums', $photo['album_id'])));
cmsCore::addSessionMessage($_LANG['PHOTO_DELETED'], 'success');
cmsUser::clearCsrfToken();
cmsCore::jsonOutput(array('error' => false, 'redirect' => '/photos/' . $photo['album_id']));
}
/////////////////////////////// PHOTO PUBLISH /////////////////////////////////////////////////////////////////////////////////////////
if ($do == 'publish_photo') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id) {
cmsCore::halt();
}
$photo = cmsCore::callEvent('GET_PHOTO', $inPhoto->getPhoto($id));
if (!$photo) {
cmsCore::halt();
}
if (!$inUser->is_admin) {
cmsCore::halt();
}
$inPhoto->publishPhoto($photo['id']);
cmsCore::callEvent('ADD_PHOTO_DONE', $photo);
$description = '<a href="/photos/photo' . $photo['id'] . '.html" class="act_photo"><img src="/images/photos/small/' . $photo['file'] . '" alt="' . htmlspecialchars(stripslashes($photo['title'])) . '" /></a>';
cmsActions::log('add_photo', array('object' => $photo['title'], 'object_url' => '/photos/photo' . $photo['id'] . '.html', 'object_id' => $photo['id'], 'user_id' => $photo['user_id'], 'target' => $photo['cat_title'], 'target_id' => $photo['album_id'], 'target_url' => '/photos/' . $photo['album_id'], 'description' => $description));
cmsCore::halt('ok');
}
/////////////////////////////// VIEW LATEST/BEST PHOTOS //////////////////////////////////////////////////////////////////////////////
if (in_array($do, array('latest', 'best'))) {
if ($do == 'latest') {
$inDB->orderBy('f.pubdate', 'DESC');
$pagetitle = $pagetitle && $inCore->isMenuIdStrict() ? $pagetitle : $_LANG['NEW_PHOTO_IN_GALLERY'];
} else {
$inDB->orderBy('f.rating', 'DESC');
$pagetitle = $pagetitle && $inCore->isMenuIdStrict() ? $pagetitle : $_LANG['BEST_PHOTOS'];
}
$inDB->limit($model->config['best_latest_perpage']);
// выбираем категории фото
$inDB->addJoin("INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.published = 1 AND a.NSDiffer = ''");
$inDB->addSelect('a.title as cat_title');
$photos = $inPhoto->getPhotos(false, 'with_comments');
if (!$photos) {
cmsCore::error404();
}
$inPage->addPathway($pagetitle);
$inPage->setTitle($pagetitle);
cmsPage::initTemplate('components', 'com_photos_bl')->assign('maxcols', $model->config['best_latest_maxcols'])->assign('pagetitle', $pagetitle)->assign('photos', $photos)->display('com_photos_bl.tpl');
}
/////////////////////////////// /////////////////////////////// /////////////////////////////// /////////////////////////////// //////
}
示例6: applet_userbanlist
function applet_userbanlist()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_BANLIST'];
cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
$to = cmsCore::request('to', 'int', 0);
// для редиректа обратно в профиль на сайт
if ($to) {
cmsUser::sessionPut('back_url', cmsCore::getBackURL());
}
if ($do == 'list') {
$toolmenu[] = array('icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');");
$toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');");
cpToolMenu($toolmenu);
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '55', 'prc' => 'cpYesNo');
$fields[] = array('title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick');
$fields[] = array('title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12');
$fields[] = array('title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12');
$fields[] = array('title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55');
$fields[] = array('title' => '', 'field' => 'int_period', 'width' => '70');
$fields[] = array('title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '90', 'prc' => 'cpYesNo');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%');
cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
}
if ($do == 'delete') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbDelete('cms_banlist', $id);
}
} else {
dbDeleteList('cms_banlist', $_REQUEST['item']);
}
cmsCore::redirect('?view=userbanlist');
}
if ($do == 'submit' || $do == 'update') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$types = array('user_id' => array('user_id', 'int', 0), 'ip' => array('ip', 'str', ''), 'cause' => array('cause', 'str', ''), 'autodelete' => array('autodelete', 'int', 0), 'int_num' => array('int_num', 'int', 0), 'int_period' => array('int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;')));
$items = cmsCore::getArrayFromRequest($types);
$error = false;
if (!$items['ip']) {
$error = true;
cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
}
if ($items['ip'] == $_SERVER['REMOTE_ADDR'] || $items['user_id'] == $inUser->id) {
$error = true;
cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
}
if (cmsUser::userIsAdmin($items['user_id'])) {
$error = true;
cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
}
if ($error) {
cmsCore::redirectBack();
}
if ($do == 'update') {
$inDB->update('cms_banlist', $items, $id);
if (empty($_SESSION['editlist'])) {
cmsCore::redirect('?view=userbanlist');
} else {
cmsCore::redirect('?view=userbanlist&do=edit');
}
}
$inDB->insert('cms_banlist', $items);
$back_url = cmsUser::sessionGet('back_url');
cmsUser::sessionDel('back_url');
cmsCore::redirect($back_url ? $back_url : '?view=userbanlist');
}
if ($do == 'add' || $do == 'edit') {
$GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="/admin/js/banlist.js"></script>';
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);');
cpToolMenu($toolmenu);
if ($do == 'add') {
echo '<h3>' . $_LANG['AD_TO_BANLIST_ADD'] . '</h3>';
cpAddPathway($_LANG['AD_TO_BANLIST_ADD']);
} else {
if (isset($_REQUEST['multiple'])) {
if (isset($_REQUEST['item'])) {
$_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
} else {
cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
cmsCore::redirectBack();
}
}
$ostatok = '';
//.........这里部分代码省略.........
示例7: applet_cron
function applet_cron()
{
cmsCore::loadClass('cron');
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_CRON_MISSION'];
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
cpAddPathway($_LANG['AD_CRON_MISSION'], 'index.php?view=cron');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', '0');
if ($do == 'list') {
$toolmenu = array();
$toolmenu[0]['icon'] = 'new.gif';
$toolmenu[0]['title'] = $_LANG['AD_CREATE_CRON_MISSION'];
$toolmenu[0]['link'] = "?view=cron&do=add";
cpToolMenu($toolmenu);
$items = cmsCron::getJobs(false);
$tpl_file = 'admin/cron.php';
$tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
include $tpl_dir . $tpl_file;
}
if ($do == 'show') {
if ($id) {
cmsCron::jobEnabled($id, true);
}
echo '1';
exit;
}
if ($do == 'hide') {
if ($id) {
cmsCron::jobEnabled($id, false);
}
echo '1';
exit;
}
if ($do == 'delete') {
if ($id) {
cmsCron::removeJobById($id);
}
cmsCore::redirect('index.php?view=cron');
}
if ($do == 'execute') {
if ($id) {
$job_result = cmsCron::executeJobById($id);
}
if ($job_result) {
cmsCore::addSessionMessage($_LANG['AD_MISSION_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_MISSION_ERROR'], 'error');
}
cmsCore::redirect('index.php?view=cron');
}
if ($do == 'submit') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$job_name = cmsCore::request('job_name', 'str');
$comment = cmsCore::request('comment', 'str');
$job_interval = cmsCore::request('job_interval', 'int');
$enabled = cmsCore::request('enabled', 'int');
$component = cmsCore::request('component', 'str');
$model_method = cmsCore::request('model_method', 'str');
$custom_file = cmsCore::request('custom_file', 'str');
$custom_file = mb_stripos($custom_file, 'image') || mb_stripos($custom_file, 'upload') || mb_stripos($custom_file, 'cache') ? '' : $custom_file;
$custom_file = preg_replace('/\\.+\\//', '', $custom_file);
$class_name = cmsCore::request('class_name', 'str');
$class_method = cmsCore::request('class_method', 'str');
cmsCron::registerJob($job_name, array('interval' => $job_interval, 'component' => $component, 'model_method' => $model_method, 'comment' => $comment, 'custom_file' => $custom_file, 'enabled' => $enabled, 'class_name' => $class_name, 'class_method' => $class_method));
cmsCore::redirect('index.php?view=cron');
}
if ($do == 'update') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
if (!$id) {
cmsCore::halt();
}
$job_name = cmsCore::request('job_name', 'str');
$comment = cmsCore::request('comment', 'str');
$job_interval = cmsCore::request('job_interval', 'int');
$enabled = cmsCore::request('enabled', 'int');
$component = cmsCore::request('component', 'str');
$model_method = cmsCore::request('model_method', 'str');
$custom_file = cmsCore::request('custom_file', 'str');
$custom_file = mb_stripos($custom_file, 'image') || mb_stripos($custom_file, 'upload') || mb_stripos($custom_file, 'cache') ? '' : $custom_file;
$custom_file = preg_replace('/\\.+\\//', '', $custom_file);
$class_name = cmsCore::request('class_name', 'str');
$class_method = cmsCore::request('class_method', 'str');
cmsCron::updateJob($id, array('job_name' => $job_name, 'job_interval' => $job_interval, 'component' => $component, 'model_method' => $model_method, 'comment' => $comment, 'custom_file' => $custom_file, 'is_enabled' => $enabled, 'class_name' => $class_name, 'class_method' => $class_method));
cmsCore::redirect('index.php?view=cron');
}
if ($do == 'edit' || $do == 'add') {
$toolmenu = array();
$toolmenu[0]['icon'] = 'save.gif';
$toolmenu[0]['title'] = $_LANG['SAVE'];
$toolmenu[0]['link'] = 'javascript:document.addform.submit();';
$toolmenu[1]['icon'] = 'cancel.gif';
//.........这里部分代码省略.........
示例8: applet_cats
function applet_cats()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
$GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
cmsCore::loadModel('content');
$model = new cms_model_content();
$do = cmsCore::request('do', 'str', 'add');
$id = cmsCore::request('id', 'int', -1);
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) {
cmsCore::loadClass('billing');
}
if ($do == 'delete') {
$is_with_content = cmsCore::inRequest('content');
$model->deleteCategory($id, $is_with_content);
cmsCore::addSessionMessage($is_with_content ? $_LANG['AD_CATEGORY_REMOVED'] : $_LANG['AD_CATEGORY_REMOVED_NOT_ARTICLE'], 'success');
cmsCore::redirect('?view=tree');
}
if ($do == 'update') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
if (isset($_REQUEST['id'])) {
$category['id'] = cmsCore::request('id', 'int', 0);
$category['title'] = cmsCore::request('title', 'str', $_LANG['AD_SECTION_UNTITLED']);
$category['parent_id'] = cmsCore::request('parent_id', 'int');
$category['description'] = cmsCore::request('description', 'html');
$category['description'] = $inDB->escape_string($category['description']);
$category['published'] = cmsCore::request('published', 'int', 0);
$category['showdate'] = cmsCore::request('showdate', 'int', 0);
$category['showcomm'] = cmsCore::request('showcomm', 'int', 0);
$category['orderby'] = cmsCore::request('orderby', 'str');
$category['orderto'] = cmsCore::request('orderto', 'str');
$category['modgrp_id'] = cmsCore::request('modgrp_id', 'int', 0);
$category['maxcols'] = cmsCore::request('maxcols', 'int', 0);
$category['showtags'] = cmsCore::request('showtags', 'int', 0);
$category['showrss'] = cmsCore::request('showrss', 'int', 0);
$category['showdesc'] = cmsCore::request('showdesc', 'int', 0);
$category['is_public'] = cmsCore::request('is_public', 'int', 0);
$category['url'] = cmsCore::request('url', 'str');
if ($category['url']) {
$category['url'] = cmsCore::strToURL($category['url'], $model->config['is_url_cyrillic']);
}
$category['tpl'] = cmsCore::request('tpl', 'str', 'com_content_view.tpl');
$category['cost'] = cmsCore::request('cost', 'str', '');
if (!is_numeric($category['cost'])) {
$category['cost'] = '';
}
$album = array();
$album['id'] = cmsCore::request('album_id', 'int', 0);
$album['header'] = cmsCore::request('album_header', 'str', '');
$album['orderby'] = cmsCore::request('album_orderby', 'str', '');
$album['orderto'] = cmsCore::request('album_orderto', 'str', '');
$album['maxcols'] = cmsCore::request('album_maxcols', 'int', 0);
$album['max'] = cmsCore::request('album_max', 'int', 0);
if ($album['id']) {
$category['photoalbum'] = serialize($album);
} else {
$category['photoalbum'] = '';
}
// получаем старую категорию
$old = $inDB->get_fields('cms_category', "id='{$category['id']}'", '*');
// если сменили категорию
if ($old['parent_id'] != $category['parent_id']) {
// перемещаем ее в дереве
$inCore->nestedSetsInit('cms_category')->MoveNode($category['id'], $category['parent_id']);
// обновляем сеолинки категорий
$inDB->updateNsCategorySeoLink('cms_category', $category['id'], $model->config['is_url_cyrillic']);
// Обновляем ссылки меню на категории
$model->updateCatMenu();
// обновляем сеолинки всех вложенных статей
$model->updateArticlesSeoLink($category['id']);
cmsCore::addSessionMessage($_LANG['AD_CATEGORY_NEW_URL'], 'info');
}
$inDB->update('cms_category', $category, $category['id']);
// если пришел запрос на обновление ссылок
// и категория не менялась - если менялась, мы выше все обновили
if (cmsCore::inRequest('update_seolink') && $old['parent_id'] == $category['parent_id']) {
// обновляем сеолинки категорий
$inDB->updateNsCategorySeoLink('cms_category', $category['id'], $model->config['is_url_cyrillic']);
// Обновляем ссылки меню на категории
$model->updateCatMenu();
// обновляем сеолинки всех вложенных статей
$model->updateArticlesSeoLink($category['id']);
cmsCore::addSessionMessage($_LANG['AD_SECTION_AND_ARTICLES_NEW_URL'], 'info');
}
if (!cmsCore::request('is_access', 'int', 0)) {
$showfor = $_REQUEST['showfor'];
cmsCore::setAccess($category['id'], $showfor, 'category');
} else {
cmsCore::clearAccess($category['id'], 'category');
}
cmsCore::addSessionMessage($_LANG['AD_CATEGORY_SAVED'], 'success');
if (!isset($_SESSION['editlist']) || @sizeof($_SESSION['editlist']) == 0) {
cmsCore::redirect('?view=tree&cat_id=' . $category['id']);
} else {
cmsCore::redirect('?view=tree');
//.........这里部分代码省略.........
示例9: applet_content
function applet_content()
{
$inCore = cmsCore::getInstance();
$inUser = cmsUser::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
//check access
global $adminAccess;
if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
cpAccessDenied();
}
$cfg = $inCore->loadComponentConfig('content');
cmsCore::loadModel('content');
$model = new cms_model_content();
$GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
$do = cmsCore::request('do', 'str', 'add');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'arhive_on') {
$inDB->query("UPDATE cms_content SET is_arhive = 1 WHERE id = '{$id}'");
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_TO_ARHIVE'], 'success');
cmsCore::redirectBack();
}
if ($do == 'move') {
$item_id = cmsCore::request('id', 'int', 0);
$cat_id = cmsCore::request('cat_id', 'int', 0);
$dir = $_REQUEST['dir'];
$step = 1;
$model->moveItem($item_id, $cat_id, $dir, $step);
echo '1';
exit;
}
if ($do == 'move_to_cat') {
$items = cmsCore::request('item', 'array_int');
$to_cat_id = cmsCore::request('obj_id', 'int', 0);
if ($items && $to_cat_id) {
$last_ordering = (int) $inDB->get_field('cms_content', "category_id = '{$to_cat_id}' ORDER BY ordering DESC", 'ordering');
foreach ($items as $item_id) {
$article = $model->getArticle($item_id);
if (!$article) {
continue;
}
$last_ordering++;
$model->updateArticle($article['id'], array('category_id' => $to_cat_id, 'ordering' => $last_ordering, 'url' => $article['url'], 'title' => $inDB->escape_string($article['title']), 'id' => $article['id'], 'user_id' => $article['user_id']));
}
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_TO'], 'success');
}
cmsCore::redirect('?view=tree&cat_id=' . $to_cat_id);
}
if ($do == 'show') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbShow('cms_content', $id);
}
echo '1';
exit;
} else {
dbShowList('cms_content', cmsCore::request('item', 'array_int'));
cmsCore::redirectBack();
}
}
if ($do == 'hide') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbHide('cms_content', $id);
}
echo '1';
exit;
} else {
dbHideList('cms_content', cmsCore::request('item', 'array_int'));
cmsCore::redirectBack();
}
}
if ($do == 'delete') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
$model->deleteArticle($id);
cmsCore::addSessionMessage($_LANG['AD_ARTICLE_REMOVE'], 'success');
}
} else {
$model->deleteArticles(cmsCore::request('item', 'array_int'));
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_REMOVE'], 'success');
}
cmsCore::redirectBack();
}
if ($do == 'update') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
if (isset($_REQUEST['id'])) {
$id = cmsCore::request('id', 'int', 0);
$article['category_id'] = cmsCore::request('category_id', 'int', 1);
$article['title'] = cmsCore::request('title', 'str');
$article['url'] = cmsCore::request('url', 'str');
$article['showtitle'] = cmsCore::request('showtitle', 'int', 0);
$article['description'] = cmsCore::request('description', 'html', '');
$article['description'] = $inDB->escape_string($article['description']);
$article['content'] = cmsCore::request('content', 'html', '');
$article['content'] = $inDB->escape_string($article['content']);
$article['published'] = cmsCore::request('published', 'int', 0);
//.........这里部分代码省略.........
示例10: blog
function blog()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
cmsCore::loadClass('blog');
$inBlog = cmsBlogs::getInstance();
$inBlog->owner = 'site';
global $_LANG;
cmsCore::loadModel('blog');
$model = new cms_model_blog();
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) {
cmsCore::loadClass('billing');
}
// Проверяем включени ли компонент
if (!$model->config['component_enabled']) {
cmsCore::error404();
}
//Получаем параметры
$id = cmsCore::request('id', 'int', 0);
$post_id = cmsCore::request('post_id', 'int', 0);
$seolink = cmsCore::request('seolink', 'str', '');
$do = cmsCore::request('do', 'str', 'blog');
$page = cmsCore::request('page', 'int', 1);
$cat_id = cmsCore::request('cat_id', 'int', 0);
$ownertype = cmsCore::request('ownertype', 'str', '');
$on_moderate = cmsCore::request('on_moderate', 'int', 0);
$pagetitle = $inCore->menuTitle();
$pagetitle = $pagetitle && $inCore->isMenuIdStrict() ? $pagetitle : $_LANG['RSS_BLOGS'];
$inPage->addPathway($pagetitle, '/blog');
$inPage->setTitle($pagetitle);
$inPage->setDescription($pagetitle);
$blog_id = 25;
////////// НАСТРОЙКИ БЛОГА ////////////////////////////////////////////////////////////////////////////////////////
if ($do == 'config') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id) {
cmsCore::halt();
}
// получаем блог
$blog = $inBlog->getBlog($id);
if (!$blog) {
cmsCore::error404();
}
//Проверяем является пользователь хозяином блога или админом
if ($blog['user_id'] != $inUser->id && !$inUser->is_admin) {
cmsCore::halt();
}
//Если нет запроса на сохранение, показываем форму настроек блога
if (!cmsCore::inRequest('goadd')) {
//Получаем список авторов блога
$authors = $inBlog->getBlogAuthors($blog['id']);
$smarty = $inCore->initSmarty('components', 'com_blog_config.tpl');
$smarty->assign('blog', $blog);
$smarty->assign('form_action', '/blog/' . $blog['id'] . '/editblog.html');
$smarty->assign('authors_list', cmsUser::getAuthorsList($authors));
$smarty->assign('users_list', cmsUser::getUsersList(false, $authors));
$smarty->assign('is_restrictions', !$inUser->is_admin && $model->config['min_karma']);
$smarty->assign('cfg', $model->config);
$smarty->display('com_blog_config.tpl');
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
}
//Если пришел запрос на сохранение
if (cmsCore::inRequest('goadd')) {
if (!cmsCore::validateForm()) {
cmsCore::halt();
}
//Получаем настройки
$title = cmsCore::request('title', 'str');
$allow_who = cmsCore::request('allow_who', 'str', 'all');
$ownertype = cmsCore::request('ownertype', 'str', 'single');
$premod = cmsCore::request('premod', 'int', 0);
$forall = cmsCore::request('forall', 'int', 1);
$showcats = cmsCore::request('showcats', 'int', 1);
$authors = cmsCore::request('authorslist', 'array_int', array());
//Проверяем настройки
if (mb_strlen($title) < 5) {
$title = $blog['title'];
}
//Проверяем ограничения по карме (для смены типа блога)
if ($model->config['min_karma'] && !$inUser->is_admin) {
// если персональный блог
if ($ownertype == 'single' && $inUser->karma < $model->config['min_karma_private']) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['BLOG_YOU_NEED'] . ' <a href="/users/' . $inUser->id . '/karma.html">' . $_LANG['BLOG_KARMS'] . '</a> ' . $_LANG['FOR_CREATE_PERSON_BLOG'] . ' — ' . $model->config['min_karma_private'] . ', ' . $_LANG['BLOG_HEAVING'] . ' — ' . $inUser->karma));
}
// если коллективный блог
if ($ownertype == 'multi' && $inUser->karma < $model->config['min_karma_public']) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['BLOG_YOU_NEED'] . ' <a href="/users/' . $inUser->id . '/karma.html">' . $_LANG['BLOG_KARMS'] . '</a> ' . $_LANG['FOR_CREATE_TEAM_BLOG'] . ' — ' . $model->config['min_karma_public'] . ', ' . $_LANG['BLOG_HEAVING'] . ' — ' . $inUser->karma));
}
}
//сохраняем авторов
$inBlog->updateBlogAuthors($blog['id'], $authors);
//сохраняем настройки блога
$blog['seolink_new'] = $inBlog->updateBlog($blog['id'], array('title' => $title, 'allow_who' => $allow_who, 'showcats' => $showcats, 'ownertype' => $ownertype, 'premod' => $premod, 'forall' => $forall), $model->config['update_seo_link_blog']);
$blog['seolink'] = $blog['seolink_new'] ? $blog['seolink_new'] : $blog['seolink'];
if (stripslashes($title) != $blog['title']) {
//.........这里部分代码省略.........