/** * Handle plugin administration page * */ function yourls_plugin_admin_page($plugin_page) { global $ydb; // Check the plugin page is actually registered if (!isset($ydb->plugin_pages[$plugin_page])) { yourls_die('This page does not exist. Maybe a plugin you thought was activated is inactive?', 'Invalid link'); } // Draw the page itself yourls_do_action('load-' . $plugin_page); yourls_html_head('plugin_page_' . $plugin_page, $ydb->plugin_pages[$plugin_page]['title']); yourls_html_logo(); yourls_html_menu(); call_user_func($ydb->plugin_pages[$plugin_page]['function']); yourls_html_footer(); die; }
$max_on_page = $offset + $perpage; } // Determine Number Of Items To Display On Page if ($offset + 1 > $total_items) { $display_on_page = $total_items; } else { $display_on_page = $offset + 1; } // Determing Total Amount Of Pages $total_pages = ceil($total_items / $perpage); } // Begin output of the page $context = $is_bookmark ? 'bookmark' : 'index'; yourls_html_head($context); yourls_html_logo(); yourls_html_menu(); yourls_do_action('admin_page_before_content'); if (!$is_bookmark) { ?> <p><?php echo $search_sentence; ?> </p> <p><?php printf(yourls__('Display <strong>%1$s</strong> to <strong class="increment">%2$s</strong> of <strong class="increment">%3$s</strong> URLs'), $display_on_page, $max_on_page, $total_items); if ($total_items_clicks !== false) { echo ", " . sprintf(yourls_n('counting <strong>1</strong> click', 'counting <strong>%s</strong> clicks', $total_items_clicks), yourls_number_format_i18n($total_items_clicks)); } ?> .</p> <?php
/** * Yourls action auth_successful * * @return bool */ public function action_auth_successful() { if (!yourls_is_admin()) { return true; } /** * Check page permissions */ if (preg_match('#\\/admin\\/(.*?)\\.php#', $_SERVER['SCRIPT_FILENAME'], $matches)) { if (!in_array($matches[1], $this->helperGetAllowedPermissions())) { yourls_add_notice(yourls__('Denied access to this page', self::APP_NAMESPACE)); yourls_html_head('accessdenied', yourls__('Denied access to this page', self::APP_NAMESPACE)); yourls_html_logo(); yourls_html_menu(); yourls_html_footer(); die; } } /** * Check action permissions */ if (yourls_is_Ajax()) { $action = $this->getRequest('action'); $permissions = $this->helperGetAllowedPermissions(); $bol = false; switch ($action) { case 'edit_display': case 'edit_save': if (!in_array('edit', $permissions['action'])) { $bol = true; } break; case 'add': case 'delete': if (!in_array($action, $permissions['action'])) { $bol = true; } break; } if ($bol) { $this->setRequest('action_old', $action); $this->setRequest('action', 'accessdenied'); } } }