seoBase
$GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlMultiField'] -> seoBaseHook();

tplHeader
if( $GLOBALS['block_keys']['geo_filter_block'] )
            {
             if( $GLOBALS['config']['mf_geo_block_autocomplete'] )
             {
                 echo '<script type="text/javascript" src="'.RL_PLUGINS_URL.'multiField/static/jquery.geo_autocomplete.js"></script>';
             }

               echo '<link href="'.RL_PLUGINS_URL.'multiField/static/style.css" type="text/css" rel="stylesheet" />';
            }

apPhpDataFormatsBottom
if( $GLOBALS['rlDb'] -> getOne( "Key", "`Key` = '".$_GET['format']."'", 'multi_formats' ) && $_GET['mode'] == 'manage')
            {
             $GLOBALS['reefless'] -> redirect(array("controller" => 'multi_formats', 'parent' => $_GET['format'] ));
           }

apPhpFormatsAjaxDeleteFormatPreDelete
global $id;

         $GLOBALS['reefless']->loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlMultiField']->deleteDF($id);

tplListingFieldSelect
$GLOBALS['rlSmarty'] -> display( RL_PLUGINS . 'multiField' . RL_DS . 'mf_block.tpl' );

tplSearchFieldSelect
$GLOBALS['rlSmarty'] -> display( RL_PLUGINS . 'multiField' . RL_DS . 'mf_block.tpl' );

tplRegFieldSelect
$GLOBALS['rlSmarty'] -> display( RL_PLUGINS . 'multiField' . RL_DS . 'mf_block_account.tpl' );

tplProfileFieldSelect
$GLOBALS['rlSmarty'] -> display( RL_PLUGINS . 'multiField' . RL_DS . 'mf_block_account.tpl' );

apPhpFieldsAjaxDeleteField
global $field;
         if( !$field['Key'] && $field['ID'] )
          {
             $field['Key'] = $GLOBALS['rlDb'] -> getOne('Key', "`ID` = '{$field['ID']}'", 'listing_fields');
           }
         $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlMultiField'] -> deleteFieldChildFields($field['Key'], 'listing');

apPhpFieldsAjaxDeleteAField
global $id;
           $key = $GLOBALS['rlDb'] -> getOne('Key', "`ID` = '{$id}'", 'account_fields');
         $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlMultiField'] -> deleteFieldChildFields($key, 'account');

apPhpListingFieldsTop
$sql ="SELECT `T1`.`Condition` FROM `".RL_DBPREFIX."listing_fields` AS `T1` ";
          $sql .="JOIN `".RL_DBPREFIX."multi_formats` AS `T2` ON `T2`.`Key` = `T1`.`Condition` ";
           $sql .="WHERE `T1`.`Key` = '".$_GET['field']."' AND `T1`.`Key` REGEXP 'level[0-9]' ";
           global $disable_condition;
            $disable_condition = $GLOBALS['rlDb'] -> getRow($sql);

apTplFieldsFormBottom
if( $GLOBALS['disable_condition'] )
           {
             echo '<script type="text/javascript">$(document).ready(function(){';
                echo "$('#dd_select_block').attr('disabled', 'disabled').addClass('disabled');";
              echo "$('#dd_select_block').after('<input ";
               echo 'type="hidden" name="data_format" value="'.$GLOBALS['disable_condition']['Condition'].'"';
               echo "/>');";
                echo '})</script>';
         }

apPhpAccountFieldsTop
$sql ="SELECT `T1`.`Condition` FROM `".RL_DBPREFIX."account_fields` AS `T1` ";
          $sql .="JOIN `".RL_DBPREFIX."multi_formats` AS `T2` ON `T2`.`Key` = `T1`.`Condition` ";
           $sql .="WHERE `T1`.`Key` = '".$_GET['field']."' AND `T1`.`Key` REGEXP 'level[0-9]'";
            global $disable_condition;
            $disable_condition = $GLOBALS['rlDb'] -> getRow($sql);

apPhpListingFieldsBeforeEdit
global $f_data, $rlDb;

         $current_format = $rlDb -> getOne("Condition", "`Key` = '".$f_data['key']."'", 'listing_fields');

         $old_multi = $rlDb -> getOne("Key", "`Key` = '".$current_format."'", 'multi_formats');
            $new_multi = $rlDb -> getOne("Key", "`Key` = '".$f_data['data_format']."'", 'multi_formats');

         $f_data['key'] = $GLOBALS['e_key'];

         if( $new_multi && !$old_multi ) //field condition changed to multiformat condition - we should add subfields for the field.
           {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> createSubFields( $f_data, 'listing' );
            }elseif( $old_multi && !$new_multi )
          {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> deleteSubFields( $f_data, 'listing' );
            }elseif( $old_multi && $new_multi && $old_multi != $new_multi)
            {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> deleteSubFields( $f_data, 'listing' );
                $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> createSubFields( $f_data, 'listing' );
            }

apPhpAccountFieldsBeforeEdit
global $f_data, $rlDb;

         $current_format = $rlDb -> getOne("Condition", "`Key` = '".$f_data['key']."'", 'account_fields');

         $old_multi = $rlDb -> getOne("Key", "`Key` = '".$current_format."'", 'multi_formats');
            $new_multi = $rlDb -> getOne("Key", "`Key` = '".$f_data['data_format']."'", 'multi_formats');
           $f_data['key'] = $GLOBALS['e_key'];
           if( $new_multi && !$old_multi ) //field condition changed to multiformat condition - we should add subfields for the field.
           {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> createSubFields( $f_data, 'account' );
            }elseif( $old_multi && !$new_multi )
          {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> deleteSubFields( $f_data, 'account' );
            }elseif( $old_multi && $new_multi && $old_multi != $new_multi)
            {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> deleteSubFields( $f_data, 'account' );
                $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlMultiField'] -> createSubFields( $f_data, 'account' );
            }

adaptValueBottom
global $multi_formats;

         /*$param1 = $value; $param2 = $field, $out = param3;*/

          if (!$GLOBALS['lang']['data_formats+name+'.$param1] && strpos($param2['Key'],'_level') !== false) {
               $out = $GLOBALS['rlDb'] -> getOne('Value', "`Key` = 'data_formats+name+".$param1."' AND `Code` = '".RL_LANG_CODE."'",'lang_keys');
              if ($out) {
                   $GLOBALS['lang']['data_formats+name+'.$param1] = $out;
                    $param3 = $out;
               }
         }

pageinfoArea
global $page_info;

         if( in_array($page_info['Controller'], array('add_listing', 'edit_listing', 'home', 'listing_type', 'search', 'registration', 'profile', 'account_type','listings_by_field', 'compare_listings', 'recently_added', 'my_listings', 'search_map')) )
            {
             global $multi_formats;

              if( $_GLOBALS['config']['mf_cache_client'] && $_SESSION['multi_formats'] )
              {
                 $multi_formats = $_SESSION['multi_formats'];
                }else
             {
                 $sql = "SELECT `T1`.*, `T2`.`Order_type` FROM `".RL_DBPREFIX."multi_formats` AS `T1` ";
                   $sql .="JOIN `".RL_DBPREFIX."data_formats` AS `T2` ON `T2`.`Key` = `T1`.`Key` ";
                  $sql .="WHERE `T1`.`Status` = 'active'";
                    $mf_tmp = $GLOBALS['rlDb'] -> getAll($sql);

                   foreach( $mf_tmp as $key => $item )
                   {
                     $multi_formats[ $item['Key'] ] = $item;
                 }
                 unset($mf_tmp);

                 if( $_GLOBALS['config']['mf_cache_client'] )
                  {
                     $_SESSION['multi_formats'] = $multi_formats;
                    }
             }
             
              $GLOBALS['rlSmarty'] -> assign( 'multi_formats', $multi_formats );
            }

specialBlock
global $page_info;

         if( in_array($page_info['Controller'], array('add_listing', 'edit_listing', 'home', 'listing_type', 'search', 'registration', 'profile', 'account_type', 'my_listings', 'search_map')) )
            {
             global $rlSmarty;

               $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $GLOBALS['rlXajax'] -> registerFunction( array( 'mfGetNext', $GLOBALS['rlMultiField'], 'ajaxGetNext' ) );
             $GLOBALS['rlXajax'] -> registerFunction( array( 'mfBuild', $GLOBALS['rlMultiField'], 'ajaxBuild' ) );

               if( in_array($_POST['xjxfun'], array('ajaxGetNext', 'ajaxBuild' ) ) )
               {
                 $GLOBALS['rlXajax'] -> processRequest();
                    exit;
             }
         }

           if( $GLOBALS['geo_format'] )
            {
                global $geo_filter_data;
                foreach ($geo_filter_data['location'] as $key => $item) {
                    if ($item && !$item['name']) {
                        $geo_filter_data['location'][$key]['name'] = $GLOBALS['lang']['data_formats+name+'.$item['Key'] ] ?
                         $GLOBALS['lang']['data_formats+name+'.$item['Key'] ]
                        : $GLOBALS['rlDb'] -> getOne("Value", "`Key` = 'data_formats+name+".$item['Key']."' AND `Code` = '".RL_LANG_CODE."'", "lang_keys");
                    }
                }
                
               if( $GLOBALS['block_keys']['geo_filter_block'] )
              {
                 $geo_block_data = $GLOBALS['rlMultiField'] -> getGeoBlockData( $GLOBALS['geo_format'] );
                  $GLOBALS['rlSmarty'] -> assign( 'geo_block_data', $geo_block_data );
              }

               $GLOBALS['rlSmarty'] -> assign( 'geo_format', $GLOBALS['geo_format'] );

               if( !$GLOBALS['config']['mf_geo_block_list'] )
                {
                 $GLOBALS['rlXajax'] -> registerFunction( array( 'geoGetNext', $GLOBALS['rlMultiField'], 'ajaxGeoGetNext' ) );
                 $GLOBALS['rlXajax'] -> registerFunction( array( 'geoBuild', $GLOBALS['rlMultiField'], 'ajaxGeoBuild' ) );

                   if( in_array($_POST['xjxfun'], array( 'ajaxGeoGetNext', 'ajaxGeoBuild' ) ) )
                    {
                     $GLOBALS['rlXajax'] -> processRequest();
                        exit;
                 }
             }

               if( $geo_filter_data['geo_url'] )
               {
                 $page_info['canonical'] = str_replace('[geo_url]', '', $GLOBALS['geo_filter_data']['clean_url']);
               }
         }

apPhpAccountsTop
global $multi_formats, $rlDb, $rlSmarty;

           $sql = "SELECT `T1`.*, `T2`.`Order_type` FROM `".RL_DBPREFIX."multi_formats` AS `T1` ";
           $sql .="LEFT JOIN `".RL_DBPREFIX."data_formats` AS `T2` ON `T2`.`Key` = `T1`.`Key` ";
         $sql .="WHERE `T1`.`Status` = 'active'";
            $mf_tmp = $rlDb -> getAll($sql);

            foreach( $mf_tmp as $key => $item )
           {
             $multi_formats[ $item['Key'] ] = $item;
         }
         unset($mf_tmp);
           $rlSmarty -> assign( 'multi_formats', $multi_formats );

           $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlXajax'] -> registerFunction( array( 'mfGetNext', $GLOBALS['rlMultiField'], 'ajaxGetNext' ) );
         $GLOBALS['rlXajax'] -> registerFunction( array( 'mfBuild', $GLOBALS['rlMultiField'], 'ajaxBuild' ) );

apPhpListingsTop
global $multi_formats, $rlDb, $rlSmarty;

           $sql = "SELECT `T1`.*, `T2`.`Order_type` FROM `".RL_DBPREFIX."multi_formats` AS `T1` ";
           $sql .="LEFT JOIN `".RL_DBPREFIX."data_formats` AS `T2` ON `T2`.`Key` = `T1`.`Key` ";
         $sql .="WHERE `T1`.`Status` = 'active'";
            $mf_tmp = $rlDb -> getAll($sql);

            foreach( $mf_tmp as $key => $item )
           {
             $multi_formats[ $item['Key'] ] = $item;
         }
         unset($mf_tmp);
           $rlSmarty -> assign( 'multi_formats', $multi_formats );

           $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlXajax'] -> registerFunction( array( 'mfGetNext', $GLOBALS['rlMultiField'], 'ajaxGetNext' ) );
         $GLOBALS['rlXajax'] -> registerFunction( array( 'mfBuild', $GLOBALS['rlMultiField'], 'ajaxBuild' ) );

apPhpControlsBottom
$GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlXajax'] -> registerFunction( array( 'rebuildMultiFields', $GLOBALS['rlMultiField'], 'ajaxRebuildMultiField' ) );
          $GLOBALS['rlXajax'] -> registerFunction( array( 'rebuildPath', $GLOBALS['rlMultiField'], 'ajaxRebuildPath' ) );
           $GLOBALS['rlXajax'] -> registerFunction( array( 'rebuildMultiCache', $GLOBALS['rlMultiField'], 'ajaxRebuildMultiCache' ) );

apTplControlsForm
echo '<tr class="body"><td class="list_td_light">'.$GLOBALS['lang']['mf_rebuild'].'</td>';
          echo '<td class="list_td_light" align="center" style="width: 200px;">';
         echo '<input id="mf_rebuild" type="button" onclick="xajax_rebuildMultiFields(';
         echo "'#mf_rebuild');$(this).val('".$GLOBALS['lang']['loading']."');";
            echo '"';
           echo 'value="'.$GLOBALS['lang']['rebuild'].'" style="margin: 0;width: 100px;" /></td></tr>';

            echo '<tr class="body"><td class="list_td">'.$GLOBALS['lang']['mf_rebuild_path'].'</td>';
         echo '<td class="list_td" align="center" style="width: 200px;">';
           echo '<input id="mf_path_rebuild" type="button" onclick="xajax_rebuildPath(';
           echo "'#mf_path_rebuild', true);$(this).val('".$GLOBALS['lang']['loading']."');";
         echo '"';
           echo 'value="'.$GLOBALS['lang']['mf_refresh'].'" style="margin: 0;width: 100px;" /></td></tr>';

         echo '<tr class="body"><td class="list_td_light">'.$GLOBALS['lang']['mf_rebuild_cache'].'</td>';
          echo '<td class="list_td_light" align="center" style="width: 200px;">';
         echo '<input id="mf_rebuild_cache" type="button" onclick="xajax_rebuildMultiCache(';
            echo "'#mf_rebuild_cache');$(this).val('".$GLOBALS['lang']['loading']."');";
          echo '"';
           echo 'value="'.$GLOBALS['lang']['update'].'" style="margin: 0;width: 100px;" /></td></tr>';

phpSubmitProfileEnd
$tpl2 = RL_PLUGINS.'multiField' . RL_DS . 'mf_reg_js.tpl';
            $js = $GLOBALS['rlSmarty'] -> fetch( $tpl2, null, null, false );
            $GLOBALS['_response'] -> script($js);

apPhpSubmitProfileEnd
$tpl2 = RL_PLUGINS.'multiField' . RL_DS . 'mf_reg_js.tpl';
          $js = $GLOBALS['rlSmarty'] -> fetch( $tpl2, null, null, false );
            $GLOBALS['_response'] -> script($js);

apPhpGetAccountFieldsEnd
$tpl2 = RL_PLUGINS.'multiField' . RL_DS . 'mf_reg_js.tpl';
           $js = $GLOBALS['rlSmarty'] -> fetch( $tpl2, null, null, false );
            $GLOBALS['_response'] -> script($js);

apTplAccountFieldSelect
$GLOBALS['rlSmarty'] -> display( RL_PLUGINS . 'multiField' . RL_DS . 'mf_block_account.tpl' );

apTplListingFieldSelect
$GLOBALS['rlSmarty'] -> display( RL_PLUGINS . 'multiField' . RL_DS . 'mf_block.tpl' );

apPhpListingFieldsAfterAdd
global $f_data;
            $f_data['key'] = $GLOBALS['f_key'];
           $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlMultiField'] -> createSubFields( $f_data, 'listing' );

apPhpAccountFieldsAfterAdd
global $f_data,$f_key;
         
          $f_data['key'] = $f_key;
            
          $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
            $GLOBALS['rlMultiField'] -> createSubFields( $f_data, 'account' );

init
global $geo_format;
          $geo_format = $GLOBALS['rlDb'] -> getOne("Key", "`Geo_filter` = '1'", "multi_formats");

         if( $geo_format )
         {
             global $geo_filter_data;
              $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');

              if( is_numeric(strpos($_GET['page'], "[geo_url]")) )
                {
                 $tmp = str_replace(array("[geo_url]", "%5Bgeo_url%5D"), "", $_SERVER['REQUEST_URI']);
                   
                  header ('HTTP/1.1 301 Moved Permanently');
                  header ('Location: '.$_SERVER['HTTP_HOST'].$tmp);
             }

               /*if( $_GET['rlVareables'] == "multiField/autocomplete.inc.php" && $_GET['str'] )
             {   
                  $str = $GLOBALS['rlValid'] -> xSql(trim($_GET['str']));                 
                  $echo = $GLOBALS['rlMultiField'] -> geoAutocomplete( $str );
                    $GLOBALS['reefless'] -> loadClass( 'Json' );
                  echo $GLOBALS['rlJson'] -> encode( $echo );
                 exit;
             }*/

             $geo_filter_data = $GLOBALS['rlMultiField'] -> prepareGet();
                $GLOBALS['rlSmarty'] -> assign_by_ref('geo_filter_data', $geo_filter_data);
           }

phpCategoriesGetCategoriesCache
if( $GLOBALS['geo_format'] )
            {           
              $param1 = $GLOBALS['rlMultiField'] -> adaptCategories( $param1 );             
              $param1 = $GLOBALS['rlMultiField'] -> adaptOtherData( $param1, true );
          }

phpCategoriesGetCategories
if( $GLOBALS['geo_format'] )
         {
             $param1 = $GLOBALS['rlMultiField'] -> adaptCategories( $param1 );
           }

listingsModifyWhere
if( $GLOBALS['geo_format'] )
            {
             global $sql, $geo_filter_data;
                foreach( $geo_filter_data['lfields'] as $field => $value )
              {
                 $sql .="AND `T1`.`{$field}` = '{$value}' ";
             }
         }

listingsModifyWhereByAccount
if( $GLOBALS['geo_format'] )
           {
             global $sql, $geo_filter_data;
                foreach( $geo_filter_data['lfields'] as $field => $value )
              {
                 $sql .="AND `T1`.`{$field}` = '{$value}' ";
             }
         }

listingsModifyWhereByPeriod
if( $GLOBALS['geo_format'] )
            {
             global $sql, $geo_filter_data;
                foreach( $geo_filter_data['lfields'] as $field => $value )
              {
                 $sql .="AND `T1`.`{$field}` = '{$value}' ";
             }
         }

listingsModifyWhereFeatured
if( $GLOBALS['geo_format'] )
            {
             global $geo_filter_data;
              foreach( $geo_filter_data['lfields'] as $field => $value )
              {
                 $param1 .="AND `T1`.`{$field}` = '{$value}' ";
              }
         }

listingsModifyWhereSearch
if( $GLOBALS['geo_format'] )
          {
             global $sql, $geo_filter_data;
                foreach( $geo_filter_data['lfields'] as $field => $value )
              {
                 $sql .="AND `T1`.`{$field}` = '{$value}' ";
             }
         }

phpSmartyClassFetch
if( !defined('REALM') )
         {
             $GLOBALS['reefless'] -> loadClass('MultiField', null, 'multiField');
                $param1 = $GLOBALS['rlMultiField'] -> smartyFetchHook( $param1 );
           }

apPhpPagesPost
$_POST['geo_exclude'] = $GLOBALS['info']['Geo_exclude'];

apTplPagesForm
echo '<tr><td class="name">'.$GLOBALS['lang']['mf_geo_exclude_page'].'</td><td class="field">';
            if( $_POST['geo_exclude'] == '1' )
            {
             $geo_exclude_yes =' checked="checked"';
         }elseif( $_POST['geo_exclude'] == '1' )
           {
             $geo_exclude_no =' checked="checked"';
          }else
         {
             $geo_exclude_no =' checked="checked"';
          }
         echo '<label><input '.$geo_exclude_no.' class="lang_add" type="radio" name="geo_exclude" value="0" />&nbsp;'.$GLOBALS['lang']['enabled'].'</label>';
            echo '<label><input '.$geo_exclude_yes.' class="lang_add" type="radio" name="geo_exclude" value="1" />&nbsp;'.$GLOBALS['lang']['disabled'].'</label></td></tr>';

apPhpPagesBeforeAdd
$GLOBALS['data']['Geo_exclude'] = $_POST['geo_exclude'];

apPhpPagesBeforeEdit
$GLOBALS['update_data']['fields']['Geo_exclude'] = $_POST['geo_exclude'];

boot
if( $GLOBALS['rlMultiField'] )
         {
             $GLOBALS['rlMultiField'] -> adaptPageInfo();
            }

pageTitle
if( $GLOBALS['rlMultiField'] )
            {
             $param1 = $GLOBALS['rlMultiField'] -> adaptPageTitle( $param1 );
            }

accountsGetDealersByCharSqlWhere
if( $GLOBALS['geo_format'] )
           {               
              foreach( $GLOBALS['geo_filter_data']['afields'] as $field => $value )
             {
                 $param1 .="AND `T1`.`{$field}` = '{$value}' ";
              }
         }

phpValidateUserLocation
if (!$param2 && $param1 && $GLOBALS['rlDb'] -> getOne("ID", "`Path` = '".$param1."'", "data_formats") ) {
                $param2 = $GLOBALS['lang']['personal_address_in_use'];
            }

