case 'new': case 'new_switchtab': // this gets set as action by JS, when we switch tabs // this gets set as action by JS, when we switch tabs case 'new_mass': case 'copy': case 'create_edit': case 'create': case 'create_publish': case 'list': if ($action == 'list') { // We only need view permission $selected = autoselect_blog('blog_ismember', 'view'); } else { // We need posting permission $selected = autoselect_blog('blog_post_statuses', 'edit'); } if (!$selected) { // No blog could be selected $Messages->add(T_('Sorry, you have no permission to post yet.'), 'error'); $action = 'nil'; } else { if (set_working_blog($selected)) { // Selected a new blog: $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog); } // Where are we going to redirect to? param('redirect_to', 'url', url_add_param($admin_url, 'ctrl=items&filter=restore&blog=' . $Blog->ID, '&')); // What form buttton has been pressed? param('save', 'string', '');
* {@internal Below is a list of authors who have contributed to design/coding of this file: }} * @author fplanque: Francois PLANQUE. * * @todo (sessions) When creating a blog, provide "edit options" (3 tabs) instead of a single long "New" form (storing the new Blog object with the session data). * @todo Currently if you change the name of a blog it gets not reflected in the blog list buttons! * * @version $Id: coll_settings.ctrl.php,v 1.11 2008/01/21 09:35:26 fplanque Exp $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } param_action('edit'); param('tab', 'string', 'general', true); // Check permissions on requested blog and autoselect an appropriate blog if necessary. // This will prevent a fat error when switching tabs and you have restricted perms on blog properties. if ($selected = autoselect_blog('blog_properties', 'edit')) { // We have a blog to work on: if (set_working_blog($selected)) { // Selected a new blog: $BlogCache =& get_Cache('BlogCache'); $Blog =& $BlogCache->get_by_ID($blog); } /** * @var Blog */ $edited_Blog =& $Blog; } else { // We could not find a blog we have edit perms on... // Note: we may still have permission to edit categories!! // redirect to blog list: header_redirect('?ctrl=collections');
case 'deprecate': case 'delete': param('comment_ID', 'integer', true); $edited_Comment = Comment_get_by_ID($comment_ID); $edited_Comment_Item =& $edited_Comment->get_Item(); set_working_blog($edited_Comment_Item->blog_ID); $BlogCache =& get_Cache('BlogCache'); $Blog =& $BlogCache->get_by_ID($blog); // Check permission: $current_User->check_perm('blog_comments', 'edit', true, $blog); // Where are we going to redirect to? param('redirect_to', 'string', url_add_param($admin_url, 'ctrl=items&blog=' . $blog . '&p=' . $edited_Comment->item_ID, '&')); break; case 'list': // Check permission: $selected = autoselect_blog('blog_comments', 'edit'); if (!$selected) { // No blog could be selected $Messages->add(T_('You have no permission to edit comments.'), 'error'); $action = 'nil'; } elseif (set_working_blog($selected)) { // Selected a new blog: $BlogCache =& get_Cache('BlogCache'); $Blog =& $BlogCache->get_by_ID($blog); } break; default: debug_die('unhandled action 1'); } $AdminUI->set_path('items'); // Sublevel may be attached below
/** * Builds the 1st half of the menu. This is the one with the most important features */ function build_menu_1() { global $blog, $admin_url; /** * @var User */ global $current_User; global $Blog; /** * @var AdminUI_general */ global $AdminUI; if (!$current_User->check_perm('admin', 'normal')) { return; } if ($current_User->check_perm('stats', 'list')) { // Permission to view stats for user's blogs: $AdminUI->add_menu_entries(NULL, array('stats' => array('text' => T_('Analytics'), 'href' => $admin_url . '?ctrl=stats&tab=summary&tab3=global', 'entries' => array('summary' => array('text' => T_('Hit summary'), 'href' => $admin_url . '?ctrl=stats&tab=summary&tab3=global&blog=' . $blog, 'order' => 'group_last', 'entries' => array('global' => array('text' => T_('Global hits'), 'href' => $admin_url . '?ctrl=stats&tab=summary&tab3=global&blog=' . $blog), 'browser' => array('text' => T_('Browser hits'), 'href' => $admin_url . '?ctrl=stats&tab=summary&tab3=browser&blog=' . $blog), 'robot' => array('text' => T_('Robot hits'), 'href' => $admin_url . '?ctrl=stats&tab=summary&tab3=robot&blog=' . $blog), 'feed' => array('text' => T_('RSS/Atom hits'), 'href' => $admin_url . '?ctrl=stats&tab=summary&tab3=feed&blog=' . $blog))))))); $ips_entries = array('top' => array('text' => T_('Top IPs'), 'href' => $admin_url . '?ctrl=stats&tab=ips&blog=' . $blog)); if ($current_User->check_perm('spamblacklist', 'view')) { // Display IP ranges only if current user has access to view Antispam tools $ips_entries['ranges'] = array('text' => T_('IP Ranges'), 'href' => $admin_url . '?ctrl=antispam&tab=stats&tab3=ipranges&blog=' . $blog); } $AdminUI->add_menu_entries('stats', array('refsearches' => array('text' => T_('Search B-hits'), 'href' => $admin_url . '?ctrl=stats&tab=refsearches&tab3=hits&blog=' . $blog, 'entries' => array('hits' => array('text' => T_('Search hits'), 'href' => $admin_url . '?ctrl=stats&tab=refsearches&tab3=hits&blog=' . $blog), 'keywords' => array('text' => T_('Keywords'), 'href' => $admin_url . '?ctrl=stats&tab=refsearches&tab3=keywords&blog=' . $blog), 'topengines' => array('text' => T_('Top engines'), 'href' => $admin_url . '?ctrl=stats&tab=refsearches&tab3=topengines&blog=' . $blog))), 'referers' => array('text' => T_('Referered B-hits'), 'href' => $admin_url . '?ctrl=stats&tab=referers&blog=' . $blog), 'other' => array('text' => T_('Direct B-hits'), 'href' => $admin_url . '?ctrl=stats&tab=other&blog=' . $blog), 'hits' => array('text' => T_('All Hits'), 'href' => $admin_url . '?ctrl=stats&tab=hits&blog=' . $blog), 'domains' => array('text' => T_('Referring domains'), 'href' => $admin_url . '?ctrl=stats&tab=domains&blog=' . $blog, 'order' => 'group_last', 'entries' => array('all' => array('text' => T_('All referrers'), 'href' => $admin_url . '?ctrl=stats&tab=domains&blog=' . $blog), 'top' => array('text' => T_('Top referrers'), 'href' => $admin_url . '?ctrl=stats&tab=domains&tab3=top&blog=' . $blog))), 'ips' => array('text' => T_('IPs'), 'href' => $admin_url . '?ctrl=stats&tab=ips&blog=' . $blog, 'entries' => $ips_entries))); if ($current_User->check_perm('stats', 'view') || autoselect_blog('stats', 'view')) { // Viewing aggregate + Permission to view stats for ALL blogs: $AdminUI->add_menu_entries('stats', array('goals' => array('text' => T_('Goals'), 'href' => $admin_url . '?ctrl=goals&blog=' . $blog, 'entries' => array('goals' => array('text' => T_('Goals'), 'href' => $admin_url . '?ctrl=goals&blog=' . $blog), 'cats' => array('text' => T_('Categories'), 'href' => $admin_url . '?ctrl=goals&tab3=cats&blog=' . $blog), 'hits' => array('text' => T_('Goal hits'), 'href' => $admin_url . '?ctrl=stats&tab=goals&tab3=hits&blog=' . $blog), 'stats' => array('text' => T_('Stats'), 'href' => $admin_url . '?ctrl=goals&tab3=stats&blog=' . $blog))), 'settings' => array('text' => T_('Settings'), 'href' => $admin_url . '?ctrl=stats&tab=settings&blog=' . $blog))); } } }
forget_param('isrch_ID'); $Messages->add($msg, 'success'); // Redirect so that a reload doesn't write to the DB twice: header_redirect('?ctrl=stats&tab=refsearches&tab3=intsearches', 303); // Will EXIT // We have EXITed already at this point!! break; } } else { if ($tab == 'domains' && $current_User->check_perm('stats', 'edit')) { require_js('jquery/jquery.jeditable.js', 'rsc_url'); } if ($blog == 0) { if (!$perm_view_all && isset($collections_Module)) { // Find a blog we can view stats for: if (!($selected = autoselect_blog('stats', 'view'))) { // No blog could be selected $Messages->add(T_('Sorry, there is no blog you have permission to view stats for.'), 'error'); $action = 'nil'; } elseif (set_working_blog($selected)) { // Selected a new blog: $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog); } } } switch ($action) { case 'changetype': // Change the type of a hit // Check permission: $current_User->check_perm('stats', 'edit', true);