| 38 |
$charfunc = array (&$this, 'character_data'); |
$charfunc = array (&$this, 'character_data'); |
| 39 |
xml_set_element_handler ($parser, $startfunc, $endfunc); |
xml_set_element_handler ($parser, $startfunc, $endfunc); |
| 40 |
xml_set_character_data_handler ($parser, $charfunc); |
xml_set_character_data_handler ($parser, $charfunc); |
| 41 |
$fp = fopen($file, 'rb'); |
if ($fp = fopen($file, 'rb')) { |
| 42 |
while ($data = fread($fp, 4096) AND !$this->terminalError) { |
while ($data = fread($fp, 4096) AND !$this->terminalError) { |
| 43 |
$data = str_replace('&', ' ampersand ', $data); |
$data = str_replace('&', ' ampersand ', $data); |
| 44 |
$ret = xml_parse($parser, $data, feof($fp)) or die (sprintf('XML ERROR: %s at line %d', |
$ret = xml_parse($parser, $data, feof($fp)) or die (sprintf('XML ERROR: %s at line %d', |
| 45 |
xml_error_string(xml_get_error_code($parser)), |
xml_error_string(xml_get_error_code($parser)), |
| 46 |
xml_get_current_line_number($parser))); |
xml_get_current_line_number($parser))); |
| 47 |
} |
} |
| 48 |
|
} |
| 49 |
|
else die ("Unable to open XML file $file"); |
| 50 |
if (count($this->opentags) != 0) { |
if (count($this->opentags) != 0) { |
| 51 |
$tags = implode (', ', $this->opentags); |
$tags = implode (', ', $this->opentags); |
| 52 |
trigger_error ("XML error - unclosed tag(s) ($tags) at end of file"); |
trigger_error ("XML error - unclosed tag(s) ($tags) at end of file"); |
| 59 |
$this->accept['MOSINSTALL'] = array ('NAME', 'CREATIONDATE', 'AUTHOR', 'COPYRIGHT', |
$this->accept['MOSINSTALL'] = array ('NAME', 'CREATIONDATE', 'AUTHOR', 'COPYRIGHT', |
| 60 |
'LICENSE', 'AUTHOREMAIL', 'AUTHORURL', 'VERSION', 'DESCRIPTION', 'FILES', 'MEDIA', |
'LICENSE', 'AUTHOREMAIL', 'AUTHORURL', 'VERSION', 'DESCRIPTION', 'FILES', 'MEDIA', |
| 61 |
'PARAMS', 'INSTALL', 'UNINSTALL', 'INSTALLFILE', 'UNINSTALLFILE', 'ADMINISTRATION', |
'PARAMS', 'INSTALL', 'UNINSTALL', 'INSTALLFILE', 'UNINSTALLFILE', 'ADMINISTRATION', |
| 62 |
'IMAGES', 'CSS'); |
'IMAGES', 'CSS', 'GROUP'); |
| 63 |
$this->accept['PARAMS'] = array ('PARAM'); |
$this->accept['PARAMS'] = array ('PARAM'); |
| 64 |
$this->accept['PARAM'] = array ('OPTION'); |
$this->accept['PARAM'] = array ('OPTION'); |
| 65 |
$this->accept['FILES'] = array ('FILENAME'); |
$this->accept['FILES'] = array ('FILENAME'); |
| 208 |
} |
} |
| 209 |
|
|
| 210 |
function element_option ($attrs) { |
function element_option ($attrs) { |
| 211 |
if (isset($attrs['VALUE'])) $optvalue = $attrs['VALUE']; |
if (isset($attrs['VALUE'])) $this->optvalue = $attrs['VALUE']; |
| 212 |
} |
} |
| 213 |
|
|
| 214 |
function character_data ($parser, $data) { |
function character_data ($parser, $data) { |
| 230 |
$default = mosGetParam ($this->paramattrs, 'DEFAULT', ''); |
$default = mosGetParam ($this->paramattrs, 'DEFAULT', ''); |
| 231 |
if ($description = mosGetParam ($this->paramattrs, 'DESCRIPTION', '')) $tooltip = mosToolTip($description, $name); |
if ($description = mosGetParam ($this->paramattrs, 'DESCRIPTION', '')) $tooltip = mosToolTip($description, $name); |
| 232 |
else $tooltip = ''; |
else $tooltip = ''; |
| 233 |
if (is_object($this->mosParameter)) $value = $this->mosParameter->get($name, $default); |
if (is_object($this->mosParameter)) { |
| 234 |
|
$mp = $this->mosParameter; |
| 235 |
|
$value = $mp->get($name, $default); |
| 236 |
|
} |
| 237 |
else $value = $default; |
else $value = $default; |
| 238 |
$this->html[] = '<tr>'; |
$this->html[] = '<tr>'; |
| 239 |
if ($label == '@spacer') $label = '<hr />'; |
if ($label == '@spacer') $label = '<hr />'; |
| 246 |
$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.'" />'; |
| 247 |
break; |
break; |
| 248 |
case 'list': |
case 'list': |
| 249 |
$controlstring = mosHTML::selectList($this->options, "$controlname[$name]", 'class="inputbox"', 'value', 'text', $value); |
$controlstring = mosHTML::selectList($this->options, $controlname.'['.$name.']', 'class="inputbox"', 'value', 'text', $value); |
| 250 |
break; |
break; |
| 251 |
case 'radio': |
case 'radio': |
| 252 |
$controlstring = mosHTML::radioList($this->options, "$controlname[$name]", $value); |
$controlstring = mosHTML::radioList($this->options, $controlname.'['.$name.']', '', $value); |
| 253 |
break; |
break; |
| 254 |
case 'imagelist': |
case 'imagelist': |
| 255 |
$directory = new mosDirectory (mamboCore::get('mosConfig_absolute_path').mosGetParam($this->paramattrs, 'DIRECTORY', '')); |
$directory = new mosDirectory (mamboCore::get('mosConfig_absolute_path').mosGetParam($this->paramattrs, 'DIRECTORY', '')); |
| 382 |
* @return string HTML |
* @return string HTML |
| 383 |
*/ |
*/ |
| 384 |
function render( $name='params' ) { |
function render( $name='params' ) { |
| 385 |
|
if (is_file($this->_path)) { |
| 386 |
$parser = new mosXMLParams ($this->_path, $this, $name); |
$parser = new mosXMLParams ($this->_path, $this, $name); |
| 387 |
if (count($parser->html)) return implode("\n", $parser->html); |
if (count($parser->html)) return implode("\n", $parser->html); |
| 388 |
else { |
} |
| 389 |
$raw = $this->_raw; |
$raw = $this->_raw; |
| 390 |
return "<textarea name='$name' cols='40' rows='10' class='text_area'$raw</textarea>"; |
return "<textarea name='$name' cols='40' rows='10' class='text_area'$raw</textarea>"; |
| 391 |
} |
} |
|
} |
|
| 392 |
|
|
| 393 |
} |
} |
| 394 |
/** |
/** |
| 422 |
} |
} |
| 423 |
|
|
| 424 |
function mosLoadCustomModule( &$module, &$params ) { |
function mosLoadCustomModule( &$module, &$params ) { |
| 425 |
global $mosConfig_absolute_path; |
die ("The function mosLoadCustomModule has had its code removed as it appears unused"); |
|
|
|
|
$rssurl = $params->get( 'rssurl', '' ); |
|
|
$rssitems = $params->get( 'rssitems', '' ); |
|
|
$rssdesc = $params->get( 'rssdesc', '' ); |
|
|
$moduleclass_sfx = $params->get( 'moduleclass_sfx', '' ); |
|
|
|
|
|
echo '<table cellpadding="0" cellspacing="0" class="moduletable' . $moduleclass_sfx . '">'; |
|
|
|
|
|
if ($module->content) { |
|
|
echo '<tr>'; |
|
|
echo '<td>' . $module->content . '</td>'; |
|
|
echo '</tr>'; |
|
|
} |
|
|
|
|
|
// feed output |
|
|
if ( $rssurl ) { |
|
|
$cacheDir = $mosConfig_absolute_path .'/cache/'; |
|
|
if (!is_writable( $cacheDir )) { |
|
|
echo '<tr>'; |
|
|
echo '<td>'.T_('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>'; |
|
| 426 |
} |
} |
| 427 |
|
|
| 428 |
function mosShowSource( $filename, $withLineNums=false ) { |
function mosShowSource( $filename, $withLineNums=false ) { |