Example #1
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $arr_editor = array();
     $arr_checkbox = array('is_under_construction');
     $result = $ttH->db->query("select * from config where id=1 ");
     $data = $ttH->db->fetch_row($result);
     if (isset($ttH->post['do_submit'])) {
         $dup = array();
         foreach ($data as $key => $value) {
             if ($key != 'id' && isset($ttH->input[$key])) {
                 //$dup[$key] = $ttH->input[$key];
                 if (in_array($key, $arr_editor)) {
                     $dup[$key] = $ttH->func->input_editor($ttH->post[$key]);
                 } else {
                     $dup[$key] = $ttH->post[$key];
                 }
             } elseif ($key != 'id' && in_array($key, $arr_checkbox)) {
                 $dup[$key] = isset($ttH->post[$key]) ? $ttH->post[$key] : 0;
             }
         }
         $ok = $ttH->db->do_update("config", $dup, "id=1");
         if ($ok) {
             $data = $dup;
             $mess = $ttH->lang["global"]["edit_success"];
             $err = $ttH->html->html_alert($mess, "success");
         }
     }
     $data["err"] = $err;
     $data["link_action"] = $this->link_act;
     $data["list_skin"] = list_skin("skin", $data["skin"], "class='form-control'");
     $data["list_method_email"] = $this->list_method_email("method_email", $data["method_email"], "class='form-control'");
     foreach ($arr_editor as $k) {
         $data["html_" . $k] = $ttH->editor->load_editor($k, $k, $data[$k], "", "full", array("folder_up" => $this->folder_upload, "fldr" => $this->dir));
     }
     foreach ($arr_checkbox as $k) {
         $data["checked_" . $k] = isset($data[$k]) && $data[$k] ? ' checked="checked"' : '';
     }
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("edit");
     return $ttH->temp_act->text("edit");
 }
Example #2
0
     $ret = file_database($config_dir . "newdbms.cfg", $cfg);
     // Make backup to other file
     break;
 case "store":
     $cfg = load_database();
     // Fill $cfg from MySQL
     $ret = file_database($config_dir . "database.cfg", $cfg);
     break;
 case "list_config":
     // Read the config directory
     $ret = list_config($config_dir);
     $apperr .= "list_config returned\n";
     break;
 case "list_skin":
     // Read the configfile into the system
     $ret = list_skin($skin_dir);
     $apperr .= "list_skin returned\n";
     break;
 case "load_config":
     // Read the configfile into the system
     $cfg = read_database($icsmsg);
     $ret = fill_database($cfg);
     $appmsg .= 'Success';
     // Return code to calling client call
     $apperr .= "load_config of " . $icsmsg . " returned OK";
     $ret = 1;
     break;
 case "store_config":
     // Read the configfile into the system
     $cfg = load_database();
     $ret = file_database($config_dir . $icsmsg, $cfg);