/** * Build teh evobar menu */ function build_evobar_menu() { /** * @var Menu */ global $topleft_Menu, $topright_Menu; global $current_User; global $home_url, $admin_url, $dispatcher, $debug, $seo_page_type, $robots_index; global $Blog, $blog; global $Settings; $perm_admin_normal = $current_User->check_perm('admin', 'normal'); $perm_admin_restricted = $current_User->check_perm('admin', 'restricted'); $entries = NULL; if ($perm_admin_normal) { // Normal Access to Admin: $entries = array('b2evo' => array('text' => '<strong>b2evolution</strong>', 'href' => $home_url), 'dashboard' => array('text' => T_('Dashboard'), 'href' => $admin_url, 'title' => T_('Go to admin dashboard')), 'see' => array('text' => T_('See'), 'href' => $home_url, 'title' => T_('See the home page')), 'write' => array('text' => T_('Write'), 'title' => T_('No blog is currently selected'), 'disabled' => true), 'blog' => array('text' => T_('Blog'), 'title' => T_('No blog is currently selected'), 'disabled' => true), 'tools' => array('text' => T_('More'), 'disabled' => true)); } elseif ($perm_admin_restricted) { // restricted Access to Admin: $entries = array('see' => array('text' => T_('Site'), 'href' => $home_url, 'title' => T_('See the home page'))); if ($current_User->check_perm('blogs', 'create')) { $entries['blog'] = array('text' => T_('Blog'), 'title' => T_('No blog is currently selected'), 'disabled' => true); } $entries['tools'] = array('text' => T_('More'), 'disabled' => true); } if (!empty($Blog)) { // A blog is currently selected: if ($perm_admin_normal) { $entries['dashboard']['href'] = $admin_url . '?blog=' . $Blog->ID; } if ($perm_admin_restricted) { $entries['see']['href'] = $Blog->get('url'); $entries['see']['title'] = T_('See the public view of this blog'); } if ($current_User->check_perm('blog_post_statuses', 'edit', false, $Blog->ID)) { // We have permission to add a post with at least one status: $write_item_url = $Blog->get_write_item_url(); if ($write_item_url) { // write item URL is not empty, so it's sure that user can create new post if (!$perm_admin_normal) { $entries['write'] = array('text' => T_('Write')); } $entries['write']['href'] = $write_item_url; $entries['write']['disabled'] = false; $entries['write']['title'] = T_('Write a new post into this blog'); } } if ($perm_admin_normal) { if (empty($write_item_url)) { // Display restricted message on this blog $entries['write']['title'] = T_('You don\'t have permission to post into this blog'); } // BLOG MENU: $items_url = $admin_url . '?ctrl=items&blog=' . $Blog->ID . '&filter=restore'; $entries['blog']['href'] = $items_url; $entries['blog']['disabled'] = false; $entries['blog']['title'] = T_('Manage this blog'); if ($Blog->get('type') == 'manual') { // Manual Pages $entries['blog']['entries']['manual'] = array('text' => T_('Manual Pages') . '…', 'href' => $items_url . '&tab=manual'); } $entries['blog']['entries']['posts'] = array('text' => T_('Posts') . '…', 'href' => $items_url); // Check if user has permission for published, draft or depreceted comments (any of these) if ($current_User->check_perm('blog_comments', 'edit', false, $Blog->ID)) { // Comments: $entries['blog']['entries']['comments'] = array('text' => T_('Comments') . '…', 'href' => $admin_url . '?ctrl=comments&blog=' . $Blog->ID . '&filter=restore'); } // Chapters / Categories: if ($current_User->check_perm('blog_cats', 'edit', false, $Blog->ID)) { // Either permission for a specific blog or the global permission: $entries['blog']['entries']['chapters'] = array('text' => T_('Categories') . '…', 'href' => $admin_url . '?ctrl=chapters&blog=' . $Blog->ID); } // PLACE HOLDER FOR FILES MODULE: $entries['blog']['entries']['files'] = NULL; // BLOG SETTINGS: if ($current_User->check_perm('blog_properties', 'edit', false, $Blog->ID)) { // We have permission to edit blog properties: $blog_param = '&blog=' . $Blog->ID; if (!empty($entries['blog']['entries'])) { // There are already entries aboce, insert a separator: $entries['blog']['entries'][] = array('separator' => true); } $entries['blog']['entries']['general'] = array('text' => T_('Blog settings'), 'href' => $admin_url . '?ctrl=coll_settings' . $blog_param, 'entries' => array('general' => array('text' => T_('General') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=general' . $blog_param), 'features' => array('text' => T_('Features') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=features' . $blog_param), 'skin' => array('text' => T_('Skin') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=skin' . $blog_param), 'plugin_settings' => array('text' => T_('Plugins') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=plugin_settings' . $blog_param), 'widgets' => array('text' => T_('Widgets') . '…', 'href' => $admin_url . '?ctrl=widgets' . $blog_param), 'urls' => array('text' => T_('URLs') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=urls' . $blog_param), 'seo' => array('text' => T_('SEO') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=seo' . $blog_param), 'advanced' => array('text' => T_('Advanced') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=advanced' . $blog_param))); if ($Blog && $Blog->advanced_perms) { $entries['blog']['entries']['general']['entries']['userperms'] = array('text' => T_('User perms') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=perm' . $blog_param); $entries['blog']['entries']['general']['entries']['groupperms'] = array('text' => T_('Group perms') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=permgroup' . $blog_param); } } } } // SYSTEM MENU: if ($perm_admin_restricted) { if ($debug) { $debug_text = 'DEBUG: '; if (!empty($seo_page_type)) { // Set in skin_init() $debug_text = $seo_page_type . ': '; } if ($robots_index === false) { $debug_text .= 'NO INDEX'; } else { $debug_text .= 'do index'; } $entries['tools']['entries']['noindex'] = array('text' => $debug_text, 'disabled' => true); $entries['tools']['entries'][''] = array('separator' => true); } if ($current_User->check_perm('users', 'view')) { // Users: $entries['tools']['disabled'] = false; $entries['tools']['entries']['users'] = array('text' => T_('Users') . '…', 'href' => $admin_url . '?ctrl=users'); } // PLACE HOLDER FOR MESSAGING MODULE: $entries['tools']['entries']['messaging'] = NULL; // PLACE HOLDER FOR FILES MODULE: $entries['tools']['entries']['files'] = NULL; $perm_spam = $current_User->check_perm('spamblacklist', 'view'); $perm_options = $current_User->check_perm('options', 'view'); $perm_emails = $current_User->check_perm('emails', 'view'); $perm_slugs = $current_User->check_perm('slugs', 'view'); $perm_maintenance = $current_User->check_perm('perm_maintenance', 'upgrade'); if ($perm_spam || $perm_options || $perm_slugs || $perm_maintenance) { if ($perm_emails) { $entries['tools']['entries']['email'] = array('text' => T_('Emails'), 'href' => $admin_url . '?ctrl=email', 'entries' => array('blocked' => array('text' => T_('Addresses') . '…', 'href' => $admin_url . '?ctrl=email'), 'sent' => array('text' => T_('Sent') . '…', 'href' => $admin_url . '?ctrl=email&tab=sent'), 'return' => array('text' => T_('Returned') . '…', 'href' => $admin_url . '?ctrl=email&tab=return'), 'settings' => array('text' => T_('Settings') . '…', 'href' => $admin_url . '?ctrl=email&tab=settings'))); } $entries['tools']['disabled'] = false; $entries['tools']['entries']['tools_sep'] = array('separator' => true); if ($perm_options) { $entries['tools']['entries']['status'] = array('text' => T_('System status') . '…', 'href' => $admin_url . '?ctrl=system'); } if ($perm_options) { $entries['tools']['entries']['crontab'] = array('text' => T_('Scheduler') . '…', 'href' => $admin_url . '?ctrl=crontab'); } if ($perm_spam) { $entries['tools']['entries']['antispam'] = array('text' => T_('Antispam'), 'href' => $admin_url . '?ctrl=antispam', 'entries' => array('blacklist' => array('text' => T_('Blacklist') . '…', 'href' => $admin_url . '?ctrl=antispam'))); if ($perm_options) { // If we have access to options, then we add a submenu: $entries['tools']['entries']['antispam']['entries']['ipranges'] = array('text' => T_('IP Ranges') . '…', 'href' => $admin_url . '?ctrl=antispam&tab3=ipranges'); $entries['tools']['entries']['antispam']['entries']['settings'] = array('text' => T_('Settings') . '…', 'href' => $admin_url . '?ctrl=antispam&tab3=settings'); if ($current_User->check_perm('options', 'edit')) { $entries['tools']['entries']['antispam']['entries']['tools'] = array('text' => T_('Tools') . '…', 'href' => $admin_url . '?ctrl=antispam&tab3=tools'); } } } if ($perm_slugs) { $entries['tools']['entries']['slugs'] = array('text' => T_('Slugs') . '…', 'href' => $admin_url . '?ctrl=slugs'); } } if ($perm_options) { // Global settings: $entries['tools']['entries']['general'] = array('text' => T_('General') . '…', 'href' => $admin_url . '?ctrl=gensettings'); $entries['tools']['entries']['regional'] = array('text' => T_('Regional'), 'href' => $admin_url . '?ctrl=regional', 'entries' => array('locales' => array('text' => T_('Locales') . '…', 'href' => $admin_url . '?ctrl=locales'), 'time' => array('text' => T_('Time') . '…', 'href' => $admin_url . '?ctrl=time'), 'countries' => array('text' => T_('Countries') . '…', 'href' => $admin_url . '?ctrl=countries'), 'regions' => array('text' => T_('Regions') . '…', 'href' => $admin_url . '?ctrl=regions'), 'subregions' => array('text' => T_('Sub-regions') . '…', 'href' => $admin_url . '?ctrl=subregions'), 'cities' => array('text' => T_('Cities') . '…', 'href' => $admin_url . '?ctrl=cities'), 'currencies' => array('text' => T_('Currencies') . '…', 'href' => $admin_url . '?ctrl=currencies'))); $entries['tools']['entries']['plugins'] = array('text' => T_('Plugins') . '…', 'href' => $admin_url . '?ctrl=plugins'); $entries['tools']['entries']['remote'] = array('text' => T_('Remote publishing') . '…', 'href' => $admin_url . '?ctrl=remotepublish'); $entries['tools']['entries']['maintenance'] = array('text' => T_('Maintenance'), 'href' => $admin_url . '?ctrl=tools', 'entries' => array('tools' => array('text' => T_('Tools') . '…', 'href' => $admin_url . '?ctrl=tools'), 'import' => array('text' => T_('Import') . '…', 'href' => $admin_url . '?ctrl=tools&tab3=import'), 'test' => array('text' => T_('Testing') . '…', 'href' => $admin_url . '?ctrl=tools&tab3=test'), 'backup' => array('text' => T_('Backup') . '…', 'href' => $admin_url . '?ctrl=backup'), 'upgrade' => array('text' => T_('Check for updates') . '…', 'href' => $admin_url . '?ctrl=upgrade'))); } } global $debug, $debug_jslog; if ($debug || $debug_jslog) { // Show JS log menu if debug is enabled $entries['jslog'] = array('text' => T_('JS log'), 'title' => T_('JS log'), 'class' => 'jslog_switcher'); } if ($entries !== NULL) { $topleft_Menu->add_menu_entries(NULL, $entries); } // --------------------------------------------------------------------------- /* * RIGHT MENU */ global $localtimenow, $is_admin_page; $entries = array('userprefs' => array('text' => $current_User->get_avatar_imgtag('crop-top-15x15', '', 'top') . ' <strong>' . $current_User->get_colored_login() . '</strong>', 'href' => get_user_profile_url(), 'entries' => array('profile' => array('text' => T_('Edit your profile') . '…', 'href' => get_user_profile_url()), 'avatar' => array('text' => T_('Your profile picture') . '…', 'href' => get_user_avatar_url()), 'pwdchange' => array('text' => T_('Change password') . '…', 'href' => get_user_pwdchange_url()), 'userprefs' => array('text' => T_('Preferences') . '…', 'href' => get_user_preferences_url()), 'subs' => array('text' => T_('Notifications') . '…', 'href' => get_user_subs_url()))), 'time' => array('text' => date(locale_shorttimefmt(), $localtimenow), 'disabled' => true, 'class' => 'noborder')); // ADMIN SKINS: if ($is_admin_page) { $admin_skins = get_admin_skins(); if (count($admin_skins) > 1) { // We have several admin skins available: display switcher: $entries['userprefs']['entries']['admskins_sep'] = array('separator' => true); $entries['userprefs']['entries']['admskins'] = array('text' => T_('Admin skin')); $redirect_to = rawurlencode(regenerate_url('', '', '', '&')); foreach ($admin_skins as $admin_skin) { $entries['userprefs']['entries']['admskins']['entries'][$admin_skin] = array('text' => $admin_skin, 'href' => $dispatcher . '?ctrl=users&action=change_admin_skin&new_admin_skin=' . rawurlencode($admin_skin) . '&redirect_to=' . $redirect_to); } } } $entries['userprefs']['entries']['logout_sep'] = array('separator' => true); $entries['userprefs']['entries']['logout'] = array('text' => T_('Logout'), 'href' => get_user_logout_url()); // AB switch: if ($perm_admin_normal) { // User must have permission to access admin... if ($is_admin_page) { if (!empty($Blog)) { $entries['abswitch'] = array('text' => T_('Blog') . ' ' . get_icon('switch-to-blog'), 'href' => $Blog->get('url')); } else { $entries['abswitch'] = array('text' => T_('Home') . ' ' . get_icon('switch-to-blog'), 'href' => $home_url); } } else { $entries['abswitch'] = array('text' => T_('Admin') . ' ' . get_icon('switch-to-admin'), 'href' => $admin_url); } } $topright_Menu->add_menu_entries(NULL, $entries); $topright_Menu->add_menu_entries(NULL, array('logout' => array('text' => T_('Logout') . ' ' . get_icon('close'), 'class' => 'rollover_sprite', 'href' => get_user_logout_url()))); }
/** * Build the evobar menu */ function build_evobar_menu() { /** * @var Menu */ global $topleft_Menu, $topright_Menu; global $current_User; global $baseurl, $home_url, $admin_url, $debug, $debug_jslog, $dev_menu, $seo_page_type, $robots_index; global $Blog, $blog, $activate_collection_toolbar; global $Settings; $perm_admin_normal = $current_User->check_perm('admin', 'normal'); $perm_admin_restricted = $current_User->check_perm('admin', 'restricted'); $entries = NULL; $working_blog = get_working_blog(); if ($working_blog) { // Set collection url only when current user has an access to the working blog if (is_admin_page()) { // Front page of the working blog $BlogCache =& get_BlogCache(); $working_Blog =& $BlogCache->get_by_ID($working_blog); $collection_url = $working_Blog->get('url'); } else { // Dashboard of the working blog $collection_url = $admin_url . '?ctrl=dashboard&blog=' . $working_blog; } } if ($perm_admin_normal || $perm_admin_restricted) { // Normal OR Restricted Access to Admin: $entries = array(); if ($perm_admin_normal) { // Only for normal access $entries['b2evo'] = array('text' => '<strong>b2evolution</strong>', 'href' => $home_url, 'entry_class' => 'rwdhide'); } $entries['front'] = array('text' => T_('Front<u>-office</u>'), 'href' => $baseurl, 'title' => T_('Go to the site home page (Front-office)')); $entries['dashboard'] = array('text' => T_('Back<u>-office</u>'), 'href' => $admin_url, 'title' => T_('Go to the site dashboard (Back-office)')); if ($perm_admin_normal) { // Only for normal access $entries['write'] = array('text' => '<span class="fa fa-plus-square"></span> ' . T_('Post'), 'title' => T_('No blog is currently selected'), 'disabled' => true, 'entry_class' => 'rwdhide'); } if ($working_blog) { // Display a link to manage first available collection $entries['blog'] = array('text' => T_('Collection'), 'href' => $collection_url, 'disabled' => true); } $entries['tools'] = array('text' => T_('More'), 'href' => $admin_url . '#', 'disabled' => true); } if ((!is_admin_page() || !empty($activate_collection_toolbar)) && !empty($Blog)) { // A blog is currently selected AND we can activate toolbar items for selected collection: if ($current_User->check_perm('blog_post_statuses', 'edit', false, $Blog->ID)) { // We have permission to add a post with at least one status: $write_item_url = $Blog->get_write_item_url(); if ($write_item_url) { // write item URL is not empty, so it's sure that user can create new post if (!$perm_admin_normal) { $entries['write'] = array('text' => '<span class="fa fa-plus-square"></span> ' . T_('Post')); } $entries['write']['href'] = $write_item_url; $entries['write']['disabled'] = false; $entries['write']['title'] = T_('Write a new post into this blog'); } } if ($perm_admin_normal && $working_blog) { if (empty($write_item_url)) { // Display restricted message on this blog $entries['write']['title'] = T_('You don\'t have permission to post into this blog'); } // BLOG MENU: $entries['blog'] = array('text' => T_('Collection'), 'title' => T_('Manage this blog'), 'href' => $collection_url); $display_separator = false; if ($current_User->check_perm('blog_ismember', 'view', false, $Blog->ID)) { // Check if current user has an access to post lists $items_url = $admin_url . '?ctrl=items&blog=' . $Blog->ID . '&filter=restore'; // Collection front page $entries['blog']['entries']['coll_front'] = array('text' => T_('Collection Front Page') . '…', 'href' => $Blog->get('url')); // Collection dashboard $entries['blog']['entries']['coll_dashboard'] = array('text' => T_('Collection Dashboard') . '…', 'href' => $admin_url . '?ctrl=dashboard&blog=' . $Blog->ID); $entries['blog']['entries'][] = array('separator' => true); if ($Blog->get('type') == 'manual') { // Manual view $entries['blog']['entries']['manual'] = array('text' => T_('Manual view') . '…', 'href' => $items_url . '&tab=manual'); } if ($Blog->get_setting('use_workflow')) { // Workflow view $entries['blog']['entries']['workflow'] = array('text' => T_('Workflow view') . '…', 'href' => $items_url . '&tab=tracker'); } $entries['blog']['entries']['posts'] = array('text' => T_('Posts') . '…', 'href' => $items_url); $display_separator = true; } // Check if user has permission for published, draft or depreceted comments (any of these) if ($current_User->check_perm('blog_comments', 'edit', false, $Blog->ID)) { // Comments: $entries['blog']['entries']['comments'] = array('text' => T_('Comments') . '…', 'href' => $admin_url . '?ctrl=comments&blog=' . $Blog->ID . '&filter=restore'); $display_separator = true; } // Chapters / Categories: if ($current_User->check_perm('blog_cats', 'edit', false, $Blog->ID)) { // Either permission for a specific blog or the global permission: $entries['blog']['entries']['chapters'] = array('text' => T_('Categories') . '…', 'href' => $admin_url . '?ctrl=chapters&blog=' . $Blog->ID); $display_separator = true; } if ($display_separator) { $entries['blog']['entries'][] = array('separator' => true); } // PLACE HOLDER FOR FILES MODULE: $entries['blog']['entries']['files'] = NULL; // BLOG SETTINGS: if ($current_User->check_perm('blog_properties', 'edit', false, $Blog->ID)) { // We have permission to edit blog properties: $blog_param = '&blog=' . $Blog->ID; $entries['blog']['entries']['features'] = array('text' => T_('Features'), 'href' => $admin_url . '?ctrl=coll_settings&tab=home' . $blog_param, 'entries' => array('front' => array('text' => T_('Front page') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=home' . $blog_param), 'posts' => array('text' => T_('Posts') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=features' . $blog_param), 'comments' => array('text' => T_('Comments') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=comments' . $blog_param), 'other' => array('text' => T_('Other displays') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=other' . $blog_param), 'more' => array('text' => T_('More') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=more' . $blog_param))); $entries['blog']['entries']['skin'] = array('text' => T_('Skin') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=skin' . $blog_param); $entries['blog']['entries']['plugin_settings'] = array('text' => T_('Plugins') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=plugin_settings' . $blog_param); $entries['blog']['entries']['widgets'] = array('text' => T_('Widgets') . '…', 'href' => $admin_url . '?ctrl=widgets' . $blog_param); if (!is_admin_page()) { // Display a menu to turn on/off the debug containers global $ReqURI, $Session; if ($Session->get('display_containers_' . $Blog->ID) == 1) { // To hide the debug containers $entries['blog']['entries']['containers'] = array('text' => T_('Hide containers'), 'href' => url_add_param(regenerate_url('display_containers'), 'display_containers=hide')); } else { // To show the debug containers $entries['blog']['entries']['containers'] = array('text' => T_('Show containers'), 'href' => url_add_param(regenerate_url('display_containers'), 'display_containers=show')); } } $entries['blog']['entries']['general'] = array('text' => T_('Settings'), 'href' => $admin_url . '?ctrl=coll_settings' . $blog_param, 'entries' => array('general' => array('text' => T_('General') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=general' . $blog_param), 'urls' => array('text' => T_('URLs') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=urls' . $blog_param), 'seo' => array('text' => T_('SEO') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=seo' . $blog_param))); if ($current_User->check_perm('options', 'view', false, $Blog->ID)) { // Post Types & Statuses $entries['blog']['entries']['general']['entries']['item_types'] = array('text' => T_('Post Types') . '…', 'href' => $admin_url . '?ctrl=itemtypes&tab=settings&tab3=types' . $blog_param); $entries['blog']['entries']['general']['entries']['item_statuses'] = array('text' => T_('Post Statuses') . '…', 'href' => $admin_url . '?ctrl=itemstatuses&tab=settings&tab3=statuses' . $blog_param); } $entries['blog']['entries']['general']['entries']['advanced'] = array('text' => T_('Advanced') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=advanced' . $blog_param); if ($Blog && $Blog->advanced_perms) { $entries['blog']['entries']['general']['entries']['userperms'] = array('text' => T_('User perms') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=perm' . $blog_param); $entries['blog']['entries']['general']['entries']['groupperms'] = array('text' => T_('Group perms') . '…', 'href' => $admin_url . '?ctrl=coll_settings&tab=permgroup' . $blog_param); } if ($current_User->check_perm('options', 'view')) { // Check if current user has a permission to view the common settings of the blogs $entries['blog']['entries']['general']['entries']['common_settings'] = array('text' => T_('Common Settings') . '…', 'href' => $admin_url . '?ctrl=collections&tab=blog_settings'); } } } } if ($perm_admin_restricted) { // DEV MENU: $dev_entries = array(); if ($dev_menu || $debug || $debug_jslog) { if (isset($Blog)) { $dev_entries['coll'] = array('text' => 'Collection = ' . $Blog->shortname, 'disabled' => true); } global $disp, $is_front; if (!empty($disp)) { $dev_entries['disp'] = array('text' => '$disp = ' . $disp, 'disabled' => true); } global $disp_detail; if (!empty($disp_detail)) { $dev_entries['disp_detail'] = array('text' => '$disp_detail = ' . $disp_detail, 'disabled' => true); } if (!empty($seo_page_type)) { // Set in skin_init() $dev_entries['seo_page_type'] = array('text' => '> ' . $seo_page_type, 'disabled' => true); } global $is_front; if (!empty($is_front)) { $dev_entries['front'] = array('text' => 'This is the FRONT page', 'disabled' => true); } if ($robots_index === false) { $debug_text = 'NO INDEX'; } else { $debug_text = 'do index'; } $dev_entries['noindex'] = array('text' => $debug_text, 'disabled' => true); } if (($dev_menu || $debug) && !is_admin_page() && !empty($Blog)) { // Display a menu to turn on/off the debug containers global $ReqURI, $Session; $dev_entries[] = array('separator' => true); if ($Session->get('display_containers_' . $Blog->ID) == 1) { // To hide the debug containers $dev_entries['containers'] = array('text' => T_('Hide containers'), 'href' => url_add_param(regenerate_url('display_containers'), 'display_containers=hide')); } else { // To show the debug containers $dev_entries['containers'] = array('text' => T_('Show containers'), 'href' => url_add_param(regenerate_url('display_containers'), 'display_containers=show')); } if ($Session->get('display_includes_' . $Blog->ID) == 1) { // To hide the debug includes $dev_entries['includes'] = array('text' => T_('Hide includes'), 'href' => url_add_param(regenerate_url('display_containers'), 'display_includes=hide')); } else { // To show the debug includes $dev_entries['includes'] = array('text' => T_('Show includes'), 'href' => url_add_param(regenerate_url('display_containers'), 'display_includes=show')); } } // MORE menu: if ($current_User->check_perm('users', 'view')) { // Users: $entries['tools']['disabled'] = false; $entries['tools']['entries']['users'] = array('text' => T_('Users') . '…', 'href' => $admin_url . '?ctrl=users'); } // PLACE HOLDER FOR MESSAGING MODULE: $entries['tools']['entries']['messaging'] = NULL; // PLACE HOLDER FOR FILES MODULE: $entries['tools']['entries']['files'] = NULL; $perm_options = $current_User->check_perm('options', 'view'); $perm_spam = $perm_options && $current_User->check_perm('spamblacklist', 'view'); $perm_emails = $current_User->check_perm('emails', 'view'); $perm_maintenance = $current_User->check_perm('perm_maintenance', 'upgrade'); if ($perm_spam || $perm_options || $perm_maintenance) { $entries['tools']['entries'][] = array('separator' => true); if ($perm_emails) { $entries['tools']['entries']['email'] = array('text' => T_('Emails'), 'href' => $admin_url . '?ctrl=campaigns', 'entries' => array('campaigns' => array('text' => T_('Campaigns') . '…', 'href' => $admin_url . '?ctrl=campaigns'), 'blocked' => array('text' => T_('Addresses') . '…', 'href' => $admin_url . '?ctrl=email'), 'sent' => array('text' => T_('Sent') . '…', 'href' => $admin_url . '?ctrl=email&tab=sent'), 'return' => array('text' => T_('Returned') . '…', 'href' => $admin_url . '?ctrl=email&tab=return'), 'settings' => array('text' => T_('Settings') . '…', 'href' => $admin_url . '?ctrl=email&tab=settings'))); } $entries['tools']['disabled'] = false; $entries['tools']['entries']['system'] = array('text' => T_('System'), 'href' => $admin_url . '?ctrl=system'); if ($perm_options) { $entries['tools']['entries']['system']['entries']['status'] = array('text' => T_('Status') . '…', 'href' => $admin_url . '?ctrl=system'); } if ($perm_options) { $entries['tools']['entries']['system']['entries']['crontab'] = array('text' => T_('Scheduler') . '…', 'href' => $admin_url . '?ctrl=crontab'); } if ($perm_spam) { $entries['tools']['entries']['system']['entries']['antispam'] = array('text' => T_('Antispam') . '…', 'href' => $admin_url . '?ctrl=antispam'); } } if ($perm_options) { // Global settings: $entries['tools']['entries']['system']['entries']['regional'] = array('text' => T_('Regional') . '…', 'href' => $admin_url . '?ctrl=regional'); $entries['tools']['entries']['system']['entries']['skins'] = array('text' => T_('Skins') . '…', 'href' => $admin_url . '?ctrl=skins&tab=system'); $entries['tools']['entries']['system']['entries']['plugins'] = array('text' => T_('Plugins') . '…', 'href' => $admin_url . '?ctrl=plugins'); $entries['tools']['entries']['system']['entries']['remote'] = array('text' => T_('Remote publishing') . '…', 'href' => $admin_url . '?ctrl=remotepublish'); $entries['tools']['entries']['system']['entries']['maintenance'] = array('text' => T_('Maintenance') . '…', 'href' => $admin_url . '?ctrl=tools'); $entries['tools']['entries']['system']['entries']['syslog'] = array('text' => T_('System log'), 'href' => '?ctrl=syslog'); } } if ($entries !== NULL) { $topleft_Menu->add_menu_entries(NULL, $entries); } // --------------------------------------------------------------------------- /* * RIGHT MENU */ global $localtimenow, $is_admin_page; $entries = array(); // Dev menu: global $debug_jslog; if ($debug || $debug_jslog) { // Show JS log menu if debug is enabled $dev_entries[] = array('separator' => true); $dev_entries['jslog'] = array('text' => T_('JS log'), 'title' => T_('JS log'), 'class' => 'jslog_switcher'); } if (!empty($dev_entries)) { // Add Dev menu if at least one entry is should be displayed $entries['dev'] = array('href' => $admin_url . '#', 'text' => '<span class="fa fa-wrench"></span> Dev', 'entries' => $dev_entries); } // User menu: $current_user_Group = $current_User->get_Group(); $userprefs_entries = array('name' => array('text' => $current_User->get_avatar_imgtag('crop-top-32x32', '', 'left') . ' ' . $current_User->get_preferred_name() . '<br /> <span class="note">' . $current_user_Group->get_name() . '</span>', 'href' => get_user_profile_url())); $userprefs_entries[] = array('separator' => true); $user_profile_url = get_user_profile_url(); if (!empty($user_profile_url)) { // Display this menu item only when url is available to current user $userprefs_entries['profile'] = array('text' => T_('Edit your profile') . '…', 'href' => $user_profile_url); } $user_avatar_url = get_user_avatar_url(); if (!empty($user_avatar_url)) { // Display this menu item only when url is available to current user $userprefs_entries['avatar'] = array('text' => T_('Your profile picture') . '…', 'href' => $user_avatar_url); } $user_pwdchange_url = get_user_pwdchange_url(); if (!empty($user_pwdchange_url)) { // Display this menu item only when url is available to current user $userprefs_entries['pwdchange'] = array('text' => T_('Change password') . '…', 'href' => $user_pwdchange_url); } $user_preferences_url = get_user_preferences_url(); if (!empty($user_preferences_url)) { // Display this menu item only when url is available to current user $userprefs_entries['userprefs'] = array('text' => T_('Preferences') . '…', 'href' => $user_preferences_url); } $user_subs_url = get_user_subs_url(); if (!empty($user_subs_url)) { // Display this menu item only when url is available to current user $userprefs_entries['subs'] = array('text' => T_('Notifications') . '…', 'href' => $user_subs_url); } $entries['userprefs'] = array('text' => '<strong>' . $current_User->get_colored_login(array('login_text' => 'name')) . '</strong>', 'href' => get_user_profile_url(), 'entries' => $userprefs_entries); $entries['time'] = array('text' => date(locale_shorttimefmt(), $localtimenow), 'disabled' => true, 'entry_class' => 'rwdhide'); if ($current_User->check_perm('admin', 'normal') && $current_User->check_perm('options', 'view')) { // Make time as link to Timezone settings if permission $entries['time']['disabled'] = false; $entries['time']['href'] = $admin_url . '?ctrl=time'; } // ADMIN SKINS: if ($is_admin_page) { $admin_skins = get_admin_skins(); if (count($admin_skins) > 1) { // We have several admin skins available: display switcher: $entries['userprefs']['entries']['admskins'] = array('text' => T_('Admin skin')); $redirect_to = rawurlencode(regenerate_url('', '', '', '&')); foreach ($admin_skins as $admin_skin) { $entries['userprefs']['entries']['admskins']['entries'][$admin_skin] = array('text' => $admin_skin, 'href' => $admin_url . '?ctrl=users&action=change_admin_skin&new_admin_skin=' . rawurlencode($admin_skin) . '&redirect_to=' . $redirect_to); } } } $entries['userprefs']['entries'][] = array('separator' => true); $entries['userprefs']['entries']['logout'] = array('text' => T_('Log out!'), 'href' => get_user_logout_url()); $topright_Menu->add_menu_entries(NULL, $entries); }
} $admin_skin = $Settings->get('admin_skin'); if (!$admin_skin || !file_exists(sprintf($admin_skin_path, $admin_skin))) { // even the default skin does not exist! if (!$admin_skin) { $Debuglog->add('There is no default admin skin set!', 'skins'); } else { $Debuglog->add('The default admin skin [' . $admin_skin . '] does not exist!', array('skin', 'error')); } if (file_exists(sprintf($admin_skin_path, 'chicago'))) { // 'legacy' does exist $admin_skin = 'chicago'; $Debuglog->add('Falling back to legacy admin skin.', 'skins'); } else { // get the first one available one $admin_skin_dirs = get_admin_skins(); if ($admin_skin_dirs === false) { $Debuglog->add('No admin skin found! Check that the path ' . $adminskins_path . ' exists.', array('skin', 'error')); } elseif (empty($admin_skin_dirs)) { // No admin skin directories found $Debuglog->add('No admin skin found! Check that there are skins in ' . $adminskins_path . '.', array('skin', 'error')); } else { $admin_skin = array_shift($admin_skin_dirs); $Debuglog->add('Falling back to first available skin.', 'skins'); } } } } if (!$admin_skin) { $Debuglog->display('No admin skin available!', '', true, 'skins'); die(1);
$Form->hidden('edited_user_login', $edited_User->login); /*************** Preferences **************/ $Form->begin_fieldset(T_('Preferences') . get_manual_link('user_preferences')); $value_admin_skin = get_param('edited_user_admin_skin'); if (!$value_admin_skin) { // no value supplied through POST/GET $value_admin_skin = $UserSettings->get('admin_skin', $edited_User->ID); } if (!$value_admin_skin) { // Nothing set yet for the user, use the default $value_admin_skin = $Settings->get('admin_skin'); } $Form->hidden('current_admin_skin', $value_admin_skin); if ($action != 'view') { // We can edit the values: $Form->select_input_array('edited_user_admin_skin', $value_admin_skin, get_admin_skins(), T_('Admin skin'), T_('The skin defines how the backoffice appears to you.'), array('onchange' => 'admin_skin_changed()')); // fp> TODO: We gotta have something like $edited_User->UserSettings->get('legend'); // Icon/text thresholds: $Form->text('edited_user_action_icon_threshold', $UserSettings->get('action_icon_threshold', $edited_User->ID), 1, T_('Action icon display'), T_('1:more icons ... 5:less icons')); $Form->text('edited_user_action_word_threshold', $UserSettings->get('action_word_threshold', $edited_User->ID), 1, T_('Action word display'), T_('1:more action words ... 5:less action words')); // To display or hide icon legend: $Form->checkbox('edited_user_legend', $UserSettings->get('display_icon_legend', $edited_User->ID), T_('Display icon legend'), T_('Display a legend at the bottom of every page including all action icons used on that page.')); // To activate or deactivate bozo validator: $Form->checkbox('edited_user_bozo', $UserSettings->get('control_form_abortions', $edited_User->ID), T_('Control form closing'), T_('This will alert you if you fill in data into a form and try to leave the form before submitting the data.')); // To activate focus on first form input text $Form->checkbox('edited_user_focusonfirst', $UserSettings->get('focus_on_first_input', $edited_User->ID), T_('Focus on first field'), T_('The focus will automatically go to the first input text field.')); // Number of results per page $results_per_page_options = array('10' => sprintf(T_('%s lines'), '10'), '20' => sprintf(T_('%s lines'), '20'), '30' => sprintf(T_('%s lines'), '30'), '40' => sprintf(T_('%s lines'), '40'), '50' => sprintf(T_('%s lines'), '50'), '100' => sprintf(T_('%s lines'), '100'), '200' => sprintf(T_('%s lines'), '200'), '500' => sprintf(T_('%s lines'), '500')); $Form->select_input_array('edited_user_results_page_size', $UserSettings->get('results_per_page', $edited_User->ID), $results_per_page_options, T_('Results per page'), T_('Number of rows displayed in results tables.'), array('force_keys_as_values' => true)); } else { // display only
?> "> <div class="actions_right"> <ul> <li class="menu_close" onmouseover="evo_menu_show(this)" onmouseout="evo_menu_hide(this)"> <?php user_profile_link('<strong>', '</strong>', '%s ' . get_icon('dropdown')); ?> <ul> <?php user_profile_link('<li>', '</li>', T_('User profile') . ' (%s)'); user_subs_link('<li>', '</li>', T_('Email subscriptions')); // ADMIN SKINS: if ($is_admin_page) { $admin_skins = get_admin_skins(); if (count($admin_skins) > 1) { // We have several admin skins available: display switcher: echo '<li class="separator"><hr /></li>'; // echo '<li class="menu_close" onmouseover="evo_menu_show(this)" onmouseout="evo_menu_hide(this)">'; // echo '<a href="#">'.T_('test').' '.get_icon('dropdown').'</a>'; // echo '<ul>'; foreach ($admin_skins as $admin_skin) { echo '<li><a href="admin.php?ctrl=users&action=change_admin_skin&new_admin_skin=' . rawurlencode($admin_skin) . '">' . T_('Admin skin:') . ' ' . $admin_skin . '</a></li>'; } // echo '</ul>'; // echo '</li>'; } } echo '<li class="separator"><hr /></li>'; user_logout_link('<li>', '</li>', T_('Logout'));