本文整理汇总了PHP中cmsCore::addSessionMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::addSessionMessage方法的具体用法?PHP cmsCore::addSessionMessage怎么用?PHP cmsCore::addSessionMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::addSessionMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_templates
function applet_templates()
{
global $adminAccess;
global $_LANG;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', array('config', 'save_config'), 'main');
cmsCore::c('page')->setTitle($_LANG['AD_TEMPLATES_SETTING']);
cpAddPathway($_LANG['AD_TEMPLATES_SETTING'], 'index.php?view=templates');
if ($do == 'main') {
cmsCore::c('page')->initTemplate('applets', 'templates')->assign('templates', cmsCore::getDirsList('/templates'))->display();
}
if ($do == 'config') {
$template = cmsCore::request('template', 'str', '');
cpAddPathway($_LANG['AD_TEMPLATE'] . ': ' . $template, 'index.php?view=templates&do=config&template=' . $template);
if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php')) {
cmsCore::error404();
}
include PATH . '/templates/' . $template . '/config.php';
if (function_exists('get_template_cfg_fields')) {
$tpl_cfgs = get_template_cfg_fields();
if (!empty($tpl_cfgs)) {
$tpl_cfgs_val = cmsCore::getTplCfg($template);
cmsCore::c('page')->initTemplate('applets', 'templates')->assign('template', $template)->assign('form_gen_form', cmsCore::c('form_gen')->generateForm($tpl_cfgs, $tpl_cfgs_val))->display();
} else {
cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_NO_CONFIG'], 'error');
cmsCore::redirectBack();
}
} else {
cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_ERROR'], 'error');
cmsCore::redirectBack();
}
}
if ($do == 'save_config') {
$template = cmsCore::request('template', 'str', '');
if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php') || !cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
include PATH . '/templates/' . $template . '/config.php';
if (function_exists('get_template_cfg_fields')) {
$tpl_cfgs = get_template_cfg_fields();
if (!empty($tpl_cfgs)) {
$tpl_cfgs = cmsCore::c('form_gen')->requestForm($tpl_cfgs);
cmsCore::saveTplCfg($tpl_cfgs, $template);
cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_SAVED'], 'success');
cmsCore::redirect('/admin/index.php?view=templates');
} else {
cmsCore::error404();
}
} else {
cmsCore::error404();
}
}
}
示例2: applet_clearcache
function applet_clearcache()
{
global $adminAccess;
global $_LANG;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
cmsCore::clearCache();
cmsCore::addSessionMessage($_LANG['AD_CLEAR_CACHE_SUCCESS'], 'success');
cmsCore::redirectBack();
}
示例3: applet_arhive
function applet_arhive()
{
$inCore = cmsCore::getInstance();
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES_ARCHIVE']);
$cfg = $inCore->loadComponentConfig('content');
$cfg_arhive = $inCore->loadComponentConfig('arhive');
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 (!cmsUser::checkCsrfToken()) {
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(array('icon' => 'folders.gif', 'title' => $_LANG['AD_LIST_OF_ARTICLES'], 'link' => '?view=arhive'));
cpToolMenu($toolmenu);
cpAddPathway($_LANG['AD_SETTINGS'], 'index.php?view=arhive&do=config');
cmsCore::c('page')->initTemplate('applets', 'arhive')->assign('cfg_arhive', $cfg_arhive)->display();
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETTINGS'], 'link' => '?view=arhive&do=config'), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=arhive&do=delete&multiple=1');"));
cpToolMenu($toolmenu);
//TABLE COLUMNS
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_CREATE'], 'field' => 'pubdate', 'width' => '80', 'filter' => 15, 'fdate' => '%d/%m/%Y'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=content&do=edit&id=%id%', 'filter' => 15), array('title' => $_LANG['AD_PARTITION'], 'field' => 'category_id', 'width' => '150', 'filter' => 1, 'prc' => 'cpCatById', 'filterlist' => cpGetList('cms_category')));
//ACTIONS
$actions = array(array('title' => $_LANG['AD_TO_ARTICLES_CATALOG'], 'icon' => 'arhive_off.gif', 'link' => '?view=arhive&do=arhive_off&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=content&do=delete&id=%id%', 'confirm' => $_LANG['AD_DELETE_MATERIALS']));
//Print table
cpListTable('cms_content', $fields, $actions, 'is_arhive=1');
}
if ($do == 'arhive_off') {
if (cmsCore::inRequest('id')) {
cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '0');
cmsCore::redirect('?view=arhive');
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::m('content')->deleteArticle($id, $cfg['af_delete']);
}
} else {
cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'), $cfg['af_delete']);
}
cmsCore::redirect('?view=arhive');
}
}
示例4: mod_invite
function mod_invite($mod, $cfg) {
global $_LANG;
$errors = false;
$is_redirect = false; // в модуле нельзя использовать cmsCore::redirectBack(), используем костыли ;)
if (cmsCore::inRequest('send_invite_email')) {
$is_redirect = true;
$username = cmsCore::request('username', 'str', '');
$email = cmsCore::request('friend_email', 'email', '');
if (!$username && !cmsCore::c('user')->id) {
cmsCore::addSessionMessage($_LANG['ERR_NEED_NAME'], 'error'); $errors = true;
}
if (cmsCore::c('user')->id) {
$username = cmsCore::c('user')->nickname;
}
if (!$email) {
cmsCore::addSessionMessage($_LANG['ERR_NEED_MAIL'], 'error'); $errors = true;
}
if (!$errors) {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$letter = cmsCore::getLanguageTextFile('mail_invite');
$letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
$letter = str_replace('{site_url}', HOST, $letter);
$letter = str_replace('{username}', $username, $letter);
cmsCore::mailText($email, sprintf($_LANG['INVITE_SUBJECT'], $username), $letter);
cmsCore::addSessionMessage($_LANG['INVITE_SENDED'], 'success');
}
}
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('user_id', cmsCore::c('user')->id)->
assign('is_redirect', $is_redirect)->
display();
return true;
}
示例5: applet_config
function applet_config()
{
// получаем оригинальный конфиг
$config = cmsConfig::getDefaultConfig();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
cmsCore::c('page')->setTitle($_LANG['AD_SITE_SETTING']);
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
$do = cmsCore::request('do', 'str', 'list');
if ($do == 'save') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$newCFG = cmsCore::getArrayFromRequest(array('scheme' => array('scheme', array('http', 'https'), ''), 'sitename' => array('sitename', 'str', ''), 'title_and_sitename' => array('title_and_sitename', 'int', 0), 'title_and_page' => array('title_and_page', 'int', 0), 'hometitle' => array('hometitle', 'str', ''), 'homecom' => array('homecom', 'str', ''), 'com_without_name_in_url' => array('com_without_name_in_url', 'str', ''), 'siteoff' => array('siteoff', 'int', 0), 'only_authorized' => array('only_authorized', 'int', 0), 'debug' => array('debug', 'int', 0), 'offtext' => array('offtext', 'str', ''), 'keywords' => array('keywords', 'str', ''), 'metadesc' => array('metadesc', 'str', ''), 'seourl' => array('seourl', 'int', 0), 'lang' => array('lang', 'str', 'ru'), 'is_change_lang' => array('is_change_lang', 'int', 0), 'sitemail' => array('sitemail', 'str', ''), 'sitemail_name' => array('sitemail_name', 'str', ''), 'wmark' => array('wmark', 'str', ''), 'template' => array('template', 'str', ''), 'admin_template' => array('admin_template', 'str', ''), 'cache' => array('cache', 'int', 0), 'cache_type' => array('cache_type', array('file', 'memcached'), ''), 'memcached_host' => array('memcached_host', 'str', ''), 'memcached_port' => array('memcached_port', 'int', 0), 'combine_css_enable' => array('combine_css_enable', 'int', 0), 'combine_css' => array('combine_css', 'html', ''), 'combine_js_enable' => array('combine_js_enable', 'int', 0), 'combine_js' => array('combine_js', 'html', ''), 'splash' => array('splash', 'int', 0), 'slight' => array('slight', 'int', 0), 'show_pw' => array('show_pw', 'int', 0), 'last_item_pw' => array('last_item_pw', 'int', 0), 'index_pw' => array('index_pw', 'int', 0), 'fastcfg' => array('fastcfg', 'int', 0), 'mailer' => array('mailer', 'str', ''), 'smtpsecure' => array('smtpsecure', 'str', ''), 'smtpauth' => array('smtpauth', 'int', 0), 'smtpuser' => array('smtpuser', 'str', $config['smtpuser']), 'smtppass' => array('smtppass', 'str', $config['smtppass']), 'smtphost' => array('smtphost', 'str', ''), 'smtpport' => array('smtpport', 'int', '25'), 'timezone' => array('timezone', 'str', $config['timezone']), 'user_stats' => array('user_stats', 'int', 0), 'seo_url_count' => array('seo_url_count', 'int', 0), 'max_pagebar_links' => array('max_pagebar_links', 'int', 0), 'allow_ip' => array('allow_ip', 'str', ''), 'iframe_enable' => array('iframe_enable', 'int', 0), 'vk_enable' => array('vk_enable', 'int', 0), 'vk_id' => array('vk_id', 'str', ''), 'vk_private_key' => array('vk_private_key', 'str', '')));
$newCFG['sitename'] = stripslashes($newCFG['sitename']);
$newCFG['hometitle'] = stripslashes($newCFG['hometitle']);
$newCFG['offtext'] = htmlspecialchars($newCFG['offtext'], ENT_QUOTES);
$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'];
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');
}
cpCheckWritable('/includes/config/config.inc.json');
$result = cmsCore::c('db')->query("SELECT (sum(data_length)+sum(index_length))/1024/1024 as size FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" . $config['db_base'] . "'", true);
if (!cmsCore::c('db')->error()) {
$s = cmsCore::c('db')->fetch_assoc($result);
} else {
$s['size'] = 0;
}
cmsCore::c('page')->initTemplate('applets', 'config')->assign('config', $config)->assign('timezone_opt', cmsCore::getTimeZonesOptions($config['timezone']))->assign('admin_templates', cmsCore::getDirsList('/templates/admin'))->assign('templates', cmsCore::getDirsList('/templates'))->assign('tpl_info', cmsCore::c('page')->getTplInfo(cmsCore::c('page')->template))->assign('components_opt', cmsCore::getListItems('cms_components', $config['com_without_name_in_url'], 'title', 'ASC', 'internal=0', 'link'))->assign('homecom_opt', cmsCore::getListItems('cms_components', $config['homecom'], 'title', 'ASC', 'internal=0', 'link'))->assign('langs', cmsCore::getDirsList('/languages'))->assign('db_size', round($s['size'], 2))->display();
}
示例6: uploadFoto
public function uploadFoto($files, $type, $photo_id)
{
foreach ($files as $file) {
if (mb_ereg("image", $file['type'])) {
$md5 = md5_file($file['tmp_name']);
if (!file_exists($this->root . "/images/fotolib/{$md5}.jpg")) {
copy($file['tmp_name'], $this->root . "/images/fotolib/{$md5}.jpg");
$this->Resize($this->root . "/images/fotolib/{$md5}.jpg", $this->root . "/images/fotolib/S_{$md5}.jpg", 640, 480);
$this->Resize($this->root . "/images/fotolib/{$md5}.jpg", $this->root . "/images/fotolib/L_{$md5}.jpg", 128, 128);
$user_id = $this->inUser->id;
$time = time();
if (file_exists($this->root . "/images/fotolib/L_{$md5}.jpg") and file_exists($this->root . "/images/fotolib/L_{$md5}.jpg")) {
$sql = "INSERT INTO cms_fotolib (`user_id`, `type`, `photo_id`, `name`, `time`) \n\t\t\t\t VALUES ('{$user_id}', '{$type}', '{$photo_id}', '{$md5}', '{$time}')";
$result = $this->inDB->query($sql);
} else {
unlink($this->root . "/images/fotolib/{$md5}.jpg");
cmsCore::addSessionMessage('Ошибка добавления!', 'error');
}
}
}
}
}
示例7: array
$fields[] = array('title' => $_LANG['AD_BANNER_CLICKS'], 'field' => 'clicks', 'width' => '90');
$fields[] = array('title' => $_LANG['AD_BANNER_CTR'], 'field' => array('clicks', 'hits'), 'width' => '90', 'prc' => 'bannerCTRbyID');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_BANNER_DEL_CONFIRM'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete&item_id=%id%');
cpListTable('cms_banners', $fields, $actions, '', 'pubdate DESC');
}
if ($opt == 'add' || $opt == 'edit') {
if ($opt == 'add') {
echo '<h3>' . $_LANG['AD_ADD_BANNER'] . '</h3>';
cpAddPathway($_LANG['AD_ADD_BANNER']);
} 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 = '';
if (isset($_SESSION['editlist'])) {
$item_id = array_shift($_SESSION['editlist']);
if (sizeof($_SESSION['editlist']) == 0) {
unset($_SESSION['editlist']);
} else {
$ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
}
} else {
$item_id = cmsCore::request('item_id', 'int', 0);
}
$mod = cms_model_banners::getBanner($item_id);
示例8: 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 (!cmsUser::checkCsrfToken()) {
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['for_img'] = cmsCore::request('for_img', 'html', '');
//.........这里部分代码省略.........
示例9: users
//.........这里部分代码省略.........
$usr = $model->getUser($id);
if (!$usr) {
cmsCore::error404();
}
$opt = cmsCore::request('opt', 'str', 'edit');
// главного админа может редактировать только он сам
if ($id == 1 && $inUser->id != $id) {
cmsCore::error404();
}
// показываем форму
if ($opt == 'edit') {
$inPage->setTitle($_LANG['CONFIG_PROFILE'] . ' - ' . $usr['nickname']);
$inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
$inPage->addPathway($_LANG['CONFIG_PROFILE']);
$private_forms = array();
if (isset($model->config['privforms'])) {
if (is_array($model->config['privforms'])) {
foreach ($model->config['privforms'] as $form_id) {
$private_forms = array_merge($private_forms, cmsForm::getFieldsHtml($form_id, $usr['formsdata']));
}
}
}
cmsPage::initTemplate('components', 'com_users_edit_profile')->assign('opt', $opt)->assign('usr', $usr)->assign('private_forms', $private_forms)->assign('cfg_forum', $inCore->loadComponentConfig('forum'))->assign('cfg', $model->config)->display('com_users_edit_profile.tpl');
return;
}
// Если сохраняем профиль
if ($opt == 'save') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$errors = false;
$users['nickname'] = cmsCore::request('nickname', 'str');
if (mb_strlen($users['nickname']) < 2) {
cmsCore::addSessionMessage($_LANG['SHORT_NICKNAME'], 'error');
$errors = true;
}
cmsCore::loadModel('registration');
$modreg = new cms_model_registration();
if (!$inUser->is_admin) {
if ($modreg->getBadNickname($users['nickname'])) {
cmsCore::addSessionMessage($_LANG['ERR_NICK_EXISTS'], 'error');
$errors = true;
}
}
$profiles['gender'] = cmsCore::request('gender', 'str');
$profiles['city'] = cmsCore::request('city', 'str');
if (mb_strlen($profiles['city']) > 50) {
cmsCore::addSessionMessage($_LANG['LONG_CITY_NAME'], 'error');
$errors = true;
}
$users['email'] = cmsCore::request('email', 'email');
if (!$users['email']) {
cmsCore::addSessionMessage($_LANG['REALY_ADRESS_EMAIL'], 'error');
$errors = true;
}
if ($usr['email'] != $users['email']) {
$is_set_email = $inDB->get_field('cms_users', "email='{$users['email']}'", 'id');
if ($is_set_email) {
cmsCore::addSessionMessage($_LANG['ADRESS_EMAIL_IS_BUSY'], 'error');
$errors = true;
} else {
// формируем токен
$token = md5($usr['email'] . uniqid() . microtime());
$inDB->insert('cms_users_activate', array('user_id' => $inUser->id, 'pubdate' => date("Y-m-d H:i:s"), 'code' => $token));
$codelink = HOST . '/users/change_email/' . $token . '/' . $users['email'];
// по старому адресу высылаем письмо с подтверждением
示例10: 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', cmsCore::request('item', 'array_int', array()));
}
cmsCore::redirect('?view=userbanlist');
}
if ($do == 'submit' || $do == 'update') {
if (!cmsUser::checkCsrfToken()) {
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 = '';
//.........这里部分代码省略.........
示例11: calendar
function calendar()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inUser = cmsUser::getInstance();
$inCore->loadModel('calendar');
$model = new cms_model_calendar();
$do = $inCore->request('do', 'str', 'view');
$cfg = $inCore->loadComponentConfig('calendar');
if ($do == 'view') {
$inPage->setTitle("Календарь событий");
$smarty = $inCore->initSmarty('components', 'com_calendar_view.tpl');
$guest = TRUE;
if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
$guest = FALSE;
}
if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
$guest = FALSE;
}
if ($inUser->is_admin) {
$guest = FALSE;
}
$catigories = $model->getAllCategories();
$smarty->assign('guest', $guest);
$smarty->assign('cfg', $cfg);
$smarty->assign('catigories', $catigories);
$smarty->assign('category', "all");
$smarty->display('com_calendar_view.tpl');
return;
}
if ($do == "category_view") {
$category_id = $inCore->request('category_id', 'int', 0);
$smarty = $inCore->initSmarty('components', 'com_calendar_view.tpl');
$guest = TRUE;
if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
$guest = FALSE;
}
if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
$guest = FALSE;
}
if ($inUser->is_admin) {
$guest = FALSE;
}
$category = $model->getCategory($category_id);
$catigories = $model->getAllCategories();
if (!$category) {
//$inCore->redirect("/calendar");
print mysql_error();
}
$inPage->setTitle("Календарь событий:" . $category['title']);
$smarty->assign('guest', $guest);
$smarty->assign('cfg', $cfg);
$smarty->assign('catigories', $catigories);
$smarty->assign('category', $category_id);
$smarty->display('com_calendar_view.tpl');
return;
}
if ($do == 'add') {
$guest = TRUE;
if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
$guest = FALSE;
}
if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
$guest = FALSE;
}
if ($inUser->is_admin) {
$guest = FALSE;
}
if ($guest) {
$inCore->redirect('/');
exit;
}
$is_send = $inCore->inRequest('title');
if ($is_send) {
$title = $inCore->request('title', 'str');
$type_raw = $inCore->request('type', 'str');
$date_start = $inCore->request('date_start', 'str');
$date_end = $inCore->request('date_end', 'str');
$hour_start = $inCore->request('hour_start', 'str');
$hour_end = $inCore->request('hour_end', 'str');
$min_start = $inCore->request('min_start', 'str');
$min_end = $inCore->request('min_end', 'str');
$content = $inCore->request('content', 'str');
if (!$title || !$type_raw || !$date_start || !$hour_start || !$hour_end || !$min_start || !$min_end) {
cmsCore::addSessionMessage('Ой, что то не было заполнено...', 'error');
$inCore->redirectBack();
exit;
} else {
$start_time = strtotime($date_start . ' ' . $hour_start . ':' . $min_start);
$end_time = strtotime($date_end . ' ' . $hour_end . ':' . $min_end);
if ($data_end == "" or $date_end < $date_start) {
$data_end = $data_start;
}
$type_data = explode("_", $type_raw);
$type = $type_data[0];
$apx = $type_data[1];
$event_id = $model->addEvent($inUser->id, $type, $apx, $start_time, $end_time, $title, $content);
if ($event_id) {
if ($type != "private") {
cmsActions::log('add_event', array('object' => 'событие', 'object_url' => '/calendar/event' . $event_id . '.html', 'object_id' => $event_id, 'target' => $title, 'target_url' => '/calendar/event' . $event_id . '.html', 'target_id' => '0', 'description' => $title));
//.........这里部分代码省略.........
示例12: photos
//.........这里部分代码省略.........
$photo['karma_buttons'] = cmsKarmaButtons('photo', $photo['id'], $photo['rating'], $is_author);
$photo['genderlink'] = cmsUser::getGenderLink($photo['user_id'], $photo['nickname'], $photo['gender'], $photo['login']);
cmsPage::initTemplate('components', 'com_photos_view_photo')->assign('photo', $photo)->assign('bbcode', '[IMG]' . HOST . '/images/photos/medium/' . $photo['file'] . '[/IMG]')->assign('previd', $previd)->assign('nextid', $nextid)->assign('cfg', $model->config)->assign('is_author', $is_author)->assign('is_admin', $inUser->is_admin)->assign('tagbar', $photo['a_tags'] ? cmsTagBar('photo', $photo['id']) : '')->display('com_photos_view_photo.tpl');
//выводим комментарии, если они разрешены и фото опубликовано
if ($photo['comments'] && $inCore->isComponentInstalled('comments')) {
cmsCore::includeComments();
comments('photo', $photo['id'], array(), $is_author);
}
}
/////////////////////////////// PHOTO UPLOAD ////////////////////////////////////////////////////////////////////////////////
if ($do == 'addphoto') {
// Неавторизованных просим авторизоваться
if (!$inUser->id) {
cmsUser::goToLogin();
}
$do_photo = cmsCore::request('do_photo', 'str', 'addphoto');
// получаем альбом
$album = $inDB->getNsCategory('cms_photo_albums', $id);
if (!$album) {
cmsCore::error404();
}
if (!$album['published'] && !$inUser->is_admin) {
cmsCore::error404();
}
$album = cmsCore::callEvent('GET_PHOTO_ALBUM', $album);
// права доступа
// загружаем только в разрешенные альбомы
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::addSessionMessage('<strong>' . $_LANG['MAX_UPLOAD_IN_DAY'] . '</strong> ' . $_LANG['CAN_UPLOAD_TOMORROW'], 'error');
cmsCore::redirectBack();
}
// глубиномер
$path_list = $inDB->getNsCategoryPath('cms_photo_albums', $album['NSLeft'], $album['NSRight'], 'id, title, NSLevel');
if ($path_list) {
foreach ($path_list as $pcat) {
$inPage->addPathway($pcat['title'], '/photos/' . $pcat['id']);
}
}
include 'components/photos/add_photo.php';
}
/////////////////////////////// PHOTO EDIT ///////////////////////////////////////////////////////////////////////////////////////////
if ($do == 'editphoto') {
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 (mb_strstr($photo['NSDiffer'], 'club')) {
cmsCore::halt();
}
$is_author = $photo['user_id'] == $inUser->id && $inUser->id;
if (!$inUser->is_admin && !$is_author) {
cmsCore::halt();
}
if (cmsCore::inRequest('edit_photo')) {
示例13: jwHeader
$cfg['readdesc'] = cmsCore::request('readdesc', 'int', 0);
$cfg['is_url_cyrillic'] = cmsCore::request('is_url_cyrillic', 'int', 0);
$cfg['rating'] = cmsCore::request('rating', 'int', 0);
$cfg['perpage'] = cmsCore::request('perpage', 'int', 0);
$cfg['pt_show'] = cmsCore::request('pt_show', 'int', 0);
$cfg['pt_disp'] = cmsCore::request('pt_disp', 'int', 0);
$cfg['pt_hide'] = cmsCore::request('pt_hide', 'int', 0);
$cfg['autokeys'] = cmsCore::request('autokeys', 'int', 0);
$cfg['img_small_w'] = cmsCore::request('img_small_w', 'int', 100);
$cfg['img_big_w'] = cmsCore::request('img_big_w', 'int', 200);
$cfg['img_sqr'] = cmsCore::request('img_sqr', 'int', 1);
$cfg['img_users'] = cmsCore::request('img_users', 'int', 1);
$cfg['watermark'] = cmsCore::request('watermark', 'int', 0);
$cfg['watermark_only_big'] = cmsCore::request('watermark_only_big', 'int', 0);
$inCore->saveComponentConfig('content', $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('?view=components&do=config&id=' . $id . '&opt=config');
}
require '../includes/jwtabs.php';
$GLOBALS['cp_page_head'][] = jwHeader();
?>
<form action="index.php?view=components&do=config&id=<?php
echo $id;
?>
" method="post" name="optform" target="_self" id="form1">
<input type="hidden" name="csrf_token" value="<?php
echo cmsUser::getCsrfToken();
?>
" />
<?php
示例14: array
if ($is_clear) {
$inDB->delete('cms_polls_log', "poll_id = '{$poll_id}'");
}
$answers = array();
foreach ($answers_title as $key => $answer) {
if ($answer) {
if (isset($nums[$key]) && !$is_clear) {
$answers[$answer] = $nums[$key];
} else {
$answers[$answer] = 0;
}
}
}
$item['answers'] = cmsCore::arrayToYaml($answers);
$inDB->update('cms_polls', $item, $poll_id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('?view=components&do=config&id=' . $id);
}
if ($opt == 'add' || $opt == 'edit') {
if ($opt == 'add') {
cpAddPathway($_LANG['AD_ADD_POLL']);
} else {
$mod = $model->getPoll(cmsCore::request('poll_id', 'int'));
cpAddPathway($_LANG['AD_EDIT_POLL']);
$answers_title = array();
$answers_num = array();
$item = 1;
foreach ($mod['answers'] as $answer => $num) {
$answers_title[$item] = htmlspecialchars($answer);
$answers_num[$item] = $num;
$item++;
示例15: applet_menu
function applet_menu()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/menu', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_MENU'];
cpAddPathway($_LANG['AD_MENU'], 'index.php?view=menu');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'list') {
$toolmenu[] = array('icon' => 'new.gif', 'title' => $_LANG['AD_MENU_POINT_ADD'], 'link' => '?view=menu&do=add');
$toolmenu[] = array('icon' => 'newmenu.gif', 'title' => $_LANG['AD_MENU_ADD'], 'link' => '?view=menu&do=addmenu');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=edit&multiple=1');");
$toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=delete&multiple=1');");
$toolmenu[] = array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=show&multiple=1');");
$toolmenu[] = array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=hide&multiple=1');");
$toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=menu');
cpToolMenu($toolmenu);
$fields[] = array('title' => 'Lt', 'field' => 'NSLeft', 'width' => '30');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=menu&do=edit&id=%id%');
$fields[] = array('title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '60');
$fields[] = array('title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100');
$fields[] = array('title' => $_LANG['AD_LINK'], 'field' => array('linktype', 'linkid', 'link'), 'width' => '240', 'prc' => 'cpMenutypeById');
$fields[] = array('title' => $_LANG['AD_MENU'], 'field' => 'menu', 'width' => '70', 'filter' => '10', 'filterlist' => cpGetList('menu'), 'prc' => 'list_menu');
$fields[] = array('title' => $_LANG['TEMPLATE'], 'field' => 'template', 'width' => '70', 'prc' => 'cpTemplateById');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=menu&do=edit&id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MENU_POINT_CONFIRM'], 'link' => '?view=menu&do=delete&id=%id%');
cpListTable('cms_menu', $fields, $actions, 'parent_id>0', 'NSLeft, ordering');
} else {
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=menu');
cpToolMenu($toolmenu);
}
if ($do == 'move_up') {
$inDB->moveNsCategory('cms_menu', $id, 'up');
cmsCore::redirectBack();
}
if ($do == 'move_down') {
$inDB->moveNsCategory('cms_menu', $id, 'down');
cmsCore::redirectBack();
}
if ($do == 'show') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbShow('cms_menu', $id);
}
echo '1';
exit;
} else {
dbShowList('cms_menu', $_REQUEST['item']);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
}
if ($do == 'hide') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbHide('cms_menu', $id);
}
echo '1';
exit;
} else {
dbHideList('cms_menu', cmsCore::request('item', 'array_int', array()));
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
}
if ($do == 'delete') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
$inDB->deleteNS('cms_menu', (int) $id);
}
} else {
$items = cmsCore::request('item', 'array_int', array());
foreach ($items as $item_id) {
$inDB->deleteNS('cms_menu', $item_id);
}
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
if ($do == 'update') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$id = cmsCore::request('id', 'int', 0);
if (!$id) {
cmsCore::redirectBack();
}
$title = cmsCore::request('title', 'str', '');
$menu = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
$linktype = cmsCore::request('mode', 'str', '');
$linkid = cmsCore::request($linktype, 'str', '');
$link = $inCore->getMenuLink($linktype, $linkid);
$target = cmsCore::request('target', 'str', '');
$published = cmsCore::request('published', 'int', 0);
//.........这里部分代码省略.........