Commit 65ea2ecf authored by mcramer's avatar mcramer
Browse files

Fixed/Implemented: replaced intval() by $app->functions->intval() in all...

Fixed/Implemented: replaced intval() by $app->functions->intval() in all interface functions due to big number problem in intval()
parent 3064f83f
......@@ -81,7 +81,8 @@ class app {
if(empty($_SESSION['s']['language'])) $_SESSION['s']['language'] = $conf['language'];
}
$this->uses('auth,plugin,functions');
$this->uses('functions'); // we need this before all others!
$this->uses('auth,plugin');
}
public function __destruct() {
......@@ -119,7 +120,7 @@ class app {
if($priority >= $this->_conf['log_priority']) {
// $server_id = $conf["server_id"];
$server_id = 0;
$priority = intval($priority);
$priority = $this->functions->intval($priority);
$tstamp = time();
$msg = $this->db->quote('[INTERFACE]: '.$msg);
$this->db->query("INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ($server_id,0,$priority,$tstamp,'$msg')");
......
......@@ -210,7 +210,7 @@ class ApsGUIController extends ApsBase
//* Get server config of the web server
$this->app->uses("getconf");
$web_config = $this->app->getconf->get_server_config(intval($websrv["server_id"]),'web');
$web_config = $this->app->getconf->get_server_config($app->functions->intval($websrv["server_id"]),'web');
//* Set mysql mode to php-fcgi and enable suexec in website on apache servers
if($web_config['server_type'] == 'apache') {
......@@ -239,7 +239,7 @@ class ApsGUIController extends ApsBase
$client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']);
if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) {
$mysql_db_server_id = $client['default_dbserver'];
$dbserver_config = $web_config = $app->getconf->get_server_config(intval($mysql_db_server_id),'server');
$dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id),'server');
$mysql_db_host = $dbserver_config['ip_address'];
$mysql_db_remote_access = 'y';
$mysql_db_remote_ips = $dbserver_config['ip_address'];
......@@ -322,7 +322,7 @@ class ApsGUIController extends ApsBase
if($tmp['database_id'] > 0) $this->db->datalogDelete('web_database', 'database_id', $tmp['database_id']);
$database_user = $tmp['database_user_id'];
$tmp = $this->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . intval($database_user) . "' OR `database_ro_user_id` = '" . intval($database_user) . "'");
$tmp = $this->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'");
if($tmp['cnt'] < 1) $this->db->datalogDelete('web_database_user', 'database_user_id', $database_user);
$this->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_REMOVE, 'id', $instanceid);
......@@ -449,6 +449,8 @@ class ApsGUIController extends ApsBase
*/
public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array())
{
global $app;
$ret = array();
$input = array();
$error = array();
......@@ -566,12 +568,12 @@ class ApsGUIController extends ApsBase
{
if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password')
{
if(intval($setting['SettingMinLength']) != 0
&& strlen($postinput[$setting_id]) < intval($setting['SettingMinLength']))
if($app->functions->intval($setting['SettingMinLength'], true) != 0
&& strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true))
$temp_errstr = sprintf($this->app->lng('error_short_value_for'), $setting['setting_name']);
if(intval($setting['SettingMaxLength']) != 0
&& strlen($postinput[$setting_id]) > intval($setting['SettingMaxLength']))
if($app->functions->intval($setting['SettingMaxLength'], true) != 0
&& strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true))
$temp_errstr = sprintf($this->app->lng('error_long_value_for'), $setting['setting_name']);
if(isset($setting['SettingRegex'])
......
......@@ -47,7 +47,7 @@ class auth {
public function has_clients($userid) {
global $app, $conf;
$userid = intval($userid);
$userid = $app->functions->intval($userid);
$client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
if($client['limit_client'] > 0) {
return true;
......@@ -60,8 +60,8 @@ class auth {
public function add_group_to_user($userid,$groupid) {
global $app;
$userid = intval($userid);
$groupid = intval($groupid);
$userid = $app->functions->intval($userid);
$groupid = $app->functions->intval($groupid);
if($userid > 0 && $groupid > 0) {
$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid");
......@@ -98,8 +98,8 @@ class auth {
public function remove_group_from_user($userid,$groupid) {
global $app;
$userid = intval($userid);
$groupid = intval($groupid);
$userid = $app->functions->intval($userid);
$groupid = $app->functions->intval($groupid);
if($userid > 0 && $groupid > 0) {
$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid");
......
......@@ -15,7 +15,7 @@ class client_templates {
/*
* Get the master-template for the client
*/
$sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . intval($clientId);
$sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId);
$record = $app->db->queryOneRecord($sql);
$masterTemplateId = $record['template_master'];
$additionalTemplateStr = $record['template_additional'];
......@@ -24,7 +24,7 @@ class client_templates {
* if the master-Template is custom there is NO changing
*/
if ($masterTemplateId > 0){
$sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId);
$sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($masterTemplateId);
$limits = $app->db->queryOneRecord($sql);
} else {
// if there is no master template it makes NO SENSE adding sub templates.
......@@ -40,7 +40,7 @@ class client_templates {
$addTpl = explode('/', $additionalTemplateStr);
foreach ($addTpl as $item){
if (trim($item) != ''){
$sql = "SELECT * FROM client_template WHERE template_id = " . intval($item);
$sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($item);
$addLimits = $app->db->queryOneRecord($sql);
/* maybe the template is deleted in the meantime */
if (is_array($addLimits)){
......@@ -115,7 +115,7 @@ class client_templates {
}
}
if($update != '') {
$sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . intval($clientId);
$sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . $app->functions->intval($clientId);
$app->db->query($sql);
}
}
......
......@@ -140,6 +140,7 @@ class form {
* @return record
*/
function decode($record) {
global $app;
if(is_array($record)) {
foreach($record as $key => $val) {
switch ($this->tableDef[$key]['datatype']) {
......@@ -154,7 +155,7 @@ class form {
break;
case 'INTEGER':
$new_record[$key] = intval($val);
$new_record[$key] = $app->functions->intval($val);
break;
case 'DOUBLE':
......@@ -306,7 +307,7 @@ class form {
}
break;
case 'INTEGER':
$new_record[$key] = intval($val);
$new_record[$key] = $app->functions->intval($val);
break;
case 'DOUBLE':
$new_record[$key] = $app->db->quote($val);
......
......@@ -299,7 +299,15 @@ class functions {
return $result_array;
}
public function intval($string, $force_numeric = false) {
if(intval($string) == 2147483647) {
if($force_numeric == true) return floatval($string);
elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
else return 0;
} else {
return intval($string);
}
}
}
......
......@@ -37,7 +37,7 @@ class getconf {
if(!isset($this->config[$server_id])) {
$app->uses('ini_parser');
$server_id = intval($server_id);
$server_id = $app->functions->intval($server_id);
$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id);
$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server['config']));
}
......
......@@ -194,14 +194,14 @@ class listform {
global $app, $conf;
//* Add Global Limit from selectbox
if(!empty($_POST['search_limit']) AND intval($_POST['search_limit'])){
$_SESSION['search']['limit'] = intval($_POST['search_limit']);
if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit'])){
$_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']);
}
//* Get Config variables
$list_name = $this->listDef['name'];
$search_prefix = $this->listDef['search_prefix'];
$records_per_page = (empty($_SESSION['search']['limit']) ? intval($this->listDef['records_per_page']) : intval($_SESSION['search']['limit'])) ;
$records_per_page = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
$table = $this->listDef['table'];
//* set PAGE to zero, if in session not set
......@@ -210,14 +210,14 @@ class listform {
}
//* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = intval($_REQUEST["page"]);
if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
//* PAGE to 0 set, if look for themselves ? page auf 0 setzen, wenn suche sich ge�ndert hat.
if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
$sql_von = intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
$sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
$record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
$pages = intval(($record_count['anzahl'] - 1) / $records_per_page);
$pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
$vars['list_file'] = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
......@@ -331,7 +331,7 @@ class listform {
break;
case 'INTEGER':
$record[$key] = intval($record[$key]);
$record[$key] = $app->functions->intval($record[$key]);
break;
case 'DOUBLE':
......@@ -387,7 +387,7 @@ class listform {
break;
case 'INTEGER':
$record[$key] = intval($record[$key]);
$record[$key] = $app->functions->intval($record[$key]);
break;
case 'DOUBLE':
......
......@@ -53,7 +53,7 @@ class plugin_backuplist extends plugin_base {
$error = '';
if(isset($_GET['backup_action'])) {
$backup_id = intval($_GET['backup_id']);
$backup_id = $app->functions->intval($_GET['backup_id']);
if($_GET['backup_action'] == 'download' && $backup_id > 0) {
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
......
......@@ -1023,11 +1023,11 @@ class remoting {
return false;
}
$sys_userid = intval($sys_userid);
$sys_userid = $app->functions->intval($sys_userid);
$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
if(isset($rec['client_id'])) {
return intval($rec['client_id']);
return $app->functions->intval($rec['client_id']);
} else {
$this->server->fault('no_client_found', 'There is no sysuser account for this client ID.');
return false;
......@@ -1043,11 +1043,11 @@ class remoting {
return false;
}
$client_id = intval($client_id);
$client_id = $app->functions->intval($client_id);
$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client_id);
if(isset($rec['groupid'])) {
return intval($rec['groupid']);
return $app->functions->intval($rec['groupid']);
} else {
$this->server->fault('no_group_found', 'There is no group for this client ID.');
return false;
......@@ -1112,12 +1112,12 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$client_id = intval($client_id);
$client_id = $app->functions->intval($client_id);
$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic';
$tables_array = explode(',',$tables);
$client_group_id = intval($client_group['groupid']);
$client_group_id = $app->functions->intval($client_group['groupid']);
$table_list = array();
if($client_group_id > 1) {
......@@ -1133,7 +1133,7 @@ class remoting {
if($client_id > 0) {
// remove the group of the client from the resellers group
$parent_client_id = intval($this->dataRecord['parent_client_id']);
$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
......@@ -1147,7 +1147,7 @@ class remoting {
// Delete all records (sub-clients, mail, web, etc....) of this client.
$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic';
$tables_array = explode(',',$tables);
$client_group_id = intval($client_group['groupid']);
$client_group_id = $app->functions->intval($client_group['groupid']);
if($client_group_id > 1) {
foreach($tables_array as $table) {
if($table != '') {
......@@ -1507,7 +1507,7 @@ class remoting {
}
if(!isset($params['client_group_id']) or (isset($params['client_group_id']) && empty($params['client_group_id']))) {
$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".intval($client_id));
$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($client_id));
$params['client_group_id'] = $rec['groupid'];
}
......@@ -1769,7 +1769,7 @@ class remoting {
}
// Delete all users that belong to this folder. - taken from web_folder_delete.php
$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".intval($primary_id)."'");
$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($primary_id)."'");
foreach($records as $rec) {
$this->deleteQuery('../sites/form/web_folder_user.tform.php',$rec['web_folder_user_id']);
//$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']);
......@@ -1874,7 +1874,7 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$group_id = intval($group_id);
$group_id = $app->functions->intval($group_id);
$sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid = $group_id ";
$all = $app->db->queryAllRecords($sql);
return $all;
......@@ -1892,7 +1892,7 @@ class remoting {
return false;
}
$client = $app->db->queryOneRecord("SELECT default_dnsserver FROM client WHERE client_id = ".intval($client_id));
$client = $app->db->queryOneRecord("SELECT default_dnsserver FROM client WHERE client_id = ".$app->functions->intval($client_id));
$server_id = $client["default_dnsserver"];
$template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'");
$fields = explode(',',$template_record['fields']);
......@@ -1959,7 +1959,7 @@ class remoting {
if($error == '') {
// Insert the soa record
$tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ".intval($client_id));
$tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ".$app->functions->intval($client_id));
$sys_userid = $tmp['userid'];
$sys_groupid = $tmp['default_group'];
unset($tmp);
......@@ -2024,7 +2024,7 @@ class remoting {
$rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin.'%');
if(isset($rec['id'])) {
return intval($rec['id']);
return $app->functions->intval($rec['id']);
} else {
$this->server->fault('no_domain_found', 'There is no domain ID with informed domain name.');
return false;
......@@ -2909,11 +2909,11 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$sys_userid = intval($sys_userid);
$sys_userid = $app->functions->intval($sys_userid);
$sys_groupid = explode(',', $sys_groupid);
$new_group = array();
foreach($sys_groupid as $group_id) {
$new_group[] = intval( $group_id);
$new_group[] = $app->functions->intval( $group_id);
}
$group_list = implode(',', $new_group);
$sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR sys_perm_other LIKE '%r%') AND type = 'vhost'";
......@@ -2947,7 +2947,7 @@ class remoting {
} else {
$status = 'n';
}
$sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".intval($primary_id);
$sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
$app->db->query($sql);
$result = $app->db->affectedRows();
return $result;
......@@ -3017,7 +3017,7 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$client_id = intval($client_id);
$client_id = $app->functions->intval($client_id);
$client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id);
if($client['client_id'] > 0) {
$new_password = $app->db->quote($new_password);
......@@ -3080,7 +3080,7 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$client_id = intval($client_id);
$client_id = $app->functions->intval($client_id);
$sql = "SELECT d.database_id, d.database_name, d.database_user_id, d.database_ro_user_id, du.database_user, du.database_password FROM web_database d LEFT JOIN web_database_user du ON (du.database_user_id = d.database_user_id) INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id";
$all = $app->db->queryAllRecords($sql);
return $all;
......@@ -3113,8 +3113,8 @@ class remoting {
return false;
}
if (!empty($client_id) && !empty($server_id)) {
$server_id = intval($server_id);
$client_id = intval($client_id);
$server_id = $app->functions->intval($server_id);
$client_id = $app->functions->intval($client_id);
$sql = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
$result = $app->db->queryAllRecords($sql);
return $result;
......@@ -3134,7 +3134,7 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$sql = "SELECT * FROM dns_rr WHERE zone = ".intval($zone_id);;
$sql = "SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($zone_id);;
$result = $app->db->queryAllRecords($sql);
return $result;
}
......@@ -3159,7 +3159,7 @@ class remoting {
} else {
$status = 'N';
}
$sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id);
$sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".$app->functions->intval($primary_id);
$app->db->query($sql);
$result = $app->db->affectedRows();
return $result;
......@@ -3181,7 +3181,7 @@ class remoting {
} else {
$status = 'n';
}
$sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".intval($primary_id);
$sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
$app->db->query($sql);
$result = $app->db->affectedRows();
return $result;
......@@ -3308,7 +3308,7 @@ class remoting {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$server_id = intval($server_id);
$server_id = $app->functions->intval($server_id);
if($server_id > 0) {
$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = $server_id LIMIT 0,1");
......@@ -3380,9 +3380,9 @@ class remoting {
}
if (!empty($client_id)) {
$client_id = intval($client_id);
$client_id = $app->functions->intval($client_id);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
$sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ".intval($tmp['groupid']);
$sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ".$app->functions->intval($tmp['groupid']);
$result = $app->db->queryAllRecords($sql);
return $result;
}
......@@ -3410,8 +3410,8 @@ class remoting {
}
$template_id = intval($template_id);
$ostemplate_id = intval($ostemplate_id);
$template_id = $app->functions->intval($template_id);
$ostemplate_id = $app->functions->intval($ostemplate_id);
//* Verify parameters
if($template_id == 0) {
......
......@@ -37,39 +37,37 @@ Copyright (c) Tri-Plex technology
/**
* Formularbehandlung
*
* Funktionen zur Umwandlung von Formulardaten
* sowie zum vorbereiten von HTML und SQL
* Ausgaben
* Functions to validate, display and save form values
*
* Tabellendefinition
* Database table field definitions
*
* Datentypen:
* - INTEGER (Wandelt Ausdr�cke in Int um)
* Datatypes:
* - INTEGER (Converts data to int automatically)
* - DOUBLE
* - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
* - VARCHAR (kein weiterer Format Check)
* - DATE (Datumsformat, Timestamp Umwandlung)
* - CURRENCY (Formats digits in currency notation)
* - VARCHAR (No format check)
* - DATE (Date format, converts from and to UNIX timestamps automatically)
*
* Formtype:
* - TEXT (normales Textfeld)
* - PASSWORD (Feldinhalt wird nicht angezeigt)
* - SELECT (Gibt Werte als option Feld aus)
* - MULTIPLE (Select-Feld mit nehreren Werten)
* - TEXT (Normal text field)
* - PASSWORD (password field, the content will not be displayed again to the user)
* - SELECT (Option fiield)
* - MULTIPLE (Allows selection of multiple values)
*
* VALUE:
* - Wert oder Array
* - Value or array
*
* SEPARATOR
* - Trennzeichen f�r multiple Felder
* - separator char used for fileds with multiple values
*
* Hint: The auto increment (ID) filed of the table has not be be definied separately.
*
* Hinweis:
* Das ID-Feld ist nicht bei den Table Values einzuf�gen.
*/
class remoting_lib {
/**
* Definition of the database atble (array)
* Definition of the database table (array)
* @var tableDef
*/
private $tableDef;
......@@ -141,7 +139,7 @@ class remoting_lib {
function loadUserProfile($client_id = 0) {
global $app,$conf;
$client_id = intval($client_id);
$client_id = $app->functions->intval($client_id);
if($client_id == 0) {
$this->sys_username = 'admin';
......@@ -176,7 +174,8 @@ class remoting_lib {
/**
* Converts data in human readable form
* Converts the data in the array to human readable format
* Datatype conversion e.g. to show the data in lists
*
* @param record
* @return record
......@@ -208,13 +207,7 @@ class remoting_lib {
break;
case 'INTEGER':
//* We use + 0 to force the string to be a number as
//* intval return value is too limited on 32bit systems
if(intval($record[$key]) == 2147483647) {
$new_record[$key] = $record[$key] + 0;
} else {
$new_record[$key] = intval($record[$key]);
}
$new_record[$key] = $app->functions->intval($record[$key]);
break;
case 'DOUBLE':
......@@ -222,7 +215,7 @@ class remoting_lib {
break;
case 'CURRENCY':
$new_record[$key] = number_format($record[$key], 2, ',', '');
$new_record[$key] = $app->functions->currency_format($record[$key]);
break;
default:
......@@ -263,7 +256,7 @@ class remoting_lib {
unset($tmp_recordid);
$querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
// Getting the records
$tmp_records = $app->db->queryAllRecords($querystring);
if($app->db->errorMessage != '') die($app->db->errorMessage);
......@@ -285,7 +278,7 @@ class remoting_lib {
$app->uses($datasource_class);
$values = $app->$datasource_class->$datasource_function($field, $record);
} else {
$this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
}
}
......@@ -294,29 +287,39 @@ class remoting_lib {
}
/**
* Converts the data in a format to store it in the database table
/**