|   | 
    
      
     | 
    
      
        
          
  
     | 
    
         
      
              
              Software Development Kits 
         | 
     | 
   
  
     | 
     
       Overview 
      General Variables 
      General Functions 
      API Example 
        
        
         | 
     | 
   
  
     | 
    
       
     | 
     | 
   
  
     | 
    Overview | 
     | 
   
  
     | 
    
       The software is designed
      with developer view in mind. Developers can easily create their own
      functions and integrate it directly to the software using the very
      powerful and popular language Perl. All the general program variables and
      functions are available for use in your newly create functions and
      subroutines.  
      It is also very easy to
      integrate directly your current applications into the software using the
      built in SSI Classes. 
      If you are a developer and
      writing an API for this system then these information will help you
      interface your code with the system easily. If you need more information
      about others functions, please contact our developers. Please be sure to
      provide as much information as possible about your application and your
      needs so we can help you as much as we can. 
      If you created your custom
      application and would like to share others for free, please send your
      application to us with full documentations, all your copyright will be
      kept on your code. 
         | 
     | 
   
  
     | 
    
       
     | 
     | 
   
  
     | 
    General
      Variables | 
     | 
   
  
     | 
    Table (1) shows the general
      variables available for use in your functions and applications.
          | 
     | 
   
  
     | 
    
      
        
          | Variable | 
          Meaning | 
         
        
          | $Global{CGI_Dir} | 
           This is the full absolute path to the executables directory. | 
         
        
          | $Global{CGI_URL} | 
           This is the full URL to the executables directory. | 
         
        
          | $Global{HTML_Dir} | 
           This is the full absolute path to the non executables (html or docs) directory. | 
         
        
          | $Global{HTML_URL} | 
           This is the full URL to the non executables (html or docs) directory. | 
         
        
          | 	$Global{SSL_URL} | 
          Secure Socket Layer full
            URL. | 
         
        
          | 	$Global{SSL_Status} | 
          Secure Socket Layer
            status. Value zero means not enabled, else means enabled. | 
         
        
          | 	$Global{SSL_Images_URL} | 
          Full URL of the images
            directory on the Secure Socket Layer server. | 
         
        
          | $Script_URL | 
          This variable holds the
            current running program full URL. | 
         
        
          | $Global{DB_Driver} | 
          SQL driver. | 
         
        
          | $Global{DB_Host} | 
          SQL hostname. | 
         
        
          | $Global{DB_Name}  | 
          SQL database name. | 
         
        
          | $Global{DB_UserID} | 
          SQL username. | 
         
        
          | $Global{DB_Password} | 
          SQL password. | 
         
        
          | 	$Global{Language} | 
          Current language selected
            by the user. | 
         
        
          | 	$Global{Admin_UserID}  | 
          Admin User ID. | 
         
        
          | 	$Global{Admin_Password} | 
          Admin Password. | 
         
        
          | $Global{Data_Dir} | 
           This is the full absolute path to
            data directory. | 
         
        
          | $Global{Lock_Dir} | 
           This is the full absolute path to
            lock directory. | 
         
        
          | $Global{Custom_Dir} | 
           This is the full absolute path to
            lib directory. | 
         
        
          | $Global{Mail_Lists_Dir} | 
           This is the full absolute path to
            maillists directory. | 
         
        
          | $Global{Database_Dir} | 
           This is the full absolute path to
            database directory. | 
         
        
          | $Global{Temp_Dir} | 
           This is the full absolute path to
            temp directory. | 
         
        
          | $Global{Template_Dir} | 
           This is the full absolute path to
            templates directory. | 
         
        
          | $Global{Images_URL} | 
           This is the full URL to
            images directory. | 
         
        
          | $Global{Upload_Dir} | 
           This is the full absolute path to
            upload directory. | 
         
        
          | $Global{Download_Dir} | 
           This is the full absolute path to
            download directory. | 
         
        
          | $Global{Upload_URL} | 
           This is the full URL to
            upload directory. | 
         
        
          | %Param | 
          
             This hash array
            contains all the arguments passed to the current program runing. For
            example $Param{action} specifies the action required to be done from
            the program. 
            To view all the parameters, you can scan the hash with a code like
            this line: 
            print "Content-type: text/html\n\n"; 
            while (($key, $value)=each(%Param)) {print ("$key =  $value<br>");} 
               | 
         
        
          | $Param{action} | 
          
             This variable
            specifies the current action required from the program to execute.
            This variable is passed to the programs in the following format in
            the browser: 
            http://www.domain.com/cgi-bin/admin?action=Accounts_Manager. 
            You can check the
            current action required if you want to execute some functions at
            specific actions. For example: 
            if ($Param{action} eq "Browse_Categories"){ 
              &My_Browse_Categories_Action; 
            } 
            elsif ($Param{action} eq "Browse"){ 
              &My_Browse_Action; 
            } 
             
               | 
         
        
          | %Language | 
          
             This hash array
            contains all the language variables of the current user default
            language required for the current action. With each action, only
            specific language file are loaded. You can load other files, see the
            general functions available. Hash keys are the language variables
            names, and the hash values are the language variables text. For
            example $Language{Site_Name}="Mewsoft".  | 
         
        
          | %Global | 
          
             This hash array
            contains all the program global variables. These are the variables
            in the files startup.ini and sysconfig.ini. Each line in these files
            in the form: 
            key~==~value, file sysconfig.ini 
            key=value, file startup.ini 
            for example: 
            Admin_Prog=admin.exe, here the key
            is $Global{Admin_Prog} and its value is "admin.exe". 
             
            Category_Teaser_Form~==~<FONT SIZE="1" ><!--Teaser--> <!--Teaser_Category_Count--></FONT> 
            The key here is $Globale{Category_Teaser_Form}
            and its value is the html string "<FONT SIZE="1" ><!--Teaser--> <!--Teaser_Category_Count--></FONT>". 
            Please view the files startup.ini
            and sysconfig.ini for any variables you may need in your custom
            functions.  | 
         
        
          | %Cookies | 
          
             This hash array
            contains all the cookies available for the current running program.
            Hash keys are cookies names and hash values are cookies values. For
            example: 
            $Cookie{User_User_ID} 
            $Cookie{User_Password} 
            $Cookie{User_Remember_login} 
            are current the user login
            information. 
               | 
         
       
     | 
     | 
   
  
     | 
    
        
      Table (1) General variables. 
         | 
     | 
   
  
     | 
    
       
     | 
     | 
   
  
     | 
    General
      Functions | 
     | 
   
  
     | 
    Table (2) shows the general
      functions available for use in your functions and applications.
          | 
     | 
   
  
     | 
    
      
        
          | Function | 
          Meaning | 
         
        
          | @Languages
            = &Get_Languages(); | 
           | 
         
        
          | %User = &Get_User($User_ID); | 
            | 
         
        
          | $Status=&Check_User_Exist($User_ID); | 
          Returns 1 if user exists,
            0 if not. | 
         
        
          | $Status=&Check_Email_Exist($Email); | 
          Returns 1 if email
            exists, 0 if not. | 
         
        
          | $Status=&Check_User_Authentication($User_ID,
            $Password); | 
          Returns 1 if user login
            correct, 0 if not. | 
         
        
          | &Exit($Error_Message,
            $Error_Title, $Go_Back_Level); | 
          
             Quit the program
            safely by disconnecting from MySQL server and display the error
            message $Error_Message with the title $Error_Title. The $Go_Back_Level
            is an integer variable -x to +x for the go back browser button
            emulation displayed on the message.  | 
         
        
          | &Quit(); | 
          Safely disconnect from
            MySQL server if connected and exit the program. | 
         
        
          | &Read_Language_File($Language_Filename); | 
          
             This will load and
            parse the language file in the variable $Language_Filename into the
            general hash array %Language. You can load any number of language
            files and all will be loaded into the same %Language hash array. You
            must pass the full path name of the file to the function.  | 
         
        
          | %Lang=&Get_Language_File($Language_Filename); | 
          
             This function will
            load and parse the language file in the variable $Language_Filename
            into the hash array %Lang and not to the general hash array
            %Language. You must pass the full path name of the file to the
            function.  | 
         
        
          | $Template_File=&Translate_File($Template_Filename); | 
          
             This function will
            translate all the language variables in the file specified in the
            variable $Template_Filename by replacing the language variables by
            their text values. You must pass the full path name of the file to
            the function.  | 
         
        
          | $Text
            = &Translate($Text); | 
          
             This function will
            translate all the language variables in the string variable
            specified in the variable $Text passed to the function.  | 
         
       
     | 
     | 
   
  
     | 
    
       Table (2) General
      functions. 
         | 
     | 
   
  
     | 
    
       
     | 
     | 
   
  
     | 
    API
      Example | 
     | 
   
  
     | 
    
       To create your own
      functions. From your admin center, click on "Custom Functions"
      link in the navigation. This will open the function editor. First, create
      a filename for your function or functions. Enter a filename in the box
      "Create new file" and click the "submit" button. Now
      the editor will create a new empty file and open it in the editor so you
      can enter your code. You can also edit any existing files. 
      Write your functions in
      the normal way as you write your own Perl programs. You can used inside
      your functions any general variable or function available for your
      applications from the system. You easily have full access to the system
      configuration and setup also. 
      This way you can create
      your own applications that is independent in operation, or special Classes
      that can be used inside the program itself. 
      The general format for
      calling custom classes or functions in the templates and language files as
      follows: 
       <!--CLASS::Custom:filename:function_name(param1,param2,...)--> 
      For example, if you
      created a custom functions file with the name "jokes", and you
      want to use the function "get_today_joke" inside this file, then
      you need to insert the class in your templates or language files as
      follows: 
       <!--CLASS::Custom:jokes:get_today_joke--> 
      You can use unlimited
      functions inside the same custom functions file. This means each file is a
      library for functions but you have to specify the filename of the function
      in the class so the program only will load the required library files. 
      The simple layout for your custom
      functions is: 
      sub My_Function{ 
      my($Param) = @_; 
      my ($Out); 
       
          $Out = "This is My_Function output"; 
       
          return $Out; 
      } 
      Save this to a custom file name
      "test" 
      Now inserting the class <!--CLASS::Custom:test:My_Function-->
      in your templates or language files, will result in replacing this class
      with the function return value "This is My_Function output" at
      the program run time. 
      By default custom
      functions files have the extension ".pm". You can create your
      own file and test the code in your debugger, then place the files in the
      "data/lib" directory. 
        | 
     | 
   
  
     | 
    
       The code below is saved in
      the file "url_grab.pm" in the "data/lib" directory.
      This file is a good example for creating your custom functions and
      libraries. The file contain more than one function. 
         | 
     | 
   
  
     | 
    =Copyright Infomation 
      ========================================================== 
                                                   Mewsoft  
    Program Author   : Elsheshtawy, A. A. 
    Home Page          : http://www.mewsoft.com 
	Copyrights © 2001-2002 Mewsoft. All rights reserved. 
      ========================================================== 
 This software license prohibits selling, giving away, or otherwise distributing  
 the source code for any of the scripts contained in this SOFTWARE PRODUCT, 
 either in full or any subpart thereof. Nor may you use this source code, in full or  
 any subpart thereof, to create derivative works or as part of another program  
 that you either sell, give away, or otherwise distribute via any method. You must 
 not (a) reverse assemble, reverse compile, decode the Software or attempt to  
 ascertain the source code by any means, to create derivative works by modifying  
 the source code to include as part of another program that you either sell, give 
 away, or otherwise distribute via any method, or modify the source code in a way 
 that the Software looks and performs other functions that it was not designed to;  
 (b) remove, change or bypass any copyright or Software protection statements  
 embedded in the Software; or (c) provide bureau services or use the Software in 
 or for any other company or other legal entity. For more details please read the 
 full software ID agreement file distributed with this software. 
      ========================================================== 
              ___                         ___    ___    ____  _______ 
  |\      /| |     \        /\         / |      /   \  |         | 
  | \    / | |      \      /  \       /  |     |     | |         | 
  |  \  /  | |-|     \    /    \     /   |___  |     | |-|       | 
  |   \/   | |        \  /      \   /        | |     | |         | 
  |        | |___      \/        \/       ___|  \___/  |         | 
       
      ========================================================== 
      =cut 
      #========================================================== 
      # To use this class in your templates, insert the class like this: 
      # <!--CLASS::Custom:url_grab:URL_Include(http://yahoo.com)--> 
      sub URL_Include { 
      my ($URL) = @_; 
      my($UA); 
      my($Parse, $Response, $Base, $Result); 
       
	undef @HREFs; 
	use HTML::LinkExtor; 
	use URI::URL; 
       
	$UA = new LWP::UserAgent; 
	$UA->agent('Mewsoft Search Engine mewsoft.com'); 
       
	$Parse = HTML::LinkExtor->new(\&Call_Back); 
	$Response = $UA->request(HTTP::Request->new(GET => $URL)); 
	$Base = $Response->base; 
	$Result = $Response->content; 
       
	$Parse->parse($Result); 
       
	@HREFs = map { [$_->[0], $_->[1], url($_->[1], $Base)->abs] } @HREFs; 
       
	foreach my $HRef (@HREFs){ 
				my $Name = $HRef->[0]; 
				my $Value = $HRef->[1]; 
				my $All = $HRef->[2]; 
				$Result =~ s|$Name\s*=\s*"?$Value"?|$Name="$All"|igs; 
	} 
       
	return $Result; 
      } 
      #========================================================== 
      # To use this class in your templates, insert the class like this: 
      # <!--CLASS::Custom:url_grab:URL_Clip_Include(http://yahoo.com, Local, Americas)--> 
      sub URL_Clip_Include{ 
      my ($Input_Line) = @_; 
      my ($URL, $Start, $End, $UA, $Full_HRef); 
      my($Result); 
       
	undef @HREFs; 
	undef $Result; 
	use HTML::LinkExtor; 
	use URI::URL; 
       
	($URL, $Start, $End)= split (/\s*\,\s*/, $Input_Line); 
       
	$UA = new LWP::UserAgent; 
	$UA->agent('Mewsoft Search Engine mewsoft.com'); 
       
	my $Parse = HTML::LinkExtor->new(\&Call_Back); 
	my $Response = $UA->request(HTTP::Request->new(GET => $URL)); 
	my $Base = $Response->base; 
	$Result = $Response->content; 
	$Parse->parse($Result); 
       
	@HREFs = map { [$_->[0], $_->[1], url($_->[1], $Base)->abs] } @HREFs; 
       
	if ($Result =~ m|($Start.*$End)|s)	{ 
			$Result = $1; 
	} 
	else{ 
			return ""; 
	} 
       
	for my $HRef (@HREFs){ 
				my $Name = $HRef->[0]; 
				my $Value = $HRef->[1]; 
				my $Full_HRef = $HRef->[2]; 
				$Result =~ s|$Name\s*=\s*"?$Value"?|$Name="$Full_HRef"|igs; 
	} 
       
	return $Result; 
       
      } 
      #========================================================== 
      sub Call_Back { 
      my($Tag, %Attr) = @_; 
       
	while (my ($K, $V) = each %Attr) { 
				next if $K eq 'usemap'; 
				push(@HREFs, [$K, $V]); 
	} 
      } 
      #========================================================== 
      1; | 
     | 
   
  
     | 
    
       
     | 
     | 
   
  
     | 
     | 
     | 
   
 
 | 
         
       
     | 
      |