| 1 | 
        
            4
         | 
        
            ryan
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        
  | 
      
      
        | 3 | 
        
            18
         | 
        
            stefan
         | 
        // $Id$
  | 
      
      
        | 4 | 
        
            4
         | 
        
            ryan
         | 
        
  | 
      
      
        | 5 | 
        
         | 
        
         | 
        /*
  | 
      
      
        | 6 | 
        
         | 
        
         | 
        
  | 
      
      
        | 7 | 
        
         | 
        
         | 
         Website Baker Project <http://www.websitebaker.org/>
  | 
      
      
        | 8 | 
        
            310
         | 
        
            ryan
         | 
         Copyright (C) 2004-2006, Ryan Djurovich
  | 
      
      
        | 9 | 
        
            4
         | 
        
            ryan
         | 
        
  | 
      
      
        | 10 | 
        
         | 
        
         | 
         Website Baker is free software; you can redistribute it and/or modify
  | 
      
      
        | 11 | 
        
         | 
        
         | 
         it under the terms of the GNU General Public License as published by
  | 
      
      
        | 12 | 
        
         | 
        
         | 
         the Free Software Foundation; either version 2 of the License, or
  | 
      
      
        | 13 | 
        
         | 
        
         | 
         (at your option) any later version.
  | 
      
      
        | 14 | 
        
         | 
        
         | 
        
  | 
      
      
        | 15 | 
        
         | 
        
         | 
         Website Baker is distributed in the hope that it will be useful,
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
      
      
        | 17 | 
        
         | 
        
         | 
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
      
      
        | 18 | 
        
         | 
        
         | 
         GNU General Public License for more details.
  | 
      
      
        | 19 | 
        
         | 
        
         | 
        
  | 
      
      
        | 20 | 
        
         | 
        
         | 
         You should have received a copy of the GNU General Public License
  | 
      
      
        | 21 | 
        
         | 
        
         | 
         along with Website Baker; if not, write to the Free Software
  | 
      
      
        | 22 | 
        
         | 
        
         | 
         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  | 
      
      
        | 23 | 
        
         | 
        
         | 
        
  | 
      
      
        | 24 | 
        
         | 
        
         | 
        */
  | 
      
      
        | 25 | 
        
         | 
        
         | 
        
  | 
      
      
        | 26 | 
        
         | 
        
         | 
        /*
  | 
      
      
        | 27 | 
        
         | 
        
         | 
        
  | 
      
      
        | 28 | 
        
         | 
        
         | 
        Admin class
  | 
      
      
        | 29 | 
        
         | 
        
         | 
        
  | 
      
      
        | 30 | 
        
         | 
        
         | 
        This class will be used for every program that will be included
  | 
      
      
        | 31 | 
        
         | 
        
         | 
        in the administration section of Website Baker.
  | 
      
      
        | 32 | 
        
         | 
        
         | 
        
  | 
      
      
        | 33 | 
        
         | 
        
         | 
        */
  | 
      
      
        | 34 | 
        
         | 
        
         | 
        
  | 
      
      
        | 35 | 
        
            18
         | 
        
            stefan
         | 
        if(!defined('WB_URL')) {
 | 
      
      
        | 36 | 
        
         | 
        
         | 
        	header('Location: ../index.php');
 | 
      
      
        | 37 | 
        
            286
         | 
        
            stefan
         | 
        	exit(0);
  | 
      
      
        | 38 | 
        
            18
         | 
        
            stefan
         | 
        }
  | 
      
      
        | 39 | 
        
            4
         | 
        
            ryan
         | 
        
  | 
      
      
        | 40 | 
        
            5
         | 
        
            stefan
         | 
        require_once(WB_PATH.'/framework/class.wb.php');
  | 
      
      
        | 41 | 
        
         | 
        
         | 
        
  | 
      
      
        | 42 | 
        
            4
         | 
        
            ryan
         | 
        // Include PHPLIB template class
  | 
      
      
        | 43 | 
        
         | 
        
         | 
        require_once(WB_PATH."/include/phplib/template.inc");
  | 
      
      
        | 44 | 
        
         | 
        
         | 
        
  | 
      
      
        | 45 | 
        
         | 
        
         | 
        
  | 
      
      
        | 46 | 
        
         | 
        
         | 
        // Get WB version
  | 
      
      
        | 47 | 
        
         | 
        
         | 
        require_once(ADMIN_PATH.'/interface/version.php');
  | 
      
      
        | 48 | 
        
         | 
        
         | 
        
  | 
      
      
        | 49 | 
        
         | 
        
         | 
        /*
  | 
      
      
        | 50 | 
        
         | 
        
         | 
        Begin user changeable settings
  | 
      
      
        | 51 | 
        
         | 
        
         | 
        */
  | 
      
      
        | 52 | 
        
         | 
        
         | 
        
  | 
      
      
        | 53 | 
        
            55
         | 
        
            stefan
         | 
        
  | 
      
      
        | 54 | 
        
            5
         | 
        
            stefan
         | 
        class admin extends wb {
 | 
      
      
        | 55 | 
        
            4
         | 
        
            ryan
         | 
        	// Authenticate user then auto print the header
  | 
      
      
        | 56 | 
        
         | 
        
         | 
        	function admin($section_name, $section_permission = 'start', $auto_header = true, $auto_auth = true) {
 | 
      
      
        | 57 | 
        
            55
         | 
        
            stefan
         | 
        		$this->wb();
  | 
      
      
        | 58 | 
        
            4
         | 
        
            ryan
         | 
        		global $MESSAGE;
  | 
      
      
        | 59 | 
        
         | 
        
         | 
        		// Specify the current applications name
  | 
      
      
        | 60 | 
        
         | 
        
         | 
        		$this->section_name = $section_name;
  | 
      
      
        | 61 | 
        
         | 
        
         | 
        		$this->section_permission = $section_permission;
  | 
      
      
        | 62 | 
        
         | 
        
         | 
        		// Authenticate the user for this application
  | 
      
      
        | 63 | 
        
         | 
        
         | 
        		if($auto_auth == true) {
 | 
      
      
        | 64 | 
        
         | 
        
         | 
        			// First check if the user is logged-in
  | 
      
      
        | 65 | 
        
         | 
        
         | 
        			if($this->is_authenticated() == false) {
 | 
      
      
        | 66 | 
        
         | 
        
         | 
        				header('Location: '.ADMIN_URL.'/login/index.php');
 | 
      
      
        | 67 | 
        
            286
         | 
        
            stefan
         | 
        				exit(0);
  | 
      
      
        | 68 | 
        
            4
         | 
        
            ryan
         | 
        			}
  | 
      
      
        | 69 | 
        
         | 
        
         | 
        			// Now check if they are allowed in this section
  | 
      
      
        | 70 | 
        
         | 
        
         | 
        			if($this->get_permission($section_permission) == false) {
 | 
      
      
        | 71 | 
        
         | 
        
         | 
        				die($MESSAGE['ADMIN']['INSUFFICIENT_PRIVELLIGES']);
  | 
      
      
        | 72 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 73 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 74 | 
        
         | 
        
         | 
        		// Auto header code
  | 
      
      
        | 75 | 
        
         | 
        
         | 
        		if($auto_header == true) {
 | 
      
      
        | 76 | 
        
         | 
        
         | 
        			$this->print_header();
  | 
      
      
        | 77 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 78 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 79 | 
        
         | 
        
         | 
        
  | 
      
      
        | 80 | 
        
         | 
        
         | 
        	// Print the admin header
  | 
      
      
        | 81 | 
        
         | 
        
         | 
        	function print_header($body_tags = '') {
 | 
      
      
        | 82 | 
        
         | 
        
         | 
        		// Get vars from the language file
  | 
      
      
        | 83 | 
        
         | 
        
         | 
        		global $MENU;
  | 
      
      
        | 84 | 
        
         | 
        
         | 
        		global $MESSAGE;
  | 
      
      
        | 85 | 
        
         | 
        
         | 
        		global $TEXT;
  | 
      
      
        | 86 | 
        
         | 
        
         | 
        		// Connect to database and get website title
  | 
      
      
        | 87 | 
        
            95
         | 
        
            stefan
         | 
        		global $database;
  | 
      
      
        | 88 | 
        
            4
         | 
        
            ryan
         | 
        		$get_title = $database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name = 'title'");
 | 
      
      
        | 89 | 
        
         | 
        
         | 
        		$title = $get_title->fetchRow();
  | 
      
      
        | 90 | 
        
         | 
        
         | 
        		$header_template = new Template(ADMIN_PATH."/interface");
  | 
      
      
        | 91 | 
        
         | 
        
         | 
        		$header_template->set_file('page', 'header.html');
 | 
      
      
        | 92 | 
        
         | 
        
         | 
        		$header_template->set_block('page', 'header_block', 'header');
 | 
      
      
        | 93 | 
        
            291
         | 
        
            stefan
         | 
        		if(defined('DEFAULT_CHARSET')) {
 | 
      
      
        | 94 | 
        
         | 
        
         | 
        			$charset=DEFAULT_CHARSET;
  | 
      
      
        | 95 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 96 | 
        
         | 
        
         | 
        			$charset='utf-8';
  | 
      
      
        | 97 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 98 | 
        
            4
         | 
        
            ryan
         | 
        		$header_template->set_var(	array(
  | 
      
      
        | 99 | 
        
         | 
        
         | 
        													'SECTION_NAME' => $MENU[strtoupper($this->section_name)],
  | 
      
      
        | 100 | 
        
         | 
        
         | 
        													'INTERFACE_DIR' => ADMIN_URL.'/interface',
  | 
      
      
        | 101 | 
        
         | 
        
         | 
        													'BODY_TAGS' => $body_tags,
  | 
      
      
        | 102 | 
        
            106
         | 
        
            stefan
         | 
        													'WEBSITE_TITLE' => ($title['value']),
  | 
      
      
        | 103 | 
        
            4
         | 
        
            ryan
         | 
        													'TEXT_ADMINISTRATION' => $TEXT['ADMINISTRATION'],
  | 
      
      
        | 104 | 
        
            291
         | 
        
            stefan
         | 
        													'CHARSET' => $charset,
  | 
      
      
        | 105 | 
        
            4
         | 
        
            ryan
         | 
        													'VERSION' => VERSION
  | 
      
      
        | 106 | 
        
         | 
        
         | 
        													)
  | 
      
      
        | 107 | 
        
         | 
        
         | 
        											);
  | 
      
      
        | 108 | 
        
         | 
        
         | 
        		// Create the menu
  | 
      
      
        | 109 | 
        
         | 
        
         | 
        		$menu = array(
  | 
      
      
        | 110 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/start/index.php', '', $MENU['START'], 'start', 0),
  | 
      
      
        | 111 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/pages/index.php', '', $MENU['PAGES'], 'pages', 1),
  | 
      
      
        | 112 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/media/index.php', '', $MENU['MEDIA'], 'media', 1),
  | 
      
      
        | 113 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/addons/index.php', '', $MENU['ADDONS'], 'addons', 1),
  | 
      
      
        | 114 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/preferences/index.php', '', $MENU['PREFERENCES'], 'preferences', 0),
  | 
      
      
        | 115 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/settings/index.php', '', $MENU['SETTINGS'], 'settings', 1),
  | 
      
      
        | 116 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/access/index.php', '', $MENU['ACCESS'], 'access', 1),
  | 
      
      
        | 117 | 
        
            311
         | 
        
            ryan
         | 
        					array('http://www.websitebaker.org/permalink/help?version='.WB_VERSION, '_blank', $MENU['HELP'], 'help', 0),
 | 
      
      
        | 118 | 
        
            4
         | 
        
            ryan
         | 
        					array(WB_URL.'/', '_blank', $MENU['VIEW'], 'view', 0),
  | 
      
      
        | 119 | 
        
         | 
        
         | 
        					array(ADMIN_URL.'/logout/index.php', '', $MENU['LOGOUT'], 'logout', 0)
  | 
      
      
        | 120 | 
        
         | 
        
         | 
        					);
  | 
      
      
        | 121 | 
        
         | 
        
         | 
        		$header_template->set_block('header_block', 'linkBlock', 'link');
 | 
      
      
        | 122 | 
        
         | 
        
         | 
        		foreach($menu AS $menu_item) {
 | 
      
      
        | 123 | 
        
         | 
        
         | 
        			$link = $menu_item[0];
  | 
      
      
        | 124 | 
        
         | 
        
         | 
        			$target = $menu_item[1];
  | 
      
      
        | 125 | 
        
         | 
        
         | 
        			$title = $menu_item[2];
  | 
      
      
        | 126 | 
        
         | 
        
         | 
        			$permission_title = $menu_item[3];
  | 
      
      
        | 127 | 
        
         | 
        
         | 
        			$required = $menu_item[4];
  | 
      
      
        | 128 | 
        
         | 
        
         | 
        			$replace_old = array(ADMIN_URL, WB_URL, '/', 'index.php');
  | 
      
      
        | 129 | 
        
         | 
        
         | 
        			if($required == false OR $this->get_link_permission($permission_title)) {
 | 
      
      
        | 130 | 
        
         | 
        
         | 
        				$header_template->set_var('LINK', $link);
 | 
      
      
        | 131 | 
        
         | 
        
         | 
        				$header_template->set_var('TARGET', $target);
 | 
      
      
        | 132 | 
        
         | 
        
         | 
        				// If link is the current section apply a class name
  | 
      
      
        | 133 | 
        
         | 
        
         | 
        				if($permission_title == strtolower($this->section_name)) {
 | 
      
      
        | 134 | 
        
         | 
        
         | 
        					$header_template->set_var('CLASS', 'current');
 | 
      
      
        | 135 | 
        
         | 
        
         | 
        				} else {
 | 
      
      
        | 136 | 
        
         | 
        
         | 
        					$header_template->set_var('CLASS', '');
 | 
      
      
        | 137 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 138 | 
        
         | 
        
         | 
        				$header_template->set_var('TITLE', $title);
 | 
      
      
        | 139 | 
        
         | 
        
         | 
        				// Print link
  | 
      
      
        | 140 | 
        
         | 
        
         | 
        				$header_template->parse('link', 'linkBlock', true);
 | 
      
      
        | 141 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 142 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 143 | 
        
         | 
        
         | 
        		$header_template->parse('header', 'header_block', false);
 | 
      
      
        | 144 | 
        
         | 
        
         | 
        		$header_template->pparse('output', 'page');
 | 
      
      
        | 145 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 146 | 
        
         | 
        
         | 
        
  | 
      
      
        | 147 | 
        
         | 
        
         | 
        	// Print the admin footer
  | 
      
      
        | 148 | 
        
         | 
        
         | 
        	function print_footer() {
 | 
      
      
        | 149 | 
        
         | 
        
         | 
        		$footer_template = new Template(ADMIN_PATH."/interface");
  | 
      
      
        | 150 | 
        
         | 
        
         | 
        		$footer_template->set_file('page', 'footer.html');
 | 
      
      
        | 151 | 
        
         | 
        
         | 
        		$footer_template->set_block('page', 'footer_block', 'header');
 | 
      
      
        | 152 | 
        
         | 
        
         | 
        		$footer_template->parse('header', 'footer_block', false);
 | 
      
      
        | 153 | 
        
         | 
        
         | 
        		$footer_template->pparse('output', 'page');
 | 
      
      
        | 154 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 155 | 
        
         | 
        
         | 
        
  | 
      
      
        | 156 | 
        
         | 
        
         | 
        	// Return a system permission
  | 
      
      
        | 157 | 
        
         | 
        
         | 
        	function get_permission($name, $type = 'system') {
 | 
      
      
        | 158 | 
        
         | 
        
         | 
        		// Append to permission type
  | 
      
      
        | 159 | 
        
         | 
        
         | 
        		$type .= '_permissions';
  | 
      
      
        | 160 | 
        
         | 
        
         | 
        		// Check if we have a section to check for
  | 
      
      
        | 161 | 
        
         | 
        
         | 
        		if($name == 'start') {
 | 
      
      
        | 162 | 
        
         | 
        
         | 
        			return true;
  | 
      
      
        | 163 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 164 | 
        
         | 
        
         | 
        			// Set system permissions var
  | 
      
      
        | 165 | 
        
         | 
        
         | 
        			$system_permissions = $this->get_session('SYSTEM_PERMISSIONS');
 | 
      
      
        | 166 | 
        
         | 
        
         | 
        			// Set module permissions var
  | 
      
      
        | 167 | 
        
         | 
        
         | 
        			$module_permissions = $this->get_session('MODULE_PERMISSIONS');
 | 
      
      
        | 168 | 
        
         | 
        
         | 
        			// Set template permissions var
  | 
      
      
        | 169 | 
        
         | 
        
         | 
        			$template_permissions = $this->get_session('TEMPLATE_PERMISSIONS');
 | 
      
      
        | 170 | 
        
         | 
        
         | 
        			// Return true if system perm = 1
  | 
      
      
        | 171 | 
        
         | 
        
         | 
        			if(is_numeric(array_search($name, $$type))) {
 | 
      
      
        | 172 | 
        
         | 
        
         | 
        				if($type == 'system_permissions') {
 | 
      
      
        | 173 | 
        
         | 
        
         | 
        					return true;
  | 
      
      
        | 174 | 
        
         | 
        
         | 
        				} else {
 | 
      
      
        | 175 | 
        
         | 
        
         | 
        					return false;
  | 
      
      
        | 176 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 177 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 178 | 
        
         | 
        
         | 
        				if($type == 'system_permissions') {
 | 
      
      
        | 179 | 
        
         | 
        
         | 
        					return false;
  | 
      
      
        | 180 | 
        
         | 
        
         | 
        				} else {
 | 
      
      
        | 181 | 
        
         | 
        
         | 
        					return true;
  | 
      
      
        | 182 | 
        
         | 
        
         | 
        				}
  | 
      
      
        | 183 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 184 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 185 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 186 | 
        
            318
         | 
        
            stefan
         | 
        
  | 
      
      
        | 187 | 
        
         | 
        
         | 
        	function get_user_details($user_id) {
 | 
      
      
        | 188 | 
        
         | 
        
         | 
        		global $database;
  | 
      
      
        | 189 | 
        
         | 
        
         | 
        		$query_user = "SELECT username,display_name FROM ".TABLE_PREFIX."users WHERE user_id = '$user_id'";
  | 
      
      
        | 190 | 
        
         | 
        
         | 
        		$get_user = $database->query($query_user);
  | 
      
      
        | 191 | 
        
         | 
        
         | 
        		if($get_user->numRows() != 0) {
 | 
      
      
        | 192 | 
        
         | 
        
         | 
        			$user = $get_user->fetchRow();
  | 
      
      
        | 193 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 194 | 
        
         | 
        
         | 
        			$user['display_name'] = 'Unknown';
  | 
      
      
        | 195 | 
        
         | 
        
         | 
        			$user['username'] = 'unknown';
  | 
      
      
        | 196 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 197 | 
        
         | 
        
         | 
        		return $user;
  | 
      
      
        | 198 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 199 | 
        
         | 
        
         | 
        
  | 
      
      
        | 200 | 
        
         | 
        
         | 
        	function get_page_details($page_id) {
 | 
      
      
        | 201 | 
        
            321
         | 
        
            stefan
         | 
        		global $database;
  | 
      
      
        | 202 | 
        
            318
         | 
        
            stefan
         | 
        		$query = "SELECT page_id,page_title,modified_by,modified_when FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
  | 
      
      
        | 203 | 
        
         | 
        
         | 
        		$results = $database->query($query);
  | 
      
      
        | 204 | 
        
         | 
        
         | 
        		if($database->is_error()) {
 | 
      
      
        | 205 | 
        
         | 
        
         | 
        			$this->print_header();
  | 
      
      
        | 206 | 
        
         | 
        
         | 
        			$this->print_error($database->get_error());
  | 
      
      
        | 207 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 208 | 
        
         | 
        
         | 
        		if($results->numRows() == 0) {
 | 
      
      
        | 209 | 
        
         | 
        
         | 
        			$this->print_header();
  | 
      
      
        | 210 | 
        
         | 
        
         | 
        			$this->print_error($MESSAGE['PAGES']['NOT_FOUND']);
  | 
      
      
        | 211 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 212 | 
        
         | 
        
         | 
        		$results_array = $results->fetchRow();
  | 
      
      
        | 213 | 
        
         | 
        
         | 
        		return $results_array;
  | 
      
      
        | 214 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 215 | 
        
         | 
        
         | 
        
  | 
      
      
        | 216 | 
        
         | 
        
         | 
        	/** Function get_page_permission takes either a numerical page_id,
  | 
      
      
        | 217 | 
        
         | 
        
         | 
        	 * upon which it looks up the permissions in the database,
  | 
      
      
        | 218 | 
        
         | 
        
         | 
        	 * or an array with keys admin_groups and admin_users
  | 
      
      
        | 219 | 
        
         | 
        
         | 
        	 */
  | 
      
      
        | 220 | 
        
         | 
        
         | 
        	function get_page_permission($page,$action='admin') {
 | 
      
      
        | 221 | 
        
         | 
        
         | 
        		if ($action!='viewing') $action='admin';
  | 
      
      
        | 222 | 
        
         | 
        
         | 
        		$action_groups=$action.'_groups';
  | 
      
      
        | 223 | 
        
         | 
        
         | 
        		$action_users=$action.'_users';
  | 
      
      
        | 224 | 
        
         | 
        
         | 
        		if (is_array($page)) {
 | 
      
      
        | 225 | 
        
         | 
        
         | 
        				$groups=$page[$action_groups];
  | 
      
      
        | 226 | 
        
         | 
        
         | 
        				$users=$page[$action_users];
  | 
      
      
        | 227 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 228 | 
        
         | 
        
         | 
        			global $database;
  | 
      
      
        | 229 | 
        
            321
         | 
        
            stefan
         | 
        			$results = $database->query("SELECT $action_groups,$action_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page'");
 | 
      
      
        | 230 | 
        
            318
         | 
        
            stefan
         | 
        			$result = $results->fetchRow();
  | 
      
      
        | 231 | 
        
         | 
        
         | 
        			$groups = explode(',', str_replace('_', '', $result[$action_groups]));
 | 
      
      
        | 232 | 
        
         | 
        
         | 
        			$users = explode(',', str_replace('_', '', $result[$action_users]));
 | 
      
      
        | 233 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 234 | 
        
         | 
        
         | 
        		if(!is_numeric(array_search($this->get_group_id(), $groups)) AND !is_numeric(array_search($this->get_user_id(), $users))) {
 | 
      
      
        | 235 | 
        
         | 
        
         | 
        			return false;
  | 
      
      
        | 236 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 237 | 
        
         | 
        
         | 
        		return true;
  | 
      
      
        | 238 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 239 | 
        
         | 
        
         | 
        
  | 
      
      
        | 240 | 
        
            5
         | 
        
            stefan
         | 
        
  | 
      
      
        | 241 | 
        
            4
         | 
        
            ryan
         | 
        	// Returns a system permission for a menu link
  | 
      
      
        | 242 | 
        
         | 
        
         | 
        	function get_link_permission($title) {
 | 
      
      
        | 243 | 
        
         | 
        
         | 
        		$title = str_replace('_blank', '', $title);
 | 
      
      
        | 244 | 
        
         | 
        
         | 
        		$title = strtolower($title);
  | 
      
      
        | 245 | 
        
         | 
        
         | 
        		// Set system permissions var
  | 
      
      
        | 246 | 
        
         | 
        
         | 
        		$system_permissions = $this->get_session('SYSTEM_PERMISSIONS');
 | 
      
      
        | 247 | 
        
         | 
        
         | 
        		// Set module permissions var
  | 
      
      
        | 248 | 
        
         | 
        
         | 
        		$module_permissions = $this->get_session('MODULE_PERMISSIONS');
 | 
      
      
        | 249 | 
        
         | 
        
         | 
        		if($title == 'start') {
 | 
      
      
        | 250 | 
        
         | 
        
         | 
        			return true;
  | 
      
      
        | 251 | 
        
         | 
        
         | 
        		} else {
 | 
      
      
        | 252 | 
        
         | 
        
         | 
        			// Return true if system perm = 1
  | 
      
      
        | 253 | 
        
         | 
        
         | 
        			if(is_numeric(array_search($title, $system_permissions))) {
 | 
      
      
        | 254 | 
        
         | 
        
         | 
        				return true;
  | 
      
      
        | 255 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 256 | 
        
         | 
        
         | 
        				return false;
  | 
      
      
        | 257 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 258 | 
        
         | 
        
         | 
        		}
  | 
      
      
        | 259 | 
        
         | 
        
         | 
        	}
  | 
      
      
        | 260 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 261 | 
        
         | 
        
         | 
        
  | 
      
      
        | 262 | 
        
            239
         | 
        
            stefan
         | 
        ?>
  |