Esempio n. 1
0
unset($dbpass);
$cache = new Cache();
// Try to fetch config from cache, otherwise fetch it via sql and store it into cache
if (($config = $cache->get('config')) === false) {
    $sql = 'SELECT * FROM ' . CONFIG_TABLE;
    $sth = $db->prepare($sql);
    $sth->execute();
    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
        $config[$row['config_name']] = $row['config_value'];
    }
    $cache->put('config', $config);
}
// Let's kill expired sessions first
$expiration = time() - (int) $config['session_span'] * 60;
$sql = 'DELETE FROM ' . SESSIONS_TABLE . '
        WHERE session_last_visit < ' . (int) $expiration;
$db->query($sql);
$user = new User();
$lang_domains = array();
$auth = new Auth();
if (file_exists($mangareader_root_path . 'install') && !defined('IN_INSTALL')) {
    //trigger_error('REMOVE_INSTALL_PATH', E_USER_WARNING);
}
// If currently on admininstration panel, load default hooks
if (is_admin_panel()) {
    foreach (glob($mangareader_admin_root_path . 'hooks/*.php') as $filename) {
        include_once $filename;
    }
}
do_action('mr_init');
// Initialize plugins here
Esempio n. 2
0
/**
* Remove a submenu page from admin panel
*
* @param string $menu_slug Slug name of the submenu ite
* @return boolean Either false if the menu item does not exist or true if it's removed
*/
function remove_submenu_page($menu_slug, $submenu_slug)
{
    if (!is_admin_panel()) {
        return;
    }
    global $admin_pages;
    if (!isset($admin_pages[$menu_slug]['subpages'][$submenu_slug])) {
        return false;
    }
    unset($admin_pages[$menu_slug]['subpages'][$submenu_slug]);
}