register("lang"); } // Save current page call $this_page=$page; // Register previous page if (!isset($last_page)) { $sess->register("last_page"); } // Register the cart if (!isset($cart)) { $cart = array(); $cart["idx"] = 0; $sess->register("cart"); } // Register the auth array if (!isset($auth)) { $auth = array(); $sess->register("auth"); } // Get Function Permissions // Sets $run_func if func is registered and have permission // Displays error if function is not registered if ($func) { $func_list = $ps_function->get_function($func); if ($func_list) { // echo $func_list["perms"]; if ($perm->check($func_list["perms"])) { $run_func = 1; $func_perms = $func_list["perms"]; $func_class = $func_list["class"]; $func_method = $func_list["method"]; } else { $error_type = "无权访问"; $error = "你没有权限使用$func功能."; $page = ERRORPAGE; $run_func = 0; } } else { $error_type = "该功能没有注册"; $error = "$func 是无效的系统功能."; $page = ERRORPAGE; $run_func = 0; } } // Set Global add by LGJ // This code move from templates/global.inc to this //Get the ps_vendor_id if (!isset($ps_vendor_id)) { $q = "SELECT * from vendor_domains where domain_name='".$HTTP_HOST."'"; $db->query($q); $db->next_record(); $ps_vendor_id = $db->f("vendor_id"); $sess->register("ps_vendor_id"); if ( !$page ) { $static_page = $db->f("static_page"); } } // Get Page/Directory Permissions // Sets $run_dir if we can run it // Displays error if directory is not registered, // no permission, or file does not exist if (!$page) { $page = HOMEPAGE; } $modulename = dirname("$page"); $pagename = basename("$page"); if (empty($modulename)) { $modulename=dirname(HOMEPAGE); $pagename = basename(HOMEPAGE); } //Get the HTTP Referer if (!isset($http_referer)) { $http_referers = split("/", $HTTP_REFERER); $http_referer = $http_referers[2]; $sess->register("http_referer"); } //If no vendor found ,default set the vendor = 1 if ( $ps_vendor_id <= 0 ){ $ps_vendor_id = 1; } //get the vendor templates information //coded by lgj $q = "SELECT templates_id from vendor_templates where vendor_id=".$ps_vendor_id; $db->query($q); $db->next_record(); $ps_vendor_templates_id = $db->f("templates_id"); //If no templates found ,default set the templates = 1 if ( $ps_vendor_templates_id <= 0 ){ $ps_vendor_templates_id = 1; } $dir_list = $ps_module->get_dir($modulename); if ($dir_list) { if ($perm->check($dir_list["perms"])) { if ($modulename == "shop" ) { if (!file_exists(TEMPLATESROOT."/$ps_vendor_templates_id/".$pagename.".ihtml")) { $error_type = "Page Does Not Exist"; $error = "Given filename does not exist. Cannot find file:
"; $error .= $modulename."/html/Mtemplates/$ps_vendor_templates_id/".$pagename.".ihtml"; $page = ERRORPAGE; } }else { if (!file_exists(MODROOT.$modulename."/html/".$pagename.".ihtml")) { $error_type = "Page Does Not Exist"; $error = "Given filename does not exist. Cannot find file:
"; $error .= $modulename."/html/".$pagename.".ihtml"; $page = ERRORPAGE; } } } else { if ($func != "userLogin") { $error = ""; $page = $last_page; $vars["login"]=1; } } // Load MODULE $module = load_module($modulename); require(MODROOT.$modulename."/lib/ps_include.inc"); $label = load_labels($modulename); } else { $error_type = "Module Not Registered"; $error = "$modulename is not a valid phpShop module."; $page = ERRORPAGE; } // Copy the vars and register them into the session if ($HTTP_POST_VARS) { $vars = $HTTP_POST_VARS; // Fix for php4 image upload problem. The error // is currently due to php4 not setting the http_post_vars // array with the file input field value. $vars["vendor_full_image"] = $vendor_full_image; $vars["vendor_full_image_name"] = $vendor_full_image_name; $vars["vendor_full_image_size"] = $vendor_full_image_size; $vars["vendor_thumb_image"] = $vendor_thumb_image; $vars["vendor_thumb_image_name"] = $vendor_thumb_image_name; $vars["vendor_thumb_image_size"] = $vendor_thumb_image_size; $vars["product_full_image"] = $product_full_image; $vars["product_full_image_name"] = $product_full_image_name; $vars["product_full_image_size"] = $product_full_image_size; $vars["product_thumb_image"] = $product_thumb_image; $vars["product_thumb_image_name"] = $product_thumb_image_name; $vars["product_thumb_image_size"] = $product_thumb_image_size; $vars["crm_image_path"] = $crm_image_path; $vars["crm_image_path_name"] = $crm_image_path_name; $vars["crm_image_path_size"] = $crm_image_path_size; $vars["crm_image_path_type"] = $crm_image_path_type; $vars["float_picture"] = $float_picture; $vars["float_picture_name"] = $float_picture_name; $vars["float_picture_size"] = $float_picture_size; $vars["float_picture_type"] = $float_picture_type; $vars["holiday_category_image"] = $holiday_category_image; $vars["holiday_category_image_name"] = $holiday_category_image_name; $vars["holiday_category_image_size"] = $holiday_category_image_size; $vars["holiday_category_image_type"] = $holiday_category_image_type; $vars["greetings_image"] = $greetings_image; $vars["greetings_image_name"] = $greetings_image_name; $vars["greetings_image_size"] = $greetings_image_size; $vars["greetings_image_type"] = $greetings_image_type; // End fix } elseif ($HTTP_GET_VARS) { $vars = $HTTP_GET_VARS; } // Run the function if we have permission if ($run_func) { $q = "SELECT module.module_name FROM module,function WHERE "; $q .= "module.module_id=function.module_id AND "; $q .= "function.function_method='$func_method' AND "; $q .= "function.function_class='$func_class'"; $db->query($q); $db->next_record(); // Load class definition file eval(load_class($db->f("module_name"), $func_class)); $string = "\$" . $func_class . " = new " . $func_class . ";"; eval($string); // RUN THE FUNCTION $cmd = "\$ok = \$" . $func_class . "->" . $func_method . "(\$vars);"; eval($cmd); if (!$ok) { if ($vars["login"] == "1") { $error = $vars["error"]; $vars["login"]=1; } else { $no_last =1; $page = $last_page; $error = $vars["error"]; } } else { $no_last = 0; $error=""; $page = $vars["page"]; } } // LOAD PAGE // If this is a login, then load the approprate module information based on wher // the login page is. if ($vars["login"] == "1" || $page==LOGINPAGE || !$perm->check($dir_list["perms"])) { if ( $print != "1" ) { $last_page = $this_page; } $page = LOGINPAGE; $modulename = dirname($page); $module = load_module($modulename); require(MODROOT.$modulename."/lib/ps_include.inc"); $label = load_labels($modulename); } if (!$no_last && $print != "1") { $last_page = $this_page; } if (!$page) { $page = HOMEPAGE; } // Show the page! $modulename = dirname($page); $pagename = basename($page) . ".ihtml"; //get the vendor information $q = "SELECT * from vendor where vendor_id=".$ps_vendor_id; $db->query($q); $db->next_record(); $vendor_name = $db->f("vendor_name"); $time_pay = $db->f("time_pay"); $vendor_image_path = $db->f("vendor_image_path"); $vendor_full_image = $db->f("vendor_full_image"); $vendor_thumb_image = $db->f("vendor_thumb_image"); $vendor_banner_image_1 = $db->f("vendor_thumb_image"); $vendor_image = "f("vendor_full_image") . ">"; $vendor_banner_image = "f("vendor_thumb_image") . ">"; $vendor_address = $db->f("vendor_address_1"); $vendor_postcode = $db->f("vendor_zip"); $vendor_city = $db->f("vendor_city"); $vendor_state = $db->f("vendor_state"); $vendor_phone = $db->f("vendor_phone"); $vendor_fax = $db->f("contact_fax"); $vendor_store_desc = $db->f("vendor_store_desc"); $vendor_store_name = $db->f("vendor_store_name"); $vendor_email = $db->f("contact_email"); //End add by LGJ //Change for module menu //Code by lgj if ($modulename == "shop") { $module_topmenu= TEMPLATESROOT."/$ps_vendor_templates_id/topmenu.ihtml"; $module_leftmenu= TEMPLATESROOT."/$ps_vendor_templates_id/leftmenu.ihtml"; } else { $module_topmenu= MODROOT.$modulename."/html/topmenu.ihtml"; $module_leftmenu= MODROOT.$modulename."/html/leftmenu.ihtml"; } // Load global file //require(MODROOT."/templates/global.inc"); require(TEMPLATESROOT."$ps_vendor_templates_id/global.inc"); // Load language file for this module if (file_exists(MODROOT.$modulename."/lib/lang_$lang.inc")) { include(MODROOT.$modulename."/lib/lang_$lang.inc"); } else { //Default to english if not set. include(MODROOT.$modulename."/lib/lang_eng.inc"); } if ( $static_page ) { echo ""; }else { // Load Header //if ($module[$modulename]["module_header"] && $print!="1") { // include(MODROOT."/templates/".$module[$modulename]["module_header"]); //} //Change for mult templates if ($module[$modulename]["module_header"] && $print!="1") { /* 太阳河花城 */ if ( $HTTP_HOST == "eguo.sunnyflower.net" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_eguo.ihtml"); }else if ( $HTTP_HOST == "eguo.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_eguo.ihtml"); }else if ( $HTTP_HOST == "chris.sunnyflower.net" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_chris.ihtml"); }else if ( $HTTP_HOST == "chris.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_chris.ihtml"); }else if ( $HTTP_HOST == "newyear.sunnyflower.net" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_newyear.ihtml"); }else if ( $HTTP_HOST == "newyear.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_newyear.ihtml"); }else if ( $HTTP_HOST == "love.sunnyflower.net" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_love.ihtml"); }else if ( $HTTP_HOST == "love.365666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_love.ihtml"); }else if ( $HTTP_HOST == "love214.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_love.ihtml"); }else if ( $HTTP_HOST == "teacher.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_teacher.ihtml"); }else if ( $HTTP_HOST == "zhongqiu.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_zhongqiu.ihtml"); }else if ( $HTTP_HOST == "love7.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_love7.ihtml"); }else if ( $HTTP_HOST == "815.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_815.ihtml"); }else if ( $HTTP_HOST == "mother.sunnyflower.net" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_mother.ihtml"); }else if ( $HTTP_HOST == "mother.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_header_mother.ihtml"); }else { include(TEMPLATESROOT."$ps_vendor_templates_id/".$module[$modulename]["module_header"]); } } // echo TEMPLATESROOT."$ps_vendor_templates_id/".$module[$modulename]["module_header"]; // Load PAGE //include(MODROOT.$modulename."/html/".$pagename); // Change for mult templates if ($modulename == "shop") { if ( $pagename == "index.ihtml" && ($HTTP_HOST == "chris.sunnyflower.net" || $HTTP_HOST == "chris.flower666.com") ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/chris.ihtml"); }else if ( $pagename == "index.ihtml" && ($HTTP_HOST == "newyear.sunnyflower.net" || $HTTP_HOST == "newyear.flower666.com") ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/newyear.ihtml"); }else if ( $pagename == "index.ihtml" && ($HTTP_HOST == "love.sunnyflower.net" || $HTTP_HOST == "love214.flower666.com") ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/love.ihtml"); }else if ( $pagename == "index.ihtml" && ($HTTP_HOST == "love.365666.com" || $HTTP_HOST == "love.365666.com") ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/love.ihtml"); }else if ( $pagename == "index.ihtml" && ($HTTP_HOST == "love7.sunnyflower.net" || $HTTP_HOST == "love7.flower666.com") ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/love7.ihtml"); }else if ( $pagename == "index.ihtml" && $HTTP_HOST == "815.flower666.com" ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/love815.ihtml"); }else if ( $pagename == "index.ihtml" && $HTTP_HOST == "teacher.flower666.com" ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/teacher.ihtml"); }else if ( $pagename == "index.ihtml" && $HTTP_HOST == "zhongqiu.flower666.com" ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/zhongqiu.ihtml"); }else if ( $pagename == "index.ihtml" && ($HTTP_HOST == "mother.sunnyflower.net" || $HTTP_HOST == "mother.flower666.com") ) { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/mother.ihtml"); }else { include(MODROOT.$modulename."/html/Mtemplates/$ps_vendor_templates_id/".$pagename); } }else { include(MODROOT.$modulename."/html/".$pagename); } // Load footer //if ($module[$modulename]["module_footer"] && $print!="1") { // include(MODROOT."/templates/".$module[$modulename]["module_footer"]); //} // Change for mult templates if ($module[$modulename]["module_footer"] && $print!="1") { if ( $HTTP_HOST == "chris.sunnyflower.net" || $HTTP_HOST == "chris.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_chris.ihtml"); }else if ( $HTTP_HOST == "newyear.sunnyflower.net" || $HTTP_HOST == "newyear.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_newyear.ihtml"); }else if ( $HTTP_HOST == "love.sunnyflower.net" || $HTTP_HOST == "love214.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_love.ihtml"); }else if ( $HTTP_HOST == "love.365666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_love.ihtml"); }else if ( $HTTP_HOST == "815.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_815.ihtml"); }else if ( $HTTP_HOST == "teacher.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_teacher.ihtml"); }else if ( $HTTP_HOST == "zhongqiu.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_zhongqiu.ihtml"); }else if ( $HTTP_HOST == "love7.sunnyflower.net" || $HTTP_HOST == "love7.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_love7.ihtml"); }else if ( $HTTP_HOST == "mother.sunnyflower.net" || $HTTP_HOST == "mother.flower666.com" ) { include(TEMPLATESROOT."$ps_vendor_templates_id/s_footer_mother.ihtml"); }else { include(TEMPLATESROOT."$ps_vendor_templates_id/".$module[$modulename]["module_footer"]); } } } // Save the session variables for the next run $sess->save(); if (SHOWVERSION) { include(DOCROOT ."/VERSION.txt"); } // Set debug option on/off if (DEBUG) { $end = utime(); $runtime = $end - $start; $messages = dirname(DEBUGPAGE); $pagename = basename(DEBUGPAGE) . ".ihtml"; include(MODROOT.$messages."/html/".$pagename); } // access list analysis, only log homepage if ( $page == "shop/index" ) { access_log(); } ?>