Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for phpPlatonLib/Platon/Platon.php between version 1.40 and 1.41

version 1.40, 2017/11/08 00:28:30 version 1.41, 2017/11/08 00:33:44
Line 25 
Line 25 
  * @access      public   * @access      public
  */   */
   
 /* $Platon: Metafox/lib/Platon.php,v 1.11 2015/01/20 15:20:17 igor Exp $ */  /* $Platon: phpPlatonLib/Platon/Platon.php,v 1.40 2017/11/08 00:28:30 nepto Exp $ */
   
 class Platon  class Platon
 {  {
Line 158  class Platon
Line 158  class Platon
      * @param   boolean $temporary  if such redirect is only temporary one       * @param   boolean $temporary  if such redirect is only temporary one
      * @todo    implement HTML page redirecting if output was aleady sent       * @todo    implement HTML page redirecting if output was aleady sent
      */       */
     function redirect($where, $temporary = false) /* {{{ */      static function redirect($where, $temporary = false, $status_code = 301) /* {{{ */
     {      {
         $url = '';          $url = '';
         if (! strncmp($where, "ftp://", 6)          if (! strncmp($where, "ftp://", 6)
Line 183  class Platon
Line 183  class Platon
   
         header('Location: '.$url);          header('Location: '.$url);
         if (! $temporary) {          if (! $temporary) {
             header('HTTP/1.1 301 Moved Permanently');              switch($status_code) {
                   case 303:
                       header('HTTP/1.1 303 See Other');
                       break;
                   case 302:
                       header('HTTP/1.1 302 Found');
                       break;
                   case 301:
                   default:
                       header('HTTP/1.1 301 Moved Permanently');
                       break;
               }
         }          }
         exit;          exit;
     } /* }}} */      } /* }}} */
Line 561  class Platon
Line 572  class Platon
 # }}}  # }}}
   
     /**      /**
        * Insert element into array on specific index.
        *
        * @param   array   $arr       input array
        * @param   int     $index     position in array
        * @param   mix     $element   inserted element
        * @return  array              output array
        */
       static function array_insert($arr, $index, $element)
       {
           if (!is_array($arr)) {
               return false;
           }
           $index = intval($index);
           if ($index > count($arr)-1) {
               array_push($arr, $element);
               return $arr;
           }
           $before = array_splice($arr, 0, $index);
           array_push($before, $element);
           return array_merge($before, $arr);
       }
   
       /**
      * Returns english grammar related number.       * Returns english grammar related number.
      *       *
      * @param   int     $number intput number       * @param   int     $number intput number

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top