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


PHP input::demo方法代码示例

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


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

示例1: _saveMetaTags

 protected function _saveMetaTags($plugin, $tags)
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     $rules = array();
     foreach ($tags as $keyword => $group) {
         foreach (config::item('languages', 'core', 'keywords') as $language) {
             $rules[$keyword . '_title_' . $language] = $rules[$keyword . '_description_' . $language] = $rules[$keyword . '_keywords_' . $language] = array('label' => '', 'rules' => array('is_string', 'trim', 'max_length' => 255));
         }
     }
     validate::setRules($rules);
     if (!validate::run()) {
         return false;
     }
     foreach ($tags as $keyword => $group) {
         $data = array();
         foreach (config::item('languages', 'core', 'keywords') as $language) {
             $data['meta_title_' . $language] = input::post($keyword . '_title_' . $language);
             $data['meta_description_' . $language] = input::post($keyword . '_description_' . $language);
             $data['meta_keywords_' . $language] = input::post($keyword . '_keywords_' . $language);
         }
         $this->metatags_model->saveMetaTags($plugin, $keyword, $data);
     }
     view::setInfo(__('meta_tags_saved', 'system_metatags'));
     router::redirect('cp/system/metatags/edit/' . $plugin);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:28,代码来源:metatags.php

示例2: _sendFeedback

 protected function _sendFeedback()
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     // Extra rules
     $rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000)));
     if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) {
         $rules['captcha'] = array('rules' => array('is_captcha'));
     }
     validate::setRules($rules);
     // Validate form values
     if (!validate::run($rules)) {
         return false;
     }
     // Get values
     $email = input::post('email');
     $subject = input::post('subject');
     $message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress();
     // Send feedback
     if (!$this->feedback_model->sendFeedback($email, $subject, $message)) {
         if (!validate::getTotalErrors()) {
             view::setError(__('send_error', 'system'));
         }
         return false;
     }
     // Success
     view::setInfo(__('message_sent', 'feedback'));
     router::redirect('feedback');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:31,代码来源:feedback.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     $authID = session::item('auth_id');
     $userID = session::item('user_id');
     $ipaddress = substr(input::ipaddress(), 0, 15);
     $useragent = substr(input::useragent(), 0, 255);
     $user = array();
     if ($authID && ($user = $this->getSession($authID, $userID, $ipaddress, $useragent))) {
         if ($user['active_date'] < date_helper::now() - 60 * $this->timeout) {
             $this->saveSession($authID, $userID, $ipaddress, $useragent);
             if (isset($user['user_id']) && $user['user_id']) {
                 $this->saveLastvisit($user['user_id']);
             }
         }
     } else {
         $cookie = cookie::item('sessdata');
         $cookie = $cookie ? @json_decode($cookie, true) : array();
         if ($cookie && is_array($cookie)) {
             $userID = isset($cookie['user_id']) ? $cookie['user_id'] : '';
             $email = isset($cookie['email']) ? $cookie['email'] : '';
             $passhash = isset($cookie['passhash']) ? $cookie['passhash'] : '';
             if ($userID && is_numeric($userID) && $userID > 0) {
                 if ($user = $this->getUser($userID, false, false)) {
                     $newPasshash = $this->generatePasshash($email, $user['password']);
                     if ($user['active'] && $user['verified'] && strcmp($email, $user['email']) == 0 && strcmp($passhash, $newPasshash) == 0) {
                         $authID = $this->saveSession(0, $user['user_id'], $ipaddress, $useragent);
                         $this->saveLastvisit($user['user_id']);
                     } else {
                         $user = array();
                     }
                 }
             }
         }
     }
     if (!$user || !isset($user['user_id']) || !$user['user_id'] || !$this->createUserSession($user)) {
         $userID = 0;
         if (!$user) {
             $authID = $this->saveSession(0, $userID, $ipaddress, $useragent);
         }
         $this->createGuestSession();
     }
     session::set('auth_id', $authID);
     session::set('user_id', $userID);
     // Is the site offline?
     if (!input::isCP() && !config::item('site_online', 'system') && !session::permission('site_access_offline', 'system') && uri::getURI() != 'site/offline' && uri::segment(1) != 'load') {
         router::redirect('site/offline');
     } elseif (input::isCP() && !session::permission('site_access_cp', 'system') && (uri::getURI() != 'cp' && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license')) {
         router::redirect('cp/users/login');
     }
     if (!input::isCP() && $this->isLoggedin() && session::permission('site_access_cp', 'system') && uri::segment(1) != 'load' && input::demo(0, '', session::item('user_id'))) {
         $this->logout();
         view::setInfo('For the purposes of this demo you may not use front end of the site under the administrator account. As such we have now logged you out.<br/>Feel free ' . html_helper::anchor('users/signup', 'register on the site') . ' to test user end functionality or ' . html_helper::anchor('users/login', 'login') . ' using your existing account details if you have one already.');
         router::redirect();
     }
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:56,代码来源:session.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     // Does user have permission to access this plugin?
     if (!session::permission('license_manage', 'system')) {
         view::noAccess();
     }
     view::setCustomParam('section', 'help');
     view::setCustomParam('options', array('help/license' => array('name' => __('help_license', 'system_navigation'), 'uri' => 'help/license', 'keyword' => 'help/license', 'attr' => array('help license'), 'items' => array())));
     loader::model('system/license');
     view::setTrail('cp/help/license', __('help', 'system_navigation'));
     view::setTrail('cp/help/license', __('help_license', 'system_navigation'));
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/system/config/system')) {
         return false;
     }
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:17,代码来源:license.php

示例5: action

 protected function action($action, $actionID = false)
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/users/pictures')) {
         return false;
     }
     // Get URI vars
     $userID = $actionID ? $actionID : (int) uri::segment(5);
     // Get user
     if (!$userID || !($user = $this->users_model->getUser($userID))) {
         view::setError(__('no_user', 'users'));
         router::redirect('cp/users/pictures/browse');
     }
     switch ($action) {
         case 'approve':
             $this->users_model->togglePictureStatus($userID, $user, 1);
             $str = __('picture_approved', 'users_picture');
             break;
         case 'decline':
             $this->users_model->togglePictureStatus($userID, $user, 0);
             $str = __('picture_declined', 'users_picture');
             break;
         case 'delete':
             $this->users_model->deletePicture($userID, $user['picture_id']);
             $str = __('picture_deleted', 'users_picture');
             break;
     }
     // Is this an action call?
     if ($actionID) {
         return;
     }
     // Process query string
     $qstring = $this->parseQuerystring();
     // Success
     view::setInfo($str);
     router::redirect('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page']);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:37,代码来源:pictures.php

示例6: deleteField

 protected function deleteField($plugin, $table, $categoryID, $fieldID)
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/system/fields/' . $plugin . '/browse' . ($categoryID ? '/' . $categoryID : ''))) {
         return false;
     }
     // Get field
     if (!($field = $this->fields_model->getField($fieldID))) {
         view::setError(__('no_field', 'system_fields'));
         router::redirect('cp/system/fields/' . $plugin . '/browse/' . $categoryID);
     }
     // Is this a system field?
     if ($field['system']) {
         view::setError(__('no_system_delete', 'system_fields'));
         router::redirect('cp/system/fields/' . $plugin . '/browse/' . $categoryID);
     }
     // Delete field
     if (!$this->fieldsdb_model->deleteField($plugin, $table, $fieldID, $field)) {
         view::setError(__('db_no_column_drop', 'system_fields'));
         router::redirect('cp/system/fields/' . $plugin . '/browse/' . $categoryID);
     }
     // Success
     view::setInfo(__('field_deleted', 'system_fields'));
     router::redirect('cp/system/fields/' . $plugin . '/browse' . ($categoryID ? '/' . $categoryID : ''));
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:25,代码来源:system.php

示例7: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/users/types')) {
         return false;
     }
     // Get URI vars
     $typeID = (int) uri::segment(5);
     // Is this one of the system types?
     if ($typeID == config::item('type_default_id', 'users')) {
         view::setError(__('type_delete_system', 'users_types'));
         router::redirect('cp/users/types');
     }
     // Is this member's own type?
     if ($typeID == session::item('type_id')) {
         view::setError(__('type_delete_self', 'users_types'));
         router::redirect('cp/users/types');
     }
     // Get user type
     if (!$typeID || !($type = $this->users_types_model->getType($typeID))) {
         view::setError(__('no_type', 'users_types'));
         router::redirect('cp/users/types');
     }
     // Do we have any members of this type?
     if ($this->users_types_model->isUsers($typeID)) {
         view::setError(__('type_delete_users', 'users_types'));
         router::redirect('cp/users/types');
     }
     // Delete user type
     if (!$this->users_types_model->deleteType($typeID, $type)) {
         view::setError(__('db_no_drop', 'system_fields'));
         router::redirect('cp/users/types');
     }
     // Success
     view::setInfo(__('type_deleted', 'users_types'));
     router::redirect('cp/users/types');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:37,代码来源:types.php

示例8: __

            ?>
									<ul class="unstyled" style="display:none" data-dropdown-menu="menu-help">
										<li><?php 
            echo html_helper::anchor('cp/help/documentation', __('help_documentation', 'system_navigation'), array('class' => 'help documentation', 'target' => '_blank'));
            ?>
</li>
										<li><?php 
            echo html_helper::anchor('cp/help/forum', __('help_forum', 'system_navigation'), array('class' => 'help forum', 'target' => '_blank'));
            ?>
</li>
										<li><?php 
            echo html_helper::anchor('cp/help/support', __('help_support', 'system_navigation'), array('class' => 'help support', 'target' => '_blank'));
            ?>
</li>
										<?php 
            if (!input::demo(0)) {
                ?>
											<li><?php 
                echo html_helper::anchor('cp/help/license', __('help_license', 'system_navigation'), array('class' => 'help license'));
                ?>
</li>
										<?php 
            }
            ?>
									</ul>
								</li>
							<?php 
        }
        ?>
						</ul>
					</div>
开发者ID:soremi,项目名称:tutornavi,代码行数:31,代码来源:header.php

示例9: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/content/reports/subjects')) {
         return false;
     }
     // Get URI vars
     $subjectID = (int) uri::segment(6);
     // Get subject
     if (!$subjectID || !($subject = $this->reports_subjects_model->getSubject($subjectID))) {
         view::setError(__('no_subject', 'reports_subjects'));
         router::redirect('cp/content/reports/subjects');
     }
     // Delete subject
     $this->reports_subjects_model->deleteSubject($subjectID, $subject);
     // Success
     view::setInfo(__('subject_deleted', 'reports_subjects'));
     router::redirect('cp/content/reports/subjects');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:19,代码来源:subjects.php

示例10: _saveLanguageData

 protected function _saveLanguageData($plugin, $language, $default)
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     // Create rules
     $rules = array();
     foreach ($default as $section => $groups) {
         foreach ($groups as $group => $types) {
             foreach ($types as $type => $lang) {
                 foreach ($lang as $keyword => $name) {
                     $rules[$group . '_' . $keyword] = array('label' => '', 'rules' => array('trim', 'required'));
                 }
             }
         }
     }
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Get language data
     $languageData = array();
     foreach ($default as $section => $groups) {
         foreach ($groups as $group => $types) {
             foreach ($types as $type => $lang) {
                 foreach ($lang as $keyword => $name) {
                     $cp = $type == 'cp' ? 1 : 0;
                     // Set language data
                     $data = array('value_' . $language => input::post($group . '_' . $keyword));
                     // Save language string
                     $this->languages_model->saveLanguageData($plugin, $section, $group, $keyword, $data);
                 }
             }
         }
     }
     // Recompile language pack
     $this->languages_model->compile($language);
     // Success
     view::setInfo(__('language_saved', 'system_languages'));
     router::redirect('cp/system/languages/translate/' . $plugin . '/' . $language);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:44,代码来源:languages.php

示例11: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/billing/credits')) {
         return false;
     }
     // Get URI vars
     $packageID = (int) uri::segment(5);
     // Get package
     if (!$packageID || !($package = $this->credits_model->getPackage($packageID))) {
         view::setError(__('no_package', 'billing_credits'));
         router::redirect('cp/billing/credits');
     }
     // Delete package
     $this->credits_model->deletePackage($packageID, $package);
     // Success
     view::setInfo(__('package_deleted', 'billing_credits'));
     router::redirect('cp/billing/credits');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:19,代码来源:credits.php

示例12: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/content/newsletters')) {
         return false;
     }
     // Get URI vars
     $newsletterID = (int) uri::segment(5);
     // Get newsletter
     if (!$newsletterID || !($newsletter = $this->newsletters_model->getNewsletter($newsletterID))) {
         view::setError(__('no_newsletter', 'newsletters'));
         router::redirect('cp/content/newsletters');
     }
     // Delete newsletter
     $this->newsletters_model->deleteNewsletter($newsletterID, $newsletter);
     // Success
     view::setInfo(__('newsletter_deleted', 'newsletters'));
     router::redirect('cp/content/newsletters');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:19,代码来源:newsletters.php

示例13: _saveSettings

 protected function _saveSettings($plugin, $settings, $param)
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     $rules = array();
     foreach ($settings as $group => $configs) {
         foreach ($configs as $setting) {
             $options = array();
             if ($setting['required']) {
                 $options[] = 'required';
             }
             if ($setting['type'] == 'email') {
                 $options[] = 'valid_email';
             } elseif ($setting['type'] == 'number') {
                 if ($setting['required']) {
                     $options[] = 'is_numeric_no_zero';
                     $options['min_value'] = '1';
                 } else {
                     $options[] = 'is_numeric';
                 }
             }
             $rules[$setting['keyword']] = array('label' => $setting['name'], 'rules' => $options);
         }
     }
     validate::setRules($rules);
     if (!validate::run()) {
         return false;
     }
     foreach ($settings as $group => $configs) {
         foreach ($configs as $setting) {
             if ($setting['type'] != 'static') {
                 $value = input::post($setting['keyword']);
                 if (method_exists($this, '_savePluginSettings')) {
                     $this->_savePluginSettings($setting['keyword'], $value);
                 }
                 if ($setting['type'] == 'checkbox') {
                     if (!is_array($value)) {
                         $value = array();
                     }
                     $value = json_encode(array_flip($value));
                 } elseif ($setting['type'] == 'number') {
                     $value = $value == '' ? 0 : $value;
                 }
                 $orderID = false;
                 if (config::item('devmode', 'system') == 2) {
                     $orderID = (int) input::post($setting['keyword'] . '___order');
                 }
                 $this->config_model->saveSetting($plugin, $setting['keyword'], $value, $orderID);
             }
         }
     }
     view::setInfo(__('config_saved', 'system_config'));
     router::redirect(($param ? 'cp/system/plugins/settings/' : 'cp/system/config/') . $plugin);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:56,代码来源:system.php

示例14: delete

 public function delete()
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/users/groups')) {
         return false;
     }
     // Get URI vars
     $groupID = (int) uri::segment(5);
     // Is this one of the system groups?
     if (in_array($groupID, array(config::item('group_default_id', 'users'), config::item('group_cancelled_id', 'users'), config::item('group_guests_id', 'users')))) {
         view::setError(__('group_delete_system', 'users_groups'));
         router::redirect('cp/users/groups');
     }
     // Is this member's own group?
     if ($groupID == session::item('group_id')) {
         view::setError(__('group_delete_self', 'users_groups'));
         router::redirect('cp/users/groups');
     }
     // Get user group
     if (!$groupID || !($group = $this->users_groups_model->getGroup($groupID))) {
         view::setError(__('no_group', 'users_groups'));
         router::redirect('cp/users/groups');
     }
     // Do we have any members in this group?
     if ($this->users_groups_model->isUsers($groupID)) {
         view::setError(__('group_delete_users', 'users_groups'));
         router::redirect('cp/users/groups');
     }
     // Delete user group
     if (!$this->users_groups_model->deleteGroup($groupID, $group)) {
         view::setError(__('db_no_column_drop', 'system_fields'));
         router::redirect('cp/users/groups');
     }
     // Success
     view::setInfo(__('group_deleted', 'users_groups'));
     router::redirect('cp/users/groups');
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:37,代码来源:groups.php

示例15: delete

 public function delete($actionID = false)
 {
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/plugins/pictures/albums')) {
         return false;
     }
     // Get URI vars
     $albumID = $actionID ? $actionID : (int) uri::segment(6);
     // Get album
     if (!$albumID || !($album = $this->pictures_albums_model->getAlbum($albumID))) {
         view::setError(__('no_album', 'pictures'));
         router::redirect('cp/plugins/pictures/albums');
     }
     // Delete album
     $this->pictures_albums_model->deleteAlbum($albumID, $album['user_id'], $album);
     // Is this an action call?
     if ($actionID) {
         return;
     }
     // Process query string
     $qstring = $this->parseQuerystring();
     // Success
     view::setInfo(__('album_deleted', 'pictures'));
     router::redirect('cp/plugins/pictures/albums?' . $qstring['url'] . 'page=' . $qstring['page']);
 }
开发者ID:soremi,项目名称:tutornavi,代码行数:25,代码来源:albums.php


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