setUserDefaultBlog($core->auth->userID(),$core->blog->id);
$core->adminurl->redirect("admin.home");
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
dcPage::check('usage,contentadmin');
if ($core->plugins->disableDepModules($core->adminurl->get('admin.home',array()))) {
exit;
}
# Logout
if (!empty($_GET['logout'])) {
$core->session->destroy();
if (isset($_COOKIE['dc_admin'])) {
unset($_COOKIE['dc_admin']);
setcookie('dc_admin',false,-600,'','',DC_ADMIN_SSL);
}
$core->adminurl->redirect("admin.auth");
exit;
}
# Plugin install
$plugins_install = $core->plugins->installModules();
# Check dashboard module prefs
$ws = $core->auth->user_prefs->addWorkspace('dashboard');
if (!$core->auth->user_prefs->dashboard->prefExists('doclinks')) {
if (!$core->auth->user_prefs->dashboard->prefExists('doclinks',true)) {
$core->auth->user_prefs->dashboard->put('doclinks',true,'boolean','',null,true);
}
$core->auth->user_prefs->dashboard->put('doclinks',true,'boolean');
}
if (!$core->auth->user_prefs->dashboard->prefExists('dcnews')) {
if (!$core->auth->user_prefs->dashboard->prefExists('dcnews',true)) {
$core->auth->user_prefs->dashboard->put('dcnews',true,'boolean','',null,true);
}
$core->auth->user_prefs->dashboard->put('dcnews',true,'boolean');
}
if (!$core->auth->user_prefs->dashboard->prefExists('quickentry')) {
if (!$core->auth->user_prefs->dashboard->prefExists('quickentry',true)) {
$core->auth->user_prefs->dashboard->put('quickentry',false,'boolean','',null,true);
}
$core->auth->user_prefs->dashboard->put('quickentry',false,'boolean');
}
if (!$core->auth->user_prefs->dashboard->prefExists('nodcupdate')) {
if (!$core->auth->user_prefs->dashboard->prefExists('nodcupdate',true)) {
$core->auth->user_prefs->dashboard->put('nodcupdate',false,'boolean','',null,true);
}
$core->auth->user_prefs->dashboard->put('nodcupdate',false,'boolean');
}
// Handle folded/unfolded sections in admin from user preferences
$ws = $core->auth->user_prefs->addWorkspace('toggles');
if (!$core->auth->user_prefs->toggles->prefExists('unfolded_sections')) {
$core->auth->user_prefs->toggles->put('unfolded_sections','','string','Folded sections in admin',null,true);
}
# Dashboard icons
$__dashboard_icons = new ArrayObject();
$favs = $core->favs->getUserFavorites();
$core->favs->appendDashboardIcons($__dashboard_icons);
# Check plugins and themes update from repository
$checkStoreUpdate = function($mod, $url, $img, $icon)
{
$repo = new dcStore($mod, $url);
$upd = $repo->get(true);
if (!empty($upd)) {
$icon[0] .= '
'.sprintf(__('An update is available', '%s updates are available.', count($upd)),count($upd));
$icon[1] .= '#update';
$icon[2] = 'images/menu/'.$img.'-b-update.png';
}
};
if (isset($__dashboard_icons['plugins'])) {
$checkStoreUpdate($core->plugins, $core->blog->settings->system->store_plugin_url, 'plugins', $__dashboard_icons['plugins']);
}
if (isset($__dashboard_icons['blog_theme'])) {
$themes = new dcThemes($core);
$themes->loadModules($core->blog->themes_path, null);
$checkStoreUpdate($themes, $core->blog->settings->system->store_theme_url, 'blog-theme', $__dashboard_icons['blog_theme']);
}
# Latest news for dashboard
$__dashboard_items = new ArrayObject(array(new ArrayObject(),new ArrayObject()));
$dashboardItem = 0;
# Documentation links
if ($core->auth->user_prefs->dashboard->doclinks) {
if (!empty($__resources['doc']))
{
$doc_links = '
1)).'" class="button">'.__('Make this blog my default blog').'
'; } if ($core->blog->status == 0) { echo ''.__('This blog is offline').'.
'; } elseif ($core->blog->status == -1) { echo ''.__('This blog is removed').'.
'; } if (!defined('DC_ADMIN_URL') || !DC_ADMIN_URL) { echo ''. sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_URL'). ' '.__('See documentation for more information.'). '
'; } if (!defined('DC_ADMIN_MAILFROM') || !DC_ADMIN_MAILFROM) { echo ''. sprintf(__('%s is not defined, you should edit your configuration file.'),'DC_ADMIN_MAILFROM'). ' '.__('See documentation for more information.'). '
'; } $err = array(); # Check cache directory if ( $core->auth->isSuperAdmin() ) { if (!is_dir(DC_TPL_CACHE) || !is_writable(DC_TPL_CACHE)) { $err[] = ''.__("The cache directory does not exist or is not writable. You must create this directory with sufficient rights and affect this location to \"DC_TPL_CACHE\" in inc/config.php file.").'
'; } } else { if (!is_dir(DC_TPL_CACHE) || !is_writable(DC_TPL_CACHE)) { $err[] = ''.__("The cache directory does not exist or is not writable. You should contact your administrator.").'
'; } } # Check public directory if ( $core->auth->isSuperAdmin() ) { if (!is_dir($core->blog->public_path) || !is_writable($core->blog->public_path)) { $err[] = ''.__("There is no writable directory /public/ at the location set in about:config \"public_path\". You must create this directory with sufficient rights (or change this setting).").'
'; } } else { if (!is_dir($core->blog->public_path) || !is_writable($core->blog->public_path)) { $err[] = ''.__("There is no writable root directory for the media manager. You should contact your administrator.").'
'; } } # Error list if (count($err) > 0) { echo ''.__('Error:').'
'. ''.__('Errors have occured with following plugins:').'
'. '