} $cache_query = 'INSERT INTO phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES(' . "'0','0','phpgwapi','config','" . addslashes(serialize($GLOBALS['phpgw_info']['server'])) . "')"; $GLOBALS['phpgw']->db->query($cache_query, __LINE__, __FILE__); } } unset($cache_query); unset($server_info_cache); if (@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) && !$_SERVER['HTTPS']) { Header('Location: https://' . $GLOBALS['phpgw_info']['server']['hostname'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . $_SERVER['REQUEST_URI']); exit; } /****************************************************************************\ * This is a global constant that should be used * * instead of / or \ in file paths * \****************************************************************************/ define('SEP', filesystem_separator()); /************************************************************************\ * Required classes * \************************************************************************/ $GLOBALS['phpgw']->log = CreateObject('phpgwapi.errorlog'); $GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation'); $GLOBALS['phpgw']->common = CreateObject('phpgwapi.common'); $GLOBALS['phpgw']->hooks = CreateObject('phpgwapi.hooks'); $GLOBALS['phpgw']->auth = CreateObject('phpgwapi.auth'); $GLOBALS['phpgw']->accounts = CreateObject('phpgwapi.accounts'); $GLOBALS['phpgw']->acl = CreateObject('phpgwapi.acl'); $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); $GLOBALS['phpgw']->preferences = CreateObject('phpgwapi.preferences'); $GLOBALS['phpgw']->applications = CreateObject('phpgwapi.applications'); print_debug('main class loaded', 'messageonly', 'api'); if (!isset($GLOBALS['phpgw_info']['flags']['included_classes']['error']) || !$GLOBALS['phpgw_info']['flags']['included_classes']['error']) {
function load_app($app, $userlang = 'en', $target = True) { define('SEP', filesystem_separator()); $langarray = array(); $fd = PHPGW_SERVER_ROOT . SEP . $app . SEP . ($app == 'setup' ? 'lang' : 'setup'); $fn = $fd . SEP . 'phpgw_' . $userlang . '.lang'; if (@is_writeable($fn) || is_writeable($fd)) { $wr = True; } $from = $GLOBALS['phpgw']->translation->charset($userlang); $to = $GLOBALS['phpgw']->translation->system_charset; //echo "<p>solangfile::load_app('$app','$userlang') converting from charset('$userlang')='$from' to '$to'</p>\n"; if (file_exists($fn)) { if ($fp = @fopen($fn, 'rb')) { while ($data = fgets($fp, 8000)) { list($message_id, $app_name, $null, $content) = explode("\t", $data); if (!$message_id) { continue; } //echo '<br>load_app(): adding phrase: $this->langarray["'.$message_id.'"]=' . trim($content); $_mess_id = strtolower(trim($message_id)); $langarray[$_mess_id]['message_id'] = $_mess_id; $langarray[$_mess_id]['app_name'] = trim($app_name); $langarray[$_mess_id]['content'] = $GLOBALS['phpgw']->translation->convert(trim($content), $from, $to); } fclose($fp); } } else { $fn = lang('no file'); } if ($target) { $this->tgt_file = $fn; } else { $this->src_file = $fn; } // stuff class array listing apps that are included already $this->loaded_apps[$userlang]['filename'] = $fn; $this->loaded_apps[$userlang]['writeable'] = $wr; if ($this->debug) { _debug_array($langarray); } @ksort($langarray); return $langarray; }
function filesystem_separator() { return filesystem_separator(); }
function register_all_hooks() { $SEP = filesystem_separator(); foreach ($GLOBALS['phpgw_info']['apps'] as $appname => $app) { $f = PHPGW_SERVER_ROOT . $SEP . $appname . $SEP . 'setup' . $SEP . 'setup.inc.php'; if (@file_exists($f)) { include $f; $this->register_hooks($appname, $setup_info[$appname]['hooks']); } } }
function add_app($app, $lang = '') { define('SEP', filesystem_separator()); //echo '<br>add_app(): called with app="' . $app . '", lang="' . $userlang . '"'; if (!isset($lang) || !$lang) { if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) { $userlang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']; } else { $userlang = 'en'; } } else { $userlang = $lang; } $fn = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . 'phpgw_' . $userlang . '.lang'; if (!file_exists($fn)) { $fn = PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . 'phpgw_en.lang'; } if (file_exists($fn)) { $fp = fopen($fn, 'r'); while ($data = fgets($fp, 8000)) { list($message_id, $app_name, $null, $content) = explode("\t", $data); //echo '<br>add_app(): adding phrase: $this->langarray["'.$message_id.'"]=' . trim($content); $this->langarray[$message_id] = trim($content); } fclose($fp); } // stuff class array listing apps that are included already $this->loaded_apps[] = $app; }