$prefs can be preference name, array of names, or null for all preferences.
*/
-function get_company_pref($prefs = null, $tbpref = TB_PREF)
+function get_company_pref($prefs = null, $tbpref = null)
{
global $SysPrefs, $core_version;
$_SESSION['SysPrefs'] = new sys_prefs();
+ if (!isset($tbpref))
+ $tbpref = TB_PREF;
+
$sql = "SELECT name, value FROM {$tbpref}sys_prefs";
$result = @db_query($sql); // supress errors before 2.3 db structure upgrade
function user_company()
{
- return $_SESSION["wa_current_user"]->company;
+ global $def_coy;
+
+ return isset($_SESSION["wa_current_user"]) ? $_SESSION["wa_current_user"]->company : $def_coy;
}
function user_pos()
$keys = array_search_keys($needle, $haystack, $valuekey);
return @$keys[0];
}
+
+function flush_dir($path, $wipe = false)
+{
+ $dir = opendir($path);
+ while(false !== ($fname = readdir($dir))) {
+ if($fname=='.' || $fname=='..' || $fname=='CVS' || (!$wipe && $fname=='index.php')) continue;
+ if(is_dir($path.'/'.$fname)) {
+ flush_dir($path.'/'.$fname, $wipe);
+ if ($wipe) @rmdir($path.'/'.$fname);
+ } else
+ @unlink($path.'/'.$fname);
+ }
+}
+/*
+ Returns current path to company private folder.
+ (Current path can change after chdir).
+*/
+function company_path($comp=null)
+{
+ global $path_to_root, $comp_path;
+
+ if (!isset($comp))
+ $comp = user_company();
+
+ // if path is relative, set current path_to_root
+ return ($comp_path[0]=='.' ? $path_to_root.'/'.basename($comp_path) : $comp_path)
+ . '/'.$comp;
+}
+
?>
\ No newline at end of file
{
global $path_to_root, $installed_languages;
- $changed = $this->code != $code;
$lang = array_search_value($code, $installed_languages, 'code');
+ $changed = $this->code != $code || $this->version != $lang['version'];
if ($lang && $changed)
{
// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
header("Cache-control: private");
+include_once($path_to_root . "/config.php");
get_text_init();
// Page Initialisation
}
include_once($path_to_root . "/includes/access_levels.inc");
-include_once($path_to_root . "/config.php");
include_once($path_to_root . "/version.php");
include_once($path_to_root . "/includes/main.inc");