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


PHP param_check_not_empty函数代码示例

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


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

示例1: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $Messages, $localtimenow;
     // Group ID
     param('ivc_grp_ID', 'integer');
     param_check_not_empty('ivc_grp_ID', T_('Please select a group'));
     $this->set_from_Request('grp_ID', 'ivc_grp_ID', true);
     // Code
     param('ivc_code', 'string');
     param_check_not_empty('ivc_code', T_('You must provide an invitation code!'));
     param_check_regexp('ivc_code', '#^[A-Za-z0-9\\-_]{3,32}$#', T_('Invitation code must be from 3 to 32 letters, digits or signs "-", "_".'));
     $this->set_from_Request('code', 'ivc_code');
     // Expire date
     if (param_date('ivc_expire_date', T_('Please enter a valid date.'), true) && param_time('ivc_expire_time')) {
         // If date and time were both correct we may set the 'expire_ts' value
         $this->set('expire_ts', form_date(get_param('ivc_expire_date'), get_param('ivc_expire_time')));
     }
     // Source
     param('ivc_source', 'string');
     $this->set_from_Request('source', 'ivc_source', true);
     if (mysql2timestamp($this->get('expire_ts')) < $localtimenow) {
         // Display a warning if date is expired
         $Messages->add($this->ID == 0 ? T_('Note: The newly created invitation code is already expired') : T_('Note: The updated invitation code is already expired'), 'warning');
     }
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:_invitation.class.php

示例2: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Name
     param('org_name', 'string');
     param_check_not_empty('org_name', T_('You must provide a name!'));
     $this->set_from_Request('name', 'org_name');
     // Url
     param('org_url', 'string');
     param_check_url('org_url', 'commenting');
     $this->set_from_Request('url', 'org_url', true);
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:17,代码来源:_organization.class.php

示例3: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request($cron_job_names = array(), $cron_job_params = array())
 {
     if ($this->ID > 0 || get_param('ctsk_ID') > 0) {
         // Update or copy cron job
         $cjob_name = param('cjob_name', 'string', true);
         param_check_not_empty('cjob_name', T_('Please enter job name'));
     } else {
         // Create new cron job
         $cjob_type = param('cjob_type', 'string', true);
         if (!isset($cron_job_params[$cjob_type])) {
             // This cron job type doesn't exist, so this is an invalid state
             debug_die('Invalid job type received');
             $cjob_name = '';
         } else {
             $cjob_name = $cron_job_names[$cjob_type];
         }
     }
     // start datetime:
     param_date('cjob_date', T_('Please enter a valid date.'), true);
     param_time('cjob_time');
     $this->set('start_datetime', form_date(get_param('cjob_date'), get_param('cjob_time')));
     // repeat after:
     $cjob_repeat_after = param_duration('cjob_repeat_after');
     if ($cjob_repeat_after == 0) {
         $cjob_repeat_after = NULL;
     }
     $this->set('repeat_after', $cjob_repeat_after);
     // name:
     if (!empty($cjob_name) && $cjob_name != $this->get('name')) {
         $this->set('name', $cjob_name);
     }
     if ($this->ID == 0 && get_param('ctsk_ID') == 0) {
         // Set these params only on creating and copying actions
         // controller:
         $this->set('controller', $cron_job_params[$cjob_type]['ctrl']);
         // params:
         $this->set('params', $cron_job_params[$cjob_type]['params']);
     }
     return !param_errors_detected();
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:45,代码来源:_cronjob.class.php

示例4: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $Messages, $demo_mode;
     // Edited Group Name
     param('edited_grp_name', 'string');
     param_check_not_empty('edited_grp_name', T_('You must provide a group name!'));
     $this->set_from_Request('name', 'edited_grp_name', true);
     // Edited Group Permission Blogs
     param('edited_grp_perm_blogs', 'string', true);
     $this->set_from_Request('perm_blogs', 'edited_grp_perm_blogs', true);
     $apply_antispam = param('apply_antispam', 'integer', 0) ? 0 : 1;
     $perm_xhtmlvalidation = param('perm_xhtmlvalidation', 'string', true);
     $perm_xhtmlvalidation_xmlrpc = param('perm_xhtmlvalidation_xmlrpc', 'string', true);
     $prevent_css_tweaks = param('prevent_css_tweaks', 'integer', 0) ? 0 : 1;
     $prevent_iframes = param('prevent_iframes', 'integer', 0) ? 0 : 1;
     $prevent_javascript = param('prevent_javascript', 'integer', 0) ? 0 : 1;
     $prevent_objects = param('prevent_objects', 'integer', 0) ? 0 : 1;
     if ($demo_mode && ($apply_antispam || $perm_xhtmlvalidation != 'always' && $perm_xhtmlvalidation_xmlrpc != 'always' || $prevent_css_tweaks || $prevent_iframes || $prevent_javascript || $prevent_objects)) {
         // Demo mode restriction: Do not allow to change these settings in demo mode, because it may lead to security problem!
         $Messages->add('Validation settings and security filters are not editable in demo mode!', 'error');
     } else {
         // Apply Antispam
         $this->set('perm_bypass_antispam', $apply_antispam);
         // XHTML Validation
         $this->set('perm_xhtmlvalidation', $perm_xhtmlvalidation);
         // XHTML Validation XMLRPC
         $this->set('perm_xhtmlvalidation_xmlrpc', $perm_xhtmlvalidation_xmlrpc);
         // CSS Tweaks
         $this->set('perm_xhtml_css_tweaks', $prevent_css_tweaks);
         // Iframes
         $this->set('perm_xhtml_iframes', $prevent_iframes);
         // Javascript
         $this->set('perm_xhtml_javascript', $prevent_javascript);
         // Objects
         $this->set('perm_xhtml_objects', $prevent_objects);
     }
     // Stats
     $this->set('perm_stats', param('edited_grp_perm_stats', 'string', true));
     // Load pluggable group permissions from request
     $GroupSettings =& $this->get_GroupSettings();
     foreach ($GroupSettings->permission_values as $name => $value) {
         // We need to handle checkboxes and radioboxes separately , because when a checkbox isn't checked the checkbox variable is not sent
         if ($name == 'perm_createblog' || $name == 'perm_getblog' || $name == 'perm_templates') {
             // These two permissions are represented by checkboxes, all other pluggable group permissions are represented by radiobox.
             $value = param('edited_grp_' . $name, 'string', 'denied');
         } elseif (($name == 'perm_admin' || $name == 'perm_users') && $this->ID == 1) {
             // Admin group has always admin perm, it can not be set or changed.
             continue;
         } else {
             $value = param('edited_grp_' . $name, 'string', '');
         }
         if ($value != '' || $name == 'max_new_threads') {
             // if radio is not set, then doesn't change the settings
             $GroupSettings->set($name, $value, $this->ID);
         }
     }
     return !param_errors_detected();
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:63,代码来源:_group.class.php

示例5: phpbb_set_var

         break;
     }
     // Save DB config of phpBB in the session
     phpbb_set_var('db_config', $phpbb_db_config);
     phpbb_set_var('blog_ID', $forum_blog_ID);
     phpbb_set_var('path_avatars', $phpbb_path_avatars);
     $step = 'groups';
     break;
 case "users":
     // Action for Step 2
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('phpbb');
     $phpbb_ranks = param('phpbb_ranks', 'array/integer', array());
     $phpbb_group_default = param('phpbb_group_default', 'integer');
     $phpbb_group_invalid = param('phpbb_group_invalid', 'integer');
     param_check_not_empty('phpbb_group_default', T_('Please select a default group!'));
     phpbb_set_var('ranks', $phpbb_ranks);
     phpbb_set_var('group_default', $phpbb_group_default);
     phpbb_set_var('group_invalid', $phpbb_group_invalid);
     $phpbb_categories = param('phpbb_categories', 'array/integer', array());
     $phpbb_forums = param('phpbb_forums', 'array/integer', array());
     phpbb_set_var('import_categories', $phpbb_categories);
     phpbb_set_var('import_forums', $phpbb_forums);
     if (empty($phpbb_categories) && empty($phpbb_forums)) {
         $Messages->add(T_('Please select at least one forum to import!'));
     }
     if (param_errors_detected()) {
         $step = 'groups';
         break;
     }
     // Set this action to complete all processes in the form
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:phpbbimport.ctrl.php

示例6: create_contacts_group_users

/**
 * Insert users for contacts group into database
 *
 * @param integer/string Group ID or 'new'
 * @param string Users IDs separated with comma
 * @param string Name of input element with new group name
 * @return array/boolean Array( 'count_users', 'group_name' ) if success, else false
 */
function create_contacts_group_users($group, $users, $new_group_field_name = 'group_combo')
{
    global $DB, $current_User, $Messages;
    $users_IDs = explode(',', $users);
    if (count($users_IDs) == 0 || strlen($users) == 0) {
        // No selected users
        $Messages->add(T_('Please select at least one user.'), 'error');
        return false;
    }
    if ($group == 'new' || (int) $group < 0) {
        // Add new group
        if ((int) $group < 0) {
            // Default group
            $default_groups = get_contacts_groups_default();
            if (isset($default_groups[$group])) {
                // Get group name
                $group_name = $default_groups[$group];
            } else {
                // Error
                $Messages->add('No found this group.', 'error');
                return false;
            }
        } else {
            // New entered group
            $group_name = param($new_group_field_name, 'string', true);
            param_check_not_empty($new_group_field_name, T_('Please enter name for new group.'));
        }
        if ($group_ID = create_contacts_group($group_name)) {
            // Create group
            $Messages->add(T_('New contacts group has been created.'), 'success');
        } else {
            // Errors
            return false;
        }
    } else {
        // Existing group
        $group_ID = (int) $group;
        if ($group_ID == 0) {
            // No defined group ID
            return false;
        }
        $SQL = new SQL();
        $SQL->SELECT('cgr_name AS name');
        $SQL->FROM('T_messaging__contact_groups');
        $SQL->WHERE('cgr_user_ID = ' . $current_User->ID);
        $SQL->WHERE_and('cgr_ID = ' . $DB->quote($group_ID));
        $group = $DB->get_row($SQL->get());
        if (is_null($group)) {
            // User try use a group of another user
            return false;
        }
        $group_name = $group->name;
    }
    // Get all Users IDs of selected group in order to exclude duplicates
    $SQL = new SQL();
    $SQL->SELECT('cgu_user_ID, cgu_cgr_ID');
    $SQL->FROM('T_messaging__contact_groupusers');
    $SQL->WHERE_and('cgu_cgr_ID = ' . $DB->quote($group_ID));
    $users_already_grouped = $DB->get_assoc($SQL->get());
    $sql = 'INSERT INTO T_messaging__contact_groupusers ( cgu_user_ID, cgu_cgr_ID ) VALUES ';
    $records = array();
    foreach ($users_IDs as $user_ID) {
        $user_ID = (int) trim($user_ID);
        if ($user_ID == 0) {
            // User ID is empty
            continue;
        } else {
            if (isset($users_already_grouped[$user_ID])) {
                if ($users_already_grouped[$user_ID] == $group_ID) {
                    // This user already is added in selected group
                    continue;
                }
            }
        }
        $records[] = '( ' . $user_ID . ', ' . $DB->quote($group_ID) . ' )';
    }
    $sql .= implode(', ', $records);
    if (count($records) == 0) {
        // No data to add
        return false;
    }
    if ($DB->query($sql, 'Insert users for contacts group')) {
        // Success query
        return array('count_users' => count($records), 'group_name' => $group_name);
    } else {
        // Failed query
        return false;
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:97,代码来源:_messaging.funcs.php

示例7: 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 creating a new user.
            if ($this->ID != 1) {
                // the admin user group can't be changed
                param_integer_range('edited_user_level', 0, 10, T_('User level must be between %d and %d.'));
                $this->set_from_Request('level', 'edited_user_level', true);
                $edited_user_Group = $GroupCache->get_by_ID(param('edited_user_grp_ID', 'integer'));
                if ($has_full_access || $has_moderate_access && $edited_user_Group->get('level') < $current_User->get_Group()->get('level')) {
                    $this->set_Group($edited_user_Group);
                }
            }
            param('edited_user_source', 'string', true);
            $this->set_from_Request('source', 'edited_user_source', true);
            // set email, without changing the user status
            $edited_user_email = utf8_strtolower(param('edited_user_email', 'string', true));
            param_check_not_empty('edited_user_email', T_('Please enter your e-mail address.'));
            param_check_email('edited_user_email', true);
            $this->set_email($edited_user_email, false);
            if ($is_admin_form) {
                // Admin form
                $notification_sender_email = utf8_strtolower(param('notification_sender_email', 'string', true));
                param_check_email('notification_sender_email');
                if (!empty($notification_sender_email)) {
                    // Change a value of setting
                    $UserSettings->set('notification_sender_email', $notification_sender_email, $this->ID);
                } elseif ($UserSettings->get('notification_sender_email', $this->ID) != '') {
                    // Delete a setting record from DB
                    $UserSettings->delete('notification_sender_email', $this->ID);
                }
                $notification_sender_name = param('notification_sender_name', 'string', true);
                if (!empty($notification_sender_name)) {
                    // Change a value of setting
                    $UserSettings->set('notification_sender_name', $notification_sender_name, $this->ID);
                } elseif ($UserSettings->get('notification_sender_name', $this->ID) != '') {
                    // Delete a setting record from DB
                    $UserSettings->delete('notification_sender_name', $this->ID);
                }
                if ($has_full_access && !isset($this->dbchanges['user_email'])) {
                    // If email address is not changed
                    // Update status of email address in the T_email_address table
                    $edited_email_status = param('edited_email_status', 'string');
                    $EmailAddressCache =& get_EmailAddressCache();
                    $EmailAddress =& $EmailAddressCache->get_by_name($this->get('email'), false, false);
                    if (!$EmailAddress && $edited_email_status != 'unknown') {
                        // Create new record in the T_email_address table
                        $EmailAddress = new EmailAddress();
                        $EmailAddress->set('address', $this->get('email'));
                    }
                    if (!empty($EmailAddress)) {
                        // Save status of an email address
                        $EmailAddress->set('status', $edited_email_status);
                        $EmailAddress->dbsave();
                    }
                }
                if ($current_User->check_perm('spamblacklist', 'edit')) {
                    // User can edit IP ranges
                    // Update status of IP range in DB
                    $edited_iprange_status = param('edited_iprange_status', 'string');
                    $IPRangeCache =& get_IPRangeCache();
                    $IPRange =& $IPRangeCache->get_by_ip(int2ip($UserSettings->get('created_fromIPv4', $this->ID)));
                    if (!$IPRange && !empty($edited_iprange_status)) {
                        // IP range doesn't exist in DB, Create new record
//.........这里部分代码省略.........
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:101,代码来源:_user.class.php

示例8: param

 /** Email notifications **/
 // Sender email address
 $sender_email = param('notification_sender_email', 'string', '');
 param_check_email('notification_sender_email', true);
 $Settings->set('notification_sender_email', $sender_email);
 // Return path
 $return_path = param('notification_return_path', 'string', '');
 param_check_email('notification_return_path', true);
 $Settings->set('notification_return_path', $return_path);
 // Sender name
 $sender_name = param('notification_sender_name', 'string', '');
 param_check_not_empty('notification_sender_name');
 $Settings->set('notification_sender_name', $sender_name);
 // Site short name
 $short_name = param('notification_short_name', 'string', '');
 param_check_not_empty('notification_short_name');
 $Settings->set('notification_short_name', $short_name);
 // Site long name
 $Settings->set('notification_long_name', param('notification_long_name', 'string', ''));
 // Site logo url
 $Settings->set('notification_logo', param('notification_logo', 'string', ''));
 /** Settings to decode the returned emails **/
 param('repath_enabled', 'boolean', 0);
 $Settings->set('repath_enabled', $repath_enabled);
 param('repath_method', 'string', true);
 $Settings->set('repath_method', strtolower($repath_method));
 param('repath_server_host', 'string', true);
 $Settings->set('repath_server_host', evo_strtolower($repath_server_host));
 param('repath_server_port', 'integer', true);
 $Settings->set('repath_server_port', $repath_server_port);
 param('repath_encrypt', 'string', true);
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:email.ctrl.php

示例9: load_from_Request

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $Plugins, $msg_text, $Settings;
     $new_thread = empty($this->thread_ID);
     // Renderers:
     if (param('renderers_displayed', 'integer', 0)) {
         // use "renderers" value only if it has been displayed (may be empty)
         $renderers = $Plugins->validate_renderer_list(param('renderers', 'array:string', array()), array('Message' => &$this));
         $this->set_renderers($renderers);
     }
     // Text
     if ($Settings->get('allow_html_message')) {
         // HTML is allowed for messages
         $text_format = 'html';
     } else {
         // HTML is disallowed for messages
         $text_format = 'htmlspecialchars';
     }
     $msg_text = param('msg_text', $text_format);
     $this->original_text = html_entity_decode($msg_text);
     // This must get triggered before any internal validation and must pass all relevant params.
     $Plugins->trigger_event('MessageThreadFormSent', array('content' => &$msg_text, 'dont_remove_pre' => true, 'renderers' => $this->get_renderers_validated()));
     if (!$new_thread) {
         param_check_not_empty('msg_text');
     }
     if ($text_format == 'html') {
         // message text may contain html, check the html sanity
         param_check_html('msg_text', T_('Invalid message content.'));
     }
     $this->set('text', get_param('msg_text'));
     // Thread
     if ($new_thread) {
         $this->Thread->load_from_Request();
     } else {
         // this is a reply to an existing conversation, check if current User is allowed to reply
         $this->get_Thread();
         if ($this->Thread->check_allow_reply()) {
             // If reply is allowed we should check if this message is not a duplicate
             global $DB, $current_User;
             // Get last message of current user in this thread
             $SQL = new SQL();
             $SQL->SELECT('msg_text');
             $SQL->FROM('T_messaging__message');
             $SQL->WHERE('msg_thread_ID = ' . $this->Thread->ID);
             $SQL->WHERE_and('msg_author_user_ID = ' . $current_User->ID);
             $SQL->ORDER_BY('msg_ID DESC');
             $last_message = $DB->get_var($SQL->get());
             if ($last_message == $msg_text) {
                 param_error('msg_text', T_('It seems you tried to send the same message twice. We only kept one copy.'));
             }
         }
     }
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:59,代码来源:_message.class.php

示例10: load_from_Request

 /**
  * Load data from Request form fields.
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $thrd_recipients, $thrd_recipients_array;
     // Resipients
     $this->set_string_from_param('recipients', empty($thrd_recipients_array) ? true : false);
     // Title
     param('thrd_title', 'string');
     param_check_not_empty('thrd_title', T_('Please enter a subject'));
     $this->set_from_Request('title', 'thrd_title');
     // Message
     param_check_not_empty('msg_text', T_('Please enter a message'));
     $this->param_check__recipients('thrd_recipients', $thrd_recipients, $thrd_recipients_array);
     return !param_errors_detected();
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:18,代码来源:_thread.class.php

示例11: param

 * 1) 'file'
 * 2) 'import'
 */
param('action', 'string');
if (!empty($action)) {
    // Try to obtain some serious time to do some serious processing (15 minutes)
    set_max_execution_time(900);
    // Turn off the output buffering to do the correct work of the function flush()
    @ini_set('output_buffering', 'off');
}
switch ($action) {
    case 'import':
        // Check that this action request is not a CSRF hacked request:
        $Session->assert_received_crumb('wpxml');
        $wp_blog_ID = param('wp_blog_ID', 'integer', 0);
        param_check_not_empty('wp_blog_ID', T_('Please select a blog!'));
        // XML File
        $xml_file = param('wp_file', 'string', '');
        if (empty($xml_file)) {
            // File is not selected
            param_error('wp_file', T_('Please select file to import.'));
        } else {
            if (!preg_match('/\\.(xml|txt|zip)$/i', $xml_file)) {
                // Extension is incorrect
                param_error('wp_file', sprintf(T_('&laquo;%s&raquo; has an unrecognized extension.'), $xml_file));
            }
        }
        if (param_errors_detected()) {
            // Stop import if errors exist
            $action = 'file';
            break;
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:wpimportxml.ctrl.php

示例12: set_string_from_param

 /**
  * Set a string parameter from a Request form value.
  *
  * @param string Dataobject parameter name
  * @param boolean true to set to NULL if empty string value
  * @param string name of function used to clean up input
  * @param string name of fucntion used to validate input (TODO)
  * @return boolean true, if value is required
  */
 function set_string_from_param($parname, $required = false, $cleanup_function = NULL, $validation_function = NULL, $error_message = NULL)
 {
     $var = $this->dbprefix . $parname;
     $value = param($var, 'string');
     if (!empty($cleanup_function)) {
         // We want to apply a cleanup function:
         $GLOBALS[$var] = $value = $cleanup_function($value);
     }
     if ($required) {
         param_check_not_empty($var);
     }
     if ($validation_function != NULL) {
         param_validate($var, $validation_function, $required, $error_message);
     }
     return $this->set($parname, $value, !$required);
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:25,代码来源:_dataobject.class.php

示例13: param_action

if ($users_numbers['newsletter'] == 0) {
    // No users for newsletter
    $Messages->add(T_('No found active accounts which accept newsletter email. Please try to change the filter of users list.'), 'note');
}
param_action();
/*
 * Perform actions:
 */
switch ($action) {
    case 'preview':
        // Check that this action request is not a CSRF hacked request:
        $Session->assert_received_crumb('newsletter');
        param('title', 'string');
        param_check_not_empty('title', T_('Please enter a title.'));
        param('message', 'text');
        param_check_not_empty('message', T_('Please enter a message.'));
        $Session->set('newsletter_title', $title);
        $Session->set('newsletter_message', $message);
        $Session->dbsave();
        if ($Messages->has_errors()) {
            // Errors
            header_redirect($admin_url . '?ctrl=newsletter');
        }
        break;
    case 'send':
        // Check that this action request is not a CSRF hacked request:
        $Session->assert_received_crumb('newsletter');
        $Messages->add(T_('Newsletter is sending now, please see a report below...'), 'success');
        break;
}
$AdminUI->breadcrumbpath_init(false);
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:newsletter.ctrl.php

示例14: load_from_Request


//.........这里部分代码省略.........
            // Blog footer:
            param_check_html('single_item_footer_text', T_('Invalid single post footer'));
            $this->set_setting('single_item_footer_text', get_param('single_item_footer_text'));
        }
        if (param('xml_item_footer_text', 'html', NULL) !== NULL) {
            // Blog footer:
            param_check_html('xml_item_footer_text', T_('Invalid RSS footer'));
            $this->set_setting('xml_item_footer_text', get_param('xml_item_footer_text'));
        }
        if (param('blog_notes', 'html', NULL) !== NULL) {
            // HTML notes:
            param_check_html('blog_notes', T_('Invalid Blog Notes'));
            $this->set('notes', get_param('blog_notes'));
            param_integer_range('max_footer_credits', 0, 3, T_('Max credits must be between %d and %d.'));
            $this->set_setting('max_footer_credits', get_param('max_footer_credits'));
        }
        if (in_array('pings', $groups)) {
            // we want to load the ping checkboxes:
            $blog_ping_plugins = param('blog_ping_plugins', 'array:string', array());
            $blog_ping_plugins = array_unique($blog_ping_plugins);
            $this->set_setting('ping_plugins', implode(',', $blog_ping_plugins));
        }
        if (in_array('authors', $groups)) {
            // we want to load the workflow & permissions params
            $this->set_setting('use_workflow', param('blog_use_workflow', 'integer', 0));
        }
        if (in_array('home', $groups)) {
            // we want to load the front page params:
            $front_disp = param('front_disp', 'string', '');
            $this->set_setting('front_disp', $front_disp);
            $front_post_ID = param('front_post_ID', 'integer', 0);
            if ($front_disp == 'page') {
                // Post ID must be required
                param_check_not_empty('front_post_ID', T_('Please enter a specific post ID'));
            }
            $this->set_setting('front_post_ID', $front_post_ID);
        }
        if (in_array('features', $groups)) {
            // we want to load the workflow checkboxes:
            $this->set_setting('enable_goto_blog', param('enable_goto_blog', 'string', NULL));
            $this->set_setting('editing_goto_blog', param('editing_goto_blog', 'string', NULL));
            $this->set_setting('default_post_status', param('default_post_status', 'string', NULL));
            $this->set_setting('post_categories', param('post_categories', 'string', NULL));
            $this->set_setting('post_navigation', param('post_navigation', 'string', NULL));
            // Show x days or x posts?:
            $this->set_setting('what_to_show', param('what_to_show', 'string', ''));
            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('orderby', param('orderby', 'string', true));
            $this->set_setting('orderdir', param('orderdir', 'string', true));
            // Front office statuses
            $this->load_inskin_statuses('post');
            // Time frame
            $this->set_setting('timestamp_min', param('timestamp_min', 'string', ''));
            $this->set_setting('timestamp_min_duration', param_duration('timestamp_min_duration'));
            $this->set_setting('timestamp_max', param('timestamp_max', 'string', ''));
            $this->set_setting('timestamp_max_duration', param_duration('timestamp_max_duration'));
            // call modules update_collection_features on this blog
            modules_call_method('update_collection_features', array('edited_Blog' => &$this));
            // load post moderation statuses
            $moderation_statuses = get_visibility_statuses('moderation');
            $post_moderation_statuses = array();
            foreach ($moderation_statuses as $status) {
                if (param('post_notif_' . $status, 'integer', 0)) {
                    $post_moderation_statuses[] = $status;
                }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:67,代码来源:_blog.class.php

示例15: 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


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