| 1 | 238 | stefan | <?php
 | 
      
        | 2 |  |  | 
 | 
      
        | 3 | 399 | Ruebenwurz | // $Id$
 | 
      
        | 4 |  |  | 
 | 
      
        | 5 | 238 | stefan | /*
 | 
      
        | 6 |  |  | 
 | 
      
        | 7 |  |  |  Website Baker Project <http://www.websitebaker.org/>
 | 
      
        | 8 | 519 | Ruebenwurz |  Copyright (C) 2004-2008, Ryan Djurovich
 | 
      
        | 9 | 238 | stefan | 
 | 
      
        | 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 |  |  | // Include config file
 | 
      
        | 27 |  |  | require('../../config.php');
 | 
      
        | 28 |  |  | 
 | 
      
        | 29 |  |  | // Make sure people are allowed to access this page
 | 
      
        | 30 |  |  | if(MANAGE_SECTIONS != 'enabled') {
 | 
      
        | 31 |  |  | 	header('Location: '.ADMIN_URL.'/pages/index.php');
 | 
      
        | 32 | 286 | stefan | 	exit(0);
 | 
      
        | 33 | 238 | stefan | }
 | 
      
        | 34 |  |  | 
 | 
      
        | 35 |  |  | // Get page id
 | 
      
        | 36 |  |  | if(!isset($_GET['page_id']) OR !is_numeric($_GET['page_id'])) {
 | 
      
        | 37 |  |  | 	header("Location: index.php");
 | 
      
        | 38 | 286 | stefan | 	exit(0);
 | 
      
        | 39 | 238 | stefan | } else {
 | 
      
        | 40 |  |  | 	$page_id = $_GET['page_id'];
 | 
      
        | 41 |  |  | }
 | 
      
        | 42 |  |  | 
 | 
      
        | 43 |  |  | // Create new admin object
 | 
      
        | 44 |  |  | require_once(WB_PATH.'/framework/class.admin.php');
 | 
      
        | 45 |  |  | $admin = new admin('Pages', 'pages_modify');
 | 
      
        | 46 |  |  | 
 | 
      
        | 47 |  |  | // Check if we are supposed to add or delete a section
 | 
      
        | 48 |  |  | if(isset($_GET['section_id']) AND is_numeric($_GET['section_id'])) {
 | 
      
        | 49 |  |  | 	// Get more information about this section
 | 
      
        | 50 |  |  | 	$section_id = $_GET['section_id'];
 | 
      
        | 51 |  |  | 	$query_section = $database->query("SELECT module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id'");
 | 
      
        | 52 |  |  | 	if($query_section->numRows() == 0) {
 | 
      
        | 53 |  |  | 		$admin->print_error('Section not found');
 | 
      
        | 54 |  |  | 	}
 | 
      
        | 55 |  |  | 	$section = $query_section->fetchRow();
 | 
      
        | 56 |  |  | 	// Include the modules delete file if it exists
 | 
      
        | 57 |  |  | 	if(file_exists(WB_PATH.'/modules/'.$section['module'].'/delete.php')) {
 | 
      
        | 58 |  |  | 		require(WB_PATH.'/modules/'.$section['module'].'/delete.php');
 | 
      
        | 59 |  |  | 	}
 | 
      
        | 60 |  |  | 	$database->query("DELETE FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' LIMIT 1");
 | 
      
        | 61 |  |  | 	if($database->is_error()) {
 | 
      
        | 62 |  |  | 		$admin->print_error($database->get_error());
 | 
      
        | 63 |  |  | 	} else {
 | 
      
        | 64 |  |  | 		require(WB_PATH.'/framework/class.order.php');
 | 
      
        | 65 |  |  | 		$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
 | 
      
        | 66 |  |  | 		$order->clean($page_id);
 | 
      
        | 67 |  |  | 		$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/sections.php?page_id='.$page_id);
 | 
      
        | 68 |  |  | 		$admin->print_footer();
 | 
      
        | 69 |  |  | 		exit();
 | 
      
        | 70 |  |  | 	}
 | 
      
        | 71 |  |  | } elseif(isset($_POST['module']) AND $_POST['module'] != '') {
 | 
      
        | 72 |  |  | 	// Get section info
 | 
      
        | 73 |  |  | 	$module = $_POST['module'];
 | 
      
        | 74 |  |  | 	// Include the ordering class
 | 
      
        | 75 |  |  | 	require(WB_PATH.'/framework/class.order.php');
 | 
      
        | 76 |  |  | 	// Get new order
 | 
      
        | 77 |  |  | 	$order = new order(TABLE_PREFIX.'sections', 'position', 'section_id', 'page_id');
 | 
      
        | 78 |  |  | 	$position = $order->get_new($page_id);
 | 
      
        | 79 |  |  | 	// Insert module into DB
 | 
      
        | 80 |  |  | 	$database->query("INSERT INTO ".TABLE_PREFIX."sections (page_id,module,position,block) VALUES ('$page_id','$module','$position','1')");
 | 
      
        | 81 |  |  | 	// Get the section id
 | 
      
        | 82 |  |  | 	$section_id = $database->get_one("SELECT LAST_INSERT_ID()");
 | 
      
        | 83 |  |  | 	// Include the selected modules add file if it exists
 | 
      
        | 84 |  |  | 	if(file_exists(WB_PATH.'/modules/'.$module.'/add.php')) {
 | 
      
        | 85 |  |  | 		require(WB_PATH.'/modules/'.$module.'/add.php');
 | 
      
        | 86 |  |  | 	}
 | 
      
        | 87 |  |  | }
 | 
      
        | 88 |  |  | 
 | 
      
        | 89 |  |  | // Get perms
 | 
      
        | 90 |  |  | $database = new database();
 | 
      
        | 91 |  |  | $results = $database->query("SELECT admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
 | 
      
        | 92 |  |  | $results_array = $results->fetchRow();
 | 
      
        | 93 |  |  | $old_admin_groups = explode(',', $results_array['admin_groups']);
 | 
      
        | 94 |  |  | $old_admin_users = explode(',', $results_array['admin_users']);
 | 
      
        | 95 | 546 | doc | $in_old_group = FALSE;
 | 
      
        | 96 |  |  | foreach($admin->get_groups_id() as $cur_gid){
 | 
      
        | 97 |  |  |     if (in_array($cur_gid, $old_admin_groups)) {
 | 
      
        | 98 |  |  | 	$in_old_group = TRUE;
 | 
      
        | 99 |  |  |     }
 | 
      
        | 100 |  |  | }
 | 
      
        | 101 |  |  | if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
 | 
      
        | 102 | 238 | stefan | 	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
 | 
      
        | 103 |  |  | }
 | 
      
        | 104 |  |  | 
 | 
      
        | 105 |  |  | // Get page details
 | 
      
        | 106 |  |  | $database = new database();
 | 
      
        | 107 |  |  | $query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'";
 | 
      
        | 108 |  |  | $results = $database->query($query);
 | 
      
        | 109 |  |  | if($database->is_error()) {
 | 
      
        | 110 |  |  | 	$admin->print_header();
 | 
      
        | 111 |  |  | 	$admin->print_error($database->get_error());
 | 
      
        | 112 |  |  | }
 | 
      
        | 113 |  |  | if($results->numRows() == 0) {
 | 
      
        | 114 |  |  | 	$admin->print_header();
 | 
      
        | 115 |  |  | 	$admin->print_error($MESSAGE['PAGES']['NOT_FOUND']);
 | 
      
        | 116 |  |  | }
 | 
      
        | 117 |  |  | $results_array = $results->fetchRow();
 | 
      
        | 118 |  |  | 
 | 
      
        | 119 |  |  | // Set module permissions
 | 
      
        | 120 |  |  | $module_permissions = $_SESSION['MODULE_PERMISSIONS'];
 | 
      
        | 121 |  |  | 
 | 
      
        | 122 |  |  | // Unset block var
 | 
      
        | 123 |  |  | unset($block);
 | 
      
        | 124 |  |  | // Include template info file (if it exists)
 | 
      
        | 125 |  |  | if($results_array['template'] != '') {
 | 
      
        | 126 |  |  | 	$template_location = WB_PATH.'/templates/'.$results_array['template'].'/info.php';
 | 
      
        | 127 |  |  | } else {
 | 
      
        | 128 |  |  | 	$template_location = WB_PATH.'/templates/'.DEFAULT_TEMPLATE.'/info.php';
 | 
      
        | 129 |  |  | }
 | 
      
        | 130 |  |  | if(file_exists($template_location)) {
 | 
      
        | 131 |  |  | 	require($template_location);
 | 
      
        | 132 |  |  | }
 | 
      
        | 133 |  |  | // Check if $menu is set
 | 
      
        | 134 |  |  | if(!isset($block[1]) OR $block[1] == '') {
 | 
      
        | 135 |  |  | 	// Make our own menu list
 | 
      
        | 136 |  |  | 	$block[1] = $TEXT['MAIN'];
 | 
      
        | 137 |  |  | }
 | 
      
        | 138 | 552 | thorn | ?>
 | 
      
        | 139 | 238 | stefan | 
 | 
      
        | 140 | 552 | thorn | <?php // include jscalendar-setup
 | 
      
        | 141 |  |  | 	require_once(WB_PATH."/include/jscalendar/wb-setup.php");
 | 
      
        | 142 |  |  | 	// override some vars:
 | 
      
        | 143 |  |  | 	//$jscal_lang = "en"; //- calendar-language (default: wb-backend-language)
 | 
      
        | 144 |  |  | 	//$jscal_today = ""; // - date, the calendar offers if the text-field is empty (default: today)
 | 
      
        | 145 |  |  | 	//$jscal_firstday = "0"; // - first-day-of-week (0-sunday, 1-monday, ...) (default: 0(EN) or 1(everything else))
 | 
      
        | 146 |  |  | 	//$jscal_format = "Y-m-d H:i"; // - initial-format used for the text-field (default: from wb-backend-date-format)
 | 
      
        | 147 |  |  | 	//$jscal_ifformat = "%Y-%m-%d %H:%M"; // - format for jscalendar (default: wb-backend-date-format)
 | 
      
        | 148 | 238 | stefan | ?>
 | 
      
        | 149 |  |  | <table cellpadding="5" cellspacing="0" border="0" align="center" width="100%" height="50" style="margin-bottom: 10px;">
 | 
      
        | 150 |  |  | <tr style="background-color: #F0F0F0;">
 | 
      
        | 151 |  |  | 	<td valign="middle" align="left">
 | 
      
        | 152 |  |  | 		<h2><?php echo $HEADING['MANAGE_SECTIONS']; ?></h2>
 | 
      
        | 153 |  |  | 	</td>
 | 
      
        | 154 |  |  | 	<td align="right">
 | 
      
        | 155 |  |  | 		<?php echo $TEXT['CURRENT_PAGE']; ?>:
 | 
      
        | 156 | 442 | Ruebenwurz | 		<b><?php echo ($results_array['page_title']); ?></b>
 | 
      
        | 157 | 238 | stefan | 		-
 | 
      
        | 158 |  |  | 		<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>"><?php echo $HEADING['MODIFY_PAGE']; ?></a>
 | 
      
        | 159 |  |  | 		-
 | 
      
        | 160 |  |  | 		<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page_id; ?>"><?php echo $TEXT['CHANGE_SETTINGS']; ?></a>
 | 
      
        | 161 |  |  | 	</td>
 | 
      
        | 162 |  |  | </tr>
 | 
      
        | 163 |  |  | </table>
 | 
      
        | 164 |  |  | 
 | 
      
        | 165 |  |  | <?php
 | 
      
        | 166 | 552 | thorn | $query_sections = $database->query("SELECT section_id,module,position,block,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
 | 
      
        | 167 | 238 | stefan | if($query_sections->numRows() > 0) {
 | 
      
        | 168 |  |  | ?>
 | 
      
        | 169 |  |  | <form name="section_properties" action="<?php echo ADMIN_URL; ?>/pages/sections_save.php?page_id=<?php echo $page_id; ?>" method="post">
 | 
      
        | 170 |  |  | 
 | 
      
        | 171 |  |  | <table cellpadding="5" cellspacing="0" border="0" align="center" width="100%">
 | 
      
        | 172 |  |  | <tr>
 | 
      
        | 173 |  |  | 	<td><?php echo $TEXT['TYPE']; ?>:</td>
 | 
      
        | 174 |  |  | 	<?php if(SECTION_BLOCKS) { ?>
 | 
      
        | 175 |  |  | 	<td style="display: {DISPLAY_BLOCK}"><?php echo $TEXT['BLOCK']; ?>:</td>
 | 
      
        | 176 |  |  | 	<?php } ?>
 | 
      
        | 177 | 552 | thorn | 	<td><?php echo $TEXT['PUBL_START_DATE']; ?>:</td>
 | 
      
        | 178 |  |  | 	<td><?php echo $TEXT['PUBL_END_DATE']; ?>:</td>
 | 
      
        | 179 | 238 | stefan | 	<td colspan="3" width="60"><?php echo $TEXT['ACTIONS']; ?>:</td>
 | 
      
        | 180 |  |  | </tr>
 | 
      
        | 181 |  |  | <?php
 | 
      
        | 182 |  |  | 	$num_sections = $query_sections->numRows();
 | 
      
        | 183 |  |  | 	while($section = $query_sections->fetchRow()) {
 | 
      
        | 184 |  |  | 		// Get the modules real name
 | 
      
        | 185 | 346 | stefan | 		$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
 | 
      
        | 186 |  |  | 		if(!is_numeric(array_search($section['module'], $module_permissions))) {
 | 
      
        | 187 | 238 | stefan | 			?>
 | 
      
        | 188 |  |  | 			<tr>
 | 
      
        | 189 | 552 | thorn | 				<td style="width: <?php if(SECTION_BLOCKS) print "120"; else print "200"; ?>px;"><a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>#<?php echo $section['section_id']; ?>"><?php echo $module_name; ?></a></td>
 | 
      
        | 190 | 238 | stefan | 				<?php if(SECTION_BLOCKS) { ?>
 | 
      
        | 191 |  |  | 				<td>
 | 
      
        | 192 |  |  | 					<select name="block<?php echo $section['section_id']; ?>" style="width: 150px;">
 | 
      
        | 193 |  |  | 						<?php
 | 
      
        | 194 |  |  | 						foreach($block AS $number => $name) {
 | 
      
        | 195 |  |  | 							?>
 | 
      
        | 196 |  |  | 							<option value="<?php echo $number; ?>"<?php if($number == $section['block']) { echo ' selected'; } ?>><?php echo $name; ?></option>
 | 
      
        | 197 |  |  | 							<?php
 | 
      
        | 198 |  |  | 						}
 | 
      
        | 199 |  |  | 						?>
 | 
      
        | 200 |  |  | 					</select>
 | 
      
        | 201 |  |  | 				</td>
 | 
      
        | 202 | 552 | thorn | 				<?php } // jscalendar-stuff following ?>
 | 
      
        | 203 |  |  | 				<td><input type="text" id="start_date<?php echo $section['section_id']; ?>" name="start_date<?php echo $section['section_id']; ?>" value="<?php if($section['publ_start']==0) print ""; else print date($jscal_format, $section['publ_start'])?>" style="width: 120px;" />
 | 
      
        | 204 |  |  | 					<img src="<?php echo WB_URL ?>/include/jscalendar/img.gif" id="trigger_start<?php echo $section['section_id']; ?>" style="cursor: pointer; border: 1px solid red;" title="Calendar" onmouseover="this.style.background='red';" onmouseout="this.style.background=''" /></td>
 | 
      
        | 205 |  |  | 				<td><input type="text" id="end_date<?php echo $section['section_id']; ?>" name="end_date<?php echo $section['section_id']; ?>" value="<?php if($section['publ_end']==0) print ""; else print date($jscal_format, $section['publ_end'])?>" style="width: 120px;" />
 | 
      
        | 206 |  |  | 					<img src="<?php echo WB_URL ?>/include/jscalendar/img.gif" id="trigger_stop<?php echo $section['section_id']; ?>" style="cursor: pointer; border: 1px solid red;" title="Calendar" onmouseover="this.style.background='red';" onmouseout="this.style.background=''" /></td>
 | 
      
        | 207 | 238 | stefan | 				<td width="20">
 | 
      
        | 208 |  |  | 					<?php if($section['position'] != 1) { ?>
 | 
      
        | 209 |  |  | 					<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section['section_id']; ?>">
 | 
      
        | 210 |  |  | 						<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" alt="^" border="0" />
 | 
      
        | 211 |  |  | 					</a>
 | 
      
        | 212 |  |  | 					<?php } ?>
 | 
      
        | 213 |  |  | 				</td>
 | 
      
        | 214 |  |  | 				<td width="20">
 | 
      
        | 215 |  |  | 					<?php if($section['position'] != $num_sections) { ?>
 | 
      
        | 216 |  |  | 					<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section['section_id']; ?>">
 | 
      
        | 217 |  |  | 						<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" alt="v" border="0" />
 | 
      
        | 218 |  |  | 					</a>
 | 
      
        | 219 |  |  | 					<?php } ?>
 | 
      
        | 220 |  |  | 				</td>
 | 
      
        | 221 |  |  | 				<td width="20">
 | 
      
        | 222 |  |  | 					<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page_id; ?>§ion_id=<?php echo $section['section_id']; ?>');">
 | 
      
        | 223 |  |  | 						<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="Del" border="0" />
 | 
      
        | 224 |  |  | 					</a>
 | 
      
        | 225 |  |  | 				</td>
 | 
      
        | 226 |  |  | 			</tr>
 | 
      
        | 227 |  |  | 			<?php
 | 
      
        | 228 |  |  | 			}
 | 
      
        | 229 |  |  | 	}
 | 
      
        | 230 |  |  | 	?>
 | 
      
        | 231 |  |  | 	<tr>
 | 
      
        | 232 | 552 | thorn | 		<td align="center" colspan="<?php if(SECTION_BLOCKS) print "7"; else print "6"; ?>"><input type="submit" name="save" value="<?php echo $TEXT['SAVE']; ?>" style="width: 150px;" /></td>
 | 
      
        | 233 | 238 | stefan | 	</tr>
 | 
      
        | 234 |  |  | 	</table>
 | 
      
        | 235 |  |  | 
 | 
      
        | 236 |  |  | </form>
 | 
      
        | 237 |  |  | <?php
 | 
      
        | 238 | 552 | thorn | 	// now add the calendars -- remember to to set the range to [1970, 2037] if the date is used as timestamp!
 | 
      
        | 239 |  |  | 	// the loop is simply a copy from above.
 | 
      
        | 240 |  |  | 	$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' ORDER BY position ASC");
 | 
      
        | 241 |  |  | 	if($query_sections->numRows() > 0) {
 | 
      
        | 242 |  |  | 		$num_sections = $query_sections->numRows();
 | 
      
        | 243 |  |  | 		while($section = $query_sections->fetchRow()) {
 | 
      
        | 244 |  |  | 			// Get the modules real name
 | 
      
        | 245 |  |  | 			$module_name=$database->get_one("SELECT name FROM ".TABLE_PREFIX."addons WHERE directory='".$section['module']."'");
 | 
      
        | 246 |  |  | 			if(!is_numeric(array_search($section['module'], $module_permissions))) {
 | 
      
        | 247 |  |  | 	?>
 | 
      
        | 248 |  |  | 				<script type="text/javascript">
 | 
      
        | 249 |  |  | 					Calendar.setup(
 | 
      
        | 250 |  |  | 						{
 | 
      
        | 251 |  |  | 							inputField  : "start_date<?php echo $section['section_id']; ?>",
 | 
      
        | 252 |  |  | 							ifFormat    : "<?php echo $jscal_ifformat ?>",
 | 
      
        | 253 |  |  | 							button      : "trigger_start<?php echo $section['section_id']; ?>",
 | 
      
        | 254 |  |  | 							firstDay    : <?php echo $jscal_firstday ?>,
 | 
      
        | 255 |  |  | 							showsTime   : "true",
 | 
      
        | 256 |  |  | 							timeFormat  : "24",
 | 
      
        | 257 |  |  | 							date        : "<?php echo $jscal_today ?>",
 | 
      
        | 258 |  |  | 							range       : [1970, 2037],
 | 
      
        | 259 |  |  | 							step        : 1
 | 
      
        | 260 |  |  | 						}
 | 
      
        | 261 |  |  | 					);
 | 
      
        | 262 |  |  | 				</script>
 | 
      
        | 263 |  |  | 				<script type="text/javascript">
 | 
      
        | 264 |  |  | 					Calendar.setup(
 | 
      
        | 265 |  |  | 						{
 | 
      
        | 266 |  |  | 							inputField  : "end_date<?php echo $section['section_id']; ?>",
 | 
      
        | 267 |  |  | 							ifFormat    : "<?php echo $jscal_ifformat ?>",
 | 
      
        | 268 |  |  | 							button      : "trigger_stop<?php echo $section['section_id']; ?>",
 | 
      
        | 269 |  |  | 							firstDay    : <?php echo $jscal_firstday ?>,
 | 
      
        | 270 |  |  | 							showsTime   : "true",
 | 
      
        | 271 |  |  | 							timeFormat  : "24",
 | 
      
        | 272 |  |  | 							date        : "<?php echo $jscal_today ?>",
 | 
      
        | 273 |  |  | 							range       : [1970, 2037],
 | 
      
        | 274 |  |  | 							step        : 1
 | 
      
        | 275 |  |  | 						}
 | 
      
        | 276 |  |  | 					);
 | 
      
        | 277 |  |  | 				</script>
 | 
      
        | 278 |  |  | <?php
 | 
      
        | 279 |  |  | 			}
 | 
      
        | 280 |  |  | 		}
 | 
      
        | 281 |  |  | 	}
 | 
      
        | 282 |  |  | ?>
 | 
      
        | 283 |  |  | <?php
 | 
      
        | 284 | 238 | stefan | }
 | 
      
        | 285 |  |  | 
 | 
      
        | 286 |  |  | // Work-out if we should show the "Add Section" form
 | 
      
        | 287 |  |  | $query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
 | 
      
        | 288 |  |  | if($query_sections->numRows() == 0) {
 | 
      
        | 289 |  |  | 	?>
 | 
      
        | 290 |  |  | 	<h2><?php echo $TEXT['ADD_SECTION']; ?></h2>
 | 
      
        | 291 |  |  | 
 | 
      
        | 292 |  |  | 	<form name="add" action="<?php echo ADMIN_URL; ?>/pages/sections.php?page_id=<?php echo $page_id; ?>" method="post">
 | 
      
        | 293 |  |  | 
 | 
      
        | 294 |  |  | 	<table cellpadding="5" cellspacing="0" border="0" align="center" width="100%">
 | 
      
        | 295 |  |  | 	<tr>
 | 
      
        | 296 |  |  | 		<td>
 | 
      
        | 297 |  |  | 			<select name="module" style="width: 100%;">
 | 
      
        | 298 |  |  | 			<?php
 | 
      
        | 299 |  |  | 			// Insert module list
 | 
      
        | 300 | 384 | Ruebenwurz | 			$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' AND directory != 'menu_link' order by name");
 | 
      
        | 301 | 238 | stefan | 			if($result->numRows() > 0) {
 | 
      
        | 302 |  |  | 				while($module = $result->fetchRow()) {
 | 
      
        | 303 |  |  | 					// Check if user is allowed to use this module
 | 
      
        | 304 |  |  | 					if(!is_numeric(array_search($module['directory'], $module_permissions))) {
 | 
      
        | 305 |  |  | 						?>
 | 
      
        | 306 |  |  | 						<option value="<?php echo $module['directory']; ?>"<?php if($module['directory'] == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module['name']; ?></option>
 | 
      
        | 307 |  |  | 						<?php
 | 
      
        | 308 |  |  | 					}
 | 
      
        | 309 |  |  | 				}
 | 
      
        | 310 |  |  | 			}
 | 
      
        | 311 |  |  | 			?>
 | 
      
        | 312 |  |  | 			</select>
 | 
      
        | 313 |  |  | 		</td>
 | 
      
        | 314 |  |  | 		<td width="100">
 | 
      
        | 315 |  |  | 			<input type="submit" name="submit" value="<?php echo $TEXT['ADD']; ?>" style="width: 100px" />
 | 
      
        | 316 |  |  | 		</td>
 | 
      
        | 317 |  |  | 	</tr>
 | 
      
        | 318 |  |  | 	</table>
 | 
      
        | 319 |  |  | 
 | 
      
        | 320 |  |  | 	</form>
 | 
      
        | 321 |  |  | 	<?php
 | 
      
        | 322 |  |  | }
 | 
      
        | 323 |  |  | 
 | 
      
        | 324 |  |  | // Print admin footer
 | 
      
        | 325 |  |  | $admin->print_footer();
 | 
      
        | 326 |  |  | 
 | 
      
        | 327 | 552 | thorn | ?>
 |