"; //end top level include //caching system //check for cached file //process links //re hash how the ANCHOR links are processed with either path or Query $path_info=$_SERVER["PATH_INFO"]; $path_query=$_SERVER["QUERY_STRING"]; if (strlen($path_info)){ $pinfo=$path_info; } if (strlen($path_query)){ //need to append a forward slash if there is a query string $pinfo='/'.$path_query; } //print "Path Info [$pinfo]INFO [$path_info] QUERY [$path_query]
"; $ptinfo=$_SERVER["PATH_INFO"]; if ($selinks==Y) { if (strlen($PATH_INFO) > 1) { $PHP_SELF = str_replace($PATH_INFO,'',$PHP_SELF); $vars = explode('/', substr($PATH_INFO, 1)); //print_r($vars); //first check - the templateid variable and refresh to a new page /* this section is a start to reorder the URL's templateid is assumed to be in the first postion ofthe array vars[0] Both these strings are treated the same fpengine.php/support_summary_details.htm/81/menuid/1/tempidx/5/link/1 fpengine.php/templateid/81/menuid/1/tempidx/5/link/1 - this one goes through a 301 redirect fpengine.php/menuid/1/tempidx/5/link/1/templateid/81/ - nothing happenes to this string as it is out of order */ if ($newurllink=='Y'){ //if there is no templateid in the array whatever is in this posistion is a place holder for the templateid if (in_array("templateid",$vars)){ $akey = array_search('templateid', $vars); //if a 'templateid' string has been found this must be in the first position of the array //exit; if ($akey==0){ $akey=$akey+1; $tempid_new=$vars[$akey]; //get templated id $gethtmlfile = new DB_Sql; $gethtmlfile->query("select filename from template where templateid='$tempid_new'"); $gethtmlfile->next_record(); $tempnme=$gethtmlfile->f("filename"); $newpath=str_replace('templateid', $tempnme, $PATH_INFO); //$newpath=$newpath.'tempkey/'.$tempid_new.'/'; //print "New Path [$newpath]
"; $newpath=$urlpath.'/fpengine.php'.$newpath; //print "New Path [$newpath]
"; //exit; //make sure that search engines do not loose the plot header("HTTP/1.0 301 Moved Permanently"); header("Location: $newpath"); exit; } }else{ //landing here after 301 redirect or nothing found to convert //Print "we are here
"; //print_r($vars); //print "
"; //need to check menu items $vars[0]='templateid'; //pump back in the templateid value $show_menu = new DB_Sql; $vcnt=count($vars); //print "Vcount [$vcnt]
"; /* Need to esatbalish is this a menu item and do we have to establish are there any other values which need to be pumped back in to stop wasting server queries nothing will happen in menushortlink is no set to Y set in /config/fpengine.inc.php this hooks back the menuid and originating template number. This only allows a short link to be used if linking a menu item to some type of navigation system the canonical link should also be used on the menu and landing page to avoid duplicate items in Google Analytics. use{meta_canonical} in the header section of the template */ if ($vcnt<=2 and $menushortlink=='Y'){ $show_menu->query("select mt.menu_id as menid1, m.menu_id as menid2, m.link_id, e.templateid as tempidx, mt.menu_default, mt.menu_templateid, e.entriesid, e.typeid, m.menu_name from menu_to_templates mt, entries e, menu m where (mt.menu_templateid ='$vars[1]' and m.menu_id = mt.menu_id and m.link_id = e.entriesid and e.typeid='5' and mt.menu_default='0')"); if($show_menu->num_rows() != 0) { $show_menu->next_record(); $smenuid=$show_menu->f("menid1"); $tvalue=$show_menu->f("tempidx"); //print "menuid [$smenuid] tempidx [$tvalue]
"; $vars[2]='menuid'; $vars[3]=$smenuid; $vars[4]='tempidx'; $vars[5]=$tvalue; } } } //landing here if a templateid has been found but in the wrong order //so nothing to convert //Print "nothing converted here
"; //exit; } //restore the variable to reference the correct template //$vars[0]='templateid'; //unset globals to start with while (list(, $var) = each($vars)) { list(, $val) = each($vars); if(preg_match('/.+\[.+\]/',$var)) { list($part1,$part2)=explode("[","$var"); $part2=str_replace("]","",$part2); //Now build array ${$part1}[$part2]=$val; } else { $HTTP_GET_VARS[$var] = $val; //print "$var : $val
"; $GLOBALS[$var] = $val; }//end preg_match } } } //do some variable checking so we know we are getting what we expect /* //templateid if($templateid!=""){ $checktemplateid = new Sanitise; $checktemplateid->checknumber($templateid); } //menuid if($menuid!=""){ $checkmenuid = new Sanitise; $checkmenuid->checknumber($menuid); } //end santitise checking */ //turn sessions on if required if (fPsessions == "on") { include_once "lib/securepage.inc.php"; $createsession = new securepage; $createsession->sessioncheck(); } $restraint=unserialize(stripslashes($restemp)); $resxx=unserialize(stripslashes($resxx)); if ($lflag){ $resid=unserialize(base64_decode($resid)); $residx=unserialize(base64_decode($residx)); $pdscr=unserialize(base64_decode($pdscrx[$menid])); } /* if ($lnk){ $restraint=$mpassarray[0]; $residx=$mpassarray[1]; $resid=$mpassarray[2]; $pdscr=$mpassarray[3]; } */ if ($link){ //print "
we are here
"; // Check the info from the session ID after clicking on a link //$menuid=$passarray[0]; $catid=$passarray[1]; $pdscr=$passarray[2]; $searchx=$passarray[3]; $restraint=$passarray[4]; $menid=$passarray[5]; $value_pagex=$passarray[6]; $pdscrx=$passarray[7]; //proposed log area for landing on a menu item //$templateid is the link key $cachedis=1; //disable the cache at this point incase things have changed /* foreach ($restraint as $val){ print "RESTRAINT $val
"; } foreach ($resprev as $val){ print "RESXX $val
"; } */ } if (is_array($resid)){ foreach ($resid as $val){ if ($val){ $restraint[$residx[$val]]=$pdscr[$val]; } } } //provide some backup incase no template id is set if (is_array($restraint)){ foreach ($restraint as $key=>$val){ $cnt++; $cval[]=$val; $keys[]=$key; $vcnt[]=$cnt; //print "Current Value $val $key
"; } } if (is_array($resxx)){ foreach ($resxx as $key=>$val){ $pval[]=$val; // print "Previous Value $val $key
"; } } $count=0; while($vcnt[$count]){ //print "Count $count CVAL " . $cval[$count] . " Pval " . $pval[$count] . " Restraint " . $restraint[$keys[$count]] . " PDSCR " . $pdscr[$count] . "
"; if ($flag){ $restraint[$keys[$count]]=0; $pdscr[$count+1]=""; //patch 23/6/03 to clear the PDSCR value }else{ if ($cval[$count]!=$pval[$count]){ if ($cval[$count==0] and $pval[$count]>=1){ $restraint[$keys[$count]]=""; //OK need to Zero out values below $flag=1; } } } $count++; } //check the results /* if ($flag){ $count=0; while($vcnt[$count]){ print "After Count $count CVAL " . $cval[$count] . " Pval " . $pval[$count] . " Restraint " . $restraint[$keys[$count]] . " PDSCR " . $pdscr[$count] . "
"; $count++; } } */ if (!$templateid) { $templateid=$fPdefaulttpl; } //turn cache control on or off and change for cache template exclusions if (($cachecontrol=='Y') && !(@in_array($templateid,$fPcacheexclusion))) { if($cachedis!=1){ function is_valid($input){ global $md5compare; $inputexpire = $input .".expire"; if(file_exists("$inputexpire")){ $loadexpire = fopen($inputexpire,"r"); $loadexpiredata = fread($loadexpire,filesize($inputexpire)); list($loadexpiredata_time,$md5compare)=explode(":",$loadexpiredata); $timestamp=time(); //print "Expire time [$loadexpiredata_time] [$timestamp]
"; if ($loadexpiredata_time <= $timestamp) { //perhaps unlik here return false; } else { return true; } fclose ($loadexpire); } else { return false; } } $cache_directory=$fastpagepath2 . "/" . ".cache"; $linkx=$REQUEST_URI; $cached_file=md5($REQUEST_URI); $complete_cached_path="$cache_directory/$cached_file"; $complete_cached_path_lock="$cache_directory/$cached_file" . ".lock"; if((file_exists("$complete_cached_path"))and(is_valid("$complete_cached_path"))) { //check if lock file exists if(!file_exists("$complete_cached_path_lock")){ $fp=fopen("$complete_cached_path",r); $buildoutput = fread($fp,filesize($complete_cached_path)); $newmd5=md5($buildoutput); if ($md5compare==$newmd5){ //cache //for statistics convert any old format first $linkx = str_replace('?', '/', $linkx); $linkx = str_replace('&', '/', $linkx); $linkx = str_replace('=', '/', $linkx); $varsx = explode('/', substr($linkx, 1)); $key = array_search('templateid', $varsx); $temp_id=$varsx[$key+1];//next key must be the templateid $key = array_search('menuid', $varsx); $men_id=$varsx[$key+1];//next key must be the templateid $visitorip= $_SERVER['REMOTE_ADDR']; $strans = new DB_Sql; $strans->query("INSERT INTO template_statistics (template_id,menu_id,remote_ip,date_stamp,cache,engine) VALUES('$templateid','$men_id','$visitorip',NOW(),'Y','F')"); // print $buildoutput; exit; } else{ //cache is probably being written to, so read from database and not file $cachedis=1; } }else{ //if lock file does exists then bail out $cachedis=1; } } } }//end cache control //End caching system //includes require "lib/template.php"; require "lib/pluginengine.inc.php"; require "lib/loadengine.inc.php"; //require "lib/linkgenerator.inc.php"; //end includes if (file_exists('admin/extraconfigure.php')) { include('admin/extraconfigure.php'); } //setup link class //$linkgen = new Link(); //finish setup link class $linksonly=0; $gettemplatename = new DB_Sql; //$gettemplatename->query("select filename,catid,menu from template where templateid='$templateid'"); $gettemplatename->query("select name,description,skey,filename,catid,menu,stitle,sdescription from template where templateid='$templateid'"); $gettemplatename->next_record(); $templatename=$gettemplatename->f("filename"); $fPmenucheck=$gettemplatename->f("menu"); $catid=$gettemplatename->f("catid"); //extra data for meta keys etc $tname=stripslashes($gettemplatename->f("name")); $tdscr=stripslashes($gettemplatename->f("description")); $tskey=stripslashes($gettemplatename->f("skey")); $stitle=stripslashes($gettemplatename->f("stitle")); $sdescription=stripslashes($gettemplatename->f("sdescription")); //canonical data if ($selinks='Y'){ if ($newurllink=='Y'){ $canonical=''; }else{ $canonical=''; } }else{ $canonical=''; } // // $templatearray[main]=$templatename; //Ok now we have to find the template file $tempath= new templatepath($catid,$fastpagepath2); $filepath=$tempath->enginepath($templatename); /* hook for fpengine statistics Masterfile records Templateid Transaction file records Date/Time and IP plus referer key */ $visitorip= $_SERVER['REMOTE_ADDR']; $linkx=$REQUEST_URI; $linkx = str_replace('?', '/', $linkx); $linkx = str_replace('&', '/', $linkx); $linkx = str_replace('=', '/', $linkx); $varsx = explode('/', substr($linkx, 1)); $key = array_search('menuid', $varsx); $men_id=$varsx[$key+1];//next key must be the templateid $engine='fpengine'; $source='Normal'; $strans = new DB_Sql; $strans->query("INSERT INTO template_statistics (template_id,menu_id,remote_ip,date_stamp,cache,engine) VALUES('$templateid','$men_id','$visitorip',NOW(),'N','F')"); // //print "Menu Check [$fPmenucheck][$templatename][$templateid]
"; /* $catname='/templates/TEMPCATID_' . $catid; $catname2='/templates'; //print "catname [$catname]
"; $tdest = $fastpagepath2 . $catname; if (is_dir($tdest)){ $dest = $fastpagepath2 . $catname . '/' . $templatename; if (is_file($dest)){ $filepath=$fastpagepath2 .$catname; }else{ $filepath=$fastpagepath2 .$catname2; } }else{ $filepath=$fastpagepath2 .$catname2; } */ $t= new Template( "$filepath"); $t->set_unknowns($unknowns="keep"); $t->set_file($templatearray); $getarray = new DB_Sql; $getarray->query("select e.entriesid,e.name,e.fieldtag,p.data,t.systype from entries e,pagedata p,type t where e.entriesid=p.entriesid and t.typeid=e.typeid and (e.templateid='$templateid' or e.templateid='0')"); $total=$getarray->num_rows(); if ($getarray->num_rows()!=0) { while ($getarray->next_record()) { $key=""; $key=stripslashes($getarray->f("fieldtag")); $entriesid=$getarray->f("entriesid"); $entriesname=$getarray->f("name"); $systype=$getarray->f("systype"); //sub_menu hook // entity syntax is support_menu == normal entity syntax // support_menu_01 - last two digits equals the format No which needs to be stripped out and a flag set // //print "Templateid [$templateid][$systype][$entriesname]
"; //print "length [$klngth] [$key] [$kresult] sub format No[$sub_format_no]
"; $info =new ArrayUserFields; $mydata=$info->extra_menu_fields($menuid); //print_r($mydata); $field_array=$info->extra_menu_field_type($menuid); //print_r($field_array); if (in_array($key,$mydata)){ $menukey=1; }else{ $menukey=0; } /* //redundant code because of the above - Mike if ($key=='menu_heading_name' or $key=='menu_template_title' or $key=='menu_template_description' or $key=='menu_template_date' or $key=='menu_return' or $key=='menu_links' or $key=='menu_image'){ $menukey=1; }else{ $menukey=0; } */ /*since we have new systypes, we need to force the system to push them through the * switch statement by creating some phantom data for the if else statement below */ /*if($systype!="alink" and $systype!="text" and $systype!="image" and $systype!="menu" and $systype!="pagetitle" and $systype!="title" and $systype!="fPglobal"){*/ $outputdata = $getarray->f("data"); if ($outputdata=="") { //create some data in $outputdata $outputdata=" "; } else { //output the data for the legacy systype option output $outputdata = $getarray->f("data"); } if ($outputdata!="" or $menukey==1 or $systype=="alink") { switch($systype) { case php: /* allows a php include to be passed into the data string type is php key represents the filename located in the root of Fastpage Include output must be to $fpout */ $pfile="$key.php"; if (file_exists($pfile)) { require $pfile; $dataentry = $fpout; } break; case phps: /* allows a php include to be passed into the data string type is php key represents the filename located in the root of Fastpage */ $pfile="$key.php"; if (file_exists($pfile)) { require $pfile; } //$dataentry = $fpout; break; case image: $tempath= new templatepath($catid,$fastpagepath3); list($imagename,$align,$border)= explode("|",$outputdata); $stest=trim($outputdata); $stsize=strlen($stest); if ($stsize){ $imagepath=$tempath->imagepath01($imagename); $dataentry = '"; } break; case alink: $get_linkid = new DB_Sql; $get_linkid->query("select templateid from links where linktag='$key'"); $get_linkid->next_record(); $linktemplateid=$get_linkid->f("templateid"); $dataentry = "$urlpath" . "/" . "fpengine.php?templateid=$linktemplateid" . '"'; $menukey="1"; break; case fPglobal: //stores all the globals //need to hook meta stuff here $mkey=substr($key,0,12); if ($mkey=='global_meta_'){ if ($fPmeta=='Y'){ switch($key) { case global_meta_title: $dataentry=$stitle; break; case global_meta_description: $dataentry=$sdescription; break; case global_meta_keywords: $dataentry=$tskey; break; case global_meta_canonical: $outputdata=$canonical; break; } } }else{ $dataentry = stripslashes($getarray->f("data")); } break; case text: if ($menukey==1){ switch($key){ case menu_return: $get_menu = new DB_Sql; $get_menu->query("select m.returnimg,m.returntext,m.useretimg from menu m,menu_to_templates mt where mt.menu_templateid='$templateid' and mt.menu_id=m.menu_id"); $get_menu->next_record(); $returnimg=$get_menu->f("returnimg"); $returntext=$get_menu->fs("returntext"); $useretimg=$get_menu->f("useretimg"); // need to get the correct Image Path $tempath= new templatepath($catid,$fastpagepath3); $imagepath=$tempath->imagepath01($returnimg); $ipath = 'images/' . $imagepath; //print "Return Image Path [$ipath] [$catid]
"; $tempvar=$restraint; $restemp=addslashes(serialize($tempvar)); if ($query) { //canonical update $fPmenu_return_search="&link=1&query=$query&page=$page"; } //patch for new links if ($newurllink=='Y' and $selinks=='Y') { //need to get template name $get_fname = new DB_Sql; $get_fname->query("select filename from template where templateid='$tempidx'"); $get_fname->next_record(); $fname=$get_fname->f("filename"); $tempnme=$fname; //$tempnme=$templatename; }else{ $tempnme='templateid'; } if ($useretimg and $returnimg){ $dataentry =""; }else{ $dataentry ="$returntext"; } break; case menu_heading_name: $get_menu = new DB_Sql; $get_menu->query("select menu_id,menu_name from menu where menu_id='$menuid'"); $get_menu->next_record(); $menuname = stripslashes($get_menu->f("menu_name")); $dataentry = stripslashes($menuname); break; case menu_template_title: $get_template = new DB_Sql; $get_template->query("select name from template where templateid='$templateid'"); $get_template->next_record(); $templatetitle = stripslashes($get_template->f("name")); $dataentry = stripslashes($templatetitle); break; case menu_tempid: $dataentry = $templateid; break; case menu_template_description: $get_template = new DB_Sql; $get_template->query("select description from template where templateid='$templateid'"); $get_template->next_record(); $templatedescr = stripslashes($get_template->f("description")); $dataentry = stripslashes($templatedescr); break; case menu_template_date: $get_menu = new DB_Sql; $get_menu->query("select mt.menu_default,mt.menu_id, mt.datecreated,mt.menu_templateid,t.templateid,t.name as menu_name,t.description,t.filename, t.name from menu_to_templates mt,template t where mt.menu_id='$menuid' && mt.menu_templateid='$templateid' and mt.menu_default != 1"); $get_menu->next_record(); //$dataentry = stripslashes($get_menu->f("datecreated")); $tdate = $get_menu->f("datecreated"); $arr = explode("-",$tdate); $dataentry=date($fPdata_format, mktime(0,0,0, $arr[1], $arr[2], $arr[0])); break; case menu_image: $get_menu = new DB_Sql; $get_menu->query("select mt.image,mt.menu_id,m.twidth,m.theight,m.menu_id from menu_to_templates mt, menu m where m.menu_id='$menuid' && mt.menu_id='$menuid' && mt.menu_templateid='$templateid' and mt.menu_default != 1"); $get_menu->next_record(); $image = $get_menu->f("image"); $twidth = $get_menu->f("twidth"); $theight = $get_menu->f("theight"); //only pump in if there is an image if ($image){ $tempath= new templatepath($catid,$fastpagepath3); $imagepath=$tempath->imagepath01($image); $dataentry = "\"thumbnail\""; } break; case menu_links: /* Routine for the previous - next links on the menu template */ //get the menu name $get_menu = new DB_Sql; $get_menu->query("select menuclass,dispos,search_order,previous,next,spacer,inactive,previousimg,nextimg,previousinact,nextinact,useimage,menu_use_adv,menu_use_alt from menu where menu_id='$menuid'"); $get_menu->next_record(); $menuclass=$get_menu->f("menuclass"); $dispos=$get_menu->f("dispos"); $search_order=$get_menu->f("search_order"); $previous=$get_menu->f("previous"); $next=$get_menu->f("next"); $spacer=$get_menu->f("spacer"); $inactive=$get_menu->f("inactive"); $previousimg=$get_menu->f("previousimg"); $nextimg=$get_menu->f("nextimg"); $previousinact=$get_menu->f("previousinact"); $nextinact=$get_menu->f("nextinact"); $useimage=$get_menu->f("useimage"); $menu_use_adv=$get_menu->f("menu_use_adv"); $menu_use_adv=$get_menu->f("menu_use_alt"); //check if there is a class - otherwise use a default class if ($menuclass==""){ $menuclass='menuclass'; } // determine the search order of the menu items //update to factor different methods switch ($search_order) { //the date fudge in place case 0: $searchkey='mt.datecreated DESC'; break; case 1: $searchkey='t.name ASC'; break; case 2: $searchkey='mt.datecreated ASC'; break; case 3: $searchkey='t.name DESC'; break; } /* if ($search_order==0){ //$searchkey='mt.p_id DESC'; $searchkey='mt.datecreated DESC'; //change the sort to the actual date }else{ $searchkey='t.name ASC'; } */ $menu =new nextprevious; $searchstring=$menu->nextextend($menuid,$pdscrx,$menu_use_adv,$menu_use_alt,$pdscr,$mon,$day,$year); $extra =new ExtraSelectInfo; $extra->MenuAdvPrep($menuid); $extra_data=$extra->extra_field_info(); // new code if ($searchx==1 and $menid==$menuid and $pdscr){ //$pdscr=$pdscrx[$menuid]; $pdscx='%' . $pdscr[0] .'%'; $retrieve_menu = new DB_Sql; $query2="select mt.image,mt.menu_default,mt.menu_id, mt.datecreated,mt.menu_templateid as template_entry"; //standard defined fields //$extra_data->extra_fields_sql(); //get the routine into action if ($extra_data){ //yep we have some extra info $query2 .= $extra_data; } $query2 .=",t.templateid,t.name as menu_name,t.description,t.filename, t.name from menu_to_templates mt,template t where mt.menu_id=" . $menuid . " and mt.menu_templateid=t.templateid and mt.menu_default != 1 and (t.name like '$pdscx' or t.description like '$pdscx')" . $searchstring . " and t.active='Y' and t.ilink='Y' order by " . $searchkey .""; $retrieve_menu->query($query2); $tfind=$retrieve_menu->num_rows(); }else{ //no search section - will have to change this at some time $retrieve_menu = new DB_Sql; //build up the Query to include any user defined fields $query3="select mt.image,mt.menu_default,mt.menu_id, mt.datecreated,mt.menu_templateid as template_entry"; //standard defined fields //$menu->extra_fields_sql(); //get the routine into action if ($extra_data){ //yep we have some extra info $query3 .= $extra_data; } $query3 .=",t.templateid,t.name as menu_name,t.description,t.filename, t.name from menu_to_templates mt,template t where mt.menu_id=" . $menuid . " and mt.menu_templateid=t.templateid and mt.menu_default != 1 and t.active='Y' and t.ilink='Y' order by " . $searchkey .""; $retrieve_menu->query($query3); $tfind=$retrieve_menu->num_rows(); // end new code /* if ($searchx==1 and $menid==$menuid){ if ($pdscr){ }else{ $pdscr=$pdscrx[$menuid]; } $pdscx='%' . $pdscr .'%'; $retrieve_menu = new DB_Sql; //search_order 0 = date DESC 1 = Descr ASC $retrieve_menu->query("select mt.menu_default,mt.menu_id, mt.datecreated,mt.menu_templateid as template_entry,t.templateid,t.name as menu_name,t.description,t.filename, t.name from menu_to_templates mt,template t where mt.menu_id='$menuid' and mt.menu_templateid=t.templateid and mt.menu_default != 1 and (t.name like '$pdscx' or t.description like '$pdscx') order by " . $searchkey .""); $tfind=$retrieve_menu->num_rows(); }else{ $retrieve_menu = new DB_Sql; $retrieve_menu->query("select mt.menu_default,mt.menu_id, mt.datecreated,mt.menu_templateid as template_entry,t.templateid,t.name as menu_name,t.description,t.filename, t.name from menu_to_templates mt,template t where mt.menu_id='$menuid' and mt.menu_templateid=t.templateid and mt.menu_default != 1 order by " . $searchkey .""); $tfind=$retrieve_menu->num_rows(); */ } //print "we are here $templateid : $tfind : $menuid
"; if ($tfind){ // Build an array with the values in $count=0; if ($newurllink=='Y' and $selinks=='Y') { $tempnme=$templatename; }else{ $tempnme='templateid'; } while($retrieve_menu->next_record()){ $count++; $template_entry=$retrieve_menu->f("template_entry"); $menuarray[$count]=$template_entry; } $count=0; $count++; while ($menuarray[$count]){ $test=$menuarray[$count]; if ($menuarray[$count]==$templateid){ //work out previous $test=$count-1; if ($menuarray[$test]){ if ($useimage and $previousimg){ // need to get the correct Image Path $tempath= new templatepath($catid,$fastpagepath3); $imagepath=$tempath->imagepath01($previousimg); $ipath = 'images/' . $imagepath; $dataentry .= " "; }else{ $dataentry .= " $previous $spacer"; } }else{ if ($useimage and $previousinact){ // need to get the correct Image Path $tempath= new templatepath($catid,$fastpagepath3); $imagepath=$tempath->imagepath01($previousinact); $ipath = 'images/' . $imagepath; //print "Return Image Path [$ipath] [$catid]
"; $dataentry .=" "; }else{ $dataentry .=" $previous $spacer"; } } $test=$count+1; if ($menuarray[$test]){ if ($useimage and $nextimg){ // need to get the correct Image Path $tempath= new templatepath($catid,$fastpagepath3); $imagepath=$tempath->imagepath01($nextimg); $ipath = 'images/' . $imagepath; //print "Return Image Path [$ipath] [$catid]
"; $dataentry .= " "; }else{ $dataentry .= " $next  "; } }else{ if ($useimage and $nextimg){ // need to get the correct Image Path $tempath= new templatepath($catid,$fastpagepath3); $imagepath=$tempath->imagepath01($nextinact); $ipath = 'images/' . $imagepath; $dataentry .=""; }else{ $dataentry .=" $next"; } } } $count++; } } break; // end of next default: //here is where we mop up any user defined menu fields if there are any $count=7; while($mydata[$count]){ if ($key==$mydata[$count]){ //see if we have a dropdown menu value to get $length=strlen($mydata[$count]); $rest = substr ($mydata[$count],5,$length); /* need to test the value The value $rest will be either [x]fieldname or just fieldname if there are square brackets this means there is additional drop info the x value will determine what description to use */ $brtest1=substr ($rest,0,1); $brtest2=substr ($rest,2,1); if ($brtest1=="[" and $brtest2=="]"){ $subvalue=substr ($rest,1,1); $ln=strlen($rest); $rest=substr ($rest,3,$ln); }else{ $subvalue=0; } $get_template = new DB_Sql; // print "REST [$rest]
"; $get_template->query("select " . $rest . " from menu_to_templates where menu_templateid ='$templateid'"); $get_template->next_record(); $extra = stripslashes($get_template->f($rest)); $dataentry = $extra; if ($field_array[$count]){ $get_template = new DB_Sql; $get_template->query("select description,dscr2,dscr3 from menu_contraints where contraint_id ='$extra' ORDER BY description"); $get_template->next_record(); switch ($subvalue) { case 0: $dataentry = stripslashes($get_template->f("description")); break; case 2: $dataentry = stripslashes($get_template->f("dscr2")); break; case 3: $dataentry = stripslashes($get_template->f("dscr3")); break; default: //should never need this default value $dataentry = stripslashes($get_template->f("description")); } } } $count++; } } //end of case }else{ //need to hook meta stuff here $mkey=substr($key,0,5); if ($mkey=='meta_'){ if ($fPmeta=='Y'){ switch($key) { case meta_title: $outputdata=$stitle; break; case meta_description: $outputdata=$sdescription; break; case meta_keywords: $outputdata=$tskey; break; case meta_canonical: $outputdata=$canonical; break; } } } // /* if ($key=='search_result_key'){ require "config/search_result_content_01.php"; } */ // capture output and do some processing so we can use it //assign a default if a page number doesn't exist right now if(!$fPpagesel){ $fPpagesel=1; } $processmulti = new pagearticles($outputdata,$fPpagesel); //process the injected information and then give some results back $processmulti->processcurrent(); $outputdata = $processmulti->pageoutput; $dataentry = stripslashes($outputdata); /* //removal of legacy code $dataentry = ereg_replace("[\r]","
",$dataentry); */ //print "key **[$key][$dataentry]**
"; } break; case multimenu: if(!$fPpagesel){ $fPpagesel=1; } $ftest=""; $fnd=0; $getpdata = new DB_Sql; $getpdata->query("select e.entriesid as eid,e.name,e.fieldtag,p.data,p.approve_data,t.systype from entries e, pagedata p,type t where e.entriesid=p.entriesid and t.typeid=e.typeid and e.templateid='$templateid' and t.typeid='8'"); $type_eight=$getpdata->num_rows(); if ($type_eight==1){ $getpdata->next_record(); $fieldtag=$getpdata->f("fieldtag"); $eid=$getpdata->f("data"); $new_id=$getpdata->f("eid"); }else{ //this shouldn't happen BUT!!!! while($getpdata->next_record()){ $fieldtag=$getpdata->f("fieldtag"); //need to pump some info in as this section is only in editpagemain.php $fd = fopen ($filepath.'/'.$templatename, "rw"); $str_in = fread ($fd, filesize ($filepath)); fclose ($fd); //strip out javascript and style sections to avoid problems with { and } $str_in = preg_replace ("']*?>.*?'si","",$str_in); $str_in = preg_replace ("']*?>.*?'si","",$str_in); preg_match_all( '/\{.*?\}/', $str_in, $str_out); $strx=$str_out[0]; $tags='{'.$fieldtag.'}'; if (in_array($tags,$strx)){ $eid=$getpdata->f("data"); $new_id=$getpdata->f("eid"); } } } if(is_numeric($eid)){ $getpdata->query("select data,approve_data from pagedata where entriesid='$eid'"); $getpdata->next_record(); if($fPapproval==1 && $getpdata->f("approve_data")!=""){ $odata=$getpdata->f("approve_data"); }else{ $odata = $getpdata->f("data"); } //yes we have a match }else{ //bummmer we don't have any match, so let's eliminate the possibilities //need to pump some info in as this section is only in editpagemain.php $fd = fopen ($filepath.'/'.$templatename, "rw"); $str_in = fread ($fd, filesize ($filepath)); fclose ($fd); //strip out javascript and style sections to avoid problems with { and } $str_in = preg_replace ("']*?>.*?'si","",$str_in); $str_in = preg_replace ("']*?>.*?'si","",$str_in); preg_match_all( '/\{.*?\}/', $str_in, $str_out); $processmulti = new pagearticles($outputdata,$fPpagesel); $test_results=$processmulti->multi_find();//start searching for a valid entity to attach to $eid=$processmulti->multi_eid();//multi Page Entity ID value $feid_tag=$processmulti->multi_feid();//multi page entity Value $fnd=$processmulti->multi_fnd();//fnd - means we found a multi Page entity match $odata=$processmulti->multi_odata();//pass back the data string which should be the multi Page entity value /* if there is a find then the values of the multi page entity attached are written back to the entity type (typeid) 8. In the pagedata the values are written which hold the pointer to the enity attached and the value of the entity Under data is held the values of the attached entity ID and under approval data is the value of the field tag This means next time the direct record can be accessed as opposed */ } $entriesid=$eid; $processmulti = new pagearticles($odata,$fPpagesel); $processmulti->Module_type('fpengine.php'); //pass the module engine $processmulti->processcurrent(); $dataentry=$processmulti->buildbox(); //show test results if not sure - just uncomment this section /* // test results included while testing in progress - this could be removed later on $getpdata = new DB_Sql; $getpdata->query("select pagedataid,data,approve_data from pagedata where entriesid='$new_id'"); $getpdata->next_record(); $enid=$getpdata->f("pagedataid"); $eid=$getpdata->f("data"); $aeid=$getpdata->f("approve_data"); if ($fnd){ print "**NEW** No items found [$test_results] Entity [$key] Type 8 Multipage Menu: Entries ID [$enid] Entity ID Attached [$eid] associated with Field Tag [$aeid]
"; }else{ print "Entity [$key] Type 8 Multipage Menu: Entries ID [$enid] Entity Attached to [$eid] associated with Field Tag [$aeid]
"; } */ break; case title; $dataentry = ""; $dataentry .= stripslashes($outputdata); $dataentry .= ""; break; case pagetitle; $dataentry = "

"; $dataentry .= stripslashes($outputdata); $dataentry .= "

"; break; case menu; //see if there is a sub_menu $menuid_temp=$menuid; //temp storgae $sub_format_no=""; $klength=strlen($key); //get length $ktest=$klength-3; $kresult=substr($key, -3, 1); if ($kresult=='_'){ //found a sub menu $sub_no=substr($key, -2); //sub menu number $kkey=substr($key,0,$ktest); //now find the menu key if(is_numeric($sub_no)){ $sub_no=floor($sub_no);//get a whole number $sub_format_no=$sub_no; $getmkey = new DB_Sql; $getmkey->query("select e.entriesid,e.fieldtag,p.data,p.entriesid from entries e,pagedata p where e.fieldtag='$kkey' and (e.entriesid=p.entriesid)"); $getmkey->next_record(); $menuid=$getmkey->f("data"); }else{ $menuid = stripslashes($getarray->f("data")); } //print "length [$klngth] [$kkey] [$kresult] sub format No[$sub_format_no] Menuid [$menuid]
"; }else{ $menuid = stripslashes($getarray->f("data")); } //print "Sub Format No [$sub_format_no] Key [$key]
"; //$sub_format_no=1; //used to fudge format No while testing // // entry point for the menu creator $enginename="fpengine.php"; //$menuid = stripslashes($getarray->f("data")); require "admin/menuextension.php"; if ($menuid_temp){ $menuid=$menuid_temp; } //exit point for the menu creator break; case globalmenu; //global menu entry to allow duplicate menu placeholders //get the original field tag $keylngth=strlen($key); $keylngth=$keylngth-5; $mem_link=substr($key,0,$keylngth); $getlink=new DB_Sql; $getlink->query("select e.entriesid,e.name,e.fieldtag,p.data,t.systype from entries e,pagedata p,type t where e.entriesid=p.entriesid and e.fieldtag='$mem_link'"); $getlink->next_record(); //now get the menu ID $enginename="fpengine.php"; $menuid = stripslashes($getlink->f("data")); require "admin/menuextension.php"; break; default: //catch all remaining types and run it through the plugin parser $getprocess = new PluginEngine; $getprocess->AssignOptions($systype,$key,$fastpagepath2); $includepoint = $getprocess->ProcessType(); $AvailableData= stripslashes($outputdata); $LoadPlugin = new LoadEngine; if (file_exists($includepoint)) { include($includepoint); } $dataentry = $LoadPlugin->Fetch(); } } //reset $templatebuild[$key]=$dataentry; $dataentry=""; } // set the template var and push the appended segments into it } $t->set_var($templatebuild); // parse the template and add the content $t->parse("out", array("main")); // Finish $t->p("out"); ?>