diff --git a/bind/include/amberphplib/inc_file_uploads.php b/bind/include/amberphplib/inc_file_uploads.php index e74fe92..d54535f 100755 --- a/bind/include/amberphplib/inc_file_uploads.php +++ b/bind/include/amberphplib/inc_file_uploads.php @@ -69,7 +69,7 @@ class file_storage Constructor function */ - function file_storage() + function __construct() { $this->config["data_storage_method"] = sql_get_singlevalue("SELECT value FROM config WHERE name='DATA_STORAGE_METHOD' LIMIT 1"); $this->config["data_storage_location"] = sql_get_singlevalue("SELECT value FROM config WHERE name='DATA_STORAGE_LOCATION' LIMIT 1"); @@ -173,7 +173,7 @@ function verify_upload_form($fieldname, $acceptable_formats = NULL) switch ($_FILES[ $fieldname ]["error"]) { case UPLOAD_ERR_INI_SIZE: - log_write("error", "file_storage", "File upload was in excess of maximum PHP limit of ". ini_get('upload_max_filesize') .""); + log_write("error", "file_storage", "File upload was in excess of maximum PHP limit of ". ini_get('upload_max_filesize')); break; case UPLOAD_ERR_NO_FILE: @@ -181,7 +181,7 @@ function verify_upload_form($fieldname, $acceptable_formats = NULL) break; default: - log_write("error", "file_storage", "Unexpected upload error: ". $_FILES[ $fieldname ]["error"] .""); + log_write("error", "file_storage", "Unexpected upload error: ". $_FILES[ $fieldname ]["error"]); break; } @@ -764,7 +764,7 @@ function filedata_render() // tell the browser how big the file is (in bytes) // most browers seem to ignore this, but it's vital in order to make IE 7 work. - header("Content-Length: ". $this->data["file_size"] .""); + header("Content-Length: ". $this->data["file_size"]); @@ -775,7 +775,7 @@ function filedata_render() has some files on disk and some in the DB, we can handle it accordingly. */ - log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"] .""); + log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"]); if ($this->data["file_location"] == "db") { @@ -790,7 +790,7 @@ function filedata_render() if (!$sql_obj->num_rows()) { - die("No data found for file". $this->id .""); + die("No data found for file". $this->id); } $sql_obj->fetch_array(); @@ -876,7 +876,7 @@ function filedata_var() $return_string = NULL; - log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"] .""); + log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"]); if ($this->data["file_location"] == "db") { @@ -897,7 +897,7 @@ function filedata_var() if (!$sql_obj->num_rows()) { - die("No data found for file". $this->id .""); + die("No data found for file". $this->id); } @@ -974,7 +974,7 @@ function filedata_write($filename) has some files on disk and some in the DB, we can handle it accordingly. */ - log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"] .""); + log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"]); if ($this->data["file_location"] == "db") { @@ -997,7 +997,7 @@ function filedata_write($filename) if (!$sql_obj->num_rows()) { - die("No data found for file ". $this->id .""); + die("No data found for file ". $this->id); } $sql_obj->fetch_array(); diff --git a/bind/include/amberphplib/inc_forms.php b/bind/include/amberphplib/inc_forms.php index 7d8f172..995a53e 100755 --- a/bind/include/amberphplib/inc_forms.php +++ b/bind/include/amberphplib/inc_forms.php @@ -1416,7 +1416,7 @@ function render_field ($fieldname) break; default: - log_debug("form", "Error: Unknown field type of ". $this->structure["fieldname"]["type"] .""); + log_debug("form", "Error: Unknown field type of ". $this->structure["fieldname"]["type"]); break; } diff --git a/bind/include/amberphplib/inc_journal.php b/bind/include/amberphplib/inc_journal.php index 9104a86..b013442 100755 --- a/bind/include/amberphplib/inc_journal.php +++ b/bind/include/amberphplib/inc_journal.php @@ -29,7 +29,7 @@ class journal_base Class Contructor */ - function journal_base() + function __construct() { // init the SQL structure $this->sql_obj = New sql_query; @@ -294,29 +294,14 @@ function prepare_set_content($content) // make sure we perform quoting, since we will be insert // these text strings into the database - if (get_magic_quotes_gpc() == 0) - { - $this->structure["content"] = addslashes($content); - } - else - { - $this->structure["content"] = $content; - } + $this->structure["content"] = addslashes($content); } function prepare_set_title($title) { log_debug("journal_base", "Executing prepare_set_title($title)"); - if (get_magic_quotes_gpc() == 0) - { - $this->structure["title"] = addslashes($title); - } - else - { - $this->structure["title"] = $title; - } - + $this->structure["title"] = addslashes($title); } function prepare_set_journalid($journalid) @@ -640,7 +625,7 @@ function render_journal() default: - log_debug("journal_display", "Invalid journal type of ". $data["type"] ." provided, unable to process entry ". $data["id"] .""); + log_debug("journal_display", "Invalid journal type of ". $data["type"] ." provided, unable to process entry ". $data["id"]); break; } // end type switch @@ -935,7 +920,7 @@ class journal_input extends journal_base Class Contructor */ - function journal_input() + function __construct() { // init the form object $this->form_obj = New form_input; @@ -1352,7 +1337,7 @@ class journal_process extends journal_base Class Contructor */ - function journal_process() + function __construct() { // sql query $this->sql_obj = New sql_query; @@ -1627,7 +1612,7 @@ function action_update() // call the upload function if (!$file_obj->action_update_form("upload")) { - log_write("error", "journal_process", "Unable to upload file for journal entry id ". $this->structure["id"] . ""); + log_write("error", "journal_process", "Unable to upload file for journal entry id ". $this->structure["id"]); } } else diff --git a/bind/include/amberphplib/inc_language.php b/bind/include/amberphplib/inc_language.php index 0aa35b8..5049766 100755 --- a/bind/include/amberphplib/inc_language.php +++ b/bind/include/amberphplib/inc_language.php @@ -154,6 +154,7 @@ function language_translate($language, $label_array) // store labels to fetch from DB in here $label_fetch_array = array(); + $result = array(); // run through the labels - see what ones we have cached, and what ones we need to query foreach ($label_array as $label) diff --git a/bind/include/amberphplib/inc_ldap.php b/bind/include/amberphplib/inc_ldap.php index 477ca64..7d2d01e 100755 --- a/bind/include/amberphplib/inc_ldap.php +++ b/bind/include/amberphplib/inc_ldap.php @@ -63,7 +63,7 @@ function connect() if (!$this->ldapcon) { - log_debug("ldap_query", "Unable to connect to LDAP server ". $this->srvcfg["host"] ." on port ". $this->srvcfg["port"] .""); + log_debug("ldap_query", "Unable to connect to LDAP server ". $this->srvcfg["host"] ." on port ". $this->srvcfg["port"]); return 0; } @@ -97,12 +97,12 @@ function connect() // bind user if (ldap_bind($this->ldapcon, $this->srvcfg["user"], $this->srvcfg["password"])) { - log_debug("ldap_query", "Successfully connect to LDAP database on ". $this->srvcfg["host"] ." as ". $this->srvcfg["user"] .""); + log_debug("ldap_query", "Successfully connect to LDAP database on ". $this->srvcfg["host"] ." as ". $this->srvcfg["user"]); return 1; } else { - log_debug("ldap_query", "Unable to connect to LDAP database on ". $this->srvcfg["host"] ." as ". $this->srvcfg["user"] .""); + log_debug("ldap_query", "Unable to connect to LDAP database on ". $this->srvcfg["host"] ." as ". $this->srvcfg["user"]); return -1; } diff --git a/bind/include/amberphplib/inc_misc.php b/bind/include/amberphplib/inc_misc.php index febf2de..e08e4f2 100755 --- a/bind/include/amberphplib/inc_misc.php +++ b/bind/include/amberphplib/inc_misc.php @@ -1410,7 +1410,7 @@ function dir_list_contents($directory='.') { $filepath = $directory . '/' . $file; - array_push($files, $filepath); + $files[] = $filepath; if ( is_dir($filepath) ) { diff --git a/bind/include/amberphplib/inc_phone_home.php b/bind/include/amberphplib/inc_phone_home.php index 3b2b16d..0937c02 100755 --- a/bind/include/amberphplib/inc_phone_home.php +++ b/bind/include/amberphplib/inc_phone_home.php @@ -118,7 +118,7 @@ function stats_generate() $sql_obj->string = "UPDATE config SET value='". $this->stats["subscription_id"] ."' WHERE name='SUBSCRIPTION_ID' LIMIT 1"; $sql_obj->execute(); - log_write("debug", "phone_home", "Generated new subscription ID of ". $this->stats["subscription_id"] .""); + log_write("debug", "phone_home", "Generated new subscription ID of ". $this->stats["subscription_id"]); } diff --git a/bind/include/amberphplib/inc_security.php b/bind/include/amberphplib/inc_security.php index 5fd63b1..7d99bbc 100755 --- a/bind/include/amberphplib/inc_security.php +++ b/bind/include/amberphplib/inc_security.php @@ -76,15 +76,11 @@ function security_form_input($expression, $valuename, $numchars, $errormsg) // strip any HTML tags $input = strip_tags($input); - // check if magic quotes is on or off and process the input correctly. - // - // this prevents SQL injections, by backslashing -- " ' ` \ -- etc. - // - if (get_magic_quotes_gpc() == 0) - { - $input = addslashes($input); - } - + // check if magic quotes is on or off and process the input correctly. + // + // this prevents SQL injections, by backslashing -- " ' ` \ -- etc. + // + $input = addslashes($input); if (strlen($input) >= $numchars) { diff --git a/bind/include/amberphplib/inc_sql.php b/bind/include/amberphplib/inc_sql.php index 89b70c5..235b13a 100755 --- a/bind/include/amberphplib/inc_sql.php +++ b/bind/include/amberphplib/inc_sql.php @@ -38,7 +38,7 @@ class sql_query /* Constructor */ - function sql_query() + function __construct() { // fetch the default database session - this avoids having to carry one object around at all times // yet still permits connecting to alternative databases @@ -132,7 +132,7 @@ function session_init($db_type, $db_hostname, $db_name, $db_username, $db_passwo } - log_write("debug", "sql_query", "New session ". $this->db_link .""); + log_write("debug", "sql_query", "New session ". $this->db_link); // success return 1; @@ -213,17 +213,9 @@ function session_terminate() { log_write("debug", "sql_query", "Executing session_terminate()"); - if ($this->db_link) + if ($this->db_link && $this->db_type == "mysql") { - switch ($this->db_type) - { - case "mysql": - - return mysqli_close($this->db_link); - - break; - } - + return mysqli_close($this->db_link); } else { diff --git a/bind/include/amberphplib/inc_tables.php b/bind/include/amberphplib/inc_tables.php index 9221b8a..bd20dae 100755 --- a/bind/include/amberphplib/inc_tables.php +++ b/bind/include/amberphplib/inc_tables.php @@ -68,7 +68,7 @@ class table Constructor Function */ - function table() + function __construct() { // init the SQL structure $this->sql_obj = New sql_query; @@ -1355,7 +1355,7 @@ function render_table_prepare() default: - log_debug("inc_tables", "Error: Unrecognised row total mode ". $this->total_rows_mode .""); + log_debug("inc_tables", "Error: Unrecognised row total mode ". $this->total_rows_mode); break; } @@ -1558,7 +1558,7 @@ function render_table_html() } else { - print "links[$link]["page"] .""; + print "links[$link]["page"]; } // add each option @@ -1769,7 +1769,7 @@ function render_table_html() } else { - print "links[$link]["options"]["class"] ."\" href=\"index.php?page=". $this->links[$link]["page"] .""; + print "links[$link]["options"]["class"] ."\" href=\"index.php?page=". $this->links[$link]["page"]; } // add each option @@ -2080,8 +2080,7 @@ function render_table_pdf($template = NULL) // table foreach loop $output_tabledata[] = '%% foreach table\_data'; - $line = ""; - $line .= '%% '; + $line = '%% '; for ($i=0; $i < $col_num; $i++) { @@ -2236,7 +2235,7 @@ function render_table_pdf($template = NULL) // add data for all selected columns for ($j=0; $j < count($this->columns); $j++) { - $structure["column_$j"] = $this->data_render[$i]["". $this->columns[$j] .""]; + $structure["column_$j"] = $this->data_render[$i][strval($this->columns[$j])]; } // optional: row totals column diff --git a/bind/include/amberphplib/inc_template_engines.php b/bind/include/amberphplib/inc_template_engines.php index 0285a96..6430a7c 100755 --- a/bind/include/amberphplib/inc_template_engines.php +++ b/bind/include/amberphplib/inc_template_engines.php @@ -35,7 +35,7 @@ class template_engine /* Constructor/Destructors */ - function template_engine() + function __construct() { log_debug("template_engine", "Executing template_engine()"); @@ -52,7 +52,7 @@ function destructor() { foreach (array_keys($this->data_files) as $var) { - log_debug("template_engine", "Removing tmp file ". $this->data_files[$var]["filename"] .""); + log_debug("template_engine", "Removing tmp file ". $this->data_files[$var]["filename"]); unlink($this->data_files[$var]["filename"]); } } diff --git a/bind/include/amberphplib/inc_user.php b/bind/include/amberphplib/inc_user.php index e4cb9b0..b62e93c 100755 --- a/bind/include/amberphplib/inc_user.php +++ b/bind/include/amberphplib/inc_user.php @@ -36,7 +36,7 @@ class user_auth Constructor */ - function user_auth() + function __construct() { log_debug("user_auth", "Executing user_auth()"); @@ -1230,7 +1230,7 @@ class blacklist /* Constructor */ - function blacklist() + function __construct() { // default IP address to use $this->ipaddress = $_SERVER["REMOTE_ADDR"]; diff --git a/bind/include/amberphplib/main.php b/bind/include/amberphplib/main.php index afcb80d..77fd50c 100755 --- a/bind/include/amberphplib/main.php +++ b/bind/include/amberphplib/main.php @@ -99,7 +99,7 @@ function log_write($type, $category, $content) @log_debug("start", ""); @log_debug("start", "AMBERPHPLIB STARTED"); -@log_debug("start", "Debugging for: ". str_replace("&", " &", $_SERVER["REQUEST_URI"]) .""); +@log_debug("start", "Debugging for: ". str_replace("&", " &", $_SERVER["REQUEST_URI"])); @log_debug("start", ""); diff --git a/bind/include/application/inc_bind.php b/bind/include/application/inc_bind.php index ec1b2b3..3bd6ca1 100644 --- a/bind/include/application/inc_bind.php +++ b/bind/include/application/inc_bind.php @@ -127,7 +127,7 @@ function check_domain_serial( $domain_name ) */ function action_reload() { - log_write("debug", "script", "Reloading Bind with new configuration using ". $GLOBALS["config"]["bind"]["reload"] .""); + log_write("debug", "script", "Reloading Bind with new configuration using ". $GLOBALS["config"]["bind"]["reload"]); exec($GLOBALS["config"]["bind"]["reload"] ." 2>&1", $exec_output, $exec_return_value); @@ -285,7 +285,7 @@ function action_generate_appconfig() if (!empty($GLOBALS["config"]["bind"]["zonefullpath"])) { // unusual, needed if Bind lacks a directory configuration option - fwrite($fh, "\tfile \"". $GLOBALS["config"]["bind"]["zonefiledir"] ."". $domain["domain_name"] .".zone\";\n"); + fwrite($fh, "\tfile \"". $GLOBALS["config"]["bind"]["zonefiledir"] . $domain["domain_name"] .".zone\";\n"); } else { @@ -502,7 +502,7 @@ function action_generate_zonefile( $domain_name, $domain_id ) if (function_exists("idn_to_ascii")) { $record["record_name"] = idn_to_ascii($record["record_name"]); - $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); + $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); } // handle origin and content format @@ -537,7 +537,7 @@ function action_generate_zonefile( $domain_name, $domain_id ) if (function_exists("idn_to_ascii")) { $record["record_name"] = idn_to_ascii($record["record_name"]); - $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); + $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); } // handle origin and content format @@ -570,7 +570,7 @@ function action_generate_zonefile( $domain_name, $domain_id ) if (function_exists("idn_to_ascii")) { $record["record_name"] = idn_to_ascii($record["record_name"]); - $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); + $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); } if (strpos($record["record_name"], "ip6.arpa")) @@ -597,7 +597,7 @@ function action_generate_zonefile( $domain_name, $domain_id ) if (function_exists("idn_to_ascii")) { $record["record_name"] = idn_to_ascii($record["record_name"]); - $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); + $record["record_content"] = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); } if (preg_match("/\./", $record["record_name"]) && preg_match("/". $domain_name ."$/", $record["record_name"])) @@ -605,7 +605,7 @@ function action_generate_zonefile( $domain_name, $domain_id ) $record["record_name"] .= "."; // append . as FQDN } - fwrite($fh, $record["record_name"] . "\t". $record["record_ttl"] ." IN CNAME ". $record["record_content"] .""); + fwrite($fh, $record["record_name"] . "\t". $record["record_ttl"] ." IN CNAME ". $record["record_content"]); if (preg_match("/\./", $record["record_content"])) { @@ -636,15 +636,21 @@ function action_generate_zonefile( $domain_name, $domain_id ) { $record["record_name"] = idn_to_ascii($record["record_name"]); - // idn_to_ascii has a lovely habit of blowing up with some record values, such as - // DKIM records. If idn_to_ascii fails, we leave the value unchanged - if ($tmp = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_2003)) + // Values in TXT and SPF records are case sensitive. + // All other DNS record types have case-insensitive values. + // INTL_IDNA_VARIANT_UTS46 processes all input (domain names) to lower case. + if (!in_array($record["record_type"], array("TXT", "SPF"))) { - $record["record_content"] = $tmp; - } - else - { - log_write("warning", "script", "Unable to punnycode parse record \"". $record["record_name"] ."\". This sometimes happens with certain records like DKIM and may not be an issue."); + // idn_to_ascii has a lovely habit of blowing up with some record values, such as + // DKIM records. If idn_to_ascii fails, we leave the value unchanged + if ($tmp = idn_to_ascii($record["record_content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46)) + { + $record["record_content"] = $tmp; + } + else + { + log_write("warning", "script", "Unable to punnycode parse record \"". $record["record_name"] ."\". This sometimes happens with certain records like DKIM and may not be an issue."); + } } } diff --git a/bind/include/application/inc_soap_api.php b/bind/include/application/inc_soap_api.php index d5b952f..d4dddf0 100755 --- a/bind/include/application/inc_soap_api.php +++ b/bind/include/application/inc_soap_api.php @@ -57,7 +57,7 @@ function authenticate() } else { - log_write("error", "soap_api", "Unknown failure whilst attempting to authenticate with the API - ". $exception->getMessage() .""); + log_write("error", "soap_api", "Unknown failure whilst attempting to authenticate with the API - ". $exception->getMessage()); return 0; } @@ -145,7 +145,7 @@ function log_push($timestamp, $log_contents) // for any other errors, report fault and retry later - better to keep retrying and only quit if there's an actual // known un-fixable problem. - log_write("error", "script", "Unknown failure whilst attempting to push log messages - ". $exception->getMessage() .""); + log_write("error", "script", "Unknown failure whilst attempting to push log messages - ". $exception->getMessage()); sleep(10); } @@ -219,7 +219,7 @@ function set_update_version( $config_version ) } catch (SoapFault $exception) { - log_write("error", "soap_api", "An unexpected error occured ". $exception->getMessage() .""); + log_write("error", "soap_api", "An unexpected error occured ". $exception->getMessage()); die("Fatal Error"); } diff --git a/bind/namedmanager_bind_configwriter.php b/bind/namedmanager_bind_configwriter.php index 8d303e1..d001f27 100755 --- a/bind/namedmanager_bind_configwriter.php +++ b/bind/namedmanager_bind_configwriter.php @@ -29,7 +29,7 @@ if (!is_readable($GLOBALS["config"]["log_file"])) { - log_write("error", "script", "Unable to read log file ". $GLOBALS["config"]["log_file"] .""); + log_write("error", "script", "Unable to read log file ". $GLOBALS["config"]["log_file"]); die(date("Y-m-d H:i:s") . " Fatal Error\n"); } @@ -80,7 +80,7 @@ function lockfile_remove() // delete lock file if (!unlink($GLOBALS["config"]["lock_file"])) { - log_write("error", "script", "Unable to remove lock file ". $GLOBALS["config"]["lock_file"] .""); + log_write("error", "script", "Unable to remove lock file ". $GLOBALS["config"]["lock_file"]); } } diff --git a/bind/namedmanager_logpush.php b/bind/namedmanager_logpush.php index 84e5559..ed67833 100755 --- a/bind/namedmanager_logpush.php +++ b/bind/namedmanager_logpush.php @@ -28,7 +28,7 @@ if (!is_readable($GLOBALS["config"]["log_file"])) { - log_write("error", "script", "Unable to read log file ". $GLOBALS["config"]["log_file"] .""); + log_write("error", "script", "Unable to read log file ". $GLOBALS["config"]["log_file"]); die("Fatal Error"); } @@ -166,7 +166,7 @@ function lockfile_remove() // delete lock file if (!unlink($GLOBALS["config"]["lock_file"])) { - log_write("error", "script", "Unable to remove lock file ". $GLOBALS["config"]["lock_file"] .""); + log_write("error", "script", "Unable to remove lock file ". $GLOBALS["config"]["lock_file"]); } } diff --git a/htdocs/api/namedmanager.php b/htdocs/api/namedmanager.php index 653966b..494931c 100755 --- a/htdocs/api/namedmanager.php +++ b/htdocs/api/namedmanager.php @@ -30,7 +30,7 @@ class api_namedmanager /* constructor */ - function api_namedmanager() + function __construct() { $this->auth_server = isset($_SESSION["auth_server"]) ? $_SESSION["auth_server"] : NULL; $this->auth_online = isset($_SESSION["auth_online"]) ? $_SESSION["auth_online"] : NULL; @@ -245,6 +245,8 @@ function set_update_version($version) $obj_server = New name_server; $obj_server->id = $this->auth_server; + $obj_server->load_data(); + return $obj_server->action_update_config_version($version); } else diff --git a/htdocs/domains/delete-process.php b/htdocs/domains/delete-process.php index cb9800f..0638dde 100755 --- a/htdocs/domains/delete-process.php +++ b/htdocs/domains/delete-process.php @@ -56,7 +56,7 @@ if (error_check()) { $_SESSION["error"]["form"]["domain_delete"] = "failed"; - header("Location: ../index.php?page=domains/delete.php&id=". $obj_domain->id .""); + header("Location: ../index.php?page=domains/delete.php&id=". $obj_domain->id); exit(0); } diff --git a/htdocs/domains/delete.php b/htdocs/domains/delete.php index 4a7d5ee..4dbb455 100755 --- a/htdocs/domains/delete.php +++ b/htdocs/domains/delete.php @@ -15,7 +15,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // initate object @@ -28,9 +28,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Domain Details", "page=domains/view.php&id=". $this->obj_domain->id .""); - $this->obj_menu_nav->add_item("Domain Records", "page=domains/records.php&id=". $this->obj_domain->id .""); - $this->obj_menu_nav->add_item("Delete Domain", "page=domains/delete.php&id=". $this->obj_domain->id ."", TRUE); + $this->obj_menu_nav->add_item("Domain Details", "page=domains/view.php&id=". $this->obj_domain->id); + $this->obj_menu_nav->add_item("Domain Records", "page=domains/records.php&id=". $this->obj_domain->id); + $this->obj_menu_nav->add_item("Delete Domain", "page=domains/delete.php&id=". $this->obj_domain->id, TRUE); } diff --git a/htdocs/domains/domains.php b/htdocs/domains/domains.php index 394f5ee..4d07528 100755 --- a/htdocs/domains/domains.php +++ b/htdocs/domains/domains.php @@ -15,7 +15,7 @@ class page_output var $obj_form; var $invalid_filter; - function page_output() + function __construct() { // include custom scripts and/or logic $this->requires["javascript"][] = "include/javascript/filter_domains.js"; @@ -52,7 +52,7 @@ function execute() $filter["fieldname"] = "domain_name"; $filter["type"] = "input"; $filter["sql"] = "domain_name LIKE '%value%'"; - $filter["defaultvalue"] = security_script_input("/^[A-Za-z0-9\.\-]*$/", $_GET["domain_name"]); + $filter["defaultvalue"] = security_script_input("/^[A-Za-z0-9\.\-]*$/", $_GET["domain_name"] ?? ""); if ($filter["defaultvalue"] == "error") { $this->invalid_filter = true; @@ -107,7 +107,7 @@ function render_html() print "

List of domains managed by this server:

"; // table data - if ((!$this->obj_table->data_num_rows) and (!$_GET["domain_name"])) + if ((!$this->obj_table->data_num_rows) and (!isset($_GET["domain_name"]) || !$_GET["domain_name"])) { format_msgbox("important", "

There are currently no domain names configured.

"); } diff --git a/htdocs/domains/edit-process.php b/htdocs/domains/edit-process.php index 5e7fb9a..c8c014a 100755 --- a/htdocs/domains/edit-process.php +++ b/htdocs/domains/edit-process.php @@ -264,7 +264,7 @@ if ($obj_domain->id) { $_SESSION["error"]["form"]["domain_edit"] = "failed"; - header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id .""); + header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id); } else { @@ -403,7 +403,7 @@ if ($obj_domain->id) { $_SESSION["error"]["form"]["domain_edit"] = "failed"; - header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id .""); + header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id); } else { @@ -424,7 +424,7 @@ if (empty($networks)) { // multiple domains - header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id .""); + header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id); exit(0); } else diff --git a/htdocs/domains/import-process.php b/htdocs/domains/import-process.php index 8eac28c..5fae6d8 100755 --- a/htdocs/domains/import-process.php +++ b/htdocs/domains/import-process.php @@ -120,7 +120,7 @@ // open the file and read data if ($zonefile = file($_FILES["import_upload_file"]["tmp_name"])) { - log_write("debug", "process", "Processing file ". $_FILES["import_upload_file"]["name"] .""); + log_write("debug", "process", "Processing file ". $_FILES["import_upload_file"]["name"]); foreach ($zonefile as $line) { @@ -160,7 +160,7 @@ // domain origin if (preg_match("/^\\\$ORIGIN\s(\S*)/", $line, $matches)) { - log_write("debug", "process", "Header: ORIGIN: ". $matches[1] .""); + log_write("debug", "process", "Header: ORIGIN: ". $matches[1]); if (empty($data["domain_name"])) { @@ -184,7 +184,7 @@ // domain TTL if (preg_match("/^\\\$TTL\s([0-9]*)/", $line, $matches)) { - log_write("debug", "process", "Header: TTL: ". $matches[1] .""); + log_write("debug", "process", "Header: TTL: ". $matches[1]); if (empty($data["domain_ttl"])) @@ -1119,7 +1119,7 @@ */ // return - header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id .""); + header("Location: ../index.php?page=domains/view.php&id=". $obj_domain->id); exit(0); diff --git a/htdocs/domains/import.php b/htdocs/domains/import.php index d0ea6cb..deace59 100755 --- a/htdocs/domains/import.php +++ b/htdocs/domains/import.php @@ -21,7 +21,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { $this->mode = @security_script_input('/^[0-9]*$/', $_GET["mode"]); diff --git a/htdocs/domains/records-ajax.php b/htdocs/domains/records-ajax.php index d419401..faa8149 100755 --- a/htdocs/domains/records-ajax.php +++ b/htdocs/domains/records-ajax.php @@ -28,7 +28,7 @@ class page_output var $is_standard; - function page_output() + function __construct() { // include custom scripts and/or logic $this->requires["javascript"][] = "include/javascript/domain_records.js"; @@ -728,7 +728,7 @@ function render_html() Draw messages */ -if ($_SESSION["error"]["message"]) +if (isset($_SESSION["error"]["message"])) { print ""; log_error_render(); @@ -736,7 +736,7 @@ function render_html() } else { - if ($_SESSION["notification"]["message"]) + if (isset($_SESSION["notification"]["message"])) { print ""; log_notification_render(); diff --git a/htdocs/domains/records-process.php b/htdocs/domains/records-process.php index c8ec958..c4b3a69 100755 --- a/htdocs/domains/records-process.php +++ b/htdocs/domains/records-process.php @@ -212,7 +212,7 @@ } $_SESSION["error"]["form"]["domain_records"] = "failed"; - header("Location: ../index.php?page=domains/records.php&id=". $obj_domain->id .""); + header("Location: ../index.php?page=domains/records.php&id=". $obj_domain->id); exit(0); } @@ -289,7 +289,7 @@ */ if ($record["reverse_ptr"]) { - log_write("debug", "process", "Updating reverse PTR record for ". $record["name"] ."--> ". $record["content"] .""); + log_write("debug", "process", "Updating reverse PTR record for ". $record["name"] ."--> ". $record["content"]); $obj_ptr = New domain_records; @@ -406,7 +406,7 @@ $obj_reverse->load_data(); $obj_reverse->action_update_serial(); - log_write("notification", "process", "Updating serials for reverse domain ". $obj_reverse->data["domain_name"] .""); + log_write("notification", "process", "Updating serials for reverse domain ". $obj_reverse->data["domain_name"]); } } diff --git a/htdocs/domains/records.php b/htdocs/domains/records.php index e44c948..6432cfe 100755 --- a/htdocs/domains/records.php +++ b/htdocs/domains/records.php @@ -25,7 +25,7 @@ class page_output var $is_standard; - function page_output() + function __construct() { // include custom scripts and/or logic $this->requires["javascript"][] = "include/javascript/domain_records.js"; @@ -40,9 +40,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Domain Details", "page=domains/view.php&id=". $this->obj_domain->id .""); - $this->obj_menu_nav->add_item("Domain Records", "page=domains/records.php&id=". $this->obj_domain->id ."", TRUE); - $this->obj_menu_nav->add_item("Delete Domain", "page=domains/delete.php&id=". $this->obj_domain->id .""); + $this->obj_menu_nav->add_item("Domain Details", "page=domains/view.php&id=". $this->obj_domain->id); + $this->obj_menu_nav->add_item("Domain Records", "page=domains/records.php&id=". $this->obj_domain->id, TRUE); + $this->obj_menu_nav->add_item("Delete Domain", "page=domains/delete.php&id=". $this->obj_domain->id); } diff --git a/htdocs/domains/view.php b/htdocs/domains/view.php index b227122..426cebf 100755 --- a/htdocs/domains/view.php +++ b/htdocs/domains/view.php @@ -15,7 +15,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // initate object @@ -28,9 +28,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Domain Details", "page=domains/view.php&id=". $this->obj_domain->id ."", TRUE); - $this->obj_menu_nav->add_item("Domain Records", "page=domains/records.php&id=". $this->obj_domain->id .""); - $this->obj_menu_nav->add_item("Delete Domain", "page=domains/delete.php&id=". $this->obj_domain->id .""); + $this->obj_menu_nav->add_item("Domain Details", "page=domains/view.php&id=". $this->obj_domain->id, TRUE); + $this->obj_menu_nav->add_item("Domain Records", "page=domains/records.php&id=". $this->obj_domain->id); + $this->obj_menu_nav->add_item("Delete Domain", "page=domains/delete.php&id=". $this->obj_domain->id); } diff --git a/htdocs/include/amberphplib/inc_file_uploads.php b/htdocs/include/amberphplib/inc_file_uploads.php index e74fe92..d54535f 100755 --- a/htdocs/include/amberphplib/inc_file_uploads.php +++ b/htdocs/include/amberphplib/inc_file_uploads.php @@ -69,7 +69,7 @@ class file_storage Constructor function */ - function file_storage() + function __construct() { $this->config["data_storage_method"] = sql_get_singlevalue("SELECT value FROM config WHERE name='DATA_STORAGE_METHOD' LIMIT 1"); $this->config["data_storage_location"] = sql_get_singlevalue("SELECT value FROM config WHERE name='DATA_STORAGE_LOCATION' LIMIT 1"); @@ -173,7 +173,7 @@ function verify_upload_form($fieldname, $acceptable_formats = NULL) switch ($_FILES[ $fieldname ]["error"]) { case UPLOAD_ERR_INI_SIZE: - log_write("error", "file_storage", "File upload was in excess of maximum PHP limit of ". ini_get('upload_max_filesize') .""); + log_write("error", "file_storage", "File upload was in excess of maximum PHP limit of ". ini_get('upload_max_filesize')); break; case UPLOAD_ERR_NO_FILE: @@ -181,7 +181,7 @@ function verify_upload_form($fieldname, $acceptable_formats = NULL) break; default: - log_write("error", "file_storage", "Unexpected upload error: ". $_FILES[ $fieldname ]["error"] .""); + log_write("error", "file_storage", "Unexpected upload error: ". $_FILES[ $fieldname ]["error"]); break; } @@ -764,7 +764,7 @@ function filedata_render() // tell the browser how big the file is (in bytes) // most browers seem to ignore this, but it's vital in order to make IE 7 work. - header("Content-Length: ". $this->data["file_size"] .""); + header("Content-Length: ". $this->data["file_size"]); @@ -775,7 +775,7 @@ function filedata_render() has some files on disk and some in the DB, we can handle it accordingly. */ - log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"] .""); + log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"]); if ($this->data["file_location"] == "db") { @@ -790,7 +790,7 @@ function filedata_render() if (!$sql_obj->num_rows()) { - die("No data found for file". $this->id .""); + die("No data found for file". $this->id); } $sql_obj->fetch_array(); @@ -876,7 +876,7 @@ function filedata_var() $return_string = NULL; - log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"] .""); + log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"]); if ($this->data["file_location"] == "db") { @@ -897,7 +897,7 @@ function filedata_var() if (!$sql_obj->num_rows()) { - die("No data found for file". $this->id .""); + die("No data found for file". $this->id); } @@ -974,7 +974,7 @@ function filedata_write($filename) has some files on disk and some in the DB, we can handle it accordingly. */ - log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"] .""); + log_write("debug", "file_storage", "Fetching file ". $this->id ." from location ". $this->data["file_location"]); if ($this->data["file_location"] == "db") { @@ -997,7 +997,7 @@ function filedata_write($filename) if (!$sql_obj->num_rows()) { - die("No data found for file ". $this->id .""); + die("No data found for file ". $this->id); } $sql_obj->fetch_array(); diff --git a/htdocs/include/amberphplib/inc_forms.php b/htdocs/include/amberphplib/inc_forms.php index 7d8f172..212eab7 100755 --- a/htdocs/include/amberphplib/inc_forms.php +++ b/htdocs/include/amberphplib/inc_forms.php @@ -604,6 +604,11 @@ function render_field ($fieldname) log_debug("form", "Executing render_field($fieldname)"); $helpmessagestatus = "false"; + + if (!isset($this->structure[$fieldname]) || !isset($this->structure[$fieldname]["type"])) { + log_debug("form", "Error: Tried to render unknown field ". $fieldname); + return 1; + } switch ($this->structure[$fieldname]["type"]) { @@ -1224,7 +1229,7 @@ function render_field ($fieldname) // create value array if the SQL has not been executed yet - if (is_string($this->structure[$fieldname]["values"])) + if (isset($this->structure[$fieldname]["values"]) && is_string($this->structure[$fieldname]["values"])) { if(!empty($this->structure[$fieldname]["defaultvalue"])) { @@ -1280,7 +1285,7 @@ function render_field ($fieldname) else { // get translation for all options - $translations = language_translate($this->language, $this->structure[$fieldname]["values"]); + $translations = language_translate($this->language, $this->structure[$fieldname]["values"] ?? []); } // input box for filtering @@ -1338,7 +1343,7 @@ function render_field ($fieldname) //echo ""; // add all the options - foreach ($this->structure[$fieldname]["values"] as $value) + foreach ($this->structure[$fieldname]["values"] ?? [] as $value) { print "
links[$link]["page"] .""; + print "links[$link]["page"]; } // add each option @@ -1769,7 +1769,7 @@ function render_table_html() } else { - print "links[$link]["options"]["class"] ."\" href=\"index.php?page=". $this->links[$link]["page"] .""; + print "links[$link]["options"]["class"] ."\" href=\"index.php?page=". $this->links[$link]["page"]; } // add each option @@ -2080,8 +2080,7 @@ function render_table_pdf($template = NULL) // table foreach loop $output_tabledata[] = '%% foreach table\_data'; - $line = ""; - $line .= '%% '; + $line = '%% '; for ($i=0; $i < $col_num; $i++) { @@ -2236,7 +2235,7 @@ function render_table_pdf($template = NULL) // add data for all selected columns for ($j=0; $j < count($this->columns); $j++) { - $structure["column_$j"] = $this->data_render[$i]["". $this->columns[$j] .""]; + $structure["column_$j"] = $this->data_render[$i][strval($this->columns[$j])]; } // optional: row totals column diff --git a/htdocs/include/amberphplib/inc_template_engines.php b/htdocs/include/amberphplib/inc_template_engines.php index 0285a96..6430a7c 100755 --- a/htdocs/include/amberphplib/inc_template_engines.php +++ b/htdocs/include/amberphplib/inc_template_engines.php @@ -35,7 +35,7 @@ class template_engine /* Constructor/Destructors */ - function template_engine() + function __construct() { log_debug("template_engine", "Executing template_engine()"); @@ -52,7 +52,7 @@ function destructor() { foreach (array_keys($this->data_files) as $var) { - log_debug("template_engine", "Removing tmp file ". $this->data_files[$var]["filename"] .""); + log_debug("template_engine", "Removing tmp file ". $this->data_files[$var]["filename"]); unlink($this->data_files[$var]["filename"]); } } diff --git a/htdocs/include/amberphplib/inc_user.php b/htdocs/include/amberphplib/inc_user.php index afaca3c..c153ae1 100755 --- a/htdocs/include/amberphplib/inc_user.php +++ b/htdocs/include/amberphplib/inc_user.php @@ -39,7 +39,7 @@ class user_auth Constructor */ - function user_auth() + function __construct() { log_debug("user_auth", "Executing user_auth()"); @@ -390,7 +390,7 @@ function login_instance_init($instance) // check the instance (if required) and select the required database - if ($GLOBALS["config"]["instance"] == "hosted") + if (isset($GLOBALS["config"]["instance"]) && $GLOBALS["config"]["instance"] == "hosted") { $sql_instance_obj = New sql_query; $sql_instance_obj->string = "SELECT active, db_hostname FROM `instances` WHERE instanceid='$instance' LIMIT 1"; @@ -1326,7 +1326,7 @@ class blacklist /* Constructor */ - function blacklist() + function __construct() { // default IP address to use $this->ipaddress = $_SERVER["REMOTE_ADDR"]; diff --git a/htdocs/include/amberphplib/main.php b/htdocs/include/amberphplib/main.php index f0cc225..13aeda8 100755 --- a/htdocs/include/amberphplib/main.php +++ b/htdocs/include/amberphplib/main.php @@ -99,7 +99,7 @@ function log_write($type, $category, $content) @log_debug("start", ""); @log_debug("start", "AMBERPHPLIB STARTED"); -@log_debug("start", "Debugging for: ". str_replace("&", " &", $_SERVER["REQUEST_URI"]) .""); +@log_debug("start", "Debugging for: ". str_replace("&", " &", $_SERVER["REQUEST_URI"])); @log_debug("start", ""); diff --git a/htdocs/include/application/inc_changelog.php b/htdocs/include/application/inc_changelog.php index d6a81fd..783ef79 100755 --- a/htdocs/include/application/inc_changelog.php +++ b/htdocs/include/application/inc_changelog.php @@ -25,7 +25,7 @@ class changelog /* Constructor */ - function changelog() + function __construct() { // default to current user or "SYSTEM" if (isset($_SESSION["user"]["name"])) diff --git a/htdocs/include/application/inc_cloud_route53.php b/htdocs/include/application/inc_cloud_route53.php index 0eb81d5..a790a5a 100644 --- a/htdocs/include/application/inc_cloud_route53.php +++ b/htdocs/include/application/inc_cloud_route53.php @@ -185,7 +185,7 @@ function fetch_records_remote() catch (Route53Exception $e) { log_write("error", "process", "A failure occured whilst trying to fetch records from AWS/Route53."); - log_write("error", "process", "Failure returned: ". $e->getExceptionCode() .""); + log_write("error", "process", "Failure returned: ". $e->getExceptionCode()); return 0; } @@ -210,15 +210,11 @@ function fetch_records_remote() $tmp["ttl"] = $route53_record["TTL"]; // Type-Specific processing - switch ($tmp["type"]) - { - case "MX": - if (preg_match("/^([0-9]*)\s(\S*)$/", $tmp["content"], $matches)) - { - $tmp["prio"] = $matches[1]; - $tmp["content"] = $matches[2]; - } - break; + if ($tmp["type"] == "MX") { + if (preg_match("/^([0-9]*)\s(\S*)$/", $tmp["content"], $matches)) { + $tmp["prio"] = $matches[1]; + $tmp["content"] = $matches[2]; + } } // AWS returns @ as \100, so we replace any \100 in the domain names with @@ -748,7 +744,7 @@ function action_sync_records() catch (Route53Exception $e) { log_write("error", "process", "A failure occured whilst trying to submit a batch change from AWS/Route53."); - log_write("error", "process", "Failure returned: ". $e->getExceptionCode() .""); + log_write("error", "process", "Failure returned: ". $e->getExceptionCode()); $this->changelog->log_post('server', "An error occured updating domain \"". $this->obj_domain->data["domain_name"] ."\" in Route53"); return 0; @@ -807,7 +803,7 @@ function action_create_domain() catch (Route53Exception $e) { log_write("error", "process", "A failure occured whilst trying to create a new hosted zone."); - log_write("error", "process", "Failure returned: ". $e->getExceptionCode() .""); + log_write("error", "process", "Failure returned: ". $e->getExceptionCode()); $this->changelog->log_post('server', "A failure occured whilst attempting to create domain \"". $change["Name"] ."\" in Route53"); return 0; @@ -950,7 +946,7 @@ function action_delete_domain() catch (Route53Exception $e) { log_write("error", "process", "A failure occured whilst trying to delete hosted zone."); - log_write("error", "process", "Failure returned: ". $e->getExceptionCode() .""); + log_write("error", "process", "Failure returned: ". $e->getExceptionCode()); $this->changelog->log_post('server', "An error occured attempting to delete domain \"". $this->obj_domain->data["domain_name"] ."\" from Route53"); diff --git a/htdocs/include/application/inc_domain.php b/htdocs/include/application/inc_domain.php index cf20b4c..5625009 100755 --- a/htdocs/include/application/inc_domain.php +++ b/htdocs/include/application/inc_domain.php @@ -28,7 +28,7 @@ class domain Constructor */ - function domain() + function __construct() { log_debug("domain", "Executing domain() [constructor]"); @@ -326,7 +326,7 @@ function load_data_record_all($exclude_forwardrev = NULL) if ($this->format == 'idn') { $data_records["name"] = idn_to_ascii($data_records["name"]); - $data_records["content"] = idn_to_ascii($data_records["content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_2003); + $data_records["content"] = idn_to_ascii($data_records["content"], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); } $this->data["records"][] = $data_records; @@ -744,7 +744,7 @@ function action_update_serial() $log = New changelog; $log->id_domain = $this->id; - $log->log_post("audit", "Domain ". $this->data["domain_name"] ." serial updated to ". $this->data["soa_serial"] .""); + $log->log_post("audit", "Domain ". $this->data["domain_name"] ." serial updated to ". $this->data["soa_serial"]); return $this->data["soa_serial"]; @@ -855,12 +855,12 @@ function action_update_ns() { $this->sql_obj->trans_commit(); - log_write("notification", "domain", "Nameserver configuration settings and domain serials updated for domain ". $this->data["domain_name"] .""); + log_write("notification", "domain", "Nameserver configuration settings and domain serials updated for domain ". $this->data["domain_name"]); $log = New changelog; $log->id_domain = $this->id; - $log->log_post("audit", "Updated nameserver (NS) records for ". $this->data["domain_name"] .""); + $log->log_post("audit", "Updated nameserver (NS) records for ". $this->data["domain_name"]); return 1; @@ -1371,7 +1371,7 @@ function find_reverse_domain($ip_address) $this->id = $this->sql_obj->data[0]["id"]; - log_write("debug", "domain_records", "Found matching domain ". $ip_arpa ." with ID of ". $this->id .""); + log_write("debug", "domain_records", "Found matching domain ". $ip_arpa ." with ID of ". $this->id); // now fetch the ID for the record that belongs to this domain $this->sql_obj->string = "SELECT id FROM `dns_records` WHERE id_domain='". $this->id ."' AND name='". $ip_ptr_name ."' LIMIT 1"; @@ -1383,7 +1383,7 @@ function find_reverse_domain($ip_address) $this->id_record = $this->sql_obj->data[0]["id"]; - log_write("debug", "domain_records", "Found matching record with ID of ". $this->id_record .""); + log_write("debug", "domain_records", "Found matching record with ID of ". $this->id_record); } @@ -1564,7 +1564,7 @@ function action_update_record() $log = New changelog; $log->id_domain = $this->id; - $log->log_post("audit", "Updated domain record type ". $this->data_record["type"] ." ". $this->data_record["name"] ."/". $this->data_record["content"] ." for domain ". $this->data["domain_name"] .""); + $log->log_post("audit", "Updated domain record type ". $this->data_record["type"] ." ". $this->data_record["name"] ."/". $this->data_record["content"] ." for domain ". $this->data["domain_name"]); } else @@ -1574,7 +1574,7 @@ function action_update_record() $log = New changelog; $log->id_domain = $this->id; - $log->log_post("audit", "Updated domain record type ". $this->data_record["type"] ." ". $this->data_record["name"] ."/". $this->data_record["content"] ." for domain ". $this->data["domain_name"] .""); + $log->log_post("audit", "Updated domain record type ". $this->data_record["type"] ." ". $this->data_record["name"] ."/". $this->data_record["content"] ." for domain ". $this->data["domain_name"]); } @@ -1639,7 +1639,7 @@ function action_delete_record() $log = New changelog; $log->id_domain = $this->id; - $log->log_post("audit", "Domain record type ". $this->data_record["type"] ." ". $this->data_record["name"] ."/". $this->data_record["content"] ." has been deleted from domain ". $this->data["domain_name"] .""); + $log->log_post("audit", "Domain record type ". $this->data_record["type"] ." ". $this->data_record["name"] ."/". $this->data_record["content"] ." has been deleted from domain ". $this->data["domain_name"]); return 1; } @@ -1798,7 +1798,7 @@ function validate_custom_records($data_orig = array()) // all other record types log_write("error", "process", "Sorry, the value you have entered for record ". $data_tmp[$i]["name"] ." contains invalid charactors"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } @@ -1814,7 +1814,7 @@ function validate_custom_records($data_orig = array()) { // invalid IP address log_write("error", "process", "A record for ". $data_tmp[$i]["name"] ." did not validate as an IPv4 address"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } break; @@ -1824,7 +1824,7 @@ function validate_custom_records($data_orig = array()) { // invalid IP address log_write("error", "process", "AAAA record for ". $data_tmp[$i]["name"] ." did not validate as an IPv6 address"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } break; @@ -1834,14 +1834,14 @@ function validate_custom_records($data_orig = array()) { // invalid CNAME log_write("error", "process", "CNAME record for " . $data_tmp[$i]["name"] . " contains invalid characters."); - error_flag_field("record_custom_" . $i . ""); + error_flag_field("record_custom_" . $i); } // make sure it's not an IP if (filter_var($data_tmp[$i]["content"], FILTER_VALIDATE_IP) == FALSE && !filter_var($data_tmp[$i]['content'], FILTER_VALIDATE_DOMAIN)) { // CNAME is pointing at an IP log_write("error", "process", "CNAME record for " . $data_tmp[$i]["name"] . " is incorrectly referencing an IP address. "); - error_flag_field("record_custom_" . $i . ""); + error_flag_field("record_custom_" . $i); } break; @@ -1851,14 +1851,14 @@ function validate_custom_records($data_orig = array()) && !preg_match("/^_[A-Za-z0-9\p{L}.-]*\._[A-Za-z\p{L}]*$/", $data_tmp[$i]["name"])) { log_write("error", "process", "SRV record for ". $data_tmp[$i]["name"] ." is not correctly formatted - name must be: _service._proto.name"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } // validate SRV content (priority, weight, port, target/host) if (!preg_match("/^[0-9]*\s[0-9]*\s[0-9]*\s[A-Za-z0-9\p{L}.-]*$/", $data_tmp[$i]["content"])) { log_write("error", "process", "SRV record for ". $data_tmp[$i]["name"] ." is not correctly formatted - content must be: priority weight port target/hostname"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } break; @@ -1881,13 +1881,13 @@ function validate_custom_records($data_orig = array()) if (!preg_match("/^[0-9]*$/", $data_tmp[$i]["name"])) { log_write("error", "process", "PTR reverse record for ". $data_tmp[$i]["content"] ." should be a single octet."); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } if (!preg_match("/^[A-Za-z0-9\p{L}.-]*$/", $data_tmp[$i]["content"])) { log_write("error", "process", "PTR reverse record for ". $data_tmp[$i]["name"] ." is not correctly formatted."); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } } @@ -1908,13 +1908,13 @@ function validate_custom_records($data_orig = array()) if (!filter_var($data_tmp[$i]["name"], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { log_write("error", "process", "Provided PTR IPv6 address for ". $data_tmp[$i]["name"] ." is not a valid IPv6 address."); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } if (!preg_match("/^[A-Za-z0-9\p{L}.-]*$/", $data_tmp[$i]["content"])) { log_write("error", "process", "Provided PTR IPv6 reverse record for ". $data_tmp[$i]["name"] ." is not correctly formatted."); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } // convert the record into PTR formatted value @@ -1928,7 +1928,7 @@ function validate_custom_records($data_orig = array()) if (!preg_match("/^[1-4] [1-2] [a-fA-F0-9]+$/", $data_tmp[$i]["content"])) { log_write("error", "process", "SSHFP record for ". $data_tmp[$i]["name"] ." is not correctly formatted - content must be: algorithm(1-4) type(1-2) "); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } break; @@ -1937,7 +1937,7 @@ function validate_custom_records($data_orig = array()) if (!preg_match("/^[0-9]+( [0-9]+( [0-9]+\.[0-9]+)?)? N|S [0-9]+( [0-9]+( [0-9]+\.[0-9]+)?)? E|W \-?[0-9]+\.[0-9]+m?( [0-9]+\.[0-9]+m?)?( [0-9]+\.[0-9]+m?)?/", $data_tmp[$i]["content"])) { log_write("error", "process", "LOC record for ". $data_tmp[$i]["name"] ." is not correctly formatted - content must follow RFC 1876"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } break; @@ -1949,7 +1949,7 @@ function validate_custom_records($data_orig = array()) default: - log_write("error", "process", "Unknown record type ". $data_tmp[$i]["type"] .""); + log_write("error", "process", "Unknown record type ". $data_tmp[$i]["type"]); break; } @@ -1973,7 +1973,7 @@ function validate_custom_records($data_orig = array()) // no match log_write("error", "process", "Sorry, we can't set a reverse PTR for ". $data_tmp[$i]["content"] ." --> ". $data_tmp[$i]["name"] .", since there is no reverse domain record for that IP address"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } else { @@ -1994,7 +1994,7 @@ function validate_custom_records($data_orig = array()) else { log_write("error", "process", "A reverse PTR record is only valid for an A or AAAA record"); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } } @@ -2013,7 +2013,7 @@ function validate_custom_records($data_orig = array()) { log_write("error", "process", "Name cannot be empty for IP address: " . $data_tmp[$i]['content']); - error_flag_field("record_custom_". $i .""); + error_flag_field("record_custom_". $i); } } diff --git a/htdocs/include/vendor/aws-sdk/Aws/Common/Model/MultipartUpload/AbstractUploadId.php b/htdocs/include/vendor/aws-sdk/Aws/Common/Model/MultipartUpload/AbstractUploadId.php index da79521..7392932 100644 --- a/htdocs/include/vendor/aws-sdk/Aws/Common/Model/MultipartUpload/AbstractUploadId.php +++ b/htdocs/include/vendor/aws-sdk/Aws/Common/Model/MultipartUpload/AbstractUploadId.php @@ -79,8 +79,8 @@ protected function loadData($data) { $data = array_replace(static::$expectedValues, array_intersect_key($data, static::$expectedValues)); foreach ($data as $key => $value) { - if (isset($data[$key])) { - $this->data[$key] = $data[$key]; + if (isset($value)) { + $this->data[$key] = $value; } else { throw new InvalidArgumentException("A required key [$key] was missing from the UploadId."); } diff --git a/htdocs/include/vendor/aws-sdk/Aws/DynamoDb/Iterator/ItemIterator.php b/htdocs/include/vendor/aws-sdk/Aws/DynamoDb/Iterator/ItemIterator.php index 855cdfe..8dc00fc 100644 --- a/htdocs/include/vendor/aws-sdk/Aws/DynamoDb/Iterator/ItemIterator.php +++ b/htdocs/include/vendor/aws-sdk/Aws/DynamoDb/Iterator/ItemIterator.php @@ -102,7 +102,8 @@ public function toArray() */ protected function processAttribute(array $attribute) { - list($type, $value) = each($attribute); + $type = array_key_first($attribute); + $value = $attribute[$type]; if ($type === 'B') { $value = base64_decode($value); diff --git a/htdocs/include/vendor/aws-sdk/Aws/S3/StreamWrapper.php b/htdocs/include/vendor/aws-sdk/Aws/S3/StreamWrapper.php index 2174b8e..1c29f6d 100644 --- a/htdocs/include/vendor/aws-sdk/Aws/S3/StreamWrapper.php +++ b/htdocs/include/vendor/aws-sdk/Aws/S3/StreamWrapper.php @@ -185,7 +185,7 @@ public function stream_open($path, $mode, $options, &$opened_path) } } - return $errors ? $this->triggerError($errors) : true; + return !$errors || $this->triggerError($errors); } /** diff --git a/htdocs/include/vendor/aws-sdk/Doctrine/Common/Cache/FileCache.php b/htdocs/include/vendor/aws-sdk/Doctrine/Common/Cache/FileCache.php index da650b4..ec3f0dc 100644 --- a/htdocs/include/vendor/aws-sdk/Doctrine/Common/Cache/FileCache.php +++ b/htdocs/include/vendor/aws-sdk/Doctrine/Common/Cache/FileCache.php @@ -91,7 +91,7 @@ public function getExtension() */ protected function getFilename($id) { - $path = implode(str_split(md5($id), 12), DIRECTORY_SEPARATOR); + $path = implode(DIRECTORY_SEPARATOR, str_split(md5($id), 12)); $path = $this->directory . DIRECTORY_SEPARATOR . $path; return $path . DIRECTORY_SEPARATOR . $id . $this->extension; @@ -129,4 +129,4 @@ protected function doGetStats() { return null; } -} \ No newline at end of file +} diff --git a/htdocs/include/vendor/aws-sdk/Guzzle/Http/Message/Request.php b/htdocs/include/vendor/aws-sdk/Guzzle/Http/Message/Request.php index 37d7690..d176cf2 100644 --- a/htdocs/include/vendor/aws-sdk/Guzzle/Http/Message/Request.php +++ b/htdocs/include/vendor/aws-sdk/Guzzle/Http/Message/Request.php @@ -465,7 +465,7 @@ public function getResponseBody() public function isResponseBodyRepeatable() { Version::warn(__METHOD__ . ' is deprecated. Use $request->getResponseBody()->isRepeatable()'); - return !$this->responseBody ? true : $this->responseBody->isRepeatable(); + return !$this->responseBody || $this->responseBody->isRepeatable(); } public function getCookies() diff --git a/htdocs/include/vendor/aws-sdk/Guzzle/Http/ReadLimitEntityBody.php b/htdocs/include/vendor/aws-sdk/Guzzle/Http/ReadLimitEntityBody.php index d0bc867..6161127 100644 --- a/htdocs/include/vendor/aws-sdk/Guzzle/Http/ReadLimitEntityBody.php +++ b/htdocs/include/vendor/aws-sdk/Guzzle/Http/ReadLimitEntityBody.php @@ -58,9 +58,7 @@ public function getContentLength() */ public function seek($offset, $whence = SEEK_SET) { - return $whence === SEEK_SET - ? $this->body->seek(max($this->offset, min($this->offset + $this->limit, $offset))) - : false; + return $whence === SEEK_SET && $this->body->seek(max($this->offset, min($this->offset + $this->limit, $offset))); } /** diff --git a/htdocs/include/vendor/aws-sdk/Guzzle/Stream/Stream.php b/htdocs/include/vendor/aws-sdk/Guzzle/Stream/Stream.php index 299f3b3..12528e0 100644 --- a/htdocs/include/vendor/aws-sdk/Guzzle/Stream/Stream.php +++ b/htdocs/include/vendor/aws-sdk/Guzzle/Stream/Stream.php @@ -229,7 +229,7 @@ public function setSize($size) public function seek($offset, $whence = SEEK_SET) { - return $this->cache[self::SEEKABLE] ? fseek($this->stream, $offset, $whence) === 0 : false; + return $this->cache[self::SEEKABLE] && fseek($this->stream, $offset, $whence) === 0; } public function read($length) diff --git a/htdocs/logs/logs.php b/htdocs/logs/logs.php index 60b52ff..ecdc116 100755 --- a/htdocs/logs/logs.php +++ b/htdocs/logs/logs.php @@ -13,7 +13,7 @@ class page_output { var $obj_table; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/javascript/logs.js"; } diff --git a/htdocs/servers/delete-process.php b/htdocs/servers/delete-process.php index f082dae..3499128 100755 --- a/htdocs/servers/delete-process.php +++ b/htdocs/servers/delete-process.php @@ -56,7 +56,7 @@ if (error_check()) { $_SESSION["error"]["form"]["name_server_delete"] = "failed"; - header("Location: ../index.php?page=servers/delete.php&id=". $obj_name_server->id .""); + header("Location: ../index.php?page=servers/delete.php&id=". $obj_name_server->id); exit(0); } diff --git a/htdocs/servers/delete.php b/htdocs/servers/delete.php index 2f47b72..e8570f5 100755 --- a/htdocs/servers/delete.php +++ b/htdocs/servers/delete.php @@ -15,7 +15,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // initate object @@ -28,14 +28,14 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Adjust Server Configuration", "page=servers/view.php&id=". $this->obj_name_server->id .""); + $this->obj_menu_nav->add_item("Adjust Server Configuration", "page=servers/view.php&id=". $this->obj_name_server->id); if ($GLOBALS["config"]["FEATURE_LOGS_API"]) { - $this->obj_menu_nav->add_item("View Server-Specific Logs", "page=servers/logs.php&id=". $this->obj_name_server->id .""); + $this->obj_menu_nav->add_item("View Server-Specific Logs", "page=servers/logs.php&id=". $this->obj_name_server->id); } - $this->obj_menu_nav->add_item("Delete Server", "page=servers/delete.php&id=". $this->obj_name_server->id ."", TRUE); + $this->obj_menu_nav->add_item("Delete Server", "page=servers/delete.php&id=". $this->obj_name_server->id, TRUE); } diff --git a/htdocs/servers/edit-process.php b/htdocs/servers/edit-process.php index bd0c17e..e6ab6a7 100755 --- a/htdocs/servers/edit-process.php +++ b/htdocs/servers/edit-process.php @@ -156,7 +156,7 @@ catch (Aws\Route53\Exception\Route53Exception $e) { log_write("error", "process", "Unable to connect to Route53 with provided credentials"); - log_write("error", "process", "Failure returned: ". $e->getExceptionCode() .""); + log_write("error", "process", "Failure returned: ". $e->getExceptionCode()); error_flag_field("route53_access_key"); error_flag_field("route53_secret_key"); } @@ -173,7 +173,7 @@ if ($obj_name_server->id) { $_SESSION["error"]["form"]["name_server_edit"] = "failed"; - header("Location: ../index.php?page=servers/view.php&id=". $obj_name_server->id .""); + header("Location: ../index.php?page=servers/view.php&id=". $obj_name_server->id); } else { @@ -200,7 +200,7 @@ Return */ - header("Location: ../index.php?page=servers/view.php&id=". $obj_name_server->id .""); + header("Location: ../index.php?page=servers/view.php&id=". $obj_name_server->id); exit(0); diff --git a/htdocs/servers/group-delete-process.php b/htdocs/servers/group-delete-process.php index 0174948..b1b0495 100755 --- a/htdocs/servers/group-delete-process.php +++ b/htdocs/servers/group-delete-process.php @@ -61,7 +61,7 @@ if (error_check()) { $_SESSION["error"]["form"]["name_server_group_delete"] = "failed"; - header("Location: ../index.php?page=servers/group-delete.php&id=". $obj_name_server_group->id .""); + header("Location: ../index.php?page=servers/group-delete.php&id=". $obj_name_server_group->id); exit(0); } diff --git a/htdocs/servers/group-delete.php b/htdocs/servers/group-delete.php index 28abdf4..74adcc7 100755 --- a/htdocs/servers/group-delete.php +++ b/htdocs/servers/group-delete.php @@ -18,7 +18,7 @@ class page_output var $lock_delete; - function page_output() + function __construct() { // initate object @@ -31,8 +31,8 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Adjust Server Group", "page=servers/group-view.php&id=". $this->obj_name_server_group->id .""); - $this->obj_menu_nav->add_item("Delete Server Group", "page=servers/group-delete.php&id=". $this->obj_name_server_group->id ."", TRUE); + $this->obj_menu_nav->add_item("Adjust Server Group", "page=servers/group-view.php&id=". $this->obj_name_server_group->id); + $this->obj_menu_nav->add_item("Delete Server Group", "page=servers/group-delete.php&id=". $this->obj_name_server_group->id, TRUE); } diff --git a/htdocs/servers/group-edit-process.php b/htdocs/servers/group-edit-process.php index ce0983d..28ed9fc 100755 --- a/htdocs/servers/group-edit-process.php +++ b/htdocs/servers/group-edit-process.php @@ -67,7 +67,7 @@ if ($obj_name_server_group->id) { $_SESSION["error"]["form"]["name_server_group_edit"] = "failed"; - header("Location: ../index.php?page=servers/group-view.php&id=". $obj_name_server_group->id .""); + header("Location: ../index.php?page=servers/group-view.php&id=". $obj_name_server_group->id); } else { @@ -94,7 +94,7 @@ Return */ - header("Location: ../index.php?page=servers/group-view.php&id=". $obj_name_server_group->id .""); + header("Location: ../index.php?page=servers/group-view.php&id=". $obj_name_server_group->id); exit(0); diff --git a/htdocs/servers/group-view.php b/htdocs/servers/group-view.php index 96b7370..2c8da84 100755 --- a/htdocs/servers/group-view.php +++ b/htdocs/servers/group-view.php @@ -15,7 +15,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // initate object @@ -28,8 +28,8 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Adjust Server Group", "page=servers/group-view.php&id=". $this->obj_name_server_group->id ."", TRUE); - $this->obj_menu_nav->add_item("Delete Server Group", "page=servers/group-delete.php&id=". $this->obj_name_server_group->id .""); + $this->obj_menu_nav->add_item("Adjust Server Group", "page=servers/group-view.php&id=". $this->obj_name_server_group->id, TRUE); + $this->obj_menu_nav->add_item("Delete Server Group", "page=servers/group-delete.php&id=". $this->obj_name_server_group->id); } diff --git a/htdocs/servers/logs.php b/htdocs/servers/logs.php index b8a0dbc..13a8c47 100755 --- a/htdocs/servers/logs.php +++ b/htdocs/servers/logs.php @@ -16,7 +16,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // initate object @@ -29,9 +29,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Adjust Server Configuration", "page=servers/view.php&id=". $this->obj_name_server->id .""); - $this->obj_menu_nav->add_item("View Server-Specific Logs", "page=servers/logs.php&id=". $this->obj_name_server->id ."", TRUE); - $this->obj_menu_nav->add_item("Delete Server", "page=servers/delete.php&id=". $this->obj_name_server->id .""); + $this->obj_menu_nav->add_item("Adjust Server Configuration", "page=servers/view.php&id=". $this->obj_name_server->id); + $this->obj_menu_nav->add_item("View Server-Specific Logs", "page=servers/logs.php&id=". $this->obj_name_server->id, TRUE); + $this->obj_menu_nav->add_item("Delete Server", "page=servers/delete.php&id=". $this->obj_name_server->id); } diff --git a/htdocs/servers/view.php b/htdocs/servers/view.php index 590ba6c..4481927 100755 --- a/htdocs/servers/view.php +++ b/htdocs/servers/view.php @@ -15,7 +15,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // initate object @@ -28,14 +28,14 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("Adjust Server Configuration", "page=servers/view.php&id=". $this->obj_name_server->id ."", TRUE); + $this->obj_menu_nav->add_item("Adjust Server Configuration", "page=servers/view.php&id=". $this->obj_name_server->id, TRUE); if ($GLOBALS["config"]["FEATURE_LOGS_API"]) { - $this->obj_menu_nav->add_item("View Server-Specific Logs", "page=servers/logs.php&id=". $this->obj_name_server->id .""); + $this->obj_menu_nav->add_item("View Server-Specific Logs", "page=servers/logs.php&id=". $this->obj_name_server->id); } - $this->obj_menu_nav->add_item("Delete Server", "page=servers/delete.php&id=". $this->obj_name_server->id .""); + $this->obj_menu_nav->add_item("Delete Server", "page=servers/delete.php&id=". $this->obj_name_server->id); } @@ -239,7 +239,7 @@ function execute() if (!empty($this->obj_name_server->data["sync_status_config"])) { - $this->obj_form->structure["sync_status_config"]["defaultvalue"] = "". lang_trans("status_unsynced") ." Last synced on ". time_format_humandate($this->obj_name_server->data["api_sync_config"]) ." ". date("H:i:s", $this->obj_name_server->data["api_sync_log"]) .""; + $this->obj_form->structure["sync_status_config"]["defaultvalue"] = "". lang_trans("status_unsynced") ." Last synced on ". time_format_humandate($this->obj_name_server->data["api_sync_config"]) ." ". date("H:i:s", $this->obj_name_server->data["api_sync_log"]); } else { @@ -251,11 +251,11 @@ function execute() { if (!empty($this->obj_name_server->data["sync_status_log"])) { - $this->obj_form->structure["sync_status_log"]["defaultvalue"] = "". lang_trans("status_unsynced") ." Logging appears stale, last synced on ". time_format_humandate($this->obj_name_server->data["api_sync_log"]) ." ". date("H:i:s", $this->obj_name_server->data["api_sync_log"]) .""; + $this->obj_form->structure["sync_status_log"]["defaultvalue"] = "". lang_trans("status_unsynced") ." Logging appears stale, last synced on ". time_format_humandate($this->obj_name_server->data["api_sync_log"]) ." ". date("H:i:s", $this->obj_name_server->data["api_sync_log"]); } else { - $this->obj_form->structure["sync_status_log"]["defaultvalue"] = "". lang_trans("status_synced") ." Last log message delivered on ". time_format_humandate($this->obj_name_server->data["api_sync_log"]) ." ". date("H:i:s", $this->obj_name_server->data["api_sync_log"]) .""; + $this->obj_form->structure["sync_status_log"]["defaultvalue"] = "". lang_trans("status_synced") ." Last log message delivered on ". time_format_humandate($this->obj_name_server->data["api_sync_log"]) ." ". date("H:i:s", $this->obj_name_server->data["api_sync_log"]); } } else diff --git a/htdocs/user/login-process.php b/htdocs/user/login-process.php index 8af7f52..30183da 100755 --- a/htdocs/user/login-process.php +++ b/htdocs/user/login-process.php @@ -12,7 +12,7 @@ // erase any data - gets rid of stale errors and user sessions. -if ($_SESSION["user"]["debug"] == "on") +if (isset($_SESSION["user"]["debug"]) && $_SESSION["user"]["debug"] == "on") { $_SESSION["error"] = array(); $_SESSION["user"] = array(); @@ -46,7 +46,7 @@ $password = security_form_input("/^\S*$/", "password_namedmanager", 1, "Please enter a password."); - if ($_SESSION["error"]["message"]) + if (!empty($_SESSION["error"]["message"])) { // errors occured header("Location: ../index.php?page=user/login.php"); @@ -66,7 +66,7 @@ // if user has been redirected to login from a previous page, lets take them to that page. if ($_SESSION["login"]["previouspage"]) { - header("Location: ../index.php?" . $_SESSION["login"]["previouspage"] . ""); + header("Location: ../index.php?" . $_SESSION["login"]["previouspage"]); $_SESSION["login"] = array(); exit(0); } diff --git a/htdocs/user/options.php b/htdocs/user/options.php index 597e873..cfbc2a4 100755 --- a/htdocs/user/options.php +++ b/htdocs/user/options.php @@ -13,7 +13,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { //$this->id = security_script_input('/^[0-9]*$/', $_GET["id"]); $this->id = $_SESSION["user"]["id"]; diff --git a/htdocs/user/user-delete-process.php b/htdocs/user/user-delete-process.php index 390f39f..6e177a7 100755 --- a/htdocs/user/user-delete-process.php +++ b/htdocs/user/user-delete-process.php @@ -13,7 +13,7 @@ include_once("../include/application/main.php"); -if (user_permissions_get(namedadmins)) +if (user_permissions_get("namedadmins")) { ///////////////////////// diff --git a/htdocs/user/user-delete.php b/htdocs/user/user-delete.php index db4741a..62c667f 100755 --- a/htdocs/user/user-delete.php +++ b/htdocs/user/user-delete.php @@ -15,7 +15,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // fetch variables $this->id = security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -23,9 +23,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("User's Details", "page=user/user-view.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("User's Permissions", "page=user/user-permissions.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete User", "page=user/user-delete.php&id=". $this->id ."", TRUE); + $this->obj_menu_nav->add_item("User's Details", "page=user/user-view.php&id=". $this->id); + $this->obj_menu_nav->add_item("User's Permissions", "page=user/user-permissions.php&id=". $this->id); + $this->obj_menu_nav->add_item("Delete User", "page=user/user-delete.php&id=". $this->id, TRUE); } diff --git a/htdocs/user/user-edit-process.php b/htdocs/user/user-edit-process.php index b17696e..87348ad 100755 --- a/htdocs/user/user-edit-process.php +++ b/htdocs/user/user-edit-process.php @@ -14,7 +14,7 @@ include_once("../include/application/main.php"); -if (user_permissions_get(namedadmins)) +if (user_permissions_get("namedadmins")) { ////// INPUT PROCESSING //////////////////////// @@ -113,7 +113,7 @@ //// PROCESS DATA //////////////////////////// - if ($_SESSION["error"]["message"]) + if (isset($_SESSION["error"]["message"])) { if ($mode == "edit") { @@ -199,7 +199,7 @@ // generate a new password and salt - if ($data["password"]) + if (!empty($data["password"])) { user_changepwd($id, $data["password"]); } @@ -254,7 +254,7 @@ $sql_obj->string = "UPDATE config SET value='update_required' WHERE name='PROCMAIL_UPDATE_STATUS' LIMIT 1"; $sql_obj->execute(); - if ($_SESSION["error"]["message"]) + if (isset($_SESSION["error"]["message"])) { $sql_obj->trans_rollback(); diff --git a/htdocs/user/user-permissions-process.php b/htdocs/user/user-permissions-process.php index 75ee057..e2a5263 100755 --- a/htdocs/user/user-permissions-process.php +++ b/htdocs/user/user-permissions-process.php @@ -14,7 +14,7 @@ include_once("../include/application/main.php"); -if (user_permissions_get(namedadmins)) +if (user_permissions_get("namedadmins")) { ////// INPUT PROCESSING //////////////////////// diff --git a/htdocs/user/user-permissions.php b/htdocs/user/user-permissions.php index 3d0323f..4a6e1ae 100755 --- a/htdocs/user/user-permissions.php +++ b/htdocs/user/user-permissions.php @@ -16,7 +16,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // fetch variables $this->id = security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -24,9 +24,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("User's Details", "page=user/user-view.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("User's Permissions", "page=user/user-permissions.php&id=". $this->id ."", TRUE); - $this->obj_menu_nav->add_item("Delete User", "page=user/user-delete.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("User's Details", "page=user/user-view.php&id=". $this->id); + $this->obj_menu_nav->add_item("User's Permissions", "page=user/user-permissions.php&id=". $this->id, TRUE); + $this->obj_menu_nav->add_item("Delete User", "page=user/user-delete.php&id=". $this->id); } diff --git a/htdocs/user/user-view.php b/htdocs/user/user-view.php index 6d2e20c..455d67d 100755 --- a/htdocs/user/user-view.php +++ b/htdocs/user/user-view.php @@ -14,7 +14,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // fetch variables $this->id = security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -22,9 +22,9 @@ function page_output() // define the navigiation menu $this->obj_menu_nav = New menu_nav; - $this->obj_menu_nav->add_item("User's Details", "page=user/user-view.php&id=". $this->id ."", TRUE); - $this->obj_menu_nav->add_item("User's Permissions", "page=user/user-permissions.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete User", "page=user/user-delete.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("User's Details", "page=user/user-view.php&id=". $this->id, TRUE); + $this->obj_menu_nav->add_item("User's Permissions", "page=user/user-permissions.php&id=". $this->id); + $this->obj_menu_nav->add_item("Delete User", "page=user/user-delete.php&id=". $this->id); } @@ -73,6 +73,8 @@ function execute() $sql_obj->string = "SELECT name, value FROM users_options WHERE userid='". $this->id ."'"; $sql_obj->execute(); + $options = array(); + if ($sql_obj->num_rows()) { $sql_obj->fetch_array(); @@ -158,14 +160,14 @@ function execute() // options $structure = form_helper_prepare_radiofromdb("option_lang", "SELECT name as id, name as label FROM language_avaliable ORDER BY name"); - $structure["defaultvalue"] = $options["lang"]; + $structure["defaultvalue"] = $options["lang"] ?? null; $this->obj_form->add_input($structure); $structure = NULL; $structure["fieldname"] = "option_dateformat"; $structure["type"] = "radio"; $structure["values"] = array("yyyy-mm-dd", "mm-dd-yyyy", "dd-mm-yyyy"); - $structure["defaultvalue"] = $options["dateformat"]; + $structure["defaultvalue"] = $options["dateformat"] ?? null; $this->obj_form->add_input($structure); /* @@ -179,14 +181,14 @@ function execute() $structure = NULL; $structure["fieldname"] = "option_shrink_tableoptions"; $structure["type"] = "checkbox"; - $structure["defaultvalue"] = $options["shrink_tableoptions"]; + $structure["defaultvalue"] = $options["shrink_tableoptions"] ?? null; $structure["options"]["label"] = "Automatically hide the options table when using defaults"; $this->obj_form->add_input($structure); $structure = NULL; $structure["fieldname"] = "option_debug"; $structure["type"] = "checkbox"; - $structure["defaultvalue"] = $options["debug"]; + $structure["defaultvalue"] = $options["debug"] ?? null; $structure["options"]["label"] = "Enable debug logging - this will impact performance a bit but will show a full trail of all functions and SQL queries made"; $this->obj_form->add_input($structure); @@ -194,7 +196,7 @@ function execute() $structure = NULL; $structure["fieldname"] = "option_concurrent_logins"; $structure["type"] = "checkbox"; - $structure["defaultvalue"] = $options["concurrent_logins"]; + $structure["defaultvalue"] = $options["concurrent_logins"] ?? null; $structure["options"]["label"] = "Permit this user to make multiple simultaneous logins"; $this->obj_form->add_input($structure);