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

PHP param_error函数代码示例

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

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



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

示例1: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Name
     $tag_name = param('tag_name', 'string', true);
     param_check_regexp('tag_name', '/^[^,]+$/', T_('Tags cannot contain commas.'));
     $this->set('name', $tag_name);
     if ($existing_tag_ID = $this->dbexists('tag_name', $tag_name)) {
         // Other tag already exists with the same name:
         if (empty($this->ID)) {
             // Suggest to edit existing tag for new creating tag
             param_error('tag_name', sprintf(T_('This tag already exists. Do you want to <a %s>edit the existing tag</a>?'), 'href="?ctrl=itemtags&amp;action=edit&amp;tag_ID=' . $existing_tag_ID . '"'));
         } else {
             // Suggest to merge for existing tag
             global $DB, $Messages, $display_merge_tags_form;
             $new_tag_posts = intval($DB->get_var('SELECT COUNT( itag_itm_ID ) FROM T_items__itemtag WHERE itag_tag_ID = ' . $DB->quote($existing_tag_ID)));
             $old_tag_posts = intval($DB->get_var('SELECT COUNT( itag_itm_ID ) FROM T_items__itemtag WHERE itag_tag_ID = ' . $DB->quote($this->ID)));
             // Set this to know to display a confirmation message to merge this tag
             $this->merge_tag_ID = $existing_tag_ID;
             $this->merge_message = sprintf(T_('The previously named "%s" tag (applied to %d posts) will be merged with the existing "%s" tag (already applied to %d posts). Are you sure?'), $this->dget('name'), $old_tag_posts, $tag_name, $new_tag_posts, 'href="?ctrl=itemtags&amp;action=merge&amp;old_tag_ID=' . $this->ID . '&amp;tag_ID=' . $existing_tag_ID . '&amp;' . url_crumb('tag') . '"', 'href="?ctrl=itemtags&amp;action=edit&amp;tag_ID=' . $this->ID . '"');
             // Return FALSE to don't save current changes without confirmation
             return false;
         }
     }
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:30,代码来源:_itemtag.class.php


示例2: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $force_upload_forbiddenext;
     // Extensions
     $this->old_extensions = $this->extensions;
     if (param_string_not_empty('ftyp_extensions', T_('Please enter file extensions separated by space.'))) {
         // Check if estensions has a valid format
         $GLOBALS['ftyp_extensions'] = strtolower(trim($GLOBALS['ftyp_extensions']));
         $reg_exp = '/^[a-z0-9]+( [a-z0-9]+)*$/';
         if (!preg_match($reg_exp, $GLOBALS['ftyp_extensions'], $res)) {
             // Extensiosn has an invalid format
             param_error('ftyp_extensions', T_('Invalid file extensions format.'));
         }
     }
     $this->set_from_Request('extensions');
     // Name
     param_string_not_empty('ftyp_name', T_('Please enter a name.'));
     $this->set_from_Request('name');
     // Mime type
     $this->old_mimetype = $this->mimetype;
     // asimo> TODO: Consider to add some further validation for the ftyp_mimetype param value
     // If it will be correctly validated, the corresponding db field collation may be changed to 'ascii_bin'
     param_string_not_empty('ftyp_mimetype', T_('Please enter a mime type.'));
     $this->set_from_Request('mimetype');
     // Icon for the mime type
     param('ftyp_icon', 'string', '');
     $this->set_from_Request('icon');
     // View type
     param('ftyp_viewtype', 'string');
     $this->set_from_Request('viewtype');
     // Allowed to upload theses extensions
     param('ftyp_allowed', 'string', 'registered');
     if ($GLOBALS['ftyp_allowed'] != 'admin') {
         // Check if the extension is in the array of the not allowed extensions (_advanced.php)
         $not_allowed = false;
         $extensions = explode(' ', $GLOBALS['ftyp_extensions']);
         foreach ($extensions as $extension) {
             if (in_array($extension, $force_upload_forbiddenext)) {
                 $not_allowed = true;
                 continue;
             }
         }
         if ($not_allowed) {
             // this extension is not allowed
             $GLOBALS['ftyp_allowed'] = 'admin';
         }
     }
     $this->set_from_Request('allowed');
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:55,代码来源:_filetype.class.php


示例3: UserfieldGroup

 $edited_UserfieldGroup = new UserfieldGroup();
 // Check that this action request is not a CSRF hacked request:
 $Session->assert_received_crumb('userfieldgroup');
 // Check permission:
 $current_User->check_perm('users', 'edit', true);
 // load data from request
 if ($edited_UserfieldGroup->load_from_Request()) {
     // We could load data from form without errors:
     // Insert in DB:
     $DB->begin();
     // because of manual assigning ID,
     // member function Userfield::dbexists() is overloaded for proper functionality
     $q = $edited_UserfieldGroup->dbexists();
     if ($q) {
         // We have a duplicate entry:
         param_error('ufgp_ID', sprintf(T_('This user field group already exists. Do you want to <a %s>edit the existing user field group</a>?'), 'href="?ctrl=userfieldsgroups&amp;action=edit&amp;ufgp_ID=' . $q . '"'));
     } else {
         $edited_UserfieldGroup->dbinsert();
         $Messages->add(T_('New User field group created.'), 'success');
     }
     $DB->commit();
     if (empty($q)) {
         // What next?
         switch ($action) {
             case 'create_copy':
                 // Redirect so that a reload doesn't write to the DB twice:
                 header_redirect('?ctrl=userfieldsgroups&action=new&ufgp_ID=' . $edited_UserfieldGroup->ID, 303);
                 // Will EXIT
                 // We have EXITed already at this point!!
                 break;
             case 'create_new':
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:userfieldsgroups.ctrl.php


示例4: param

 param('pass1', 'string', '');
 param('pass2', 'string', '');
 // Call plugin event to allow catching input in general and validating own things from DisplayRegisterFormFieldset event
 $Plugins->trigger_event('RegisterFormSent', array('login' => &$login, 'email' => &$email, 'locale' => &$locale, 'pass1' => &$pass1, 'pass2' => &$pass2));
 if ($Messages->count('error')) {
     // a Plugin has added an error
     break;
 }
 // Check profile params:
 profile_check_params(array('login' => $login, 'pass1' => $pass1, 'pass2' => $pass2, 'email' => $email, 'pass_required' => true));
 // We want all logins to be lowercase to guarantee uniqueness regardless of the database case handling for UNIQUE indexes:
 $login = strtolower($login);
 $UserCache =& get_Cache('UserCache');
 if ($UserCache->get_by_login($login)) {
     // The login is already registered
     param_error('login', sprintf(T_('The login &laquo;%s&raquo; is already registered, please choose another one.'), $login));
 }
 if ($Messages->count('error')) {
     break;
 }
 $DB->begin();
 $new_User =& new User();
 $new_User->set('login', $login);
 $new_User->set('pass', md5($pass1));
 // encrypted
 $new_User->set('nickname', $login);
 $new_User->set_email($email);
 $new_User->set('ip', $Hit->IP);
 $new_User->set('domain', $Hit->get_remote_host(true));
 $new_User->set('browser', $Hit->user_agent);
 $new_User->set_datecreated($localtimenow);
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:register.php


示例5: param_validate

/**
 * Validate variable
 *
 * @param string param name
 * @param string validator function name
 * @param boolean true if variable value can't be empty
 * @param custom error message
 * @return boolean true if OK
 */
function param_validate($variable, $validator, $required = false, $custom_msg = NULL)
{
    /* Tblue> Note: is_callable() does not check whether a function is
     *        disabled (http://www.php.net/manual/en/function.is-callable.php#79151).
     */
    if (!is_callable($validator)) {
        debug_die('Validator function ' . $validator . '() is not callable!');
    }
    if (!isset($GLOBALS[$variable])) {
        // Variable not set, we cannot handle this using the validator function...
        if ($required) {
            // Add error:
            param_check_not_empty($variable, $custom_msg);
            return false;
        }
        return true;
    }
    if ($GLOBALS[$variable] === '' && !$required) {
        // Variable is empty or not set. That's fine since it isn't required:
        return true;
    }
    $msg = $validator($GLOBALS[$variable]);
    if (!empty($msg)) {
        if (!empty($custom_msg)) {
            $msg = $custom_msg;
        }
        param_error($variable, $msg);
        return false;
    }
    return true;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:40,代码来源:_misc.funcs.php


示例6: param

    $Settings->set('newusers_revalidate_emailchg', $newusers_revalidate_emailchg);
    param('newusers_grp_ID', 'integer', true);
    $Settings->set('newusers_grp_ID', $newusers_grp_ID);
    param_integer_range('newusers_level', 0, 9, T_('User level must be between %d and %d.'));
    $Settings->set('newusers_level', $newusers_level);
    param('default_blog_ID', 'integer', true);
    $Settings->set('default_blog_ID', $default_blog_ID);
    param_integer_range('user_minpwdlen', 1, 32, T_('Minimun password length must be between %d and %d.'));
    $Settings->set('user_minpwdlen', $user_minpwdlen);
    param('js_passwd_hashing', 'integer', 0);
    $Settings->set('js_passwd_hashing', $js_passwd_hashing);
    // Session timeout
    $timeout_sessions = param('timeout_sessions', 'integer', $Settings->get_default('timeout_sessions'));
    if ($timeout_sessions < 300) {
        // lower than 5 minutes: not allowed
        param_error('timeout_sessions', sprintf(T_('You cannot set a session timeout below %d seconds.'), 300));
    } elseif ($timeout_sessions < 86400) {
        // lower than 1 day: notice/warning
        $Messages->add(sprintf(T_('Warning: your session timeout is just %d seconds. Your users may have to re-login often!'), $timeout_sessions), 'note');
    }
    $Settings->set('timeout_sessions', $timeout_sessions);
    param_integer_range('reloadpage_timeout', 0, 99999, T_('Reload-page timeout must be between %d and %d.'));
    $Settings->set('reloadpage_timeout', $reloadpage_timeout);
    if (!$Messages->count('error')) {
        if ($Settings->dbupdate()) {
            $Messages->add(T_('General settings updated.'), 'success');
        }
    }
}
// Display <html><head>...</head> section! (Note: should be done early if actions do not redirect)
$AdminUI->disp_html_head();
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:settings.ctrl.php


示例7: load_from_Request

    /**
     * Load data from Request form fields.
     *
     * @param array groups of params to load
     * @return boolean true if loaded data seems valid.
     */
    function load_from_Request($groups = array())
    {
        global $Messages, $default_locale, $DB;
        /**
         * @var User
         */
        global $current_User;
        if (param('blog_name', 'string', NULL) !== NULL) {
            // General params:
            $this->set_from_Request('name');
            $this->set('shortname', param('blog_shortname', 'string', true));
            $this->set('locale', param('blog_locale', 'string', $default_locale));
        }
        if (param('archive_links', 'string', NULL) !== NULL) {
            // Archive link type:
            $this->set_setting('archive_links', get_param('archive_links'));
            $this->set_setting('archive_posts_per_page', param('archive_posts_per_page', 'integer', NULL), true);
        }
        if (param('chapter_links', 'string', NULL) !== NULL) {
            // Chapter link type:
            $this->set_setting('chapter_links', get_param('chapter_links'));
        }
        if (param('category_prefix', 'string', NULL) !== NULL) {
            $category_prefix = get_param('category_prefix');
            if (!preg_match('|^([A-Za-z0-9\\-_]+(/[A-Za-z0-9\\-_]+)*)?$|', $category_prefix)) {
                param_error('category_prefix', T_('Invalid category prefix.'));
            }
            $this->set_setting('category_prefix', $category_prefix);
        }
        if (param('tag_links', 'string', NULL) !== NULL) {
            // Tag page link type:
            $this->set_setting('tag_links', get_param('tag_links'));
        }
        if (param('tag_prefix', 'string', NULL) !== NULL) {
            $category_prefix = get_param('tag_prefix');
            if (!preg_match('|^([A-Za-z0-9\\-_]+(/[A-Za-z0-9\\-_]+)*)?$|', $category_prefix)) {
                param_error('tag_prefix', T_('Invalid category prefix.'));
            }
            $this->set_setting('tag_prefix', $category_prefix);
        }
        if (param('chapter_posts_per_page', 'integer', NULL) !== NULL) {
            // Chapter link type:
            $this->set_setting('chapter_posts_per_page', get_param('chapter_posts_per_page'), true);
            $this->set_setting('tag_posts_per_page', param('tag_posts_per_page', 'integer', NULL), true);
        }
        if (param('single_links', 'string', NULL) !== NULL) {
            // Single post link type:
            $this->set_setting('single_links', get_param('single_links'));
        }
        if (param('blog_skin_ID', 'integer', NULL) !== NULL) {
            // Default blog:
            $this->set_from_Request('skin_ID');
        }
        if (param('what_to_show', 'string', NULL) !== NULL) {
            // Show x days or x posts?:
            $this->set_setting('what_to_show', get_param('what_to_show'));
            param_integer_range('posts_per_page', 1, 9999, T_('Items/days per page must be between %d and %d.'));
            $this->set_setting('posts_per_page', get_param('posts_per_page'));
            $this->set_setting('archive_mode', param('archive_mode', 'string', true));
            $this->set_setting('orderby', param('orderby', 'string', true));
            $this->set_setting('orderdir', param('orderdir', 'string', true));
        }
        if (param('feed_content', 'string', NULL) !== NULL) {
            // How much content in feeds?
            $this->set_setting('feed_content', get_param('feed_content'));
            param_integer_range('posts_per_feed', 1, 9999, T_('Items per feed must be between %d and %d.'));
            $this->set_setting('posts_per_feed', get_param('posts_per_feed'));
        }
        if (param('blog_description', 'string', NULL) !== NULL) {
            // Description:
            $this->set_from_Request('shortdesc', 'blog_description');
        }
        if (param('blog_keywords', 'string', NULL) !== NULL) {
            // Keywords:
            $this->set_from_Request('keywords');
        }
        if (param('blog_tagline', 'html', NULL) !== NULL) {
            // HTML tagline:
            param_check_html('blog_tagline', T_('Invalid tagline'));
            $this->set('tagline', get_param('blog_tagline'));
        }
        if (param('blog_longdesc', 'html', NULL) !== NULL) {
            // HTML long description:
            param_check_html('blog_longdesc', T_('Invalid long description'));
            $this->set('longdesc', get_param('blog_longdesc'));
        }
        if (param('blog_footer_text', 'html', NULL) !== NULL) {
            // Blog footer:
            param_check_html('blog_footer_text', T_('Invalid blog footer'));
            $this->set_setting('blog_footer_text', get_param('blog_footer_text'));
        }
        if (param('single_item_footer_text', 'html', NULL) !== NULL) {
            // Blog footer:
            param_check_html('single_item_footer_text', T_('Invalid single post footer'));
//.........这里部分代码省略.........
开发者ID:LFSF,项目名称:oras,代码行数:101,代码来源:_blog.class.php


示例8: param

     // Edit currency form:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('currency');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an curr_ID:
     param('curr_ID', 'integer', true);
     // load data from request
     if ($edited_Currency->load_from_Request()) {
         // We could load data from form without errors:
         // Update in DB:
         $DB->begin();
         $q = $edited_Currency->dbexists();
         if ($q) {
             // We have a duplicate entry:
             param_error('curr_code', sprintf(T_('This currency already exists. Do you want to <a %s>edit the existing currency</a>?'), 'href="?ctrl=currencies&amp;action=edit&amp;curr_ID=' . $q . '"'));
         } else {
             $edited_Currency->dbupdate();
             $Messages->add(T_('Currency updated.'), 'success');
         }
         $DB->commit();
         if (empty($q)) {
             // If no error, Redirect so that a reload doesn't write to the DB twice:
             header_redirect('?ctrl=currencies', 303);
             // Will EXIT
             // We have EXITed already at this point!!
         }
     }
     break;
 case 'delete':
     // Delete currency:
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:currencies.ctrl.php


示例9: headers_content_mightcache

     headers_content_mightcache('text/html');
     phpinfo();
     exit;
     break;
 case 'create_sample_hits':
     $days = param('days', 'integer', 0);
     $min_interval = param('min_interval', 'integer', 0);
     $max_interval = param('max_interval', 'integer', 0);
     if ($days < 1) {
         param_error('days', 'Please enter how many days of stats to generate');
         $action = 'show_create_hits';
         break;
     }
     if ($min_interval > $max_interval || $min_interval < 0 || $max_interval <= 0) {
         param_error('min_interval', 'Please enter correct interval values');
         param_error('max_interval', 'Please enter correct interval values');
         $action = 'show_create_hits';
         break;
     }
     // Execute a creating of hits inside template in order to see a process
     $template_action = 'create_sample_hits';
     break;
 case 'create_sample_messages':
     $num_loops = param('num_loops', 'string', 0);
     $num_messages = param('num_messages', 'string', 0);
     $num_words = param('num_words', 'string', 0);
     $max_users = param('max_users', 'string', 0);
     if (!(param_check_number('num_loops', T_('"How many loops" field must be a number'), true) && param_check_number('num_messages', T_('"How many messages in each conversation" field must be a number'), true) && param_check_number('num_words', T_('"How many words in each message" field must be a number'), true) && param_check_number('max_users', T_('"Max # of participants in a conversation" field must be a number'), true))) {
         // param errors
         $action = 'show_create_messages';
         break;
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:tools.ctrl.php


示例10: switch

    }
}
switch ($action) {
    case 'new':
        // Check that we have permission to edit options:
        $current_User->check_perm('options', 'edit', true, NULL);
        break;
    case 'create':
        // Check that we have permission to edit options:
        $current_User->check_perm('options', 'edit', true, NULL);
        // CREATE OBJECT:
        load_class('/cron/model/_cronjob.class.php');
        $edited_Cronjob =& new Cronjob();
        $cjob_type = param('cjob_type', 'string', true);
        if (!isset($cron_job_params[$cjob_type])) {
            param_error('cjob_type', T_('Invalid job type'));
        }
        // start datetime:
        param_date('cjob_date', T_('Please enter a valid date.'), true);
        param_time('cjob_time');
        $edited_Cronjob->set('start_datetime', form_date(get_param('cjob_date'), get_param('cjob_time')));
        // repeat after:
        $cjob_repeat_after_days = param('cjob_repeat_after_days', 'integer', 0);
        $cjob_repeat_after_hours = param('cjob_repeat_after_hours', 'integer', 0);
        $cjob_repeat_after_minutes = param('cjob_repeat_after_minutes', 'integer', 0);
        $cjob_repeat_after = (($cjob_repeat_after_days * 24 + $cjob_repeat_after_hours) * 60 + $cjob_repeat_after_minutes) * 60;
        // seconds
        if ($cjob_repeat_after == 0) {
            $cjob_repeat_after = NULL;
        }
        $edited_Cronjob->set('repeat_after', $cjob_repeat_after);
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:cronjobs.ctrl.php


示例11: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * This requires the blog (e.g. {@link $blog_ID} or {@link $main_cat_ID} to be set).
  *
  * @param boolean true if we are returning to edit mode (new, switchtab...)
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request($editing = false, $creating = false)
 {
     global $default_locale, $current_User, $localtimenow;
     global $posttypes_reserved_IDs, $item_typ_ID;
     // LOCALE:
     if (param('post_locale', 'string', NULL) !== NULL) {
         $this->set_from_Request('locale');
     }
     // POST TYPE:
     $item_typ_ID = get_param('item_typ_ID');
     if (empty($item_typ_ID)) {
         // Try to get this from request if it has been not initialized by controller:
         $item_typ_ID = param('item_typ_ID', 'integer', NULL);
     }
     if (!empty($item_typ_ID)) {
         // Set new post type ID only if it is defined on request:
         $this->set('ityp_ID', $item_typ_ID);
     }
     // URL associated with Item:
     $post_url = param('post_url', 'string', NULL);
     if ($post_url !== NULL) {
         param_check_url('post_url', 'posting', '');
         $this->set_from_Request('url');
     }
     if (empty($post_url) && $this->get_type_setting('use_url') == 'required') {
         // URL must be entered
         param_check_not_empty('post_url', T_('Please provide a "Link To" URL.'), '');
     }
     // Item parent ID:
     $post_parent_ID = param('post_parent_ID', 'integer', NULL);
     if ($post_parent_ID !== NULL) {
         // If item parent ID is entered:
         $ItemCache =& get_ItemCache();
         if ($ItemCache->get_by_ID($post_parent_ID, false, false)) {
             // Save only ID of existing item:
             $this->set_from_Request('parent_ID');
         } else {
             // Display an error of the entered item parent ID is incorrect:
             param_error('post_parent_ID', T_('The parent ID is not a correct Item ID.'));
         }
     }
     if (empty($post_parent_ID)) {
         // If empty parent ID is entered:
         if ($this->get_type_setting('use_parent') == 'required') {
             // Item parent ID must be entered:
             param_check_not_empty('post_parent_ID', T_('Please provide a parent ID.'), '');
         } else {
             // Remove parent ID:
             $this->set_from_Request('parent_ID');
         }
     }
     if ($this->status == 'redirected' && empty($this->url)) {
         // Note: post_url is not part of the simple form, so this message can be a little bit awkward there
         param_error('post_url', T_('If you want to redirect this post, you must specify an URL!') . ' (' . T_('Advanced properties panel') . ')', T_('If you want to redirect this post, you must specify an URL!'));
     }
     // ISSUE DATE / TIMESTAMP:
     $this->load_Blog();
     if ($current_User->check_perm('admin', 'restricted') && $current_User->check_perm('blog_edit_ts', 'edit', false, $this->Blog->ID)) {
         // Allow to update timestamp fields only if user has a permission to edit such fields
         //    and also if user has an access to back-office
         $item_dateset = param('item_dateset', 'integer', NULL);
         if ($item_dateset !== NULL) {
             $this->set('dateset', $item_dateset);
             if ($editing || $this->dateset == 1) {
                 // We can use user date:
                 if (param_date('item_issue_date', T_('Please enter a valid issue date.'), true) && param_time('item_issue_time')) {
                     // only set it, if a (valid) date and time was given:
                     $this->set('issue_date', form_date(get_param('item_issue_date'), get_param('item_issue_time')));
                     // TODO: cleanup...
                 }
             } elseif ($this->dateset == 0) {
                 // Set date to NOW:
                 $this->set('issue_date', date('Y-m-d H:i:s', $localtimenow));
             }
         }
     }
     // DEADLINE:
     if (param_date('item_deadline', T_('Please enter a valid deadline.'), false, NULL) !== NULL) {
         $this->set_from_Request('datedeadline', 'item_deadline', true);
     }
     // SLUG:
     if (param('post_urltitle', 'string', NULL) !== NULL) {
         $this->set_from_Request('urltitle');
     }
     // <title> TAG:
     $titletag = param('titletag', 'string', NULL);
     if ($titletag !== NULL) {
         $this->set_from_Request('titletag', 'titletag');
     }
     if (empty($titletag) && $this->get_type_setting('use_title_tag') == 'required') {
         // Title tag must be entered
         param_check_not_empty('titletag', T_('Please provide a title tag.'), '');
//.........这里部分代码省略.........
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:101,代码来源:_item.class.php


示例12: param

     }
     break;
 case 'update_settings':
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('collectionsettings');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     if (param('default_blog_ID', 'integer', NULL) !== NULL) {
         $Settings->set('default_blog_ID', $default_blog_ID);
     }
     $Settings->set('blogs_order_by', param('blogs_order_by', 'string', true));
     $Settings->set('blogs_order_dir', param('blogs_order_dir', 'string', true));
     // Reload page timeout
     $reloadpage_timeout = param_duration('reloadpage_timeout');
     if ($reloadpage_timeout > 99999) {
         param_error('reloadpage_timeout', sprintf(T_('Reload-page timeout must be between %d and %d seconds.'), 0, 99999));
     }
     $Settings->set('reloadpage_timeout', $reloadpage_timeout);
     // Smart hit count
     $Settings->set('smart_view_count', param('smart_view_count', 'integer', 0));
     $new_cache_status = param('general_cache_enabled', 'integer', 0);
     if (!$Messages->has_errors()) {
         load_funcs('collections/model/_blog.funcs.php');
         $result = set_cache_enabled('general_cache_enabled', $new_cache_status, NULL, false);
         if ($result != NULL) {
             // general cache setting was changed
             list($status, $message) = $result;
             $Messages->add($message, $status);
         }
     }
     $Settings->set('newblog_cache_enabled', param('newblog_cache_enabled', 'integer', 0));
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:collections.ctrl.php


示例13: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Category
     param('goal_gcat_ID', 'integer', true);
     param_check_not_empty('goal_gcat_ID', T_('Please select a category.'));
     $this->set_from_Request('gcat_ID');
     // Name
     $this->set_string_from_param('name', true);
     // Key
     $this->set_string_from_param('key', true);
     // Temporary Redirection URL:
     $this->set_string_from_param('temp_redir_url');
     // Normal Redirection URL:
     param('goal_redir_url', 'string');
     if ($this->get('temp_redir_url') != '') {
         // Normal Redirection URL is required when Temporary Redirection URL is not empty
         param_check_not_empty('goal_redir_url', T_('Please enter Normal Redirection URL.'));
     }
     $this->set_from_Request('redir_url');
     if ($this->get('temp_redir_url') != '' && $this->get('temp_redir_url') == $this->get('redir_url')) {
         // Compare normal and temp urls
         param_error('goal_temp_redir_url', T_('Temporary Redirection URL should not be equal to Normal Redirection URL'));
         param_error('goal_redir_url', NULL, '');
     }
     // Temporary Start
     $temp_start_date = param_date('goal_temp_start_date', T_('Please enter a valid date.'), false);
     if (!empty($temp_start_date)) {
         $temp_start_time = param('goal_temp_start_time', 'string');
         $temp_start_time = empty($temp_start_time) ? '00:00:00' : param_time('goal_temp_start_time');
         $this->set('temp_start_ts', form_date($temp_start_date, $temp_start_time));
     } else {
         $this->set('temp_start_ts', NULL);
     }
     // Temporary End
     $temp_end_date = param_date('goal_temp_end_date', T_('Please enter a valid date.'), false);
     if (!empty($temp_end_date)) {
         $temp_end_time = param('goal_temp_end_time', 'string');
         $temp_end_time = empty($temp_end_time) ? '00:00:00' : param_time('goal_temp_end_time');
         $this->set('temp_end_ts', form_date($temp_end_date, $temp_end_time));
     } else {
         $this->set('temp_end_ts', NULL);
     }
     if ($this->get('temp_start_ts') !== NULL && $this->get('temp_end_ts') !== NULL && strtotime($this->get('temp_start_ts')) >= strtotime($this->get('temp_end_ts'))) {
         // Compare Start and End dates
         param_error('goal_temp_start_date', NULL, '');
         param_error('goal_temp_start_time', NULL, '');
         param_error('goal_temp_end_date', NULL, '');
         param_error('goal_temp_end_time', T_('Temporary Start Date/Time should not be greater than Temporary End Date/Time'));
     }
     // Default value:
     param('goal_default_value', 'string');
     param_check_decimal('goal_default_value', T_('Default value must be a number.'));
     $this->set_from_Request('default_value', 'goal_default_value', true);
     // Notes
     param('goal_notes', 'text');
     $this->set_from_Request('notes', 'goal_notes');
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:63,代码来源:_goal.class.php


示例14: param_check_html

/**
 * Checks for sanitized code.
 *
 * WARNING: this does *NOT* (necessarilly) make the HTML code safe.
 * It only checks on it and produces error messages.
 * It is NOT (necessarily) safe to use the output.
 *
 * @param string param name
 * @param string error message
 * @return boolean|string
 */
function param_check_html($var, $err_msg = '#', $field_err_msg = '#', $autobr = 0)
{
    global $Messages;
    $altered_html = check_html_sanity($GLOBALS[$var], 'posting', $autobr);
    if ($altered_html === false) {
        // We have errors, do not keep sanitization attemps:
        if ($err_msg == '#') {
            $err_msg = T_('Invalid XHTML.');
        }
        if ($field_err_msg == '#') {
            $field_err_msg = T_('Invalid XHTML.');
        }
        param_error($var, $err_msg, $field_err_msg);
        return false;
    }
    // Keep the altered HTML (balanced tags, etc.) - NOT necessarily safe if loose checking has been allowed.
    $GLOBALS[$var] = $altered_html;
    return $altered_html;
}
开发者ID:LFSF,项目名称:oras,代码行数:30,代码来源:_param.funcs.php


示例15: profile_check_params

/**
 * Check profile parameters and add errors through {@link param_error()}.
 *
 * @param array associative array.
 *     Either array( $value, $input_name ) or just $value;
 *     ($input_name gets used for associating it to a form fieldname)
 *     - 'login': check for non-empty
 *     - 'nickname': check for non-empty
 *     - 'icq': must be a number
 *     - 'email': mandatory, must be well formed
 *     - 'url': must be well formed, in allowed scheme, not blacklisted
 *     - 'pass1' / 'pass2': passwords (twice), must be the same and not == login (if given)
 *     - 'pass_required': false/true (default is true)
 * @param User|NULL A user to use for additional checks (password != login/nick).
 */
function profile_check_params($params, $User = NULL)
{
    global $Messages, $Settings;
    foreach ($params as $k => $v) {
        // normalize params:
        if ($k != 'pass_required' && !is_array($v)) {
            $params[$k] = array($v, $k);
        }
    }
    // checking login has been typed:
    if (isset($params['login']) && empty($params['login'][0])) {
        param_error('login', T_('Please enter a login.'));
    }
    // checking the nickname has been typed
    if (isset($params['nickname']) && empty($params['nickname'][0])) {
        param_error($params['nickname'][1], T_('Please enter a nickname (can be the same as your login).'));
    }
    // if the ICQ UIN has been entered, check to see if it has only numbers
    if (!empty($params['icq'][0])) {
        if (!preg_match('#^[0-9]+$#', $params['icq'][0])) {
            param_error($params['icq'][1], T_('The ICQ UIN can only be a number, no letters allowed.'));
        }
    }
    // checking e-mail address
    if (isset($params['email'][0])) {
        if (empty($params['email'][0])) {
            param_error($params['email'][1], T_('Please enter an e-mail address.'));
        } elseif (!is_email($params['email'][0])) {
            param_error($params['email'][1], T_('The email address is invalid.'));
        }
    }
    // Checking URL:
    if (isset($params['url'])) {
        if ($error = validate_url($params['url'][0], 'commenting')) {
            param_error($params['url'][1], T_('Supplied URL is invalid: ') . $error);
        }
    }
    // Check passwords:
    $pass_required = isset($params['pass_required']) ? $params['pass_required'] : true;
    if (isset($params['pass1'][0]) && isset($params['pass2'][0])) {
        if ($pass_required || !empty($params['pass1'][0]) || !empty($params['pass2'][0])) {
            // Password is required or was given
            // checking the password has been typed twice
            if (empty($params['pass1'][0]) || empty($params['pass2'][0])) {
                param_error($params['pass2'][1], T_('Please enter your password twice.'));
            }
            // checking the password has been typed twice the same:
            if ($params['pass1'][0] !== $params['pass2'][0]) {
                param_error($params['pass1'][1], T_('You typed two different passwords.'));
            } elseif (strlen($params['pass1'][0]) < $Settings->get('user_minpwdlen')) {
                param_error($params['pass1'][1], sprintf(T_('The minimum password length is %d characters.'), $Settings->get('user_minpwdlen')));
            } elseif (isset($User) && $params['pass1'][0] == $User->get('login')) {
                param_error($params['pass1'][1], T_('The password must be different from your login.'));
            } elseif (isset($User) && $params['pass1'][0] == $User->get('nickname')) {
                param_error($params['pass1'][1], T_('The password must be different from your nickname.'));
            }
        }
    }
}
开发者ID:LFSF,项目名称:oras,代码行数:74,代码来源:_user.funcs.php


示例16: wpxml_check_file

/**
 * Check WordPress XML file for correct format
 *
 * @param string File path
 * @param boolean TRUE - halt on errors
 */
function wpxml_check_file($file, $halt = false)
{
    $internal_errors = libxml_use_internal_errors(true);
    $xml = simplexml_load_file($file);
    if (!$xml) {
        // halt/display if loading produces an error
        if ($halt) {
            debug_die('There was an error when reading this WXR file');
        } else {
            param_error('wp_file', T_('There was an error when reading this WXR file'));
        }
    }
    $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
    if (!$wxr_version) {
        if ($halt) {
            debug_die('This does not appear to be a WXR file, missing/invalid WXR version number');
        } else {
            param_error('wp_file', T_('This does not appear to be a WXR file, missing/invalid WXR version number'));
        }
    }
    $wxr_version = (string) trim($wxr_version[0]);
    if (!preg_match('/^\\d+\\.\\d+$/', $wxr_version)) {
        // confirm that we are dealing with the correct file format
        if ($halt) {
            debug_die('This does not appear to be a WXR file, missing/invalid WXR version number');
        } else {
            param_error('wp_file', T_('This does not appear to be a WXR file, missing/invalid WXR version number'));
        }
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:36,代码来源:_wp.funcs.php


示例17: param_error

				UPDATE T_plugins
				   SET plug_name = NULL,
				       plug_shortdesc = NULL
				 WHERE plug_ID = ' . $plugin_ID);
        // Code:
        $updated = $admin_Plugins->set_code($edit_Plugin->ID, $edited_plugin_code);
        if (is_string($updated)) {
            // error message
            param_error('edited_plugin_code', $updated);
            $action = 'edit_settings';
        } elseif ($updated === 1) {
            $Messages->add(T_('Plugin code updated.'), 'success');
        }
        // Priority:
        if (!preg_match('~^1?\\d?\\d$~', $edited_plugin_priority)) {
            param_error('edited_plugin_priority', T_('Plugin priority must be numeric (0-100).'));
        } else {
            $updated = $admin_Plugins->set_priority($edit_Plugin->ID, $edited_plugin_priority);
            if ($updated === 1) {
                $Messages->add(T_('Plugin priority updated.'), 'success');
            }
        }
        // PluginSettings:
        if ($edit_Plugin->Settings) {
            if ($edit_Plugin->Settings->restore_defaults()) {
                $Messages->add(T_('Restored default values.'), 'success');
            } else {
                $Messages->add(T_('Settings have not changed.'), 'note');
            }
        }
        // Enable all events:
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:plugins.ctrl.php


示例18: load_from_Request

    /**
     * Load data from Request form fields.
     *
     * @return boolean true if loaded data seems valid.
     */
    function load_from_Request()
    {
        global $DB, $Settings, $UserSettings, $GroupCache, $Messages, $action;
        global $current_User, $Session, $localtimenow;
        $is_new_user = $this->ID == 0;
        // ---- Login checking / START ----
        $edited_user_login = param('edited_user_login', 'string');
        if (empty($edited_user_login)) {
            // Empty login
            param_error('edited_user_login', T_('Please enter your login.'));
        }
        param_check_valid_login('edited_user_login');
        $UserCache =& get_UserCache();
        $UserLogin = $UserCache->get_by_login($edited_user_login);
        if ($UserLogin && $UserLogin->ID != $this->ID) {
            // The login is already registered
            $login_error_message = T_('This login already exists.');
            if ($current_User->check_perm('users', 'edit')) {
                $login_error_message = sprintf(T_('This login &laquo;%s&raquo; already exists. Do you want to <a %s>edit the existing user</a>?'), $edited_user_login, 'href="' . get_user_settings_url('profile', $UserLogin->ID) . '"');
            }
            param_error('edited_user_login', $login_error_message);
        }
        if (!param_has_error('edited_user_login')) {
            // We want all logins to be lowercase to guarantee uniqueness regardless of the database case handling for UNIQUE indexes:
            $this->set_from_Request('login', 'edited_user_login', true, 'utf8_strtolower');
        }
        // ---- Login checking / END ----
        $is_identity_form = param('identity_form', 'boolean', false);
        $is_admin_form = param('admin_form', 'boolean', false);
        $has_full_access = $current_User->check_perm('users', 'edit');
        $has_moderate_access = $current_User->check_perm('users', 'moderate');
        // ******* Admin form or new user create ******* //
        // In both cases current user must have users edit permission!
        if (($is_admin_form || $is_identity_form && $is_new_user) && $has_moderate_access) {
            // level/group and email options are displayed on identity form only when crea 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP param_errors_detected函数代码示例发布时间:2022-05-15
下一篇:
PHP param_check_not_empty函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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