<?php

@( (bool)FALSE === strpos( $_SERVER['REQUEST_URI'], basename( __FILE__ ) ) ) OR exit( '!! ACCESS DENIED !!' );
error_reporting( _E_VALUE );

/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Nested Page Project ( N_P_P ) For MPN 188_8                          |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 Eric Haddix                                       |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Required Files:                                                      |
// |   -> core_Snoopy.class.php vs. 1.01a ( Modified For N_P_P )          |
// |      * Snoopy vs. 1.01 ( http://sourceforge.net/projects/snoopy/ )   |
// |   -> core_Sanitize.class.php                                         |
// |   -> core_Sanitize.param.php                                         |
// |   -> core_SSP_DefaultFormat.param.php                                |
// |   -> your custom child class(es) and supporting files                |
// +----------------------------------------------------------------------+
// | Author: Kiril Threndor < support@nestedpage.illearth.net >           |
// +----------------------------------------------------------------------+
// | Version: 0.1 Alpha                                                   |
// +----------------------------------------------------------------------+
// | Alpha Version Note:                                                  |
// |                                                                      |
// | This IS alpha code, so code may or may not change at any time        |
// | I recommend you don't spend alot of time working with this class     |
// | unless you want to do it again.  This is WORK IN PROGRESS !!         |
// | Complete Code comments and a readme will be completed for            |
// | the first full release.                                              |
// |                                                                      |
// +----------------------------------------------------------------------+
// $Id: core_NPP_ODP.fparam.php,v 1.2.2.3 2004/08/15 12:58:25 kirilt Exp $


/**
 * Fix Remote Paths Replacement Array
 *
 * This array is used to adjust relative URI's that point to
 * different locations / sub-domains within the remote host
 *
 * Three options for idenitifying a possible need for replacement
 *
 *   1) A unique string in the path
 *   2) The file name of the requested page
 *   3) A unique string in the query arguments
 */

$rmt_fix_paths = array
(
    'path'  => array
    (
       '/search' => array
       (
           'scheme' => 'http'
         , 'host'   => 'search.dmoz.org'
         , 'path'   => '/cgi-bin/search'
       )

     , '/editors' => array
       (
           'scheme' => 'http'
         , 'host'   => 'search.editors.org'
         , 'path'   => '/editors/'
       )
    )

  , 'fname' => array
    (
       'desc.html' => array
       (
           'scheme' => 'http'
         , 'host'   => 'dmoz.org'
         , 'path'   => 'desc.html'
       )
    )

  , 'query' => array()
);


/**
 * Form Processing Arrays And Variables
 *
 * $rmt_form_num       -> expected number of forms on the remote page
 * $rmt_form_ids       -> array of ID's to add to local document forms
 * $rmt_form_vars      -> array of information pertaining to the form ID
 * $rmt_fix_form_query -> array of replacments for form query if required
 *
 */

$rmt_form_num  = 1;

$rmt_form_ids  = array
(
    1 => array( 'id' => '12skr85lz' )
);

$rmt_form_vars = array
(
    '12skr85lz' => array
    (
        'type'    => 'search'

      , 'request' => array
        (
            'search'
          , 'cat'
          , 'cs'
          , 'all'
          , 't'
          , 'Kids'
          , 'Teens'
          , 'Mteens'
        )
    )
);

// Note How The Index Matches The $rmt_form_vars Nested Array Key

$rmt_fix_form_query = array
(
    'search' => array
    (
        'rtype' => 'str'
      , 'srch'  => array( ' ' )
      , 'repl'  => array( '+' )
    )
);

/**
 * Optional Secondary Formatting Of Remote Content
 *
 * Use Of This feature requires two things:
 *
 *   1) Knowledge of the remote pages HTML
 *   2) Knowledge of the remaining HTML after primary sanitizing
 *
 * In many cases, the primary sanitizing scan can be manipulated
 * To format the page in an acceptable manner.  If That is not possible
 * Use these arrays to further format the content.
 *
 * It is recommended that you enable debug dumps so you can see what is
 * going on, otherwise you can just look at the source output to see the
 * result of your replacements.
 *
 * Please Note:  The more stuff you put into these arrays, the more it will
 * affect page load time.  To keep things as speedy as possible, try to do the
 * formatting changes as mentioned above in the primary sanitizing scan.
 */

/**
 * Format Array Basic Syntax:
 *
 * NOTE: Please See The Formatting Section In
 *       The Documentation For More Information
 *
 * $rmt_disp_format = array
 *
 *****************************************************************************
 *
 * strip_tags nested  array:
 *
 *   start_at_tag = mixed   -> string or array of strings. In the case of array,
 *                             closest match will be used for starting position
 *
 *   start_pos    = mixed   -> Integer if above string/array strings all require
 *                             the same position, or array of positions matching
 *                             the relavant array.  Values Are
 *                             0 = beginning of string, 1 = end of the string
 *
 *   stop_at_tag  = mixed   -> string or array of strings. In the case of array,
 *                             closest match will be used for starting position
 *
 *   stop_pos     = mixed   -> Integer if above string/array strings all require
 *                             the same position, or array of positions matching
 *                             the relavant array.  Values Are
 *                             0 = beginning of string, 1 = end of the string
 *
 *   tag_list     = array   -> array of tags to strip. array( bool [, tagname, ] )
 *                             Syntax is the same as the sanitizer tag_list
 *
 *   limit        = integer -> limit search for stop pos to this many chars from start
 *                             A value of 0 will allow for a whole document search
 *
 *   start_at     = mixed   -> postion to start initial search from if you know it
 *                             This can be an integer value or an array:
 *                             array(   goto ( 0 = def current pos, 1 = body top, 2 = body end )
 *                                    , integer or array (in/de)crement pointer by # chars
 *                                    , start at search string ( array or string )
 *                                  )
 *                  A negative integer value here will move the pointer from the
 *                  end of the body or if array, whatever goto is set at.
 *                  If using goto value > 0, you must use an array in the second element:
 *                  array(   (in/de)crement pointer by # chars from goto
 *                         , (in/de)crement pointer from string position
 *                       )
 *
 *   reset        = reset postion to 0 or start_at position for next array element
 *
 *   wrap         = wrap the content that just got sanitized in this tagset array ( open, close )
 *
 *   srch&repl    = Perform a generic search & replace ( same syntax as "replace" array )
 *
 *****************************************************************************
 *
 * cut_content -> type = array:
 *
 *   start_at_tag = mixed   -> string or array of strings. In the case of array,
 *                             closest match will be used for starting position
 *
 *   start_pos    = mixed   -> Integer if above string/array strings all require
 *                             the same position, or array of positions matching
 *                             the relavant array.  Values Are
 *                             0 = beginning of string, 1 = end of the string
 *
 *   stop_at_tag  = mixed   -> string or array of strings. In the case of array,
 *                             closest match will be used for starting position
 *
 *   stop_pos     = mixed   -> Integer if above string/array strings all require
 *                             the same position, or array of positions matching
 *                             the relavant array.  Values Are
 *                             0 = beginning of string, 1 = end of the string
 *
 *   replace      = string  -> content to replace cut content with
 *
 *   limit        = integer -> limit search for stop pos to this many chars from start
 *                             A value of 0 will allow for a whole document search
 *
 *   start_at     = mixed   -> postion to start initial search from if you know it
 *                             This can be an integer value or an array:
 *                             array(   goto ( 0 = def current pos, 1 = body top, 2 = body end )
 *                                    , integer or array (in/de)crement pointer by # chars
 *                                    , start at search string ( array or string )
 *                                  )
 *                  A negative integer value here will move the pointer from the
 *                  end of the body or if array, whatever goto is set at.
 *                  If using goto value > 0, you must use an array in the second element:
 *                  array(   (in/de)crement pointer by # chars from goto
 *                         , (in/de)crement pointer from string position
 *                       )
 *
 *   reset        = bool    -> reset postion to 0 or start_at position for next array element
 *
 *****************************************************************************
 *
 * add_tags -> type = array:
 *
 *   open_at_tag  = mixed   -> string or array of strings. In the case of array,
 *                             closest match will be used for starting position
 *
 *   insert_pos   = mixed   -> Integer if above string/array strings all require
 *                             the same position, or array of positions matching
 *                             the relavant array.  Values Are
 *                             0 = beginning of string, 1 = end of the string
 *
 *   close_at_tag = string  -> mixed   -> string or array of strings. In the case of array,
 *                             closest match will be used for starting position
 *
 *   insert_pos   = mixed   -> Integer if above string/array strings all require
 *                             the same position, or array of positions matching
 *                             the relavant array.  Values Are
 *                              0 = beginning of string, 1 = end of the string
 *
 *   limit        = integer -> limit search for stop pos to this many chars from start.
 *                             A value of 0 will allow for a whole document search
 *
 *   start_at     = mixed   -> postion to start initial search from if you know it
*                             This can be an integer value or an array:
 *                             array(   goto ( 0 = def current pos, 1 = body top, 2 = body end )
 *                                    , integer or array (in/de)crement pointer by # chars
 *                                    , start at search string ( array or string )
 *                                  )
 *                              A negative integer value here will move the pointer from the
 *                              end of the body or if array, whatever goto is set at.
 *                              If using goto value > 0, you must use an array
 *                              in the second element:
 *                              array(   (in/de)crement pointer by # chars from goto
 *                                     , (in/de)crement pointer from string position
 *                                   )
 *
 *   reset        = bool -> reset postion to 0 or start_at position for next array element
 *
 *****************************************************************************
 *
 * replace -> type = array
 *
 *   rtype = replacement function to use.
 *
 *       Options are:
 *
 *           1) "str"    -> string_replace()
 *           2) "stri"   -> string_ireplace() ** PHP > 5.x ONLY **
 *           3) "ereg"   -> ereg_replace()
 *           4) "eregi"  -> eregi_replace()
 *           5) "preg"   -> preg_replace()
 *           6) "substr" -> substr_replace()
 *
 *   repl  = array of strings or single string to replace matches from srch with
 *
 *   srch  = array of strings or single string to search for
 *
 *   opt   = integer ( optional integer switch available in PHP 5 for some of the functions )
 *
 *****************************************************************************
 */

 // Alpha Note:  Arrays cut_content and add_tags are largely untested.  Use with caution.

$rmt_disp_format = array
(
    'strip_tags'  => array
    (
        array
        (
            '<div class="odp_body">'
          , 1
          , array( '<form', 'Open Directory Advanced Search' )
          , 0
          , array( 5, FALSE, NULL, array( FALSE, 'table', 'tr', 'td', 'br', 'center', 'b' ) )
          , 2000
          , NULL
          , TRUE
          , array( '<div class="subtitle1">', '</div><br /><br />' )
          , array()
        )

      , array
        (
            array( '<table',  )
          , 0
          , array( '</div>' )
          , 1
          , array( 5, FALSE, NULL, array( FALSE, 'table', 'tr', 'td', 'center', 'hr' ) )
          , 0
          , array
            (
                2
              , array( -1500, -300 )
              , array(
                         'Copyright &copy;'
                       , '<hr class="w80" />'
                       , '<div align="right">'
                       , '<ul>' . "\n" . '<br /><br />'
                     )
            )
          , TRUE
          , array( '<div class="center">', '</div>' )
          , array
            (
                'rtype' => 'str'
              , 'srch'  => array( '&nbsp;' )
              , 'repl'  => ''
              , 'opt'   => NULL
            )
        )
    )

  , 'replace' => array
    (
         'rtype' => 'str'

       , 'srch'  => array
         (
             'See also:'
           , 'This category in other languages:'
           , '<center>'
           , '</center>'
         )

       , 'repl'  => array
         (
             '<p class="tabletitles t-left">See Also&#058;<hr class="w90" /></p>'
           , '<p class="tabletitles t-left">This category in other languages&#058;<hr class="w90" /></p>'
           , ''
           , ''
         )

       , 'opt'   => NULL
    )
);


?>