It's Carlos ... www.premium-sponsor.com (i updated the parser... it's really fast!)-code available...
| From: | carlos at premium-sponsor dot com | Date: | Thu, 05 May 2011 18:17:06 +0000 |
| Subject: | It's Carlos ... www.premium-sponsor.com (i updated the parser... it's really fast!)-code available... | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-10955@lists.php.net to get a copy of this message | ||
<?
//delete h:/programas/easyphp1-8/www/www.premium-sponsor.com ereg replace at the end
//WHEN TRACKING IS ACTIVATED->Prepare session of entrance ... with the necessary informations ... referer-1,ip,etc(CONSIDER THE VARIABLE IN THE ACCEPTABLE ARRAY OF VARIABLES)... and associate the session of entrance to the session out ...(log at txt files and db)
//CONSIDER THE VARIABLE LANGUAGE AT THE DIRECTORY OF LANGUAGE@CACHE ...
//lifetime of template@cache
$_configuration_variables_["_main_section_"]="adult";
$_configuration_variables_["_sub_sections_"]=array("videos"=>"Movies","websites"=>"WebSites","galleries"=>"Galleries","partner_links"=>"");
$_configuration_variables_["_tmp_path_to_update_"]=$_SERVER['DOCUMENT_ROOT']."/www.premium-sponsor.com";
$_configuration_variables_["_cache_validation_"]="no"; //when yes do not forget to remove the space from _end_php_tag_
$_configuration_variables_["_cache_tracking_"]="";
$_configuration_variables_["_language_directory_cache_"]="pt";
$_configuration_variables_["_language_"]="1-".$_configuration_variables_["_language_directory_cache_"];
$_configuration_variables_["_str_first_var_cache_tracking_"]="&";
//$_configuration_variables_["_str_first_var_cache_tracking_"]=(empty($_REQUEST["vte"]) ? "?vte=0&" : "?vte=1&");
$_configuration_variables_["_character_url_enclosed_"]='"';
$_configuration_variables_["_start_php_tag_"]='<?php ';
$_configuration_variables_["_end_php_tag_"]=' ? >';
//movies|id|id_sponsor|id_flux|id_fk|
if($_REQUEST["vte"]==1){//engine for tracking activated
$_configuration_variables_["_cache_tracking_"]="/tracking";
$_configuration_variables_["_variables_tracking_engine_"]["_flag_"]="yes";
$_configuration_variables_["_variables_tracking_engine_"]["_acceptable_vars_"]=array("vte","srcid","cid","tck1","tck2","lg","dm","psid","prid","tp1","tp2","cf","data","tcki1","tcki2","oid","rebill","url","urlplayer","tpsid");
switch ($_REQUEST["fuo"]) {//flag of our url out
case "fif": //flag iframe
$_configuration_variables_["_variables_tracking_engine_"]["_url_out_"]="http://www.premium-sponsor.net/iframe.php?fr_src=out.php&";
break;
case "fu": //flag url
$_configuration_variables_["_variables_tracking_engine_"]["_url_out_"]="http://www.premium-sponsor.net/out.php".$_configuration_variables_["_str_first_var_cache_tracking_"];
break;
}
$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"]=$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_hidden_field_"]="";
foreach($_configuration_variables_["_variables_tracking_engine_"]["_acceptable_vars_"] as $_k_acceptable_vars_=>$_v_acceptable_vars_){
$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"].=$_v_acceptable_vars_.'='.'{_var_php_'.$_v_acceptable_vars_.'_}&';
$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_hidden_field_"].='<input type="hidden" name="'.$_v_acceptable_vars_.'" value="{_var_php_'.$_v_acceptable_vars_.'_}">';
}
}
//videos,websites,galleries,partner_links,liveshow
switch ($_configuration_variables_["_variable_template_to_load_"]) {
case "disclaimer":
$_var_life_time_=3600;
$_var_main_file_path_file_name_cache_= $_configuration_variables_["_main_section_"]."/pages".$_configuration_variables_["_cache_tracking_"];
$_var_array_sections_="";
break;
case "index":
$_var_life_time_=3600;
$_var_main_file_path_file_name_cache_= $_configuration_variables_["_main_section_"]."/pages".$_configuration_variables_["_cache_tracking_"];
$_var_array_sections_=array("videos","websites","galleries","partner_links");
break;
}
$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_life_time_"]=$_var_life_time_;
$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_main_file_path_file_name_cache_"]=$_var_main_file_path_file_name_cache_;
$_configuration_variables_["_array_sections_"][$_configuration_variables_["_variable_template_to_load_"]]=$_var_array_sections_;
$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_file_path_file_name_cache_"]= md5(str_replace("/","-",$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_main_file_path_file_name_cache_"]."/".$_configuration_variables_["_variable_template_to_load_"]));
//variables of configuration
$_cache_life_time_file_["_tmp_char_language_"]="_";
$_configuration_variables_["_domain_path_to_dir_cache_"]=$_configuration_variables_["_tmp_path_to_update_"]."/".$_cache_life_time_file_["_tmp_char_language_"].$_configuration_variables_["_language_directory_cache_"]."/cache/";
$_configuration_variables_["_main_path_loop_"]=$_configuration_variables_["_domain_path_to_dir_cache_"].$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_main_file_path_file_name_cache_"];
$_configuration_variables_["_final_path_file_at_cache_"]=$_configuration_variables_["_main_path_loop_"]."/".$_configuration_variables_["_variable_template_to_load_"].$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_file_path_file_name_cache_"];
//sendemailwarning($GLOBALS["mailwarning"],$varsubject="cron aborted->emergency",$myXML);
if( $_configuration_variables_["_cache_validation_"]=="no" || !is_readable($_configuration_variables_["_final_path_file_at_cache_"]) || filemtime($_configuration_variables_["_final_path_file_at_cache_"]) < (time()-$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_life_time_"])){
//place variables only necessary at the creation of the page@cache here... less memory ...
$_configuration_variables_["_domain_path_to_css_"]=$_configuration_variables_["_tmp_path_to_update_"]."/templates/adult/css/twoColFixLtHdr.css";
$_configuration_variables_["_domain_path_to_css_at_cache_"]=$_configuration_variables_["_domain_path_to_dir_cache_"].$_configuration_variables_["_main_section_"]."/css/twoColFixLtHdr{_id_category_}.css";
$_configuration_variables_["_domain_path_to_images_"]=$_configuration_variables_["_tmp_path_to_update_"]."/templates/adult/images";
$_configuration_variables_["_pagination_separator_"]="|";
$_configuration_variables_["_flag_level_"]=0;
$_configuration_variables_["_flag_trigers_"]="";
$_configuration_variables_["_domain_path_to_templates_"]=$_configuration_variables_["_tmp_path_to_update_"]."/templates/".$_configuration_variables_["_main_section_"]."/";
$_configuration_variables_["_template_to_load_"]=$_configuration_variables_["_domain_path_to_templates_"]."".$_configuration_variables_["_variable_template_to_load_"].".html";
$_configuration_variables_["_path_to_serialized_files_app_"]=$_configuration_variables_["_tmp_path_to_update_"]."/_serialized_files_app_/";
$_configuration_variables_["_path_to_serialized_files_app_last_records_"]=$_configuration_variables_["_path_to_serialized_files_app_"]."results/lastrecords/".$_configuration_variables_["_main_section_"]."/";
$_configuration_variables_["_path_to_serialized_file_categories_"]=$_configuration_variables_["_path_to_serialized_files_app_"]."categories/".$_configuration_variables_["_main_section_"]."/{_category_node_above_}/{_language_category_}/categories.txt";
$_configuration_variables_["_tags_"]=array("liveshow_rule_separateur_text"=>array("##","|?|","|:|"),"tag_separateur"=>array("|::|"),"symbol_separateur"=>array("|:0:|","|:1:|"));
if(!is_dir($_configuration_variables_["_main_path_loop_"])){
//explode the variable of thye array _main_filepath_file_name_cache_ to define the path to the file@cache...
$_array_of_the_path_for_dirs_=explode("/",$_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_main_file_path_file_name_cache_"]);
if(is_array($_array_of_the_path_for_dirs_)){
$_path_to_concatenate_="";
foreach($_array_of_the_path_for_dirs_ as $_k_array_of_the_path_for_dirs_=>$_v_array_of_the_path_for_dirs_){
//echo "_v_array_of_the_path_for_dirs_->".$_v_array_of_the_path_for_dirs_."<br>";
$_path_to_concatenate_.=$_v_array_of_the_path_for_dirs_."/";
$_substr_path_to_concatenate_=substr($_configuration_variables_["_domain_path_to_dir_cache_"].$_path_to_concatenate_,0,-1);
//echo "_substr_path_to_concatenate_->".$_substr_path_to_concatenate_."<br>";
if(!is_dir($_substr_path_to_concatenate_)){
if(!mkdir($_substr_path_to_concatenate_,0777)){
$myXML="Error creating directory for cache@:".$_substr_path_to_concatenate_;
sendemailwarning($GLOBALS["mailwarning"],$varsubject="creation of page at cache aborted->emergency",$myXML);
echo $myXML;
exit;
}
}
}
unset($_array_of_the_path_for_dirs_);
}
}
//get serialized files of the language ...
include("../_template_engine_.php");
$_buffer_of_the_page_=_parser_template_engine_($_configuration_variables_["_template_to_load_"],$_configuration_variables_["_language_"],$_configuration_variables_["_array_sections_"][$_configuration_variables_["_variable_template_to_load_"]],$_configuration_variables_["_flag_level_"],$_configuration_variables_["_flag_trigers_"]);
$_buffer_of_the_page_=trim($_buffer_of_the_page_);
//generate cache with final html ...
//check if it has section block ...
$_buffer_of_the_page_=_parser_sections_template_($_buffer_of_the_page_,$_configuration_variables_["_variable_template_to_load_"],$_configuration_variables_["_array_sections_"][$_configuration_variables_["_variable_template_to_load_"]],$_configuration_variables_["_language_"]);
//if tracking is activated replace ... otherwise erase
if($_configuration_variables_["_variables_tracking_engine_"]["_flag_"]=="yes"){
foreach($_configuration_variables_["_variables_tracking_engine_"]["_acceptable_vars_"] as $_k_acceptable_vars_=>$_v_acceptable_vars_){
$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"]=str_replace('{_var_php_'.$_v_acceptable_vars_.'_}', '{_start_php_tag_} echo $_REQUEST["'.$_v_acceptable_vars_.'"]; {_end_php_tag_}', $_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"]);
$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_hidden_field_"]=str_replace('{_var_php_'.$_v_acceptable_vars_.'_}', '{_start_php_tag_} echo $_REQUEST["'.$_v_acceptable_vars_.'"]; {_end_php_tag_}', $_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_hidden_field_"]);
}
//$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"]=str_replace('{_var_php_'.$_v_acceptable_vars_.'_}', '_start_php_tag_ echo $_REQUEST["'.$_v_acceptable_vars_.'"]; _end_php_tag_', $_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"]);
$_tmp_str_vars_tracking_=$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_"];
$_tmp_str_vars_tracking_hidden_field_=$_configuration_variables_["_variables_tracking_engine_"]["_str_vars_tracking_hidden_field_"];
$_tmp_str_first_var_cache_tracking_=$_configuration_variables_["_str_first_var_cache_tracking_"];
}else{
$_tmp_str_vars_tracking_=$_tmp_str_first_var_cache_tracking_=$_tmp_str_vars_tracking_hidden_field_="";
}
//echo '_tmp_str_vars_tracking_'.$_tmp_str_vars_tracking_.'&_tmp_str_first_var_cache_tracking_='.$_tmp_str_first_var_cache_tracking_.'<br>';
$_buffer_of_the_page_=str_replace(array('{_str_vars_tracking_}','{_str_first_var_cache_tracking_}','{_str_vars_tracking_hidden_field_}'),array($_tmp_str_vars_tracking_,$_tmp_str_first_var_cache_tracking_,$_tmp_str_vars_tracking_hidden_field_), $_buffer_of_the_page_);
//replace the variables of the language in the buffer after loading the serialized file..
foreach($_configuration_variables_ as $_k_configuration_variables_=>$_v_configuration_variables_){
//IF VARIABLE IS THE ONE SET TO BE USED BY THE CSS GENERATE THE CSS IN CACHE WITH THE CORRESPONDING VALUE OF THE CATEGORY IF IMAGE EXISTS...
if($_k_configuration_variables_=="_domain_path_to_css_"){
$_buffer_of_the_page_=_parser_section_css_template_($_REQUEST["cid"],$_buffer_of_the_page_,$_configuration_variables_["_language_"]);
}else{//if($_k_configuration_variables_=="_domain_path_to_css_"){
$_buffer_of_the_page_ =str_replace('{'.$_k_configuration_variables_.'}', $_v_configuration_variables_, $_buffer_of_the_page_);
}
}
$_configuration_variables_["_variables_language_"] = unserialize(file_get_contents($_configuration_variables_["_path_to_serialized_files_app_"]."translations/".$_configuration_variables_["_main_section_"]."/".$_configuration_variables_["_language_"].".txt"));
if(is_array($_configuration_variables_["_variables_language_"])){
//echo "<pre>".print_r($_configuration_variables_["_variables_language_"])."</pre>";
foreach($_configuration_variables_["_variables_language_"] as $_k_variable_language_=>$_v_variable_language_){
$_buffer_of_the_page_=str_replace('{'.$_k_variable_language_.'}', $_v_variable_language_, $_buffer_of_the_page_);
}
}
//echo $_cache_life_time_file_[$_configuration_variables_["_variable_template_to_load_"]]["_file_path_file_name_cache_"]."<br><br>";
//generate the cache of the page ...
//tmp replace ... delete AFTER BEING ONLINE...
$_buffer_of_the_page_=str_replace('h:/programas/easyphp1-8/www/www.premium-sponsor.com', 'http://127.0.0.1/www.premium-sponsor.com', $_buffer_of_the_page_);
$f = fopen($_configuration_variables_["_final_path_file_at_cache_"], 'w');
fputs($f, $_buffer_of_the_page_);
fclose($f);
//echo $_buffer_of_the_page_;}else{ echo "@CACHE:<br>"; } include($_configuration_variables_["_final_path_file_at_cache_"]); // in the next version of www.premium-sponsor.com ... prepare one solution that considers that the parameters passed to one function will be always one array to avoid changing the functions each time one extra parameter is needed ... it's just added at the array ... function _parser_section_css_template_($_category_id_,$_buffer_of_the_page_,$_language_){
//consider the varibale language too later to prevent/consider) not only the category but the language too
$_configuration_variables_=$GLOBALS["_configuration_variables_"];
$_path_to_css_at_cache_=$_configuration_variables_["_domain_path_to_dir_cache_"].$_configuration_variables_["_main_section_"]."/css";
if(!is_dir($_path_to_css_at_cache_)){
if(!mkdir($_path_to_css_at_cache_,0777)){
$myXML="Error creating directory for css cache@:".$_path_to_css_at_cache_;
sendemailwarning($GLOBALS["mailwarning"],$varsubject="creation of page at cache aborted->emergency",$myXML);
echo $myXML;
exit;
}
}
if(!empty($_category_id_)){
if(is_file($_configuration_variables_["_domain_path_to_images_"]."/bg_adult".$_category_id_.".jpg")){
$_str_to_replace_id_category_=$_category_id_;
}else{
$_str_to_replace_id_category_="";
}
}else $_str_to_replace_id_category_="";
$_configuration_variables_["_domain_path_to_css_at_cache_"]=str_replace('{_id_category_}', $_str_to_replace_id_category_, $_configuration_variables_["_domain_path_to_css_at_cache_"]);
if(!is_file($_configuration_variables_["_domain_path_to_css_at_cache_"])){
//variables used@css== {_domain_path_to_images_} && {_id_category_}
$handlecss = fopen($_configuration_variables_["_domain_path_to_css_"], "r");
$contentscss = '';
while (!feof($handlecss)) {
$contentscss .= fread($handlecss,8192);
}
fclose($handlecss);
//pr
$contentscss=str_replace(array('{_domain_path_to_images_}','{_id_category_}'), array($_configuration_variables_["_domain_path_to_images_"],$_str_to_replace_id_category_), $contentscss);
//tmp replace ... delete AFTER BEING ONLINE...
$contentscss=str_replace('h:/programas/easyphp1-8/www/www.premium-sponsor.com', 'http://127.0.0.1/www.premium-sponsor.com', $contentscss);
$fcss = fopen($_configuration_variables_["_domain_path_to_css_at_cache_"], 'w');
fputs($fcss, $contentscss);
fclose($fcss);
unset($contentscss);
}
$_buffer_of_the_page_ =str_replace('{_domain_path_to_css_}', $_configuration_variables_["_domain_path_to_css_at_cache_"], $_buffer_of_the_page_);
return $_buffer_of_the_page_;} function _parser_sections_template_($_buffer_of_the_page_,$_variable_template_to_load_,$_array_sections_of_variable_template_to_load_,$_language_){
$_configuration_variables_=$GLOBALS["_configuration_variables_"];
$_pos_first_tag_section_=strpos($_buffer_of_the_page_, "{_section_block_}");
$_pos_last_tag_section_=strpos($_buffer_of_the_page_, "{/_section_block_}")+1;
if($_pos_first_tag_section_ !== false && $_pos_last_tag_section_ !== false ){
$_buffer_of_the_section_=substr($_buffer_of_the_page_,($_pos_first_tag_section_+strlen("{_section_block_}")),($_pos_last_tag_section_-$_pos_first_tag_section_-strlen("{/_section_block_}")));
//echo "_buffer_of_the_section_:".$_buffer_of_the_section_."<br>";
if(is_array($_array_sections_of_variable_template_to_load_)){
foreach($_array_sections_of_variable_template_to_load_ as $_k_array_sections_of_variable_template_to_load_=>$_v_array_sections_of_variable_template_to_load_){
//process section of template
if(!empty($_configuration_variables_["_sub_sections_"][$_v_array_sections_of_variable_template_to_load_])){
$_array_final_buffer_of_the_section_[$_v_array_sections_of_variable_template_to_load_]=_parser_single_section_template_($_buffer_of_the_section_,$_variable_template_to_load_,$_v_array_sections_of_variable_template_to_load_,$_language_);
}
}
}
if(is_array($_array_final_buffer_of_the_section_)){
//replace the sections @the buffer of the page and return the final buffer of the page
//echo "<pre>".print_r($_array_final_buffer_of_the_section_)."</pre>";
$_final_html_section_=implode('<br>',$_array_final_buffer_of_the_section_);
unset($_array_final_buffer_of_the_section_,$GLOBALS["_array_serialized_categories_"]);//$GLOBALS["_array_serialized_categories_"] is used to prepare categories inside the sub sections
}
$_buffer_of_the_page_=str_replace(substr($_buffer_of_the_page_,($_pos_first_tag_section_),($_pos_last_tag_section_-$_pos_first_tag_section_+strlen("{/_section_block_}"))),$_final_html_section_,$_buffer_of_the_page_);
//replace the final html code of the section @ the buffer of the page
}
return $_buffer_of_the_page_;
}
function _parser_single_section_template_($_buffer_of_the_section_,$_variable_template_to_load_,$_v_array_sections_of_variable_template_to_load_,$_language_){
$_language_="2-uk";
$_configuration_variables_=$GLOBALS["_configuration_variables_"];
$_final_path_to_serialized_file_last_results_["_main_path_last_results_"]=$_configuration_variables_["_path_to_serialized_files_app_last_records_"].$_configuration_variables_["_sub_sections_"][$_v_array_sections_of_variable_template_to_load_]."/-/".$_language_."/";
$_final_path_to_serialized_file_last_results_["_info_file_last_results_"]=$_final_path_to_serialized_file_last_results_["_main_path_last_results_"]."_serialized_.txt";
$_final_path_to_serialized_file_last_results_["_serialized_file_last_results_"]=$_final_path_to_serialized_file_last_results_["_main_path_last_results_"]."1_serialized_.txt";
//echo $_buffer_of_the_section_.",".$_variable_template_to_load_.",".$_v_array_sections_of_variable_template_to_load_.",".$_language_."@<br>";
//echo "<pre>".print_r($_final_path_to_serialized_file_last_results_)."</pre>";
//echo $_final_path_to_serialized_file_last_results_["_info_file_last_results_"]."<br>";
if(is_file($_final_path_to_serialized_file_last_results_["_info_file_last_results_"])){
//echo "is ok and inside<br>";
//open it and the serialized file to parse the section...
$_tmp_array_info_ = explode("|",implode('',file($_final_path_to_serialized_file_last_results_["_info_file_last_results_"])));
$_number_of_serialized_files_=$_tmp_array_info_[0];
$_number_of_records_total_=$_tmp_array_info_[1];
$_array_information_serialized_= unserialize(file_get_contents($_final_path_to_serialized_file_last_results_["_serialized_file_last_results_"]));
if(is_array($_array_information_serialized_)){
$_number_of_records_serialized_file_=sizeof($_array_information_serialized_["id"]);
//echo "<pre>".print_r($_array_information_serialized_)."</pre>";
}
//echo $info."<br>";
}
$_number_of_records_random_=array(
"index"=>array("videos"=>10,"websites"=>10,"galleries"=>10,"partner_links"=>10),
"category_detail"=>array("videos"=>10,"websites"=>10,"galleries"=>10,"partner_links"=>10)
);
//echo "<pre>".print_r($_number_of_records_random_)."</pre>";
//echo '_number_of_records_total_:'.$_number_of_records_total_.'@_number_of_records_serialized_file_'.$_number_of_records_serialized_file_.'@number of records random'.$_number_of_records_random_[$_variable_template_to_load_][$_v_array_sections_of_variable_template_to_load_].'<br>';
if($_variable_template_to_load_=="index"){
if($_v_array_sections_of_variable_template_to_load_=="videos" || $_v_array_sections_of_variable_template_to_load_=="websites" || $_v_array_sections_of_variable_template_to_load_=="galleries"){
$_section_title_html_main_block_='<b>{_word_'.$_v_array_sections_of_variable_template_to_load_.'_}</b> :: [ {_word_random_}->{_number_of_records_random_}, {_word_last_}->{_number_of_records_total_random_group_} ]->[ {_word_total_}->{_number_of_records_total_} ]';
}else if($_v_array_sections_of_variable_template_to_load_=="partner_links"){
$_section_title_html_main_block_='<b>{_word_'.$_v_array_sections_of_variable_template_to_load_.'_}</b> :: [{_word_last_}->{_number_of_records_random_}], [{_word_total_}->{_number_of_records_total_}]';
}
$_section_title_html_main_block_=str_replace(array('{_number_of_records_random_}','{_number_of_records_total_random_group_}','{_number_of_records_total_}'),array($_number_of_records_random_[$_variable_template_to_load_][$_v_array_sections_of_variable_template_to_load_],$_number_of_records_serialized_file_,$_number_of_records_total_), $_section_title_html_main_block_);
//echo '_section_title_html_main_block_:'.$_section_title_html_main_block_."<br>";
$_section_records_html_section_='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%" valign="top" align="center">{_html_list_of_records_}</td></tr></table>';
//prepare array to be applied...
if($_number_of_records_serialized_file_<=$_number_of_records_random_[$_variable_template_to_load_][$_v_array_sections_of_variable_template_to_load_]){
$_final_array_display_=$_array_information_serialized_;
}else{
$_keys_final_array_display_=array_rand($_array_information_serialized_["id"], $_number_of_records_random_[$_variable_template_to_load_][$_v_array_sections_of_variable_template_to_load_]);
if(is_array($_keys_final_array_display_)){
//echo "<pre>".print_r($_keys_final_array_display_)."</pre>";
if(is_array($_array_information_serialized_)){
foreach($_array_information_serialized_ as $_k_array_information_serialized_=>$_v_array_information_serialized_){
foreach($_keys_final_array_display_ as $_k_keys_final_array_display_=>$_v_keys_final_array_display_){
$_final_array_display_[$_k_array_information_serialized_][$_v_keys_final_array_display_]=$_array_information_serialized_[$_k_array_information_serialized_][$_v_keys_final_array_display_];
}
}
}
}
unset($_keys_final_array_display_,$_array_information_serialized_);
}
if(is_array($_final_array_display_)){
foreach($_final_array_display_ as $_k_final_array_display_=>$_v_final_array_display_){
if($_k_final_array_display_=="str_movies_categories"){
//path to categories at serialized files ...
//prepare the categories ...
if(is_array($_v_final_array_display_)){
foreach($_v_final_array_display_ as $_k_v_final_array_display_=>$_v_v_final_array_display_){
$_final_array_display_[$_k_final_array_display_][$_k_v_final_array_display_]=_return_categories_information_($_v_v_final_array_display_,$_language_);
}//foreach($_v_final_array_display_ as $_k_v_final_array_display_=>$_v_v_final_array_display_){
}
}
}
//$_tmp_field_array_=explode($GLOBALS["tag_separateur"][0],$_row_select_info_movies_[5]);
// _parser_return_tags_information_("length",$_tmp_field_array_);
//echo "<pre>".print_r($_final_array_display_)."</pre>";
$_str_tmp_html_section_='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
$_str_tmp_html_section_records_="";
foreach($_final_array_display_["id"] as $_k_final_array_display_=>$_v_final_array_display_){
//get the title...
//$_configuration_variables_["_tags_"]=array("liveshow_rule_separateur_text"=>array("##","|?|","|:|"),"tag_separateur"=>array("|::|"),"symbol_separateur"=>array("|:0:|","|:1:|"));
$_tmp_field_array_=explode($_configuration_variables_["_tags_"]["tag_separateur"][0],$_final_array_display_["description"][$_k_final_array_display_]);
$_str_tmp_html_section_records_.='<tr><td width="100%" valign="top" align="center" colspan="2">'._parser_return_tags_information_("title",$_tmp_field_array_).'</td></tr>';
}
$_str_tmp_html_section_.=$_str_tmp_html_section_records_.="</table>";
}
$_section_records_html_section_=str_replace(array('{_html_list_of_records_}'),array($_str_tmp_html_section_), $_section_records_html_section_);
$_buffer_of_the_section_=str_replace(array('{_section_title_}','{@_html_section_@}'),array($_section_title_html_main_block_,$_section_records_html_section_), $_buffer_of_the_section_);
//prepare the
//html code for index and each section... directly here ... to reduce the pointer,etc to files ...
//point to serialized files of-> $_v_array_sections_of_variable_template_to_load_ and return the last 10 recors of the section and the number of records...
}
//echo '_buffer_of_the_section_:'.$_buffer_of_the_section_."<br>";
return $_buffer_of_the_section_;
}
function _return_categories_information_($_str_of_categories_,$_language_){
$_configuration_variables_=$GLOBALS["_configuration_variables_"];
$_final_str_to_return_="";
$_tmp_array_categories_=explode("|",$_str_of_categories_);
if(is_array($_tmp_array_categories_)){
foreach($_tmp_array_categories_ as $_k_tmp_array_categories_=>$_v_tmp_array_categories_){
//echo $_k_tmp_array_categories_."=>".$_v_tmp_array_categories_."...<br>";
if(strlen(trim($_v_tmp_array_categories_))>1){
$_tmp_array_categories_detail_=explode("-",$_v_tmp_array_categories_);
if(is_array($_tmp_array_categories_detail_)){
//first position is the id of category, second the node above
//$_configuration_variables_["_path_to_serialized_file_categories_"]=$_configuration_variables_["_path_to_serialized_files_app_"].$_configuration_variables_["_main_section_"]."/{_category_node_above_}/{_language_category_}/categories.txt";
$_path_to_serialized_file_categories_=str_replace(array('{_category_node_above_}','{_language_category_}'),array($_tmp_array_categories_detail_[1],$_language_), $_configuration_variables_["_path_to_serialized_file_categories_"]);
$_path_to_serialized_file_categories_main_node_=str_replace(array('{_category_node_above_}','{_language_category_}'),array(539,$_language_), $_configuration_variables_["_path_to_serialized_file_categories_"]);
if(empty($_tmp_array_categories_detail_[0])&& empty($_tmp_array_categories_detail_[1])){
$_final_str_to_return_="{_word_no_categorie_}";
}else{
if(!is_array($GLOBALS["_array_serialized_categories_"][$_tmp_array_categories_detail_[1]][$_language_])){
$GLOBALS["_array_serialized_categories_"][$_tmp_array_categories_detail_[1]][$_language_][]=unserialize(file_get_contents($_path_to_serialized_file_categories_main_node_));
$GLOBALS["_array_serialized_categories_"][$_tmp_array_categories_detail_[1]][$_language_][]= unserialize(file_get_contents($_path_to_serialized_file_categories_));
}
if(is_array($GLOBALS["_array_serialized_categories_"][$_tmp_array_categories_detail_[1]][$_language_])){
//echo "<pre>".print_r($GLOBALS["_array_serialized_categories_"])."</pre>";
$_final_str_to_return_.=$_tmp_array_categories_detail_[0].";".$GLOBALS["_array_serialized_categories_"][$_tmp_array_categories_detail_[1]][$_language_][1][$_tmp_array_categories_detail_[0]]."-".$_tmp_array_categories_detail_[1].";".$GLOBALS["_array_serialized_categories_"][$_tmp_array_categories_detail_[1]][$_language_][0][$_tmp_array_categories_detail_[1]]."|";
}
}
}
}
}
unset($_tmp_array_categories_);
}
//echo $_final_str_to_return_."<br>";
return substr($_final_str_to_return_,0,-1);
}
function _parser_return_tags_information_($_name_tags_,$_txt_to_parse_){
//echo $_txt_to_parse_."<br><br>";
if(is_array($_txt_to_parse_)){
foreach($_txt_to_parse_ as $_key_txt_to_parse_=>$_value_txt_to_parse_ ){
if(is_array($_name_tags_)){
foreach($_name_tags_ as $_key_name_tag_=>$_value_name_tag_){
if(substr_count($_value_txt_to_parse_, $_value_name_tag_)>0){
$_final_txt_tag_[$_value_name_tag_]=get_text_information($_value_txt_to_parse_,$_value_name_tag_);
break;
}
}
}else{
if(substr_count($_value_txt_to_parse_, $_name_tags_)>0){
$_final_txt_tag_=get_text_information($_value_txt_to_parse_,$_name_tags_);
}
}
}
}
return $_final_txt_tag_;
}
function get_text_information($_txt_to_parse_,$_name_tag_){
$_configuration_variables_=$GLOBALS["_configuration_variables_"];
if(substr_count($_txt_to_parse_, $_name_tag_)>0){
//echo "start:".stripos_php_4($_txt_to_parse_, $GLOBALS["symbol_separateur"][0].$_name_tag_.$GLOBALS["symbol_separateur"][1]);
$start_position=stripos_php_4($_txt_to_parse_, $_configuration_variables_["_tags_"]["symbol_separateur"][0].$_name_tag_.$_configuration_variables_["_tags_"]["symbol_separateur"][1]);
$last_position=stripos_php_4($_txt_to_parse_, $_configuration_variables_["_tags_"]["symbol_separateur"][0]."end".$_name_tag_.$_configuration_variables_["_tags_"]["symbol_separateur"][1]);
$_size_of_separateur_=strlen($_configuration_variables_["_tags_"]["symbol_separateur"][0].$_name_tag_.$_configuration_variables_["_tags_"]["symbol_separateur"][1]);
$_txt_tag_=substr($_txt_to_parse_,($start_position+$_size_of_separateur_),($last_position-$_size_of_separateur_));
return $_txt_tag_;
}else{
}} function stripos_php_4($haystack, $needle){ return strpos(strtolower($haystack), strtolower($needle)); } ?> Kind regards, Carlos