当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendAuthentication类代码示例

本文整理汇总了PHP中BackendAuthentication的典型用法代码示例。如果您正苦于以下问题:PHP BackendAuthentication类的具体用法?PHP BackendAuthentication怎么用?PHP BackendAuthentication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BackendAuthentication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadDatagrids

 /**
  * Loads the dataGrids
  */
 private function loadDatagrids()
 {
     // load all categories
     $categories = BackendFaqModel::getCategories(true);
     // loop categories and create a dataGrid for each one
     foreach ($categories as $categoryId => $categoryTitle) {
         $dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
         $dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop'));
         $dataGrid->setColumnsHidden(array('category_id', 'sequence'));
         $dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>');
         $dataGrid->setColumnsSequence('dragAndDropHandle');
         $dataGrid->setColumnAttributes('question', array('class' => 'title'));
         $dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle'));
         $dataGrid->setRowAttributes(array('id' => '[id]'));
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('edit')) {
             $dataGrid->setColumnURL('question', BackendModel::createURLForAction('edit') . '&amp;id=[id]');
             $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&amp;id=[id]', BL::lbl('Edit'));
         }
         // add dataGrid to list
         $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
     }
     // set empty datagrid
     $this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => '')));
     $this->emptyDatagrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop emptyGrid'));
     $this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:30,代码来源:index.php

示例2: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     BackendAuthentication::logout();
     // redirect to login-screen
     $this->redirect(BackendModel::createUrlForAction('index', $this->getModule()));
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:10,代码来源:logout.php

示例3: validateForm

 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validate fields
         $this->frm->getField('title')->isFilled(BL::err('QuestionIsRequired'));
         $this->frm->getField('answer')->isFilled(BL::err('AnswerIsRequired'));
         $this->frm->getField('category_id')->isFilled(BL::err('CategoryIsRequired'));
         $this->meta->validate();
         if ($this->frm->isCorrect()) {
             // build item
             $item['meta_id'] = $this->meta->save();
             $item['category_id'] = $this->frm->getField('category_id')->getValue();
             $item['user_id'] = BackendAuthentication::getUser()->getUserId();
             $item['language'] = BL::getWorkingLanguage();
             $item['question'] = $this->frm->getField('title')->getValue();
             $item['answer'] = $this->frm->getField('answer')->getValue(true);
             $item['created_on'] = BackendModel::getUTCDate();
             $item['hidden'] = $this->frm->getField('hidden')->getValue();
             $item['sequence'] = BackendFaqModel::getMaximumSequence($this->frm->getField('category_id')->getValue()) + 1;
             // save the data
             $item['id'] = BackendFaqModel::insert($item);
             BackendTagsModel::saveTags($item['id'], $this->frm->getField('tags')->getValue(), $this->URL->getModule());
             BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item));
             // add search index
             BackendSearchModel::saveIndex('faq', $item['id'], array('title' => $item['question'], 'text' => $item['answer']));
             $this->redirect(BackendModel::createURLForAction('index') . '&report=added&var=' . urlencode($item['question']) . '&highlight=row-' . $item['id']);
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:33,代码来源:add.php

示例4: parse

 /**
  * Parse the form
  */
 protected function parse()
 {
     parent::parse();
     // assign the data
     $this->tpl->assign('item', $this->record);
     $this->tpl->assign('showDeleteCategory', BackendFaqModel::deleteCategoryAllowed($this->id) && BackendAuthentication::isAllowedAction('delete_category'));
 }
开发者ID:richsage,项目名称:forkcms,代码行数:10,代码来源:edit_category.php

示例5: loadForm

 /**
  * Loads the settings form
  */
 private function loadForm()
 {
     $this->isGod = BackendAuthentication::getUser()->isGod();
     $this->frm = new BackendForm('settings');
     // add fields for pagination
     $this->frm->addDropdown('overview_number_of_items', array_combine(range(1, 30), range(1, 30)), BackendModel::getModuleSetting($this->URL->getModule(), 'overview_num_items', 10));
     $this->frm->addDropdown('recent_articles_full_number_of_items', array_combine(range(1, 10), range(1, 10)), BackendModel::getModuleSetting($this->URL->getModule(), 'recent_articles_full_num_items', 5));
     $this->frm->addDropdown('recent_articles_list_number_of_items', array_combine(range(1, 10), range(1, 10)), BackendModel::getModuleSetting($this->URL->getModule(), 'recent_articles_list_num_items', 5));
     // add fields for spam
     $this->frm->addCheckbox('spamfilter', BackendModel::getModuleSetting($this->URL->getModule(), 'spamfilter', false));
     // no Akismet-key, so we can't enable spam-filter
     if (BackendModel::getModuleSetting('core', 'akismet_key') == '') {
         $this->frm->getField('spamfilter')->setAttribute('disabled', 'disabled');
         $this->tpl->assign('noAkismetKey', true);
     }
     // add fields for comments
     $this->frm->addCheckbox('allow_comments', BackendModel::getModuleSetting($this->URL->getModule(), 'allow_comments', false));
     $this->frm->addCheckbox('moderation', BackendModel::getModuleSetting($this->URL->getModule(), 'moderation', false));
     // add fields for notifications
     $this->frm->addCheckbox('notify_by_email_on_new_comment_to_moderate', BackendModel::getModuleSetting($this->URL->getModule(), 'notify_by_email_on_new_comment_to_moderate', false));
     $this->frm->addCheckbox('notify_by_email_on_new_comment', BackendModel::getModuleSetting($this->URL->getModule(), 'notify_by_email_on_new_comment', false));
     // add fields for SEO
     $this->frm->addCheckbox('ping_services', BackendModel::getModuleSetting($this->URL->getModule(), 'ping_services', false));
     // add fields for RSS
     $this->frm->addCheckbox('rss_meta', BackendModel::getModuleSetting($this->URL->getModule(), 'rss_meta_' . BL::getWorkingLanguage(), true));
     $this->frm->addText('rss_title', BackendModel::getModuleSetting($this->URL->getModule(), 'rss_title_' . BL::getWorkingLanguage()));
     $this->frm->addTextarea('rss_description', BackendModel::getModuleSetting($this->URL->getModule(), 'rss_description_' . BL::getWorkingLanguage()));
     $this->frm->addText('feedburner_url', BackendModel::getModuleSetting($this->URL->getModule(), 'feedburner_url_' . BL::getWorkingLanguage()));
     // god user?
     if ($this->isGod) {
         $this->frm->addCheckbox('show_image_form', BackendModel::getModuleSetting($this->URL->getModule(), 'show_image_form', true));
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:36,代码来源:settings.php

示例6: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->imageIsAllowed = BackendModel::getModuleSetting($this->URL->getModule(), 'show_image_form', true);
     $this->frm = new BackendForm('add');
     // set hidden values
     $rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y');
     $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
     // get categories
     $categories = BackendBlogModel::getCategories();
     $categories['new_category'] = SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
     // create elements
     $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title');
     $this->frm->addEditor('text');
     $this->frm->addEditor('introduction');
     $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
     $this->frm->addCheckbox('allow_comments', BackendModel::getModuleSetting($this->getModule(), 'allow_comments', false));
     $this->frm->addDropdown('category_id', $categories, SpoonFilter::getGetValue('category', null, null, 'int'));
     if (count($categories) != 2) {
         $this->frm->getField('category_id')->setDefaultElement('');
     }
     $this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), BackendAuthentication::getUser()->getUserId());
     $this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox');
     $this->frm->addDate('publish_on_date');
     $this->frm->addTime('publish_on_time');
     if ($this->imageIsAllowed) {
         $this->frm->addImage('image');
     }
     // meta
     $this->meta = new BackendMeta($this->frm, null, 'title', true);
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:33,代码来源:add.php

示例7: outputCSV

 /**
  * Output a CSV-file as a download
  *
  * @param string $filename					The name of the file.
  * @param array $array						The array to convert.
  * @param array[optional] $columns			The column names you want to use.
  * @param array[optional] $excludeColumns	The columns you want to exclude.
  */
 public static function outputCSV($filename, array $array, array $columns = null, array $excludeColumns = null)
 {
     // get settings
     $splitCharacter = BackendAuthentication::getUser()->getSetting('csv_split_character');
     $lineEnding = BackendAuthentication::getUser()->getSetting('csv_line_ending');
     // reformat
     if ($lineEnding == '\\n') {
         $lineEnding = "\n";
     }
     if ($lineEnding == '\\r\\n') {
         $lineEnding = "\r\n";
     }
     // convert into CSV
     $csv = SpoonFileCSV::arrayToString($array, $columns, $excludeColumns, $splitCharacter, '"', $lineEnding);
     // set headers for download
     $headers[] = 'Content-type: application/csv; charset=' . SPOON_CHARSET;
     $headers[] = 'Content-Disposition: attachment; filename="' . $filename;
     $headers[] = 'Content-Length: ' . strlen($csv);
     $headers[] = 'Pragma: no-cache';
     // overwrite the headers
     SpoonHTTP::setHeaders($headers);
     // ouput the CSV
     echo $csv;
     exit;
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:33,代码来源:csv.php

示例8: validateForm

 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validate fields
         $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
         if ($this->frm->isCorrect()) {
             // build item
             $item['id'] = BackendContentBlocksModel::getMaximumId() + 1;
             $item['user_id'] = BackendAuthentication::getUser()->getUserId();
             $item['template'] = count($this->templates) > 1 ? $this->frm->getField('template')->getValue() : $this->templates[0];
             $item['language'] = BL::getWorkingLanguage();
             $item['title'] = $this->frm->getField('title')->getValue();
             $item['text'] = $this->frm->getField('text')->getValue();
             $item['hidden'] = $this->frm->getField('hidden')->getValue() ? 'N' : 'Y';
             $item['status'] = 'active';
             $item['created_on'] = BackendModel::getUTCDate();
             $item['edited_on'] = BackendModel::getUTCDate();
             // insert the item
             $item['revision_id'] = BackendContentBlocksModel::insert($item);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('index') . '&report=added&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']);
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:30,代码来源:add.php

示例9: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->isGod = BackendAuthentication::getUser()->isGod();
     $this->frm = new BackendForm('settingsEmail');
     // email settings
     $mailerFrom = BackendModel::getModuleSetting('core', 'mailer_from');
     $this->frm->addText('mailer_from_name', isset($mailerFrom['name']) ? $mailerFrom['name'] : '');
     $this->frm->addText('mailer_from_email', isset($mailerFrom['email']) ? $mailerFrom['email'] : '');
     $mailerTo = BackendModel::getModuleSetting('core', 'mailer_to');
     $this->frm->addText('mailer_to_name', isset($mailerTo['name']) ? $mailerTo['name'] : '');
     $this->frm->addText('mailer_to_email', isset($mailerTo['email']) ? $mailerTo['email'] : '');
     $mailerReplyTo = BackendModel::getModuleSetting('core', 'mailer_reply_to');
     $this->frm->addText('mailer_reply_to_name', isset($mailerReplyTo['name']) ? $mailerReplyTo['name'] : '');
     $this->frm->addText('mailer_reply_to_email', isset($mailerReplyTo['email']) ? $mailerReplyTo['email'] : '');
     if ($this->isGod) {
         $mailerType = BackendModel::getModuleSetting('core', 'mailer_type', 'mail');
         $this->frm->addDropdown('mailer_type', array('mail' => 'PHP\'s mail', 'smtp' => 'SMTP'), $mailerType);
         // smtp settings
         $this->frm->addText('smtp_server', BackendModel::getModuleSetting('core', 'smtp_server', ''));
         $this->frm->addText('smtp_port', BackendModel::getModuleSetting('core', 'smtp_port', 25));
         $this->frm->addText('smtp_username', BackendModel::getModuleSetting('core', 'smtp_username', ''));
         $this->frm->addPassword('smtp_password', BackendModel::getModuleSetting('core', 'smtp_password', ''));
     }
     $this->tpl->assign('isGod', $this->isGod);
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:28,代码来源:email.php

示例10: parse

 /**
  * Parse into template
  */
 private function parse()
 {
     // get the logged in user
     $authenticatedUser = BackendAuthentication::getUser();
     // check if we need to show the password strength and parse the label
     $this->tpl->assign('showPasswordStrength', $authenticatedUser->getSetting('password_strength') !== 'strong');
     $this->tpl->assign('passwordStrengthLabel', BL::lbl($authenticatedUser->getSetting('password_strength')));
 }
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:11,代码来源:statistics.php

示例11: execute

 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // log out the current user
     BackendAuthentication::logout();
     // redirect to login-screen
     $this->redirect(BackendModel::createUrlForAction('index', $this->getModule()));
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:14,代码来源:logout.php

示例12: execute

 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // get parameters
     $newSequence = SpoonFilter::getPostValue('new_sequence', null, '');
     // validate
     if ($newSequence == '') {
         $this->output(self::BAD_REQUEST, null, 'no new_sequence provided');
     }
     // convert into array
     $json = @json_decode($newSequence, true);
     // validate
     if ($json === false) {
         $this->output(self::BAD_REQUEST, null, 'invalid new_sequence provided');
     }
     // initialize
     $userSequence = array();
     $hiddenItems = array();
     // loop columns
     foreach ($json as $column => $widgets) {
         $columnValue = 'left';
         if ($column == 1) {
             $columnValue = 'middle';
         }
         if ($column == 2) {
             $columnValue = 'right';
         }
         // loop widgets
         foreach ($widgets as $sequence => $widget) {
             // store position
             $userSequence[$widget['module']][$widget['widget']] = array('column' => $columnValue, 'position' => $sequence, 'hidden' => $widget['hidden'], 'present' => $widget['present']);
             // add to array
             if ($widget['hidden']) {
                 $hiddenItems[] = $widget['module'] . '_' . $widget['widget'];
             }
         }
     }
     // get previous setting
     $currentSetting = BackendAuthentication::getUser()->getSetting('dashboard_sequence');
     $data['reload'] = false;
     // any settings?
     if ($currentSetting !== null) {
         // loop modules
         foreach ($currentSetting as $module => $widgets) {
             foreach ($widgets as $widget => $values) {
                 if ($values['hidden'] && isset($userSequence[$module][$widget]['hidden']) && !$userSequence[$module][$widget]['hidden']) {
                     $data['reload'] = true;
                 }
             }
         }
     }
     // store
     BackendAuthentication::getUser()->setSetting('dashboard_sequence', $userSequence);
     // output
     $this->output(self::OK, $data, BL::msg('Saved'));
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:62,代码来源:alter_sequence.php

示例13: execute

 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // user is god?
     $isGod = BackendAuthentication::getUser()->isGod();
     // get possible languages
     if ($isGod) {
         $possibleLanguages = array_unique(array_merge(BL::getWorkingLanguages(), BL::getInterfaceLanguages()));
     } else {
         $possibleLanguages = BL::getWorkingLanguages();
     }
     // get parameters
     $language = SpoonFilter::getPostValue('language', array_keys($possibleLanguages), null, 'string');
     $module = SpoonFilter::getPostValue('module', BackendModel::getModules(false), null, 'string');
     $name = SpoonFilter::getPostValue('name', null, null, 'string');
     $type = SpoonFilter::getPostValue('type', BackendModel::getDB()->getEnumValues('locale', 'type'), null, 'string');
     $application = SpoonFilter::getPostValue('application', array('backend', 'frontend'), null, 'string');
     $value = SpoonFilter::getPostValue('value', null, null, 'string');
     // validate values
     if (trim($value) == '' || $language == '' || $module == '' || $type == '' || $application == '' || $application == 'frontend' && $module != 'core') {
         $error = BL::err('InvalidValue');
     }
     // in case this is a 'act' type, there are special rules concerning possible values
     if ($type == 'act' && !isset($error)) {
         if (!SpoonFilter::isValidAgainstRegexp('|^([a-z0-9\\-\\_])+$|', $value)) {
             $error = BL::err('InvalidActionValue', $this->getModule());
         }
     }
     // no error?
     if (!isset($error)) {
         // build item
         $item['language'] = $language;
         $item['module'] = $module;
         $item['name'] = $name;
         $item['type'] = $type;
         $item['application'] = $application;
         $item['value'] = $value;
         $item['edited_on'] = BackendModel::getUTCDate();
         $item['user_id'] = BackendAuthentication::getUser()->getUserId();
         // does the translation exist?
         if (BackendLocaleModel::existsByName($name, $type, $module, $language, $application)) {
             // add the id to the item
             $item['id'] = (int) BackendLocaleModel::getByName($name, $type, $module, $language, $application);
             // update in db
             BackendLocaleModel::update($item);
         } else {
             // insert in db
             BackendLocaleModel::insert($item);
         }
         // output OK
         $this->output(self::OK);
     } else {
         $this->output(self::ERROR, null, $error);
     }
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:61,代码来源:save_translation.php

示例14: loadDataGrid

 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendContentBlocksModel::QRY_BROWSE, array('active', BL::getWorkingLanguage()));
     $this->dataGrid->setSortingColumns(array('title'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('edit')) {
         $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit') . '&amp;id=[id]');
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&amp;id=[id]', BL::lbl('Edit'));
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:13,代码来源:index.php

示例15: parse

 /**
  * Parse into template
  */
 private function parse()
 {
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('settings', 'analytics')) {
         // parse redirect link
         $this->tpl->assign('settingsUrl', BackendModel::createURLForAction('settings', 'analytics'));
     }
     $this->parseKeywords();
     $this->parseReferrers();
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:13,代码来源:traffic_sources.php


注:本文中的BackendAuthentication类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。