Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Readme
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Post any bugs to https://github.com/pellcorp/opendb/issues

- phpSniff - Copyright 2002-2004 Roger Raymond <epsilon7@users.sourceforge.net>

- phpThumb() - The PHP thumbnail creator. by James Heinrich <info@silisoftware.com>
- phpThumb() - The PHP thumbnail creator by James Heinrich <info@silisoftware.com>

- PHPMailer - 5.2.x - https://github.com/PHPMailer/PHPMailer

- adodb-time.inc.php - ADODb Date / Time functions.
Copyright (c) 2000, 2001, 2002, 2003 John Lim
Expand Down
6 changes: 3 additions & 3 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if (is_site_enabled()) {
if (is_opendb_valid_session()) {
if (is_user_granted_permission(PERM_ADMIN_TOOLS)) {
$HTTP_VARS['type'] = ifempty($HTTP_VARS['type'], 'config');
$HTTP_VARS['type'] = ifempty($HTTP_VARS['type'] ?? NULL, 'config');

$ADMIN_TYPE = $HTTP_VARS['type'];
$ADMIN_DIR = './admin/' . $ADMIN_TYPE;
Expand Down Expand Up @@ -67,7 +67,7 @@
_theme_header($title);

// todo - this should really be in the <head>...</head> - does it matter?
if ($xajax) {
if (isset($xajax)) {
$xajax->printJavascript();
}

Expand All @@ -92,4 +92,4 @@

// Cleanup after begin.inc.php
require_once("./include/end.inc.php");
?>
?>
9 changes: 5 additions & 4 deletions admin/backup/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ function get_table_content($table, $crlf) {
unset($HTTP_VARS['tables']);

$opendb_tables_r = fetch_opendb_table_list_r();
while (list(, $value) = each($opendb_tables_r)) {
foreach ($opendb_tables_r as $value) {
$HTTP_VARS['tables'][] = $value;
}
}

@reset($HTTP_VARS['tables']);
while (list(, $table) = @each($HTTP_VARS['tables'])) {
foreach ($HTTP_VARS['tables'] as $table) {
echo $CRLF . "#" . $CRLF;
echo "# " . get_opendb_lang_var('dumping_data_for_table', 'table', $table) . $CRLF;
echo "#" . $CRLF . $CRLF;
Expand All @@ -126,7 +126,8 @@ function get_table_content($table, $crlf) {
echo ("<ul class=\"checkboxGridOptionsVertical\">");

$opendb_tables_r = fetch_opendb_table_list_r();
while (list(, $table) = each($opendb_tables_r)) {
$count = 0;
foreach ($opendb_tables_r as $table) {
// the cache tables cannot be backed up as they might contain
// binary data, which we don't yet support.
if (!ends_with($table, '_cache') && $table != 'php_session') {
Expand All @@ -150,4 +151,4 @@ function get_table_content($table, $crlf) {
echo ("
</form>");
}
?>
?>
21 changes: 10 additions & 11 deletions admin/config/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function get_group_block_input_field($config_group_item_r, $value) {

if (is_array($value)) {
reset($value);
while (list($key, $val) = each($value)) {
foreach ($value as $key => $val) {
$buffer .= "<option value=\"" . $val . "\" SELECTED>" . $val . "\n";
}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ function get_group_block($config_group_r) {
global $PHP_SELF;
global $ADMIN_TYPE;

$buffer .= "<form name=\"config\" action=\"$PHP_SELF\" method=\"POST\">" . "<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">" . "<input type=\"hidden\" name=\"op\" value=\"save\">" . "<input type=\"hidden\" name=\"group_id\" value=\"" . $config_group_r['id'] . "\">";
$buffer = "<form name=\"config\" action=\"$PHP_SELF\" method=\"POST\">" . "<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">" . "<input type=\"hidden\" name=\"op\" value=\"save\">" . "<input type=\"hidden\" name=\"group_id\" value=\"" . $config_group_r['id'] . "\">";

$buffer .= "<ul class=\"saveButtons\">
<li><input type=\"submit\" class=\"submit\" value=\"Refresh\" onclick=\"this.form['op'].value='';\"></li>
Expand Down Expand Up @@ -259,9 +259,9 @@ function save_config($HTTP_VARS, &$errors) {
function save_config_item($config_group_item_r, $HTTP_VARS, &$errors) {
$http_value = NULL;
if ($config_group_item_r['keyid'] != '0')
$http_value = $HTTP_VARS[$config_group_item_r['group_id']][$config_group_item_r['id']][$config_group_item_r['keyid']];
$http_value = $HTTP_VARS[$config_group_item_r['group_id']][$config_group_item_r['id']][$config_group_item_r['keyid']] ?? "";
else
$http_value = $HTTP_VARS[$config_group_item_r['group_id']][$config_group_item_r['id']];
$http_value = $HTTP_VARS[$config_group_item_r['group_id']][$config_group_item_r['id']] ?? "";

// if old values exist, and count of new values is the same, then no need to proceed.
if ($config_group_item_r['type'] == 'array') {
Expand All @@ -272,7 +272,7 @@ function save_config_item($config_group_item_r, $HTTP_VARS, &$errors) {

if (is_not_empty_array($http_value)) {
reset($http_value);
while (list($key, $value) = each($http_value)) {
foreach ($http_value as $key => $value) {
if ($value != 'NULL') {
if (!insert_s_config_group_item_var($config_group_item_r['group_id'], $config_group_item_r['id'], $key, $value)) {
$errors[] = array('error' => 'Config Group Item Var not inserted', 'detail' => db_error());
Expand Down Expand Up @@ -311,7 +311,7 @@ function save_config_item($config_group_item_r, $HTTP_VARS, &$errors) {

@set_time_limit(0);

if (strlen($HTTP_VARS['group_id']) == 0) {
if (strlen($HTTP_VARS['group_id'] ?? "") == 0) {
$HTTP_VARS['group_id'] = 'site';
}

Expand All @@ -321,7 +321,7 @@ function save_config_item($config_group_item_r, $HTTP_VARS, &$errors) {
save_config($HTTP_VARS, $errors);
}

if (is_not_empty_array($errors))
if (is_not_empty_array($errors ?? ""))
echo format_error_block($errors);
echo get_javascript("admin/config/select.js");

Expand All @@ -342,21 +342,20 @@ function save_config_item($config_group_item_r, $HTTP_VARS, &$errors) {
$first = TRUE;

reset($config_group_rs);
while (list(, $config_group_r) = each($config_group_rs)) {
foreach ($config_group_rs as $config_group_r) {
if ($config_group_r['id'] == $HTTP_VARS['group_id'])
echo "\n<li class=\"activetab " . ($first ? " first" : "") . "\">" . $config_group_r['name'] . "</li>";
else
echo "\n<li class=\"" . ($first ? "first" : "") . "\"><a href=\"$PHP_SELF?type=$ADMIN_TYPE&group_id=" . $config_group_r['id'] . "\">" . $config_group_r['name'] . "</a></li>";
$first = FALSE;
}
db_free_result($results);

echo ("\n</ul>");

echo ("<div id=\"tab-content\">");

reset($config_group_rs);
while (list(, $config_group_r) = each($config_group_rs)) {
foreach ($config_group_rs as $config_group_r) {
if ($config_group_r['id'] == $HTTP_VARS['group_id']) {
echo get_group_block($config_group_r);
break;
Expand All @@ -366,4 +365,4 @@ function save_config_item($config_group_item_r, $HTTP_VARS, &$errors) {
}

echo ("</div>");
?>
?>
6 changes: 3 additions & 3 deletions admin/item_cache/ItemCacheAjaxJobs.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
include_once("./lib/AdminAjaxJobs.class.php");

class ItemCacheAjaxJobs extends AdminAjaxJobs {
function ItemCacheAjaxJobs($job) {
parent::AdminAjaxJobs(get_class($this), $job, 10);
function __construct($job) {
parent::__construct(get_class($this), $job, 10);
}

function __executeJob() {
Expand Down Expand Up @@ -95,4 +95,4 @@ function __perform_refresh_thumbnails_batch() {
$this->_remaining = fetch_file_cache_missing_thumbs_cnt('ITEM');
}
}
?>
?>
4 changes: 2 additions & 2 deletions admin/patch_facility/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function echo_install_sql_file($sqlfile) {
return false;
}

while (list(, $line) = each($lines)) {
foreach ($lines as $line) {
if (strlen(trim($line)) === 0)
echo ("<br />");
else {
Expand Down Expand Up @@ -122,4 +122,4 @@ function validate_sql_script($patchdir, $sqlfile) {
display_patch_list('Customise for Country', 'country');
display_patch_list('Miscellaneous Updates', 'extras');
}
?>
?>
8 changes: 4 additions & 4 deletions admin/s_address_type/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function display_s_addr_attribute_type_rltshp_row($s_address_type, $s_addr_attri

echo ("<td class=\"$class\">" . "<select name=\"s_attribute_type[$row]\">" . "\n<option value=\"\">");
reset($s_attribute_type_list_rs);
while (list(, $attribute_type_r) = each($s_attribute_type_list_rs)) {
foreach ($s_attribute_type_list_rs as $attribute_type_r) {
if (is_not_empty_array($s_addr_attribute_type_rltshp_r) && $s_addr_attribute_type_rltshp_r['s_attribute_type'] == $attribute_type_r['s_attribute_type'])
echo ("\n<option value=\"" . $attribute_type_r['s_attribute_type'] . "\" SELECTED>" . $attribute_type_r['s_attribute_type']);
else
Expand Down Expand Up @@ -302,7 +302,7 @@ function display_s_addr_attribute_type_rltshp_row($s_address_type, $s_addr_attri

// Now display records that could not be inserted.
if (is_not_empty_array($saatr_already_exists)) {
while (list(, $saatr_r) = each($saatr_already_exists)) {
foreach ($saatr_already_exists as $saatr_r) {
display_s_addr_attribute_type_rltshp_row($HTTP_VARS['s_address_type'], $saatr_r, $row, TRUE, $s_attribute_type_list_rs);
$row++;
}
Expand Down Expand Up @@ -365,7 +365,7 @@ function display_s_addr_attribute_type_rltshp_row($s_address_type, $s_addr_attri
if (strlen($HTTP_VARS['op']) == 0 || $HTTP_VARS['op'] == 'edit_types' || $HTTP_VARS['op'] == 'update_types') {
echo ("<p>[<a href=\"${PHP_SELF}?type=${ADMIN_TYPE}&op=new_type\">New Address Type</a>]</p>");

if (is_not_empty_array($errors))
if (is_not_empty_array($errors ?? ""))
echo format_error_block($errors);

$results = fetch_s_address_type_rs();
Expand Down Expand Up @@ -394,4 +394,4 @@ function display_s_addr_attribute_type_rltshp_row($s_address_type, $s_addr_attri
echo ("<p class=\"error\">No Address Types Installed</p>");
}
}
?>
?>
41 changes: 22 additions & 19 deletions admin/s_attribute_type/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
$input_type_functions_cats = array('lookup' => array('radio_grid', 'checkbox_grid', 'single_select', 'multi_select'), 'multi' => array('datetime', 'email', 'filtered', 'number', 'password', 'text', 'url'), 'normal' => array(), 'restricted' => array('review_options'));

reset($input_type_functions);
while (list($key, ) = each($input_type_functions)) {
foreach($input_type_functions as $key => $_v) {
if (!in_array($key, $input_type_functions_cats['lookup']) && !in_array($key, $input_type_functions_cats['restricted'])) {
$input_type_functions_cats['normal'][] = $key;
}
Expand Down Expand Up @@ -57,7 +57,7 @@ function get_attribute_ind_type_function_list($type) {
$new_function_list = Array();

reset($input_type_functions);
while (list($key, $function) = each($input_type_functions)) {
foreach ($input_type_functions as $key => $function) {
if (in_array($key, $input_type_functions_cats[$type])) {
$new_function_list[$key] = $function;
}
Expand All @@ -74,7 +74,7 @@ function get_attribute_ind_type_function_list($type) {
function build_function_list($name, $list_array, $function_type, $onchange_event = NULL) {
$select = "\n<select name=\"$name\" onchange=\"$onchange_event\">";

while (list($key, ) = each($list_array)) {
foreach($list_array as $key => $_v) {
if (strcasecmp($function_type, $key) === 0)
$select .= "\n<option value=\"$key\" SELECTED>$key";
else
Expand All @@ -94,7 +94,7 @@ function get_function_spec($type, $func_args) {
$args = "";

@reset($func_args);
while (list(, $value) = @each($func_args)) {
foreach ($func_args as $value) {
if (substr($value, -3) === '[Y]') {
$value = substr($value, 0, -3);
if (strlen($args) == 0)
Expand Down Expand Up @@ -124,13 +124,13 @@ function get_widget_tooltip_array() {

//name, type, description, spec, args
reset($input_type_functions);
while (list($name, $definition) = each($input_type_functions)) {
foreach ($input_type_functions as $name => $definition) {
$arrayOfAttributes .= "arrayOfWidgetTooltips[$count] = " . get_widget_js_entry($name, 'input', $definition);
$count++;
}

reset($display_type_functions);
while (list($name, $definition) = each($display_type_functions)) {
foreach ($display_type_functions as $name => $definition) {
$arrayOfAttributes .= "arrayOfWidgetTooltips[$count] = " . get_widget_js_entry($name, 'display', $definition);
$count++;
}
Expand All @@ -145,7 +145,7 @@ function get_widget_js_entry($name, $type, $definition) {
$spec = get_function_spec($name, $definition['args']);

$args = array();
while (list(, $value) = each($definition['args'])) {
foreach ($definition['args'] as $value) {
if (substr($value, -3) === "[Y]") {
$value = substr($value, 0, -3);
}
Expand Down Expand Up @@ -191,11 +191,13 @@ function display_attribute_type_form($HTTP_VARS) {
}

echo ("<div class=\"tabContainer\">" . "<form name=\"s_attribute_type_lookup\" action=\"$PHP_SELF\" method=\"POST\">" . "<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">" . "<input type=\"hidden\" name=\"op\" value=\"\">"
. "<input type=\"hidden\" name=\"s_attribute_type\" value=\"" . $HTTP_VARS['s_attribute_type'] . "\">");
. "<input type=\"hidden\" name=\"s_attribute_type\" value=\"" . ($HTTP_VARS['s_attribute_type'] ?? "") . "\">");

$isFirst = true;
echo ("<ul class=\"tabMenu\" id=\"tab-menu\">");
while (list($letter, $attribute_type_rs) = each($alpha_attribute_type_rs)) {
if (!isset($HTTP_VARS['active_tab']))
$HTTP_VARS['active_tab'] = "";
foreach ($alpha_attribute_type_rs as $letter => $attribute_type_rs) {
$isFirst ? $class = "first" : $class = "";
if ($letter == $HTTP_VARS['active_tab'] || ($HTTP_VARS['active_tab'] == "" && $isFirst))
$class .= " activeTab";
Expand All @@ -207,14 +209,14 @@ function display_attribute_type_form($HTTP_VARS) {
reset($alpha_attribute_type_rs);
$isFirst = true;
echo ('<div id="tab-content">');
while (list($letter, $attribute_type_rs) = each($alpha_attribute_type_rs)) {
foreach ($alpha_attribute_type_rs as $letter => $attribute_type_rs) {
($isFirst && $HTTP_VARS['active_tab'] == "") ? $class = "tabContent" : $class = "tabContentHidden";
if ($letter == $HTTP_VARS['active_tab'])
$class = "tabContent";
echo ("<div id=\"pane$letter\" class=\"$class\">\n" . "\n<table>" . "<tr class=\"navbar\">" . "<th>Type</th>" . "<th>Description</th>" . "<th>Field Type</th>" . "<th colspan=\"2\"></th>" . "</tr>");

while (list(, $attribute_type_r) = each($attribute_type_rs)) {
echo (get_s_attribute_type_row($attribute_type_r, $row, $letter));
foreach ($attribute_type_rs as $attribute_type_r) {
echo (get_s_attribute_type_row($attribute_type_r, NULL, $letter));
}

echo ("</table></div>");
Expand Down Expand Up @@ -244,7 +246,7 @@ function display_lookup_attribute_type_form($HTTP_VARS) {
db_free_result($results);
}

$emptyrows = 20 - (count($attribute_type_rows) % 20);
$emptyrows = 20 - (count($attribute_type_rows ?? []) % 20);
if ($emptyrows == 0)
$emptyrows = 20;

Expand Down Expand Up @@ -485,7 +487,7 @@ function build_roles_select($attribute_type_r) {
function build_options_array($type, $input_type_functions_cats) {
$buffer = "inputOptions['$type'] = new Array(";
reset($input_type_functions_cats[$type]);
while (list(, $value) = each($input_type_functions_cats[$type])) {
foreach ($input_type_functions_cats[$type] as $value) {
$buffer .= "'$value',";
}

Expand Down Expand Up @@ -538,7 +540,7 @@ function build_attribute_ind_type_widget($attribute_ind_type, $HTTP_VARS) {
$options = array('lookup' => 'Lookup', 'normal' => 'Normal', 'multi' => 'Multi Value');

$field = '';
while (list($key, $value) = each($options)) {
foreach ($options as $key => $value) {
$field .= "<input type=\"radio\" class=\"radio\" name=\"attribute_ind_type\" value=\"$key\" onClick=\"populateInputSelect(this.form['input_type'], '$key');\"";
if ($key == $attribute_ind_type)
$field .= ' CHECKED';
Expand Down Expand Up @@ -784,7 +786,7 @@ function set_attribute_ind_type(&$HTTP_VARS) {
$save_button = 'Insert';
}

if (is_not_empty_array($errors))
if (is_not_empty_array($errors ?? ""))
echo format_error_block($errors);

echo ("\n<form name=\"s_attribute_type\" action=\"$PHP_SELF\" method=\"POST\">");
Expand All @@ -796,7 +798,7 @@ function set_attribute_ind_type(&$HTTP_VARS) {
display_edit_form($attribute_type_r, $HTTP_VARS);
echo ("\n</table>");

echo (format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory')));
echo (format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), 'id' => 'compulsory')));

if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE)
echo ("\n<input type=\"button\" class=\"button\" value=\"$save_button\" onclick=\"if(!checkForm(this.form)){return false;}else{this.form.submit();}\">");
Expand Down Expand Up @@ -829,14 +831,15 @@ function toggleChecked(element, name)

echo ("\n<h3>Edit " . $HTTP_VARS['s_attribute_type'] . " Attribute Type Lookups</h3>");

if (is_not_empty_array($errors))
if (is_not_empty_array($errors ?? ""))
echo format_error_block($errors);

display_lookup_attribute_type_form($HTTP_VARS);

echo (format_help_block('Image(s) must be in a <i>theme search path</i> directory.'));

} else if ($HTTP_VARS['op'] == '') {
if (is_not_empty_array($errors))
if (is_not_empty_array($errors ?? ""))
echo format_error_block($errors);

echo ("<p>[<a href=\"${PHP_SELF}?type=${ADMIN_TYPE}&op=new\">New Attribute Type</a>]</p>");
Expand Down
4 changes: 2 additions & 2 deletions admin/s_file_type/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function insert_s_file_type_extensions($content_type, $default_extension, $alt_e
else
$extensions_r[] = $default_extension;

while (list(, $extension) = each($extensions_r)) {
foreach ($extensions_r as $extension) {
$extension = strtolower(trim($extension));
if (strlen($extension) > 0) {
$query = "INSERT INTO s_file_type_extension ( content_type, extension, default_ind )" . "VALUES ('$content_type', '" . $extension . "', '" . ($extension == $default_extension ? 'Y' : 'N') . "')";
Expand Down Expand Up @@ -211,4 +211,4 @@ function delete_s_file_type_extensions($content_type) {
return FALSE;
}
}
?>
?>
Loading