Skip to content
20 changes: 10 additions & 10 deletions bind/include/amberphplib/inc_file_uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -173,15 +173,15 @@ 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:
log_write("error", "file_storage", "No file supplied for upload.");
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;
}

Expand Down Expand Up @@ -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"]);



Expand All @@ -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")
{
Expand All @@ -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();
Expand Down Expand Up @@ -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")
{
Expand All @@ -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);
}


Expand Down Expand Up @@ -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")
{
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion bind/include/amberphplib/inc_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
29 changes: 7 additions & 22 deletions bind/include/amberphplib/inc_journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class journal_base

Class Contructor
*/
function journal_base()
function __construct()
{
// init the SQL structure
$this->sql_obj = New sql_query;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bind/include/amberphplib/inc_language.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions bind/include/amberphplib/inc_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion bind/include/amberphplib/inc_misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ function dir_list_contents($directory='.')
{
$filepath = $directory . '/' . $file;

array_push($files, $filepath);
$files[] = $filepath;

if ( is_dir($filepath) )
{
Expand Down
2 changes: 1 addition & 1 deletion bind/include/amberphplib/inc_phone_home.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
}


Expand Down
14 changes: 5 additions & 9 deletions bind/include/amberphplib/inc_security.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 4 additions & 12 deletions bind/include/amberphplib/inc_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down
13 changes: 6 additions & 7 deletions bind/include/amberphplib/inc_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class table

Constructor Function
*/
function table()
function __construct()
{
// init the SQL structure
$this->sql_obj = New sql_query;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1558,7 +1558,7 @@ function render_table_html()
}
else
{
print "<a href=\"index.php?page=". $this->links[$link]["page"] ."";
print "<a href=\"index.php?page=". $this->links[$link]["page"];
}

// add each option
Expand Down Expand Up @@ -1769,7 +1769,7 @@ function render_table_html()
}
else
{
print "<a class=\"button_small ". $this->links[$link]["options"]["class"] ."\" href=\"index.php?page=". $this->links[$link]["page"] ."";
print "<a class=\"button_small ". $this->links[$link]["options"]["class"] ."\" href=\"index.php?page=". $this->links[$link]["page"];
}

// add each option
Expand Down Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bind/include/amberphplib/inc_template_engines.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class template_engine
/*
Constructor/Destructors
*/
function template_engine()
function __construct()
{
log_debug("template_engine", "Executing template_engine()");

Expand All @@ -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"]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions bind/include/amberphplib/inc_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class user_auth
Constructor
*/

function user_auth()
function __construct()
{
log_debug("user_auth", "Executing user_auth()");

Expand Down Expand Up @@ -1230,7 +1230,7 @@ class blacklist
/*
Constructor
*/
function blacklist()
function __construct()
{
// default IP address to use
$this->ipaddress = $_SERVER["REMOTE_ADDR"];
Expand Down
2 changes: 1 addition & 1 deletion bind/include/amberphplib/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");


Expand Down
Loading