Annotation of /mambo/branches/4.6/administrator/components/com_templates/admin.templates.php
Parent Directory
|
Revision Log
Revision 129 - (view) (download)
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * @version $Id: admin.templates.php,v 1.1 2005/07/22 01:53:31 eddieajau Exp $ | ||
| 4 : | * @package Mambo | ||
| 5 : | * @subpackage Templates | ||
| 6 : | * @copyright (C) 2000 - 2005 Miro International Pty Ltd | ||
| 7 : | * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||
| 8 : | * Mambo is Free Software | ||
| 9 : | */ | ||
| 10 : | |||
| 11 : | /** ensure this file is being included by a parent file */ | ||
| 12 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 13 : | |||
| 14 : | // ensure user has access to this function | ||
| 15 : | if (!$acl->acl_check( 'administration', 'manage', 'users', $GLOBALS['my']->usertype, 'components', 'com_templates' )) { | ||
| 16 : | mosRedirect( 'index2.php', _NOT_AUTH ); | ||
| 17 : | } | ||
| 18 : | |||
| 19 : | require_once( $mainframe->getPath( 'admin_html' ) ); | ||
| 20 : | require_once( $mosConfig_absolute_path .'/administrator/components/com_templates/admin.templates.class.php' ); | ||
| 21 : | // XML library | ||
| 22 : | csouza | 129 | //require_once( $mosConfig_absolute_path .'/includes/domit/xml_domit_lite_include.php' ); |
| 23 : | root | 1 | |
| 24 : | $task = trim( strtolower( mosGetParam( $_REQUEST, "task", "" ) ) ); | ||
| 25 : | $cid = mosGetParam( $_REQUEST, "cid", array(0) ); | ||
| 26 : | $client = mosGetParam( $_REQUEST, 'client', '' ); | ||
| 27 : | |||
| 28 : | if (!is_array( $cid )) { | ||
| 29 : | $cid = array(0); | ||
| 30 : | } | ||
| 31 : | |||
| 32 : | switch ($task) { | ||
| 33 : | case 'new': | ||
| 34 : | mosRedirect ( 'index2.php?option=com_installer&element=template&client='. $client ); | ||
| 35 : | break; | ||
| 36 : | |||
| 37 : | case 'edit_source': | ||
| 38 : | editTemplateSource( $cid[0], $option, $client ); | ||
| 39 : | break; | ||
| 40 : | |||
| 41 : | case 'save_source': | ||
| 42 : | saveTemplateSource( $option, $client ); | ||
| 43 : | break; | ||
| 44 : | |||
| 45 : | case 'edit_css': | ||
| 46 : | editTemplateCSS( $cid[0], $option, $client ); | ||
| 47 : | break; | ||
| 48 : | |||
| 49 : | case 'save_css': | ||
| 50 : | saveTemplateCSS( $option, $client ); | ||
| 51 : | break; | ||
| 52 : | |||
| 53 : | case 'remove': | ||
| 54 : | removeTemplate( $cid[0], $option, $client ); | ||
| 55 : | break; | ||
| 56 : | |||
| 57 : | case 'publish': | ||
| 58 : | defaultTemplate( $cid[0], $option, $client ); | ||
| 59 : | break; | ||
| 60 : | |||
| 61 : | case 'default': | ||
| 62 : | defaultTemplate( $cid[0], $option, $client ); | ||
| 63 : | break; | ||
| 64 : | |||
| 65 : | case 'assign': | ||
| 66 : | assignTemplate( $cid[0], $option, $client ); | ||
| 67 : | break; | ||
| 68 : | |||
| 69 : | case 'save_assign': | ||
| 70 : | saveTemplateAssign( $option, $client ); | ||
| 71 : | break; | ||
| 72 : | |||
| 73 : | case 'cancel': | ||
| 74 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client ); | ||
| 75 : | break; | ||
| 76 : | |||
| 77 : | case 'positions': | ||
| 78 : | editPositions( $option ); | ||
| 79 : | break; | ||
| 80 : | |||
| 81 : | case 'save_positions': | ||
| 82 : | savePositions( $option ); | ||
| 83 : | break; | ||
| 84 : | |||
| 85 : | default: | ||
| 86 : | viewTemplates( $option, $client ); | ||
| 87 : | break; | ||
| 88 : | } | ||
| 89 : | |||
| 90 : | |||
| 91 : | /** | ||
| 92 : | * Compiles a list of installed, version 4.5+ templates | ||
| 93 : | * | ||
| 94 : | * Based on xml files found. If no xml file found the template | ||
| 95 : | * is ignored | ||
| 96 : | */ | ||
| 97 : | function viewTemplates( $option, $client ) { | ||
| 98 : | global $database, $mainframe; | ||
| 99 : | global $mosConfig_absolute_path, $mosConfig_list_limit; | ||
| 100 : | |||
| 101 : | $limit = $mainframe->getUserStateFromRequest( 'viewlistlimit', 'limit', $mosConfig_list_limit ); | ||
| 102 : | $limitstart = $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 ); | ||
| 103 : | |||
| 104 : | if ($client == 'admin') { | ||
| 105 : | $templateBaseDir = mosPathName( $mosConfig_absolute_path . '/administrator/templates' ); | ||
| 106 : | } else { | ||
| 107 : | $templateBaseDir = mosPathName( $mosConfig_absolute_path . '/templates' ); | ||
| 108 : | } | ||
| 109 : | |||
| 110 : | $rows = array(); | ||
| 111 : | // Read the template dir to find templates | ||
| 112 : | $templateDirs = mosReadDirectory($templateBaseDir); | ||
| 113 : | |||
| 114 : | $id = intval( $client == 'admin' ); | ||
| 115 : | |||
| 116 : | if ($client=='admin') { | ||
| 117 : | $database->setQuery( "SELECT template FROM #__templates_menu WHERE client_id='1' AND menuid='0'" ); | ||
| 118 : | } else { | ||
| 119 : | $database->setQuery( "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'" ); | ||
| 120 : | } | ||
| 121 : | $cur_template = $database->loadResult(); | ||
| 122 : | |||
| 123 : | $rowid = 0; | ||
| 124 : | // Check that the directory contains an xml file | ||
| 125 : | foreach($templateDirs as $templateDir) { | ||
| 126 : | $dirName = mosPathName($templateBaseDir . $templateDir); | ||
| 127 : | $xmlFilesInDir = mosReadDirectory($dirName,'.xml$'); | ||
| 128 : | |||
| 129 : | foreach($xmlFilesInDir as $xmlfile) { | ||
| 130 : | // Read the file to see if it's a valid template XML file | ||
| 131 : | csouza | 129 | $parser =& new mosXMLDescription($dirName.$xmlfile); |
| 132 : | if ($parser->getType() != 'template') continue; | ||
| 133 : | /* | ||
| 134 : | root | 1 | $xmlDoc =& new DOMIT_Lite_Document(); |
| 135 : | $xmlDoc->resolveErrors( true ); | ||
| 136 : | if (!$xmlDoc->loadXML( $dirName . $xmlfile, false, true )) { | ||
| 137 : | continue; | ||
| 138 : | } | ||
| 139 : | |||
| 140 : | $element = &$xmlDoc->documentElement; | ||
| 141 : | |||
| 142 : | if ($element->getTagName() != 'mosinstall') { | ||
| 143 : | continue; | ||
| 144 : | } | ||
| 145 : | if ($element->getAttribute( 'type' ) != 'template') { | ||
| 146 : | continue; | ||
| 147 : | } | ||
| 148 : | csouza | 129 | */ |
| 149 : | root | 1 | $row = new StdClass(); |
| 150 : | $row->id = $rowid; | ||
| 151 : | $row->directory = $templateDir; | ||
| 152 : | csouza | 129 | |
| 153 : | $row->creationdate = $parser->getCreationDate('template'); | ||
| 154 : | $row->name = $parser->getName('template'); | ||
| 155 : | $row->author = $parser->getAuthor('template'); | ||
| 156 : | $row->copyright = $parser->getCopyright('template'); | ||
| 157 : | $row->authorEmail = $parser->getAuthorEmail('template'); | ||
| 158 : | $row->authorUrl = $parser->getAuthorUrl('template'); | ||
| 159 : | $row->version = $parser->getVersion('template'); | ||
| 160 : | /* | ||
| 161 : | root | 1 | $element = &$xmlDoc->getElementsByPath('name', 1 ); |
| 162 : | $row->name = $element->getText(); | ||
| 163 : | |||
| 164 : | $element = &$xmlDoc->getElementsByPath('creationDate', 1); | ||
| 165 : | $row->creationdate = $element ? $element->getText() : 'Unknown'; | ||
| 166 : | |||
| 167 : | $element = &$xmlDoc->getElementsByPath('author', 1); | ||
| 168 : | $row->author = $element ? $element->getText() : 'Unknown'; | ||
| 169 : | |||
| 170 : | $element = &$xmlDoc->getElementsByPath('copyright', 1); | ||
| 171 : | $row->copyright = $element ? $element->getText() : ''; | ||
| 172 : | |||
| 173 : | $element = &$xmlDoc->getElementsByPath('authorEmail', 1); | ||
| 174 : | $row->authorEmail = $element ? $element->getText() : ''; | ||
| 175 : | |||
| 176 : | $element = &$xmlDoc->getElementsByPath('authorUrl', 1); | ||
| 177 : | $row->authorUrl = $element ? $element->getText() : ''; | ||
| 178 : | |||
| 179 : | $element = &$xmlDoc->getElementsByPath('version', 1); | ||
| 180 : | $row->version = $element ? $element->getText() : ''; | ||
| 181 : | csouza | 129 | */ |
| 182 : | root | 1 | // Get info from db |
| 183 : | if ($cur_template == $templateDir) { | ||
| 184 : | $row->published = 1; | ||
| 185 : | } else { | ||
| 186 : | $row->published = 0; | ||
| 187 : | } | ||
| 188 : | |||
| 189 : | $row->checked_out = 0; | ||
| 190 : | $row->mosname = strtolower( str_replace( ' ', '_', $row->name ) ); | ||
| 191 : | |||
| 192 : | // check if template is assigned | ||
| 193 : | $database->setQuery( "SELECT count(*) FROM #__templates_menu WHERE client_id='0' AND template='$row->directory' AND menuid<>'0'" ); | ||
| 194 : | $row->assigned = $database->loadResult() ? 1 : 0; | ||
| 195 : | |||
| 196 : | $rows[] = $row; | ||
| 197 : | $rowid++; | ||
| 198 : | } | ||
| 199 : | } | ||
| 200 : | |||
| 201 : | require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' ); | ||
| 202 : | $pageNav = new mosPageNav( count( $rows ), $limitstart, $limit ); | ||
| 203 : | |||
| 204 : | $rows = array_slice( $rows, $pageNav->limitstart, $pageNav->limit ); | ||
| 205 : | |||
| 206 : | HTML_templates::showTemplates( $rows, $pageNav, $option, $client ); | ||
| 207 : | } | ||
| 208 : | |||
| 209 : | |||
| 210 : | /** | ||
| 211 : | * Publish, or make current, the selected template | ||
| 212 : | */ | ||
| 213 : | function defaultTemplate( $p_tname, $option, $client ) { | ||
| 214 : | global $database; | ||
| 215 : | |||
| 216 : | if ($client=='admin') { | ||
| 217 : | $database->setQuery("DELETE FROM #__templates_menu WHERE client_id='1' AND menuid='0'"); | ||
| 218 : | $database->query(); | ||
| 219 : | |||
| 220 : | $database->setQuery("INSERT INTO #__templates_menu SET client_id='1', template='$p_tname', menuid='0'"); | ||
| 221 : | $database->query(); | ||
| 222 : | } else { | ||
| 223 : | $database->setQuery("DELETE FROM #__templates_menu WHERE client_id='0' AND menuid='0'"); | ||
| 224 : | $database->query(); | ||
| 225 : | |||
| 226 : | $database->setQuery("INSERT INTO #__templates_menu SET client_id='0', template='$p_tname', menuid='0'"); | ||
| 227 : | $database->query(); | ||
| 228 : | |||
| 229 : | $_SESSION['cur_template'] = $p_tname; | ||
| 230 : | } | ||
| 231 : | |||
| 232 : | mosRedirect('index2.php?option='. $option .'&client='. $client); | ||
| 233 : | } | ||
| 234 : | |||
| 235 : | /** | ||
| 236 : | * Remove the selected template | ||
| 237 : | */ | ||
| 238 : | function removeTemplate( $cid, $option, $client ) { | ||
| 239 : | global $database; | ||
| 240 : | |||
| 241 : | $client_id = $client=='admin' ? 1 : 0; | ||
| 242 : | |||
| 243 : | $database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='$client_id' AND menuid='0'"); | ||
| 244 : | $cur_template = $database->loadResult(); | ||
| 245 : | |||
| 246 : | if ($cur_template == $cid) { | ||
| 247 : | echo "<script>alert(\"You can not delete template in use.\"); window.history.go(-1); </script>\n"; | ||
| 248 : | exit(); | ||
| 249 : | } | ||
| 250 : | |||
| 251 : | // Un-assign | ||
| 252 : | |||
| 253 : | $database->setQuery( "DELETE FROM #__templates_menu WHERE template='$cid' AND client_id='$client_id' AND menuid<>'0'" ); | ||
| 254 : | $database->query(); | ||
| 255 : | |||
| 256 : | mosRedirect( 'index2.php?option=com_installer&element=template&client='. $client .'&task=remove&cid[]='. $cid ); | ||
| 257 : | } | ||
| 258 : | |||
| 259 : | function editTemplateSource( $p_tname, $option, $client ) { | ||
| 260 : | global $mosConfig_absolute_path; | ||
| 261 : | |||
| 262 : | if ( $client == 'admin' ) { | ||
| 263 : | $file = $mosConfig_absolute_path .'/administrator/templates/'. $p_tname .'/index.php'; | ||
| 264 : | } else { | ||
| 265 : | $file = $mosConfig_absolute_path .'/templates/'. $p_tname .'/index.php'; | ||
| 266 : | } | ||
| 267 : | |||
| 268 : | if ( $fp = fopen( $file, 'r' ) ) { | ||
| 269 : | $content = fread( $fp, filesize( $file ) ); | ||
| 270 : | $content = htmlspecialchars( $content ); | ||
| 271 : | |||
| 272 : | HTML_templates::editTemplateSource( $p_tname, $content, $option, $client ); | ||
| 273 : | } else { | ||
| 274 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation Failed: Could not open'. $file ); | ||
| 275 : | } | ||
| 276 : | } | ||
| 277 : | |||
| 278 : | |||
| 279 : | function saveTemplateSource( $option, $client ) { | ||
| 280 : | global $mosConfig_absolute_path; | ||
| 281 : | |||
| 282 : | $template = mosGetParam( $_POST, 'template', '' ); | ||
| 283 : | $filecontent = mosGetParam( $_POST, 'filecontent', '', _MOS_ALLOWHTML ); | ||
| 284 : | |||
| 285 : | if ( !$template ) { | ||
| 286 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: No template specified.' ); | ||
| 287 : | } | ||
| 288 : | if ( !$filecontent ) { | ||
| 289 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: Content empty.' ); | ||
| 290 : | } | ||
| 291 : | |||
| 292 : | if ( $client == 'admin' ) { | ||
| 293 : | $file = $mosConfig_absolute_path .'/administrator/templates/'. $template .'/index.php'; | ||
| 294 : | } else { | ||
| 295 : | $file = $mosConfig_absolute_path .'/templates/'. $template .'/index.php'; | ||
| 296 : | } | ||
| 297 : | |||
| 298 : | $enable_write = mosGetParam($_POST,'enable_write',0); | ||
| 299 : | $oldperms = fileperms($file); | ||
| 300 : | if ($enable_write) @chmod($file, $oldperms | 0222); | ||
| 301 : | |||
| 302 : | clearstatcache(); | ||
| 303 : | if ( is_writable( $file ) == false ) { | ||
| 304 : | mosRedirect( 'index2.php?option='. $option , 'Operation failed: '. $file .' is not writable.' ); | ||
| 305 : | } | ||
| 306 : | |||
| 307 : | if ( $fp = fopen ($file, 'w' ) ) { | ||
| 308 : | fputs( $fp, stripslashes( $filecontent ), strlen( $filecontent ) ); | ||
| 309 : | fclose( $fp ); | ||
| 310 : | if ($enable_write) { | ||
| 311 : | @chmod($file, $oldperms); | ||
| 312 : | } else { | ||
| 313 : | if (mosGetParam($_POST,'disable_write',0)) | ||
| 314 : | @chmod($file, $oldperms & 0777555); | ||
| 315 : | } // if | ||
| 316 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client ); | ||
| 317 : | } else { | ||
| 318 : | if ($enable_write) @chmod($file, $oldperms); | ||
| 319 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: Failed to open file for writing.' ); | ||
| 320 : | } | ||
| 321 : | |||
| 322 : | } | ||
| 323 : | |||
| 324 : | function editTemplateCSS( $p_tname, $option, $client ) { | ||
| 325 : | global $mosConfig_absolute_path; | ||
| 326 : | |||
| 327 : | if ( $client == 'admin' ) { | ||
| 328 : | $file = $mosConfig_absolute_path .'/administrator/templates/'. $p_tname .'/css/template_css.css'; | ||
| 329 : | } else { | ||
| 330 : | $file = $mosConfig_absolute_path .'/templates/'. $p_tname .'/css/template_css.css'; | ||
| 331 : | } | ||
| 332 : | |||
| 333 : | if ($fp = fopen( $file, 'r' )) { | ||
| 334 : | $content = fread( $fp, filesize( $file ) ); | ||
| 335 : | $content = htmlspecialchars( $content ); | ||
| 336 : | |||
| 337 : | HTML_templates::editCSSSource( $p_tname, $content, $option, $client ); | ||
| 338 : | } else { | ||
| 339 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation Failed: Could not open'. $file ); | ||
| 340 : | } | ||
| 341 : | } | ||
| 342 : | |||
| 343 : | |||
| 344 : | function saveTemplateCSS( $option, $client ) { | ||
| 345 : | global $mosConfig_absolute_path; | ||
| 346 : | $template = trim( mosGetParam( $_POST, 'template', '' ) ); | ||
| 347 : | $filecontent = mosGetParam( $_POST, 'filecontent', '', _MOS_ALLOWHTML ); | ||
| 348 : | |||
| 349 : | if ( !$template ) { | ||
| 350 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: No template specified.' ); | ||
| 351 : | } | ||
| 352 : | |||
| 353 : | if ( !$filecontent ) { | ||
| 354 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: Content empty.' ); | ||
| 355 : | } | ||
| 356 : | |||
| 357 : | if ( $client == 'admin' ) { | ||
| 358 : | $file = $mosConfig_absolute_path .'/administrator/templates/'. $template .'/css/template_css.css'; | ||
| 359 : | } else { | ||
| 360 : | $file = $mosConfig_absolute_path .'/templates/'. $template .'/css/template_css.css'; | ||
| 361 : | } | ||
| 362 : | |||
| 363 : | $enable_write = mosGetParam($_POST,'enable_write',0); | ||
| 364 : | $oldperms = fileperms($file); | ||
| 365 : | if ($enable_write) @chmod($file, $oldperms | 0222); | ||
| 366 : | |||
| 367 : | clearstatcache(); | ||
| 368 : | if ( is_writable( $file ) == false ) { | ||
| 369 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: The file is not writable.' ); | ||
| 370 : | } | ||
| 371 : | |||
| 372 : | if ($fp = fopen ($file, 'w')) { | ||
| 373 : | fputs( $fp, stripslashes( $filecontent ) ); | ||
| 374 : | fclose( $fp ); | ||
| 375 : | if ($enable_write) { | ||
| 376 : | @chmod($file, $oldperms); | ||
| 377 : | } else { | ||
| 378 : | if (mosGetParam($_POST,'disable_write',0)) | ||
| 379 : | @chmod($file, $oldperms & 0777555); | ||
| 380 : | } // if | ||
| 381 : | mosRedirect( 'index2.php?option='. $option ); | ||
| 382 : | } else { | ||
| 383 : | if ($enable_write) @chmod($file, $oldperms); | ||
| 384 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client, 'Operation failed: Failed to open file for writing.' ); | ||
| 385 : | } | ||
| 386 : | |||
| 387 : | } | ||
| 388 : | |||
| 389 : | |||
| 390 : | function assignTemplate( $p_tname, $option, $client ) { | ||
| 391 : | global $database; | ||
| 392 : | |||
| 393 : | // get selected pages for $menulist | ||
| 394 : | if ( $p_tname ) { | ||
| 395 : | $database->setQuery( "SELECT menuid AS value FROM #__templates_menu WHERE client_id='0' AND template='$p_tname'" ); | ||
| 396 : | $lookup = $database->loadObjectList(); | ||
| 397 : | } | ||
| 398 : | |||
| 399 : | // build the html select list | ||
| 400 : | $menulist = mosAdminMenus::MenuLinks( $lookup, 0, 1 ); | ||
| 401 : | |||
| 402 : | HTML_templates::assignTemplate( $p_tname, $menulist, $option, $client ); | ||
| 403 : | } | ||
| 404 : | |||
| 405 : | |||
| 406 : | function saveTemplateAssign( $option, $client ) { | ||
| 407 : | global $database; | ||
| 408 : | |||
| 409 : | $menus = mosGetParam( $_POST, 'selections', array() ); | ||
| 410 : | $template = mosGetParam( $_POST, 'template', '' ); | ||
| 411 : | |||
| 412 : | $database->setQuery( "DELETE FROM #__templates_menu WHERE client_id='0' AND template='$template' AND menuid<>'0'" ); | ||
| 413 : | $database->query(); | ||
| 414 : | |||
| 415 : | if ( !in_array( '', $menus ) ) { | ||
| 416 : | foreach ( $menus as $menuid ){ | ||
| 417 : | // If 'None' is not in array | ||
| 418 : | if ( $menuid <> -999 ) { | ||
| 419 : | // check if there is already a template assigned to this menu item | ||
| 420 : | $database->setQuery( "DELETE FROM #__templates_menu WHERE client_id='0' AND menuid='$menuid'" ); | ||
| 421 : | $database->query(); | ||
| 422 : | $database->setQuery( "INSERT INTO #__templates_menu SET client_id='0', template='$template', menuid='$menuid'" ); | ||
| 423 : | $database->query(); | ||
| 424 : | } | ||
| 425 : | } | ||
| 426 : | } | ||
| 427 : | |||
| 428 : | mosRedirect( 'index2.php?option='. $option .'&client='. $client ); | ||
| 429 : | } | ||
| 430 : | |||
| 431 : | |||
| 432 : | /** | ||
| 433 : | */ | ||
| 434 : | function editPositions( $option ) { | ||
| 435 : | global $database; | ||
| 436 : | |||
| 437 : | $database->setQuery( "SELECT * FROM #__template_positions" ); | ||
| 438 : | $positions = $database->loadObjectList(); | ||
| 439 : | |||
| 440 : | HTML_templates::editPositions( $positions, $option ); | ||
| 441 : | } | ||
| 442 : | |||
| 443 : | /** | ||
| 444 : | */ | ||
| 445 : | function savePositions( $option ) { | ||
| 446 : | global $database; | ||
| 447 : | |||
| 448 : | $positions = mosGetParam( $_POST, 'position', array() ); | ||
| 449 : | $descriptions = mosGetParam( $_POST, 'description', array() ); | ||
| 450 : | |||
| 451 : | $query = 'DELETE FROM #__template_positions'; | ||
| 452 : | $database->setQuery( $query ); | ||
| 453 : | $database->query(); | ||
| 454 : | |||
| 455 : | foreach ($positions as $id=>$position) { | ||
| 456 : | $position = trim( $database->getEscaped( $position ) ); | ||
| 457 : | $description = mosGetParam( $descriptions, $id, '' ); | ||
| 458 : | if ($position != '') { | ||
| 459 : | $id = intval( $id ); | ||
| 460 : | $query = "INSERT INTO #__template_positions" | ||
| 461 : | . "\nVALUES ($id,'$position','$description')"; | ||
| 462 : | $database->setQuery( $query ); | ||
| 463 : | $database->query(); | ||
| 464 : | } | ||
| 465 : | } | ||
| 466 : | mosRedirect( 'index2.php?option='. $option .'&task=positions', 'Positions saved' ); | ||
| 467 : | } | ||
| 468 : | csouza | 129 | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

