public function before($action_name) { if (!cmsUser::isAdmin()) { cmsCore::error404(); } parent::before($action_name); $template = cmsTemplate::getInstance(); $template->setLayout('admin'); $template->setMenuItems('cp_main', $this->getAdminMenu()); }
public function before($action_name) { if (!cmsUser::isAdmin()) { cmsCore::error404(); } if (!$this->isAllowByIp()) { cmsCore::error404(); } parent::before($action_name); $this->cms_template->setLayout('admin'); $this->cms_template->setMenuItems('cp_main', $this->getAdminMenu()); }
public function run() { if (!$this->request->isAjax()) { cmsCore::error404(); } if (!cmsUser::isAdmin()) { cmsCore::error404(); } $ctype_id = $this->request->get('value', 0); if (!$ctype_id) { cmsCore::error404(); } $datasets = $this->model->getContentDatasets($ctype_id); $list = array(); if ($datasets) { $list = array('0' => '') + array_collection_to_list($datasets, 'id', 'title'); } cmsTemplate::getInstance()->renderJSON($list); }
public function run() { if (!$this->request->isAjax()) { cmsCore::error404(); } if (!cmsUser::isAdmin()) { cmsCore::error404(); } $ctype_id = $this->request->get('value', 0); if (!$ctype_id) { cmsCore::error404(); } $ctype = $this->model->getContentType($ctype_id); if (!$ctype) { cmsCore::error404(); } $fields = $this->model->getContentFields($ctype['name']); $list = array(); if ($fields) { $list = array('' => '') + array_collection_to_list($fields, 'name', 'title'); } cmsTemplate::getInstance()->renderJSON($list); }
<?php $user = cmsUser::getInstance(); $list_header = empty($ctype['labels']['profile']) ? $ctype['title'] : $ctype['labels']['profile']; $this->setPageTitle($list_header, $profile['nickname']); $this->addBreadcrumb(LANG_USERS, href_to('users')); $this->addBreadcrumb($profile['nickname'], href_to('users', $profile['id'])); $this->addBreadcrumb($list_header); if (cmsUser::isAllowed($ctype['name'], 'add')) { $this->addToolButton(array('class' => 'add', 'title' => sprintf(LANG_CONTENT_ADD_ITEM, $ctype['labels']['create']), 'href' => href_to($ctype['name'], 'add'))); } if ($folder_id && ($user->id == $profile['id'] || $user->is_admin)) { $this->addToolButton(array('class' => 'folder_edit', 'title' => LANG_EDIT_FOLDER, 'href' => href_to($ctype['name'], 'editfolder', $folder_id))); $this->addToolButton(array('class' => 'folder_delete', 'title' => LANG_DELETE_FOLDER, 'href' => href_to($ctype['name'], 'delfolder', $folder_id), 'onclick' => "if(!confirm('" . LANG_DELETE_FOLDER_CONFIRM . "')){ return false; }")); } if (cmsUser::isAdmin()) { $this->addToolButton(array('class' => 'page_gear', 'title' => sprintf(LANG_CONTENT_TYPE_SETTINGS, mb_strtolower($ctype['title'])), 'href' => href_to('admin', 'ctypes', array('edit', $ctype['id'])))); } $rss_query = "?user={$profile['id']}"; ?> <h1 id="user_profile_title"> <?php if (!empty($ctype['options']['is_rss']) && $this->controller->isControllerEnabled('rss')) { ?> <div class="content_list_rss_icon"> <a href="<?php echo href_to('rss', 'feed', $ctype['name']) . $rss_query; ?> ">RSS</a>
public function run() { if (cmsUser::isLogged() && !cmsUser::isAdmin()) { $this->redirectToHome(); } $users_model = cmsCore::getModel('users'); $form = $this->getForm('registration'); // // Добавляем поле для кода приглашения, // если регистрация доступна только по приглашениям // if ($this->options['is_reg_invites']) { $fieldset_id = $form->addFieldsetToBeginning(LANG_REG_INVITED_ONLY); $form->addField($fieldset_id, new fieldString('inv', array('title' => LANG_REG_INVITE_CODE, 'rules' => array(array('required'), array('min_length', 10), array('max_length', 10))))); } // // Добавляем поле выбора группы, // при наличии публичных групп // $public_groups = $users_model->getPublicGroups(); if ($public_groups) { $pb_items = array(); foreach ($public_groups as $pb) { $pb_items[$pb['id']] = $pb['title']; } $form->addFieldToBeginning('basic', new fieldList('group_id', array('title' => LANG_USER_GROUP, 'items' => $pb_items))); } // // Добавляем в форму обязательные поля профилей // $content_model = cmsCore::getModel('content'); $content_model->setTablePrefix(''); $content_model->orderBy('ordering'); $fields = $content_model->getRequiredContentFields('users'); // Разбиваем поля по группам $fieldsets = cmsForm::mapFieldsToFieldsets($fields); // Добавляем поля в форму foreach ($fieldsets as $fieldset) { $fieldset_id = $form->addFieldset($fieldset['title']); foreach ($fieldset['fields'] as $field) { if ($field['is_system']) { continue; } $form->addField($fieldset_id, $field['handler']); } } $user = array(); if ($this->request->hasInQuery('inv')) { $user['inv'] = $this->request->get('inv'); } $is_submitted = $this->request->has('submit'); if ($is_submitted) { if (!$this->options['is_reg_enabled']) { cmsCore::error404(); } $errors = false; $is_captcha_valid = true; // // Проверяем капчу // if ($this->options['reg_captcha']) { $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request); if (!$is_captcha_valid) { $errors = true; cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error'); } } // // Парсим и валидируем форму // if (!$errors) { $user = $form->parse($this->request, $is_submitted); $user['groups'] = array(); if (!empty($this->options['def_groups'])) { $user['groups'] = $this->options['def_groups']; } if (isset($user['group_id'])) { if (!in_array($user['group_id'], $user['groups'])) { $user['groups'][] = $user['group_id']; } } // // убираем поля которые не относятся к выбранной пользователем группе // foreach ($fieldsets as $fieldset) { foreach ($fieldset['fields'] as $field) { if (!$field['groups_edit']) { continue; } if (in_array(0, $field['groups_edit'])) { continue; } if (!in_array($user['group_id'], $field['groups_edit'])) { $form->disableField($field['name']); unset($user[$field['name']]); } } } $errors = $form->validate($this, $user); } if (!$errors) { // // проверяем код приглашения // if ($this->options['is_reg_invites']) { $invite = $this->model->getInviteByCode($user['inv']); if (!$invite) { $errors['inv'] = LANG_REG_WRONG_INVITE_CODE; } else { if ($this->options['is_invites_strict'] && $invite['email'] != $user['email']) { $errors['inv'] = LANG_REG_WRONG_INVITE_CODE_EMAIL; } else { $user['inviter_id'] = $invite['user_id']; } } } // // проверяем допустимость e-mail, имени и IP // if (!$this->isEmailAllowed($user['email'])) { $errors['email'] = sprintf(LANG_AUTH_RESTRICTED_EMAIL, $user['email']); } if (!$this->isNameAllowed($user['nickname'])) { $errors['nickname'] = sprintf(LANG_AUTH_RESTRICTED_NAME, $user['nickname']); } if (!$this->isIPAllowed(cmsUser::get('ip'))) { cmsUser::addSessionMessage(sprintf(LANG_AUTH_RESTRICTED_IP, cmsUser::get('ip')), 'error'); $errors = true; } } if (!$errors) { unset($user['inv']); // // Блокируем пользователя, если включена верификация e-mail // if ($this->options['verify_email']) { $user = array_merge($user, array('is_locked' => true, 'lock_reason' => LANG_REG_CFG_VERIFY_LOCK_REASON, 'pass_token' => string_random(32, $user['email']), 'date_token' => '')); } $result = $users_model->addUser($user); if ($result['success']) { $user['id'] = $result['id']; cmsUser::addSessionMessage(LANG_REG_SUCCESS, 'success'); // отправляем письмо верификации e-mail if ($this->options['verify_email']) { $messenger = cmsCore::getController('messages'); $to = array('email' => $user['email'], 'name' => $user['nickname']); $letter = array('name' => 'reg_verify'); $messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'verify', $user['pass_token']), 'valid_until' => html_date(date('d.m.Y H:i', time() + $this->options['verify_exp'] * 3600), true))); cmsUser::addSessionMessage(sprintf(LANG_REG_SUCCESS_NEED_VERIFY, $user['email']), 'info'); } else { cmsEventsManager::hook('user_registered', $user); } $back_url = cmsUser::sessionGet('auth_back_url') ? cmsUser::sessionGet('auth_back_url', true) : false; if ($back_url) { $this->redirect($back_url); } else { $this->redirectToHome(); } } else { $errors = $result['errors']; } } if ($errors && $is_captcha_valid) { cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error'); } } // Капча if ($this->options['reg_captcha']) { $captcha_html = cmsEventsManager::hook('captcha_html'); } return cmsTemplate::getInstance()->render('registration', array('user' => $user, 'form' => $form, 'captcha_html' => isset($captcha_html) ? $captcha_html : false, 'errors' => isset($errors) ? $errors : false)); }
echo $this->options['owner_year'] ? $this->options['owner_year'] : date('Y'); ?> </li> <li id="info"> <span class="item"> <?php echo LANG_POWERED_BY_INSTANTCMS; ?> </span> <span class="item"> <?php echo LANG_ICONS_BY_FATCOW; ?> </span> <?php if ($config->debug && cmsUser::isAdmin()) { ?> <span class="item"> SQL: <a href="#sql_debug" class="ajax-modal"><?php echo $core->db->query_count; ?> </a> </span> <?php if ($config->cache_enabled) { ?> <span class="item"> Cache: <?php echo cmsCache::getInstance()->query_count; ?> </span>
// http://instantcms.ru/ // // produced by InstantSoft, instantsoft.ru // // LICENSED BY GNU/GPL v2 // // // /******************************************************************************/ session_start(); define('VALID_RUN', true); // Устанавливаем кодировку header('Content-type:text/html; charset=utf-8'); header('X-Powered-By: InstantCMS'); require_once 'bootstrap.php'; if (cmsConfig::get('emulate_lag')) { usleep(350000); } // Инициализируем шаблонизатор $template = cmsTemplate::getInstance(); if (href_to('auth', 'login') != $_SERVER['REQUEST_URI']) { if (!cmsConfig::get('is_site_on') && !cmsUser::isAdmin()) { cmsCore::errorMaintenance(); } } cmsEventsManager::hook('engine_start'); //Запускаем роутинг и контроллер $core->route($_SERVER['REQUEST_URI']); $core->runController(); $core->runWidgets(); //Выводим готовую страницу $template->renderPage(); cmsEventsManager::hook('engine_stop'); // Останавливаем кеш cmsCache::getInstance()->stop();
// produced by InstantSoft, instantsoft.ru // // LICENSED BY GNU/GPL v2 // // // /******************************************************************************/ session_start(); define('VALID_RUN', true); // Устанавливаем кодировку header('Content-type:text/html; charset=utf-8'); header('X-Powered-By: InstantCMS 2'); require_once 'bootstrap.php'; if ($config->emulate_lag) { usleep(350000); } //Запускаем роутинг $core->route($_SERVER['REQUEST_URI']); // Инициализируем шаблонизатор $template = cmsTemplate::getInstance(); if (href_to('auth', 'login') != $_SERVER['REQUEST_URI']) { if (!$config->is_site_on && !cmsUser::isAdmin()) { cmsCore::errorMaintenance(); } } cmsEventsManager::hook('engine_start'); //Запускаем контроллер $core->runController(); $core->runWidgets(); //Выводим готовую страницу $template->renderPage(); cmsEventsManager::hook('engine_stop'); // Останавливаем кеш cmsCache::getInstance()->stop();
public function run() { if (!$this->request->isAjax()) { cmsCore::error404(); } if (!cmsUser::isAdmin()) { cmsCore::error404(); } $ctype_id = $this->request->get('value'); if (!$ctype_id) { cmsCore::error404(); } $ctype = $this->model->getContentType($ctype_id); if (!$ctype) { cmsCore::error404(); } $cats = $this->model->getCategoriesTree($ctype['name']); $cats_list = array(); if ($cats) { foreach ($cats as $cat) { if ($cat['ns_level'] > 1) { $cat['title'] = str_repeat('-', $cat['ns_level']) . ' ' . $cat['title']; } $cats_list[$cat['id']] = $cat['title']; } } cmsTemplate::getInstance()->renderJSON($cats_list); }