本文整理汇总了PHP中cmsCore::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::redirect方法的具体用法?PHP cmsCore::redirect怎么用?PHP cmsCore::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::redirect方法的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_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');
}
}
示例3: files
function files()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
$do = cmsCore::getInstance()->do;
$model = new cms_model_files();
//============================================================================//
// Скачивание
if ($do == 'view') {
$fileurl = cmsCore::request('fileurl', 'html', '');
if (mb_strpos($fileurl, '-') === 0) {
$fileurl = htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-')));
}
$fileurl = cmsCore::strClear($fileurl);
if (!$fileurl || mb_strstr($fileurl, '..') || strpos($fileurl, '.') === 0) {
cmsCore::error404();
}
if (strpos($fileurl, 'http') === 0) {
$model->increaseDownloadCount($fileurl);
cmsCore::redirect($fileurl);
} elseif (file_exists(PATH . $fileurl)) {
$model->increaseDownloadCount($fileurl);
header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
header('Location:' . $fileurl);
cmsCore::halt();
} else {
cmsCore::halt($_LANG['FILE_NOT_FOUND']);
}
}
//============================================================================//
if ($do == 'redirect') {
$url = str_replace(array('--q--', ' '), array('?', '+'), cmsCore::request('url', 'str', ''));
if (mb_strpos($url, '-') === 0) {
$url = htmlspecialchars_decode(base64_decode(ltrim($url, '-')));
}
$url = cmsCore::strClear($url);
if (!$url || mb_strstr($url, '..') || strpos($url, '.') === 0) {
cmsCore::error404();
}
// кириллические домены
$url_host = parse_url($url, PHP_URL_HOST);
if (preg_match('/^[а-яё]+/iu', $url_host)) {
cmsCore::loadClass('idna_convert');
$IDN = new idna_convert();
$host = $IDN->encode($url_host);
$url = str_ireplace($url_host, $host, $url);
}
cmsCore::redirect($url);
}
//============================================================================//
}
示例4: applet_help
function applet_help()
{
$topic = cmsCore::request('topic', 'str', '');
$help_url = array('components' => 'http://cmsrudi.ru/docs/components', 'modules' => 'http://cmsrudi.ru/docs/modules', 'plugins' => 'http://cmsrudi.ru/docs/plugins');
$help_url['menu'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BC%D0%B5%D0%BD%D1%8E_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
$help_url['content'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
$help_url['cats'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
$help_url['users'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D0%B8';
$help_url['config'] = 'http://www.instantcms.ru/wiki/doku.php/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
if (isset($help_url[$topic])) {
cmsCore::redirect($help_url[$topic]);
}
cmsCore::redirect('http://cmsrudi.ru/docs');
}
示例5: applet_help
function applet_help()
{
$topic = cmsCore::request('topic', 'str', '');
$help_url['menu'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BC%D0%B5%D0%BD%D1%8E_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
$help_url['modules'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8';
$help_url['content'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
$help_url['cats'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BA%D0%BE%D0%BD%D1%82%D0%B5%D0%BD%D1%82';
$help_url['components'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BA%D0%BE%D0%BC%D0%BF%D0%BE%D0%BD%D0%B5%D0%BD%D1%82%D1%8B';
$help_url['users'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D0%B8';
$help_url['config'] = 'http://www.cms.vadyus.com/wiki/doku.php/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0_%D1%81%D0%B0%D0%B9%D1%82%D0%B0';
if (isset($help_url[$topic])) {
cmsCore::redirect($help_url[$topic]);
}
cmsCore::redirect('http://www.cms.vadyus.com/wiki');
}
示例6: banners
function banners()
{
$inCore = cmsCore::getInstance();
$model = new cms_model_banners();
$do = $inCore->do;
$banner_id = cmsCore::request('id', 'int', 0);
//======================================================================================================================//
if ($do == 'view') {
$banner = $model->getBanner($banner_id);
if (!$banner || !$banner['published']) {
cmsCore::error404();
}
$model->clickBanner($banner_id);
cmsCore::redirect($banner['link']);
}
}
示例7: 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();
}
示例8: while
$sql = "SELECT id, filename FROM cms_user_files WHERE user_id = '{$id}' AND {$fsql}";
$result = $inDB->query($sql);
if ($inDB->num_rows($result)) {
while ($file = $inDB->fetch_assoc($result)) {
@unlink(PATH . '/upload/userfiles/' . $id . '/' . $file['filename']);
cmsActions::removeObjectLog('add_file', $file['id']);
}
$inDB->query("DELETE FROM cms_user_files WHERE user_id = '{$id}' AND {$fsql}");
}
cmsCore::redirect('/users/' . $id . '/files.html');
}
/////////////////////////////// MULTIPLE FILES PUBLISHING /////////////////////////////////////////////////////////////////////////////////////////
if ($fdo == 'pubfilelist') {
$files = cmsCore::request('files', 'array_int', array());
if (!$files) {
cmsCore::error404();
}
$allow = cmsCore::request('allow', 'str', 'nobody');
if (!$inUser->id || $inUser->id != $id && !$inUser->is_admin) {
cmsCore::error404();
}
$a_list = rtrim(implode(',', $files), ',');
$fsql = '';
if ($a_list) {
$fsql .= "id IN ({$a_list})";
} else {
$fsql .= '1=0';
}
$inDB->query("UPDATE cms_user_files SET allow_who = '{$allow}' WHERE user_id = '{$id}' AND {$fsql}");
cmsCore::redirect('/users/' . $id . '/files.html');
}
示例9: session_id
$mod['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
$mod['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
}
cmsUser::sessionPut('mod', $mod);
cmsCore::redirect('/photos/' . $album['id'] . '/submit_photo.html');
}
}
////////////////// форма загрузки фотографий 2 шаг /////////////////////////////
if ($do_photo == 'submit_photo') {
$mod = cmsUser::sessionGet('mod');
if (!$mod) {
cmsCore::error404();
}
$inPage->addPathway($_LANG['ADD_PHOTO'] . ': ' . $_LANG['STEP_2']);
$inPage->setTitle($_LANG['ADD_PHOTO'] . ': ' . $_LANG['STEP_2']);
if ($album['uplimit'] && !$inUser->is_admin) {
$max_limit = true;
$max_files = (int) $album['uplimit'] - $today_uploaded;
$stop_photo = $today_uploaded >= (int) $album['uplimit'];
} else {
$max_limit = false;
$max_files = 0;
$stop_photo = false;
}
cmsPage::initTemplate('components', 'com_photos_add2')->assign('upload_url', '/components/photos/ajax/upload_photo.php')->assign('upload_complete_url', '/photos/' . $album['id'] . '/uploaded.html')->assign('sess_id', session_id())->assign('max_limit', $max_limit)->assign('album', $album)->assign('max_files', $max_files)->assign('uload_type', $mod['is_multi'] ? 'multi' : 'single')->assign('stop_photo', $stop_photo)->display('com_photos_add2.tpl');
}
///////////////// фотографии загружены /////////////////////////////////////////
if ($do_photo == 'uploaded') {
cmsUser::sessionDel('mod');
cmsCore::redirect('/photos/' . $album['id']);
}
示例10: cpAddPathway
if ($opt == 'update_cat') {
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
$item_id = cmsCore::request('item_id', 'int');
$cat['title'] = cmsCore::request('title', 'str', 'NO_TITLE');
$cat['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
$cat['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
$cat['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
$cat['published'] = cmsCore::request('published', 'int');
$cat['ordering'] = cmsCore::request('ordering', 'int');
$cat['seolink'] = $model->getCatSeoLink($cat['title'], $item_id);
cmsCore::c('db')->update('cms_forum_cats', $cat, $item_id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'info');
cmsCore::redirect('?view=components&do=config&id='. $id .'&opt=list_cats');
}
if ($opt == 'list_cats') {
cpAddPathway($_LANG['AD_FORUMS_CATS']);
echo '<h3>'. $_LANG['AD_FORUMS_CATS'] .'</h3>';
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=components&do=config&id='. $id .'&opt=edit_cat&item_id=%id%' ),
array( 'title' => $_LANG['AD_IS_PUBLISHED'], 'field' => 'published', 'width' => '100', 'do' => 'opt', 'do_suffix' => '_cat' )
);
$actions = array(
array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id='. $id .'&opt=edit_cat&item_id=%id%' ),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_DELETE_CATEGORY'], 'link' => '?view=components&do=config&id='. $id .'&opt=delete_cat&item_id=%id%' )
示例11: blogs
function blogs() {
$inCore = cmsCore::getInstance();
cmsCore::c('blog')->owner = 'user';
global $_LANG;
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) { cmsCore::loadClass('billing'); }
//Получаем параметры
$id = cmsCore::request('id', 'int', 0);
$post_id = cmsCore::request('post_id', 'int', 0);
$bloglink = cmsCore::request('bloglink', 'str', '');
$seolink = cmsCore::request('seolink', 'str', '');
$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->getComponentTitle();
cmsCore::c('page')->addPathway($pagetitle, '/blogs');
cmsCore::c('page')->setTitle($pagetitle);
cmsCore::c('page')->setDescription(cmsCore::m('blogs')->config['meta_desc'] ? cmsCore::m('blogs')->config['meta_desc'] : $pagetitle);
cmsCore::c('page')->setKeywords(cmsCore::m('blogs')->config['meta_keys'] ? cmsCore::m('blogs')->config['meta_keys'] : $pagetitle);
cmsCore::c('page')->addHeadJsLang(array('CONFIG_BLOG','DEL_BLOG','YOU_REALY_DELETE_BLOG','NEW_CAT','RENAME_CAT','YOU_REALY_DELETE_CAT','YOU_REALY_DELETE_POST','NO_PUBLISHED'));
///////////////////////// МОЙ БЛОГ /////////////////////////////////////////
if ($inCore->do == 'my_blog'){
if(!cmsCore::c('user')->id){ cmsCore::error404(); }
$my_blog = cmsCore::c('blog')->getBlogByUserId(cmsCore::c('user')->id);
if (!$my_blog) {
cmsCore::redirect('/blogs/createblog.html');
} else {
cmsCore::redirect(cmsCore::m('blogs')->getBlogURL($my_blog['seolink']));
}
}
///////////////////////// ПОСЛЕДНИЕ ПОСТЫ //////////////////////////////////
if ($inCore->do=='view'){
cmsCore::c('page')->addHead('<link rel="alternate" type="application/rss+xml" title="'.$_LANG['RSS_BLOGS'].'" href="'.HOST.'/rss/blogs/all/feed.rss">');
// кроме админов в списке только с доступом для всех
if(!cmsCore::c('user')->is_admin){
cmsCore::c('blog')->whereOnlyPublic();
}
// ограничиваем по рейтингу если надо
if(cmsCore::m('blogs')->config['list_min_rating']){
cmsCore::c('blog')->ratingGreaterThan(cmsCore::m('blogs')->config['list_min_rating']);
}
// всего постов
$total = cmsCore::c('blog')->getPostsCount(cmsCore::c('user')->is_admin);
//устанавливаем сортировку
cmsCore::c('db')->orderBy('p.pubdate', 'DESC');
cmsCore::c('db')->limitPage($page, cmsCore::m('blogs')->config['perpage']);
// сами посты
$posts = cmsCore::c('blog')->getPosts(cmsCore::c('user')->is_admin, cmsCore::m('blogs'));
if(!$posts && $page > 1){ cmsCore::error404(); }
cmsPage::initTemplate('components', 'com_blog_view_posts')->
assign('pagetitle', $pagetitle)->
assign('ownertype', $ownertype)->
assign('total', $total)->
assign('posts', $posts)->
assign('pagination', cmsPage::getPagebar($total, $page, cmsCore::m('blogs')->config['perpage'], '/blogs/latest-%page%.html'))->
assign('cfg', cmsCore::m('blogs')->config)->
display();
}
////////// СОЗДАНИЕ БЛОГА //////////////////////////////////////////////////
if ($inCore->do=='create'){
//Проверяем авторизацию
if (!cmsCore::c('user')->id){ cmsUser::goToLogin(); }
//Если у пользователя уже есть блог, то выходим
if (cmsCore::c('blog')->getUserBlogId(cmsCore::c('user')->id)) { cmsCore::redirectBack(); }
cmsCore::c('page')->addPathway($_LANG['PATH_CREATING_BLOG']);
cmsCore::c('page')->setTitle($_LANG['CREATE_BLOG']);
if (IS_BILLING){ cmsBilling::checkBalance('blogs', 'add_blog'); }
//Показ формы создания блога
if (!cmsCore::inRequest('goadd')){
cmsPage::initTemplate('components', 'com_blog_create')->
assign('is_restrictions', (!cmsCore::c('user')->is_admin && cmsCore::m('blogs')->config['min_karma']))->
assign('cfg', cmsCore::m('blogs')->config)->
display();
}
//.........这里部分代码省略.........
示例12: 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);
//.........这里部分代码省略.........
示例13: array
$perpage = 21;
$pagination = cmsPage::getPagebar($total, $page, $perpage, '/users/%user%/photos/%album%%id%-%page%.html', array('user' => $usr['login'], 'album' => $album_type, 'id' => $album_id));
$page_photos = array();
$start = $perpage * ($page - 1);
for ($p = $start; $p < $start + $perpage; $p++) {
if ($photos[$p]) {
$page_photos[] = $photos[$p];
}
}
$photos = $page_photos;
unset($page_photos);
}
//Отдаем в шаблон
cmsPage::initTemplate('components', 'com_users_photos')->assign('page_title', $album['title'])->assign('album_type', $album_type)->assign('album', $album)->assign('photos', $photos)->assign('user_id', $usr['id'])->assign('usr', $usr)->assign('my_profile', $my_profile)->assign('is_admin', $inUser->is_admin)->assign('pagebar', $pagination)->display('com_users_photos.tpl');
}
//============================================================================//
//============================ Удалить фотоальбом ============================//
//============================================================================//
if ($pdo == 'delalbum') {
$album_id = cmsCore::request('album_id', 'int', '0');
$album = $model->getPhotoAlbum('private', $album_id);
if (!$album) {
cmsCore::error404();
}
if (!$inUser->is_admin && $album['user_id'] != $inUser->id) {
cmsCore::error404();
}
$model->deletePhotoAlbum($id, $album_id);
$user = cmsUser::getShortUserData($album['user_id']);
cmsCore::redirect(cmsUser::getProfileURL($user['login']));
}
示例14: array
$model->updateClub($item_id, $new_club);
cmsCore::addSessionMessage($_LANG['CONFIG_SAVE_OK'], 'success');
if (empty($_SESSION['editlist'])) {
cmsCore::redirect('index.php?view=components&do=config&id='. $id .'&opt=list');
} else {
cmsCore::redirect('index.php?view=components&do=config&id='. $id .'&opt=edit');
}
}
if ($opt == 'delete') {
$model->deleteClub(cmsCore::request('item_id', 'int', 0));
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=components&do=config&id='. $id .'&opt=list');
}
cpToolMenu($toolmenu);
if ($opt == 'list') {
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40'),
array( 'title' => $_LANG['DATE'], 'field' => 'pubdate', 'width' => '100', 'filter' => '15', 'fdate' => '%d/%m/%Y'),
array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'filter' => '15', 'link' => '?view=components&do=config&id='. $id .'&opt=edit&item_id=%id%'),
array( 'title' => $_LANG['CLUB_TYPE'], 'field' => 'clubtype', 'width' => '100'),
array( 'title' => $_LANG['MEMBERS'], 'field' => 'members_count', 'width' => '100'),
array( 'title' => $_LANG['AD_IS_PUBLISHED'], 'field' => 'published', 'width' => '100', 'do' => 'opt', 'do_suffix' => '_club')
);
$actions = array(
示例15: 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>
//.........这里部分代码省略.........