Пример #1
0
 function execute()
 {
     /*
     	Define form structure
     */
     $this->obj_form = new form_input();
     $this->obj_form->formname = "config";
     $this->obj_form->language = $_SESSION["user"]["lang"];
     $this->obj_form->action = "admin/config-process.php";
     $this->obj_form->method = "post";
     /*
     		// security options
     		$structure = NULL;
     		$structure["fieldname"]				= "BLACKLIST_ENABLE";
     		$structure["type"]				= "checkbox";
     		$structure["options"]["label"]			= "Enable to prevent brute-force login attempts";
     		$structure["options"]["no_translate_fieldname"]	= "yes";
     		$this->obj_form->add_input($structure);
     
     		$structure = NULL;
     		$structure["fieldname"]				= "BLACKLIST_LIMIT";
     		$structure["type"]				= "input";
     		$structure["options"]["no_translate_fieldname"]	= "yes";
     		$this->obj_form->add_input($structure);
     */
     // date/time configuration
     $structure = form_helper_prepare_timezonedropdown("TIMEZONE_DEFAULT");
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "DATEFORMAT";
     $structure["type"] = "radio";
     $structure["values"] = array("yyyy-mm-dd", "mm-dd-yyyy", "dd-mm-yyyy");
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // default options
     $structure = NULL;
     $structure["fieldname"] = "DEFAULT_HOSTMASTER";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["help"] = "*****@*****.**";
     $structure["options"]["label"] = " Email address for the DNS administrator.";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "DEFAULT_TTL_SOA";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["autofill"] = "86400";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "DEFAULT_TTL_NS";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Default TTL for Name Server (NS) records.";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "DEFAULT_TTL_MX";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Default TTL for MX records";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "DEFAULT_TTL_OTHER";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Default TTL for all other record types (A, AAAA, TXT, SPF, PTR, etc)";
     $this->obj_form->add_input($structure);
     // zone database configuration
     $structure = NULL;
     $structure["fieldname"] = "ZONE_DB_TYPE";
     $structure["type"] = "radio";
     $structure["values"] = array("zone_internal");
     // Long term plan is to support multiple backends, but we don't have this capability yet.
     //$structure["values"]					= array("zone_internal", "powerdns_mysql");
     $structure["options"]["autoselect"] = "yes";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ZONE_DB_HOST";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ZONE_DB_NAME";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ZONE_DB_USERNAME";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ZONE_DB_PASSWORD";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // logging options
     $structure = NULL;
     $structure["fieldname"] = "FEATURE_LOGS_ENABLE";
     $structure["type"] = "checkbox";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Enable audit & name server logging functionality.";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "FEATURE_LOGS_AUDIT";
     $structure["type"] = "checkbox";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Enable audit trail logging - tracks changes made to DNS records & zones.";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "FEATURE_LOGS_API";
     $structure["type"] = "checkbox";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Enable logging via API from name servers.";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "LOG_UPDATE_INTERVAL";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " seconds";
     $structure["options"]["width"] = "50";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "LOG_RETENTION_PERIOD";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Delete logs after defined number of days (0 to disable).";
     $structure["options"]["width"] = "50";
     $this->obj_form->add_input($structure);
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "default", "FEATURE_LOGS_AUDIT", "hide");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "default", "FEATURE_LOGS_API", "hide");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "default", "LOG_UPDATE_INTERVAL", "hide");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "default", "LOG_RETENTION_PERIOD", "hide");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "1", "FEATURE_LOGS_AUDIT", "show");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "1", "FEATURE_LOGS_API", "show");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "1", "LOG_RETENTION_PERIOD", "show");
     $this->obj_form->add_action("FEATURE_LOGS_ENABLE", "1", "LOG_UPDATE_INTERVAL", "show");
     // miscellaneous configurations
     $max_input_vars = @ini_get('max_input_vars');
     if (empty($max_input_vars)) {
         // PHP defaults if we can't query
         $max_input_vars = 1000;
     }
     $max_input_vars = sprintf("%d", $max_input_vars / 15);
     $structure = NULL;
     $structure["fieldname"] = "PAGINATION_DOMAIN_RECORDS";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " records per page (recommend maximum of {$max_input_vars}, adjust PHP max_input_vars to support more if required. Some browsers may perform badly with high values here)";
     $this->obj_form->add_input($structure);
     $this->obj_form->add_action("ZONE_DB_TYPE", "default", "ZONE_DB_HOST", "hide");
     $this->obj_form->add_action("ZONE_DB_TYPE", "default", "ZONE_DB_NAME", "hide");
     $this->obj_form->add_action("ZONE_DB_TYPE", "default", "ZONE_DB_USERNAME", "hide");
     $this->obj_form->add_action("ZONE_DB_TYPE", "default", "ZONE_DB_PASSWORD", "hide");
     $this->obj_form->add_action("ZONE_DB_TYPE", "powerdns_mysql", "ZONE_DB_HOST", "show");
     $this->obj_form->add_action("ZONE_DB_TYPE", "powerdns_mysql", "ZONE_DB_NAME", "show");
     $this->obj_form->add_action("ZONE_DB_TYPE", "powerdns_mysql", "ZONE_DB_USERNAME", "show");
     $this->obj_form->add_action("ZONE_DB_TYPE", "powerdns_mysql", "ZONE_DB_PASSWORD", "show");
     // admin API
     $structure = NULL;
     $structure["fieldname"] = "ADMIN_API_KEY";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["help"] = " Set me to a unique random string";
     $structure["options"]["label"] = " API keys for scripts that interact with NamedManager";
     $this->obj_form->add_input($structure);
     // amberstats phone home
     $structure = NULL;
     $structure["fieldname"] = "PHONE_HOME";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Report back to the developers with application, OS, PHP version and a random unique ID so we can better improve this software. (all information is anonymous, private and greatly appreciated. We use this information to focus development and packaging on the main platforms our users are running to better meet your needs.";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $phone_home_info = new phone_home();
     $phone_home_info->stats_generate();
     $structure = NULL;
     $structure["fieldname"] = "PHONE_HOME_EXAMPLE";
     $structure["type"] = "text";
     $structure["defaultvalue"] = "<i>Actual information to be sent: " . format_arraytocommastring(array_values($phone_home_info->stats)) . "</i>";
     $structure["options"]["no_fieldname"] = "yes";
     $structure["options"]["no_shift"] = "yes";
     $this->obj_form->add_input($structure);
     // submit section
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Save Changes";
     $this->obj_form->add_input($structure);
     // define subforms
     //		$this->obj_form->subforms["config_security"]		= array("BLACKLIST_ENABLE", "BLACKLIST_LIMIT");
     $this->obj_form->subforms["config_zone_defaults"] = array("DEFAULT_HOSTMASTER", "DEFAULT_TTL_SOA", "DEFAULT_TTL_NS", "DEFAULT_TTL_MX", "DEFAULT_TTL_OTHER");
     $this->obj_form->subforms["config_zone_database"] = array("ZONE_DB_TYPE", "ZONE_DB_HOST", "ZONE_DB_NAME", "ZONE_DB_USERNAME", "ZONE_DB_PASSWORD");
     $this->obj_form->subforms["config_api"] = array("ADMIN_API_KEY");
     $this->obj_form->subforms["config_dateandtime"] = array("DATEFORMAT", "TIMEZONE_DEFAULT");
     $this->obj_form->subforms["config_logging"] = array("FEATURE_LOGS_ENABLE", "FEATURE_LOGS_AUDIT", "FEATURE_LOGS_API", "LOG_UPDATE_INTERVAL", "LOG_RETENTION_PERIOD");
     $this->obj_form->subforms["config_miscellaneous"] = array("PAGINATION_DOMAIN_RECORDS");
     $this->obj_form->subforms["config_amberstats"] = array("PHONE_HOME", "PHONE_HOME_EXAMPLE");
     $this->obj_form->subforms["submit"] = array("submit");
     if (error_check()) {
         // load error datas
         $this->obj_form->load_data_error();
     } else {
         // fetch all the values from the database
         $sql_config_obj = new sql_query();
         $sql_config_obj->string = "SELECT name, value FROM config ORDER BY name";
         $sql_config_obj->execute();
         $sql_config_obj->fetch_array();
         foreach ($sql_config_obj->data as $data_config) {
             $this->obj_form->structure[$data_config["name"]]["defaultvalue"] = $data_config["value"];
         }
         unset($sql_config_obj);
     }
 }
Пример #2
0
 function login($instance, $username, $password)
 {
     log_debug("user_auth", "Executing login({$instance}, {$username}, \$password)");
     /*
     	Make sure it's safe to allow users to login
     */
     $schema_version = sql_get_singlevalue("SELECT value FROM config WHERE name='SCHEMA_VERSION' LIMIT 1");
     if ($schema_version != $GLOBALS["config"]["schema_version"]) {
         log_write("error", "user_auth", "The application has been updated, but the database has not been upgraded to match. Login is disabled until this is resolved.");
         return -5;
     }
     /*
     	Run Authentication Process
     */
     // connect to correct database instance
     $return = $this->login_instance_init($instance);
     if ($return == "-2") {
         // instance has been disabled
         return -4;
     } elseif ($return != "1") {
         // invalid instance ID or unknown error
         return -3;
     }
     // verify IP against blacklist
     $obj_blacklist = new blacklist();
     if ($obj_blacklist->check_ip()) {
         // blacklisted user
         return -1;
     }
     // authenticate the user
     $userid = $this->login_authenticate($username, $password);
     if ($userid <= 0) {
         if ($userid == "-2") {
             // user is disabled and can not be authenticated
             return -2;
         } else {
             // invalid password or unknown failure occured
             $obj_blacklist->increment();
             return 0;
         }
     }
     // Create user authentication session
     if (!$this->session_init($userid, $username)) {
         // unknown failure occured
         $obj_blacklist->increment();
         return 0;
     }
     /*
     	If enabled, run the phone home feature now - this submits non-private
     	data to Amberdms to better understand the size and requirements of
     	our userbase.
     */
     $phone_home = new phone_home();
     if ($phone_home->check_enabled()) {
         if ($phone_home->check_phone_home_timer()) {
             // time to update
             $phone_home->stats_generate();
             $phone_home->stats_submit();
         }
     }
     /*
     	Login Successful!
     */
     return 1;
 }
 function execute()
 {
     /*
     	Define form structure
     */
     $this->obj_form = new form_input();
     $this->obj_form->formname = "config_application";
     $this->obj_form->language = $_SESSION["user"]["lang"];
     $this->obj_form->action = "admin/config_application-process.php";
     $this->obj_form->method = "post";
     // default codes
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_AP_INVOICENUM";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_AR_INVOICENUM";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_GL_TRANSNUM";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_QUOTES_NUM";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_CREDIT_NUM";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "CODE_ACCOUNT";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "CODE_CUSTOMER";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "CODE_PRODUCT";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "CODE_PROJECT";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "CODE_VENDOR";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "CODE_STAFF";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // invoicing options
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_SERVICES_ADVANCEBILLING";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["width"] = "50";
     $structure["options"]["label"] = " days";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_SERVICES_DATESHIFT";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["width"] = "50";
     $structure["options"]["label"] = " " . lang_trans("help_accounts_services_dateshift");
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_TERMS_DAYS";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_AUTOPAY";
     $structure["type"] = "checkbox";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Check to have invoices automatically paid where there is credit or reoccuring billing details.";
     $this->obj_form->add_input($structure);
     // email options
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_EMAIL_ADDRESS";
     $structure["type"] = "input";
     $structure["options"]["label"] = " Internal email address to send billing system related emails to.";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_INVOICE_AUTOEMAIL";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Tick to have service and order invoices automatically emailed to customers when created, from address will be COMPANY_EMAIL_ADDRESS";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_INVOICE_BATCHREPORT";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Tick to have an invoice batch report sent to ACCOUNTS_EMAIL_ADDRESS when invoices are automatically generated.";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_EMAIL_AUTOBCC";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Always BCC outgoing invoice emails to ACCOUNTS_EMAIL_ADDRESS";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // service email options
     $structure = NULL;
     $structure["fieldname"] = "SERVICES_USAGEALERTS_ENABLE";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Tick to have service usage alerts delivered to customers (where customers/services are enabled for it).";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // orders options
     $structure = NULL;
     $structure["fieldname"] = "ORDERS_BILL_ONSERVICE";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Automatically bill customer orders when the next service bill is generated.";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ORDERS_BILL_ENDOFMONTH";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Automatically bill customer orders at the end of the calender month.";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // timesheet options
     $structure = NULL;
     $structure["fieldname"] = "TIMESHEET_BOOKTOFUTURE";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Allow users to book time to dates in the future";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // audit locking
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_INVOICE_LOCK";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "ACCOUNTS_GL_LOCK";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "JOURNAL_LOCK";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "TIMESHEET_LOCK";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // misc
     $structure = NULL;
     $structure["fieldname"] = "UPLOAD_MAXBYTES";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " Bytes. Server maximum is " . ini_get('upload_max_filesize') . ", to increase server limit, you must edit php.ini";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "API_URL";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["options"]["label"] = " This URL will be used in namespace and soap address URLS in the WSDL files.";
     $this->obj_form->add_input($structure);
     // amberstats phone home
     $structure = NULL;
     $structure["fieldname"] = "PHONE_HOME";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Report back to the developers with application, OS, PHP version and a random unique ID so we can better improve this software. (all information is anonymous, private and greatly appreciated. We use this information to focus development and packaging on the main platforms our users are running to better meet your needs.";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $phone_home_info = new phone_home();
     $phone_home_info->stats_generate();
     $structure = NULL;
     $structure["fieldname"] = "PHONE_HOME_EXAMPLE";
     $structure["type"] = "text";
     $structure["defaultvalue"] = "<i>Actual information to be sent: " . format_arraytocommastring(array_values($phone_home_info->stats)) . "</i>";
     $structure["options"]["no_fieldname"] = "yes";
     $structure["options"]["no_shift"] = "yes";
     $this->obj_form->add_input($structure);
     // security options
     $structure = NULL;
     $structure["fieldname"] = "SESSION_TIMEOUT";
     $structure["type"] = "input";
     $structure["options"]["label"] = " seconds idle before logging user out";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $structure["defaultvalue"] = "7200";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "BLACKLIST_ENABLE";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Enable to prevent brute-force login attempts";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "BLACKLIST_LIMIT";
     $structure["type"] = "input";
     $structure["options"]["no_translate_fieldname"] = "yes";
     $this->obj_form->add_input($structure);
     // dangerous options
     if ($GLOBALS["config"]["dangerous_conf_options"] == "enabled") {
         $structure = NULL;
         $structure["fieldname"] = "EMAIL_ENABLE";
         $structure["type"] = "checkbox";
         $structure["options"]["label"] = "Enable or disable the ability to send emails. If you don't trust users not to try using the system to spam people (eg: if this is a demo system) then it is highly recommended to disable this option.";
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
         $structure = NULL;
         $structure["fieldname"] = "DATA_STORAGE_METHOD";
         $structure["type"] = "radio";
         $structure["values"] = array("database", "filesystem");
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
         $structure = NULL;
         $structure["fieldname"] = "DATA_STORAGE_LOCATION";
         $structure["type"] = "input";
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
         $structure = NULL;
         $structure["fieldname"] = "PATH_TMPDIR";
         $structure["type"] = "input";
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
         $structure = NULL;
         $structure["fieldname"] = "APP_PDFLATEX";
         $structure["type"] = "input";
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
         $structure = NULL;
         $structure["fieldname"] = "APP_WKHTMLTOPDF";
         $structure["type"] = "input";
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
         $structure = NULL;
         $structure["fieldname"] = "APP_MYSQL_DUMP";
         $structure["type"] = "input";
         $structure["options"]["no_translate_fieldname"] = "yes";
         $this->obj_form->add_input($structure);
     }
     // submit section
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Save Changes";
     $this->obj_form->add_input($structure);
     // define subforms
     $this->obj_form->subforms["config_defcodes"] = array("ACCOUNTS_AP_INVOICENUM", "ACCOUNTS_AR_INVOICENUM", "ACCOUNTS_GL_TRANSNUM", "ACCOUNTS_QUOTES_NUM", "ACCOUNTS_CREDIT_NUM", "CODE_ACCOUNT", "CODE_CUSTOMER", "CODE_VENDOR", "CODE_PRODUCT", "CODE_PROJECT", "CODE_STAFF");
     $this->obj_form->subforms["config_accounts"] = array("ACCOUNTS_SERVICES_ADVANCEBILLING", "ACCOUNTS_SERVICES_DATESHIFT", "ACCOUNTS_TERMS_DAYS", "ACCOUNTS_AUTOPAY");
     $this->obj_form->subforms["config_accounts_email"] = array("ACCOUNTS_EMAIL_ADDRESS", "ACCOUNTS_INVOICE_AUTOEMAIL", "ACCOUNTS_EMAIL_AUTOBCC", "ACCOUNTS_INVOICE_BATCHREPORT");
     $this->obj_form->subforms["config_services_email"] = array("SERVICES_USAGEALERTS_ENABLE");
     $this->obj_form->subforms["config_orders"] = array("ORDERS_BILL_ONSERVICE", "ORDERS_BILL_ENDOFMONTH");
     $this->obj_form->subforms["config_timesheet"] = array("TIMESHEET_BOOKTOFUTURE");
     $this->obj_form->subforms["config_auditlocking"] = array("ACCOUNTS_INVOICE_LOCK", "ACCOUNTS_GL_LOCK", "JOURNAL_LOCK", "TIMESHEET_LOCK");
     $this->obj_form->subforms["config_contributions"] = array("PHONE_HOME", "PHONE_HOME_EXAMPLE");
     $this->obj_form->subforms["config_security"] = array("SESSION_TIMEOUT", "BLACKLIST_ENABLE", "BLACKLIST_LIMIT");
     $this->obj_form->subforms["config_misc"] = array("UPLOAD_MAXBYTES", "API_URL");
     if ($GLOBALS["config"]["dangerous_conf_options"] == "enabled") {
         $this->obj_form->subforms["config_dangerous"] = array("PATH_TMPDIR", "APP_PDFLATEX", "APP_WKHTMLTOPDF", "APP_MYSQL_DUMP", "EMAIL_ENABLE", "DATA_STORAGE_LOCATION", "DATA_STORAGE_METHOD");
     }
     $this->obj_form->subforms["submit"] = array("submit");
     if (error_check()) {
         // load error datas
         $this->obj_form->load_data_error();
     } else {
         // fetch all the values from the database
         $sql_config_obj = new sql_query();
         $sql_config_obj->string = "SELECT name, value FROM config ORDER BY name";
         $sql_config_obj->execute();
         $sql_config_obj->fetch_array();
         foreach ($sql_config_obj->data as $data_config) {
             $this->obj_form->structure[$data_config["name"]]["defaultvalue"] = $data_config["value"];
         }
         unset($sql_config_obj);
     }
 }