| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
| 3 |
* @package Mambo Open Source |
* @package Mambo |
| 4 |
* @copyright (C) 2005 - 2006 Mambo Foundation Inc. |
* @author Mambo Foundation Inc see README.php |
| 5 |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL |
* @copyright Mambo Foundation Inc. |
| 6 |
* |
* See COPYRIGHT.php for copyright notices and details. |
| 7 |
* Mambo was originally developed by Miro (www.miro.com.au) in 2000. Miro assigned the copyright in Mambo to The Mambo Foundation in 2005 to ensure |
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see |
| 8 |
* that Mambo remained free Open Source software owned and managed by the community. |
* LICENSE.php |
| 9 |
* Mambo is Free Software |
* Mambo is free software; you can redistribute it and/or |
| 10 |
|
* modify it under the terms of the GNU General Public License |
| 11 |
|
* as published by the Free Software Foundation; version 2 of the |
| 12 |
|
* License. |
| 13 |
*/ |
*/ |
| 14 |
|
|
| 15 |
/** ensure this file is being included by a parent file */ |
/** ensure this file is being included by a parent file */ |
| 63 |
$this->accept['MOSINSTALL'] = array ('NAME', 'CREATIONDATE', 'AUTHOR', 'COPYRIGHT', |
$this->accept['MOSINSTALL'] = array ('NAME', 'CREATIONDATE', 'AUTHOR', 'COPYRIGHT', |
| 64 |
'LICENSE', 'AUTHOREMAIL', 'AUTHORURL', 'VERSION', 'DESCRIPTION', 'FILES', 'MEDIA', |
'LICENSE', 'AUTHOREMAIL', 'AUTHORURL', 'VERSION', 'DESCRIPTION', 'FILES', 'MEDIA', |
| 65 |
'PARAMS', 'INSTALL', 'UNINSTALL', 'INSTALLFILE', 'UNINSTALLFILE', 'ADMINISTRATION', |
'PARAMS', 'INSTALL', 'UNINSTALL', 'INSTALLFILE', 'UNINSTALLFILE', 'ADMINISTRATION', |
| 66 |
'IMAGES', 'CSS', 'GROUP'); |
'IMAGES', 'CSS', 'GROUP', 'LOCALE', 'REMOVE_FILES'); |
| 67 |
$this->accept['PARAMS'] = array ('PARAM'); |
$this->accept['PARAMS'] = array ('PARAM'); |
| 68 |
$this->accept['PARAM'] = array ('OPTION'); |
$this->accept['PARAM'] = array ('OPTION'); |
| 69 |
$this->accept['FILES'] = array ('FILENAME'); |
$this->accept['FILES'] = array ('FILENAME'); |
| 70 |
|
$this->accept['REMOVE_FILES'] = array ('FILENAME'); |
| 71 |
$this->accept['INSTALL'] = array ('QUERIES'); |
$this->accept['INSTALL'] = array ('QUERIES'); |
| 72 |
$this->accept['UNINSTALL'] = array ('QUERIES'); |
$this->accept['UNINSTALL'] = array ('QUERIES'); |
| 73 |
$this->accept['QUERIES'] = array ('QUERY'); |
$this->accept['QUERIES'] = array ('QUERY'); |
| 76 |
$this->accept['SUBMENU'] = array('MENU'); |
$this->accept['SUBMENU'] = array('MENU'); |
| 77 |
$this->accept['MEDIA'] = array('FILENAME'); |
$this->accept['MEDIA'] = array('FILENAME'); |
| 78 |
$this->accept['CSS'] = array('FILENAME'); |
$this->accept['CSS'] = array('FILENAME'); |
| 79 |
|
$this->accept['LOCALE'] = array('PLURAL_FORM', 'DATE_FORMAT', 'CODESETS', 'DAYS', 'MONTHS', 'WINCODEPAGE'); |
| 80 |
|
$this->accept['CODESETS'] = array('CHARSET'); |
| 81 |
} |
} |
| 82 |
|
|
| 83 |
function start_element ($parser, $element_name, $element_attrs) { |
function start_element ($parser, $element_name, $element_attrs) { |
| 213 |
} |
} |
| 214 |
|
|
| 215 |
function end_element_option () { |
function end_element_option () { |
| 216 |
$this->options[] = mosHTML::makeOption($this->optvalue, $this->chardata); |
$this->options[] = mosHTML::makeOption($this->optvalue, T_($this->chardata)); |
| 217 |
$this->optvalue = ''; |
$this->optvalue = ''; |
| 218 |
} |
} |
| 219 |
|
|
| 220 |
function end_element_param () { |
function end_element_param () { |
| 221 |
$type = mosGetParam ($this->paramattrs, 'TYPE', ''); |
$type = mosGetParam ($this->paramattrs, 'TYPE', ''); |
| 222 |
$name = mosGetParam ($this->paramattrs, 'NAME', ''); |
$name = mosGetParam ($this->paramattrs, 'NAME', ''); |
| 223 |
$label = mosGetParam ($this->paramattrs, 'LABEL', $name); |
$label = T_(mosGetParam ($this->paramattrs, 'LABEL', $name)); |
| 224 |
$default = mosGetParam ($this->paramattrs, 'DEFAULT', ''); |
$default = T_(mosGetParam ($this->paramattrs, 'DEFAULT', '')); |
| 225 |
if ($description = mosGetParam ($this->paramattrs, 'DESCRIPTION', '')) $tooltip = mosToolTip($description, $name); |
if ($description = mosGetParam ($this->paramattrs, 'DESCRIPTION', '')) $tooltip = mosToolTip(T_($description), $name); |
| 226 |
else $tooltip = ''; |
else $tooltip = ''; |
| 227 |
if (is_object($this->mosParameter)) { |
if (is_object($this->mosParameter)) { |
| 228 |
$mp = $this->mosParameter; |
$mp = $this->mosParameter; |
| 257 |
case 'textarea': |
case 'textarea': |
| 258 |
$rows = mosGetParam ($this->paramattrs, 'ROWS', 0); |
$rows = mosGetParam ($this->paramattrs, 'ROWS', 0); |
| 259 |
$cols = mosGetParam ($this->paramattrs, 'COLS', 0); |
$cols = mosGetParam ($this->paramattrs, 'COLS', 0); |
| 260 |
$value = str_replace ('<br /', "\n", $value); |
$value = str_replace ('<br />', "\n", $value); |
| 261 |
$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>"; |
| 262 |
break; |
break; |
| 263 |
case 'spacer': |
case 'spacer': |
| 386 |
} |
} |
| 387 |
|
|
| 388 |
/** |
/** |
| 389 |
|
* Useful HTML class for admin side components |
| 390 |
|
* @package Mambo |
| 391 |
|
*/ |
| 392 |
|
class basicAdminHTML { |
| 393 |
|
var $pageNav = ''; |
| 394 |
|
var $option = ''; |
| 395 |
|
var $act = ''; |
| 396 |
|
var $limit = 10; |
| 397 |
|
|
| 398 |
|
function basicAdminHTML (&$controller, $limit) { |
| 399 |
|
$this->act = $controller->admin->act; |
| 400 |
|
$this->limit = $limit; |
| 401 |
|
$this->pageNav = $controller->pageNav; |
| 402 |
|
$this->option = strtolower(mosGetParam($_REQUEST,'option','com_admin')); |
| 403 |
|
} |
| 404 |
|
|
| 405 |
|
function tickBox ($object, $property) { |
| 406 |
|
if (is_object($object) AND $object->$property) $checked = "checked='checked'"; |
| 407 |
|
else $checked = ''; |
| 408 |
|
echo "<td><input type='checkbox' name='$property' value='1' $checked /></td>"; |
| 409 |
|
} |
| 410 |
|
|
| 411 |
|
function yesNoList ($object, $property) { |
| 412 |
|
$yesno[] = mosHTML::makeOption( 0, _NO ); |
| 413 |
|
$yesno[] = mosHTML::makeOption( 1, _YES ); |
| 414 |
|
if ($object) $default = $object->$property; |
| 415 |
|
else $default = 0; |
| 416 |
|
echo '<td valign="top">'; |
| 417 |
|
echo mosHTML::selectList($yesno, $property, 'class="inputbox" size="1"', 'value', 'text', $default);; |
| 418 |
|
echo '</td></tr>'; |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
function inputTop ($title, $redstar=false, $maxsize=0) { |
| 422 |
|
?> |
| 423 |
|
<tr> |
| 424 |
|
<td width="30%" valign="top" align="right"> |
| 425 |
|
<strong><?php if ($redstar) echo '<font color="red">*</font>'; echo $title; if ($maxsize) echo "</strong> <br /><em>$maxsize</em> "; ?></strong> |
| 426 |
|
</td> |
| 427 |
|
<?php |
| 428 |
|
} |
| 429 |
|
|
| 430 |
|
function blankRow () { |
| 431 |
|
?> |
| 432 |
|
<tr><td> </td></tr> |
| 433 |
|
<?php |
| 434 |
|
} |
| 435 |
|
|
| 436 |
|
function fileInputBox ($title, $name, $value, $width, $tooltip=null) { |
| 437 |
|
$this->inputTop($title); |
| 438 |
|
?> |
| 439 |
|
<td align="left" valign="top"> |
| 440 |
|
<input class="inputbox" type="text" name="<?php echo $name; ?>" size="<?php echo $width; ?>" value="<?php echo $value; ?>" /> |
| 441 |
|
<?php if ($tooltip) echo tooltip($tooltip); ?> |
| 442 |
|
</td> |
| 443 |
|
</tr> |
| 444 |
|
<?php |
| 445 |
|
} |
| 446 |
|
|
| 447 |
|
function fileInputArea ($title, $maxsize, $name, $value, $rows, $cols, $editor=false, $tooltip=null) { |
| 448 |
|
$this->inputTop ($title, false, $maxsize); |
| 449 |
|
echo '<td valign="top">'; |
| 450 |
|
if ($editor) { |
| 451 |
|
$box = "editorArea( 'description', '$value', '$name', 500, 200, $rows, $cols );"; |
| 452 |
|
eval($box); |
| 453 |
|
} |
| 454 |
|
else echo "<textarea class='inputbox' name='$name' rows='$rows' cols='$cols'>$value</textarea>"; |
| 455 |
|
if ($tooltip) echo tooltip($tooltip); |
| 456 |
|
echo '</td></tr>'; |
| 457 |
|
} |
| 458 |
|
|
| 459 |
|
function tickBoxField ($object, $property, $title) { |
| 460 |
|
?> |
| 461 |
|
<tr> |
| 462 |
|
<td width="30%" valign="top" align="right"> |
| 463 |
|
<strong><?php echo $title; ?></strong> |
| 464 |
|
</td> |
| 465 |
|
<?php |
| 466 |
|
$this->tickBox($object,$property); |
| 467 |
|
echo '</tr>'; |
| 468 |
|
} |
| 469 |
|
|
| 470 |
|
function simpleTickBox ($title, $name, $checked=false) { |
| 471 |
|
$this->inputTop($title); |
| 472 |
|
if ($checked) $check = 'checked="checked"'; |
| 473 |
|
else $check = ''; |
| 474 |
|
?> |
| 475 |
|
<td> |
| 476 |
|
<input type="checkbox" name="<?php echo $name; ?>" value="1" <?php echo $check; ?> /> |
| 477 |
|
</td> |
| 478 |
|
</tr> |
| 479 |
|
<?php |
| 480 |
|
} |
| 481 |
|
function formStart ($title, $imagepath) { |
| 482 |
|
?> |
| 483 |
|
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> |
| 484 |
|
<script language="Javascript" src="../includes/js/overlib_mini.js"></script> |
| 485 |
|
<form action="index2.php" method="post" name="adminForm"> |
| 486 |
|
<table cellpadding="4" cellspacing="0" border="0" width="100%"> |
| 487 |
|
<tr> |
| 488 |
|
<td width="100%" colspan="4"> |
| 489 |
|
<div class="title"> |
| 490 |
|
<img src="<?php echo $imagepath; ?>" alt="<?php echo $title; ?>" /> |
| 491 |
|
<span class="sectionname"> <?php echo $title; ?></span> |
| 492 |
|
</div> |
| 493 |
|
</td> |
| 494 |
|
</tr> |
| 495 |
|
<?php |
| 496 |
|
} |
| 497 |
|
|
| 498 |
|
function listHeadingStart ($count) { |
| 499 |
|
?> |
| 500 |
|
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist"> |
| 501 |
|
<tr> |
| 502 |
|
<th width="5" align="left"> |
| 503 |
|
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo $count; ?>);" /> |
| 504 |
|
</th> |
| 505 |
|
<?php |
| 506 |
|
} |
| 507 |
|
|
| 508 |
|
function headingItem ($width, $title, $colspan=1) { |
| 509 |
|
if ($colspan > 1) $colcode = " colspan=\"$colspan\""; |
| 510 |
|
else $colcode = ''; |
| 511 |
|
echo "<th width=\"$width\" align=\"left\"$colcode>$title</th>"; |
| 512 |
|
} |
| 513 |
|
|
| 514 |
|
function commonScripts ($edit_fields) { |
| 515 |
|
?> |
| 516 |
|
<script type="text/javascript"> |
| 517 |
|
function submitbutton(pressbutton) { |
| 518 |
|
<?php |
| 519 |
|
if (is_array($edit_fields)) foreach ($edit_fields as $field) getEditorContents( $field, $field ); |
| 520 |
|
else getEditorContents ($edit_fields, $edit_fields); |
| 521 |
|
?> |
| 522 |
|
submitform( pressbutton ); |
| 523 |
|
} |
| 524 |
|
</script> |
| 525 |
|
<?php |
| 526 |
|
} |
| 527 |
|
|
| 528 |
|
function listFormEnd ($pagecontrol=true) { |
| 529 |
|
if ($pagecontrol) { |
| 530 |
|
?> |
| 531 |
|
<tr> |
| 532 |
|
<th align="center" colspan="10"> <?php echo $this->pageNav->writePagesLinks(); ?></th> |
| 533 |
|
</tr> |
| 534 |
|
<tr> |
| 535 |
|
<td align="center" colspan="10"> <?php echo $this->pageNav->writePagesCounter(); ?></td> |
| 536 |
|
</tr> |
| 537 |
|
<?php |
| 538 |
|
} |
| 539 |
|
?> |
| 540 |
|
<input type="hidden" name="option" value="<?php echo $this->option; ?>" /> |
| 541 |
|
<input type="hidden" name="task" value="" /> |
| 542 |
|
<input type="hidden" name="act" value="<?php echo $this->act; ?>" /> |
| 543 |
|
<input type="hidden" name="boxchecked" value="0" /> |
| 544 |
|
</table> |
| 545 |
|
</form> |
| 546 |
|
<?php |
| 547 |
|
} |
| 548 |
|
|
| 549 |
|
function editFormEnd ($id) { |
| 550 |
|
?> |
| 551 |
|
<input type="hidden" name="cfid" value="<?php echo $id; ?>" /> |
| 552 |
|
<input type="hidden" name="limit" value="<?php echo $this->limit; ?>" /> |
| 553 |
|
<input type="hidden" name="option" value="<?php echo $this->option; ?>" /> |
| 554 |
|
<input type="hidden" name="task" value="" /> |
| 555 |
|
<input type="hidden" name="act" value="<?php echo $this->act; ?>" /> |
| 556 |
|
</table> |
| 557 |
|
</form> |
| 558 |
|
<?php |
| 559 |
|
} |
| 560 |
|
|
| 561 |
|
function multiOptionList ($name, $title, $options, $current, $tooltip=null) { |
| 562 |
|
$alternatives = explode(',',$options); |
| 563 |
|
$already = explode(',', $current); |
| 564 |
|
?> |
| 565 |
|
<tr> |
| 566 |
|
<td width="30%" valign="top" align="right"> |
| 567 |
|
<strong><?php echo $title; ?></strong> |
| 568 |
|
</td> |
| 569 |
|
<td valign="top"> |
| 570 |
|
<?php |
| 571 |
|
foreach ($alternatives as $one) { |
| 572 |
|
if (in_array($one,$already)) $mark = 'checked="checked"'; |
| 573 |
|
else $mark = ''; |
| 574 |
|
$value = $name.'_'.$one; |
| 575 |
|
echo "<input type=\"checkbox\" name=\"$value\" $mark />$one"; |
| 576 |
|
} |
| 577 |
|
if ($tooltip) echo ' '.tooltip($tooltip); |
| 578 |
|
echo '</td></tr>'; |
| 579 |
|
} |
| 580 |
|
|
| 581 |
|
function tooltip ($text) { |
| 582 |
|
return '<a href="javascript:void(0)" onmouseover="return escape('."'".$text."'".')">'.mamboCore::get('mosConfig_live_site').'/includes/js/ThemeOffice/tooltip.png</a>'; |
| 583 |
|
} |
| 584 |
|
|
| 585 |
|
} |
| 586 |
|
|
| 587 |
|
/** |
| 588 |
* @param string THe template position |
* @param string THe template position |
| 589 |
*/ |
*/ |
| 590 |
function mosCountAdminModules( $position='left' ) { |
function mosCountAdminModules( $position='left' ) { |
| 615 |
} |
} |
| 616 |
|
|
| 617 |
function mosLoadCustomModule( &$module, &$params ) { |
function mosLoadCustomModule( &$module, &$params ) { |
| 618 |
die ("The function mosLoadCustomModule has had its code removed as it appears unused"); |
if ($module->content) { |
| 619 |
|
$moduleclass_sfx = $params->get( 'moduleclass_sfx', '' ); |
| 620 |
|
echo '<table cellpadding="0" cellspacing="0" class="moduletable' . $moduleclass_sfx . '">'; |
| 621 |
|
echo '<tr>'; |
| 622 |
|
echo '<td>' . $module->content . '</td>'; |
| 623 |
|
echo '</tr>'; |
| 624 |
|
echo '</table>'; |
| 625 |
|
} |
| 626 |
|
|
| 627 |
} |
} |
| 628 |
|
|
| 629 |
function mosShowSource( $filename, $withLineNums=false ) { |
function mosShowSource( $filename, $withLineNums=false ) { |