Project

General

Profile

« Previous | Next » 

Revision 169

Added by ryan about 19 years ago

Fixed addon listing in numerous places so it now use's DB for info

View differences:

sections.php
164 164
		$module_path = WB_PATH.'/modules/'.$section['module'].'/info.php';
165 165
		if(file_exists($module_path)) {
166 166
			require($module_path);
167
			if(!isset($module_type)) { $module_type = 'unknown'; }
168
			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_type == 'page') {
167
			if(!isset($module_function)) { $module_function = 'unknown'; }
168
			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_function == 'page') {
169 169
			?>
170 170
			<tr>
171 171
				<td style="width: 250px;"><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>
......
204 204
			</tr>
205 205
			<?php
206 206
			}
207
			if(isset($module_type)) { unset($module_type); } // Unset module type
207
			if(isset($module_function)) { unset($module_function); } // Unset module type
208 208
		}
209 209
	}
210 210
	?>
......
236 236
			<select name="module" style="width: 100%;">
237 237
			<?php
238 238
			// Insert module list
239
			if($handle = opendir(WB_PATH.'/modules/')) {
240
				while (false !== ($file = readdir($handle))) {
241
					if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'menu_link' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
242
						// Include the modules info file
243
						require(WB_PATH.'/modules/'.$file.'/info.php');
244
						// Check if user is allowed to use this module
245
						if(!isset($module_type)) { $module_type = 'unknown'; }
246
						if(!is_numeric(array_search($file, $module_permissions)) AND $module_type == 'page') {
247
							?>
248
							<option value="<?php echo $file; ?>"<?php if($file == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module_name; ?></option>
249
							<?php
250
						}
251
						if(isset($module_type)) { unset($module_type); } // Unset module type
252
			
239
			$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' AND directory != 'menu_link'");
240
			if($result->numRows() > 0) {
241
				while($module = $result->fetchRow()) {
242
					// Check if user is allowed to use this module
243
					if(!is_numeric(array_search($module['directory'], $module_permissions))) {
244
						?>
245
						<option value="<?php echo $module['directory']; ?>"<?php if($module['directory'] == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module['name']; ?></option>
246
						<?php
253 247
					}
254 248
				}
255 249
			}

Also available in: Unified diff