[Frontaccounting-cvs_updates] /hg/p/frontaccounting/mercurial: Access to system settings moved...
Brought to you by:
frontaccounting,
itronics
From: FrontAccounting <fro...@us...> - 2015-01-10 23:19:49
|
details: http://frontaccounting.hg.sourceforge.net:8000/hgroot/frontaccounting/frontaccounting/hg/p/frontaccounting/mercurial/rev/8abefc67175d changeset: 3488:8abefc67175d user: Janusz Dobrowolski <ja...@fr...> date: Sat Jan 10 16:53:55 2015 +0100 description: Access to system settings moved from global scope to SysPrefs. diffstat: access/login.php | 24 +++--- access/logout.php | 2 +- access/password_reset.php | 12 +- admin/attachments.php | 2 +- admin/backups.php | 4 +- admin/change_current_user_password.php | 2 +- admin/company_preferences.php | 4 +- admin/db/company_db.inc | 19 ++++- admin/db/fiscalyears_db.inc | 2 - admin/db/maintenance_db.inc | 25 +++--- admin/db/users_db.inc | 6 +- admin/display_prefs.php | 4 +- admin/inst_chart.php | 2 +- admin/inst_lang.php | 4 +- admin/inst_module.php | 2 +- admin/inst_theme.php | 2 +- admin/inst_upgrade.php | 8 +- admin/print_profiles.php | 6 +- admin/view_print_transaction.php | 2 +- admin/void_transaction.php | 2 +- config.default.php | 58 +-------------- dimensions/inquiry/search_dimensions.php | 2 +- doc/api_changes.txt | 4 +- gl/bank_account_reconcile.php | 2 +- gl/bank_transfer.php | 2 +- gl/gl_bank.php | 2 +- gl/gl_journal.php | 2 +- gl/includes/db/gl_db_rates.inc | 8 +- gl/includes/db/gl_db_trans.inc | 8 +- gl/inquiry/balance_sheet.php | 10 +- gl/inquiry/bank_inquiry.php | 2 +- gl/inquiry/gl_account_inquiry.php | 2 +- gl/inquiry/gl_trial_balance.php | 4 +- gl/inquiry/journal_inquiry.php | 2 +- gl/inquiry/profit_loss.php | 15 +-- gl/inquiry/tax_inquiry.php | 2 +- gl/manage/close_period.php | 4 +- gl/manage/exchange_rates.php | 5 +- gl/manage/gl_account_classes.php | 12 +- includes/access_levels.inc | 2 +- includes/current_user.inc | 45 ++++++----- includes/date_functions.inc | 80 ++++++++++---------- includes/db/connect_db_mysql.inc | 25 ++--- includes/db/connect_db_mysqli.inc | 30 +++---- includes/db/sql_functions.inc | 4 +- includes/db_pager.inc | 8 +- includes/errors.inc | 30 +++---- includes/main.inc | 12 ++- includes/page/header.inc | 14 +- includes/prefs/sysprefs.inc | 25 ++++- includes/prefs/userprefs.inc | 12 +- includes/session.inc | 39 +++++++--- includes/system_tests.inc | 7 +- includes/types.inc | 5 +- includes/ui/db_pager_view.inc | 2 +- includes/ui/ui_lists.inc | 81 ++++++++------------ includes/ui/ui_view.inc | 14 ++- inventory/adjustments.php | 2 +- inventory/cost_update.php | 2 +- inventory/inquiry/stock_movements.php | 2 +- inventory/manage/items.php | 14 +- inventory/manage/sales_kits.php | 2 +- inventory/transfers.php | 2 +- manufacturing/search_work_orders.php | 2 +- manufacturing/view/wo_costs_view.php | 2 +- manufacturing/view/wo_issue_view.php | 2 +- manufacturing/view/wo_production_view.php | 2 +- manufacturing/view/work_order_view.php | 2 +- manufacturing/work_order_add_finished.php | 8 +- manufacturing/work_order_costs.php | 2 +- manufacturing/work_order_entry.php | 2 +- manufacturing/work_order_issue.php | 2 +- manufacturing/work_order_release.php | 2 +- purchasing/allocations/supplier_allocate.php | 2 +- purchasing/allocations/supplier_allocation_main.php | 2 +- purchasing/inquiry/po_search.php | 2 +- purchasing/inquiry/po_search_completed.php | 2 +- purchasing/inquiry/supplier_allocation_inquiry.php | 2 +- purchasing/inquiry/supplier_inquiry.php | 2 +- purchasing/manage/suppliers.php | 2 +- purchasing/po_entry_items.php | 2 +- purchasing/po_receive_items.php | 2 +- purchasing/supplier_credit.php | 14 +-- purchasing/supplier_invoice.php | 9 +- purchasing/supplier_payment.php | 2 +- purchasing/view/view_grn.php | 2 +- purchasing/view/view_po.php | 2 +- purchasing/view/view_supp_credit.php | 2 +- purchasing/view/view_supp_invoice.php | 2 +- purchasing/view/view_supp_payment.php | 2 +- reporting/includes/Workbook.php | 6 +- reporting/includes/class.graphic.inc | 19 +--- reporting/includes/doctext.inc | 2 + reporting/includes/excel_report.inc | 6 +- reporting/includes/pdf_report.inc | 13 +- reporting/includes/reporting.inc | 4 +- reporting/includes/reports_classes.inc | 6 +- reporting/rep102.php | 6 +- reporting/rep104.php | 8 +- reporting/rep109.php | 4 +- reporting/rep110.php | 3 +- reporting/rep111.php | 12 +- reporting/rep202.php | 7 +- reporting/rep301.php | 4 +- reporting/rep303.php | 8 +- reporting/rep705.php | 6 +- reporting/rep706.php | 7 +- reporting/rep707.php | 7 +- reporting/rep708.php | 4 +- reporting/rep709.php | 2 +- sales/allocations/customer_allocate.php | 2 +- sales/allocations/customer_allocation_main.php | 2 +- sales/create_recurrent_invoices.php | 2 +- sales/credit_note_entry.php | 2 +- sales/customer_credit_invoice.php | 2 +- sales/customer_delivery.php | 2 +- sales/customer_invoice.php | 2 +- sales/customer_payments.php | 2 +- sales/includes/cart_class.inc | 4 +- sales/includes/db/cust_trans_db.inc | 6 +- sales/includes/sales_ui.inc | 4 +- sales/inquiry/customer_allocation_inquiry.php | 2 +- sales/inquiry/customer_inquiry.php | 2 +- sales/inquiry/sales_deliveries_view.php | 2 +- sales/inquiry/sales_orders_view.php | 2 +- sales/manage/customers.php | 14 +- sales/manage/recurrent_invoices.php | 2 +- sales/sales_order_entry.php | 2 +- sales/view/view_credit.php | 2 +- sales/view/view_dispatch.php | 2 +- sales/view/view_invoice.php | 2 +- sales/view/view_receipt.php | 2 +- sales/view/view_sales_order.php | 2 +- themes/aqua/renderer.php | 21 ++-- themes/cool/renderer.php | 23 ++--- themes/default/renderer.php | 23 ++--- 136 files changed, 523 insertions(+), 562 deletions(-) diffs (truncated from 4060 to 300 lines): diff -r 29e5bbcd691f -r 8abefc67175d access/login.php --- a/access/login.php Fri Jan 09 20:03:54 2015 +0100 +++ b/access/login.php Sat Jan 10 16:53:55 2015 +0100 @@ -21,15 +21,15 @@ } </script>"; add_js_file('login.js'); - // Display demo user name and password within login form if "$allow_demo_mode" is true - if ($allow_demo_mode == true) + // Display demo user name and password within login form if allow_demo_mode option is true + if ($SysPrefs->allow_demo_mode == true) { $demo_text = _("Login as user: demouser and password: password"); } else { $demo_text = _("Please login here"); - if (@$allow_password_reset) { + if (@$SysPrefs->allow_password_reset) { $demo_text .= " "._("or")." <a href='$path_to_root/index.php?reset=1'>"._("request new password")."</a>"; } } @@ -40,7 +40,7 @@ $js .= "<script>setTimeout(function() { document.getElementsByName('SubmitUser')[0].disabled=0; - document.getElementById('log_msg').innerHTML='$demo_text'}, 1000*$login_delay);</script>"; + document.getElementById('log_msg').innerHTML='$demo_text'}, 1000*".$SysPrefs->login_delay.");</script>"; $demo_text = $blocked_msg; } flush_dir(user_js_cache()); @@ -50,7 +50,7 @@ $login_timeout = $_SESSION["wa_current_user"]->last_act; - $title = $login_timeout ? _('Authorization timeout') : $app_title." ".$version." - "._("Login"); + $title = $login_timeout ? _('Authorization timeout') : $SysPrefs->app_title." ".$version." - "._("Login"); $encoding = isset($_SESSION['language']->encoding) ? $_SESSION['language']->encoding : "iso-8859-1"; $rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : "ltr"; $onload = !$login_timeout ? "onload='defaultCompany()'" : ""; @@ -79,7 +79,7 @@ start_row(); echo "<td align='center' colspan=2>"; if (!$login_timeout) { // FA logo - echo "<a target='_blank' href='$power_url'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>"; + echo "<a target='_blank' href='".$SysPrefs->power_url."'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>"; } else { echo "<font size=5>"._('Authorization timeout')."</font>"; } @@ -88,12 +88,12 @@ echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' />\n"; if (!$login_timeout) - table_section_title(_("Version")." $version Build $build_version - "._("Login")); - $value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($allow_demo_mode ? "demouser":""); + table_section_title(_("Version")." $version Build ".$SysPrefs->build_version." - "._("Login")); + $value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($SysPrefs->allow_demo_mode ? "demouser":""); text_row(_("User name"), "user_name_entry_field", $value, 20, 30); - $password = $allow_demo_mode ? "password":""; + $password = $SysPrefs->allow_demo_mode ? "password":""; password_row(_("Password:"), 'password', $password); @@ -104,7 +104,7 @@ $coy = $_SESSION['wa_current_user']->company; else $coy = $def_coy; - if (!@$text_company_selection) { + if (!@$SysPrefs->text_company_selection) { echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n"; for ($i = 0; $i < count($db_connections); $i++) echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>"; @@ -154,10 +154,10 @@ echo "</tr></table>\n"; echo "<table class='footer'>\n"; echo "<tr>\n"; - echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$app_title $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n"; + echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->app_title." $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n"; echo "</tr>\n"; echo "<tr>\n"; - echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$power_by</a></td>\n"; + echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->power_by."</a></td>\n"; echo "</tr>\n"; echo "</table><br><br>\n"; echo "</body></html>\n"; diff -r 29e5bbcd691f -r 8abefc67175d access/logout.php --- a/access/logout.php Fri Jan 09 20:03:54 2015 +0100 +++ b/access/logout.php Sat Jan 10 16:53:55 2015 +0100 @@ -31,7 +31,7 @@ <td><div align='center'><font size=2>"; echo _("Thank you for using") . " "; -echo "<strong>$app_title $version</strong>"; +echo "<strong>".$SysPrefs->app_title." $version</strong>"; echo "</font></div></td> </tr> diff -r 29e5bbcd691f -r 8abefc67175d access/password_reset.php --- a/access/password_reset.php Fri Jan 09 20:03:54 2015 +0100 +++ b/access/password_reset.php Sat Jan 10 16:53:55 2015 +0100 @@ -28,7 +28,7 @@ $login_timeout = $_SESSION["wa_current_user"]->last_act; - $title = $app_title." ".$version." - "._("Password reset"); + $title = $SysPrefs->app_title." ".$version." - "._("Password reset"); $encoding = isset($_SESSION['language']->encoding) ? $_SESSION['language']->encoding : "iso-8859-1"; $rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : "ltr"; $onload = !$login_timeout ? "onload='defaultCompany()'" : ""; @@ -53,12 +53,12 @@ start_table(false, "class='login'"); start_row(); echo "<td align='center' colspan=2>"; - echo "<a target='_blank' href='$power_url'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>"; + echo "<a target='_blank' href='".$SysPrefs->power_url."'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>"; echo "</td>\n"; end_row(); echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' />\n"; - table_section_title(_("Version")." $version Build $build_version - "._("Password reset")); + table_section_title(_("Version")." $version Build ".$SysPrefs->build_version." - "._("Password reset")); text_row(_("Email"), "email_entry_field", "", 20, 30); @@ -66,7 +66,7 @@ $coy = $_SESSION['wa_current_user']->company; else $coy = $def_coy; - if (!@$text_company_selection) { + if (!@$SysPrefs->text_company_selection) { echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n"; for ($i = 0; $i < count($db_connections); $i++) echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>"; @@ -105,10 +105,10 @@ echo "</tr></table>\n"; echo "<table class='footer'>\n"; echo "<tr>\n"; - echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$app_title $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n"; + echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->app_title." $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n"; echo "</tr>\n"; echo "<tr>\n"; - echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$power_by</a></td>\n"; + echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->power_by."</a></td>\n"; echo "</tr>\n"; echo "</table><br><br>\n"; echo "</body></html>\n"; diff -r 29e5bbcd691f -r 8abefc67175d admin/attachments.php --- a/admin/attachments.php Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/attachments.php Sat Jan 10 16:53:55 2015 +0100 @@ -69,7 +69,7 @@ } $js = ""; -if ($use_popup_windows) +if ($SysPrefs->use_popup_windows) $js .= get_js_open_window(800, 500); page(_($help_context = "Attach Documents"), false, false, "", $js); diff -r 29e5bbcd691f -r 8abefc67175d admin/backups.php --- a/admin/backups.php Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/backups.php Sat Jan 10 16:53:55 2015 +0100 @@ -16,6 +16,8 @@ include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/admin/db/maintenance_db.inc"); +define("BACKUP_PATH", $SysPrefs->comp_path.'/'.user_company()."/backup/"); + if (get_post('view')) { if (!get_post('backups')) { display_error(_('Select backup file first.')); @@ -57,7 +59,7 @@ function generate_backup($conn, $ext='no', $comm='') { - $filename = db_backup($conn, $ext, $comm); + $filename = db_backup($conn, $ext, $comm, BACKUP_PATH); if ($filename) display_notification(_("Backup successfully generated."). ' ' . _("Filename") . ": " . $filename); diff -r 29e5bbcd691f -r 8abefc67175d admin/change_current_user_password.php --- a/admin/change_current_user_password.php Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/change_current_user_password.php Sat Jan 10 16:53:55 2015 +0100 @@ -64,7 +64,7 @@ if (can_process()) { - if ($allow_demo_mode) { + if ($SysPrefs->allow_demo_mode) { display_warning(_("Password cannot be changed in demo mode.")); } else { update_user_password($_SESSION["wa_current_user"]->user, diff -r 29e5bbcd691f -r 8abefc67175d admin/company_preferences.php --- a/admin/company_preferences.php Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/company_preferences.php Sat Jan 10 16:53:55 2015 +0100 @@ -52,9 +52,9 @@ display_error(_('Only jpg and png files are supported - a file extension of .jpg or .png is expected')); $input_error = 1; } - elseif ( $_FILES['pic']['size'] > ($max_image_size * 1024)) + elseif ( $_FILES['pic']['size'] > ($SysPrefs->max_image_size * 1024)) { //File Size Check - display_error(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size); + display_error(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $SysPrefs->max_image_size); $input_error = 1; } elseif ( $_FILES['pic']['type'] == "text/plain" ) diff -r 29e5bbcd691f -r 8abefc67175d admin/db/company_db.inc --- a/admin/db/company_db.inc Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/db/company_db.inc Sat Jan 10 16:53:55 2015 +0100 @@ -36,7 +36,7 @@ if (!isset($_SESSION['SysPrefs']->prefs)) { // cached preferences - $_SESSION['SysPrefs'] = new sys_prefs(); +// $_SESSION['SysPrefs'] = new sys_prefs(); $sql = "SELECT name, value FROM ".TB_PREF."sys_prefs"; $result = @db_query($sql); // supress errors before 2.3 db structure upgrade @@ -216,3 +216,20 @@ } + + + + + + + + + + + + + + + + + diff -r 29e5bbcd691f -r 8abefc67175d admin/db/fiscalyears_db.inc --- a/admin/db/fiscalyears_db.inc Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/db/fiscalyears_db.inc Sat Jan 10 16:53:55 2015 +0100 @@ -48,8 +48,6 @@ function get_current_fiscalyear() { - global $path_to_root; - include_once($path_to_root . "/admin/db/company_db.inc"); $year = get_company_pref('f_year'); $sql = "SELECT * FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($year); diff -r 29e5bbcd691f -r 8abefc67175d admin/db/maintenance_db.inc --- a/admin/db/maintenance_db.inc Fri Jan 09 20:03:54 2015 +0100 +++ b/admin/db/maintenance_db.inc Sat Jan 10 16:53:55 2015 +0100 @@ -263,9 +263,10 @@ */ function db_import($filename, $connection, $force=true, $init=true, $protect=false, $return_errors=false) { - global $db, $go_debug, $sql_trail; + global $db, $SysPrefs; - $sql_trail = false; + $trail = $SysPrefs->sql_trail; + $SysPrefs->sql_trail = false; $allowed_commands = array( "create" => 'table_queries', @@ -413,8 +414,8 @@ /*/ if ($return_errors) { // prevent errors display - $save_debug = $go_debug; - $go_debug = 0; + $save_debug = $SysPrefs->go_debug; + $SysPrefs->go_debug = 0; } // execute drop tables if exists queries if (is_array($drop_queries)) @@ -457,7 +458,9 @@ } if ($return_errors) - $go_debug = $save_debug; + $SysPrefs->go_debug = $save_debug; + + $SysPrefs->sql_trail = $trail; db_query("SET foreign_key_checks=1"); if ($delimiter != ';') db_query("delimiter ;"); // just for any case @@ -530,16 +533,13 @@ return explode("\n", $file_data); } -function db_backup($conn, $ext='no', $comm='', $path=null) +function db_backup($conn, $ext='no', $comm='', $path='') { if ($conn['tbpref'] != "") $filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql"; |