private function __construct() { $options = array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); $dsn = 'mysql:host=' . config::read('db.host') . ';dbname=' . config::read('db.basename') . ';port=' . config::read('db.port'); $user = config::read('db.user'); $password = config::read('db.password'); $this->dbh = new PDO($dsn, $user, $password, $options); }
function __construct() { parent::__construct(); $this->tz_offset_s = $GLOBALS['egw']->datetime->tz_offset; $this->now = time() + $this->tz_offset_s; // time() is server-time and we need a user-time $this->config = config::read('courseprotocol'); if (isset($this->config['customfields']) && is_array($this->config['customfields'])) { $this->customfields = $this->config['customfields']; } }
/** * Get navbar as array to eg. set as vars for a template (from idots' navbar.inc.php) * * Reimplemented so set the vars for the navbar itself (uses $this->tpl and the blocks a and b) * * @internal PHP5 protected * @param array $apps navbar apps from _get_navbar_apps * @return array */ function _get_navbar($apps) { $var = parent::_get_navbar($apps); if ($GLOBALS['egw_info']['user']['preferences']['common']['click_or_onmouseover'] == 'onmouseover') { $var['show_menu_event'] = 'onMouseOver'; } else { $var['show_menu_event'] = 'onClick'; } if ($GLOBALS['egw_info']['user']['userid'] == 'anonymous') { $config_reg = config::read('registration'); $this->tpl->set_var(array('url' => $GLOBALS['egw']->link('/logout.php'), 'title' => lang('Login'))); $this->tpl->fp('upper_tabs', 'upper_tab_block'); if ($config_reg[enable_registration] == 'True' && $config_reg[register_link] == 'True') { $this->tpl->set_var(array('url' => $GLOBALS['egw']->link('/registration/index.php'), 'title' => lang('Register'))); } } if (!($max_icons = $GLOBALS['egw_info']['user']['preferences']['common']['max_icons'])) { $max_icons = 30; } if ($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] == 'no') { $tdwidth = 100 / $max_icons; } else { $tdwidth = 100 / ($max_icons + 1); // +1 for logout } $this->tpl->set_var('tdwidth', round($tdwidth)); // not shown in the navbar foreach ($apps as $app => $app_data) { if ($app != 'preferences' && $app != 'about' && $app != 'logout' && $app != 'manual' && ($app != 'home' || $GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no')) { $this->tpl->set_var($app_data); if ($i < $max_icons) { $this->tpl->set_var($app_data); if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'text') { $this->tpl->fp('app_icons', 'app_icon_block', true); } if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'icons') { $this->tpl->fp('app_titles', 'app_title_block', true); } } else { $this->tpl->fp('app_extra_icons', 'app_extra_block', true); } $i++; } } // settings for the extra icons dif if ($i <= $max_icons) { $this->tpl->set_var('app_extra_icons_div', ''); $this->tpl->set_var('app_extra_icons_icon', ''); } else { $var['lang_close'] = lang('Close'); $var['lang_show_more_apps'] = lang('show_more_apps'); } if ($GLOBALS['egw_info']['user']['preferences']['common']['start_and_logout_icons'] != 'no' && $GLOBALS['egw_info']['user']['userid'] != 'anonymous') { $this->tpl->set_var($apps['logout']); if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'text') { $this->tpl->fp('app_icons', 'app_icon_block', true); } if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] != 'icons') { $this->tpl->fp('app_titles', 'app_title_block', true); } } if ($GLOBALS['egw_info']['user']['preferences']['common']['navbar_format'] == 'icons') { $var['app_titles'] = '<td colspan="' . $max_icons . '"> </td>'; } return $var; }
// Start the current session $cp = session_get_cookie_params(); session_set_cookie_params($cp['lifetime'], $cp['path'], _BASE_DOMAIN_); session_start(); // Read the basic configuration variables $config = new config(); // Connect to the SQL server if (!sql::connect(_MYSQL_HOST_, _MYSQL_USER_, _MYSQL_PASS_, _MYSQL_DB_)) { // We need the following objects initialized // Does not matter that then don't actually do anything $lang = new language(_DEFAULT_LANGUAGE_, _DEFAULT_SITE_, true); $theme =& new theme(); $theme->showError(_OFFLINE_MESSAGE_, 1); } // Read additional configuration variables from the database $config->read(); if (strlen($path) > 1) { if (substr($path, 0, 1) == '/') { $path = substr($path, 1, strlen($path) - 1); } if (substr($path, -1, 1) == '/') { $path = substr($path, 0, strlen($path) - 1); } $args = explode('/', $path); } else { $args = array(); } if (count($args) > 0 && $args[0] == 'admin') { // The first thing we need to do is check if we need to install ourselves if (count($args) > 1 && $args[1] == 'install') { // Check to see if we are locked down...
function __construct() { $this->config = config::read('courseprotocol'); }