... Controlar as drogas a escala planetaria,identificando o consumidor final,etc ... organizado por (...),etc,etc aplicando limites de consumo,etc... com a possibilidade de aplicar alertas,etc,etc
Parte de um pressuposto relativamente complexo ... sendo obvio que o parser nao e importante,etc,etc ... logica racional ...
Sao certamente bilioes de usd/euros por mes ...
A logica racional ... certamente esta:
$id_flux["idsponsor"]=2;
// $flux_treat=array(397,382,769,770);
//$flux_treat=array(397,382);
$flux_treat=array(521,6876);
$textemailmessage="";
include("../../conf.inc.php");
if(is_array($flux_treat)){
foreach($flux_treat as $kfluxtotreat => $vfluxtotreat){
//echo $kfluxtreatsubtype."
";
if(!empty($array_language_flux_default[$vfluxtotreat])){
$id_language_default=$array_language_flux_default[$vfluxtotreat];
}
$info_page_records=explode("|",$array_number_records_per_page_start_flux[$vfluxtotreat]);
if(is_array($id_flux["detail"][$vfluxtotreat])){
foreach($id_flux["detail"][$vfluxtotreat]["Sponsor"]["url"]["information"]["xml"] as $kfluxtreatsubtype=>$vfluxtreatsubtype){
//control if execution is allowed by kfluxtreatsubtype and add exit
echo $kfluxtreatsubtype."
";
if(check_lock_control_($kfluxtreatsubtype,"start")=="ok"){
$_ids_types_xml_cache_=$_ids_types_xml_[$kfluxtreatsubtype];
$_time_of_cache_flux_subtype=$_ids_types_xml_time_cache_[$kfluxtreatsubtype];
//echo "time of cache ".$_time_of_cache_flux_subtype."
";
if($kfluxtreatsubtype =="xml-movies"){
$number_records_or_end_position=$info_page_records[0];
$counterfilter=0;
foreach($id_flux["detail"][$vfluxtotreat]["languages"] as $klg => $vlg){
foreach($ids_cats_sponsor[$vfluxtotreat] as $kcat => $vcat){
$cat_convereted_cache=$vcat;
$pagenumb=$limitepaginas=$info_page_records[1];
while ($pagenumb<=$limitepaginas){
$replacements=array($id_flux["idsponsorfk"],$id_flux["loginsponsor"],$id_flux["passwordsponsor"],$kcat,"{idcatsonsponsor}",$pagenumb,$vlg,$number_records_or_end_position,"{filter}",$_SERVER['REMOTE_ADDR'],$id_flux["keysponsor"],"{tracker}","{iditemdetail}","{idsubitemdetail}","{subtracker}");
$urlstringtreat =str_replace($patterns, $replacements, $vfluxtreatsubtype);
$page_number_cache=$pagenumb;
echo "".$urlstringtreat."
";
$myXML = open_xml_parsing($generatecache="yes",$urlstringtreat,$id_flux["idsponsor"],$vfluxtotreat,$_ids_types_xml_cache_,$klg,$_id_filter_="x",$cat_convereted_cache,$_id_product_sub_type_="x",$_time_of_cache_flux_subtype,"yes|5;3|".$page_number_cache);
if(substr($myXML,0,8)=="ERRORMSG"){
$textemailmessage.=$myXML;
}else{
$xml = new CXml();
$xml->Set_XML_data($myXML);
$global1_[$video->id]['str_informations_db'] = prepare_strings_database(remove_weird_symbols_caracteres(treatment_string_tags($_complete_str_="",$_tag_to_treat_="",$str_array_str_informations_db),$vfluxtotreat));
unset($str_array_str_informations_db,$str_array_images);
$myMovie=movies_management($global1_);
if(substr($myMovie,0,8)=="ERRORMSG"){
$textemailmessage.=$myMovie;
unset($global1_[$video->id]);
}else{
unset($global1_[$video->id]);
}
}//if(!is_array($global1_[$video->id])){
}//foreach($xml->obj_data->videos_site[0]->videos[0]->video as $video){
}//if(isset($xml->obj_data->videos_site[0]->videos[0])){
}//else if(substr($myXML,0,8)=="ERRORMSG"){
$pagenumb++;
$limitepaginas=$xml->obj_data->videos_site[0]->navigation[0]->nb_pages[0];
unset($myXML);
if($pagenumb >$limitepaginas){
break;
}
}//while ($pagenumb<=$limitepaginas){
//echo $array_modules_to_include_subtype[$kfluxtreatsubtype]."
";
//@include($array_modules_to_include_subtype[$kfluxtreatsubtype]);
/*
if($vfluxtotreat==382 || $vfluxtotreat==397){
$myMovie=movies_management($global1_);
if(substr($myMovie,0,8)=="ERRORMSG"){
$textemailmessage.=$myMovie;
echo $textemailmessage."
";
}
unset($global1_);
}
*/
}//foreach($ids_cats as $kcat => $vcat){
/*
if($vfluxtotreat==382 || $vfluxtotreat==397){
$myMovie=movies_management($global1_);
if(substr($myMovie,0,8)=="ERRORMSG"){
$textemailmessage.=$myMovie;
echo $textemailmessage."
";
}
unset($global1_);
}
*/
$counterfilter++;
}//foreach($id_flux["detail"][$k]["languages"] as $klg => $vlg){
}
}//if(check_lock_control_($kfluxtreatsubtype)==""){
check_lock_control_($kfluxtreatsubtype,"end");
}//foreach($id_flux["detail"][$vfluxtotreat]["Sponsor"]["url"]["information"]["xml"] as $kfluxtreatsubtype=>$vfluxtreatsubtype){
}//if(is_array($id_flux["detail"])){
}
}
include("../include_footer.php");
?>
LATER:
function _parser_browse_categories_($_array_categories_to_browse_info_,$_flag_section_, $_flag_language_){
if(is_array($_array_categories_to_browse_info_)){
$_key_caregories_to_array_serialized_="-".implode("-",$_array_categories_to_browse_info_)."-";
$_sql_where_=" WHERE 1 AND (";
foreach($_array_categories_to_browse_info_ as $_k_array_categories_to_browse_info_=>$_v_array_categories_to_browse_info_){
$_sql_where_ .= " {_field_description_} LIKE '%|".$_v_array_categories_to_browse_info_."|%' OR ";
}//foreach($_array_categories_to_browse_info_ as $_k_array_categories_to_browse_info_=>$_v_array_categories_to_browse_info_){
$_sql_where_=substr($_sql_where_, 0, (strlen($_sql_where_)-3)).")";
}else{
if(empty($_array_categories_to_browse_info_)){
$_key_caregories_to_array_serialized_="-";
$_sql_where_=" WHERE 1 ";
}else{
$_key_caregories_to_array_serialized_="-".$_array_categories_to_browse_info_."-";
//prepare array
$_sql_where_=" WHERE 1 AND {_field_description_} LIKE '%|".$_array_categories_to_browse_info_."|%' ";
}
}
echo $_sql_where_."
";
if(is_array($_flag_section_)){
foreach($_flag_section_ as $_k_flag_section_=>$_v_flag_section_){
if($_k_flag_section_=="adult"){
if(is_array($_v_flag_section_)){
foreach($_v_flag_section_ as $_k_v_flag_section_=>$_v_v_flag_section_){
switch ($_v_v_flag_section_) {
case "Movies":
It could point to filesystem,etc instead of pointing to one database,etc...
$_sql_where_=str_replace("{_field_description_}", "str_movies_categories", $_sql_where_);
$_sql_="SELECT id,id_sponsor,id_flux,id_fk,id_language,movie_date,url_outs,description,imgs_final_paths_text FROM movies ".$_sql_where_." AND (id_language='".$_flag_language_."' OR str_movies_languages = '|".$_flag_language_."|') ORDER BY movie_date DESC";
$_result_sql_ = $GLOBALS["db"]->sql_query($_sql_);
if($_result_sql_){
$_array_to_serialize_number_of_records_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_]=$GLOBALS["db"]->sql_numrows();
$_count_file_serialized_=$_file_serialized_=0;
while($_row_sql_ = $GLOBALS["db"]->sql_fetchrow($_result_sql_)){
if($_row_sql_[4] != $_flag_language_){
//... get it from translations ...
$_sql_select_translations_="SELECT description FROM movies_translation WHERE id_language=".$_flag_language_;
$_result_sql_translations_ = $GLOBALS["db"]->sql_query($_sql_select_translations_);
if($_result_sql_translations_){
$_row_sql_translations_ = $GLOBALS["db"]->sql_fetchrow($_result_sql_translations_);
//replace @current field translations the values from translations...
$_title_=$GLOBALS["symbol_separateur"][0]."title".$GLOBALS["symbol_separateur"][1];
$_description_=$GLOBALS["symbol_separateur"][0]."description".$GLOBALS["symbol_separateur"][1];
$_tmp_field_array_=explode($GLOBALS["tag_separateur"][0],$_row_sql_[4]);
//loop array to update the title and description
foreach($_tmp_field_array_ as $_k_tmp_field_array_=>$_v_tmp_field_array_){
if(strpos($_v_tmp_field_array_, $_title_) !== false){
//get the index of the title
$_index_of_array_title_=$_k_tmp_field_array_;
}
if(strpos($_v_tmp_field_array_, $_description_) !== false){
//get the index of the description
$_index_of_array_description_=$_k_tmp_field_array_;
}
}
$_tmp_field_array_translations_=explode($GLOBALS["tag_separateur"][0],$_row_sql_translations_[0]);
foreach($_tmp_field_array_translations_ as $_k_tmp_field_array_translations_=>$_v_tmp_field_array_translations_){
if(strpos($_v_tmp_field_array_translations_, $_title_) !== false){
//get the index of the title
$_index_of_array_translation_title_=$_k_tmp_field_array_translations_;
}
if(strpos($_v_tmp_field_array_translations_, $_description_) !== false){
//get the index of the description
$_index_of_array_translation_description_=$_k_tmp_field_array_translations_;
}
}
//set the value of translation and implode the array to the final description ... not translated
$_tmp_field_array_[$_index_of_array_title_]= $_tmp_field_array_translations_[$_index_of_array_translation_title_] ;
$_tmp_field_array_[$_index_of_array_description_]= $_tmp_field_array_translations_[$_index_of_array_translation_description_] ;
$_row_sql_[4]=implode($GLOBALS["tag_separateur"][0], $_tmp_field_array_);
unset($_tmp_field_array_,$_tmp_field_array_translations_);//not unsetting the variables ..it's not essential and the array@unset is enough ... at loop
$GLOBALS["db"]->sql_freeresult($_result_sql_translations_);
}
}
//prepare to generate serialized files with the sql ... with 200 records per block ... 200 records per block is by default ... reasonable number!
if(($_count_file_serialized_%200)==0){
$_file_serialized_=($_count_file_serialized_/200)+1;
}
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["id"][]=$_row_sql_[0];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["id_sponsor"][]=$_row_sql_[1];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["id_flux"][]=$_row_sql_[2];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["id_fk"][]=$_row_sql_[3];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["movie_date"][]=$_row_sql_[5];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["url_outs"][]=$_row_sql_[6];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["description"][]=$_row_sql_[7];
$_array_to_serialize_[$_k_flag_section_][$_v_v_flag_section_][$_key_caregories_to_array_serialized_][$_flag_language_][$_file_serialized_]["imgs_final_paths_text"][]=$_row_sql_[8];
$_count_file_serialized_++;
}
$GLOBALS["db"]->sql_freeresult($_result_sql_);
}
break;
case "...":
echo "i equals ...";
break;
}
}
}//foreach($_v_flag_section_ as $_k_v_flag_section_=>$_v_v_flag_section_){
}//if($_k_flag_section_=="adult"){
}//foreach($_flag_section_ as $_k_flag_section_=>$_v_flag_section_){
}//if(is_array($_flag_section_)){
}
if(is_array($_array_to_serialize_)){
echo "
".print_r($_array_to_serialize_number_of_records_).""; if(!is_dir($GLOBALS["PathSerializedFilesApp"]."/results/")){ if(!mkdir($GLOBALS["PathSerializedFilesApp"]."/results", 0777)){ $myMSG="Error creating directory results@serialized"; echo $myMSG; exit; } } foreach( $_array_to_serialize_ as $_k_array_to_serialize_=>$_v_array_to_serialize_){ if(!is_dir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/")){ //$_k_flag_section_ if(!mkdir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_, 0777)){ $myMSG="Error creating directory results_k_flag_section_@serialized"; echo $myMSG; exit; } } if($_v_array_to_serialize_){ foreach($_v_array_to_serialize_ as $_k_v_array_to_serialize_=>$_v_v_array_to_serialize_){//$_v_v_flag_section_ if(!is_dir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/".$_k_v_array_to_serialize_."/")){ if(!mkdir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/".$_k_v_array_to_serialize_, 0777)){ $myMSG="Error creating directory results_k_flag_section_@_k_v_array_to_serialize_@serialized"; echo $myMSG; exit; } } if($_v_v_array_to_serialize_){ foreach($_v_v_array_to_serialize_ as $_k_v_v_array_to_serialize_=>$_v_v_v_array_to_serialize_){//$_key_categories_to_array_serialized_ if(!is_dir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/".$_k_v_array_to_serialize_."/".$_k_v_v_array_to_serialize_."/")){ if(!mkdir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/".$_k_v_array_to_serialize_."/".$_k_v_v_array_to_serialize_, 0777)){ $myMSG="Error creating directory results_k_flag_section_@_k_v_array_to_serialize_@_k_v_v_array_to_serialize_@serialized"; echo $myMSG; exit; } } if($_v_v_v_array_to_serialize_){ foreach($_v_v_v_array_to_serialize_ as $_k_v_v_v_array_to_serialize_=>$_v_v_v_v_array_to_serialize_){//$_flag_language_ $_number_of_records_=$_array_to_serialize_number_of_records_[$_k_array_to_serialize_][$_k_v_array_to_serialize_][$_k_v_v_array_to_serialize_][$_k_v_v_v_array_to_serialize_]; $_k_v_v_v_array_to_serialize_=$GLOBALS["_languages_to_create_"][$_k_v_v_v_array_to_serialize_]; if(!is_dir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/".$_k_v_array_to_serialize_."/".$_k_v_v_array_to_serialize_."/".$_k_v_v_v_array_to_serialize_."/")){ if(!mkdir($GLOBALS["PathSerializedFilesApp"]."/results/".$_k_array_to_serialize_."/".$_k_v_array_to_serialize_."/".$_k_v_v_array_to_serialize_."/".$_k_v_v_v_array_to_serialize_, 0777)){ $myMSG="Error creating directory results_k_flag_section_@_k_v_array_to_serialize_@_k_v_v_array_to_serialize_@_k_v_v_v_array_to_serialize_@serialized"; echo $myMSG; exit; } } } if(is_array($_v_v_v_v_array_to_serialize_)){ echo "[$_k_array_to_serialize_][$_k_v_array_to_serialize_][$_k_v_v_array_to_serialize_][$_k_v_v_v_array_to_serialize_]
".print_r($_v_v_v_v_v_array_to_serialize_).""; echo "