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


PHP Engine\Authentication类代码示例

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


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

示例1: parse

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

示例2: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->imageIsAllowed = $this->get('fork.settings')->get($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', $this->get('fork.settings')->get($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:newaltcoin,项目名称:forkcms,代码行数:33,代码来源:Add.php

示例3: validateForm

 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         $fields = $this->frm->getFields();
         // validate fields
         $fields['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 ? $fields['template']->getValue() : $this->templates[0];
             $item['language'] = BL::getWorkingLanguage();
             $item['title'] = $fields['title']->getValue();
             $item['text'] = $fields['text']->getValue();
             $item['hidden'] = $fields['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:bwgraves,项目名称:forkcms,代码行数:31,代码来源:Add.php

示例4: 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)), $this->get('fork.settings')->get($this->URL->getModule(), 'overview_num_items', 10));
     $this->frm->addDropdown('recent_articles_full_number_of_items', array_combine(range(1, 10), range(1, 10)), $this->get('fork.settings')->get($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)), $this->get('fork.settings')->get($this->URL->getModule(), 'recent_articles_list_num_items', 5));
     // add fields for spam
     $this->frm->addCheckbox('spamfilter', $this->get('fork.settings')->get($this->URL->getModule(), 'spamfilter', false));
     // no Akismet-key, so we can't enable spam-filter
     if ($this->get('fork.settings')->get('Core', 'akismet_key') == '') {
         $this->frm->getField('spamfilter')->setAttribute('disabled', 'disabled');
         $this->tpl->assign('noAkismetKey', true);
     }
     // add fields for comments
     $this->frm->addCheckbox('allow_comments', $this->get('fork.settings')->get($this->URL->getModule(), 'allow_comments', false));
     $this->frm->addCheckbox('moderation', $this->get('fork.settings')->get($this->URL->getModule(), 'moderation', false));
     // add fields for notifications
     $this->frm->addCheckbox('notify_by_email_on_new_comment_to_moderate', $this->get('fork.settings')->get($this->URL->getModule(), 'notify_by_email_on_new_comment_to_moderate', false));
     $this->frm->addCheckbox('notify_by_email_on_new_comment', $this->get('fork.settings')->get($this->URL->getModule(), 'notify_by_email_on_new_comment', false));
     // add fields for SEO
     // @TODO remove this when the api is kicked out
     $this->frm->addCheckbox('ping_services', $this->get('fork.settings')->get($this->URL->getModule(), 'ping_services', false));
     // add fields for RSS
     $this->frm->addCheckbox('rss_meta', $this->get('fork.settings')->get($this->URL->getModule(), 'rss_meta_' . BL::getWorkingLanguage(), true));
     $this->frm->addText('rss_title', $this->get('fork.settings')->get($this->URL->getModule(), 'rss_title_' . BL::getWorkingLanguage()));
     $this->frm->addTextarea('rss_description', $this->get('fork.settings')->get($this->URL->getModule(), 'rss_description_' . BL::getWorkingLanguage()));
     // god user?
     if ($this->isGod) {
         $this->frm->addCheckbox('show_image_form', $this->get('fork.settings')->get($this->URL->getModule(), 'show_image_form', true));
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:36,代码来源:Settings.php

示例5: 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:bwgraves,项目名称:forkcms,代码行数:30,代码来源:Index.php

示例6: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     BackendAuthentication::logout();
     // redirect to login-screen
     $this->redirect(BackendModel::createURLForAction('Index', $this->getModule()));
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:10,代码来源:Logout.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  $columns        The column names you want to use.
  * @param array  $excludeColumns The columns you want to exclude.
  */
 public static function outputCSV($filename, array $array, array $columns = null, array $excludeColumns = null)
 {
     // get settings
     $splitCharacter = Authentication::getUser()->getSetting('csv_split_character');
     $lineEnding = Authentication::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
     $charset = BackendModel::getContainer()->getParameter('kernel.charset');
     $headers[] = 'Content-type: application/csv; charset=' . $charset;
     $headers[] = 'Content-Disposition: attachment; filename="' . $filename . '"';
     $headers[] = 'Content-Length: ' . strlen($csv);
     $headers[] = 'Pragma: no-cache';
     // overwrite the headers
     \SpoonHTTP::setHeaders($headers);
     // output the CSV
     echo $csv;
     exit;
 }
开发者ID:arashrasoulzadeh,项目名称:forkcms,代码行数:34,代码来源:Csv.php

示例8: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->isGod = BackendAuthentication::getUser()->isGod();
     $this->frm = new BackendForm('settingsEmail');
     // email settings
     $mailerFrom = $this->get('fork.settings')->get('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'] : '')->setAttribute('type', 'email');
     $mailerTo = $this->get('fork.settings')->get('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'] : '')->setAttribute('type', 'email');
     $mailerReplyTo = $this->get('fork.settings')->get('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'] : '')->setAttribute('type', 'email');
     if ($this->isGod) {
         $mailerType = $this->get('fork.settings')->get('Core', 'mailer_type', 'mail');
         $this->frm->addDropdown('mailer_type', array('mail' => 'PHP\'s mail', 'smtp' => 'SMTP'), $mailerType);
         // smtp settings
         $this->frm->addText('smtp_server', $this->get('fork.settings')->get('Core', 'smtp_server', ''));
         $this->frm->addText('smtp_port', $this->get('fork.settings')->get('Core', 'smtp_port', 25));
         $this->frm->addText('smtp_username', $this->get('fork.settings')->get('Core', 'smtp_username', ''));
         $this->frm->addPassword('smtp_password', $this->get('fork.settings')->get('Core', 'smtp_password', ''));
         $this->frm->addDropdown('smtp_secure_layer', array('no' => ucfirst(BL::lbl('None')), 'ssl' => 'SSL', 'tls' => 'TLS'), $this->get('fork.settings')->get('Core', 'smtp_secure_layer', 'no'));
     }
     $this->tpl->assign('isGod', $this->isGod);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:29,代码来源:Email.php

示例9: 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:bwgraves,项目名称:forkcms,代码行数:11,代码来源:Statistics.php

示例10: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // get parameters
     $newSequence = \SpoonFilter::getPostValue('new_sequence', null, '');
     // validate
     if ($newSequence == '') {
         $this->output(self::BAD_REQUEST, null, 'no new_sequence provided');
     } else {
         // convert into array
         $json = @json_decode($newSequence, true);
         // validate
         if ($json === false) {
             $this->output(self::BAD_REQUEST, null, 'invalid new_sequence provided');
         } else {
             // initialize
             $userSequence = array();
             $hiddenItems = array();
             // loop columns
             foreach ($json as $column => $widgets) {
                 $columnValue = 'left';
                 if ($column == 1) {
                     $columnValue = 'middle';
                 } elseif ($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:bwgraves,项目名称:forkcms,代码行数:60,代码来源:AlterSequence.php

示例11: loadDataGrid

 /**
  * Load the datagrid
  */
 public function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendGroupsModel::QRY_BROWSE);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
         $this->dataGrid->setColumnURL('num_users', BackendModel::createURLForAction('Edit') . '&amp;id=[id]#tabUsers');
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:13,代码来源:Index.php

示例12: 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:bwgraves,项目名称:forkcms,代码行数:13,代码来源:Index.php

示例13: parse

 /**
  * Parse & display the page
  */
 protected function parse()
 {
     parent::parse();
     $this->tpl->assign('dataGrid', $this->dataGrid->getNumResults() != 0 ? $this->dataGrid->getContent() : false);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('AddCategory') && $this->multipleCategoriesAllowed) {
         $this->tpl->assign('showAgendaAddCategory', true);
     } else {
         $this->tpl->assign('showAgendaAddCategory', false);
     }
 }
开发者ID:Comsa-Veurne,项目名称:modules,代码行数:14,代码来源:Categories.php

示例14: loadDataGrid

 /**
  * Load the dataGrid
  */
 protected function loadDataGrid()
 {
     $this->dataGrid = new DataGridDB(BackendInstagramModel::QRY_DATAGRID_BROWSE, Language::getWorkingLanguage());
     // Reform date
     $this->dataGrid->setColumnFunction(array('Backend\\Core\\Engine\\DataGridFunctions', 'getLongDate'), array('[created_on]'), 'created_on', true);
     // Check if this action is allowed
     if (Authentication::isAllowedAction('Edit')) {
         $this->dataGrid->addColumn('edit', null, Language::lbl('Edit'), Model::createURLForAction('Edit') . '&amp;id=[id]', Language::lbl('Edit'));
         $this->dataGrid->setColumnURL('username', Model::createURLForAction('Edit') . '&amp;id=[id]');
     }
 }
开发者ID:jeroendesloovere,项目名称:fork-cms-module-instagram,代码行数:14,代码来源:Index.php

示例15: CheckAuthentication

/**
 * This function must check the user session to be sure that he/she is
 * authorized to upload and access files in the File Browser.
 *
 * @return boolean
 */
function CheckAuthentication()
{
    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...
    // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
    // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
    // user logs in your system. To be able to use session variables don't
    // forget to add session_start() at the top of this file.
    return BackendAuthentication::isLoggedIn();
}
开发者ID:forkcms,项目名称:forkcms,代码行数:17,代码来源:config.php


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