Пример #1
0
 unset($_POST['submit']);
 $setup = false;
 if (isset($_POST['setup'])) {
     $setup = true;
     unset($_POST['setup']);
     $elements_form = formToArray($_POST);
     try {
         $prefs = new Preferences_admin();
         $prefs->deleteConfFile();
         $prefs = new Preferences_admin();
     } catch (Exception $e) {
     }
     $prefs->initialize();
     $prefs->set('general', 'sql', $elements_form['general']['sql']);
 } else {
     $elements_form = formToArray($_POST);
     $prefs = new Preferences_admin($elements_form);
 }
 $ret = $prefs->isValid();
 if ($ret === true) {
     $ret = $prefs->backup();
     if ($ret > 0) {
         $buf = $prefs->get('general', 'admin_language');
         $language = locale2unix($buf);
         setlocale(LC_ALL, $language . '.UTF-8');
         // configuration saved
         popup_info(_('Configuration successfully saved'));
         redirect('index.php');
     } else {
         header_static(_('Configuration'));
         echo 'problem : configuration not saved<br>';
Пример #2
0
     $ret = $_SESSION['service']->user_settings_set($_REQUEST['unique_id'], $_REQUEST['container'], $_REQUEST['element_id'], null);
 } else {
     if ($_REQUEST['action'] == 'del' && isset($_REQUEST['container']) && isset($_REQUEST['element_id'])) {
         $ret = $_SESSION['service']->user_settings_remove($_REQUEST['unique_id'], $_REQUEST['container'], $_REQUEST['element_id']);
     } else {
         if ($_REQUEST['action'] == 'modify' && isset($_REQUEST['container'])) {
             $container = $_REQUEST['container'];
             $formdata = array();
             $sep = '___';
             $sepkey = 'general' . $sep . $container;
             foreach ($_REQUEST as $key2 => $value2) {
                 if (substr($key2, 0, strlen($sepkey)) == $sepkey) {
                     $formdata[$key2] = $value2;
                 }
             }
             $formarray = formToArray($formdata);
             if (isset($formarray['general'][$container])) {
                 $data = $formarray['general'][$container];
                 $ret = null;
                 foreach ($data as $element_id => $value) {
                     $ret = $_SESSION['service']->user_settings_set($_REQUEST['unique_id'], $container, $element_id, $value);
                     if ($ret !== true) {
                         break;
                     }
                 }
             }
         }
     }
 }
 if ($ret === true) {
     popup_info(_('User successfully modified'));