/** * 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); }
/** * Display user activate info form content * * @param Object activateinfo Form */ function display_activateinfo($params) { global $current_User, $Settings, $UserSettings, $Plugins; global $secure_htsrv_url, $rsc_path, $rsc_url, $dummy_fields; if (!is_logged_in()) { // if this happens, it means the code is not correct somewhere before this debug_die("You must log in to see this page."); } // init force request new email address param $force_request = param('force_request', 'boolean', false); // get last activation email timestamp from User Settings $last_activation_email_date = $UserSettings->get('last_activation_email', $current_User->ID); if ($force_request || empty($last_activation_email_date)) { // notification email was not sent yet, or user needs another one ( forced request ) $params = array_merge(array('form_action' => $secure_htsrv_url . 'login.php', 'form_name' => 'form_validatemail', 'form_class' => 'fform', 'form_layout' => 'fieldset', 'inskin' => false), $params); $Form = new Form($params['form_action'], $params['form_name'], 'post', $params['form_layout']); $Form->begin_form($params['form_class']); $Form->add_crumb('validateform'); $Form->hidden('action', 'req_validatemail'); $Form->hidden('redirect_to', $params['redirect_to']); if ($params['inskin']) { $Form->hidden('inskin', $params['inskin']); $Form->hidden('blog', $params['blog']); } $Form->hidden('req_validatemail_submit', 1); // to know if the form has been submitted $Form->begin_fieldset(); echo '<ol>'; echo '<li>' . T_('Please confirm your email address below:') . '</li>'; echo '</ol>'; // set email text input content only if this is not a forced request. This way the user may have bigger chance to write a correct email address. $user_email = $force_request ? '' : $current_User->email; // fp> note: 45 is the max length for evopress skin. $Form->text_input($dummy_fields['email'], $user_email, 45, T_('Your email'), '', array('maxlength' => 255, 'class' => 'input_text', 'required' => true)); $Form->end_fieldset(); // Submit button: $submit_button = array(array('name' => 'submit', 'value' => T_('Send me a new activation email now!'), 'class' => 'submit')); $Form->buttons_input($submit_button); if (!$params['inskin']) { $Plugins->trigger_event('DisplayValidateAccountFormFieldset', array('Form' => &$Form)); } $Form->end_form(); return; } // get notification email from general Settings $notification_email = $Settings->get('notification_sender_email'); // convert date to timestamp $last_activation_email_ts = mysql2timestamp($last_activation_email_date); // get difference between local time and server time $time_difference = $Settings->get('time_difference'); // get last activation email local date and time $last_email_date = date(locale_datefmt(), $last_activation_email_ts + $time_difference); $last_email_time = date(locale_shorttimefmt(), $last_activation_email_ts + $time_difference); $user_email = $current_User->email; echo '<ol start="1" class="expanded">'; $instruction = sprintf(T_('Open your email account for %s and find a message we sent you on %s at %s with the following title:'), $user_email, $last_email_date, $last_email_time); echo '<li>' . $instruction . '<br /><b>' . sprintf(T_('Activate your account: %s'), $current_User->login) . '</b>'; $request_validation_url = 'href="' . regenerate_url('', 'force_request=1&validate_required=true&redirect_to=' . $params['redirect_to']) . '"'; echo '<p>' . sprintf(T_('NOTE: If you don\'t find it, check your "Junk", "Spam" or "Unsolicited email" folders. If you really can\'t find it, <a %s>request a new activation email</a>.'), $request_validation_url) . '</p></li>'; echo '<li>' . sprintf(T_('Add us (%s) to your contacts to make sure you receive future email notifications, especially when someone sends you a private message.'), '<b><span class="nowrap">' . $notification_email . '</span></b>') . '</li>'; echo '<li><b class="red">' . T_('Click on the activation link in the email.') . '</b>'; echo '<p>' . T_('If this does not work, please copy/paste that link into the address bar of your browser.') . '</p>'; echo '<p>' . sprintf(T_('If you need assistance, please send an email to %s'), '<b><a href="mailto:"' . $notification_email . '"><span class="nowrap">' . $notification_email . '</span></a></b>') . '</p></li>'; echo '</ol>'; if ((strpos($user_email, '@hotmail.') || strpos($user_email, '@live.') || strpos($user_email, '@msn.')) && file_exists($rsc_path . 'img/login_help/hotmail-validation.png')) { // The user is on hotmail and we have a help screen to show him: (needs to be localized and include correct site name) echo '<div class="center" style="margin: 2em auto"><img src="' . $rsc_url . 'img/login_help/hotmail-validation.png" /></div>'; } }
/** * Template function: display time (datetime) of comment * * @param string date/time format: leave empty to use locale default time format * '#short_time' - to use locale default short time format * @param boolean true if you want GMT */ function time($format = '', $useGM = false) { if (empty($format)) { // Get the current locale's default time format $format = locale_timefmt(); } if ($format == '#short_time') { // Use short time format of current locale $format = locale_shorttimefmt(); } echo mysql2date($format, $this->date, $useGM); }
/** * Template function: display issue time (datetime) of Item * @param array * - 'time_format': Time format ('#short_time' - to use short time) * - ... see {@link get_issue_date()} * @see get_issue_date() */ function issue_time($params = array()) { // Make sure we are not missing any param: $params = array_merge(array('time_format' => '#'), $params); if (!isset($params['date_format'])) { $params['date_format'] = $params['time_format']; } if ($params['date_format'] == '#') { // Use default time format of current locale $params['date_format'] = locale_timefmt(); } if ($params['date_format'] == '#short_time') { // Use short time format of current locale $params['date_format'] = locale_shorttimefmt(); } echo $this->get_issue_date($params); }
// 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')); ?> </ul> </li> <li class="time"><?php echo date(locale_shorttimefmt(), $localtimenow); ?> </li> <?php if ($is_admin_page) { blog_home_link('<li>', '</li>', T_('Blog') . ' ' . get_icon('switch-to-blog'), T_('Home') . ' ' . get_icon('switch-to-blog')); } else { user_admin_link('<li>', '</li>', T_('Admin') . ' ' . get_icon('switch-to-admin')); } user_logout_link('<li>', '</li>', T_('Logout') . ' ' . get_icon('close'), '#', array('class' => 'rollover')); ?> </ul> </div> <div class="actions_left">