Login   Register  
PHP Classes
elePHPant
Icontem

File: curl.inc

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jorge Machin  >  REF  >  curl.inc  >  Download  
File: curl.inc
Role: ???
Content type: text/plain
Description: Main class
Class: REF
Author: By
Last change:
Date: 2002-01-21 18:51
Size: 8,163 bytes
 

Contents

Class file image Download
<?php 
    
   /*  ------------------------------------------------------------------------
         Módulo : curl.inc ( clase REF ) 
         Autor  : Jorge Renato Machin Ibarra 
         Inicio : Septiembre 24 de 1998 
         Final  : Septiembre 25 de 1998       
       -----------------------------------------------------------------------
   */ 
 
   class REF { 
 
      var $Arr; 
      var $Ext;
      var $Border;
      var $Debug;

      function REF( $preserve = 'S',  $extension = '.php3' ) {

          $Border = 0;

          if ( $preserve == 'S' )

            $this -> preserve( 'lid' );

          $this -> Ext = $extension;

      }
 
      // ----------------------------------------------------------------------- 
      //   
      // ----------------------------------------------------------------------- 
 
      function preserve( $CurlVar0 = "CURL-NULL", $CurlVar1 = "CURL-NULL",  
                         $CurlVar2 = "CURL-NULL", $CurlVar3 = "CURL-NULL", 
                         $CurlVar4 = "CURL-NULL", $CurlVar5 = "CURL-NULL", 
                         $CurlVar6 = "CURL-NULL", $CurlVar7 = "CURL-NULL", 
                         $CurlVar8 = "CURL-NULL", $CurlVar9 = "CURL-NULL" )  
      { 

         $curr = "CurlVar0";          

         for ( $i = 0 ; $i < 10 && $$curr != "CURL-NULL"; $i++, $curr = "CurlVar".$i ) 

            $this->Arr[ $$curr ] = $$curr;

       
      } 


      // ----------------------------------------------------------------------- 
      //   
      // ----------------------------------------------------------------------- 
 

      function unpreserve( $CurlVar0 = "CURL-NULL", $CurlVar1 = "CURL-NULL",  
                           $CurlVar2 = "CURL-NULL", $CurlVar3 = "CURL-NULL", 
                           $CurlVar4 = "CURL-NULL", $CurlVar5 = "CURL-NULL", 
                           $CurlVar6 = "CURL-NULL", $CurlVar7 = "CURL-NULL", 
                           $CurlVar8 = "CURL-NULL", $CurlVar9 = "CURL-NULL") 
      {

         $curr = "CurlVar0";          

         for ( $i = 0 ; $i < 10 && $$curr != "CURL-NULL"; $i++, $curr = "CurlVar".$i ) 
     
             unset( $this->Arr[ $$curr ] );
       
      } 


      // ----------------------------------------------------------------------- 
      //   
      // ----------------------------------------------------------------------- 

      function unpreserveAll() {

         reset( $this -> Arr );

         while( $Actual = Next( $this-> Arr ) ) 

            if ( !( $Actual == "lid" || $Actual == "Pid" ) )

               unset( $this->Arr[$Actual] );

      }


      // ----------------------------------------------------------------------- 
      //   
      // ----------------------------------------------------------------------- 
 

      function ispreserved( $CurlVar ) {

         return isset( $this->Arr[$CurlVar] );

      }
  

      // ----------------------------------------------------------------------- 
      //   
      // ----------------------------------------------------------------------- 

      function GetParams() {

         global $umbCache;

         //  Declara las variables globales:

         if ( empty ( $this -> Arr ) ) 

            $elements = 0;

         else 

            $elements = count( $this -> Arr );
         

         if ( !is_array( $this -> Arr)  ) 

            return;

         reset( $this -> Arr );

         do {

            $Curlvar = current( $this -> Arr );

            global $$Curlvar;

            if ( ( strval (  $$Curlvar ) != "" ) || ( gettype( $$Curlvar ) == "array") ) {

               if ( $param != "" )

                  $param .= "&";

               if (  gettype( $$Curlvar ) == "array" ) 

                  $param .= $Curlvar . "[]=";
                  
               else {

                  $param .= "$Curlvar" . "=";


                  if ( $umbCache == "S" && $Curlvar == 'pid' ) 

                     $param .= urlencode('umbPid'); 

                  else

                     $param .= urlencode( $$Curlvar );


               }

            }

         } while( next( $this-> Arr ) );
         

         if ( $param != "" )

            $param = "?" . $param;

         return $param;

      }

 
      // ---------------------------------------- 
      //  chidden
      // ---------------------------------------- 
 
      function chidden() { 
 
         global $umbCache;
 
         //  Declara  las variables globales:      
 
         if ( empty( $this->Arr ) ) 
 
            $elements = 0; 
 
         else 
 
            $elements = count( $this->Arr ); 
 

         if ( !is_array( $this -> Arr)  ) 

            return;

         reset( $this -> Arr );

         do {
 
            $var = current( $this->Arr ); 
 
            global $$var; 
  
            if ( $$var != "" || gettype( $$var ) == "array" ) {

               echo( "<INPUT TYPE=\"HIDDEN\" NAME=\"$var");

               if (  gettype( $$var ) == "array" ) 

                   echo( "[]\" VALUE=\"" );
                  
               else {

                   echo( "\" " . "VALUE=\"" );

                   if ( $umbCache == "S" && $var == "pid" )                   

                      echo 'umbPid';

                   else

                      echo $$var;

               }

               echo( "\">\n"); 
 
            }

         } while( next( $this-> Arr ) );
 
      } 


      // ---------------------------------------- 
      //  clocation
      // ---------------------------------------- 
 
      function clocation( $path ) {     
       
         header("Location: ".$path.$this->GetParams());
           
      }



      // ---------------------------------------- 
      //  curl
      // ---------------------------------------- 
 
      function curl( $path, $msg, $extras = "" ) {     
  
         global $umbCache;

         $pres =  $this->GetParams();

         if  ( $pos = strpos( $path, '#' ) ) {

            $gato = substr( $path, $pos, strlen( $path ) - $pos );
            $path = substr( $path, 0, $pos );

         }

         if ( $pos = strpos( $path, '?' ) ) {

            $quest = substr( $path, $pos, strlen( $path ) - $pos );
            $path = substr( $path, 0, $pos );
            $pres = "&" . substr( $pres, 1, strlen( $pres ) ); 

         }
   

         echo "<A HREF=\"$path$quest$pres$gato\"";
        
         if ( $extras != "" )
        
            echo(" $extras ");
        
         echo( " >$msg</A>" ); 
           
      }


      // ---------------------------------------- 
      //  gurl
      // ---------------------------------------- 
 
      function gurl( $path, $imgPath, $msg = "", $width = "", $height = "", $extras = "" ) {     

  
         if ( $pos = strpos( $path, '?' ) ) {

            $quest = substr( $path, $pos, strlen( $path ) - $pos );
            $path = substr( $path, 0, $pos );
            $pres = "&" . substr( $pres, 1, strlen( $pres ) ); 

         }
   

         echo "<A HREF=\"$path$quest$pres$gato\"";


         if ( $extras != "" )
        
            echo(" $extras ");
        
         echo( ">" ); 
         echo( "<img src=\"".$imgPath."\" BORDER=\"".$this->Border."\" ALT=\"$msg\" " );

         if ( $width != "" )
        
            echo(" WIDTH=\"$width\"");

         if ( $height != "" )
        
            echo(" HEIGHT=\"$height\"");

         echo( ">" ); 
         echo( "</A>" ); 
           
      } 

      // ---------------------------------------- 
      //  Area
      // ---------------------------------------- 
 
      function carea( $shape, $coords, $path, $msg ) {     
 
         echo( "<AREA SHAPE = \"$shape\" COORDS = \"$coords\" HREF=\"$path" ); 
         echo( $this->GetParams() . "\" ALT = \"" . $msg . "\">\n" ); 
           
      }

  } 
 

?>