[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/plugins/system/legacy/ -> functions.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: functions.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla.Legacy
   5   * @subpackage    1.5
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant
   9   * to the GNU General Public License, and as distributed it includes or
  10   * is derivative of works licensed under the GNU General Public License or
  11   * other free or open source software licenses.
  12   * See COPYRIGHT.php for copyright notices and details.
  13   */
  14  
  15  /**
  16   * Legacy function, use <jdoc:exists type="modules" condition="{POSITION}" /> instead
  17   *
  18   * @deprecated    As of version 1.5
  19   */
  20  function mosCountModules( $position='left' ) {
  21      jimport('joomla.application.module.helper');
  22      return count(JModuleHelper::getModules($position));
  23  }
  24  
  25  /**
  26   * Legacy function, use <jdoc:include type="component" /> instead
  27   *
  28   * @deprecated    As of version 1.5
  29   */
  30  function mosMainBody() {
  31      ?><jdoc:include type="component" /><?php
  32  }
  33  
  34  /**
  35   * Legacy function, use <jdoc:include type="modules" /> instead
  36   *
  37   * @deprecated        As of version 1.5
  38   */
  39  function mosLoadModules( $position='left', $style=0 )
  40  {
  41      // Select the module chrome function
  42      if (is_numeric($style))
  43      {
  44          switch ( $style )
  45          {
  46              case -3:
  47                  $style = 'rounded';
  48                  break;
  49  
  50              case -2:
  51                  $style = 'xhtml';
  52                  break;
  53  
  54              case -1:
  55                  $style = 'raw';
  56                  break;
  57  
  58              case 0  :
  59              default :
  60                  $style = 'table';
  61                  break;
  62          }
  63      }
  64      ?><jdoc:include type="modules" name="<?php echo $position ?>" style="<?php echo $style ?>"/><?php
  65  }
  66  
  67  /**
  68   * Legacy function, use <jdoc:include type="module" /> instead
  69   *
  70   * @deprecated        As of version 1.5
  71   */
  72  function mosLoadModule( $name, $style=-1 ) {
  73      ?><jdoc:include type="module" name="<?php echo $name ?>" style="<?php echo $style ?>" /><?php
  74  }
  75  
  76  /**
  77   * Legacy function, use <jdoc:include type="head" /> instead
  78   *
  79   * @deprecated    As of version 1.5
  80   */
  81  function mosShowHead() {
  82      ?><jdoc:include type="head" /><?php
  83  }
  84  
  85  /**
  86   * Legacy function, using <jdoc:exists> instead
  87   *
  88   * @deprecated    As of version 1.5
  89   */
  90  function mosCountAdminModules(  $position='left' ) {
  91      $document =& JFactory::getDocument();
  92      return count($document->getModules($position));
  93  }
  94  
  95  /**
  96   * Legacy function, using <jdoc:include type="component" /> instead
  97   *
  98   * @deprecated    As of version 1.5
  99   */
 100  function mosMainBody_Admin() {
 101      ?><jdoc:include type="component" /><?php
 102  }
 103  
 104  /**
 105   * Legacy function, using <jdoc:include type="modules" /> instead
 106   *
 107   * @deprecated    As of version 1.5
 108   */
 109  
 110  function mosLoadAdminModules( $position='left', $style=0 ) {
 111  
 112      // Select the module chrome function
 113      if (is_numeric($style))
 114      {
 115          switch ( $style )
 116          {
 117              case 2:
 118                  $style = 'xhtml';
 119                  break;
 120  
 121              case 0  :
 122              default :
 123                  $style = 'raw';
 124                  break;
 125          }
 126      }
 127      ?><jdoc:include type="modules" name="<?php echo $position ?>" style="<?php echo $style ?>" /><?php
 128  }
 129  
 130  /**
 131   * Legacy function, using <jdoc:include type="module" /> instead
 132   *
 133   * @deprecated    As of version 1.5
 134   */
 135  function mosLoadAdminModule( $name, $style=0 ) {
 136      ?><jdoc:include type="module" name="<?php echo $name ?>" style="<?php echo $style ?>" /><?php
 137  }
 138  
 139  /**
 140   * Legacy function, using <jdoc:include type="head" /> instead
 141   *
 142   * @deprecated    As of version 1.5
 143   */
 144  function mosShowHead_Admin() {
 145      ?><jdoc:include type="head" /><?php
 146  }
 147  
 148  /**
 149   * Legacy function, always use {@link JRequest::getVar()} instead
 150   *
 151   * @deprecated    As of version 1.5
 152   */
 153  function mosStripslashes( &$value )
 154  {
 155      $ret = '';
 156      if (is_string( $value )) {
 157          $ret = stripslashes( $value );
 158      } else {
 159          if (is_array( $value )) {
 160              $ret = array();
 161              foreach ($value as $key => $val) {
 162                  $ret[$key] = mosStripslashes( $val );
 163              }
 164          } else {
 165              $ret = $value;
 166          }
 167      }
 168      return $ret;
 169  }
 170  
 171  /**
 172   * Legacy function, use {@link JArrayHelper JArrayHelper->toObject()} instead
 173   *
 174   * @deprecated    As of version 1.5
 175   */
 176  function mosBindArrayToObject( $array, &$obj, $ignore='', $prefix=NULL, $checkSlashes=true )
 177  {
 178      if (!is_array( $array ) || !is_object( $obj )) {
 179          return (false);
 180      }
 181  
 182      foreach (get_object_vars($obj) as $k => $v)
 183      {
 184          if( substr( $k, 0, 1 ) != '_' )
 185          {
 186              // internal attributes of an object are ignored
 187              if (strpos( $ignore, $k) === false)
 188              {
 189                  if ($prefix) {
 190                      $ak = $prefix . $k;
 191                  } else {
 192                      $ak = $k;
 193                  }
 194                  if (isset($array[$ak])) {
 195                      $obj->$k = ($checkSlashes && get_magic_quotes_gpc()) ? mosStripslashes( $array[$ak] ) : $array[$ak];
 196                  }
 197              }
 198          }
 199      }
 200  
 201      return true;
 202  }
 203  
 204  /**
 205   * Legacy function, use {@link JUtility::getHash()} instead
 206   *
 207   * @deprecated    As of version 1.5
 208   */
 209  function mosHash( $seed ) {
 210      return JUtility::getHash( $seed );
 211  }
 212  
 213  /**
 214  * Legacy function
 215   *
 216   * @deprecated    As of version 1.5
 217  */
 218  function mosNotAuth()
 219  {
 220      $user =& JFactory::getUser();
 221      echo JText::_('ALERTNOTAUTH');
 222      if ($user->get('id') < 1) {
 223          echo "<br />" . JText::_( 'You need to login.' );
 224      }
 225  }
 226  
 227  /**
 228   * Legacy function, use (@link JError} or {@link JApplication::redirect()} instead.
 229   *
 230   * @deprecated    As of version 1.5
 231   */
 232  function mosErrorAlert( $text, $action='window.history.go(-1);', $mode=1 )
 233  {
 234      global $mainframe;
 235  
 236      $text = nl2br( $text );
 237      $text = addslashes( $text );
 238      $text = strip_tags( $text );
 239  
 240      switch ( $mode ) {
 241          case 2:
 242              echo "<script>$action</script> \n";
 243              break;
 244  
 245          case 1:
 246          default:
 247              echo "<script>alert('$text'); $action</script> \n";
 248              echo '<noscript>';
 249              echo "$text\n";
 250              echo '</noscript>';
 251              break;
 252      }
 253  
 254      $mainframe->close();
 255  }
 256  
 257  /**
 258   * Legacy function, use {@link JPath::clean()} instead
 259   *
 260   * @deprecated    As of version 1.5
 261   */
 262  function mosPathName($p_path, $p_addtrailingslash = true)
 263  {
 264      jimport('joomla.filesystem.path');
 265      $path = JPath::clean($p_path);
 266      if ($p_addtrailingslash) {
 267          $path = rtrim($path, DS) . DS;
 268      }
 269      return $path;
 270  }
 271  
 272  /**
 273   * Legacy function, use {@link JFolder::files()} or {@link JFolder::folders()} instead
 274   *
 275   * @deprecated    As of version 1.5
 276   */
 277  function mosReadDirectory( $path, $filter='.', $recurse=false, $fullpath=false  )
 278  {
 279      $arr = array(null);
 280  
 281      // Get the files and folders
 282      jimport('joomla.filesystem.folder');
 283      $files        = JFolder::files($path, $filter, $recurse, $fullpath);
 284      $folders    = JFolder::folders($path, $filter, $recurse, $fullpath);
 285      // Merge files and folders into one array
 286      $arr = array_merge($files, $folders);
 287      // Sort them all
 288      asort($arr);
 289      return $arr;
 290  }
 291  
 292  /**
 293   * Legacy function, use {@link JFactory::getMailer()} instead
 294   *
 295   * @deprecated    As of version 1.5
 296   */
 297  function mosCreateMail( $from='', $fromname='', $subject, $body ) {
 298  
 299      $mail =& JFactory::getMailer();
 300  
 301      $mail->From     = $from ? $from : $mail->From;
 302      $mail->FromName = $fromname ? $fromname : $mail->FromName;
 303      $mail->Subject     = $subject;
 304      $mail->Body     = $body;
 305  
 306      return $mail;
 307  }
 308  
 309  /**
 310   * Legacy function, use {@link JUtility::sendMail()} instead
 311   *
 312   * @deprecated    As of version 1.5
 313   */
 314  function mosMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=NULL, $bcc=NULL, $attachment=NULL, $replyto=NULL, $replytoname=NULL ) {
 315      return JUTility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname );
 316  }
 317  
 318  /**
 319   * Legacy function, use {@link JUtility::sendAdminMail()} instead
 320   *
 321   * @deprecated    As of version 1.5
 322   */
 323  function mosSendAdminMail( $adminName, $adminEmail, $email, $type, $title, $author ) {
 324      JUtility::sendAdminMail( $adminName, $adminEmail, $email, $type, $title, $author );
 325  }
 326  
 327  /**
 328   * Legacy function, use {@link JUserHelper::genRandomPassword()} instead
 329   *
 330   * @deprecated    As of version 1.5
 331   */
 332  function mosMakePassword() {
 333      jimport('joomla.user.helper');
 334      return JUserHelper::genRandomPassword();
 335  }
 336  
 337  /**
 338   * Legacy function, use {@link JApplication::redirect() JApplication->redirect()} instead
 339   *
 340   * @deprecated    As of version 1.5
 341   */
 342  function mosRedirect( $url, $msg='' ) {
 343      global $mainframe;
 344      $mainframe->redirect( $url, $msg );
 345  }
 346  
 347  /**
 348   * Legacy function, use {@link JFolder::create()}
 349   *
 350   * @deprecated    As of version 1.5
 351   */
 352  function mosMakePath($base, $path='', $mode = NULL) {
 353  
 354      if ($mode===null) {
 355          $mode = 0755;
 356      }
 357  
 358      jimport('joomla.filesystem.folder');
 359      return JFolder::create($base.$path, $mode);
 360  }
 361  
 362  /**
 363   * Legacy function, use {@link JArrayHelper::toInteger()} instead
 364   *
 365   * @deprecated    As of version 1.5
 366   */
 367  function mosArrayToInts( &$array, $default=null ) {
 368      return JArrayHelper::toInteger( $array, $default );
 369  }
 370  
 371  /**
 372   * Legacy function, use {@link JException::getTrace() JException->getTrace()} instead
 373   *
 374   * @deprecated    As of version 1.5
 375   */
 376  function mosBackTrace( $message='' ) {
 377      if (function_exists( 'debug_backtrace' )) {
 378          echo '<div align="left">';
 379          if ($message) {
 380              echo '<p><strong>' . $message . '</strong></p>';
 381          }
 382          foreach( debug_backtrace() as $back) {
 383              if (@$back['file']) {
 384                  echo '<br />' . str_replace( JPATH_ROOT, '', $back['file'] ) . ':' . $back['line'];
 385              }
 386          }
 387          echo '</div>';
 388      }
 389  }
 390  
 391  /**
 392   * Legacy function, use {@link JPath::setPermissions()} instead
 393   *
 394   * @deprecated    As of version 1.5
 395   */
 396  function mosChmod( $path ) {
 397      jimport('joomla.filesystem.path');
 398      return JPath::setPermissions( $path );
 399  }
 400  
 401  /**
 402   * Legacy function, use {@link JPath::setPermissions()} instead
 403   *
 404   * @deprecated    As of version 1.5
 405   */
 406  function mosChmodRecursive( $path, $filemode=NULL, $dirmode=NULL ) {
 407      jimport('joomla.filesystem.path');
 408      return JPath::setPermissions( $path, $filemode, $dirmode );
 409  }
 410  
 411  /**
 412   * Legacy function, use {@link JPath::canChmod()} instead
 413   *
 414   * @deprecated    As of version 1.5
 415   */
 416  function mosIsChmodable( $file ) {
 417      jimport('joomla.filesystem.path');
 418      return JPath::canChmod( $file );
 419  }
 420  
 421  /**
 422   * Legacy function, replaced by geshi bot
 423   *
 424   * @deprecated    As of version 1.5
 425   */
 426  function mosShowSource( $filename, $withLineNums=false ) {
 427  
 428      ini_set('highlight.html', '000000');
 429      ini_set('highlight.default', '#800000');
 430      ini_set('highlight.keyword','#0000ff');
 431      ini_set('highlight.string', '#ff00ff');
 432      ini_set('highlight.comment','#008000');
 433  
 434      if (!($source = @highlight_file( $filename, true ))) {
 435          return JText::_( 'Operation Failed' );
 436      }
 437      $source = explode("<br />", $source);
 438  
 439      $ln = 1;
 440  
 441      $txt = '';
 442      foreach( $source as $line ) {
 443          $txt .= "<code>";
 444          if ($withLineNums) {
 445              $txt .= "<font color=\"#aaaaaa\">";
 446              $txt .= str_replace( ' ', '&nbsp;', sprintf( "%4d:", $ln ) );
 447              $txt .= "</font>";
 448          }
 449          $txt .= "$line<br /><code>";
 450          $ln++;
 451      }
 452      return $txt;
 453  }
 454  
 455  /**
 456   * Legacy function, use mosLoadModule( 'breadcrumb', -1 ); instead
 457   *
 458   * @deprecated    As of version 1.5
 459   */
 460  function mosPathWay() {
 461      mosLoadModule('breadcrumb', -1);
 462  }
 463  
 464  /**
 465   * Legacy function, use {@link JBrowser::getInstance()} instead
 466   *
 467   * @deprecated    As of version 1.5
 468   */
 469  function mosGetBrowser( $agent ) {
 470      jimport('joomla.environment.browser');
 471      $instance =& JBrowser::getInstance();
 472      return $instance;
 473  }
 474  
 475  /**
 476   * Legacy function, use {@link JApplication::getBrowser()} instead
 477   *
 478   * @deprecated    As of version 1.5
 479   */
 480  function mosGetOS( $agent ) {
 481      jimport('joomla.environment.browser');
 482      $instance =& JBrowser::getInstance();
 483      return $instance->getPlatform();
 484  }
 485  
 486  /**
 487   * Legacy function, use {@link JArrayHelper::getValue()} instead
 488   *
 489   * @deprecated    As of version 1.5
 490   */
 491  function mosGetParam( &$arr, $name, $def=null, $mask=0 )
 492  {
 493      // Static input filters for specific settings
 494      static $noHtmlFilter    = null;
 495      static $safeHtmlFilter    = null;
 496  
 497      $var = JArrayHelper::getValue( $arr, $name, $def, '' );
 498  
 499      // If the no trim flag is not set, trim the variable
 500      if (!($mask & 1) && is_string($var)) {
 501          $var = trim($var);
 502      }
 503  
 504      // Now we handle input filtering
 505      if ($mask & 2) {
 506          // If the allow html flag is set, apply a safe html filter to the variable
 507          if (is_null($safeHtmlFilter)) {
 508              $safeHtmlFilter = & JFilterInput::getInstance(null, null, 1, 1);
 509          }
 510          $var = $safeHtmlFilter->clean($var, 'none');
 511      } elseif ($mask & 4) {
 512          // If the allow raw flag is set, do not modify the variable
 513          $var = $var;
 514      } else {
 515          // Since no allow flags were set, we will apply the most strict filter to the variable
 516          if (is_null($noHtmlFilter)) {
 517              $noHtmlFilter = & JFilterInput::getInstance(/* $tags, $attr, $tag_method, $attr_method, $xss_auto */);
 518          }
 519          $var = $noHtmlFilter->clean($var, 'none');
 520      }
 521      return $var;
 522  }
 523  
 524  /**
 525   * Legacy function, use {@link JHTML::_('list.genericordering', )} instead
 526   *
 527   * @deprecated    As of version 1.5
 528   */
 529  function mosGetOrderingList( $sql, $chop='30' )
 530  {
 531      return JHTML::_('list.genericordering', $sql, $chop);
 532  }
 533  
 534  /**
 535   * Legacy function, use {@link JRegistry} instead
 536   *
 537   * @deprecated    As of version 1.5
 538   */
 539  function mosParseParams( $txt ) {
 540  
 541      $registry = new JRegistry();
 542      $registry->loadINI($txt);
 543      return $registry->toObject( );
 544  }
 545  
 546  /**
 547   * Legacy function, removed
 548   *
 549   * @deprecated    As of version 1.5
 550   */
 551  function mosLoadComponent( $name )
 552  {
 553      // set up some global variables for use by the frontend component
 554      global $mainframe, $database;
 555      $name = JFilterInput::clean($name, 'cmd');
 556      $path = JPATH_SITE.DS.'components'.DS.'com_'.$name.DS.$name.'.php';
 557      if (file_exists($path)) {
 558          include $path;
 559      }
 560  }
 561  
 562  /**
 563   * Legacy function, use {@link JEditor::init()} instead
 564   *
 565   * @deprecated    As of version 1.5
 566   */
 567  function initEditor()
 568  {
 569      $editor =& JFactory::getEditor();
 570      echo $editor->initialise();
 571  }
 572  
 573  /**
 574   * Legacy function, use {@link JEditor::save()} or {@link JEditor::getContent()} instead
 575   *
 576   * @deprecated    As of version 1.5
 577   */
 578  function getEditorContents($editorArea, $hiddenField)
 579  {
 580      jimport( 'joomla.html.editor' );
 581      $editor =& JFactory::getEditor();
 582      echo $editor->save( $hiddenField );
 583  }
 584  
 585  /**
 586   * Legacy function, use {@link JEditor::display()} instead
 587   *
 588   * @deprecated    As of version 1.5
 589   */
 590  function editorArea($name, $content, $hiddenField, $width, $height, $col, $row)
 591  {
 592      jimport( 'joomla.html.editor' );
 593      $editor =& JFactory::getEditor();
 594      echo $editor->display($hiddenField, $content, $width, $height, $col, $row);
 595  }
 596  
 597  /**
 598   * Legacy function, use {@link JMenu::authorize()} instead
 599   *
 600   * @deprecated    As of version 1.5
 601   */
 602  function mosMenuCheck( $Itemid, $menu_option, $task, $gid )
 603  {
 604      $user =& JFactory::getUser();
 605      $menus =& JSite::getMenu();
 606      return $menus->authorize($Itemid, $user->get('aid'));
 607  }
 608  
 609  /**
 610   * Legacy function, use {@link JArrayHelper::fromObject()} instead
 611   *
 612   * @deprecated    As of version 1.5
 613   */
 614  function mosObjectToArray( $p_obj, $recurse = true, $regex = null )
 615  {
 616      $result = JArrayHelper::fromObject( $p_obj, $recurse, $regex );
 617      return $result;
 618  }
 619  
 620  /**
 621   * Legacy function, use {@link JHTML::_('date', )} instead
 622   *
 623   * @deprecated    As of version 1.5
 624   */
 625  function mosFormatDate( $date = 'now', $format = null, $offset = null )  {
 626  
 627      if ( ! $format )
 628      {
 629          $format = JText::_('DATE_FORMAT_LC1');
 630      }
 631  
 632      return JHTML::_('date', $date, $format, $offset);
 633  }
 634  
 635  /**
 636   * Legacy function, use {@link JHTML::_('date', )} instead
 637   *
 638   * @deprecated    As of version 1.5
 639   */
 640  function mosCurrentDate( $format="" )
 641  {
 642      if ($format=="") {
 643          $format = JText::_( 'DATE_FORMAT_LC1' );
 644      }
 645  
 646      return JHTML::_('date', 'now', $format);
 647  }
 648  
 649  /**
 650   * Legacy function, use {@link JFilterOutput::objectHTMLSafe()} instead
 651   *
 652   * @deprecated    As of version 1.5
 653   */
 654  function mosMakeHtmlSafe( &$mixed, $quote_style=ENT_QUOTES, $exclude_keys='' ) {
 655      JFilterOutput::objectHTMLSafe( $mixed, $quote_style, $exclude_keys );
 656  }
 657  
 658  /**
 659   * Legacy function, handled by {@link JDocument} Zlib outputfilter
 660   *
 661   * @deprecated    As of version 1.5
 662   */
 663  function initGzip()
 664  {
 665      global $mainframe, $do_gzip_compress;
 666  
 667  
 668      // attempt to disable session.use_trans_sid
 669      ini_set('session.use_trans_sid', false);
 670  
 671      $do_gzip_compress = FALSE;
 672      if ($mainframe->getCfg('gzip') == 1) {
 673          $phpver = phpversion();
 674          $useragent = mosGetParam( $_SERVER, 'HTTP_USER_AGENT', '' );
 675          $canZip = mosGetParam( $_SERVER, 'HTTP_ACCEPT_ENCODING', '' );
 676  
 677          if ( $phpver >= '4.0.4pl1' &&
 678                  ( strpos($useragent,'compatible') !== false ||
 679                      strpos($useragent,'Gecko') !== false
 680                  )
 681              ) {
 682              // Check for gzip header or northon internet securities
 683              if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
 684                  $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING']));
 685              }
 686              if ( (in_array('gzip', $encodings) || isset( $_SERVER['---------------']) ) && extension_loaded('zlib') && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') && !ini_get('session.use_trans_sid') ) {
 687                  // You cannot specify additional output handlers if
 688                  // zlib.output_compression is activated here
 689                  ob_start( 'ob_gzhandler' );
 690                  return;
 691              }
 692          } else if ( $phpver > '4.0' ) {
 693              if ( strpos($canZip,'gzip') !== false ) {
 694                  if (extension_loaded( 'zlib' )) {
 695                      $do_gzip_compress = TRUE;
 696                      ob_start();
 697                      ob_implicit_flush(0);
 698  
 699                      header( 'Content-Encoding: gzip' );
 700                      return;
 701                  }
 702              }
 703          }
 704      }
 705      ob_start();
 706  }
 707  
 708  /**
 709   * Legacy function, use JFolder::delete($path)
 710   *
 711   * @deprecated    As of version 1.5
 712   */
 713  function deldir( $dir )
 714  {
 715      $current_dir = opendir( $dir );
 716      $old_umask = umask(0);
 717      while ($entryname = readdir( $current_dir )) {
 718          if ($entryname != '.' and $entryname != '..') {
 719              if (is_dir( $dir . $entryname )) {
 720                  deldir( mosPathName( $dir . $entryname ) );
 721              } else {
 722                  @chmod($dir . $entryname, 0777);
 723                  unlink( $dir . $entryname );
 724              }
 725          }
 726      }
 727      umask($old_umask);
 728      closedir( $current_dir );
 729      return rmdir( $dir );
 730  }
 731  
 732  /**
 733   * Legacy function, handled by {@link JDocument} Zlib outputfilter
 734   *
 735   * @deprecated    As of version 1.5
 736   */
 737  function doGzip()
 738  {
 739      global $do_gzip_compress;
 740      if ( $do_gzip_compress )
 741      {
 742          $gzip_contents = ob_get_contents();
 743          ob_end_clean();
 744  
 745          $gzip_size = strlen($gzip_contents);
 746          $gzip_crc = crc32($gzip_contents);
 747  
 748          $gzip_contents = gzcompress($gzip_contents, 9);
 749          $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
 750  
 751          echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
 752          echo $gzip_contents;
 753          echo pack('V', $gzip_crc);
 754          echo pack('V', $gzip_size);
 755      } else {
 756          ob_end_flush();
 757      }
 758  }
 759  
 760  /**
 761   * Legacy function, use {@link JArrayHelper::sortObjects()} instead
 762   *
 763   * @deprecated    As of version 1.5
 764   */
 765  function SortArrayObjects( &$a, $k, $sort_direction=1 )
 766  {
 767      JArrayHelper::sortObjects($a, $k, $sort_direction);
 768  }
 769  
 770  /**
 771   * Legacy function, {@link JRequest::getVar()}
 772   *
 773   * @deprecated    As of version 1.5
 774   */
 775  function josGetArrayInts( $name, $type=NULL ) {
 776  
 777      $array    =  JRequest::getVar($name, array(), 'default', 'array' );
 778  
 779      return $array;
 780  }
 781  
 782  /**
 783   * Legacy function, {@link JSession} transparently checks for spoofing attacks
 784   *
 785   * @deprecated    As of version 1.5
 786   */
 787  function josSpoofCheck( $header=false, $alternate=null )
 788  {
 789      // Lets make sure they saw the html form
 790      $check = true;
 791      $hash    = josSpoofValue($alternate);
 792      $valid    = JRequest::getBool( $hash, 0, 'post' );
 793      if (!$valid) {
 794          $check = false;
 795      }
 796  
 797      // Make sure request came from a client with a user agent string.
 798      if (!isset( $_SERVER['HTTP_USER_AGENT'] )) {
 799          $check = false;
 800      }
 801  
 802      // Check to make sure that the request was posted as well.
 803      $requestMethod = JArrayHelper::getValue( $_SERVER, 'REQUEST_METHOD' );
 804      if ($requestMethod != 'POST') {
 805          $check = false;
 806      }
 807  
 808      if (!$check)
 809      {
 810          header( 'HTTP/1.0 403 Forbidden' );
 811          jexit( JText::_('E_SESSION_TIMEOUT') );
 812      }
 813  }
 814  
 815  /**
 816   * Legacy function, use {@link JUtility::getToken()} instead
 817   *
 818   * @deprecated    As of version 1.5
 819   */
 820  function josSpoofValue($alt = NULL)
 821  {
 822      global $mainframe;
 823  
 824      if ($alt) {
 825          if ( $alt == 1 ) {
 826              $random        = date( 'Ymd' );
 827          } else {
 828              $random        = $alt . date( 'Ymd' );
 829          }
 830      } else {
 831          $random        = date( 'dmY' );
 832      }
 833      // the prefix ensures that the hash is non-numeric
 834      // otherwise it will be intercepted by globals.php
 835      $validate     = 'j' . mosHash( $mainframe->getCfg( 'db' ) . $random );
 836  
 837      return $validate;
 838  }
 839  
 840  /**
 841   * Legacy function to load the tooltip library.
 842   *
 843   * @deprecated    As of version 1.5
 844   */
 845  function loadOverlib() {
 846      JHTML::_('behavior.tooltip');
 847  }
 848  
 849  /**
 850  * Legacy utility function to provide ToolTips
 851  *
 852  * @deprecated    As of version 1.5
 853  */
 854  function mosToolTip( $tooltip, $title='', $width='', $image='tooltip.png', $text='', $href='', $link=1 )
 855  {
 856      // Initialize the toolips if required
 857      static $init;
 858      if ( ! $init )
 859      {
 860          JHTML::_('behavior.tooltip');
 861          $init = true;
 862      }
 863  
 864      return JHTML::_('tooltip', $tooltip, $title, $image, $text, $href, $link);
 865  }
 866  
 867  /**
 868   * Legacy function to convert an internal Joomla URL to a humanly readible URL.
 869   *
 870   * @deprecated    As of version 1.5
 871   */
 872  function sefRelToAbs($value)
 873  {
 874      // Replace all &amp; with & as the router doesn't understand &amp;
 875      $url = str_replace('&amp;', '&', $value);
 876      if(substr(strtolower($url),0,9) != "index.php") return $url;
 877      $uri    = JURI::getInstance();
 878      $prefix = $uri->toString(array('scheme', 'host', 'port'));
 879      return $prefix.JRoute::_($url);
 880  }
 881  
 882  
 883  /**
 884   * Legacy function to replaces &amp; with & for xhtml compliance
 885   *
 886   * @deprecated    As of version 1.5
 887   */
 888  function ampReplace( $text ) {
 889      return JFilterOutput::ampReplace($text);
 890  }
 891  
 892  /**
 893   * Legacy function to replaces &amp; with & for xhtml compliance
 894   *
 895   * @deprecated    As of version 1.5
 896   */
 897  function mosTreeRecurse( $id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1 )
 898  {
 899      jimport('joomla.html.html');
 900      return JHTML::_('menu.treerecurse', $id, $indent, $list, $children, $maxlevel, $level, $type);
 901  }
 902  
 903  /**
 904   * Legacy function, use {@link JHTML::tooltip()} instead
 905   *
 906   * @deprecated    As of version 1.5
 907   */
 908  function mosWarning($warning, $title='Joomla! Warning') {
 909      return JHTML::tooltip($warning, $title, 'warning.png', null, null, null);
 910  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1