/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // Name param_string_not_empty('pst_name', T_('Please enter a name.')); $this->set_from_Request('name'); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // Name param_string_not_empty('ufgp_name', T_('Please enter a group name.')); $this->set_from_Request('name'); // Order param_string_not_empty('ufgp_order', T_('Please enter an order number.')); $this->set_from_Request('order'); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // get new ID if (param('new_ptyp_ID', 'string', NULL) !== NULL) { param_check_number('new_ptyp_ID', T_('ID must be a number.'), true); $this->set_from_Request('ID', 'new_ptyp_ID'); } // Name param_string_not_empty('ptyp_name', T_('Please enter a name.')); $this->set_from_Request('name'); return !param_errors_detected(); }
/** * 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(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_request() { global $DB; parent::load_from_Request(); // Check url name if (param_string_not_empty('cat_urlname', T_('Please enter an urlname.'))) { $this->set_from_Request('urlname'); if (!preg_match('|^[A-Za-z0-9\\-]+$|', $this->urlname) || preg_match('|^[A-Za-z][0-9]*$|', $this->urlname)) { param_error('cat_urlname', T_('The url name is invalid.')); } else { if (Chapter::urlname_exists($this->urlname, $this->ID)) { // urlname is already in use param_error('cat_urlname', T_('This URL name is already in use by another category. Please choose another name.')); } } } return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // Address global $emadr_address; param_string_not_empty('emadr_address', T_('Please enter email address.')); $emadr_address = utf8_strtolower(get_param('emadr_address')); param_check_email('emadr_address', true); if ($existing_emadr_ID = $this->dbexists('emadr_address', get_param('emadr_address'))) { // Check if a email address already exists with the same address global $admin_url; param_error('emadr_address', sprintf(T_('This email address already exists. Do you want to <a %s>edit the existing email address</a>?'), 'href="' . $admin_url . '?ctrl=email&tab=blocked&emadr_ID=' . $existing_emadr_ID . '"')); } $this->set_from_Request('address'); // Status $emadr_status = param('emadr_status', 'string', true); if (!empty($emadr_status)) { $this->set('status', $emadr_status); } // Sent count param('emadr_sent_count', 'integer', ''); param_check_number('emadr_sent_count', T_('The count must be a number.'), true); $this->set_from_Request('sent_count', 'emadr_sent_count', true); // Sent count since last error param('emadr_sent_last_returnerror', 'integer', ''); param_check_number('emadr_sent_last_returnerror', T_('The count must be a number.'), true); $this->set_from_Request('sent_last_returnerror', 'emadr_sent_last_returnerror', true); // Permanent errors count param('emadr_prmerror_count', 'integer', ''); param_check_number('emadr_prmerror_count', T_('The count must be a number.'), true); $this->set_from_Request('prmerror_count', 'emadr_prmerror_count', true); // Permanent errors count param('emadr_tmperror_count', 'integer', ''); param_check_number('emadr_tmperror_count', T_('The count must be a number.'), true); $this->set_from_Request('tmperror_count', 'emadr_tmperror_count', true); // Permanent errors count param('emadr_spamerror_count', 'integer', ''); param_check_number('emadr_spamerror_count', T_('The count must be a number.'), true); $this->set_from_Request('spamerror_count', 'emadr_spamerror_count', true); // Permanent errors count param('emadr_othererror_count', 'integer', ''); param_check_number('emadr_othererror_count', T_('The count must be a number.'), true); $this->set_from_Request('othererror_count', 'emadr_othererror_count', true); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { param_string_not_empty('dom_name', T_('Please enter domain name.')); $dom_name = get_param('dom_name'); $this->set('name', $dom_name); $dom_status = param('dom_status', 'string', true); $this->set('status', $dom_status, true); $dom_type = param('dom_type', 'string', true); $this->set('type', $dom_type, true); if (!param_errors_detected()) { // Check domains with the same name and type global $Messages, $DB; $SQL = new SQL(); $SQL->SELECT('dom_ID'); $SQL->FROM('T_basedomains'); $SQL->WHERE('dom_ID != ' . $this->ID); $SQL->WHERE_and('dom_name = ' . $DB->quote($dom_name)); $SQL->WHERE_and('dom_type = ' . $DB->quote($dom_type)); if ($DB->get_var($SQL->get())) { $Messages->add(T_('Domain already exists with the same name and type.')); } } return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // get new ID if (param('new_ityp_ID', 'string', NULL) !== NULL) { param_check_number('new_ityp_ID', T_('ID must be a number.'), true); $this->set_from_Request('ID', 'new_ityp_ID'); } // Name if (!$this->is_special()) { // Update the name only of not special post types param_string_not_empty('ityp_name', T_('Please enter a name.')); $this->set_from_Request('name'); } // Description param('ityp_description', 'text'); $this->set_from_Request('description', NULL, true); // Permission level param('ityp_perm_level', 'string'); $this->set_from_Request('perm_level'); // Back-office tab param('ityp_backoffice_tab', 'string'); $this->set_from_Request('backoffice_tab', NULL, true); // Template name param('ityp_template_name', 'string'); $this->set_from_Request('template_name', NULL, true); // Use title param('ityp_use_title', 'string'); $this->set_from_Request('use_title'); // Use URL param('ityp_use_url', 'string'); $this->set_from_Request('use_url'); // Use Parent ID param('ityp_use_parent', 'string'); $this->set_from_Request('use_parent'); // Use text param('ityp_use_text', 'string'); $this->set_from_Request('use_text'); // Allow HTML param('ityp_allow_html', 'integer', 0); $this->set_from_Request('allow_html'); // Allow Teaser and Page breaks param('ityp_allow_breaks', 'integer', 0); $this->set_from_Request('allow_breaks'); // Allow attachments param('ityp_allow_attachments', 'integer', 0); $this->set_from_Request('allow_attachments'); // Use excerpt param('ityp_use_excerpt', 'string'); $this->set_from_Request('use_excerpt'); // Use title tag param('ityp_use_title_tag', 'string'); $this->set_from_Request('use_title_tag'); // Use meta description param('ityp_use_meta_desc', 'string'); $this->set_from_Request('use_meta_desc'); // Use meta keywords param('ityp_use_meta_keywds', 'string'); $this->set_from_Request('use_meta_keywds'); // Use tags param('ityp_use_tags', 'string'); $this->set_from_Request('use_tags'); // Allow featured param('ityp_allow_featured', 'integer', 0); $this->set_from_Request('allow_featured'); // Use country, region, sub-region, city: $use_country = param('ityp_use_country', 'string', 'never'); $use_region = param('ityp_use_region', 'string', 'never'); $use_sub_region = param('ityp_use_sub_region', 'string', 'never'); $use_city = param('ityp_use_city', 'string', 'never'); if ($use_city == 'required') { // If city is required - all location fields also are required $use_country = $use_region = $use_sub_region = 'required'; } else { if ($use_sub_region == 'required') { // If subregion is required - country & region fields also are required $use_country = $use_region = 'required'; } else { if ($use_region == 'required') { // If region is required - country field also is required $use_country = 'required'; } } } $this->set('use_country', $use_country); $this->set('use_region', $use_region); $this->set('use_sub_region', $use_sub_region); $this->set('use_city', $use_city); // Use coordinates param('ityp_use_coordinates', 'string'); $this->set_from_Request('use_coordinates'); // Use custom fields param('ityp_use_custom_fields', 'integer', 0); $this->set_from_Request('use_custom_fields'); // Use comments param('ityp_use_comments', 'integer', 0); $this->set_from_Request('use_comments'); // Allow closing comments param('ityp_allow_closing_comments', 'integer', 0); $this->set_from_Request('allow_closing_comments'); // Allow disabling comments param('ityp_allow_disabling_comments', 'integer', 0); $this->set_from_Request('allow_disabling_comments'); // Use comment expiration param('ityp_use_comment_expiration', 'string'); $this->set_from_Request('use_comment_expiration'); // Load custom fields from request $this->load_custom_fields_from_Request(); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // Group param_string_not_empty('ufdf_ufgp_ID', T_('Please select a group.')); $this->set_from_Request('ufgp_ID'); // Type param_string_not_empty('ufdf_type', T_('Please enter a type.')); $this->set_from_Request('type'); // Name param_string_not_empty('ufdf_name', T_('Please enter a name.')); $this->set_from_Request('name'); // Options if (param('ufdf_type', 'string') == 'list') { // Save 'Options' only for Field type == 'Option list' $ufdf_options = explode("\n", param('ufdf_options', 'text')); if (count($ufdf_options) < 2) { // We don't want save an option list with one item param_error('ufdf_options', T_('Please enter at least 2 options on 2 different lines.')); } $this->set_from_Request('options'); } // Required param_string_not_empty('ufdf_required', 'Please select Hidden, Optional, Recommended or Required.'); $this->set_from_Request('required'); // Duplicated param_string_not_empty('ufdf_duplicated', 'Please select Forbidden, Allowed or List style.'); $this->set_from_Request('duplicated'); // Order if ($this->group_ID != $this->ufgp_ID) { // Group is changing, set order as last $this->set('order', $this->get_last_order($this->ufgp_ID)); } // Suggest if (param('ufdf_type', 'string') == 'word') { // Save 'Suggest values' only for Field type == 'Single word' param('ufdf_suggest', 'integer', 0); $this->set_from_Request('suggest'); } // Bubbletip param('ufdf_bubbletip', 'text', ''); $this->set_from_Request('bubbletip'); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // Group $old_group_ID = $this->ufgp_ID; // Save old group ID to know if it was changed param_string_not_empty('ufdf_ufgp_ID', T_('Please select a group.')); $this->set_from_Request('ufgp_ID'); // Type param_string_not_empty('ufdf_type', T_('Please enter a type.')); $this->set_from_Request('type'); // Code $code = param('ufdf_code', 'string'); param_check_not_empty('ufdf_code', T_('Please provide a code to uniquely identify this field.')); param_check_regexp('ufdf_code', '#^[a-z0-9_]{1,20}$#', T_('The field code must contain only lowercase letters, digits or the "_" sign. 20 characters max.')); $this->set_from_Request('code'); // Name param_string_not_empty('ufdf_name', T_('Please enter a name.')); $this->set_from_Request('name'); // Icon name param('ufdf_icon_name', 'string'); $this->set_from_Request('icon_name', 'ufdf_icon_name', true); // Options if (param('ufdf_type', 'string') == 'list') { // Save 'Options' only for Field type == 'Option list' $ufdf_options = param('ufdf_options', 'text'); if (count(explode("\n", $ufdf_options)) < 2) { // We don't want save an option list with one item param_error('ufdf_options', T_('Please enter at least 2 options on 2 different lines.')); } elseif (utf8_strlen($ufdf_options) > 255) { // This may not happen in normal circumstances because the textarea max length is set to 255 chars // This extra check is for the case if js is not enabled or someone would try to directly edit the html param_error('ufdf_options', T_('"Options" field content can not be longer than 255 symbols.')); } $this->set('options', $ufdf_options); } // Required param_string_not_empty('ufdf_required', 'Please select Hidden, Optional, Recommended or Required.'); $this->set_from_Request('required'); // Duplicated param_string_not_empty('ufdf_duplicated', 'Please select Forbidden, Allowed or List style.'); $this->set_from_Request('duplicated'); // Order if ($old_group_ID != $this->ufgp_ID) { // Group is changing, set order as last $this->set('order', $this->get_last_order($this->ufgp_ID)); } // Suggest if (param('ufdf_type', 'string') == 'word') { // Save 'Suggest values' only for Field type == 'Single word' param('ufdf_suggest', 'integer', 0); $this->set_from_Request('suggest'); } // Bubbletip param('ufdf_bubbletip', 'text', ''); $this->set_from_Request('bubbletip', NULL, true); if (!param_errors_detected()) { // Field code must be unique, Check it only when no errors on the form if ($field_ID = $this->dbexists('ufdf_code', $this->get('code'))) { // We have a duplicate entry: param_error('ufdf_code', sprintf(T_('Another user field already uses this code. Do you want to <a %s>edit the existing user field</a>?'), 'href="?ctrl=userfields&action=edit&ufdf_ID=' . $field_ID . '"')); } } return !param_errors_detected(); }
$email_text = preg_replace('/<a[^>]+href="([^"]+)"[^>]*>[^<]*<\\/a>/i', ' [ $1 ] ', $email_html); $email_text = str_replace(array("\n", "\r", '</p><p>', '<p>', '</p>', '<br>', '<br />', '<br/>'), array('', '', "\n\n", "\n\n", "\n\n", "\n", "\n", "\n"), $email_text); $email_text = strip_tags($email_text); $edited_EmailCampaign->set('email_text', $email_text); $action = 'edit'; $tab = param('current_tab', 'string'); break; case 'test': // Send test email // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('campaign'); // Check permission: $current_User->check_perm('emails', 'edit', true); // Test email address param('test_email_address', 'string', ''); param_string_not_empty('test_email_address', T_('Please enter test email address')); param_check_email('test_email_address', T_('Test email address is incorrect')); // Store test email address in Session $Session->set('test_campaign_email', $test_email_address); $Session->dbsave(); // Check campaign before sending $edited_EmailCampaign->check(true, 'test'); $action = 'edit'; $tab = param('current_tab', 'string'); if (param_errors_detected()) { // Some errors were detected in the campaign's fields or test email address break; } // Send one test email if (!$edited_EmailCampaign->send_email($current_User->ID, $test_email_address, 'test')) { // Sending is failed
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { // Name param_string_not_empty('skin_name', T_('Please enter a name.')); $this->set_from_Request('name'); // Skin type param('skin_type', 'string'); $this->set_from_Request('type'); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_request() { param_string_not_empty('cat_name', T_('Please enter a name.')); $this->set_from_Request('name'); if (param('cat_parent_ID', 'integer', -1) !== -1) { // Set parent ID: $this->set_from_Request('parent_ID'); } // Check url name param('cat_urlname', 'string'); $this->set_from_Request('urlname'); // Check description param('cat_description', 'string'); $this->set_from_Request('description'); $cat_Blog =& $this->get_Blog(); if ($cat_Blog && $cat_Blog->get_setting('category_ordering') == 'manual') { // Manual ordering param('cat_order', 'integer', NULL); $this->set_from_Request('order', 'cat_order', true); } // Sort sub-categories param('cat_subcat_ordering', 'string'); $this->set_from_Request('subcat_ordering'); // Meta category $cat_meta = param('cat_meta', 'integer', 0); if ($this->has_posts() && $cat_meta) { // Display error message if we want make the meta category from category with posts global $Messages; $Messages->add(sprintf(T_('The category «%s» cannot be set as meta category. You must remove the posts it contains first.'), $this->dget('name'))); } else { // Save the category as 'Meta' only if it has no posts $this->set_from_Request('meta'); } // Locked category param('cat_lock', 'integer', 0); $this->set_from_Request('lock'); return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { if (param('ecmp_name', 'string', NULL) !== NULL) { // Name param_string_not_empty('ecmp_name', T_('Please enter a campaign name.')); $this->set_from_Request('name'); } if (param('ecmp_email_title', 'string', NULL) !== NULL) { // Email title param_string_not_empty('ecmp_email_title', T_('Please enter an email title.')); $this->set_from_Request('email_title'); } if (param('ecmp_email_html', 'html', NULL) !== NULL) { // Email HTML message param_check_html('ecmp_email_html', T_('Please enter an HTML message.')); $this->set_from_Request('email_html'); } if (param('ecmp_email_text', 'text', NULL) !== NULL) { // Email Plain- Text message $this->set_from_Request('email_text'); } return !param_errors_detected(); }
/** * Load data from Request form fields. * * @return boolean true if loaded data seems valid. */ function load_from_Request() { global $force_upload_forbiddenext; // 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 param_string_not_empty('ftyp_mimetype', T_('Please enter a mime type.')); $this->set_from_Request('mimetype'); // Icon for the mime type if (param('ftyp_icon', 'string', '')) { param_check_filename('ftyp_icon', T_('Please enter a file name.')); } $this->set_from_Request('icon'); // View type param('ftyp_viewtype', 'string'); $this->set_from_Request('viewtype'); // Allowed to upload theses extensions param('ftyp_allowed', 'integer', '0'); if ($GLOBALS['ftyp_allowed']) { // 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'] = 0; } } $this->set_from_Request('allowed'); return !param_errors_detected(); }