setUserDefaultBlog($core->auth->userID(),$core->blog->id); http::redirect('index.php'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } dcPage::check('usage,contentadmin'); # 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); } http::redirect('auth.php'); 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',true,'boolean','',null,true); } $core->auth->user_prefs->dashboard->put('quickentry',true,'boolean'); } # Dashboard icons $__dashboard_icons = new ArrayObject(); # Dashboard favorites $post_count = $core->blog->getPosts(array(),true)->f(0); $str_entries = ($post_count > 1) ? __('%d entries') : __('%d entry'); $comment_count = $core->blog->getComments(array(),true)->f(0); $str_comments = ($comment_count > 1) ? __('%d comments') : __('%d comment'); $ws = $core->auth->user_prefs->addWorkspace('favorites'); $count = 0; foreach ($ws->dumpPrefs() as $k => $v) { // User favorites only if (!$v['global']) { $fav = unserialize($v['value']); if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { $count++; $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) : ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); $__dashboard_icons[$fav['name']] = new ArrayObject(array($title,$fav['url'],$fav['large-icon'])); # Let plugins set their own title for favorite on dashboard $core->callBehavior('adminDashboardFavsIcon',$core,$fav['name'],$__dashboard_icons[$fav['name']]); } } } if (!$count) { // Global favorites if any foreach ($ws->dumpPrefs() as $k => $v) { $fav = unserialize($v['value']); if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { $count++; $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) : ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); $__dashboard_icons[$fav['name']] = new ArrayObject(array($title,$fav['url'],$fav['large-icon'])); # Let plugins set their own title for favorite on dashboard $core->callBehavior('adminDashboardFavsIcon',$core,$fav['name'],$__dashboard_icons[$fav['name']]); } } } if (!$count) { // No user or global favorites, add "user pref" and "new entry" fav if ($core->auth->check('usage,contentadmin',$core->blog->id)) { $__dashboard_icons['new_post'] = new ArrayObject(array(__('New entry'),'post.php','images/menu/edit-b.png')); } $__dashboard_icons['prefs'] = new ArrayObject(array(__('My preferences'),'preferences.php','images/menu/user-pref-b.png')); } # Latest news for dashboard $__dashboard_items = new ArrayObject(array(new ArrayObject,new ArrayObject)); # Documentation links $dashboardItem = 0; if ($core->auth->user_prefs->dashboard->doclinks) { if (!empty($__resources['doc'])) { $doc_links = '
'.dt::dt2str('%d %B %Y',$item->pubdate,'Europe/Paris').': '. ''.text::cutString(html::clean($item->content),120).'...
'.__('This blog is offline').'
'; } elseif ($core->blog->status == -1) { echo ''.__('This blog is removed').'
'; } if (!DC_ADMIN_URL) { echo ''. __('DC_ADMIN_URL is not defined, you should edit your configuration file.'). '
'; } # Plugins install messages if (!empty($plugins_install['success'])) { echo ''.sprintf(__('Dotclear %s is available!'),$new_v).'
'. ''.__('Some plugins are installed twice:').'
'. ''.
''.$i[0].'