true)); $user = new Users('default', array('iweb' => true)); $catalog = new CatalogFront(); $articles = new Articles('default',array('iweb' => true)); $newsletter = new Newsletter('default',array('iweb' => true)); //$events = new Events('default',array('iweb' => true)); //$cards = new Cards('default',array('iweb' => true)); $blog = new Blog('default',array('iweb' => true)); $invoice = new Invoice('default',array('iweb' => true)); //$exercises = new Exercise('default',array('iweb' => true)); //$iexpert = new iExpert('default',array('iweb' => true)); //$idirectory = new Local_Directory('default',array('iweb' => true)); $lang = new Language('default',array('iweb' => true)); if ($page->client_has_package('translate')){ $page->language_html=$lang->google_translate(); } else{ $page->language_html=$lang->language_bar(); } //internet_consultant HACK if (isset($_GET['ic']) && intval($_GET['ic'])>0 && $_SERVER['HTTP_HOST']=='iweb.bg'){ $ic_id=intval($_GET['ic']); $qrow=MySql::query_fetch_first("SELECT * FROM ic_web_profile WHERE ic_id = {$ic_id}"); if ($qrow!==false){ $page->merge_p($qrow); $page->p->ic_skype_button=($qrow['ic_skype']=="")?"":$page->template_include("templates/general/ic_skype_button.html.php"); $_SESSION["internet_consultant"]=($qrow['ic_text']=="")?"":$page->template_include("templates/general/internet_consultant.html.php"); $_SESSION["ic_contacts"]=($qrow['ic_phone']=="" && $qrow['ic_gsm']=="")?"":$page->template_include("templates/general/ic_contacts.html.php"); } } elseif (!isset($_SESSION["ic_contacts"]) && $_SERVER['HTTP_HOST']=='iweb.bg'){ $page->p->ic_gsm="0882258313"; $page->p->ic_phone="028845911"; $_SESSION["ic_contacts"]=$page->template_include("templates/general/ic_contacts.html.php"); $_SESSION["internet_consultant"]=""; } elseif(!isset($_SESSION["ic_contacts"]) && $_SERVER['HTTP_HOST']!='iweb.bg'){ $_SESSION["ic_contacts"]=""; $_SESSION["internet_consultant"]=""; } // initialize page - common sections to all iweb pages initialize_page(); //***************************************************************************************************************** // Determine request type and populate request specific areas in the page //***************************************************************************************************************** $request_type = determine_request(); switch($request_type) { case 'load': load_file($_REQUEST['f']); break; case 'content': request_content($_REQUEST['content']); break; // case 'newcontent': request_content($_REQUEST['content']); break; // case 'oldcontent': request_content($content->get_new_content_id($_REQUEST['content'])); break; // case 'directorycontent': request_directory_content($_GET['directorycontent']); break; case 'showhomepage': request_homepage(); break; case 'article': request_article($_REQUEST['article'],0); break; // case 'oldarticle': request_article($newsletter->get_new_article_id($_REQUEST['article']),0); break; // case 'newnewsletter': request_article($_REQUEST['newsletters'],1); break; // case 'oldnewsletter': request_article($newsletter->get_new_article_id($_REQUEST['newsletter']),1); break; // case 'newsletterarchive': request_newsletter_archive(); break; case 'newsletteractivate': request_newsletter_activate($_REQUEST['activate']); break; case 'newsletterunsubscribe': $page->content = $newsletter->unsubscribe($_REQUEST['subscriber_email']); break; // case 'showcalendar': request_calendar(); break; // case 'showcalendarevents': request_calendar_events(); break; // case 'showcard': request_card(); break; // case 'showbirthdaycard': request_birthday_card(); break; // case 'cardunsubscribe': request_unsubscribe_card(); break; case 'showblog': request_blog(); break; case 'showblogpostnew': request_blog_post($_REQUEST['pid'],1); break; case 'showblogpostold': request_blog_post($blog->get_new_blogpost_id($_REQUEST['pid']),1); break; case 'showblogcommentsnew': request_blog_post($_REQUEST['pid'],0); break; case 'showblogcommentsold': request_blog_post($blog->get_new_blogpost_id($_REQUEST['pid']),0); break; case 'blogcommentdelete': request_blog_comment_delete(); break; case 'publicshared': request_public_shared_content($_REQUEST['page_direct']); break; case 'robots': include("robots.php"); exit; break; case 'search': request_search(); break; case 'register': request_register(); break; case 'register_firm': request_register_firm(); break; case 'forgotpassword': request_forgot_password(); break; case 'login': request_login(); break; case 'logout': $user->logout(); break; case 'myaccount': request_myaccount(); break; case 'question_of_the_day': request_question_of_the_day(); break; case 'question_of_the_day2': request_question_of_the_day2(); break; case 'my_answers': request_my_answers(); break; case 'game_results': request_game_results(); break; case 'game_results2': request_game_results2(); break; case 'editprofile': request_profile(); break; case 'newssubscribe': request_newsletter_subscriptions(); break; // case 'editcardsubscribe': request_card_subscriptions(); break; case 'sendtofriend': $page->send_to_friend(); break; case 'requestappointment': $page->request_appointment(); break; case 'sendemailowner': $page->send_to_doctor(); break; case 'sendemailpage': send_to_doctor_page(); break; case 'sendemailsample': send_to_mail_sample(); break; case 'sendemailpageral': send_to_ral_page(); break; case 'sendsimple': sendsimpleemail(); break; // case 'sendsmsowner': $page->send_to_sms(); break; // case 'callowner': $page->click_to_call(); break; case 'rawcontent': request_raw_content(); break; // case 'showexercisectgy': request_exercise_category($_REQUEST['id']); break; // case 'showexercise': request_exercise($_REQUEST['id']); break; // case 'showmyexercises': request_my_exercises(); break; // case 'iexpertquestions': $page->content = $iexpert->show_questions(); break; // case 'idirectorysearch': $page->content = $idirectory->search_front_end(); break; // case 'idirectorysearchcity': $page->content = $idirectory->search_by_city(); break; // case 'idirectoryshowcity': $page->content = $idirectory->show_city(); break; // case 'idirectorydetails': $page->content = $idirectory->show_premium_detals(); break; case 'showstorecategory': request_store_category($_REQUEST['category_id']); break; case 'showstoreproduct': request_store_product($_REQUEST['product_id']); break; case 'catalogtopproducts': request_store_products('top'); break; case 'catalogsale': request_store_products('sale'); break; case 'catalogmin': request_store_products_min('min'); break; case 'catalogsearch': request_store_products('search'); break; case 'showmanufacturer': request_manufacturer($_REQUEST['manufacturer_id']); break; case 'showmanufacturerproducts':request_manufacturer_products($_REQUEST['manufacturer_id']); break; case 'addtocart': request_add_to_cart(); break; case 'addwishlist': request_add_wishlist(); break; case 'wishlist': request_wishlist(); break; case 'showstorecart': request_store_cart(); break; case 'catalogcheckout': request_catalog_checkout(); break; case 'catalogthank': request_catalog_thank_you(); break; case 'directory_search': directory_search(); break; case 'directory_details': directory_details(); break; // case 'showstoreinvoice': request_store_invoice(); break; case 'showmyorders': request_store_my_orders(); break; case 'showmanufacturerpage': request_show_manufacturer_page(); break; // case 'paypalnotify': request_paypal_ipn(); break; // case 'paypaltransfer': request_paypal_pdt(); break; case 'add_invoice': request_add_invoice(); break; case 'list_invoice': request_list_invoice(); break; case 'view_invoice': request_view_invoice(); break; case 'showgallery': request_show_gallery(); break; case 'showgalleryinfo': request_show_gallery_info($_REQUEST['gallery_id']); break; case 'showgallerycat': request_show_gallery_cat($_REQUEST['category_id']); break; case 'showprojects': request_show_projects(); break; case 'shownews': request_show_news(); break; case 'shownewsinfo': request_show_news_info($_REQUEST['news_id']); break; case 'showcontacts': request_show_contacts(); break; case 'showaop': request_show_aop(); break; case 'showaopinfo': request_show_aop_info($_REQUEST['aop_id']); break; default: show_notfound(); break; } //***************************************************************************************************************** // Remaining common routines to be handled after the content has been set //***************************************************************************************************************** // content not found if (!isset($page->content)) show_notfound(); // if description is not set, set it from page content if (!$page->description) { $content_description=str_replace("\n", " ",substr(html_entity_decode(strip_tags(str_replace('\n', ' ',str_replace(' ',' ',$page->content)))), 0, 300)); $cut=strrpos($content_description," "); $page->description.=substr($content_description, 0, $cut)."..."; } // ampersand fix in descriptions $page->description = str_replace('&','&',str_replace('&','&', $page->description)); //catalog $page->catalog=""; if ($page->client_has_package('catalog')){ $catalog_settings = $catalog->get_catalog_settings(); $total_prices=$catalog->get_price_total(); $page->shopping_cart=""; $page->p->catalog_show_cart = 0; if ($catalog_settings['catalog_show_cart']==1){ /* $page->shopping_cart = '

'.$lang->shopping_cart.''; if (isset($_SESSION["shopping_cart"]) && is_array($_SESSION["shopping_cart"])){ $page->shopping_cart .= "
".$lang->products.": ".count($_SESSION["shopping_cart"]); $page->shopping_cart .= "
".$lang->price.": ".$catalog->format_price($total_prices["products_with_dds_total"])."лв. "; } $page->shopping_cart .= "

"; */ $page->p->catalog_show_cart = 1; $page->p->cart_name = $lang->shopping_cart; $page->p->cart_number_products = $lang->products.": ".count($_SESSION["shopping_cart"]); $page->p->cart_number_products_only = count($_SESSION["shopping_cart"]); $page->p->cart_price = $lang->price.": ".$catalog->format_price($total_prices["products_with_dds_total"])." ".$_SESSION["catalog_currency"]; $page->shopping_cart = $page->template_include("templates/catalog/cart.html.php"); } $page->catalog=""; if ($catalog_settings['catalog_show_nav']==1){ $lang_catalog_name=($page->language=='en')?$catalog_settings['catalog_name_en']:$catalog_settings['catalog_name']; $page->catalog_name = ''.$lang_catalog_name.''; $page->catalog_categories = ""; $page->catalog_search=""; if ($catalog_settings['catalog_show_featured']==1){ $page->catalog_categories .= "
  • ".$lang->top_products."
  • "; } if ($catalog_settings['catalog_show_categories']==1){ $page->catalog_categories .= $catalog->show_catalog_categories_nav(); $page->catalog_categories_caffe .= $catalog->show_catalog_categories_nav_caffe(); $page->catalog_categories_magi .= $catalog->show_catalog_categories_nav_magi(); $page->catalog_categories_emm .= $catalog->show_catalog_categories_nav_emm(); $page->catalog_categories_marsi .= $catalog->show_catalog_categories_nav_marsi(); $page->catalog_categories_filter .= $catalog->show_catalog_categories_nav_filter(); } if ($catalog_settings['catalog_show_sale']==1){ $page->catalog_categories .= "
  • ".$lang->sale."
  • "; } if ($catalog_settings['catalog_show_search']==1){ $page->catalog_search = ''; } $page->catalog = $page->template_include("templates/catalog/catalog_front_nav.html.php"); } $page->catalog_attribute_search=""; if ($catalog_settings['catalog_attribute_search']==1){ $page->catalog_attribute_search = $catalog->show_attribute_search(); } $page->catalog_manufacturers=""; if ($catalog_settings['catalog_manufacturers']==1){ $page->catalog_manufacturers = $catalog->show_manufacturers($catalog_settings['catalog_manufacturers_limit']); } $page->catalog_manufacturers_emm=""; if ($catalog_settings['catalog_manufacturers']==1){ $page->catalog_manufacturers_emm = $catalog->show_manufacturers_emm($catalog_settings['catalog_manufacturers_limit']); } $page->catalog_new_products=""; $page->catalog_new_products = $catalog->show_new_products(); $page->catalog_sale_products=""; $page->catalog_sale_products = $catalog->show_sale_products(); $page->category_products_fist_page=""; $page->category_products_fist_page = $catalog->show_category_products_fist_page(); // $page->drop_shopping_cart = $catalog->display_shopping_cart_drop(); $page->drop_shopping_cart = ""; $page->drop_shopping_cart = $catalog->display_shopping_cart_drop_front(); $page->category_fist_page=""; $page->category_fist_page = $catalog->show_category_fist_page(); // $page->elegant_slider=""; // $page->elegant_slider = $catalog->show_product_elegant_slider(); /** $page->catalog_slider_products=""; $page->catalog_slider_products = $catalog->show_slider_products(); $page->catalog_slider_products_last=""; $page->catalog_slider_products_last = $catalog->show_slider_products_last(); $page->catalog_new_front=""; $page->catalog_new_front = $catalog->show_new_front(); $page->catalog_manual_front=""; $page->catalog_manual_front = $catalog->show_manual_front(); $page->catalog_most_products=""; $page->catalog_most_products = $catalog->show_most_products(); **/ $page->catalog_button=""; if ($catalog_settings['catalog_use_button']==1){ if ($page->language=='en'){ $page->catalog_button = '
  • '.$catalog_settings['catalog_name_en'].'
  • '; } else{ $page->catalog_button = '
  • '.$catalog_settings['catalog_name'].'
  • '; } } } // page options need to be processed after the page processing finishes since one link includes the page title if ($page->client_page_options) $page->page_options = $page->generate_page_options(); $page->email_options=$page->generate_email_options(); // determine the skin to be used show the page // 404 грешка if (isset($page->is404) && $page->is404) { $page->section_title = "404 | Страницата не е намерена"; $page->title = "Страницата не е намерена | " . $page->client_site_title; $page->noindex = ''; $page->breadcrubs=""; $page->breadcrubs.= " » ".$page->section_title; $page->content = $page->template_include("templates/general/404.html"); } show_page_with_skin(); //***************************************************************************************************************** // // End of main program - start of routines // //***************************************************************************************************************** //****************************************************************************************************************************** // initialize page - common sections to all pages //****************************************************************************************************************************** function initialize_page() { global $page; global $content; global $user; global $newsletter; global $articles; // global $events; // global $cards; global $blog; // global $exercises; // global $idirectory; global $catalog; // global $directory_access; // global $iexpert; global $lang; // if under construction status is set and accessed with domain, do not show the site if ($page->client_under_construction && !$directory_access) show_under_construction(); // if www domain is requested and it is set to be redirected to base domain, do so if ($page->client_www_domain == WWW_DOMAIN_NONE && substr($_SERVER['HTTP_HOST'],0,3) == 'www' && !$directory_access) { header("Location: http://{$page->client_domain}"); exit; } // if base domain is requested and it is set to be redirected to www domain, do so if ($page->client_www_domain == WWW_DOMAIN_ONLY && $_SERVER['HTTP_HOST'] == $page->client_domain && !$directory_access) { header("Location: http://www.{$page->client_domain}"); exit; } // force reload of cached menu and other UI elements $force_db = isset($_GET['reload_menu']); $page->info_content_menu_box=""; $page->member_content_menu_box=""; $custom_content='custom_content_'.$page->language; $page->custom_content_menu =$content->get_js_menu($custom_content, 'h',$force_db); $custom_content='info_content_'.$page->language; $page->info_content_menu = $content->get_js_menu($custom_content, 'v',$force_db); if($page->info_content_menu!=""){ $page->info_menu_title=$lang->info_menu_title; $page->info_content_menu_box=$page->template_include("templates/general/info_content_box.html.php"); } $custom_content='member_content_'.$page->language; $page->member_content_menu = $content->get_js_menu($custom_content, 'v',$force_db); if($page->member_content_menu!=""){ $page->member_content_menu_box=$page->template_include("templates/general/member_content_box.html.php"); } $page->info_block_one=get_info_block('block_one'); $page->info_block_two=get_info_block('block_two'); $page->info_block_three=get_info_block('block_three'); $page->info_block_four=get_info_block('block_four'); $page->facebook=get_facebook(); $page->twitter=get_twitter(); $page->google=get_google(); $page->youtube=get_youtube(); $page->linkedin=get_linkedin(); $page->instagram=get_instagram(); $page->article_front=""; $page->article_front= $articles->article_front_page_content(); $page->https_redirect=""; $page->https_redirect= $content->show_https_redirect(); $page->catalog_biathlon=""; $page->catalog_biathlon = $catalog->show_catalog_biathlon(); $page->show_news_front=""; $page->show_news_front = $catalog->show_news_front_intro(); $page->show_news_new=""; $page->show_news_new = $catalog->show_news_new(); $page->show_news_slider=""; $page->show_news_slider = $catalog->show_news_slider_intro(); //$page->site_count= $content->show_site_count(); $page->kids_slider = $content->show_kids_slider(); $page->kids_slider_new = $content->show_kids_slider_new(); $page->kids_slider_10 = $content->show_kids_slider_10(); $page->kids_slider_11 = $content->show_kids_slider_11(); $page->kids_slider_12 = $content->show_kids_slider_12(); // $page->article_front_strategies=""; // $page->article_front_strategies= $articles->article_front_page_content_strategies(); // $page->article_front_consulting=""; // $page->article_front_consulting= $articles->article_front_page_content_consulting(); $page->article_front_cdg=""; $page->article_front_cdg= $articles->article_front_page_content_cdg(); $page->article_front_ogneborec=""; $page->article_front_ogneborec= $articles->article_front_page_content_ogneborec(); $page->article_front_ogneborec_back=""; $page->article_front_ogneborec_back= $articles->article_front_page_content_ogneborec_back(); $page->first_page_blog=""; $page->first_page_blog= $blog->first_page_show_blog(); $page->custom_form=""; $page->custom_form = $blog->get_custom_form(); $page->custom_form_2=""; $page->custom_form_2 = $blog->get_custom_form_2(); // $page->info_block_four=get_info_block('block_four'); //footer links $page->footer_links=$content->get_flat_menu("iedit_custom_content_".$page->language); //javascripts $page->common_js = $page->template_include("templates/common.js.php"); // welcome message - client domain name $page->user_wellcome_message = "www." . $page->client_domain . ""; // if member login is enabled for the client - display member login related stuff $page->client_member_login_box=""; if($page->client_member_login){ $page->user_profile="".$lang->my_account.""; $page->my_orders="".$lang->my_orders.""; $page->payment="".$lang->my_payment.""; $page->traders="".$lang->my_traders.""; // user is logged in if (isset($user->member_id)) { $page->user_wellcome_message='

    '.$lang->user_wellcome_message.ucwords(strtolower($user->member_firstname." ".$user->member_lastname)).'!

    '; // my account link should always display if members are turned on - if member is not logged in, it goes to login page $page->user_account_link="".$lang->my_account.""; $page->user_orders="".$lang->my_orders.""; $page->user_change_login_message="".$lang->logout.""; $page->user_change_status_message="".$lang->edit_profile.""; $page->small_login_form=$page->template_include("templates/users/user_logout_small.html.php"); } // user is not logged in else { $page->user_change_login_message="".$lang->login.""; $page->user_change_status_message="".$lang->register.""; $page->small_login_form=$page->template_include("templates/users/user_login_small.html.php"); } $page->client_member_login_box=$page->template_include("templates/general/client_member_login_box.html.php"); } //hide login box $page->login_registration_box=""; if($page->client_member_login){ $page->login_registration_box="".$lang->login_registration.' '; } // newsletter subscription form $page->newsletter_subscribe_form=""; if ($page->client_has_package('newsletter')){ $page->newsletter_subscribe_form = $newsletter->subscribe(); } // footer menu (to be used for brimhall in the future) $page->footer_menu = $content->get_footer_menu_html(); // default keywords $page->keywords = $page->client_keywords; // default page title $page->title = ucwords($content->replace_tokens($page->client_site_title)); // if the client is in trial mode, show the demo footer for experimenting with skins if ($page->client_trial_mode) $page->demo_template = $page->template_include("templates/skins/brands/" . $page->brand . "/demo.html.php"); // determine banner HTML source $page->banner = determine_banner(); } //****************************************************************************************************************************** // raw client content //****************************************************************************************************************************** function request_raw_content() { global $request_file; global $request_folders; global $approot; global $page; //debug $folder_url=""; // we do not serve PHP files as raw content if (preg_match('/\.(php)$/',$request_file)) show_notfound(); // determine the relative file path if (count($request_folders) > 0) $folder_url = '/' . join('/', $request_folders); $relative_file_path = $folder_url . '/' . $request_file; // check if the file exists in global space first if (file_exists($approot . $relative_file_path)) $absolute_file_path = $approot . $relative_file_path; // check if the file exists in client space elseif (file_exists($approot . '/clients/' . $page->client_id . $relative_file_path)) $absolute_file_path = $approot . '/clients/' . $page->client_id . $relative_file_path; // otherwise, not found else show_notfound(); // return the file to the browser serve_raw_content($absolute_file_path); } //****************************************************************************************************************************** // determine skin and display page //****************************************************************************************************************************** function show_page_with_skin() { global $page; // print skin template requested if (strpos($_SERVER["REQUEST_URI"],'print=1') !== false ){ $page->print_title=$page->section_title; include("templates/general/template_print_".$page->language.".html.php"); exit; } // save page skin template requested if(strpos($_SERVER["REQUEST_URI"],'save=1') !== false){ header('Content-type: text/html'); header('Content-Disposition: attachment; filename="'.array_shift(explode('?', basename(str_replace(".php", ".html",$_SERVER['REQUEST_URI']))))); $page->print_title=$page->section_title; include("templates/general/template_save_".$page->language.".html.php"); exit; } // if the client is using custom skin, read skin template from the client directory and render with it if ($page->skin_name == 'Custom Skin') { //$page->render_with("clients/" . $page->client_id . "/skin/template.html.php"); $page->render_with("client_theme/" . $page->client_id . "/template.html.php"); return; } // override from query string for demos and trials - they will be valid throughout the session if (isset($_GET['skin_template']) && strlen($_GET['skin_template']) > 0) $page->session_var('skin_template', $_GET['skin_template']); if (isset($_GET['skin_css']) && strlen($_GET['skin_css']) > 0) $page->session_var('skin_css', $_GET['skin_css']); if (strlen($page->session_var('skin_template')) > 0) $page->skin_template = $page->session_var('skin_template'); if (strlen($page->session_var('skin_css')) > 0) $page->skin_css = $page->session_var('skin_css'); // display the page $page->css = $page->skin_css; $page->render_with("templates/skins/" . $page->skin_template . ".html.php"); } //************************************************************************************ // determine client banner //************************************************************************************ function determine_banner() { global $page; global $approot; // default under construction banner $banner = "/images/common/banner.gif"; // admin set default banner is set and exists if (strlen($page->client_default_banner) > 0) { $default_banner = "/images/brands/" . $page->brand . "/banners/" . $page->client_id . "_" . $page->client_default_banner; if (file_exists($approot . $default_banner)) $banner = $default_banner; } // demo and trial query string override (only effective if client has not set a banner) - will continue during the session if (isset($_GET['banner']) && strlen($_GET['banner']) > 0) $page->session_var('banner', $_GET['banner']); if (strlen($page->session_var('banner')) > 0) $banner = "/images/brands/" . $page->brand . "/banners/" . $page->session_var('banner'); // client uploaded banner is set and exists if (strlen($page->client_banner) > 0) if (file_exists($approot . $page->client_banner)) $banner = $page->client_banner; //if english banner if ($page->language=='en' && strlen($page->client_banner_en) >0 ){ if (file_exists($approot . $page->client_banner_en)) $banner = $page->client_banner_en; } // banner width and height used for flash banners $width = $page->skin_width; $height = $page->skin_height; $pathinfo = pathinfo($banner); $page->banner_path = $banner; $ftype = strtolower($pathinfo['extension']); if ($ftype == "jpg" || $ftype == "jpeg") $banner = "\"\"title}\" name=\"image_banner_jpg\" />"; elseif ($ftype == "png") $banner = "\"\"title}\" name=\"image_banner_png\" />"; elseif ($ftype == "gif") $banner = "\"\"title}\" name=\"image_banner_gif\" />"; elseif ($ftype == "swf") { $bannerfile = $banner; $banner=" \n"; } return $banner; } function sendsimpleemail(){ global $page; $page->content = $page->send_simple(); // page title $page->section_title = "Форма за Контакт"; $page->title .= " :: Форма за Контакт"; } function send_to_doctor_page(){ global $page; $page->content = $page->send_to_doctor_page(); // page title $page->section_title = "Форма за Контакт"; $page->title .= " :: Форма за Контакт"; } function send_to_mail_sample(){ global $page; $page->content = $page->send_to_mail_sample(); // page title $page->section_title = "Форма за Контакт"; $page->title .= " :: Форма за Контакт"; } function send_to_ral_page(){ global $page; $page->content = $page->send_to_ral_page(); // page title $page->section_title = "Форма за Контакт"; $page->title .= " :: Форма за Контакт"; } //***************************************************************************************************************** // Handle a store shopping cart page request //***************************************************************************************************************** function request_add_to_cart() { global $page; global $catalog; // show shopping cart $page->content = $catalog->add_to_card(); // page title $page->section_title = "Пазарска Количка"; $page->title .= " :: ".$page->section_title; } function request_add_wishlist() { global $page; global $catalog; // show shopping cart $page->content = $catalog->add_wishlist(); // page title $page->section_title = "Любими продукти"; $page->title = $page->section_title." | "; $page->title .= $page->client_site_title; } function request_wishlist() { global $page; global $catalog; $page->breadcrubs=($page->language=='en')?"Home » Wishlist":"Начало » Любими продукти"; // show shopping cart $page->content = $catalog->display_wishlist(); // page title $page->section_title = "Любими продукти"; $page->title = $page->section_title. " | "; $page->title .= $page->client_site_title; $page->page_title=$page->section_title; } function request_store_cart() { global $page; global $catalog; // show shopping cart $page->content = $catalog->display_shopping_cart(); // page title $page->section_title = "Пазарска Количка"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Handle a store checkout page request //***************************************************************************************************************** function request_catalog_checkout() { global $page; global $catalog; // show checkout $page->content = $catalog->show_checkout(); // page title $page->section_title = "Поръчка"; $page->title .= " :: ".$page->section_title; } function request_catalog_thank_you() { global $page; global $catalog; // show checkout $page->content = $catalog->show_checkout(); // page title $page->section_title = "Поръчка"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Handle a store invoice page request //***************************************************************************************************************** function request_store_invoice() { global $page; global $store; // show checkout $page->content = $store->show_invoice(); // page title $page->section_title = "Store Invoice"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_store_my_orders() { global $page; global $catalog; global $user; // my account is for members only (if the member login is enabled for the client) if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); $page->breadcrubs=($page->language=='en')?"Home » My orders":"Начало » Моите поръчки"; // show shopping cart $page->content = $catalog->show_my_orders(); // page title $page->section_title = "Моите поръчки"; $page->title .= " :: ".$page->section_title; $page->page_title=$page->section_title; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_show_manufacturer_page() { global $page; global $catalog; global $user; // show shopping cart $page->content = $catalog->show_manufacturer_page(); // page title $page->section_title = "Производители"; $page->title .= " :: ".$page->section_title; } /* //***************************************************************************************************************** // Handle a paypal instant payment notification (IPN) request //***************************************************************************************************************** function request_paypal_ipn() { global $store; $store->payment_module($store->payment_module_id('paypalstd'))->instant_payment_notification(); } //***************************************************************************************************************** // Handle a paypal payment data transfer (PDT) request //***************************************************************************************************************** function request_paypal_pdt() { global $store; global $page; // execute payment data transfer - if successful, we'll be redirected to invoice screen here $page->content = $store->payment_module($store->payment_module_id('paypalstd'))->payment_data_transfer(); // successful execution of payment data transfer redirects to invoice - if we get to this point, it's an error $page->section_title = "PayPal Communications Error"; $page->title .= " :: ".$page->section_title; } */ //***************************************************************************************************************** // Handle a store category page request //***************************************************************************************************************** function request_store_category($category_id) { global $page; global $user; global $catalog; global $lang; // set store category $catalog->set_parent($category_id); // get the page content $page->content = $catalog->show_category(); $page->content .= $catalog->show_category_products(); // page title if ($page->language=='bg'){ if ($_REQUEST['category_id']>0){ $page->section_title = $catalog->show_catalog_categories_breadcrubs($category_id); } else { $page->section_title = $catalog->get_category_title(); } } if ($page->language=='en'){ $page->section_title = $catalog->get_category_title_en(); } if ($page->language=='th'){ $page->section_title = $catalog->get_category_title_th(); } $cat_seo_title=$catalog->get_cat_seo_title($category_id); if (empty($cat_seo_title)){ $page->title .= " :: ".$catalog->get_category_title(); } else { $page->title = $cat_seo_title; } $cat_seo_keywords=$catalog->get_cat_seo_metakw($category_id); if (empty($cat_seo_keywords)){ $page->keywords = $page->client_keywords; } else { $page->keywords = $cat_seo_keywords; } $cat_seo_description=$catalog->get_cat_seo_metadesc($category_id); if (empty($cat_seo_description)){ $page->description = str_replace('&','&',str_replace('&','&', $page->description)); } else { $page->description = $cat_seo_description; } $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title; $page->page_title=$catalog->show_catalog_categories_title($category_id); } function request_store_products($type){ global $page; global $catalog; global $lang; $page->content .= $catalog->show_category_products($type); // page title $page->section_title = " Ново"; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; $page->page_title=$page->section_title; } function request_store_product($product_id){ global $page; global $catalog; global $lang; $product_id=intval($product_id); // get the page content $page->content = $catalog->show_product($product_id); // page title if ($page->language=='bg'){ $page->section_title = $catalog->show_catalog_products_breadcrubs($product_id); } if ($page->language=='en'){ $page->section_title = $catalog->get_product_title_en(); } if ($page->language=='th'){ $page->section_title = $catalog->get_product_title_th(); } $cat_seo_title=$catalog->get_pr_seo_title($product_id); if (empty($cat_seo_title)){ $page->title .= " :: ".$catalog->get_product_title($product_id); } else { $page->title = $cat_seo_title; } $cat_seo_keywords=$catalog->get_pr_seo_metakw($product_id); if (empty($cat_seo_keywords)){ $page->keywords = $page->client_keywords; } else { $page->keywords = $cat_seo_keywords; } $cat_seo_description=$catalog->get_pr_seo_metadesc($product_id); if (empty($cat_seo_description)){ $page->description = str_replace('&','&',str_replace('&','&', $page->description)); } else { $page->description = $cat_seo_description; } $og_image=$catalog->get_product_og_image($product_id); $page->og_image = $og_image; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title; } function request_store_products_min($type){ global $page; global $catalog; $page->content .= $catalog->show_store_products_min($type); } function request_manufacturer($manufacturer_id){ global $page; global $catalog; global $lang; $manufacturer_id=intval($manufacturer_id); // get the page content $page->content = $catalog->show_manufacturer_details($manufacturer_id); $page->content .= "

     

    ".$catalog->show_category_products('manufacturer'); // page title $page->section_title = $lang->manufacturers; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } function request_manufacturer_products($manufacturer_id){ global $page; global $catalog; global $lang; $manufacturer_id=intval($manufacturer_id); $page->content = "

     

    ".$catalog->show_category_products('manufacturer'); // page title $page->section_title = $lang->products; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } //***************************************************************************************************************** // Show a blog post comment delete request confirmation screen for admins (legacy bug/feature) //***************************************************************************************************************** function request_blog_comment_delete() { global $page; global $blog; // blog link to come back to $blogpost_id = $_REQUEST['pid']; $blog_link = str_replace(" ","_",html_entity_decode(strtolower($blog->get_post_title($blogpost_id)))); $blog_link = ereg_replace("[^[:space:]a-zA-Z0-9_]", "", $blog_link).".html"; // show delete confirmation page - at the confirmation or cancellation, it comes back to the blog post comments screen $page->content = $blog->delete_comment("/blog/b_{$blogpost_id}_{$blog_link}"); $page->section_title = "Delete Blog Comment"; $page->title .= $page->section_title; } //***************************************************************************************************************** // Show a blog post request //***************************************************************************************************************** function request_blog_post($blogpost_id, $show_main_post) { global $page; global $blog; // check if the client has access to blogs if (!$page->client_has_package('blog')) show_notfound(); // if add comment is requested, add it to the database before displaying if (isset($_REQUEST['comment_action']) && ($_REQUEST['comment_action']=="add")) $page_comment_message = $blog->front_end_add_comments_action($blogpost_id); // if we are not showing the main post, show the comment titles $show_comment_titles = $show_main_post?false:true; // main blog label and link $blog_label = $blog->label_blog(); $blog_link = str_replace(" ","_",html_entity_decode(strtolower($blog_label))); $blog_link = "blog.html"; // blog post page content $page->content .= ""; // blog main post if ($show_main_post) $page->content .= $blog->front_end_show_post($blogpost_id); // blog post comments $page->content .= $blog->front_end_show_comments($blogpost_id, $show_comment_titles); // add comment area $page->content .= $blog->front_end_add_comments($blogpost_id); // if a comment was added, show message about it if (isset($page_comment_message)) $page->content .= $page_comment_message; // page title is taken from Blog $page->section_title = str_replace("\"","",$blog->get_post_title($blogpost_id)); $page->title .= " :: ".$page->section_title; // page description is taken from the beginning of the blog post content (first 250 characters up to the last space) $page->description = str_replace("\n", " ",substr(html_entity_decode(strip_tags(str_replace('\n',' ',$blog->get_post_content($blogpost_id)))),0,250)); $page->description = substr($page->description, 0, strrpos($page->description," "))."..."; } //***************************************************************************************************************** // Show main blog page request //***************************************************************************************************************** function request_blog() { global $page; global $blog; // check if the client has access to blogs if (!$page->client_has_package('blog')) show_notfound(); // determine the month and year to show $blogmonth = isset($_REQUEST['month'])?$_REQUEST['month']:'0'; $blogyear = isset($_REQUEST['year'])?$_REQUEST['year']:'0'; // show blogs for a month $page->content = $blog->front_end_show_blog($blogyear, $blogmonth); // page title $page->section_title = $blog->label_blog(); $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Member forgot password request //***************************************************************************************************************** function request_forgot_password() { global $page; global $user; $page->breadcrubs=($page->language=='en')?"Home » Forgot Password":"Начало » Забравена Парола"; $page->content = $user->run_forgot_password(); $page->section_title = ($page->language=='en')?"Password Reminder":"Забравена парола"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Member login request //***************************************************************************************************************** function request_login() { global $page; global $user; $page->breadcrubs=($page->language=='en')?"Home » Login":"Начало » Вход"; $page->content = $user->run_login(); $page->section_title =($page->language=='en')?"Member Login": "Вход за Потребители"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // My account page - links to profile edit and other member operations //***************************************************************************************************************** function request_myaccount() { global $page; global $user; // my account is for members only (if the member login is enabled for the client) if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); $page->breadcrubs=($page->language=='en')?"Home » My account":"Начало » Моят акаунт"; $page->content = $user->run_my_profile(); $page->section_title = "Моят акаунт"; $page->title .= " :: ".$page->section_title; $page->page_title=$page->section_title; } //***************************************************************************************************************** function request_question_of_the_day() { global $page; global $user; // my account is for members only (if the member login is enabled for the client) if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); $page->content = $user->question_of_the_day(); $page->section_title = "Въпроси на деня"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** function request_question_of_the_day2() { global $page; global $user; // my account is for members only (if the member login is enabled for the client) if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); $page->content = $user->question_of_the_day2(); $page->section_title = "Въпроси на деня"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // My account page - links to profile edit and other member operations //***************************************************************************************************************** function request_my_answers() { global $page; global $user; // my account is for members only (if the member login is enabled for the client) if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); $page->content = $user->run_my_answers(); $page->section_title = "Моите отговори"; $page->title .= " :: ".$page->section_title; } function request_game_results() { global $page; global $user; // my account is for members only (if the member login is enabled for the client) $page->content = $user->run_game_results(); $page->section_title = "Резултати от играта"; $page->title .= " :: ".$page->section_title; } function request_game_results2() { global $page; global $user; // my account is for members only (if the member login is enabled for the client) $page->content = $user->run_game_results2(); $page->section_title = "Резултати от играта"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_show_gallery() { global $page; global $lang; global $catalog; // show shopping cart $page->content = $catalog->show_gallery_front(); // page title $page->section_title = "Галерия"; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } function request_show_gallery_cat($category_id) { global $page; global $lang; global $catalog; $category_id=intval($category_id); // show shopping cart $page->content = $catalog->show_gallery_front_cat($category_id); // page title $page->section_title = $catalog->get_gallery_cat_title(); $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } function request_show_gallery_info($gallery_id) { global $page; global $catalog; global $lang; $gallery_id=intval($gallery_id); // get the page content $page->content = $catalog->show_gallery_info($gallery_id); // page title if ($page->language=='bg'){ $page->section_title = $catalog->get_gallery_title(); } $og_image=$catalog->get_gallery_og_image($gallery_id); $page->og_image = $og_image; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; $page->page_title=$page->section_title; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_show_projects() { global $page; global $lang; global $catalog; // show shopping cart $page->content = $catalog->show_project(); // page title $page->section_title = "Проекти"; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_show_news() { global $page; global $catalog; global $lang; // show shopping cart $page->content = $catalog->show_news_front(); // page title $page->section_title = "Новини"; $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } //***************************************************************************************************************** function request_show_news_info($news_id) { global $page; global $catalog; global $lang; $news_id=intval($news_id); // get the page content $page->content = $catalog->show_news_info($news_id); // page title $page->section_title = $catalog->get_news_title(); $page->title .= " :: ".$page->section_title; $og_image=$catalog->get_news_og_image($news_id); $page->og_image = $og_image; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_show_aop() { global $page; global $catalog; // show shopping cart $page->content = $catalog->show_aop_front(); // page title $page->section_title = "Профил на купувача"; $page->title .= " :: ".$page->section_title; } function request_show_aop_info($aop_id) { global $page; global $catalog; global $lang; $aop_id=intval($aop_id); // get the page content $page->content = $catalog->show_aop_info($aop_id); // page title if ($page->language=='bg'){ $page->section_title = $catalog->get_aop_title(); } $page->title .= " :: ".$page->section_title; $page->breadcrubs="".$lang->home.""; $page->breadcrubs.= " » ".$page->section_title.""; } //***************************************************************************************************************** // Handle a store my orders page request //***************************************************************************************************************** function request_show_contacts() { global $page; global $catalog; // show shopping cart $page->content = $catalog->show_contacts(); // page title $page->section_title = "Контакти"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Edit profile page //***************************************************************************************************************** function request_profile() { global $page; global $user; if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); $page->breadcrubs=($page->language=='en')?"Home » Edit Profile":"Начало » Промяна на Профил"; $page->content = $user->run_profile(); $page->section_title = ($page->language=='en')?"Edit Profile": "Промяна на профил"; $page->title .= " :: ".$page->section_title; $page->page_title=$page->section_title; } //***************************************************************************************************************** // Edit newsletter subscriptions page //***************************************************************************************************************** function request_newsletter_subscriptions() { global $page; global $newsletter; $page->content = $newsletter->edit_subscriptions(); $page->section_title = "Edit Newsletter Subscriptions"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Edit card subscription page //***************************************************************************************************************** function request_card_subscriptions() { global $page; global $cards; $page->content = $cards->edit_subscriptions(); $page->section_title = "Edit Card Subscriptions"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Directory Search request //***************************************************************************************************************** function directory_search() { global $page; global $user; $ads = new Ads(); $page->breadcrubs="Директория"; $page->content = $ads->directory_search(); $page->section_title = ($page->language=='en')?"Directory Search": "Директория"; $page->title .= " :: ".$page->section_title; } function directory_details() { global $page; global $user; $ads = new Ads(); $page->breadcrubs="Директория"; $page->content = $ads->directory_details(); $page->section_title = ($page->language=='en')?"Directory Search": "Директория"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Member registration request //***************************************************************************************************************** function request_register() { global $page; global $user; $page->breadcrubs=($page->language=='en')?"Home » Register":"Начало » Регистрация"; $page->content = $user->run_register(); $page->section_title = ($page->language=='en')?"Registration": "Регистрация"; $page->title .= " :: ".$page->section_title; $page->page_title=$page->section_title; } //***************************************************************************************************************** // Member registration request //***************************************************************************************************************** function request_register_firm() { global $page; global $user; $page->breadcrubs=($page->language=='en')?"Home » Register":"Начало » Регистрация"; $page->content = $user->run_register_firm(); $page->section_title = ($page->language=='en')?"Registration": "Регистрация на фирми"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Search request //***************************************************************************************************************** function request_search() { global $page; global $content; $page->breadcrubs=($page->language=='en')?"Home":"Начало"; // log user searches $page->user_log_searches(); // search keywords and return results $page->content = "
    ".$content->search_content()."
    "; // titles $page->section_title = ($page->language=='en')?"Search Results":"Резултати от търсенето"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Newsletter subscription activation //***************************************************************************************************************** function request_newsletter_activate($activation_id) { global $page; global $newsletter; // activation $page->content = $newsletter->subscription_activate($activation_id); // page title $page->section_title = "Subscription Confirmation"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Newsletter and articles //***************************************************************************************************************** function request_article($article_id, $show_as_newsletter) { global $page; global $newsletter; // article content $page->content = $newsletter->article_get_article($article_id, 'user'); // for newsletters, add the header and footer if ($show_as_newsletter) { $headers = $newsletter->admin_get_headers(); $page->content = $headers['header']."

    " . $page->content . "

    ".$headers['footer']; $page->user_log_newsletter($article_id); } // page title $page->section_title = $show_as_newsletter?"Newsletter":"Featured Article"; $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Public content that is shared between all brands //***************************************************************************************************************** function request_public_shared_content($public_file) { global $page; global $content; global $approot; // if the request is terms of use or privacy policy, return brand specific file if ($public_file == 'privacy_policy') $actual_file = $page->brand_privacypolicy_page; elseif ($public_file == 'terms_of_use') $actual_file = $page->brand_termsofuse_page; else $actual_file = $public_file; // check if the file exists if (!file_exists($approot . "/content/public/" . $actual_file . ".html")) show_notfound(); // return content $page->content = $page->template_include("content/public/" . $actual_file . ".html"); $page->content = $content->replace_tokens($page->content); // page title $page->section_title = ucwords(str_replace("_", " ", $public_file)); $page->title .= " :: ".$page->section_title; } //***************************************************************************************************************** // Handle a content request with the current server content ID //***************************************************************************************************************** function request_content($content_id) { global $page; global $user; global $content; if ($content_id==$content->get_homepage_id()){ Session::redirect_url("/index.php"); } // get the requested section (only valid for content requests) $section = $page->get_requested_section(); // check for member only content - don't allow views when not logged in if (($section=='member_content_bg' || $section=='member_content_en') && $page->client_member_login && !isset($user->member_id)){ Session::redirect_url("/login.iwb"); } // set the content section $content->set_section($section); // get the page content $page->content = $content->show_page($content_id, 'user'); // breadcrumbs (the stuff on top that shows with links like home -> vets -> vet facts... if (strlen($content->category_path)>0) $page->breadcrubs = $content->category_path; // page title $clean_title_string = strip_tags($content->category_path); $page_title_pos = $page->strripos($clean_title_string,'» '); $page->section_title= substr($clean_title_string, $page_title_pos + 7, strlen($clean_title_string) ); $page->title .= " :: ".$page->section_title; $page->page_title=$content->category_label; //GET Internet Consultant info //$page->internet_consultant="ivan aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; $tmp_section=substr($section, 0, -3); // for custom public contents, the SEO override settings if (SEOTags::check_custom_seo()===true) override_seotags($content_id, $section); } //***************************************************************************************************************** // Override SEO tags for custom content //***************************************************************************************************************** function override_seotags($content_id, $section) { global $page; $seotags = new SEOTags($section ,array('iweb' => true), $content_id); $override_title = $seotags->get_title(); $override_metakw = trim(str_replace('"','',$seotags->get_metakw())); $override_metadesc = trim(str_replace('"','',$seotags->get_metadesc())); // Override page title if (strlen($override_title)) $page->title = $override_title; // Override page description if (strlen($override_metadesc)) $page->description = $override_metadesc; // Override page keywords for custom contents if (strlen($override_metakw)) $page->keywords=$override_metakw; } //***************************************************************************************************************** // Handle home page request //***************************************************************************************************************** function request_homepage() { global $page; global $content; global $newsletter; global $catalog; $language=$page->language; // set the content section (home page is custom content) $content->set_section("custom_content_".$language); if ($page->client_intro!=""){ //var_dump($page->client_intro); $page->tmp_content = $content->display_get_first(); $page->render_with($page->client_intro); exit; } // home page $page->content = $content->display_get_first(); if ($page->client_has_package('catalog')){ $page->content .= $catalog->request_homepage_content(); } $page->breadcrubs=($page->language=='bg')?"Начало":"Home"; // add featured articles if the client has this setting active if ($page->client_featured_articles) { $page->featured_articles = $newsletter->get_front_page_content(); $page->content.=$page->featured_articles; } // page title $page->section_title=($page->language=='bg')?'Начало':'Home'; $page->title .= " :: ".$page->section_title; // SEO override settings for home page override_seotags($content->get_homepage_id(), $content->section); } //***************************************************************************************************************** // Invoice add //***************************************************************************************************************** function request_add_invoice() { global $page; global $user; global $invoice; if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); // my account is for members only (if the member login is enabled for the client) $page->content = $invoice->add_invoice(); } //***************************************************************************************************************** // Invoice list //***************************************************************************************************************** function request_list_invoice() { global $page; global $user; global $invoice; if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); // my account is for members only (if the member login is enabled for the client) $page->content = $invoice->list_invoice(); } //***************************************************************************************************************** // Invoice view //***************************************************************************************************************** function request_view_invoice() { global $page; global $user; global $invoice; if ($page->client_member_login && !isset($user->member_id)) Session::redirect_url("/login.iwb"); // my account is for members only (if the member login is enabled for the client) $page->content = $invoice->view_invoice(); } //****************************************************************************************************************************** function get_info_block($block){ global $page; global $user; $block_field=$block."_".$page->language; $info_block = MySql::query_fetch_first_val("select {$block_field} from info_blocks where client_id = '{$user->client_id}'"); if (strlen($info_block)>0){ $page->info_block=$info_block; $tmp_content=$page->template_include("templates/general/info_block.html.php"); return $tmp_content; } else { return; } } //****************************************************************************************************************************** function get_facebook(){ global $page; global $user; $facebook = MySql::query_fetch_first_val("select facebook from clients_misc where client_id = '{$user->client_id}'"); if (strlen($facebook)>0){ $page->facebook=$facebook; return $facebook; } else { return; } } //****************************************************************************************************************************** function get_twitter(){ global $page; global $user; $twitter = MySql::query_fetch_first_val("select twitter from clients_misc where client_id = '{$user->client_id}'"); if (strlen($twitter)>0){ $page->twitter=$twitter; return $twitter; } else { return; } } //****************************************************************************************************************************** function get_google(){ global $page; global $user; $google = MySql::query_fetch_first_val("select google from clients_misc where client_id = '{$user->client_id}'"); if (strlen($google)>0){ $page->google=$google; return $google; } else { return; } } //****************************************************************************************************************************** function get_youtube(){ global $page; global $user; $youtube = MySql::query_fetch_first_val("select youtube from clients_misc where client_id = '{$user->client_id}'"); if (strlen($youtube)>0){ $page->youtube=$youtube; return $youtube; } else { return; } } //****************************************************************************************************************************** function get_linkedin(){ global $page; global $user; $linkedin = MySql::query_fetch_first_val("select linkedin from clients_misc where client_id = '{$user->client_id}'"); if (strlen($linkedin)>0){ $page->linkedin=$linkedin; return $linkedin; } else { return; } } //****************************************************************************************************************************** function get_instagram(){ global $page; global $user; $instagram = MySql::query_fetch_first_val("select instagram from clients_misc where client_id = '{$user->client_id}'"); if (strlen($instagram)>0){ $page->instagram=$instagram; return $instagram; } else { return; } } //****************************************************************************************************************************** // determine request type //****************************************************************************************************************************** function determine_request() { global $request_file; global $request_folders; global $request_url; global $page; global $approot; // send to friend request if (strpos($_SERVER["REQUEST_URI"],'send_email=1') !== false) return 'sendtofriend'; // request appointment request if (strpos($_SERVER["REQUEST_URI"],'request_appointment=1') !== false) return 'requestappointment'; // send email to website owner request if (strpos($_SERVER["REQUEST_URI"],'send_client=1') !== false) return 'sendemailowner'; if (strpos($_SERVER["REQUEST_URI"],'send_client_page=1') !== false) return 'sendemailpage'; if (strpos($_SERVER["REQUEST_URI"],'?sendsimple=1') !== false) return 'sendemailsample'; if (strpos($_SERVER["REQUEST_URI"],'send_client_page_ral2=1') !== false) return 'sendemailpageral'; // send email to website owner request if (strpos($_SERVER["REQUEST_URI"],'sendsimpleee=1') !== false) return 'sendsimple'; // a PHP file is requested if (preg_match('/\.(php)$/',$request_file)) { // check the client space for the PHP file requested - if it exists, undefine all variables and execute php file and exit if (file_exists($approot . '/clients/' . $page->client_id . $request_url)) { unset_all_vars(); include($approot . '/clients/' . $page->client_id . $request_url); exit; } // blog archive requests (by year and month) if (count($request_folders)==3) if ($request_folders[0] == 'blog') { $REQUEST['year'] = $request_folder[1]; $REQUEST['month'] = $request_folder[2]; return 'showblog'; } // only the root level is valid for now if (count($request_folders) > 0) return 'notfound'; // only index.php or iweb.php is valid in global space if (($request_file != 'index.php')&& ($request_file != 'iweb.php')) return 'notfound'; // newsletter activation request if (isset($_GET['activate'])) return 'newsletteractivate'; // newsletter unsubscribe request if(isset($_GET['action']) && strval($_GET['action'])=='unsubscribe') return 'newsletterunsubscribe'; // public shared content request if (isset($_GET['page_direct']) && strval($_GET['page_direct'])!="") return 'publicshared'; // search request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'iedit' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'content_search') return 'search'; // legacy style robots.txt request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'iedit' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'robots_txt') return 'robots'; // logout request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'users' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'logout') return 'logout'; // register request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'users' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'register') return 'register'; // forgot password request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'users' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'forgot') return 'forgotpassword'; // login request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'users') return 'login'; // iblog show request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'iblog' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'show_blog') return 'showblog'; // iblog show post request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'iblog' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'show_post') return 'showblogpostold'; // iblog show comments request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'iblog' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'show_comments') return 'showblogcommentsold'; // iblog delete comments request if (isset($_REQUEST['package']) && strval($_REQUEST['package']) == 'iblog' && isset($_REQUEST['action']) && strval($_REQUEST['action']) == 'delete_comment') return 'blogcommentdelete'; // home page by default return 'showhomepage'; } // text file is requested elseif (preg_match('/\.(txt)$/',$request_file)) { // if it's the robots.txt file, serve it here if (($request_file == 'robots.txt') && ($page->client_id<>5)) return 'robots'; // custom client text file return 'rawcontent'; } // IWB file is requested elseif (preg_match('/\.(iwb)$/',$request_file)) { // can only be login screen if ($request_file == 'login.iwb') return 'login'; return 'notfound'; } // HTML file is requested elseif (preg_match('/\.(html)$/',$request_file)) { // logout request if ((count($request_folders)==0) && ($request_file == 'load.html')) return 'load'; // logout request if ((count($request_folders)==0) && ($request_file == 'logout.html')) return 'logout'; // my account request if ((count($request_folders)==0) && ($request_file == 'my_account.html')) return 'myaccount'; // my account request if ((count($request_folders)==0) && ($request_file == 'my_account2.html')) return 'myaccount2'; // my account request // my account request if ((count($request_folders)==0) && ($request_file == 'question_of_the_day.html')) return 'question_of_the_day'; if ((count($request_folders)==0) && ($request_file == 'question_of_the_day2.html')) return 'question_of_the_day2'; if ((count($request_folders)==0) && ($request_file == 'game_results.html')) return 'game_results'; if ((count($request_folders)==0) && ($request_file == 'game_results2.html')) return 'game_results2'; // my account request if ((count($request_folders)==0) && ($request_file == 'my_answers.html')) return 'my_answers'; if ((count($request_folders)==0) && ($request_file == 'edit_profile.html')) return 'editprofile'; // edit newsletter subscriptions request if ((count($request_folders)==0) && ($request_file == 'subscribe.html')) return 'newssubscribe'; // edit card subscriptions request // if ((count($request_folders)==0) && ($request_file == 'edit_card_subscribe.html')) return 'editcardsubscribe'; // terms of use request if ((count($request_folders)==0) && ($request_file == 'terms_of_use.html')) { $_REQUEST['page_direct']='terms_of_use'; return 'publicshared'; } // privacy policy request if ((count($request_folders)==0) && ($request_file == 'privacy_policy.html')) { $_REQUEST['page_direct']='privacy_policy'; return 'publicshared'; } // directory request if ((count($request_folders)==0) && ($request_file == 'directory_search.html')) return 'directory_search'; // directory request if ((count($request_folders)==0) && ($request_file == 'directory_details.html')) return 'directory_details'; // register request if ((count($request_folders)==0) && ($request_file == 'register.html')) return 'register'; if ((count($request_folders)==0) && ($request_file == 'register_firm.html')) return 'register_firm'; // forgot password request if ((count($request_folders)==0) && ($request_file == 'forgot_password.html')) return 'forgotpassword'; // blog requests if (isset($request_folders[0])) if ($request_folders[0] == 'blog') { // legacy style show blog post request if (preg_match('/^([0-9]{1,10})_([a-zA-Z0-9_]{1,100})\.html$/',$request_file)) { $request_parts = split('_',$request_file); $_REQUEST['pid'] = $request_parts[0]; return 'showblogpostold'; } // new style show blog post request if (preg_match('/^b_([0-9]{1,10})_([a-zA-Z0-9_]{1,100})\.html$/',$request_file)) { $request_parts = split('_',$request_file); $_REQUEST['pid'] = $request_parts[1]; return 'showblogpostnew'; } // main blog page request if (count($request_folders)==1) return 'showblog'; // blogs by month page request (blog archive) if (count($request_folders)==3) { $REQUEST['year'] = $request_folder[1]; $REQUEST['month'] = $request_folder[2]; return 'showblog'; } } // blog comments requests if (isset($request_folders[0])) if ($request_folders[0] == 'blog_comments') { // legacy style show blog post request if (preg_match('/^([0-9]{1,10})_([a-zA-Z0-9_]{1,100})\.html$/',$request_file)) { $request_parts = split('_',$request_file); $_REQUEST['pid'] = $request_parts[0]; return 'showblogcommentsold'; } // new style show blog post request if (preg_match('/^b_([0-9]{1,10})_([a-zA-Z0-9_]{1,100})\.html$/',$request_file)) { $request_parts = split('_',$request_file); $_REQUEST['pid'] = $request_parts[1]; return 'showblogcommentsnew'; } } // invoice requests if (isset($request_folders[0])) if ($request_folders[0] == 'invoice') { if ($request_file == 'add_invoice.html') return 'add_invoice'; if ($request_file == 'list_invoice.html') return 'list_invoice'; if ($request_file == 'view_invoice.html') return 'view_invoice'; } // show newsletter article requests if (isset($request_folders[0])) if ($request_folders[0] == 'articles') { // legacy style show article request if (preg_match('/^([0-9]{1,4})\.html$/',$request_file)) { $request_parts = split('\.',$request_file); $_REQUEST['article'] = $request_parts[0]; return 'article'; } } // show newsletter article requests if (isset($request_folders[0])) if ($request_folders[0] == 'gallery') { if ($request_file == 'gallery.html') return 'showgallery'; if (preg_match('/^([0-9]{1,9})_gallery_cat\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['category_id'] = $request_parts[0]; return 'showgallerycat'; } if (preg_match('/^([0-9]{1,9})_([a-zA-Z0-9_]{1,200})_gallery\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['gallery_id'] = $request_parts[0]; return 'showgalleryinfo'; } } // show newsletter article requests if (isset($request_folders[0])) if ($request_folders[0] == 'project') { if ($request_file == 'projects.html') return 'showprojects'; } // show newsletter article requests if (isset($request_folders[0])) if ($request_folders[0] == 'news') { if ($request_file == 'news.html') return 'shownews'; if (preg_match('/^([0-9]{1,9})_([a-zA-Z0-9_]{1,200})_news\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['news_id'] = $request_parts[0]; return 'shownewsinfo'; } } // show newsletter article requests if (isset($request_folders[0])) if ($request_folders[0] == 'contacts') { if ($request_file == 'contact_us.html') return 'showcontacts'; } // show newsletter article requests if (isset($request_folders[0])) if ($request_folders[0] == 'aop') { if ($request_file == 'profil_na_kupuvacha.html') return 'showaop'; if (preg_match('/^([0-9]{1,9})_([a-zA-Z0-9_]{1,200})_aop\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['aop_id'] = $request_parts[0]; return 'showaopinfo'; } } // catalog requests if (isset($request_folders[0])) if ($request_folders[0] == 'catalog' ) { // top products if ($request_file == 'top_products.html') return 'catalogtopproducts'; // products sale if ($request_file == 'sale.html') return 'catalogsale'; if ($request_file == 'checkout_min.html') return 'catalogmin'; // products sale if ($request_file == 'search.html') return 'catalogsearch'; // show category request if (preg_match('/^([0-9]{1,5})_([a-zA-Z0-9_]{1,200})_cat\.html$/',$request_file) ) { $request_parts = explode('_',$request_file); $_REQUEST['category_id'] = $request_parts[0]; return 'showstorecategory'; } // show category request if (preg_match('/^([0-9]{1,5})_category\.html$/',$request_file) ) { $request_parts = explode('_',$request_file); $_REQUEST['category_id'] = $request_parts[0]; return 'showstorecategory'; } elseif (preg_match('/^([0-9]{1,5})_manufacturer\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['manufacturer_id'] = $request_parts[0]; return 'showmanufacturer'; } elseif (preg_match('/^([0-9]{1,5})_manufacturer_products\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['manufacturer_id'] = $request_parts[0]; return 'showmanufacturerproducts'; } elseif (preg_match('/^([0-9]{1,9})_([a-zA-Z0-9_]{1,200})\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['product_id'] = $request_parts[0]; return 'showstoreproduct'; } /* if (preg_match('/^([0-9]{1,5})_product\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['product_id'] = $request_parts[0]; return 'showstoreproduct'; } */ // show shopping cart request if ($request_file == 'add_to_cart.html') return 'addtocart'; if ($request_file == 'add_to_wishlist.html') return 'addwishlist'; if ($request_file == 'wishlist.html') return 'wishlist'; // show shopping cart request if ($request_file == 'show_shopping_cart.html') return 'showstorecart'; // show checkout screen request if ($request_file == 'checkout.html') return 'catalogcheckout'; if ($request_file == 'koga/thank-you.html') return 'catalogthank'; // show invoice screen request if ($request_file == 'invoice.html') return 'showstoreinvoice'; // view my orders request if ($request_file == 'my_orders.html') return 'showmyorders'; if ($request_file == 'manufacturer.html') return 'showmanufacturerpage'; } // catalog requests if (isset($request_folders[0])) if ($request_folders[0] == 'koga' ) { // top products if ($request_file == 'top_products.html') return 'catalogtopproducts'; // products sale if ($request_file == 'sale.html') return 'catalogsale'; // products sale if ($request_file == 'search.html') return 'catalogsearch'; // show category request if (preg_match('/^([0-9]{1,5})_([a-zA-Z0-9_]{1,200})_cat\.html$/',$request_file) ) { $request_parts = explode('_',$request_file); $_REQUEST['category_id'] = $request_parts[0]; return 'showstorecategory'; } // show category request if (preg_match('/^([0-9]{1,5})_category\.html$/',$request_file) ) { $request_parts = explode('_',$request_file); $_REQUEST['category_id'] = $request_parts[0]; return 'showstorecategory'; } elseif (preg_match('/^([0-9]{1,5})_manufacturer\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['manufacturer_id'] = $request_parts[0]; return 'showmanufacturer'; } elseif (preg_match('/^([0-9]{1,5})_manufacturer_products\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['manufacturer_id'] = $request_parts[0]; return 'showmanufacturerproducts'; } elseif (preg_match('/^([0-9]{1,9})_([a-zA-Z0-9_]{1,200})\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['product_id'] = $request_parts[0]; return 'showstoreproduct'; } /* if (preg_match('/^([0-9]{1,5})_product\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['product_id'] = $request_parts[0]; return 'showstoreproduct'; } */ // show shopping cart request if ($request_file == 'add_to_cart.html') return 'addtocart'; // show shopping cart request if ($request_file == 'show_shopping_cart.html') return 'showstorecart'; // show checkout screen request if ($request_file == 'checkout.html') return 'catalogcheckout'; if ($request_file == 'thank-you.html') return 'catalogthank'; // show invoice screen request if ($request_file == 'invoice.html') return 'showstoreinvoice'; // view my orders request if ($request_file == 'my_orders.html') return 'showmyorders'; if ($request_file == 'manufacturer.html') return 'showmanufacturerpage'; } // catalog requests if (isset($request_folders[0])) if ($request_folders[0] == 'bg' ) { // top products if ($request_file == 'top_products.html') return 'catalogtopproducts'; // products sale if ($request_file == 'sale.html') return 'catalogsale'; // products sale if ($request_file == 'search.html') return 'catalogsearch'; // show category request if (preg_match('/^([0-9]{1,5})_category\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['category_id'] = $request_parts[0]; return 'showstorecategory'; } elseif (preg_match('/^([0-9]{1,5})_manufacturer\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['manufacturer_id'] = $request_parts[0]; return 'showmanufacturer'; } elseif (preg_match('/^([0-9]{1,5})_manufacturer_products\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['manufacturer_id'] = $request_parts[0]; return 'showmanufacturerproducts'; } elseif (preg_match('/^([0-9]{1,9})_([a-zA-Z0-9_]{1,200})\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['product_id'] = $request_parts[0]; return 'showstoreproduct'; } /* if (preg_match('/^([0-9]{1,5})_product\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['product_id'] = $request_parts[0]; return 'showstoreproduct'; } */ // show shopping cart request if ($request_file == 'add_to_cart.html') return 'addtocart'; // show shopping cart request if ($request_file == 'show_shopping_cart.html') return 'showstorecart'; // show checkout screen request if ($request_file == 'checkout.html') return 'catalogcheckout'; if ($request_file == 'thank-you.html') return 'catalogthank'; // show invoice screen request if ($request_file == 'invoice.html') return 'showstoreinvoice'; // view my orders request if ($request_file == 'my_orders.html') return 'showmyorders'; if ($request_file == 'manufacturer.html') return 'showmanufacturerpage'; } // show content requests if (isset($request_folders[0])) { if ($request_folders[0] == "main_bg") $_REQUEST['section'] = 'custom_content_bg'; if ($request_folders[0] == "main_en") $_REQUEST['section'] = 'custom_content_en'; if ($request_folders[0] == "main_th") $_REQUEST['section'] = 'custom_content_th'; if ($request_folders[0] == "main_fr") $_REQUEST['section'] = 'custom_content_fr'; if ($request_folders[0] == "main_ft") $_REQUEST['section'] = 'custom_content_ft'; if ($request_folders[0] == "member_bg") $_REQUEST['section'] = 'member_content_bg'; if ($request_folders[0] == "member_en") $_REQUEST['section'] = 'member_content_en'; if ($request_folders[0] == "info_bg") $_REQUEST['section'] = 'info_content_bg'; if ($request_folders[0] == "info_en") $_REQUEST['section'] = 'info_content_en'; if ($request_folders[0] == "main-bg") $_REQUEST['section'] = 'custom_content_bg'; if ($request_folders[0] == "main-en") $_REQUEST['section'] = 'custom_content_en'; if ($request_folders[0] == "main-th") $_REQUEST['section'] = 'custom_content_th'; if ($request_folders[0] == "main-fr") $_REQUEST['section'] = 'custom_content_fr'; if ($request_folders[0] == "main-ft") $_REQUEST['section'] = 'custom_content_ft'; if ($request_folders[0] == "member-bg") $_REQUEST['section'] = 'member_content_bg'; if ($request_folders[0] == "member-en") $_REQUEST['section'] = 'member_content_en'; if ($request_folders[0] == "info-bg") $_REQUEST['section'] = 'info_content_bg'; if ($request_folders[0] == "info-en") $_REQUEST['section'] = 'info_content_en'; if (isset($_REQUEST['section'])) { //new content if (preg_match('/^([0-9]{1,6})_([a-zA-Z0-9_]{1,250})\.html$/',$request_file)) { $request_parts = explode('_',$request_file); $_REQUEST['content'] = $request_parts[0]; return 'content'; } //new content if (preg_match('/^([0-9]{1,6})-([a-zA-Z0-9-]{1,250})\.html$/',$request_file) ) { $request_parts = explode('-',$request_file); $_REQUEST['content'] = $request_parts[0]; return 'content'; } } } // otherwise it's raw content return 'rawcontent'; } // otherwise it's raw content (it may not be found in that handler) return 'rawcontent'; } //************************************* function load_file($load_file){ global $approot; global $page; $combined_file_extension = ''; $file_content = ''; $body_color ="".$page->client_body_color; $body2_color ="".$page->client_body2_color; $font_color ="".$page->client_font_color; $header_color ="".$page->client_header_color; $navigation_color ="".$page->client_nav_color; $navigation2_color ="".$page->client_nav2_color; $file_path=$approot.strval($load_file); if (!file_exists($file_path)) { show_notfound(); } else{ $file_content = file_get_contents($file_path); $file_content = str_replace("[BODYCOLOR]", $body_color, $file_content); $file_content = str_replace("[BODY2COLOR]", $body2_color, $file_content); $file_content = str_replace("[FONTCOLOR]", $font_color, $file_content); $file_content = str_replace("[HEADERCOLOR]", $header_color, $file_content); $file_content = str_replace("[NAVCOLOR]", $navigation_color, $file_content); $file_content = str_replace("[NAV2COLOR]", $navigation2_color, $file_content); header("Content-Type: text/css"); header("Expires: " . date("r", time() + 864000)); // 10 days header("Cache-Control: must-revalidate, proxy-revalidate,max-age=864000,s-max-age=864000"); // 10 days header("Pragma: public"); header($_SERVER['SERVER_PROTOCOL'] . " 200 OK"); echo $file_content; exit; } }// end load function ?>