本文整理汇总了PHP中cmsCore::halt方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::halt方法的具体用法?PHP cmsCore::halt怎么用?PHP cmsCore::halt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::halt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_filters
function applet_filters() {
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) { cpAccessDenied(); }
if (!cmsUser::isAdminCan('admin/filters', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_LANG['AD_FILTERS']);
cpAddPathway($_LANG['AD_FILTERS'], 'index.php?view=filters');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'hide') {
cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '0');
cmsCore::halt('1');
}
if ($do == 'show') {
cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '1');
cmsCore::halt('1');
}
if ($do == 'list') {
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '250' ),
array( 'title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '' ),
array( 'title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '100' )
);
cpListTable('cms_filters', $fields, array());
}
}
示例2: polls
function polls()
{
$model = new cms_model_polls();
global $_LANG;
$do = cmsCore::getInstance()->do;
//========================================================================================================================//
//========================================================================================================================//
if ($do == 'view') {
$answer = cmsCore::request('answer', 'str', '');
$poll_id = cmsCore::request('poll_id', 'int');
if (!$answer || !$poll_id) {
if (cmsCore::isAjax()) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['SELECT_THE_OPTION']));
} else {
cmsCore::error404();
}
}
$poll = $model->getPoll($poll_id);
if (!$poll) {
cmsCore::jsonOutput(array('error' => true, 'text' => ''));
}
if ($model->isUserVoted($poll_id)) {
cmsCore::jsonOutput(array('error' => true, 'text' => ''));
}
if (!cmsUser::checkCsrfToken()) {
cmsCore::halt();
}
$model->votePoll($poll, $answer);
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['VOTE_ACCEPTED']));
}
}
示例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_cron
function applet_cron() {
cmsCore::loadClass('cron');
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_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(
array( 'icon' => 'new.gif', 'title' => $_LANG['AD_CREATE_CRON_MISSION'], '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); }
cmsCore::halt('1');
}
if ($do == 'hide') {
if ($id) { cmsCron::jobEnabled($id, false); }
cmsCore::halt('1');
}
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 (!cmsUser::checkCsrfToken()) { 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 (!cmsUser::checkCsrfToken()) { 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');
//.........这里部分代码省略.........
示例5: preg_replace
if (!$file) {
cmsCore::error404();
}
$name = preg_replace('/\\.+\\//', '', $file['filename']);
$fileurl = '/upload/userfiles/' . $file['user_id'] . '/' . $name;
if (!file_exists(PATH . $fileurl)) {
cmsCore::error404();
}
if ($file['user_id'] != $inUser->id && $file['allow_who'] != 'all' && !$inUser->is_admin) {
$inCore->halt($_LANG['FILE_HIDEN']);
}
$inDB->query("UPDATE cms_user_files SET hits = hits + 1 WHERE id = {$file_id}");
header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
header('Location:' . $fileurl);
cmsCore::halt();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($fdo == 'addfile') {
if (!$inUser->id) {
cmsUser::goToLogin();
}
$usr = cmsUser::getShortUserData($inUser->id);
if (!$usr) {
cmsCore::error404();
}
$free_mb = $model->config['filessize'] ? round($model->config['filessize'] - round($model->getUserFilesSize($usr['id']) / 1024 / 1024, 2), 2) : '';
if (cmsCore::inRequest('upload')) {
$size_mb = 0;
$loaded_files = array();
$list_files = array();
示例6:
if ($opt == 'show_cat') {
$item_id = cmsCore::request('item_id', 'int');
if (!empty($item_id)) {
$sql = "UPDATE cms_forum_cats SET published = 1 WHERE id = ". $item_id;
cmsCore::c('db')->query($sql);
cmsCore::halt('1');
}
}
if ($opt == 'hide_cat') {
$item_id = cmsCore::request('item_id', 'int');
if (!empty($item_id)) {
$sql = "UPDATE cms_forum_cats SET published = 0 WHERE id = ". $item_id;
cmsCore::c('db')->query($sql);
cmsCore::halt('1');
}
}
if ($opt == 'submit_cat') {
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
$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']);
cmsCore::c('db')->insert('cms_forum_cats', $cat);
示例7: blogs
//.........这里部分代码省略.........
//Добавляем блог в базу
$blog_id = cmsCore::c('blog')->addBlog(array('user_id'=>cmsCore::c('user')->id, 'title'=>$title, 'allow_who'=>$allow_who, 'ownertype'=>$ownertype, 'forall'=>1));
$blog_link = cmsCore::c('db')->get_field('cms_blogs', "id='{$blog_id}'", 'seolink');
//регистрируем событие
cmsActions::log('add_blog', array(
'object' => $title,
'object_url' => cmsCore::m('blogs')->getBlogURL($blog_link),
'object_id' => $blog_id,
'target' => '',
'target_url' => '',
'target_id' => 0,
'description' => ''
));
if (IS_BILLING){ cmsBilling::process('blogs', 'add_blog'); }
cmsCore::addSessionMessage($_LANG['BLOG_CREATED_TEXT'], 'info');
cmsCore::redirect(cmsCore::m('blogs')->getBlogURL($blog_link));
}
}
////////// НАСТРОЙКИ БЛОГА /////////////////////////////////////////////////
if ($inCore->do=='config'){
if(!cmsCore::c('user')->id) { cmsCore::error404(); }
if(!cmsCore::isAjax()) { cmsCore::error404(); }
// получаем блог
$blog = cmsCore::c('blog')->getBlog($id);
if (!$blog) { cmsCore::error404(); }
//Проверяем является пользователь хозяином блога или админом
if ($blog['user_id'] != cmsCore::c('user')->id && !cmsCore::c('user')->is_admin ) { cmsCore::halt(); }
//Если нет запроса на сохранение, показываем форму настроек блога
if (!cmsCore::inRequest('goadd')){
//Получаем список авторов блога
$authors = cmsCore::c('blog')->getBlogAuthors($blog['id']);
cmsPage::initTemplate('components', 'com_blog_config')->
assign('blog', $blog)->
assign('form_action', '/blogs/'.$blog['id'].'/editblog.html')->
assign('authors_list', cmsUser::getAuthorsList($authors))->
assign('users_list', cmsUser::getUsersList(false, $authors))->
assign('is_restrictions', (!cmsCore::c('user')->is_admin && cmsCore::m('blogs')->config['min_karma']))->
assign('cfg', cmsCore::m('blogs')->config)->
assign('is_admin', cmsCore::c('user')->is_admin)->
display();
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
}
//Если пришел запрос на сохранение
if (cmsCore::inRequest('goadd')){
//Получаем настройки
$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 (cmsCore::m('blogs')->config['seo_user_access'] || cmsCore::c('user')->is_admin) {
$page_title = cmsCore::request('pagetitle', 'str', '');
$meta_keys = cmsCore::request('meta_keys', 'str', '');
示例8: files
function files()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
$do = cmsCore::getInstance()->do;
//============================================================================//
// Скачивание
if ($do == 'view') {
$fileurl = cmsCore::request('fileurl', 'str', '');
if (!$fileurl) {
cmsCore::error404();
}
$fileurl = mb_strpos($fileurl, '-') === 0 ? htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-'))) : $fileurl;
if (mb_strstr($fileurl, '..')) {
cmsCore::error404();
}
if (mb_strstr($fileurl, 'http:/')) {
if (!mb_strstr($fileurl, 'http://')) {
$fileurl = str_replace('http:/', 'http://', $fileurl);
}
}
$downloads = cmsCore::fileDownloadCount($fileurl);
if ($downloads == 0) {
$sql = "INSERT INTO cms_downloads (fileurl, hits) VALUES ('{$fileurl}', '1')";
$inDB->query($sql);
} else {
$sql = "UPDATE cms_downloads SET hits = hits + 1 WHERE fileurl = '{$fileurl}'";
$inDB->query($sql);
}
if (mb_strstr($fileurl, 'http:/')) {
cmsCore::redirect($fileurl);
}
if (file_exists(PATH . $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 (!$url) {
cmsCore::error404();
}
$url = mb_strpos($url, '-') === 0 ? htmlspecialchars_decode(base64_decode(ltrim($url, '-'))) : $url;
if (mb_strstr($url, '..')) {
cmsCore::error404();
}
if (mb_strstr($url, 'http:/')) {
if (!mb_strstr($url, 'http://')) {
$url = str_replace('http:/', 'http://', $url);
}
}
if (mb_strstr($url, 'https:/')) {
if (!mb_strstr($url, 'https://')) {
$url = str_replace('https:/', 'https://', $url);
}
}
// кириллические домены
$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);
}
//============================================================================//
}
示例9: 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(array('icon' => 'new.gif', 'title' => $_LANG['AD_CREATE_CRON_MISSION'], '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 (!cmsUser::checkCsrfToken()) {
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 (!cmsUser::checkCsrfToken()) {
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(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);'));
cpToolMenu($toolmenu);
if ($do == 'edit') {
$mod = cmsCron::getJobById($id);
echo '<h3>' . $_LANG['AD_EDIT_MISSION'] . '</h3>';
cpAddPathway($mod['job_name'], 'index.php?view=cron&do=edit&id=' . $mod['id']);
} else {
echo '<h3>' . $_LANG['AD_CREATE_CRON_MISSION'] . '</h3>';
//.........这里部分代码省略.........
示例10: proceedBody
/**
* Генерирует тело страницы, вызывая нужный компонент
*/
public function proceedBody()
{
ob_start();
//проверяем что компонент указан
if (!$this->component) {
return false;
}
$components = array($this->component);
if ($this->url_without_com_name) {
$components = cmsCore::callEvent('URL_WITHOUT_COM_NAME', $components);
}
foreach ($components as $component) {
$this->component = $component;
// компонент включен?
if (!$this->isComponentEnable($this->component)) {
continue;
}
if ($this->url_without_com_name) {
$this->uri = $this->component . strstr($this->uri, '/');
}
//парсим адрес и заполняем массив $_REQUEST
if (!$this->parseComponentRoute()) {
continue;
}
// узнаем действие в компоненте
$this->detectAction();
self::loadLanguage('components/' . $this->component);
// Вызываем сначала плагин (если он есть) на действие
// Успешность выполнения должна определяться в методе execute плагина
// Он должен вернуть true
if (!cmsCore::callEvent(strtoupper('get_' . $this->component . '_action_' . $this->do), false)) {
self::loadModel($this->component);
self::includeFile('components/' . $this->component . '/frontend.php');
if (function_exists($this->component)) {
// в компонетах вместо error404() лучше использовать return false
if (call_user_func($this->component) === false) {
continue;
}
}
}
if (self::isAjax()) {
cmsCore::halt(cmsCore::callEvent('AFTER_COMPONENT_' . strtoupper($this->component), ob_get_clean()));
}
cmsPage::getInstance()->page_body = cmsCore::callEvent('AFTER_COMPONENT_' . strtoupper($this->component), ob_get_clean());
return true;
}
self::error404();
}
示例11: applet_content
function applet_content() {
$inCore = cmsCore::getInstance();
cmsCore::m('content');
global $_LANG;
//check access
global $adminAccess;
if (!cmsUser::isAdminCan('admin/content', $adminAccess)) { cpAccessDenied(); }
$cfg = $inCore->loadComponentConfig('content');
cmsCore::c('page')->setTitle($_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') {
cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '1');
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 = cmsCore::request('dir', 'str');
$step = 1;
cmsCore::m('content')->moveItem($item_id, $cat_id, $dir, $step);
cmsCore::halt(1);
}
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)cmsCore::c('db')->get_field('cms_content', "category_id = '". $to_cat_id ."' ORDER BY ordering DESC", 'ordering');
foreach ($items as $item_id) {
$article = cmsCore::m('content')->getArticle($item_id);
if (!$article) { continue; }
$last_ordering++;
cmsCore::m('content')->updateArticle(
$article['id'],
array(
'category_id' => $to_cat_id,
'ordering' => $last_ordering,
'url' => $article['url'],
'title' => cmsCore::c('db')->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 (!cmsCore::inRequest('item')) {
if ($id >= 0) { cmsCore::c('db')->setFlag('cms_content', $id, 'published', '1'); }
cmsCore::halt('1');
} else {
cmsCore::c('db')->setFlags('cms_content', cmsCore::request('item', 'array_int'), 'published', '1');
cmsCore::redirectBack();
}
}
if ($do == 'hide') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) { cmsCore::c('db')->setFlag('cms_content', $id, 'published', '0'); }
cmsCore::halt('1');
} else {
cmsCore::c('db')->setFlags('cms_content', cmsCore::request('item', 'array_int'), 'published', '0');
cmsCore::redirectBack();
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::m('content')->deleteArticle($id);
cmsCore::addSessionMessage($_LANG['AD_ARTICLE_REMOVE'], 'success');
}
} else {
cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'));
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_REMOVE'], 'success');
}
cmsCore::redirectBack();
}
if ($do == 'update'){
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
//.........这里部分代码省略.........
示例12:
// объект плагина
$plugin = $inCore->loadPlugin('p_ckeditor');
// разрешена ли загрузка фото
if (!$plugin->canUpload()) {
cmsCore::error404();
}
// Загружаем конфиг плагина
$cfg = $inCore->loadPluginConfig('p_ckeditor');
if (!$cfg) {
cmsCore::error404();
}
global $_LANG;
// Выставляем конфигурационные параметры
$inUploadPhoto->upload_dir = PATH . '/upload/';
$inUploadPhoto->medium_size_w = $cfg['photo_width'];
$inUploadPhoto->medium_size_h = $cfg['photo_height'];
$inUploadPhoto->thumbsqr = false;
$inUploadPhoto->is_watermark = $cfg['iswatermark'];
$inUploadPhoto->only_medium = true;
$inUploadPhoto->dir_medium = 'wysiwyg/';
$inUploadPhoto->input_name = 'upload';
// Процесс загрузки фото
$file = $inUploadPhoto->uploadPhoto();
$http_path = '/upload/wysiwyg/' . $file['filename'];
$error = '';
if (!$file['filename']) {
$error = $_LANG['CK_UPLOAD_ERROR'];
$http_path = '';
}
cmsCore::halt('<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . cmsCore::request('CKEditorFuncNum', 'int', 0) . ', "' . $http_path . '", "' . $error . '" );</script>');
示例13: array
if (!$is_admin && !$is_moder) { cmsCore::halt(); }
$inBlog->publishPost($post_id);
$post['seolink'] = $model->getPostURL($club['id'], $post['seolink']);
if ($club['clubtype'] != 'private' && $post['allow_who'] == 'all') { cmsCore::callEvent('ADD_POST_DONE', $post); }
if ($club['clubtype'] != 'private' && $post['allow_who'] != 'nobody'){
if(!cmsCore::c('db')->get_field('cms_actions_log', "object_id = '". $post['id'] ."' AND object_url = '". $post['seolink'] ."'", 'id')){
cmsActions::log($inBlog->getTarget('actions_post'), array(
'object' => $post['title'],
'user_id' => $post['user_id'],
'object_url' => $post['seolink'],
'object_id' => $post['id'],
'target' => $club['title'],
'target_url' => '/clubs/'.$club['id'],
'target_id' => $club['id'],
'description' => '',
'is_friends_only' => (int)($post['allow_who'] == 'friends')
));
}
}
cmsUser::sendMessage(USER_UPDATER, $post['user_id'], $_LANG['YOUR_POST'].' <b>«<a href="'.$post['seolink'].'">'.$post['title'].'</a>»</b> '.$_LANG['PUBLISHED_IN_BLOG'].' <b>«<a href="'.$model->getBlogURL($club['id']).'">'.$blog['title'].'</a>»</b>');
cmsCore::halt('ok');
}
示例14: applet_plugins
function applet_plugins()
{
global $_LANG;
$inCore = cmsCore::getInstance();
cmsCore::c('page')->setTitle($_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') {
cmsCore::c('db')->setFlag('cms_plugins', $id, 'published', '0');
cmsCore::halt('1');
}
if ($do == 'show') {
cmsCore::c('db')->setFlag('cms_plugins', $id, 'published', '1');
cmsCore::halt('1');
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'install.gif', 'title' => $_LANG['AD_INSTALL_PLUGINS'], 'link' => '?view=install&do=plugin'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=plugins'));
cpToolMenu($toolmenu);
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'link' => '?view=plugins&do=config&id=%id%', 'width' => '250'), array('title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => ''), array('title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '160'), array('title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '80'), array('title' => $_LANG['AD_FOLDER'], 'field' => 'plugin', 'width' => '100'), array('title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '80'));
$actions = array(array('title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=plugins&do=config&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=install&do=remove_plugin&id=%id%', 'confirm' => $_LANG['AD_REMOVE_PLUGIN_FROM']));
cpListTable('cms_plugins', $fields, $actions);
}
if ($do == 'save_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', 0);
$plugin = $inCore->loadPlugin($plugin_name);
$plugin_cfg_fields = $plugin->getConfigFields();
if (empty($plugin_cfg_fields)) {
$config = cmsCore::request('config', 'array_str');
} else {
$config = cmsCore::c('form_gen')->requestForm($plugin->getConfigFields());
}
if (!$config || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $config);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', '');
$xml_file = PATH . '/plugins/' . $plugin_name . '/backend.xml';
if (!file_exists($xml_file)) {
cmsCore::error404();
}
$cfg = array();
$backend = simplexml_load_file($xml_file);
foreach ($backend->params->param as $param) {
$name = (string) $param['name'];
$type = (string) $param['type'];
$default = (string) $param['default'];
switch ($param['type']) {
case 'number':
$value = cmsCore::request($name, 'int', $default);
break;
case 'string':
$value = cmsCore::request($name, 'str', $default);
break;
case 'html':
$value = cmsCore::badTagClear(cmsCore::request($name, 'html', $default));
break;
case 'flag':
$value = cmsCore::request($name, 'int', 0);
break;
case 'list':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
case 'list_function':
$value = cmsCore::request($name, 'str', $default);
break;
case 'list_db':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
}
$cfg[$name] = $value;
}
if (!$cfg || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $cfg);
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);
//.........这里部分代码省略.........
示例15: define
<?php
/******************************************************************************/
// //
// InstantCMS v1.10.5 //
// http://www.instantcms.ru/ //
// //
// written by InstantCMS Team, 2007-2014 //
// produced by InstantSoft, (www.instantsoft.ru) //
// //
// LICENSED BY GNU/GPL v2 //
// //
/******************************************************************************/
define('PATH', $_SERVER['DOCUMENT_ROOT']);
include(PATH .'/core/ajax/ajax_core.php');
cmsCore::loadLanguage('modules/mod_latest');
$module_id = cmsCore::request('module_id', 'int', '');
if (!$module_id) { cmsCore::halt(); }
$cfg = $inCore->loadModuleConfig($module_id);
// номер страницы передаем через конфиг
$cfg['page'] = cmsCore::request('page', 'int', 1);
cmsCore::includeFile('modules/mod_latest/module.php');
mod_latest(array('id' => $module_id), $cfg);