/**
  * 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();
 }
 /**
  * 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();
 }
 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Name
     $this->set_string_from_param('name', true);
     // Shortcut
     $this->set_string_from_param('shortcut', true);
     // Code
     param('curr_code', 'string');
     param_check_regexp('curr_code', '#^[A-Za-z]{3}$#', T_('Currency code must be 3 letters.'));
     $this->set_from_Request('code', 'curr_code', true);
     return !param_errors_detected();
 }
 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Name
     $this->set_string_from_param('name', true);
     // Code
     param('ctry_code', 'string');
     param_check_regexp('ctry_code', '#^[A-Za-z]{2}$#', T_('Country code must be 2 letters.'));
     $this->set_from_Request('code', 'ctry_code');
     // Currency Id
     param('ctry_curr_ID', 'integer');
     param_check_number('ctry_curr_ID', T_('Please select a currency'));
     $this->set_from_Request('curr_ID', 'ctry_curr_ID', true);
     return !param_errors_detected();
 }
 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Country Id
     param('rgn_ctry_ID', 'integer', true);
     param_check_number('rgn_ctry_ID', T_('Please select a country'), true);
     $this->set_from_Request('ctry_ID', 'rgn_ctry_ID', true);
     // Name
     $this->set_string_from_param('name', true);
     // Code
     param('rgn_code', 'string');
     param_check_regexp('rgn_code', '#^[A-Za-z0-9]{1,6}$#', T_('Region code must be from 1 to 6 letters.'));
     $this->set_from_Request('code', 'rgn_code');
     return !param_errors_detected();
 }
Exemple #6
0
 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     // Country Id
     param('city_ctry_ID', 'integer', true);
     param_check_number('city_ctry_ID', T_('Please select a country'), true);
     $this->set_from_Request('ctry_ID', 'city_ctry_ID', true);
     // Region Id
     $this->set_string_from_param('rgn_ID');
     // Subregion Id
     $this->set_string_from_param('subrg_ID');
     // Name
     $this->set_string_from_param('name', true);
     // Code
     param('city_postcode', 'string');
     param_check_regexp('city_postcode', '#^[A-Za-z0-9]{1,12}$#', T_('City code must be from 1 to 12 letters.'));
     $this->set_from_Request('postcode', 'city_postcode');
     return !param_errors_detected();
 }
Exemple #7
0
         $Messages->add(T_('Regional settings updated.'), 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect('?ctrl=locales' . ($loc_transinfo ? '&loc_transinfo=1' : ''), 303);
         // Will EXIT
         // We have EXITed already at this point!!
     }
     break;
 case 'updatelocale':
 case 'createlocale':
     // CREATE/EDIT locale
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('locales');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     param('newloc_locale', 'string', true);
     param_check_regexp('newloc_locale', '/^[a-z]{2,3}-[A-Z]{2}.*$/', T_('Please use valid locale format.'));
     param('newloc_enabled', 'integer', 0);
     param('newloc_name', 'string', true);
     param('newloc_datefmt', 'string', true);
     param_check_not_empty('newloc_datefmt', T_('Date format cannot be empty.'));
     param('newloc_timefmt', 'string', true);
     param_check_not_empty('newloc_timefmt', T_('Time format cannot be empty.'));
     param('newloc_shorttimefmt', 'string', true);
     param_check_not_empty('newloc_shorttimefmt', T_('Short time format cannot be empty.'));
     param('newloc_startofweek', 'integer', 0);
     param('newloc_priority', 'integer', 1);
     param_check_range('newloc_priority', 1, 255, T_('Priority must be numeric (1-255).'));
     param('newloc_messages', 'string', true);
     param('newloc_transliteration_map', 'string', true);
     if (param_errors_detected()) {
         // Don't save locale if errors exist
 /**
  * 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&amp;action=edit&amp;ufdf_ID=' . $field_ID . '"'));
         }
     }
     return !param_errors_detected();
 }
 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $Messages;
     $aipr_status = param('aipr_status', 'string', true);
     $this->set('status', $aipr_status, true);
     $aipr_IPv4start = param('aipr_IPv4start', 'string', true);
     param_check_regexp('aipr_IPv4start', '#^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$#i', T_('Please enter a correct IP range start'));
     $aipr_IPv4start = ip2int($aipr_IPv4start);
     $this->set('IPv4start', $aipr_IPv4start);
     $aipr_IPv4end = param('aipr_IPv4end', 'string', true);
     param_check_regexp('aipr_IPv4end', '#^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$#i', T_('Please enter a correct IP range end'));
     $aipr_IPv4end = ip2int($aipr_IPv4end);
     $this->set('IPv4end', $aipr_IPv4end);
     // start timestamp:
     param_date('aipr_IP_timestamp', T_('Please enter a valid Date.'), true);
     $this->set('IP_datetime', form_date(get_param('aipr_IP_timestamp')));
     if ($aipr_IPv4start > $aipr_IPv4end) {
         $Messages->add(T_('IP range start must be less than IP range end'), 'error');
     }
     if (!param_errors_detected()) {
         // Check IPs for inside in other ranges
         if ($ip_range = get_ip_range($aipr_IPv4start, $aipr_IPv4end, $this->ID)) {
             $admin_url;
             $Messages->add(sprintf(T_('IP range already exists with params: %s - <a %s>Edit this range</a>'), int2ip($ip_range->aipr_IPv4start) . ' - ' . int2ip($ip_range->aipr_IPv4end), 'href="' . $admin_url . '?ctrl=antispam&amp;tab3=ipranges&amp;action=iprange_edit&amp;iprange_ID=' . $ip_range->aipr_ID . '"'), 'error');
         }
     }
     return !param_errors_detected();
 }
Exemple #10
0
 }
 $block_item_Widget = new Widget('block_item');
 $block_item_Widget->title = T_('Exporting package from SVN...');
 $block_item_Widget->disp_template_replaced('block_start');
 $svn_url = param('svn_url', 'string', '');
 $svn_folder = param('svn_folder', 'string', '/');
 $svn_user = param('svn_user', 'string', false);
 $svn_password = param('svn_password', 'string', false);
 $svn_revision = param('svn_revision', 'integer');
 $UserSettings->set('svn_upgrade_url', $svn_url);
 $UserSettings->set('svn_upgrade_folder', $svn_folder);
 $UserSettings->set('svn_upgrade_user', $svn_user);
 $UserSettings->set('svn_upgrade_revision', $svn_revision);
 $UserSettings->dbupdate();
 $success = param_check_not_empty('svn_url', T_('Please enter the URL of repository'));
 $success = $success && param_check_regexp('svn_folder', '#/blogs/$#', T_('A correct SVN folder path must ends with "/blogs/'));
 if (!$success) {
     $action = 'start';
     break;
 }
 $success = prepare_maintenance_dir($upgrade_path, true);
 if ($success) {
     // Set maximum execution time
     set_max_execution_time(2400);
     // 60 minutes
     load_class('_ext/phpsvnclient/phpsvnclient.php', 'phpsvnclient');
     $phpsvnclient = new phpsvnclient($svn_url, $svn_user, $svn_password);
     // Get an error if it was during connecting to svn server
     $svn_error = $phpsvnclient->getError();
     if (!empty($svn_error) || $phpsvnclient->getVersion() < 1) {
         // Some errors or Incorrect version
 // Check permission:
 $current_User->check_perm('options', 'edit', true);
 // Lock system
 if ($current_User->check_perm('users', 'edit')) {
     $system_lock = param('system_lock', 'integer', 0);
     if ($Settings->get('system_lock') && !$system_lock && !$Messages->has_errors() && 1 == $Messages->count()) {
         // System lock was turned off and there was no error, remove the warning about the system lock
         $Messages->clear();
     }
     $Settings->set('system_lock', $system_lock);
 }
 // Site code
 $Settings->set('site_code', param('site_code', 'string', ''));
 // Site color
 $site_color = param('site_color', 'string', '');
 param_check_regexp('site_color', '~^(#([a-f0-9]{3}){1,2})?$~i', T_('Invalid color code.'), NULL, false);
 $Settings->set('site_color', $site_color);
 // 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', ''));
 // Small site logo url
 param('notification_logo', 'string', '');
 param_check_url('notification_logo', 'http-https');
 $Settings->set('notification_logo', get_param('notification_logo'));
 // Large site logo url
 param('notification_logo_large', 'string', '');
 param_check_url('notification_logo_large', 'http-https');
 $Settings->set('notification_logo_large', get_param('notification_logo_large'));
Exemple #12
0
 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     global $Messages;
     $aipr_status = param('aipr_status', 'string', true);
     $this->set('status', $aipr_status, true);
     $aipr_IPv4start = param('aipr_IPv4start', 'string', true);
     param_check_regexp('aipr_IPv4start', '#^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$#i', T_('Please enter a correct IP range start'));
     $aipr_IPv4start = ip2int($aipr_IPv4start);
     $this->set('IPv4start', $aipr_IPv4start);
     $aipr_IPv4end = param('aipr_IPv4end', 'string', true);
     param_check_regexp('aipr_IPv4end', '#^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$#i', T_('Please enter a correct IP range end'));
     $aipr_IPv4end = ip2int($aipr_IPv4end);
     $this->set('IPv4end', $aipr_IPv4end);
     if ($aipr_IPv4start > $aipr_IPv4end) {
         $Messages->add(T_('IP range start must be less than IP range end'), 'error');
     }
     if (!param_errors_detected()) {
         // Check IPs for inside in other ranges
         if ($ip_range = get_ip_range($aipr_IPv4start, $aipr_IPv4end, $this->ID)) {
             $Messages->add(sprintf(T_('IP range already exists with params: %s'), int2ip($ip_range->aipr_IPv4start) . ' - ' . int2ip($ip_range->aipr_IPv4end)), 'error');
         }
     }
     return !param_errors_detected();
 }