• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Engine\Authentication类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $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(), null, 'string');
     $name = \SpoonFilter::getPostValue('name', null, null, 'string');
     $type = \SpoonFilter::getPostValue('type', BackendModel::getContainer()->get('database')->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 (urlencode($value) != CommonUri::getUrl($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:newaltcoin,项目名称:forkcms,代码行数:57,代码来源:SaveTranslation.php


示例17: loadDataGrid

 /**
  * Load the dataGrid
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_BRANDS, array(BL::getWorkingLanguage()));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditBrand')) {
         $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_brand') . '&amp;id=[id]');
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_brand') . '&amp;id=[id]', BL::lbl('Edit'));
     }
     // sequence
     $this->dataGrid->enableSequenceByDragAndDrop();
     $this->dataGrid->setAttributes(array('data-action' => 'SequenceBrands'));
 }
开发者ID:Comsa-Veurne,项目名称:modules,代码行数:15,代码来源:Brands.php


示例18: loadDataGrid

 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new BackendDataGridDB(BackendExtensionsModel::QRY_BROWSE_TEMPLATES, array($this->selectedTheme));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditThemeTemplate')) {
         // set colum URLs
         $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('EditThemeTemplate') . '&amp;id=[id]');
         // add edit column
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('EditThemeTemplate') . '&amp;id=[id]', BL::lbl('Edit'));
     }
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:15,代码来源:ThemeTemplates.php


示例19: copy

 /**
  * Copy content blocks
  *
  * @param string $from The language code to copy the content blocks from.
  * @param string $to The language code we want to copy the content blocks to.
  *
  * @return array
  *
  * @deprecated use the CopyContentBlocksToOtherLocale command
  */
 public static function copy($from, $to)
 {
     trigger_error('Backend\\Modules\\ContentBlocks\\Engine::copy is deprecated.
          Switch the CopyContentBlocksToOtherLocale command instead.', E_USER_DEPRECATED);
     // get db
     $db = BackendModel::getContainer()->get('database');
     // init variables
     $contentBlockIds = $oldIds = $newIds = array();
     // copy the contentblocks
     $contentBlocks = (array) $db->getRecords('SELECT * FROM content_blocks WHERE language = ? AND status = "active"', array($from));
     // define counter
     $i = 1;
     // loop existing content blocks
     foreach ($contentBlocks as $contentBlock) {
         // define old id
         $oldId = $contentBlock['extra_id'];
         // init new block
         $newBlock = array();
         // build new block
         $newBlock['id'] = self::getMaximumId() + $i;
         $newBlock['language'] = $to;
         $newBlock['created_on'] = BackendModel::getUTCDate();
         $newBlock['edited_on'] = BackendModel::getUTCDate();
         $newBlock['status'] = $contentBlock['status'];
         $newBlock['user_id'] = BackendAuthentication::getUser()->getUserId();
         $newBlock['template'] = $contentBlock['template'];
         $newBlock['title'] = $contentBlock['title'];
         $newBlock['text'] = $contentBlock['text'];
         $newBlock['hidden'] = $contentBlock['hidden'];
         // inset content block
         $newId = self::insert($newBlock);
         // save ids for later
         $oldIds[] = $oldId;
         $newIds[$oldId] = $newId;
         // redefine counter
         ++$i;
     }
     // get the extra Ids for the content blocks
     if (!empty($newIds)) {
         // get content block extra ids
         $contentBlockExtraIds = (array) $db->getRecords('SELECT revision_id, extra_id FROM content_blocks WHERE revision_id IN (' . implode(',', $newIds) . ')');
         // loop new ids
         foreach ($newIds as $oldId => $newId) {
             foreach ($contentBlockExtraIds as $extraId) {
                 if ($extraId['revision_id'] == $newId) {
                     $contentBlockIds[$oldId] = $extraId['extra_id'];
                 }
             }
         }
     }
     // return contentBlockIds
     return $contentBlockIds;
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:63,代码来源:Model.php


示例20: 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'));
     $url = BackendModel::getURLForBlock($this->URL->getModule(), 'Category');
     $url404 = BackendModel::getURL(404);
     if ($url404 != $url) {
         $this->tpl->assign('detailURL', SITE_URL . $url);
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:15,代码来源:EditCategory.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Engine\Language类代码示例发布时间:2022-05-23
下一篇:
PHP Classes\WidgetBase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap