| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
|
* @version $Id: admin.php,v 1.1 2005/07/22 01:53:54 eddieajau Exp $ |
|
| 3 |
* @package Mambo |
* @package Mambo |
| 4 |
* @copyright (C) 2000 - 2005 Miro International Pty Ltd |
* @copyright Refer to copyright.php |
| 5 |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
| 6 |
* Mambo is Free Software |
* @author Mambo Foundation Inc see README.php |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
/** ensure this file is being included by a parent file */ |
/** ensure this file is being included by a parent file */ |
| 14 |
***/ |
***/ |
| 15 |
|
|
| 16 |
class mosBasicXML { |
class mosBasicXML { |
| 17 |
|
var $xmlfile = ''; |
| 18 |
var $opentags = array(); |
var $opentags = array(); |
|
var $opencount; |
|
| 19 |
var $accept = array(); |
var $accept = array(); |
| 20 |
var $mosinstall = false; |
var $mosinstall = false; |
| 21 |
|
var $chardata = ''; |
| 22 |
var $type; |
var $type; |
| 23 |
var $terminalError = false; |
var $errors = ''; |
|
var $errors = array(); |
|
| 24 |
var $mosParameter = null; |
var $mosParameter = null; |
| 25 |
var $name = ''; |
var $name = ''; |
| 26 |
|
|
| 27 |
function mosBasicXML ($file, $mosParameter=null, $name='params') { |
function mosBasicXML ($file, $mosParameter=null, $name='params') { |
| 28 |
|
$this->xmlfile = $file; |
| 29 |
$this->modParameter = $mosParameter; |
$this->mosParameter = $mosParameter; |
| 30 |
$this->name = $name; |
$this->name = $name; |
| 31 |
|
$this->errors = new mosErrorSet(); |
| 32 |
$this->setTree(); |
$this->setTree(); |
| 33 |
$parser = xml_parser_create(); |
$parser = xml_parser_create(); |
| 34 |
xml_set_element_handler ($parser, array ($this, 'start_element'), array ($this, 'end_element')); |
$startfunc = array (&$this, 'start_element'); |
| 35 |
xml_set_character_data_handler ($parser, array ($this, 'character_data')); |
$endfunc = array (&$this, 'end_element'); |
| 36 |
|
$charfunc = array (&$this, 'character_data'); |
| 37 |
$fp = fopen($file, 'rb'); |
xml_set_element_handler ($parser, $startfunc, $endfunc); |
| 38 |
while ($data = fread($fp, 4096) AND !$this->terminalError) { |
xml_set_character_data_handler ($parser, $charfunc); |
| 39 |
|
if ($fp = fopen($this->xmlfile, 'rb')) { |
| 40 |
|
while ($data = fread($fp, 4096) AND $this->errors->getMaxLevel() < _MOS_ERROR_FATAL) { |
| 41 |
$data = str_replace('&', ' ampersand ', $data); |
$data = str_replace('&', ' ampersand ', $data); |
| 42 |
$ret = xml_parse($parser, $data, feof($fp)) or die (sprintf('XML ERROR: %s at line %d', |
$ret = xml_parse($parser, $data, feof($fp)) or $this->errors->addErrorDetails(sprintf(T_('XML ERROR in %s: %s at line %d'), |
| 43 |
|
$this->xmlfile, |
| 44 |
xml_error_string(xml_get_error_code($parser)), |
xml_error_string(xml_get_error_code($parser)), |
| 45 |
xml_get_current_line_number($parser))); |
xml_get_current_line_number($parser)), _MOS_ERROR_FATAL); |
| 46 |
|
} |
| 47 |
} |
} |
| 48 |
|
else $this->errors->addErrorDetails(sprintf(T_('Unable to open XML file %s'),$this->xmlfile), _MOS_ERROR_FATAL); |
| 49 |
if (count($this->opentags) != 0) { |
if (count($this->opentags) != 0) { |
| 50 |
$tags = implode (', ', $this->opentags); |
$tags = implode (', ', $this->opentags); |
| 51 |
trigger_error ("XML error - unclosed tag(s) ($tags) at end of file"); |
$this->errors->addErrorDetails(sprintf(T_('XML error in %s - unclosed tag(s) (%s) at end of file'),$this->xmlfile, $tags), _MOS_ERROR_SEVERE); |
| 52 |
} |
} |
| 53 |
xml_parser_free($parser); |
xml_parser_free($parser); |
|
if (count($this->errors)) var_dump ($this->errors); |
|
| 54 |
} |
} |
| 55 |
|
|
| 56 |
function setTree () { |
function setTree () { |
| 57 |
$this->accept['MOSINSTALL'] = array ('NAME', 'CREATIONDATE', 'AUTHOR', 'COPYRIGHT', |
$this->accept['MOSINSTALL'] = array ('NAME', 'CREATIONDATE', 'AUTHOR', 'COPYRIGHT', |
| 58 |
'LICENSE', 'AUTHOREMAIL', 'AUTHORURL', 'VERSION', 'DESCRIPTION', 'FILES', 'GROUP', |
'LICENSE', 'AUTHOREMAIL', 'AUTHORURL', 'VERSION', 'DESCRIPTION', 'FILES', 'MEDIA', |
| 59 |
'PARAMS', 'INSTALL', 'UNINSTALL', 'INSTALLFILE', 'UNINSTALLFILE', 'ADMINISTRATION', |
'PARAMS', 'INSTALL', 'UNINSTALL', 'INSTALLFILE', 'UNINSTALLFILE', 'ADMINISTRATION', |
| 60 |
'IMAGES', 'CSS'); |
'IMAGES', 'CSS', 'GROUP', 'LOCALE', 'REMOVE_FILES'); |
| 61 |
$this->accept['PARAMS'] = array ('PARAM'); |
$this->accept['PARAMS'] = array ('PARAM'); |
| 62 |
$this->accept['PARAM'] = array ('OPTION'); |
$this->accept['PARAM'] = array ('OPTION'); |
| 63 |
$this->accept['FILES'] = array ('FILENAME'); |
$this->accept['FILES'] = array ('FILENAME'); |
| 64 |
|
$this->accept['REMOVE_FILES'] = array ('FILENAME'); |
| 65 |
$this->accept['INSTALL'] = array ('QUERIES'); |
$this->accept['INSTALL'] = array ('QUERIES'); |
| 66 |
$this->accept['UNINSTALL'] = array ('QUERIES'); |
$this->accept['UNINSTALL'] = array ('QUERIES'); |
| 67 |
$this->accept['QUERIES'] = array ('QUERY'); |
$this->accept['QUERIES'] = array ('QUERY'); |
| 68 |
$this->accept['ADMINISTRATION'] = array ('FILES', 'IMAGES', 'MENU'); |
$this->accept['ADMINISTRATION'] = array ('FILES', 'IMAGES', 'MENU', 'SUBMENU'); |
| 69 |
$this->accept['IMAGES'] = array ('FILENAME'); |
$this->accept['IMAGES'] = array ('FILENAME'); |
|
$this->accept['MENU'] = array ('SUBMENU'); |
|
| 70 |
$this->accept['SUBMENU'] = array('MENU'); |
$this->accept['SUBMENU'] = array('MENU'); |
| 71 |
|
$this->accept['MEDIA'] = array('FILENAME'); |
| 72 |
$this->accept['CSS'] = array('FILENAME'); |
$this->accept['CSS'] = array('FILENAME'); |
| 73 |
|
$this->accept['LOCALE'] = array('PLURAL_FORM', 'DATE_FORMAT', 'CODESETS', 'DAYS', 'MONTHS', 'WINCODEPAGE'); |
| 74 |
|
$this->accept['CODESETS'] = array('CHARSET'); |
| 75 |
} |
} |
| 76 |
|
|
| 77 |
function start_element ($parser, $element_name, $element_attrs) { |
function start_element ($parser, $element_name, $element_attrs) { |
| 78 |
if ($this->terminalError) return; |
if ($this->errors->getMaxLevel() >= _MOS_ERROR_FATAL) return; |
|
$method = 'element_'.$element_name; |
|
|
|
|
|
$specific = array ($this, $method); |
|
|
if (is_callable($specific)) $this->$method($element_attrs); |
|
| 79 |
if ($this->mosinstall) { |
if ($this->mosinstall) { |
| 80 |
$container = $this->opentags[0]; |
$container = $this->opentags[0]; |
| 81 |
if (!isset($this->accept[$container]) OR !is_array($this->accept[$container])) trigger_error ("XML error $container is not a valid containing element"); |
if (!isset($this->accept[$container]) OR !is_array($this->accept[$container])) $this->errors->addErrorDetails(sprintf(T_('XML error in %s: %s is not a valid containing element'), $this->xmlfile, $container), _MOS_ERROR_WARN); |
| 82 |
if (!in_array($element_name, $this->accept[$container])) trigger_error ("XML error $element_name not permitted within $container"); |
elseif (!in_array($element_name, $this->accept[$container])) $this->errors->addErrorDetails(sprintf(T_('XML error in %s: %s not permitted within %s'), $this->xmlfile, $element_name, $container), _MOS_ERROR_WARN); |
| 83 |
} |
} |
| 84 |
if ($this->mosinstall OR $element_name == 'MOSINSTALL') { |
if ($this->mosinstall OR $element_name == 'MOSINSTALL') { |
| 85 |
$this->opencount = array_unshift ($this->opentags, $element_name); |
$this->opencount = array_unshift ($this->opentags, $element_name); |
|
dump($this->opentags); |
|
|
$setdata = array ($this, 'set_data'); |
|
|
if (is_callable($setdata)) $this->set_data($element_attrs); |
|
| 86 |
$this->mosinstall = true; |
$this->mosinstall = true; |
| 87 |
|
$method = 'element_'.$element_name; |
| 88 |
|
$specific = array (&$this, $method); |
| 89 |
|
foreach ($element_attrs as $key=>$attr) $element_attrs[$key] = str_replace(' ampersand ', '&', $attr); |
| 90 |
|
if (is_callable($specific)) $this->$method($element_attrs); |
| 91 |
} |
} |
| 92 |
else trigger_error ("XML expected MOSINSTALL but found $element_name"); |
else $this->errors->addErrorDetails(sprintf(T_('XML error in %s: expected MOSINSTALL but found %s'), $this->xmlfile, $element_name), _MOS_ERROR_SEVERE); |
|
// echo '<br />Start of '.$element_name; |
|
| 93 |
} |
} |
| 94 |
|
|
| 95 |
function end_element ($parser, $element_name) { |
function end_element ($parser, $element_name) { |
| 96 |
if ($this->terminalError) return; |
if ($this->errors->getMaxLevel() >= _MOS_ERROR_FATAL) return; |
| 97 |
$check = array_shift ($this->opentags); |
if ($this->opentags[0] != $element_name) { |
| 98 |
dump($this); |
$this->errors->addErrorDetails(sprintf(T_('XML error in %s: last open tag was %s, but found end of %s'), $this->xmlfile, $check, $element_name), _MOS_ERROR_SEVERE); |
| 99 |
if ($check != $element_name) { |
return; |
|
$this->opencount = array_unshift ($this->opentags, $check); |
|
|
trigger_error("XML last open tag was $check, but found end of $element_name"); |
|
| 100 |
} |
} |
| 101 |
else $this->opencount--; |
$this->chardata = str_replace(' ampersand ', '&', $this->chardata); |
| 102 |
|
if (isset($this->opentags[1]) AND $this->opentags[1] == 'MOSINSTALL') $this->values[$this->opentags[0]] = $this->chardata; |
| 103 |
$method = 'end_element_'.$element_name; |
$method = 'end_element_'.$element_name; |
| 104 |
$specific = array ($this, $method); |
$specific = array (&$this, $method); |
| 105 |
if (is_callable($specific)) $this->$method(); |
if (is_callable($specific)) $this->$method(); |
| 106 |
// echo '<br />End of '.$element_name; |
array_shift ($this->opentags); |
| 107 |
|
$this->opencount--; |
| 108 |
|
$this->chardata = ''; |
| 109 |
} |
} |
| 110 |
|
|
| 111 |
function character_data ($parser, $data) { |
function character_data ($parser, $data) { |
| 112 |
// Should be overridden by inheriting class |
if ($this->errors->getMaxLevel() >= _MOS_ERROR_FATAL) return; |
| 113 |
$this->errors[] = 'XML handler error - no method provided to deal with character data'; |
$this->chardata .= trim($data); |
|
$this->terminalError = true; |
|
| 114 |
} |
} |
| 115 |
|
|
| 116 |
function element_mosinstall ($attrs) { |
function element_mosinstall ($attrs) { |
| 117 |
if (isset($attrs['TYPE'])) $this->type = $attrs['TYPE']; |
if (isset($attrs['TYPE'])) $this->type = $attrs['TYPE']; |
| 118 |
else trigger_error ("XML error - mosinstall does not have type attribute"); |
else $this->errors->addErrorDetails(sprintf(T_('XML error in %s: mosinstall does not have type attribute'), $this->xmlfile), _MOS_ERROR_FATAL); |
| 119 |
} |
} |
| 120 |
|
|
| 121 |
function getType () { |
function getType () { |
| 122 |
return $this->type; |
return $this->type; |
| 123 |
} |
} |
| 124 |
|
|
| 125 |
|
function &getErrors () { |
| 126 |
|
$errors =& $this->errors->getErrors(); |
| 127 |
|
return $errors; |
| 128 |
|
} |
| 129 |
|
|
| 130 |
} |
} |
| 131 |
|
|
| 132 |
/** |
/** |
| 136 |
class mosXMLDescription extends mosBasicXML { |
class mosXMLDescription extends mosBasicXML { |
| 137 |
var $values = array(); |
var $values = array(); |
| 138 |
|
|
|
function character_data ($parser, $data) { |
|
|
if ($this->terminalError) return; |
|
|
$this->topLevelCharacterData($data); |
|
|
} |
|
|
|
|
|
function topLevelCharacterData ($data) { |
|
|
if ($data = trim($data)) { |
|
|
if (isset($this->opentags[1]) AND $this->opentags[1] == 'MOSINSTALL') $this->values[$this->opentags[0]] = $data; |
|
|
} |
|
|
} |
|
|
|
|
| 139 |
function getDescription ($type) { |
function getDescription ($type) { |
| 140 |
if ($type == $this->type AND isset($this->values['DESCRIPTION'])) return $this->values['DESCRIPTION']; |
if ($type == $this->type AND isset($this->values['DESCRIPTION'])) return $this->values['DESCRIPTION']; |
| 141 |
else return ''; |
else return ''; |
| 186 |
class mosXMLParams extends mosXMLDescription { |
class mosXMLParams extends mosXMLDescription { |
| 187 |
var $options = array(); |
var $options = array(); |
| 188 |
var $optvalue = ''; |
var $optvalue = ''; |
|
var $optdata = ''; |
|
| 189 |
var $paramattrs = array(); |
var $paramattrs = array(); |
| 190 |
var $paramcount = 0; |
var $paramcount = 0; |
| 191 |
var $html = array(); |
var $html = array(); |
| 203 |
} |
} |
| 204 |
|
|
| 205 |
function element_option ($attrs) { |
function element_option ($attrs) { |
| 206 |
if (isset($attrs['VALUE'])) $optvalue = $attrs['VALUE']; |
if (isset($attrs['VALUE'])) $this->optvalue = $attrs['VALUE']; |
|
} |
|
|
|
|
|
function character_data ($parser, $data) { |
|
|
if ($this->terminalError) return; |
|
|
$this->topLevelCharacterData($data); |
|
|
if ($this->opentags[0] == 'OPTION') $this->optdata = $data; |
|
| 207 |
} |
} |
| 208 |
|
|
| 209 |
function end_element_option () { |
function end_element_option () { |
| 210 |
$this->options[] = mosHTML::makeOption($this->optvalue, $this->optdata); |
$this->options[] = mosHTML::makeOption($this->optvalue, T_($this->chardata)); |
|
$this->optdata = ''; |
|
| 211 |
$this->optvalue = ''; |
$this->optvalue = ''; |
| 212 |
} |
} |
| 213 |
|
|
| 214 |
function end_element_param () { |
function end_element_param () { |
| 215 |
$type = mosGetParam ($this->paramattrs, 'TYPE', ''); |
$type = mosGetParam ($this->paramattrs, 'TYPE', ''); |
| 216 |
$name = mosGetParam ($this->paramattrs, 'NAME', ''); |
$name = mosGetParam ($this->paramattrs, 'NAME', ''); |
| 217 |
$label = mosGetParam ($this->paramattrs, 'LABEL', $name); |
$label = T_(mosGetParam ($this->paramattrs, 'LABEL', $name)); |
| 218 |
$default = mosGetParam ($this->paramattrs, 'DEFAULT', ''); |
$default = T_(mosGetParam ($this->paramattrs, 'DEFAULT', '')); |
| 219 |
if ($description = mosGetParam ($this->paramattrs, 'DESCRIPTION', '')) $tooltip = mosToolTip($description, $name); |
if ($description = mosGetParam ($this->paramattrs, 'DESCRIPTION', '')) $tooltip = mosToolTip(T_($description), $name); |
| 220 |
else $tooltip = ''; |
else $tooltip = ''; |
| 221 |
if (is_object($this->mosParameter)) $value = $this->mosParameter->get($name, $default); |
if (is_object($this->mosParameter)) { |
| 222 |
|
$mp = $this->mosParameter; |
| 223 |
|
$value = $mp->get($name, $default); |
| 224 |
|
} |
| 225 |
else $value = $default; |
else $value = $default; |
| 226 |
$this->html[] = '<tr>'; |
$this->html[] = '<tr>'; |
| 227 |
if ($label == '@spacer') $label = '<hr />'; |
if ($label == '@spacer') $label = '<hr />'; |
| 234 |
$controlstring = '<input type="text" name="'.$this->name.'['.$name.']" value="'.$value.'" class="text_area" size="'.$size.'" />'; |
$controlstring = '<input type="text" name="'.$this->name.'['.$name.']" value="'.$value.'" class="text_area" size="'.$size.'" />'; |
| 235 |
break; |
break; |
| 236 |
case 'list': |
case 'list': |
| 237 |
$controlstring = mosHTML::selectList($this->options, "$controlname[$name]", 'class="inputbox"', 'value', 'text', $value); |
$controlstring = mosHTML::selectList($this->options, $controlname.'['.$name.']', 'class="inputbox"', 'value', 'text', $value); |
| 238 |
break; |
break; |
| 239 |
case 'radio': |
case 'radio': |
| 240 |
$controlstring = mosHTML::radioList($this->options, "$controlname[$name]", $value); |
$controlstring = mosHTML::radioList($this->options, $controlname.'['.$name.']', '', $value); |
| 241 |
break; |
break; |
| 242 |
case 'imagelist': |
case 'imagelist': |
| 243 |
$directory = new mosDirectory (mamboCore::get('mosConfig_absolute_path').mosGetParam($this->paramattrs, 'DIRECTORY', '')); |
$directory = new mosDirectory (mamboCore::get('mosConfig_absolute_path').mosGetParam($this->paramattrs, 'DIRECTORY', '')); |
| 246 |
foreach ($files as $file) $options[] = mosHTML::makeOption($file, $file); |
foreach ($files as $file) $options[] = mosHTML::makeOption($file, $file); |
| 247 |
if (!isset($this->paramattrs['HIDE_NONE'])) array_unshift($options, mosHTML::makeOption('-1', '- Do not use an image -' )); |
if (!isset($this->paramattrs['HIDE_NONE'])) array_unshift($options, mosHTML::makeOption('-1', '- Do not use an image -' )); |
| 248 |
if (!isset($this->paramattrs['HIDE_DEFAULT'])) array_unshift($options, mosHTML::makeOption('', '- Use Default image -')); |
if (!isset($this->paramattrs['HIDE_DEFAULT'])) array_unshift($options, mosHTML::makeOption('', '- Use Default image -')); |
| 249 |
$controlstring = mosHTML::selectList ($options, "$controlname[$name]", 'class="inputbox"', 'value', 'text', $value); |
$controlstring = mosHTML::selectList ($options, $controlname.'['.$name.']', 'class="inputbox"', 'value', 'text', $value); |
| 250 |
break; |
break; |
| 251 |
case 'textarea': |
case 'textarea': |
| 252 |
$rows = mosGetParam ($this->paramattrs, 'ROWS', 0); |
$rows = mosGetParam ($this->paramattrs, 'ROWS', 0); |
| 253 |
$cols = mosGetParam ($this->paramattrs, 'COLS', 0); |
$cols = mosGetParam ($this->paramattrs, 'COLS', 0); |
| 254 |
$value = str_replace ('<br /', "\n", $value); |
$value = str_replace ('<br />', "\n", $value); |
| 255 |
$controlstring = "<textarea name='params[$name]' cols='$cols' rows='$rows' class='text_area'>$value</textarea>"; |
$controlstring = "<textarea name='params[$name]' cols='$cols' rows='$rows' class='text_area'>$value</textarea>"; |
| 256 |
break; |
break; |
| 257 |
case 'spacer': |
case 'spacer': |
| 258 |
$controlstring = $value ? $value : '<hr />'; |
$controlstring = $value ? $value : '<hr />'; |
| 259 |
break; |
break; |
| 260 |
case 'mos_section': |
case 'mos_section': |
| 261 |
$controlstring = _form_mos_section($name, $value, $controlname); |
$controlstring = $this->_form_mos_section($name, $value, $controlname); |
| 262 |
break; |
break; |
| 263 |
case 'mos_category': |
case 'mos_category': |
| 264 |
$controlstring = _form_mos_category($name, $value, $controlname); |
$controlstring = $this->_form_mos_category($name, $value, $controlname); |
| 265 |
break; |
break; |
| 266 |
case 'mos_menu': |
case 'mos_menu': |
| 267 |
|
$controlstring = $this->_form_mos_menu($name, $value, $controlname); |
| 268 |
|
break; |
| 269 |
default: |
default: |
| 270 |
$controlstring = _HANDLER.'='.$type; |
$controlstring = T_('Handler not defined for type').'='.$type; |
| 271 |
} |
} |
| 272 |
// $this->html[] = "<td>$type</td>"; |
// $this->html[] = "<td>$type</td>"; |
| 273 |
$this->html[] = "<td>$controlstring</td>"; |
$this->html[] = "<td>$controlstring</td>"; |
| 280 |
|
|
| 281 |
function end_element_params () { |
function end_element_params () { |
| 282 |
$this->html[] = '</table>'; |
$this->html[] = '</table>'; |
| 283 |
if ($this->paramcount == 0) $this->html[] = '<tr><td colspan="2"><i>'._NO_PARAMS.'</i></td></tr>'; |
if ($this->paramcount == 0) $this->html[] = '<tr><td colspan="2"><i>'.T_('There are no Parameters for this item').'</i></td></tr>'; |
| 284 |
$this->paramcount = 0; |
$this->paramcount = 0; |
| 285 |
} |
} |
| 286 |
/** |
/** |
| 291 |
* @return string The html for the element |
* @return string The html for the element |
| 292 |
*/ |
*/ |
| 293 |
function _form_mos_section( $name, $value, $control_name ) { |
function _form_mos_section( $name, $value, $control_name ) { |
| 294 |
$database = mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 295 |
$query = "SELECT id AS value, title AS text" |
$query = "SELECT id AS value, title AS text" |
| 296 |
. "\n FROM #__sections" |
. "\n FROM #__sections" |
| 297 |
. "\n WHERE published='1' AND scope='content'" |
. "\n WHERE published='1' AND scope='content'" |
| 300 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 301 |
$options = $database->loadObjectList(); |
$options = $database->loadObjectList(); |
| 302 |
array_unshift($options, mosHTML::makeOption( '0', '- Select Content Section -' )); |
array_unshift($options, mosHTML::makeOption( '0', '- Select Content Section -' )); |
| 303 |
return mosHTML::selectList( $options, "$control_name[$name]", 'class="inputbox"', 'value', 'text', $value ); |
return mosHTML::selectList( $options, $control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value ); |
| 304 |
} |
} |
| 305 |
/** |
/** |
| 306 |
* @param string The name of the form element |
* @param string The name of the form element |
| 310 |
* @return string The html for the element |
* @return string The html for the element |
| 311 |
*/ |
*/ |
| 312 |
function _form_mos_category( $name, $value, $control_name ) { |
function _form_mos_category( $name, $value, $control_name ) { |
| 313 |
$database = mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 314 |
$query = "SELECT c.id AS value, CONCAT_WS( '/',s.title, c.title ) AS text" |
$query = "SELECT c.id AS value, CONCAT_WS( '/',s.title, c.title ) AS text" |
| 315 |
. "\n FROM #__categories AS c" |
. "\n FROM #__categories AS c" |
| 316 |
. "\n LEFT JOIN #__sections AS s ON s.id=c.section" |
. "\n LEFT JOIN #__sections AS s ON s.id=c.section" |
| 320 |
$database->setQuery( $query ); |
$database->setQuery( $query ); |
| 321 |
$options = $database->loadObjectList(); |
$options = $database->loadObjectList(); |
| 322 |
array_unshift($options, mosHTML::makeOption('0', '- Select Content Category -')); |
array_unshift($options, mosHTML::makeOption('0', '- Select Content Category -')); |
| 323 |
return mosHTML::selectList( $options, "$control_name[$name]", 'class="inputbox"', 'value', 'text', $value ); |
return mosHTML::selectList( $options, $control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value ); |
| 324 |
} |
} |
| 325 |
/** |
/** |
| 326 |
* @param string The name of the form element |
* @param string The name of the form element |
| 329 |
* @param string The control name |
* @param string The control name |
| 330 |
* @return string The html for the element |
* @return string The html for the element |
| 331 |
*/ |
*/ |
| 332 |
// function _form_mos_menu( $name, $value, &$node, $control_name ) { |
function _form_mos_menu( $name, $value, $control_name ) { |
| 333 |
// global $database; |
$menuTypes = mosAdminMenus::menutypes(); |
| 334 |
// |
foreach($menuTypes as $menutype ) $options[] = mosHTML::makeOption( $menutype, $menutype ); |
| 335 |
// $menuTypes = $mainframe->menutypes(); |
array_unshift( $options, mosHTML::makeOption( '', '- Select Menu -' ) ); |
| 336 |
// |
return mosHTML::selectList( $options, ''. $control_name .'['. $name .']', 'class="inputbox"', 'value', 'text', $value ); |
| 337 |
// foreach($menuTypes as $menutype ) { |
} |
|
// $options[] = mosHTML::makeOption( $menutype, $menutype ); |
|
|
// } |
|
|
// array_unshift( $options, mosHTML::makeOption( '', '- Select Menu -' ) ); |
|
|
// |
|
|
// return mosHTML::selectList( $options, ''. $control_name .'['. $name .']', 'class="inputbox"', 'value', 'text', $value ); |
|
|
// } |
|
| 338 |
} |
} |
| 339 |
|
|
| 340 |
/** |
/** |
| 361 |
$this->_type = $type; |
$this->_type = $type; |
| 362 |
} |
} |
| 363 |
|
|
| 364 |
|
} |
| 365 |
/** |
/** |
| 366 |
* @param string The name of the control, or the default text area if a setup file is not found |
* Generally available parameter object |
| 367 |
* @return string HTML |
* @package Mambo |
| 368 |
*/ |
*/ |
| 369 |
function render( $name='params' ) { |
class mosSpecialAdminParameters extends mosAdminParameters { |
| 370 |
$parser = new mosXMLParams ($this->_path, $this, $name); |
|
| 371 |
if (count($parser->html)) return implode("\n", $parser->html); |
function mosSpecialAdminParameters ($name, $version='') { |
| 372 |
else { |
$database =& mamboDatabase::getInstance(); |
| 373 |
$raw = $this->_raw; |
$sql = "SELECT * FROM #__parameters WHERE param_name='$name'"; |
| 374 |
return "<textarea name='$name' cols='40' rows='10' class='text_area'$raw</textarea>"; |
if ($version) $sql .= " AND param_version='$version'"; |
| 375 |
|
$database->setQuery($sql); |
| 376 |
|
$parameters = $database->loadObjectList(); |
| 377 |
|
if ($parameters) $parameters = $parameters[0]; |
| 378 |
|
parent::mosAdminParameters($parameters->params, mamboCore::get('mosConfig_absolute_path').'/parameters/'.$parameters->param_file); |
| 379 |
} |
} |
| 380 |
} |
} |
| 381 |
|
|
|
} |
|
| 382 |
/** |
/** |
| 383 |
* @param string THe template position |
* Useful HTML class for admin side components |
| 384 |
|
* @package Mambo |
| 385 |
*/ |
*/ |
| 386 |
function mosCountAdminModules( $position='left' ) { |
class basicAdminHTML { |
| 387 |
global $database, $my, $Itemid; |
var $pageNav = ''; |
| 388 |
|
var $option = ''; |
| 389 |
|
var $act = ''; |
| 390 |
|
var $limit = 10; |
| 391 |
|
|
| 392 |
|
function basicAdminHTML (&$controller, $limit) { |
| 393 |
|
$this->act = $controller->admin->act; |
| 394 |
|
$this->limit = $limit; |
| 395 |
|
$this->pageNav = $controller->pageNav; |
| 396 |
|
$this->option = strtolower(mosGetParam($_REQUEST,'option','com_admin')); |
| 397 |
|
} |
| 398 |
|
|
| 399 |
|
function tickBox ($object, $property) { |
| 400 |
|
if (is_object($object) AND $object->$property) $checked = "checked='checked'"; |
| 401 |
|
else $checked = ''; |
| 402 |
|
echo "<td><input type='checkbox' name='$property' value='1' $checked /></td>"; |
| 403 |
|
} |
| 404 |
|
|
| 405 |
|
function yesNoList ($object, $property) { |
| 406 |
|
$yesno[] = mosHTML::makeOption( 0, _NO ); |
| 407 |
|
$yesno[] = mosHTML::makeOption( 1, _YES ); |
| 408 |
|
if ($object) $default = $object->$property; |
| 409 |
|
else $default = 0; |
| 410 |
|
echo '<td valign="top">'; |
| 411 |
|
echo mosHTML::selectList($yesno, $property, 'class="inputbox" size="1"', 'value', 'text', $default);; |
| 412 |
|
echo '</td></tr>'; |
| 413 |
|
} |
| 414 |
|
|
| 415 |
$query = "SELECT COUNT(m.id)" |
function inputTop ($title, $redstar=false, $maxsize=0) { |
| 416 |
. "\nFROM #__modules AS m" |
?> |
| 417 |
. "\nWHERE m.published='1' AND m.position='$position' AND m.client_id='1'"; |
<tr> |
| 418 |
|
<td width="30%" valign="top" align="right"> |
| 419 |
|
<b><?php if ($redstar) echo '<font color="red">*</font>'; echo $title; if ($maxsize) echo "</b> <br /><i>$maxsize</i> "; ?></b> |
| 420 |
|
</td> |
| 421 |
|
<?php |
| 422 |
|
} |
| 423 |
|
|
| 424 |
$database->setQuery( $query ); |
function blankRow () { |
| 425 |
return $database->loadResult(); |
?> |
| 426 |
|
<tr><td> </td></tr> |
| 427 |
|
<?php |
| 428 |
} |
} |
|
/** |
|
|
* Loads admin modules via module position |
|
|
* @param string The position |
|
|
* @param int 0 = no style, 1 = tabbed |
|
|
*/ |
|
|
function mosLoadAdminModules( $position='left', $style=0 ) { |
|
|
global $database, $my, $acl; |
|
| 429 |
|
|
| 430 |
$cache =& mosCache::getCache( 'com_content' ); |
function fileInputBox ($title, $name, $value, $width, $tooltip=null) { |
| 431 |
|
$this->inputTop($title); |
| 432 |
|
?> |
| 433 |
|
<td align="left" valign="top"> |
| 434 |
|
<input class="inputbox" type="text" name="<?php echo $name; ?>" size="<?php echo $width; ?>" value="<?php echo $value; ?>" /> |
| 435 |
|
<?php if ($tooltip) echo tooltip($tooltip); ?> |
| 436 |
|
</td> |
| 437 |
|
</tr> |
| 438 |
|
<?php |
| 439 |
|
} |
| 440 |
|
|
| 441 |
$query = "SELECT id, title, module, position, content, showtitle, params" |
function fileInputArea ($title, $maxsize, $name, $value, $rows, $cols, $editor=false, $tooltip=null) { |
| 442 |
. "\n FROM #__modules AS m" |
$this->inputTop ($title, false, $maxsize); |
| 443 |
. "\n WHERE m.published = '1'" |
echo '<td valign="top">'; |
| 444 |
. "\n AND m.position='$position'" |
if ($editor) { |
| 445 |
. "\n AND (m.client_id = 1)" |
$box = "editorArea( 'description', '$value', '$name', 500, 200, $rows, $cols );"; |
| 446 |
. "\n ORDER BY m.ordering"; |
eval($box); |
| 447 |
|
} |
| 448 |
|
else echo "<textarea class='inputbox' name='$name' rows='$rows' cols='$cols'>$value</textarea>"; |
| 449 |
|
if ($tooltip) echo tooltip($tooltip); |
| 450 |
|
echo '</td></tr>'; |
| 451 |
|
} |
| 452 |
|
|
| 453 |
$database->setQuery( $query ); |
function tickBoxField ($object, $property, $title) { |
| 454 |
$modules = $database->loadObjectList(); |
?> |
| 455 |
if($database->getErrorNum()) { |
<tr> |
| 456 |
echo "MA ".$database->stderr(true); |
<td width="30%" valign="top" align="right"> |
| 457 |
return; |
<b><?php echo $title; ?></b> |
| 458 |
|
</td> |
| 459 |
|
<?php |
| 460 |
|
$this->tickBox($object,$property); |
| 461 |
|
echo '</tr>'; |
| 462 |
} |
} |
|
if (!$modules) $modules = array(); |
|
| 463 |
|
|
| 464 |
switch ($style) { |
function simpleTickBox ($title, $name, $checked=false) { |
| 465 |
case 0: |
$this->inputTop($title); |
| 466 |
default: |
if ($checked) $check = 'checked="checked"'; |
| 467 |
foreach ($modules as $module) { |
else $check = ''; |
| 468 |
$params =& new mosParameters( $module->params ); |
?> |
| 469 |
if ( $module->module == '' ) { |
<td> |
| 470 |
mosLoadCustomModule( $module, $params ); |
<input type="checkbox" name="<?php echo $name; ?>" value="1" <?php echo $check; ?> /> |
| 471 |
} else { |
</td> |
| 472 |
mosLoadAdminModule( substr( $module->module, 4 ), $params ); |
</tr> |
| 473 |
|
<?php |
| 474 |
} |
} |
| 475 |
|
function formStart ($title, $imagepath) { |
| 476 |
|
?> |
| 477 |
|
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> |
| 478 |
|
<script language="Javascript" src="../includes/js/overlib_mini.js"></script> |
| 479 |
|
<form action="index2.php" method="post" name="adminForm"> |
| 480 |
|
<table cellpadding="4" cellspacing="0" border="0" width="100%"> |
| 481 |
|
<tr> |
| 482 |
|
<td width="100%" colspan="4"> |
| 483 |
|
<div class="title"> |
| 484 |
|
<img src="<?php echo $imagepath; ?>" alt="<?php echo $title; ?>" /> |
| 485 |
|
<span class="sectionname"> <?php echo $title; ?></span> |
| 486 |
|
</div> |
| 487 |
|
</td> |
| 488 |
|
</tr> |
| 489 |
|
<?php |
| 490 |
} |
} |
|
break; |
|
| 491 |
|
|
| 492 |
case 1: |
function listHeadingStart ($count) { |
| 493 |
// Tabs |
?> |
| 494 |
$tabs = new mosTabs(1); |
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist"> |
| 495 |
$tabs->startPane( 'modules-' . $position ); |
<tr> |
| 496 |
foreach ($modules as $module) { |
<th width="5" align="left"> |
| 497 |
$params =& new mosParameters( $module->params ); |
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo $count; ?>);" /> |
| 498 |
$editAllComponents = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' ); |
</th> |
| 499 |
// $authoriser = new mosAuthoriser($database); |
<?php |
|
// $editAllComponents = $authoriser->checkPermission('mosUser', $my->id, 'edit', 'editAllComponents', 0); |
|
|
// special handling for components module |
|
|
if ( $module->module != 'mod_components' || ( $module->module == 'mod_components' && $editAllComponents ) ) { |
|
|
$tabs->startTab( $module->title, 'module' . $module->id ); |
|
|
if ( $module->module == '' ) { |
|
|
mosLoadCustomModule( $module, $params ); |
|
|
} else { |
|
|
mosLoadAdminModule( substr( $module->module, 4 ), $params ); |
|
| 500 |
} |
} |
| 501 |
$tabs->endTab(); |
|
| 502 |
|
function headingItem ($width, $title, $colspan=1) { |
| 503 |
|
if ($colspan > 1) $colcode = " colspan=\"$colspan\""; |
| 504 |
|
else $colcode = ''; |
| 505 |
|
echo "<th width=\"$width\" align=\"left\"$colcode>$title</th>"; |
| 506 |
} |
} |
| 507 |
|
|
| 508 |
|
function commonScripts ($edit_fields) { |
| 509 |
|
?> |
| 510 |
|
<script type="text/javascript"> |
| 511 |
|
function submitbutton(pressbutton) { |
| 512 |
|
<?php |
| 513 |
|
if (is_array($edit_fields)) foreach ($edit_fields as $field) getEditorContents( $field, $field ); |
| 514 |
|
else getEditorContents ($edit_fields, $edit_fields); |
| 515 |
|
?> |
| 516 |
|
submitform( pressbutton ); |
| 517 |
|
} |
| 518 |
|
</script> |
| 519 |
|
<?php |
| 520 |
} |
} |
|
$tabs->endPane(); |
|
|
break; |
|
| 521 |
|
|
| 522 |
case 2: |
function listFormEnd ($pagecontrol=true) { |
| 523 |
// Div'd |
if ($pagecontrol) { |
| 524 |
foreach ($modules as $module) { |
?> |
| 525 |
$params =& new mosParameters( $module->params ); |
<tr> |
| 526 |
echo '<div>'; |
<th align="center" colspan="10"> <?php echo $this->pageNav->writePagesLinks(); ?></th> |
| 527 |
if ( $module->module == '' ) { |
</tr> |
| 528 |
mosLoadCustomModule( $module, $params ); |
<tr> |
| 529 |
} else { |
<td align="center" colspan="10"> <?php echo $this->pageNav->writePagesCounter(); ?></td> |
| 530 |
mosLoadAdminModule( substr( $module->module, 4 ), $params ); |
</tr> |
| 531 |
|
<?php |
| 532 |
} |
} |
| 533 |
echo '</div>'; |
?> |
| 534 |
|
<input type="hidden" name="option" value="<?php echo $this->option; ?>" /> |
| 535 |
|
<input type="hidden" name="task" value="" /> |
| 536 |
|
<input type="hidden" name="act" value="<?php echo $this->act; ?>" /> |
| 537 |
|
<input type="hidden" name="boxchecked" value="0" /> |
| 538 |
|
</table> |
| 539 |
|
</form> |
| 540 |
|
<?php |
| 541 |
} |
} |
| 542 |
break; |
|
| 543 |
|
function editFormEnd ($id) { |
| 544 |
|
?> |
| 545 |
|
<input type="hidden" name="cfid" value="<?php echo $id; ?>" /> |
| 546 |
|
<input type="hidden" name="limit" value="<?php echo $this->limit; ?>" /> |
| 547 |
|
<input type="hidden" name="option" value="<?php echo $this->option; ?>" /> |
| 548 |
|
<input type="hidden" name="task" value="" /> |
| 549 |
|
<input type="hidden" name="act" value="<?php echo $this->act; ?>" /> |
| 550 |
|
</table> |
| 551 |
|
</form> |
| 552 |
|
<?php |
| 553 |
|
} |
| 554 |
|
|
| 555 |
|
function multiOptionList ($name, $title, $options, $current, $tooltip=null) { |
| 556 |
|
$alternatives = explode(',',$options); |
| 557 |
|
$already = explode(',', $current); |
| 558 |
|
?> |
| 559 |
|
<tr> |
| 560 |
|
<td width="30%" valign="top" align="right"> |
| 561 |
|
<b><?php echo $title; ?></b> |
| 562 |
|
</td> |
| 563 |
|
<td valign="top"> |
| 564 |
|
<?php |
| 565 |
|
foreach ($alternatives as $one) { |
| 566 |
|
if (in_array($one,$already)) $mark = 'checked="checked"'; |
| 567 |
|
else $mark = ''; |
| 568 |
|
$value = $name.'_'.$one; |
| 569 |
|
echo "<input type=\"checkbox\" name=\"$value\" $mark />$one"; |
| 570 |
|
} |
| 571 |
|
if ($tooltip) echo ' '.tooltip($tooltip); |
| 572 |
|
echo '</td></tr>'; |
| 573 |
} |
} |
| 574 |
|
|
| 575 |
|
function tooltip ($text) { |
| 576 |
|
return '<a href="javascript:void(0)" onmouseover="return escape('."'".$text."'".')">'.mamboCore::get('mosConfig_live_site').'/includes/js/ThemeOffice/tooltip.png</a>'; |
| 577 |
|
} |
| 578 |
|
|
| 579 |
|
} |
| 580 |
|
|
| 581 |
|
/** |
| 582 |
|
* @param string THe template position |
| 583 |
|
*/ |
| 584 |
|
function mosCountAdminModules( $position='left' ) { |
| 585 |
|
$handler =& mosModuleHandler::getInstance(); |
| 586 |
|
return $handler->mosCountModules($position, true); |
| 587 |
|
} |
| 588 |
|
/** |
| 589 |
|
* Loads admin modules via module position |
| 590 |
|
* @param string The position |
| 591 |
|
* @param int 0 = no style, 1 = tabbed |
| 592 |
|
*/ |
| 593 |
|
function mosLoadAdminModules( $position='left', $style=0 ) { |
| 594 |
|
$handler =& mosModuleHandler::getInstance(); |
| 595 |
|
return $handler->mosLoadAdminModules($position, $style); |
| 596 |
} |
} |
| 597 |
/** |
/** |
| 598 |
* Loads an admin module |
* Loads an admin module |
| 599 |
*/ |
*/ |
| 600 |
function mosLoadAdminModule( $name, $params=NULL ) { |
function mosLoadAdminModule( $name, $params=NULL ) { |
| 601 |
global $mosConfig_absolute_path, $mosConfig_live_site; |
global $mosConfig_absolute_path, $mosConfig_live_site; |
| 602 |
global $database, $my, $mainframe, $option, $acl; |
global $database, $acl, $my, $mainframe, $option; |
| 603 |
|
global $task, $act; |
|
$task = mosGetParam( $_REQUEST, 'task', '' ); |
|
|
// legacy support for $act |
|
|
$act = mosGetParam( $_REQUEST, 'act', '' ); |
|
| 604 |
|
|
| 605 |
$name = str_replace( '/', '', $name ); |
$name = str_replace( '/', '', $name ); |
| 606 |
$name = str_replace( '\\', '', $name ); |
$name = str_replace( '\\', '', $name ); |
| 607 |
$path = "$mosConfig_absolute_path/administrator/modules/mod_$name.php"; |
$path = mamboCore::get('mosConfig_absolute_path')."/administrator/modules/mod_$name.php"; |
| 608 |
if (file_exists( $path )) { |
if (file_exists($path)) require $path; |
|
require $path; |
|
|
} |
|
| 609 |
} |
} |
| 610 |
|
|
| 611 |
function mosLoadCustomModule( &$module, &$params ) { |
function mosLoadCustomModule( &$module, &$params ) { |
| 612 |
global $mosConfig_absolute_path; |
if ($module->content) { |
|
|
|
|
$rssurl = $params->get( 'rssurl', '' ); |
|
|
$rssitems = $params->get( 'rssitems', '' ); |
|
|
$rssdesc = $params->get( 'rssdesc', '' ); |
|
| 613 |
$moduleclass_sfx = $params->get( 'moduleclass_sfx', '' ); |
$moduleclass_sfx = $params->get( 'moduleclass_sfx', '' ); |
|
|
|
| 614 |
echo '<table cellpadding="0" cellspacing="0" class="moduletable' . $moduleclass_sfx . '">'; |
echo '<table cellpadding="0" cellspacing="0" class="moduletable' . $moduleclass_sfx . '">'; |
|
|
|
|
if ($module->content) { |
|
| 615 |
echo '<tr>'; |
echo '<tr>'; |
| 616 |
echo '<td>' . $module->content . '</td>'; |
echo '<td>' . $module->content . '</td>'; |
| 617 |
echo '</tr>'; |
echo '</tr>'; |
| 618 |
|
echo '</table>'; |
| 619 |
} |
} |
| 620 |
|
|
|
// feed output |
|
|
if ( $rssurl ) { |
|
|
$cacheDir = $mosConfig_absolute_path .'/cache/'; |
|
|
if (!is_writable( $cacheDir )) { |
|
|
echo '<tr>'; |
|
|
echo '<td>Please make cache directory writable.</td>'; |
|
|
echo '</tr>'; |
|
|
} else { |
|
|
$LitePath = $mosConfig_absolute_path .'/includes/Cache/Lite.php'; |
|
|
require_once( $mosConfig_absolute_path .'/includes/domit/xml_domit_rss_lite.php'); |
|
|
$rssDoc =& new xml_domit_rss_document_lite(); |
|
|
$rssDoc->useCacheLite(true, $LitePath, $cacheDir, 3600); |
|
|
$rssDoc->loadRSS( $rssurl ); |
|
|
$totalChannels = $rssDoc->getChannelCount(); |
|
|
|
|
|
for ($i = 0; $i < $totalChannels; $i++) { |
|
|
$currChannel =& $rssDoc->getChannel($i); |
|
|
echo '<tr>'; |
|
|
echo '<td><strong><a href="'. $currChannel->getLink() .'" target="_child">'; |
|
|
echo $currChannel->getTitle() .'</a></strong></td>'; |
|
|
echo '</tr>'; |
|
|
if ($rssdesc) { |
|
|
echo '<tr>'; |
|
|
echo '<td>'. $currChannel->getDescription() .'</td>'; |
|
|
echo '</tr>'; |
|
|
} |
|
|
|
|
|
$actualItems = $currChannel->getItemCount(); |
|
|
$setItems = $rssitems; |
|
|
|
|
|
if ($setItems > $actualItems) { |
|
|
$totalItems = $actualItems; |
|
|
} else { |
|
|
$totalItems = $setItems; |
|
|
} |
|
|
|
|
|
for ($j = 0; $j < $totalItems; $j++) { |
|
|
$currItem =& $currChannel->getItem($j); |
|
|
|
|
|
echo '<tr>'; |
|
|
echo '<td><strong><a href="'. $currItem->getLink() .'" target="_child">'; |
|
|
echo $currItem->getTitle() .'</a></strong> - '. $currItem->getDescription() .'</td>'; |
|
|
echo '</tr>'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
echo '</table>'; |
|
| 621 |
} |
} |
| 622 |
|
|
| 623 |
function mosShowSource( $filename, $withLineNums=false ) { |
function mosShowSource( $filename, $withLineNums=false ) { |
| 711 |
return $ret; |
return $ret; |
| 712 |
} |
} |
| 713 |
|
|
|
function &checkAdminSession (&$database) { |
|
|
// restore some session variables |
|
|
$my = new mosUser( $database ); |
|
|
$my->id = mosGetParam( $_SESSION, 'session_user_id', '' ); |
|
|
$my->username = mosGetParam( $_SESSION, 'session_username', '' ); |
|
|
$my->usertype = mosGetParam( $_SESSION, 'session_usertype', '' ); |
|
|
$my->gid = mosGetParam( $_SESSION, 'session_gid', '' ); |
|
|
|
|
|
$session_id = mosGetParam( $_SESSION, 'session_id', '' ); |
|
|
$logintime = mosGetParam( $_SESSION, 'session_logintime', '' ); |
|
|
|
|
|
// check against db record of session |
|
|
if ($session_id == md5( $my->id.$my->username.$my->usertype.$logintime )) { |
|
|
$database->setQuery( "SELECT * FROM #__session" |
|
|
. "\nWHERE session_id='$session_id'" |
|
|
. " AND username = '" . $database->getEscaped( $my->username ) . "'" |
|
|
. " AND userid = " . intval( $my->id ) |
|
|
); |
|
|
if (!$result = $database->query()) { |
|
|
echo $database->stderr(); |
|
|
} |
|
|
if ($database->getNumRows( $result ) <> 1) $my = null; |
|
|
} |
|
|
else $my = null; |
|
|
|
|
|
if ($my) { |
|
|
// update session timestamp |
|
|
$current_time = time(); |
|
|
$database->setQuery("UPDATE #__session SET time='$current_time' WHERE session_id='$session_id'"); |
|
|
$database->query(); |
|
|
// timeout old sessions |
|
|
$past = time()-1800; |
|
|
$database->setQuery( "DELETE FROM #__session WHERE time < '$past'" ); |
|
|
$database->query(); |
|
|
} |
|
|
return $my; |
|
|
} |
|
|
|
|
| 714 |
?> |
?> |