| 1 | 1358 | Luisehahne | <?php
 | 
      
        | 2 |  |  | /**
 | 
      
        | 3 |  |  |  *
 | 
      
        | 4 |  |  |  * @category        admin
 | 
      
        | 5 |  |  |  * @package         pages
 | 
      
        | 6 | 1707 | Luisehahne |  * @author          Ryan Djurovich, WebsiteBaker Project
 | 
      
        | 7 | 1914 | Luisehahne |  * @copyright       2009-2013, WebsiteBaker Org. e.V.
 | 
      
        | 8 |  |  |  * @link            http://www.websitebaker.org/
 | 
      
        | 9 | 1358 | Luisehahne |  * @license         http://www.gnu.org/licenses/gpl.html
 | 
      
        | 10 |  |  |  * @platform        WebsiteBaker 2.8.x
 | 
      
        | 11 | 1373 | Luisehahne |  * @requirements    PHP 5.2.2 and higher
 | 
      
        | 12 | 1358 | Luisehahne |  * @version         $Id$
 | 
      
        | 13 | 1843 | Luisehahne |  * @filesource      $HeadURL$
 | 
      
        | 14 | 1358 | Luisehahne |  * @lastmodified    $Date$
 | 
      
        | 15 |  |  |  *
 | 
      
        | 16 |  |  |  */
 | 
      
        | 17 |  |  | 
 | 
      
        | 18 |  |  | // Include config file
 | 
      
        | 19 | 1825 | Luisehahne | if(!defined('WB_URL'))
 | 
      
        | 20 |  |  | {
 | 
      
        | 21 |  |  |     $config_file = realpath('../../config.php');
 | 
      
        | 22 |  |  |     if(file_exists($config_file) && !defined('WB_URL'))
 | 
      
        | 23 |  |  |     {
 | 
      
        | 24 |  |  |     	require($config_file);
 | 
      
        | 25 |  |  |     }
 | 
      
        | 26 |  |  | }
 | 
      
        | 27 | 1358 | Luisehahne | 
 | 
      
        | 28 |  |  | // Make sure people are allowed to access this page
 | 
      
        | 29 |  |  | if(MANAGE_SECTIONS != 'enabled')
 | 
      
        | 30 |  |  | {
 | 
      
        | 31 |  |  | 	header('Location: '.ADMIN_URL.'/pages/index.php');
 | 
      
        | 32 |  |  | 	exit(0);
 | 
      
        | 33 |  |  | }
 | 
      
        | 34 | 1402 | Luisehahne | /* */
 | 
      
        | 35 | 1835 | Luisehahne | $debug = true; // to show position
 | 
      
        | 36 | 1402 | Luisehahne | If(!defined('DEBUG')) { define('DEBUG',$debug);}
 | 
      
        | 37 |  |  | // Create new admin object
 | 
      
        | 38 | 1825 | Luisehahne | if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
 | 
      
        | 39 | 1753 | Luisehahne | $admin = new admin('Pages', 'pages_view', false);
 | 
      
        | 40 | 1358 | Luisehahne | 
 | 
      
        | 41 | 1825 | Luisehahne | // Include the WB functions file
 | 
      
        | 42 |  |  | if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 | 
      
        | 43 | 1914 | Luisehahne | $mLang = Translate::getinstance();
 | 
      
        | 44 |  |  | $mLang->enableAddon('admin\pages');
 | 
      
        | 45 | 1825 | Luisehahne | 
 | 
      
        | 46 | 1475 | Luisehahne | $action = 'show';
 | 
      
        | 47 | 1358 | Luisehahne | // Get page id
 | 
      
        | 48 | 1475 | Luisehahne | $requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
 | 
      
        | 49 |  |  | $page_id = intval((isset(${$requestMethod}['page_id'])) ? ${$requestMethod}['page_id'] : 0);
 | 
      
        | 50 |  |  | $action = ($page_id ? 'show' : $action);
 | 
      
        | 51 |  |  | // Get section id if there is one
 | 
      
        | 52 |  |  | $requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
 | 
      
        | 53 |  |  | $section_id = ((isset(${$requestMethod}['section_id'])) ? ${$requestMethod}['section_id']  : 0);
 | 
      
        | 54 |  |  | $action = ($section_id ? 'delete' : $action);
 | 
      
        | 55 |  |  | // Get module if there is one
 | 
      
        | 56 |  |  | $requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
 | 
      
        | 57 |  |  | $module = ((isset(${$requestMethod}['module'])) ? ${$requestMethod}['module']  : 0);
 | 
      
        | 58 |  |  | $action = ($module != '' ? 'add' : $action);
 | 
      
        | 59 |  |  | $admin_header = true;
 | 
      
        | 60 |  |  | $backlink = ADMIN_URL.'/pages/sections.php?page_id='.(int)$page_id;
 | 
      
        | 61 | 1358 | Luisehahne | 
 | 
      
        | 62 | 1475 | Luisehahne | switch ($action):
 | 
      
        | 63 |  |  | 	case 'delete' :
 | 
      
        | 64 | 1753 | Luisehahne |         if($admin->get_permission('pages_delete') == false)
 | 
      
        | 65 |  |  |         {
 | 
      
        | 66 |  |  | 			$admin->print_header();
 | 
      
        | 67 |  |  | 			$admin->print_error($module.' '.strtolower($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']),$backlink);
 | 
      
        | 68 |  |  |         }
 | 
      
        | 69 | 1358 | Luisehahne | 
 | 
      
        | 70 | 1475 | Luisehahne | 		if( ( !($section_id = intval($admin->checkIDKEY('section_id', 0, $_SERVER['REQUEST_METHOD'])) )) )
 | 
      
        | 71 |  |  | 		{
 | 
      
        | 72 |  |  | 			if($admin_header) { $admin->print_header(); }
 | 
      
        | 73 |  |  | 			$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$backlink);
 | 
      
        | 74 |  |  | 		}
 | 
      
        | 75 | 1358 | Luisehahne | 
 | 
      
        | 76 | 1475 | Luisehahne | 		$action = 'show';
 | 
      
        | 77 |  |  | 	    $sql  = 'SELECT `module` FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 78 |  |  | 	    $sql .= 'WHERE `section_id` ='.$section_id;
 | 
      
        | 79 |  |  |         if( ( ($modulname = $database->get_one($sql)) == $module) && ($section_id > 0 ) ) {
 | 
      
        | 80 |  |  | 			// Include the modules delete file if it exists
 | 
      
        | 81 |  |  | 			if(file_exists(WB_PATH.'/modules/'.$modulname.'/delete.php'))
 | 
      
        | 82 |  |  | 		    {
 | 
      
        | 83 |  |  | 				require(WB_PATH.'/modules/'.$modulname.'/delete.php');
 | 
      
        | 84 |  |  | 			}
 | 
      
        | 85 |  |  | 		    $sql  = 'DELETE FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 86 |  |  | 		    $sql .= 'WHERE `section_id` ='.(int)$section_id.' LIMIT 1';
 | 
      
        | 87 |  |  | 			if( !$database->query($sql) ) {
 | 
      
        | 88 |  |  | 				if($admin_header) { $admin->print_header(); }
 | 
      
        | 89 |  |  | 				$admin->print_error($database->get_error(),$backlink);
 | 
      
        | 90 |  |  | 			}  else {
 | 
      
        | 91 |  |  | 				require_once(WB_PATH.'/framework/class.order.php');
 | 
      
        | 92 |  |  | 				$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
 | 
      
        | 93 |  |  | 				$order->clean($page_id);
 | 
      
        | 94 | 1914 | Luisehahne | 				$format = $mLang->TEXT_SECTION.' %d  %s %s '.strtolower( $mLang->TEXT_DELETED);
 | 
      
        | 95 |  |  | 				$message = sprintf ($format,$section_id,strtoupper($modulname),strtolower($mLang->TEXT_SUCCESS));
 | 
      
        | 96 | 1475 | Luisehahne | 				if($admin_header) { $admin->print_header(); }
 | 
      
        | 97 |  |  | 				$admin_header = false;
 | 
      
        | 98 |  |  | 				unset($_POST);
 | 
      
        | 99 |  |  | 				$admin->print_success($message, $backlink );
 | 
      
        | 100 |  |  | 			}
 | 
      
        | 101 |  |  |         } else {
 | 
      
        | 102 |  |  | 			if($admin_header) { $admin->print_header(); }
 | 
      
        | 103 | 1914 | Luisehahne | 			$admin->print_error($module.' '.strtolower($mLang->TEXT_NOT_FOUND),$backlink);
 | 
      
        | 104 | 1475 | Luisehahne |         }
 | 
      
        | 105 | 1358 | Luisehahne | 
 | 
      
        | 106 | 1475 | Luisehahne | 		break;
 | 
      
        | 107 |  |  | 	case 'add' :
 | 
      
        | 108 | 1753 | Luisehahne |         if($admin->get_permission('pages_add') == false)
 | 
      
        | 109 |  |  |         {
 | 
      
        | 110 |  |  | 			$admin->print_header();
 | 
      
        | 111 |  |  | 			$admin->print_error($module.' '.strtolower($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']),$backlink);
 | 
      
        | 112 |  |  |         }
 | 
      
        | 113 | 1475 | Luisehahne | 		if (!$admin->checkFTAN())
 | 
      
        | 114 |  |  | 		{
 | 
      
        | 115 |  |  | 			$admin->print_header();
 | 
      
        | 116 |  |  | 			$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$backlink);
 | 
      
        | 117 |  |  | 		}
 | 
      
        | 118 |  |  | 		$action = 'show';
 | 
      
        | 119 |  |  | 		$module = preg_replace('/\W/', '', $module );  // fix secunia 2010-91-4
 | 
      
        | 120 |  |  | 		require_once(WB_PATH.'/framework/class.order.php');
 | 
      
        | 121 |  |  | 		// Get new order
 | 
      
        | 122 | 1358 | Luisehahne | 		$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
 | 
      
        | 123 | 1475 | Luisehahne | 		$position = $order->get_new($page_id);
 | 
      
        | 124 |  |  | 		// Insert module into DB
 | 
      
        | 125 |  |  | 	    $sql  = 'INSERT INTO `'.TABLE_PREFIX.'sections` SET ';
 | 
      
        | 126 |  |  | 	    $sql .= '`page_id` = '.(int)$page_id.', ';
 | 
      
        | 127 |  |  | 	    $sql .= '`module` = \''.$module.'\', ';
 | 
      
        | 128 |  |  | 	    $sql .= '`position` = '.(int)$position.', ';
 | 
      
        | 129 | 1753 | Luisehahne | 	    $sql .= '`block` = \'1\', ';
 | 
      
        | 130 |  |  |         $sql .= '`publ_start` = \'0\',';
 | 
      
        | 131 |  |  |         $sql .= '`publ_end` = \'0\' ';
 | 
      
        | 132 |  |  | 
 | 
      
        | 133 | 1475 | Luisehahne |         if($database->query($sql)) {
 | 
      
        | 134 |  |  | 			// Get the section id
 | 
      
        | 135 |  |  | 			$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
 | 
      
        | 136 |  |  | 			// Include the selected modules add file if it exists
 | 
      
        | 137 |  |  | 			if(file_exists(WB_PATH.'/modules/'.$module.'/add.php'))
 | 
      
        | 138 |  |  | 		    {
 | 
      
        | 139 |  |  | 				require(WB_PATH.'/modules/'.$module.'/add.php');
 | 
      
        | 140 |  |  | 			}
 | 
      
        | 141 |  |  |         } elseif ($database->is_error())  {
 | 
      
        | 142 |  |  | 			if($admin_header) { $admin->print_header(); }
 | 
      
        | 143 |  |  | 			$admin->print_error($database->get_error());
 | 
      
        | 144 |  |  | 		}
 | 
      
        | 145 |  |  | 		break;
 | 
      
        | 146 |  |  | 	default:
 | 
      
        | 147 |  |  | 		break;
 | 
      
        | 148 |  |  | endswitch;
 | 
      
        | 149 | 1358 | Luisehahne | 
 | 
      
        | 150 | 1475 | Luisehahne | switch ($action):
 | 
      
        | 151 |  |  | 	default:
 | 
      
        | 152 | 1358 | Luisehahne | 
 | 
      
        | 153 | 1475 | Luisehahne | 		if($admin_header) { $admin->print_header(); }
 | 
      
        | 154 |  |  | 		// Get perms
 | 
      
        | 155 |  |  | 		$sql  = 'SELECT `admin_groups`,`admin_users` FROM `'.TABLE_PREFIX.'pages` ';
 | 
      
        | 156 |  |  | 		$sql .= 'WHERE `page_id` = '.$page_id;
 | 
      
        | 157 |  |  | 		$results = $database->query($sql);
 | 
      
        | 158 | 1358 | Luisehahne | 
 | 
      
        | 159 | 1475 | Luisehahne | 		$results_array = $results->fetchRow();
 | 
      
        | 160 |  |  | 		$old_admin_groups = explode(',', $results_array['admin_groups']);
 | 
      
        | 161 |  |  | 		$old_admin_users = explode(',', $results_array['admin_users']);
 | 
      
        | 162 |  |  | 		$in_old_group = FALSE;
 | 
      
        | 163 |  |  | 		foreach($admin->get_groups_id() as $cur_gid)
 | 
      
        | 164 |  |  | 		{
 | 
      
        | 165 |  |  | 			if (in_array($cur_gid, $old_admin_groups))
 | 
      
        | 166 |  |  | 		    {
 | 
      
        | 167 |  |  | 				$in_old_group = TRUE;
 | 
      
        | 168 |  |  | 			}
 | 
      
        | 169 |  |  | 		}
 | 
      
        | 170 |  |  | 		if((!$in_old_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users)))
 | 
      
        | 171 |  |  | 		{
 | 
      
        | 172 |  |  | 			$admin->print_header();
 | 
      
        | 173 | 1707 | Luisehahne | 			$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
 | 
      
        | 174 | 1475 | Luisehahne | 		}
 | 
      
        | 175 | 1358 | Luisehahne | 
 | 
      
        | 176 | 1475 | Luisehahne | 		// Get page details
 | 
      
        | 177 |  |  | 		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'pages` ';
 | 
      
        | 178 |  |  | 		$sql .= 'WHERE `page_id` = '.$page_id;
 | 
      
        | 179 |  |  | 		$results = $database->query($sql);
 | 
      
        | 180 | 1358 | Luisehahne | 
 | 
      
        | 181 | 1475 | Luisehahne | 		if($database->is_error())
 | 
      
        | 182 |  |  | 		{
 | 
      
        | 183 |  |  | 			// $admin->print_header();
 | 
      
        | 184 |  |  | 			$admin->print_error($database->get_error());
 | 
      
        | 185 |  |  | 		}
 | 
      
        | 186 |  |  | 		if($results->numRows() == 0)
 | 
      
        | 187 |  |  | 		{
 | 
      
        | 188 |  |  | 			// $admin->print_header();
 | 
      
        | 189 | 1707 | Luisehahne | 			$admin->print_error($MESSAGE['PAGES_NOT_FOUND']);
 | 
      
        | 190 | 1475 | Luisehahne | 		}
 | 
      
        | 191 |  |  | 		$results_array = $results->fetchRow();
 | 
      
        | 192 | 1358 | Luisehahne | 
 | 
      
        | 193 | 1707 | Luisehahne | 		// Get display name of person who last modified the page
 | 
      
        | 194 |  |  | 			$user=$admin->get_user_details($results_array['modified_by']);
 | 
      
        | 195 |  |  | 		// Convert the unix ts for modified_when to human a readable form
 | 
      
        | 196 |  |  | 			if($results_array['modified_when'] != 0) {
 | 
      
        | 197 |  |  | 				$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
 | 
      
        | 198 |  |  | 			} else {
 | 
      
        | 199 |  |  | 				$modified_ts = 'Unknown';
 | 
      
        | 200 |  |  | 			}
 | 
      
        | 201 |  |  | 
 | 
      
        | 202 | 1475 | Luisehahne | 		// Set module permissions
 | 
      
        | 203 |  |  | 		$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
 | 
      
        | 204 | 1358 | Luisehahne | 
 | 
      
        | 205 | 1475 | Luisehahne | 		// Unset block var
 | 
      
        | 206 |  |  | 		unset($block);
 | 
      
        | 207 |  |  | 		// Include template info file (if it exists)
 | 
      
        | 208 |  |  | 		if($results_array['template'] != '')
 | 
      
        | 209 |  |  | 		{
 | 
      
        | 210 |  |  | 			$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
 | 
      
        | 211 |  |  | 		} else {
 | 
      
        | 212 |  |  | 			$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
 | 
      
        | 213 |  |  | 		}
 | 
      
        | 214 |  |  | 		if(file_exists($template_location))
 | 
      
        | 215 |  |  | 		{
 | 
      
        | 216 |  |  | 			require($template_location);
 | 
      
        | 217 |  |  | 		}
 | 
      
        | 218 | 1893 | Luisehahne |  // check block settings from template/info.php
 | 
      
        | 219 |  |  | 	if(isset($block) && is_array($block) && sizeof($block) > 0) {
 | 
      
        | 220 |  |  | 		if(isset($block[0])) {
 | 
      
        | 221 |  |  | 		throw new AppException('Invalid index 0 for $block[] in '.str_replace(WB_PATH,'',$template_location).'. '
 | 
      
        | 222 |  |  | 		                     . 'The list must start with $block[1]. Please correct it!');
 | 
      
        | 223 | 1475 | Luisehahne | 		}
 | 
      
        | 224 | 1893 | Luisehahne | 		foreach($block as $iIndex=>$sBlockTitle) {
 | 
      
        | 225 |  |  | 			if(trim($sBlockTitle) == '' ) {
 | 
      
        | 226 | 1914 | Luisehahne | 			 $block[$iIndex] = $mLang->TEXT_BLOCK.'_'.$iIndex;
 | 
      
        | 227 | 1893 | Luisehahne | 			}
 | 
      
        | 228 |  |  | 		}
 | 
      
        | 229 |  |  | 	}else {
 | 
      
        | 230 |  |  | 		// Make our own menu list
 | 
      
        | 231 | 1914 | Luisehahne | 		$block = array(1, $mLang->TEXT_MAIN);
 | 
      
        | 232 | 1893 | Luisehahne | 	}
 | 
      
        | 233 | 1475 | Luisehahne | 		/*-- load css files with jquery --*/
 | 
      
        | 234 |  |  | 		// include jscalendar-setup
 | 
      
        | 235 |  |  | 		$jscal_use_time = true; // whether to use a clock, too
 | 
      
        | 236 |  |  | 		require_once(WB_PATH."/include/jscalendar/wb-setup.php");
 | 
      
        | 237 | 1358 | Luisehahne | 
 | 
      
        | 238 | 1529 | Luisehahne | 		// Setup template object, parse vars to it, then parse it
 | 
      
        | 239 |  |  | 		// Create new template object
 | 
      
        | 240 | 1625 | Luisehahne | 		$tpl = new Template(dirname($admin->correct_theme_source('pages_sections.htt')));
 | 
      
        | 241 | 1529 | Luisehahne | 		// $template->debug = true;
 | 
      
        | 242 | 1475 | Luisehahne | 		$tpl->set_file('page', 'pages_sections.htt');
 | 
      
        | 243 |  |  | 		$tpl->set_block('page', 'main_block', 'main');
 | 
      
        | 244 |  |  | 		$tpl->set_block('main_block', 'module_block', 'module_list');
 | 
      
        | 245 |  |  | 		$tpl->set_block('main_block', 'section_block', 'section_list');
 | 
      
        | 246 |  |  | 		$tpl->set_block('section_block', 'block_block', 'block_list');
 | 
      
        | 247 |  |  | 		$tpl->set_block('main_block', 'calendar_block', 'calendar_list');
 | 
      
        | 248 |  |  | 		$tpl->set_var('FTAN', $admin->getFTAN());
 | 
      
        | 249 | 1358 | Luisehahne | 
 | 
      
        | 250 | 1475 | Luisehahne | 		// set first defaults and messages
 | 
      
        | 251 |  |  | 		$tpl->set_var(array(
 | 
      
        | 252 |  |  | 						'PAGE_ID' => $results_array['page_id'],
 | 
      
        | 253 |  |  | 						// 'PAGE_IDKEY' => $admin->getIDKEY($results_array['page_id']),
 | 
      
        | 254 |  |  | 						'PAGE_IDKEY' => $results_array['page_id'],
 | 
      
        | 255 | 1914 | Luisehahne | 						'TEXT_PAGE' => $mLang->TEXT_PAGE,
 | 
      
        | 256 | 1475 | Luisehahne | 						'PAGE_TITLE' => ($results_array['page_title']),
 | 
      
        | 257 |  |  | 						'MENU_TITLE' => ($results_array['menu_title']),
 | 
      
        | 258 | 1914 | Luisehahne | 						'TEXT_CURRENT_PAGE' => $mLang->TEXT_CURRENT_PAGE,
 | 
      
        | 259 |  |  | 						'TEXT_LAST_MODIFIED' => $mLang->TEXT_LAST_UPDATED_BY,
 | 
      
        | 260 | 1475 | Luisehahne | 						'HEADING_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
 | 
      
        | 261 |  |  | 						'HEADING_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
 | 
      
        | 262 | 1914 | Luisehahne | 						'TEXT_CHANGE_SETTINGS' => $mLang->TEXT_CHANGE_SETTINGS,
 | 
      
        | 263 |  |  | 						'TEXT_ADD_SECTION' => $mLang->TEXT_ADD_SECTION,
 | 
      
        | 264 |  |  | 						'TEXT_SECTION' => $mLang->TEXT_SECTION,
 | 
      
        | 265 | 1475 | Luisehahne | 						'TEXT_ID' => 'ID',
 | 
      
        | 266 | 1914 | Luisehahne | 						'TEXT_TYPE' => $mLang->TEXT_TYPE,
 | 
      
        | 267 |  |  | 						'TEXT_BLOCK' => $mLang->TEXT_BLOCK,
 | 
      
        | 268 | 1475 | Luisehahne | 						'TEXT_PUBL_START_DATE' => $TEXT{'PUBL_START_DATE'},
 | 
      
        | 269 | 1914 | Luisehahne | 						'TEXT_PUBL_END_DATE' => $mLang->TEXT_PUBL_END_DATE,
 | 
      
        | 270 |  |  | 						'TEXT_ACTIONS' => $mLang->TEXT_ACTIONS,
 | 
      
        | 271 | 1707 | Luisehahne | 						'MODIFIED_BY'          => $user['display_name'],
 | 
      
        | 272 |  |  | 						'MODIFIED_BY_USERNAME' => $user['username'],
 | 
      
        | 273 |  |  | 						'MODIFIED_WHEN'        => $modified_ts,
 | 
      
        | 274 | 1475 | Luisehahne | 						'ADMIN_URL' => ADMIN_URL,
 | 
      
        | 275 |  |  | 						'WB_URL' => WB_URL,
 | 
      
        | 276 |  |  | 						'THEME_URL' => THEME_URL
 | 
      
        | 277 |  |  | 						)
 | 
      
        | 278 |  |  | 					);
 | 
      
        | 279 | 1707 | Luisehahne | // check modify page permission
 | 
      
        | 280 |  |  | 	if( $admin->get_permission('pages_modify') )
 | 
      
        | 281 |  |  | 	{
 | 
      
        | 282 |  |  | 		$tpl->set_var(array(
 | 
      
        | 283 |  |  | 				'MODIFY_LINK_BEFORE' => '<a href="'.ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'].'">',
 | 
      
        | 284 |  |  | 				'MODIFY_LINK_AFTER' => '</a>',
 | 
      
        | 285 |  |  | 				'DISPLAY_MANAGE_MODIFY' => 'link',
 | 
      
        | 286 |  |  | 				));
 | 
      
        | 287 |  |  | 	} else {
 | 
      
        | 288 |  |  | 		$tpl->set_var(array(
 | 
      
        | 289 |  |  | 				'MODIFY_LINK_BEFORE' => '<span class="bold grey">',
 | 
      
        | 290 |  |  | 				'MODIFY_LINK_AFTER' => '</span>',
 | 
      
        | 291 |  |  | 				'DISPLAY_MANAGE_MODIFY' => 'link',
 | 
      
        | 292 |  |  | 				));
 | 
      
        | 293 |  |  | 	}
 | 
      
        | 294 | 1358 | Luisehahne | 
 | 
      
        | 295 | 1707 | Luisehahne | // check settings page permission
 | 
      
        | 296 |  |  | 	if( $admin->get_permission('pages_settings') )
 | 
      
        | 297 |  |  | 	{
 | 
      
        | 298 |  |  | 		$tpl->set_var(array(
 | 
      
        | 299 |  |  | 				'SETTINGS_LINK_BEFORE' => '<a href="'.ADMIN_URL.'/pages/settings.php?page_id='.$results_array['page_id'].'">',
 | 
      
        | 300 |  |  | 				'SETTINGS_LINK_AFTER' => '</a>',
 | 
      
        | 301 |  |  | 				'DISPLAY_MANAGE_SETTINGS' => 'link',
 | 
      
        | 302 |  |  | 				));
 | 
      
        | 303 |  |  | 	} else {
 | 
      
        | 304 |  |  | 		$tpl->set_var(array(
 | 
      
        | 305 |  |  | 				'SETTINGS_LINK_BEFORE' => '<span class="bold grey">',
 | 
      
        | 306 |  |  | 				'SETTINGS_LINK_AFTER' => '</span>',
 | 
      
        | 307 |  |  | 				'DISPLAY_MANAGE_SECTIONS' => 'link',
 | 
      
        | 308 |  |  | 				));
 | 
      
        | 309 |  |  | 	}
 | 
      
        | 310 |  |  | 
 | 
      
        | 311 | 1475 | Luisehahne | 		// Insert variables
 | 
      
        | 312 |  |  | 		$tpl->set_var(array(
 | 
      
        | 313 |  |  | 						'PAGE_ID' => $results_array['page_id'],
 | 
      
        | 314 |  |  | 						// 'PAGE_IDKEY' => $admin->getIDKEY($results_array['page_id']),
 | 
      
        | 315 |  |  | 						'PAGE_IDKEY' => $results_array['page_id'],
 | 
      
        | 316 |  |  | 						'VAR_PAGE_TITLE' => $results_array['page_title'],
 | 
      
        | 317 |  |  | 						'SETTINGS_LINK' => ADMIN_URL.'/pages/settings.php?page_id='.$results_array['page_id'],
 | 
      
        | 318 |  |  | 						'MODIFY_LINK' => ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id']
 | 
      
        | 319 |  |  | 						)
 | 
      
        | 320 |  |  | 					);
 | 
      
        | 321 | 1843 | Luisehahne | // setting trash only if more than one section exists
 | 
      
        | 322 |  |  | 		$tpl->set_block('section_block', 'delete_block', 'delete');
 | 
      
        | 323 |  |  | 		if( $bSectionCanDelete = ($database->get_one('SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id))!=1 ) {
 | 
      
        | 324 |  |  | 		}
 | 
      
        | 325 | 1358 | Luisehahne | 
 | 
      
        | 326 | 1475 | Luisehahne | 		$sql  = 'SELECT `section_id`,`module`,`position`,`block`,`publ_start`,`publ_end` ';
 | 
      
        | 327 |  |  | 		$sql .= 'FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 328 |  |  | 		$sql .= 'WHERE `page_id` = '.$page_id.' ';
 | 
      
        | 329 |  |  | 		$sql .= 'ORDER BY `position` ASC';
 | 
      
        | 330 |  |  | 		$query_sections = $database->query($sql);
 | 
      
        | 331 |  |  | 
 | 
      
        | 332 |  |  | 		if($query_sections->numRows() > 0)
 | 
      
        | 333 |  |  | 		{
 | 
      
        | 334 |  |  | 			$num_sections = $query_sections->numRows();
 | 
      
        | 335 | 1914 | Luisehahne | 			while($section = $query_sections->fetchRow(MYSQL_ASSOC))
 | 
      
        | 336 | 1475 | Luisehahne | 		    {
 | 
      
        | 337 |  |  | 				if(!is_numeric(array_search($section['module'], $module_permissions)))
 | 
      
        | 338 |  |  | 		        {
 | 
      
        | 339 |  |  | 					// Get the modules real name
 | 
      
        | 340 |  |  | 		            $sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` ';
 | 
      
        | 341 |  |  | 		            $sql .= 'WHERE `directory` = "'.$section['module'].'"';
 | 
      
        | 342 |  |  | 		            if(!$database->get_one($sql) || !file_exists(WB_PATH.'/modules/'.$section['module']))
 | 
      
        | 343 | 1358 | Luisehahne | 					{
 | 
      
        | 344 | 1475 | Luisehahne | 						$edit_page = '<span class="module_disabled">'.$section['module'].'</span>';
 | 
      
        | 345 |  |  | 					}else
 | 
      
        | 346 |  |  | 					{
 | 
      
        | 347 |  |  | 						$edit_page = '';
 | 
      
        | 348 |  |  | 					}
 | 
      
        | 349 | 1914 | Luisehahne | 					$sSectionIdPrefix = ( defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? SEC_ANCHOR : 'Sec');
 | 
      
        | 350 | 1475 | Luisehahne | 					$edit_page_0 = '<a id="sid'.$section['section_id'].'" href="'.ADMIN_URL.'/pages/modify.php?page_id='.$results_array['page_id'];
 | 
      
        | 351 | 1914 | Luisehahne | 					$edit_page_1  = ($sSectionIdPrefix!='') ? '#'.$sSectionIdPrefix.$section['section_id'].'">' : '">';
 | 
      
        | 352 | 1518 | Luisehahne | 					$edit_page_1 .= $section['module'].'</a>';
 | 
      
        | 353 | 1475 | Luisehahne | 					if(SECTION_BLOCKS)
 | 
      
        | 354 |  |  | 		            {
 | 
      
        | 355 |  |  | 						if($edit_page == '')
 | 
      
        | 356 |  |  | 						{
 | 
      
        | 357 |  |  | 							if(defined('EDIT_ONE_SECTION') && EDIT_ONE_SECTION)
 | 
      
        | 358 |  |  | 							{
 | 
      
        | 359 | 1518 | Luisehahne | 								$edit_page = $edit_page_0.'&wysiwyg='.$section['section_id'].$edit_page_1;
 | 
      
        | 360 | 1475 | Luisehahne | 							} else {
 | 
      
        | 361 | 1518 | Luisehahne | 								$edit_page = $edit_page_0.$edit_page_1;
 | 
      
        | 362 | 1475 | Luisehahne | 							}
 | 
      
        | 363 |  |  | 						}
 | 
      
        | 364 |  |  | 						$input_attribute = 'input_normal';
 | 
      
        | 365 |  |  | 						$tpl->set_var(array(
 | 
      
        | 366 |  |  | 								'STYLE_DISPLAY_SECTION_BLOCK' => ' style="visibility:visible;"',
 | 
      
        | 367 |  |  | 								'NAME_SIZE' => 300,
 | 
      
        | 368 |  |  | 								'INPUT_ATTRIBUTE' => $input_attribute,
 | 
      
        | 369 |  |  | 								'VAR_SECTION_ID' => $section['section_id'],
 | 
      
        | 370 |  |  | 								'VAR_SECTION_IDKEY' => $admin->getIDKEY($section['section_id']),
 | 
      
        | 371 |  |  | 								// 'VAR_SECTION_IDKEY' => $section['section_id'],
 | 
      
        | 372 |  |  | 								'VAR_POSITION' => $section['position'],
 | 
      
        | 373 |  |  | 								'LINK_MODIFY_URL_VAR_MODUL_NAME' => $edit_page,
 | 
      
        | 374 |  |  | 								'SELECT' => '',
 | 
      
        | 375 |  |  | 								'SET_NONE_DISPLAY_OPTION' => ''
 | 
      
        | 376 |  |  | 								)
 | 
      
        | 377 |  |  | 							);
 | 
      
        | 378 |  |  | 						// Add block options to the section_list
 | 
      
        | 379 |  |  | 						$tpl->clear_var('block_list');
 | 
      
        | 380 |  |  | 						foreach($block AS $number => $name)
 | 
      
        | 381 |  |  | 		                {
 | 
      
        | 382 |  |  | 							$tpl->set_var('NAME', htmlentities(strip_tags($name)));
 | 
      
        | 383 |  |  | 							$tpl->set_var('VALUE', $number);
 | 
      
        | 384 |  |  | 							$tpl->set_var('SIZE', 1);
 | 
      
        | 385 |  |  | 							if($section['block'] == $number)
 | 
      
        | 386 |  |  | 		                    {
 | 
      
        | 387 |  |  | 								$tpl->set_var('SELECTED', ' selected="selected"');
 | 
      
        | 388 |  |  | 							} else {
 | 
      
        | 389 |  |  | 								$tpl->set_var('SELECTED', '');
 | 
      
        | 390 |  |  | 							}
 | 
      
        | 391 |  |  | 							$tpl->parse('block_list', 'block_block', true);
 | 
      
        | 392 |  |  | 						}
 | 
      
        | 393 | 1358 | Luisehahne | 					} else {
 | 
      
        | 394 | 1475 | Luisehahne | 						if($edit_page == '')
 | 
      
        | 395 |  |  | 						{
 | 
      
        | 396 |  |  | 							$edit_page = $edit_page_0.'#wb_'.$edit_page_1;
 | 
      
        | 397 |  |  | 						}
 | 
      
        | 398 |  |  | 						$input_attribute = 'input_normal';
 | 
      
        | 399 |  |  | 						$tpl->set_var(array(
 | 
      
        | 400 |  |  | 								'STYLE_DISPLAY_SECTION_BLOCK' => ' style="visibility:hidden;"',
 | 
      
        | 401 |  |  | 								'NAME_SIZE' => 300,
 | 
      
        | 402 |  |  | 								'INPUT_ATTRIBUTE' => $input_attribute,
 | 
      
        | 403 |  |  | 								'VAR_SECTION_ID' => $section['section_id'],
 | 
      
        | 404 |  |  | 								'VAR_SECTION_IDKEY' => $admin->getIDKEY($section['section_id']),
 | 
      
        | 405 |  |  | 								// 'VAR_SECTION_IDKEY' => $section['section_id'],
 | 
      
        | 406 |  |  | 								'VAR_POSITION' => $section['position'],
 | 
      
        | 407 |  |  | 								'LINK_MODIFY_URL_VAR_MODUL_NAME' => $edit_page,
 | 
      
        | 408 |  |  | 								'NAME' => htmlentities(strip_tags($block[1])),
 | 
      
        | 409 |  |  | 								'VALUE' => 1,
 | 
      
        | 410 | 1825 | Luisehahne | 								'SET_NONE_DISPLAY_OPTION' => '<option> </option>'
 | 
      
        | 411 | 1475 | Luisehahne | 								)
 | 
      
        | 412 |  |  | 							);
 | 
      
        | 413 | 1358 | Luisehahne | 					}
 | 
      
        | 414 | 1475 | Luisehahne | 					// Insert icon and images
 | 
      
        | 415 |  |  | 					$tpl->set_var(array(
 | 
      
        | 416 |  |  | 								'CLOCK_16_PNG' => 'clock_16.png',
 | 
      
        | 417 |  |  | 								'CLOCK_DEL_16_PNG' => 'clock_del_16.png',
 | 
      
        | 418 |  |  | 								'DELETE_16_PNG' => 'delete_16.png'
 | 
      
        | 419 |  |  | 								)
 | 
      
        | 420 |  |  | 							);
 | 
      
        | 421 |  |  | 					// set calendar start values
 | 
      
        | 422 |  |  | 					if($section['publ_start']==0)
 | 
      
        | 423 |  |  | 		            {
 | 
      
        | 424 |  |  | 						$tpl->set_var('VALUE_PUBL_START', '');
 | 
      
        | 425 | 1358 | Luisehahne | 					} else {
 | 
      
        | 426 | 1914 | Luisehahne | 						$tpl->set_var('VALUE_PUBL_START', date($jscal_format, $section['publ_start']+TIMEZONE));
 | 
      
        | 427 | 1358 | Luisehahne | 					}
 | 
      
        | 428 | 1475 | Luisehahne | 					// set calendar start values
 | 
      
        | 429 |  |  | 					if($section['publ_end']==0)
 | 
      
        | 430 |  |  | 		            {
 | 
      
        | 431 |  |  | 						$tpl->set_var('VALUE_PUBL_END', '');
 | 
      
        | 432 |  |  | 					} else {
 | 
      
        | 433 | 1914 | Luisehahne | 						$tpl->set_var('VALUE_PUBL_END', date($jscal_format, $section['publ_end']+TIMEZONE));
 | 
      
        | 434 | 1475 | Luisehahne | 					}
 | 
      
        | 435 |  |  | 					// Insert icons up and down
 | 
      
        | 436 |  |  | 					if($section['position'] != 1 )
 | 
      
        | 437 |  |  | 		            {
 | 
      
        | 438 |  |  | 						$tpl->set_var(
 | 
      
        | 439 |  |  | 									'VAR_MOVE_UP_URL',
 | 
      
        | 440 |  |  | 									'<a href="'.ADMIN_URL.'/pages/move_up.php?page_id='.$page_id.'&section_id='.$section['section_id'].'">
 | 
      
        | 441 |  |  | 									<img src="'.THEME_URL.'/images/up_16.png" alt="{TEXT_MOVE_UP}" />
 | 
      
        | 442 |  |  | 									</a>' );
 | 
      
        | 443 |  |  | 					} else {
 | 
      
        | 444 |  |  | 						$tpl->set_var(array(
 | 
      
        | 445 |  |  | 									'VAR_MOVE_UP_URL' => ''
 | 
      
        | 446 |  |  | 									)
 | 
      
        | 447 |  |  | 								);
 | 
      
        | 448 |  |  | 					}
 | 
      
        | 449 |  |  | 					if($section['position'] != $num_sections ) {
 | 
      
        | 450 |  |  | 						$tpl->set_var(
 | 
      
        | 451 |  |  | 									'VAR_MOVE_DOWN_URL',
 | 
      
        | 452 |  |  | 									'<a href="'.ADMIN_URL.'/pages/move_down.php?page_id='.$page_id.'&section_id='.$section['section_id'].'">
 | 
      
        | 453 |  |  | 									<img src="'.THEME_URL.'/images/down_16.png" alt="{TEXT_MOVE_DOWN}" />
 | 
      
        | 454 |  |  | 									</a>' );
 | 
      
        | 455 |  |  | 					} else {
 | 
      
        | 456 |  |  | 						$tpl->set_var(array(
 | 
      
        | 457 |  |  | 									'VAR_MOVE_DOWN_URL' => ''
 | 
      
        | 458 |  |  | 									)
 | 
      
        | 459 |  |  | 								);
 | 
      
        | 460 |  |  | 					}
 | 
      
        | 461 | 1843 | Luisehahne | 
 | 
      
        | 462 | 1475 | Luisehahne | 				} else {
 | 
      
        | 463 |  |  | 				  continue;
 | 
      
        | 464 | 1358 | Luisehahne | 				}
 | 
      
        | 465 | 1475 | Luisehahne | 
 | 
      
        | 466 |  |  | 					$tpl->set_var(array(
 | 
      
        | 467 | 1840 | Luisehahne | 									'DISPLAY_DEBUG' => ' style="visibility:visible;"',
 | 
      
        | 468 | 1475 | Luisehahne | 									'TEXT_SID' => 'SID',
 | 
      
        | 469 |  |  | 									'DEBUG_COLSPAN_SIZE' => 9
 | 
      
        | 470 |  |  | 									)
 | 
      
        | 471 |  |  | 								);
 | 
      
        | 472 |  |  | 				if($debug)
 | 
      
        | 473 |  |  | 		        {
 | 
      
        | 474 |  |  | 					$tpl->set_var(array(
 | 
      
        | 475 | 1840 | Luisehahne | 									'DISPLAY_DEBUG' => ' style="visibility:visible;"',
 | 
      
        | 476 | 1475 | Luisehahne | 									'TEXT_PID' => 'PID',
 | 
      
        | 477 |  |  | 									'TEXT_SID' => 'SID',
 | 
      
        | 478 |  |  | 									'POSITION' => $section['position']
 | 
      
        | 479 |  |  | 									)
 | 
      
        | 480 |  |  | 								);
 | 
      
        | 481 |  |  | 				} else {
 | 
      
        | 482 |  |  | 					$tpl->set_var(array(
 | 
      
        | 483 |  |  | 									'DISPLAY_DEBUG' => ' style="display:none;"',
 | 
      
        | 484 |  |  | 									'TEXT_PID' => '',
 | 
      
        | 485 |  |  | 									'POSITION' => ''
 | 
      
        | 486 |  |  | 									)
 | 
      
        | 487 |  |  | 								);
 | 
      
        | 488 | 1358 | Luisehahne | 				}
 | 
      
        | 489 | 1843 | Luisehahne | 				if($bSectionCanDelete) {
 | 
      
        | 490 |  |  | 					$tpl->parse('delete', 'delete_block', false);
 | 
      
        | 491 |  |  | 				} else {
 | 
      
        | 492 |  |  | 					$tpl->parse('delete', '', false);
 | 
      
        | 493 |  |  | 				}
 | 
      
        | 494 | 1475 | Luisehahne | 				$tpl->parse('section_list', 'section_block', true);
 | 
      
        | 495 | 1358 | Luisehahne | 			}
 | 
      
        | 496 | 1843 | Luisehahne | 
 | 
      
        | 497 | 1358 | Luisehahne | 		}
 | 
      
        | 498 |  |  | 
 | 
      
        | 499 | 1475 | Luisehahne | 		// now add the calendars -- remember to to set the range to [1970, 2037] if the date is used as timestamp!
 | 
      
        | 500 |  |  | 		// the loop is simply a copy from above.
 | 
      
        | 501 |  |  | 		$sql  = 'SELECT `section_id`,`module` FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 502 |  |  | 		$sql .= 'WHERE page_id = '.$page_id.' ';
 | 
      
        | 503 |  |  | 		$sql .= 'ORDER BY `position` ASC';
 | 
      
        | 504 |  |  | 		$query_sections = $database->query($sql);
 | 
      
        | 505 | 1358 | Luisehahne | 
 | 
      
        | 506 | 1475 | Luisehahne | 		if($query_sections->numRows() > 0)
 | 
      
        | 507 |  |  | 		{
 | 
      
        | 508 |  |  | 			$num_sections = $query_sections->numRows();
 | 
      
        | 509 |  |  | 			while($section = $query_sections->fetchRow())
 | 
      
        | 510 |  |  | 		    {
 | 
      
        | 511 |  |  | 				// Get the modules real name
 | 
      
        | 512 |  |  | 		        $sql  = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` ';
 | 
      
        | 513 |  |  | 		        $sql .= 'WHERE `directory` = "'.$section['module'].'"';
 | 
      
        | 514 |  |  | 		        $module_name = $database->get_one($sql);
 | 
      
        | 515 | 1358 | Luisehahne | 
 | 
      
        | 516 | 1475 | Luisehahne | 				if(!is_numeric(array_search($section['module'], $module_permissions)))
 | 
      
        | 517 |  |  | 		        {
 | 
      
        | 518 |  |  | 					$tpl->set_var(array(
 | 
      
        | 519 |  |  | 								'jscal_ifformat' => $jscal_ifformat,
 | 
      
        | 520 |  |  | 								'jscal_firstday' => $jscal_firstday,
 | 
      
        | 521 |  |  | 								'jscal_today' => $jscal_today,
 | 
      
        | 522 |  |  | 								'start_date' => 'start_date'.$section['section_id'],
 | 
      
        | 523 |  |  | 								'end_date' => 'end_date'.$section['section_id'],
 | 
      
        | 524 |  |  | 								'trigger_start' => 'trigger_start'.$section['section_id'],
 | 
      
        | 525 |  |  | 								'trigger_end' => 'trigger_stop'.$section['section_id']
 | 
      
        | 526 |  |  | 								)
 | 
      
        | 527 |  |  | 							);
 | 
      
        | 528 |  |  | 					if(isset($jscal_use_time) && $jscal_use_time==TRUE) {
 | 
      
        | 529 |  |  | 						$tpl->set_var(array(
 | 
      
        | 530 |  |  | 								'showsTime' => "true",
 | 
      
        | 531 |  |  | 								'timeFormat' => "24"
 | 
      
        | 532 |  |  | 								)
 | 
      
        | 533 |  |  | 							);
 | 
      
        | 534 |  |  | 					}  else {
 | 
      
        | 535 |  |  | 						$tpl->set_var(array(
 | 
      
        | 536 |  |  | 								'showsTime' => "false",
 | 
      
        | 537 |  |  | 								'timeFormat' => "24"
 | 
      
        | 538 |  |  | 								)
 | 
      
        | 539 |  |  | 							);
 | 
      
        | 540 |  |  | 					}
 | 
      
        | 541 |  |  | 				}
 | 
      
        | 542 |  |  | 				$tpl->parse('calendar_list', 'calendar_block', true);
 | 
      
        | 543 | 1358 | Luisehahne | 			}
 | 
      
        | 544 |  |  | 		}
 | 
      
        | 545 |  |  | 
 | 
      
        | 546 | 1475 | Luisehahne | 		// Work-out if we should show the "Add Section" form
 | 
      
        | 547 |  |  | 		$sql  = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` ';
 | 
      
        | 548 |  |  | 		$sql .= 'WHERE `page_id` = '.$page_id.' AND `module` = "menu_link"';
 | 
      
        | 549 |  |  | 		$query_sections = $database->query($sql);
 | 
      
        | 550 | 1914 | Luisehahne | 		$tpl->set_var('TEXT_PLEASE_SELECT', $mLang->TEXT_NONE);
 | 
      
        | 551 | 1475 | Luisehahne | 		if($query_sections->numRows() == 0)
 | 
      
        | 552 |  |  | 		{
 | 
      
        | 553 | 1914 | Luisehahne | 			$tpl->set_var('TEXT_PLEASE_SELECT', $mLang->TEXT_PLEASE_SELECT);
 | 
      
        | 554 | 1475 | Luisehahne | 			// Modules list
 | 
      
        | 555 |  |  | 		    $sql  = 'SELECT `name`,`directory`,`type` FROM `'.TABLE_PREFIX.'addons` ';
 | 
      
        | 556 |  |  | 		    $sql .= 'WHERE `type` = "module" AND `function` = "page" AND `directory` != "menu_link" ';
 | 
      
        | 557 |  |  | 		    $sql .= 'ORDER BY `name`';
 | 
      
        | 558 |  |  | 		    $result = $database->query($sql);
 | 
      
        | 559 |  |  | 		// if(DEBUG && $database->is_error()) { $admin->print_error($database->get_error()); }
 | 
      
        | 560 | 1358 | Luisehahne | 
 | 
      
        | 561 | 1475 | Luisehahne | 			if($result->numRows() > 0)
 | 
      
        | 562 |  |  | 		    {
 | 
      
        | 563 |  |  | 				while ($module = $result->fetchRow())
 | 
      
        | 564 |  |  | 		        {
 | 
      
        | 565 |  |  | 					// Check if user is allowed to use this module   echo  $module['directory'],'<br />';
 | 
      
        | 566 |  |  | 					if(!is_numeric(array_search($module['directory'], $module_permissions)))
 | 
      
        | 567 |  |  | 		            {
 | 
      
        | 568 |  |  | 						$tpl->set_var('VALUE', $module['directory']);
 | 
      
        | 569 |  |  | 						$tpl->set_var('NAME', $module['name']);
 | 
      
        | 570 |  |  | 						if($module['directory'] == 'wysiwyg')
 | 
      
        | 571 |  |  | 		                {
 | 
      
        | 572 |  |  | 							$tpl->set_var('SELECTED', ' selected="selected"');
 | 
      
        | 573 |  |  | 						} else {
 | 
      
        | 574 |  |  | 							$tpl->set_var('SELECTED', '');
 | 
      
        | 575 |  |  | 						}
 | 
      
        | 576 |  |  | 						$tpl->parse('module_list', 'module_block', true);
 | 
      
        | 577 |  |  | 					} else {
 | 
      
        | 578 |  |  | 					  continue;
 | 
      
        | 579 |  |  | 					}
 | 
      
        | 580 | 1358 | Luisehahne | 				}
 | 
      
        | 581 |  |  | 			}
 | 
      
        | 582 |  |  | 		}
 | 
      
        | 583 | 1475 | Luisehahne | 		// Insert language text and messages
 | 
      
        | 584 |  |  | 		$tpl->set_var(array(
 | 
      
        | 585 |  |  | 							'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
 | 
      
        | 586 | 1914 | Luisehahne | 							'TEXT_ARE_YOU_SURE' => $mLang->TEXT_ARE_YOU_SURE,
 | 
      
        | 587 |  |  | 							'TEXT_TYPE' => $mLang->TEXT_TYPE,
 | 
      
        | 588 |  |  | 							'TEXT_ADD' => $mLang->TEXT_ADD,
 | 
      
        | 589 |  |  | 							'TEXT_SAVE' =>  $mLang->TEXT_SAVE,
 | 
      
        | 590 | 1475 | Luisehahne | 							'TEXTLINK_MODIFY_PAGE' => $HEADING['MODIFY_PAGE'],
 | 
      
        | 591 | 1914 | Luisehahne | 							'TEXT_CALENDAR' => $mLang->TEXT_CALENDAR,
 | 
      
        | 592 |  |  | 							'TEXT_DELETE_DATE' => $mLang->TEXT_DELETE_DATE,
 | 
      
        | 593 |  |  | 							'TEXT_ADD_SECTION' => $mLang->TEXT_ADD_SECTION,
 | 
      
        | 594 |  |  | 							'TEXT_MOVE_UP' => $mLang->TEXT_MOVE_UP,
 | 
      
        | 595 |  |  | 							'TEXT_MOVE_DOWN' => $mLang->TEXT_MOVE_DOWN
 | 
      
        | 596 | 1475 | Luisehahne | 							)
 | 
      
        | 597 |  |  | 						);
 | 
      
        | 598 |  |  | 		$tpl->parse('main', 'main_block', false);
 | 
      
        | 599 |  |  | 		$tpl->pparse('output', 'page');
 | 
      
        | 600 |  |  | 		// include the required file for Javascript admin
 | 
      
        | 601 |  |  | 		if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'))
 | 
      
        | 602 |  |  | 		{
 | 
      
        | 603 |  |  | 			include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php');
 | 
      
        | 604 |  |  | 		}
 | 
      
        | 605 |  |  | 		break;
 | 
      
        | 606 |  |  | endswitch;
 | 
      
        | 607 | 1358 | Luisehahne | 
 | 
      
        | 608 |  |  | // Print admin footer
 | 
      
        | 609 |  |  | $admin->print_footer();
 |