예제 #1
0
 /**
  * ManageSitemaps
  * 
  * @return Void
  */
 public function ManageSitemaps($MsgDesc = "", $MsgStatus = "")
 {
     if ($MsgDesc != "") {
         $GLOBALS["Message"] = MessageBox($MsgDesc, $MsgStatus);
     }
     if (!isset($GLOBALS["GenerateLabel"])) {
         $GLOBALS["GenerateLabel"] = GetLang('Generate');
     }
     if (isset($_POST['currentTab'])) {
         $GLOBALS["CurrentTab"] = $_POST['currentTab'];
     } else {
         $GLOBALS["CurrentTab"] = 0;
     }
     $indexArr = file_list(self::$sitemap_folder, "/\\.xml\$/i");
     $cbArr = $this->FilterArray(self::$sitemap_folder . '/category-brand', $indexArr);
     $mcbArr = $this->FilterArray(self::$sitemap_folder . '/mix-category-brand', $indexArr);
     $pbArr = $this->FilterArray(self::$sitemap_folder . '/products', $indexArr);
     $dpArr = $this->FilterArray(self::$sitemap_folder . '/dynamic-pages', $indexArr);
     $spArr = $this->FilterArray(self::$sitemap_folder . '/static-pages', $indexArr);
     if (count($cbArr) > 0) {
         $GLOBALS["CatBrandResult"] = "";
         foreach ($cbArr as $val) {
             $val = str_replace(ISC_BASE_PATH, GetConfig('ShopPath'), $val);
             $GLOBALS["CatBrandResult"] .= "<a href='{$val}'>{$val}</a><br/>";
         }
     } else {
         $GLOBALS["CatBrandResult"] = "<span style='color: red;'>You haven't generated the category-brand sitemap yet!</span>";
     }
     if (count($mcbArr) > 0) {
         $GLOBALS["MixCatBrandResult"] = "";
         foreach ($mcbArr as $val) {
             $val = str_replace(ISC_BASE_PATH, GetConfig('ShopPath'), $val);
             $GLOBALS["MixCatBrandResult"] .= "<a href='{$val}'>{$val}</a><br/>";
         }
     } else {
         $GLOBALS["MixCatBrandResult"] = "<span style='color: red;'>You haven't generated the mix-category-brand sitemap yet!</span>";
     }
     if (count($pbArr) > 0) {
         $GLOBALS["ProdBrandResult"] = "";
         foreach ($pbArr as $val) {
             $val = str_replace(ISC_BASE_PATH, GetConfig('ShopPath'), $val);
             $GLOBALS["ProdBrandResult"] .= "<a href='{$val}'>{$val}</a><br/>";
         }
     } else {
         $GLOBALS["ProdBrandResult"] = "<span style='color: red;'>You haven't generated the product-brand sitemap yet!</span>";
     }
     if (count($dpArr) > 0) {
         $GLOBALS["DynmicPageResult"] = "";
         foreach ($dpArr as $val) {
             $val = str_replace(ISC_BASE_PATH, GetConfig('ShopPath'), $val);
             $GLOBALS["DynmicPageResult"] .= "<a href='{$val}'>{$val}</a><br/>";
         }
     } else {
         $GLOBALS["DynmicPageResult"] = "<span style='color: red;'>You haven't generated the dynamic-page sitemap yet!</span>";
     }
     if (count($spArr) > 0) {
         $GLOBALS["StaticPageResult"] = "";
         if (class_exists('DOMDocument')) {
             $xml = new DOMDocument();
             $xml->load(self::$sitemap_folder . '/static-pages.xml');
             $locDom = $xml->getElementsByTagName('loc');
             foreach ($locDom as $loc) {
                 //$GLOBALS["StaticPageResult"] .= $loc->nodeValue.'&#13;&#10;';
                 $GLOBALS["StaticPageResult"] .= '<option>' . $loc->nodeValue . '</option>';
             }
         } else {
             //ini_set("display_errors","1");
             $xml = new OpXML();
             $xml->load(self::$sitemap_folder . '/static-pages.xml');
             $locDom = $xml->getElementsByTagName('loc');
             foreach ($locDom as $loc) {
                 $GLOBALS["StaticPageResult"] .= '<option>' . $loc . '</option>';
             }
         }
     } else {
         $GLOBALS["StaticPageResult"] = "<span style='color: red;'>You haven't generated the static-pages sitemap yet!</span>";
     }
     $indexSitemap = ISC_BASE_PATH . '/sitemap.xml';
     if (file_exists($indexSitemap)) {
         $indexSitemap = str_replace(ISC_BASE_PATH, GetConfig('ShopPath'), $indexSitemap);
         $GLOBALS["IndexMapResult"] = "<a href='{$indexSitemap}'>{$indexSitemap}</a>";
     } else {
         $GLOBALS["IndexMapResult"] = "<span style='color: red;'>You haven't generated the index sitemap yet!</span>";
     }
     $uQuery = "SELECT * FROM [|PREFIX|]sitemap_setting limit 0,1";
     $uResult = $GLOBALS['ISC_CLASS_DB']->Query($uQuery);
     if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($uResult)) {
         $GLOBALS["SitemapId"] = $row['id'];
         $GLOBALS["MaxmumRecords"] = $row['maxrecord'];
         $GLOBALS["IndexRootName"] = $row['indexroot'];
         $GLOBALS["NormalRootName"] = $row['normalroot'];
         $GLOBALS["IndexUrlName"] = $row['indexurl'];
         $GLOBALS["NormalUrlName"] = $row['normalurl'];
         $GLOBALS["PopularCatList"] = $row['popularcatlist'];
         //leo 2011-11-17 new setting for popular categories list
         $GLOBALS["UrlChildOption"] = $this->_GetUrlChildOption(explode(',', $row['childnodes']));
         $this->xmlConfig['IndexRoot'] = $row['indexroot'];
         $this->xmlConfig['IndexUrl'] = $row['indexurl'];
         $this->xmlConfig['NormalRoot'] = $row['normalroot'];
         $this->xmlConfig['NormalUrl'] = $row['normalurl'];
         $this->xmlConfig['childNodes'] = explode(',', $row['childnodes']);
     } else {
         $GLOBALS["SitemapId"] = $hasSetting;
         $GLOBALS["MaxmumRecords"] = "50,000";
         $GLOBALS["IndexRootName"] = "sitemapindex";
         $GLOBALS["NormalRootName"] = "urlset";
         $GLOBALS["IndexUrlName"] = "sitemap";
         $GLOBALS["NormalUrlName"] = "url";
         $GLOBALS["UrlChildOption"] = $this->_GetUrlChildOption(array('loc'));
     }
     $GLOBALS["PopularYearsStart"] = "1995";
     $GLOBALS["PopularYearsEnd"] = "2010";
     $GLOBALS["PopularCategories"] = $GLOBALS["PopularCatList"];
     //"Nerf Bars, Fender Flares - Fender Trim, Tonneau Covers, Bed Mats, Air Intakes, Bull Bars & Grille Guards, Floor Protection, Exhaust Systems, Bug Shields - Bug Deflectors, Performance Chips";
     $GLOBALS["PopularMakes"] = "Chevrolet, GMC, Ford, Dodge, Toyota, Nissan, Honda, Jeep, Hyundai, Chrysler, Infiniti, Lexus";
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("sitemaps.manage");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
예제 #2
0
파일: logxss.php 프로젝트: moorefu/anehta
********************************************************/
$tmp = explode("</requestURI>", $qstr);
$tmp = explode("<![CDATA[", $tmp[0]);
$tmp = explode("\r\n]]>\r\n", $tmp[1]);
$requestURI = $tmp[0];
$tmp = explode("/", $tmp[0]);
// 切分uri
$xssDomain = $tmp[2];
$tmp = "";
//$getData = XML_unserialize($test);
//print_r($getData);
/*******************************************************
* 开始存储数据到xml文件
********************************************************/
$fpath = "../slave/slave.xml";
$slaveData = new OpXML('slaveData', $fpath);
//增加一条记录
$arr = array('requestDate' => $requestDate, 'slaveWatermark' => $slaveWatermark, 'slaveIP' => $slaveIP, 'slaveUA' => $slaveUA, 'slaveLang' => $slaveLang, 'slaveProxy' => $slaveProxy, 'slaveLocation' => $slaveLocation, 'xssGot' => $qstr);
$slaveData->insert($arr);
/*******************************************************
* 生成rss feed
********************************************************/
$myFeed = new RSSFeed();
$myFeed->addChannel("Anehta!", "http://anehta.googlecode.com", "Anehta Slave Events!", "zh-cn");
// 下面去掉$qstr 里的 "<![CDATA["和 "]]>"
$qstr = str_replace("\r\n<![CDATA[\r\n", "", $qstr);
$qstr = str_replace("\r\n]]>\r\n", "", $qstr);
/**
 * Encodes HTML safely for UTF-8. Use instead of htmlentities.
 *
 * @param string $var
예제 #3
0
파일: config.php 프로젝트: moorefu/anehta
 }
 if (!empty($_POST['boomerangsrc'])) {
     //$boomerangsrc = base64_encode($_POST['boomerangsrc']);
     $boomerangsrc = $_POST['boomerangsrc'];
 }
 $fpath = 'config.xml';
 //文件的路径,不用手动创建文件
 if (file_exists($fpath) == false) {
     //配置文件不存在就生成一个
     $anehtaConfig = new OpXML('anehtaConfig', $fpath);
     //增加一条记录
     $arr = array('homepage' => 'http://anehta.googlecode.com', 'author' => 'axis', 'blog' => 'http://hi.baidu.com/aullik5', 'team' => 'http://www.ph4nt0m.org');
     $anehtaConfig->insert($arr);
 } else {
     //配置文件存在,开始更新记录
     $anehtaConfig = new OpXML('anehtaConfig', $fpath);
     //增加一条记录
     $arr = array('homepage' => 'http://anehta.googlecode.com', 'author' => 'axis', 'blog' => 'http://hi.baidu.com/aullik5', 'team' => 'http://www.ph4nt0m.org');
     $anehtaConfig->updateRecordById(1, $arr);
     // 根据提交的配置信息插入xml文件
     if ($anehtaurl != "" && $boomerangtarget != "" && $boomerangsrc != "") {
         $arr = array('anehtaurl' => $anehtaurl, 'boomerangtarget' => $boomerangtarget, 'boomerangsrc' => $boomerangsrc);
     } else {
         echo "Please complete the configure!";
         exit;
     }
     if ($anehtaConfig->getRecordById(2)) {
         // 有记录则更新
         $anehtaConfig->updateRecordById(2, $arr);
     } else {
         // 没有则插入
예제 #4
0
 public function SaveAsXML($filelist, $isRoot = false)
 {
     $adjustPath = $isRoot ? '' : self::$sitemap_folder . '/';
     $rootTag = $isRoot ? 'sitemapindex' : 'urlset';
     $urlTag = $isRoot ? 'sitemap' : 'url';
     $locTag = 'loc';
     foreach ($filelist as $filename => $datas) {
         echo "{$filename}.xml is generating...<br/>";
         /*
         $xmlDoc = new DOMDocument("1.0","UTF-8");
         $xmlDoc->preserveWhiteSpace = false;   
         $xmlDoc->formatOutput = true;               
         		
         $urlset = $xmlDoc->createElement("urlset");    
         $urlset = $xmlDoc->appendChild($urlset); 
         */
         if (count($datas) > 100000) {
             $tmpDatas = array_chunk($datas, 10000);
             foreach ($tmpDatas as $tmps) {
                 $xmlDoc = new OpXML();
                 $urlset = $xmlDoc->addRoot($rootTag, array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'));
                 foreach ($tmps as $data) {
                     $url = $xmlDoc->addChild($urlset, $urlTag);
                     $xmlDoc->addChild($url, $locTag, htmlspecialchars($data, ENT_COMPAT, "UTF-8"));
                     //$xmlDoc->addChild($url, 'lastmod', $this->Last_modification);
                 }
                 //unset($xmlDoc);
                 $saveResult = $xmlDoc->save("{$adjustPath}{$filename}.xml", "a");
             }
         } else {
             $xmlDoc = new OpXML();
             $urlset = $xmlDoc->addRoot($rootTag, array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'));
             foreach ($datas as $data) {
                 $url = $xmlDoc->addChild($urlset, $urlTag);
                 //$xmlDoc->addChild($url, $locTag, $data);
                 $xmlDoc->addChild($url, $locTag, htmlspecialchars($data, ENT_QUOTES, "UTF-8"));
                 //$xmlDoc->addChild($url, 'lastmod', $this->Last_modification);
                 //$xmlDoc->addChild($url, 'changefreq', $this->Changefreq);
                 //$xmlDoc->addChild($url, 'priority', $this->Priority);
                 /*
                 //create nodes
                 $url = $xmlDoc->createElement("url");
                 $url = $urlset->appendChild($url);
                 
                 //create attribute to a node
                 //$name_value = $xmlDoc->createAttribute("value");
                 //$name_value  =$url->appendChild($name_value);
                 
                 $loc = $xmlDoc->createElement("loc");
                 $loc = $url->appendChild($loc);
                 $loc->appendChild($xmlDoc->createTextNode($data));
                 
                 $lastmod = $xmlDoc->createElement("lastmod");
                 $lastmod = $url->appendChild($lastmod);
                 $lastmod->appendChild($xmlDoc->createTextNode($this->Last_modification));
                 
                 $changefreq = $xmlDoc->createElement("changefreq");
                 $changefreq = $url->appendChild($changefreq);
                 $changefreq->appendChild($xmlDoc->createTextNode($this->Changefreq));
                 
                 $priority = $xmlDoc->createElement("priority");
                 $priority = $url->appendChild($priority);
                 $priority->appendChild($xmlDoc->createTextNode($this->Priority));
                 */
             }
             $saveResult = $xmlDoc->save("{$adjustPath}{$filename}.xml");
             //$xmlDoc->save("$adjustPath$filename.xml");
         }
         if ($saveResult) {
             echo UsedMemory() . "<br/>";
             $filepath = htmlspecialchars(self::$website . "/{$adjustPath}{$filename}.xml");
             array_push($this->sitemapIndex, self::$website . "/{$adjustPath}{$filename}.xml");
             echo 'Save ' . htmlspecialchars($filename) . ".xml Successful.<br/>Total: {$saveResult} Bytes.<br/>";
             echo "<a href='{$filepath}'>{$filepath}</a><br/><br/>";
         } else {
             return false;
         }
     }
     return true;
 }
예제 #5
0
 public function Sitemap($MsgDesc = "", $MsgStatus = "")
 {
     //$categories = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('RootCategories');
     $catquery = $GLOBALS['ISC_CLASS_DB']->Query("SELECT categoryid , catparentid, catname FROM [|PREFIX|]categories c WHERE catparentid = 0 ");
     $categories = array();
     while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catquery)) {
         $catid = $catrow['categoryid'];
         $catparentid = $catrow['catparentid'];
         $catname = $catrow['catname'];
         $categories[0][$catid] = array('categoryid' => $catid, 'catparentid' => $catparentid, 'catname' => $catname);
     }
     if (!isset($categories[0])) {
         $this->DontDisplay = true;
         return;
     }
     /*----- the below block has been added to display the categories department wise ----- */
     $dept = array();
     $cat_dept = array();
     $cat_department = array();
     $cat_dept_qry = "select categoryid , catdeptid , deptname, catparentid from isc_categories c left join isc_department d on d.deptid = c.catdeptid where catparentid = 0 order by deptname asc, catdeptid desc, catname";
     $cat_dept_res = $GLOBALS['ISC_CLASS_DB']->Query($cat_dept_qry);
     while ($cat_dept_row = $GLOBALS['ISC_CLASS_DB']->Fetch($cat_dept_res)) {
         //$cat_department[$cat_dept_row['categoryid']]['catdeptid'] = $cat_dept_row['deptname'];
         $dept[$cat_dept_row['catdeptid']] = $cat_dept_row['deptname'];
         $cat_dept[$cat_dept_row['categoryid']] = $cat_dept_row['catdeptid'];
         //                $cat_dept[$cat_dept_row['catdeptid']][0] .= $cat_dept_row['categoryid'];
         if (isset($categories[0][$cat_dept_row['categoryid']])) {
             $categories[0][$cat_dept_row['categoryid']]['catdeptid'] = $cat_dept_row['catdeptid'];
         }
     }
     foreach ($cat_dept as $key => $value) {
         if (isset($categories[0][$key])) {
             $cat_department[0][$key] = $categories[0][$key];
         }
     }
     $categories = $cat_department;
     $ValidCats = $this->GetValidCategories();
     $output = '';
     /* the below two variables are added to apply updown animation and image */
     $GLOBALS['contentid'] = "all_category";
     if (isset($GLOBALS['CategoryJSFunction'])) {
         $GLOBALS['arrowimage'] = "<img src='{$path}/templates/default/images/imgHdrDropDownIcon.gif' border='0' id='all_categoryimage'>";
     }
     $temp_dept = "";
     foreach ($categories[0] as $rootCat) {
         // If we don't have permission to view this category then skip
         if (!CustomerGroupHasAccessToCategory($rootCat['categoryid'])) {
             continue;
         }
         if (in_array($rootCat['categoryid'], $ValidCats)) {
             $GLOBALS['CategoryCount'] = "";
             // making it empty as client told not to show the count on homepage.
             if ($temp_dept != $rootCat['catdeptid']) {
                 if (!empty($temp_dept)) {
                     $output .= "</ul>";
                 }
                 if (!empty($dept[$rootCat['catdeptid']])) {
                     $GLOBALS['deptname'] = $dept[$rootCat['catdeptid']];
                 } else {
                     $GLOBALS['deptname'] = "Others";
                 }
                 $GLOBALS['deptid'] = "li_" . $rootCat['catdeptid'];
                 $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SitemapDepartment");
                 $output .= "<ul id='" . $GLOBALS['deptid'] . "'>";
                 // $output .= "<ul><li >".$dept[$rootCat['catdeptid']]."</li></ul><ul>";
                 $temp_dept = $rootCat['catdeptid'];
             }
             $GLOBALS['SubCategoryList'] = $this->GetSubCategory($rootCat['categoryid'], $rootCat['catname']);
             $GLOBALS['LastChildClass'] = '';
             $GLOBALS['CategoryName'] = isc_html_escape($rootCat['catname']);
             ### Common code for creating links SEO friendly and Non-SEO friendly links
             $RootCatName = $rootCat['catname'];
             $GLOBALS['CategoryLink'] = $this->LeftCatLink($RootCatName);
             $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCategoryList");
         }
     }
     $output .= "</ul>";
     $GLOBALS['output'] = $output;
     //$query = "SELECT * FROM [|PREFIX|]brands ORDER BY brandname";
     $query = "SELECT DISTINCT b . * , \n                            (SELECT COUNT( productid ) \n                                FROM [|PREFIX|]products p WHERE p.prodbrandid = b.brandid ) AS   products \n                                FROM [|PREFIX|]brands b \n                                LEFT JOIN isc_products p ON p.prodbrandid = b.brandid\n                                ORDER BY b.brandname";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $brand = '';
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if ($row['products'] != '0') {
             //$url = htmlspecialchars(BrandLink($row['brandname']), ENT_COMPAT, 'UTF-8');
             $brandid = "brand_" . $row['brandid'];
             $brand .= "<ul id='" . $row['brandid'] . "'>";
             //                        $brand .= $row['brandname'];
             $GLOBALS['Brandname'] = isc_html_escape($row['brandname']);
             $GLOBALS['Brandid'] = $row['brandid'];
             $GLOBALS['BrandLink'] = $this->BrandLink($row['brandname']);
             $GLOBALS['Serieslist'] = $this->GetSeries($row['brandid'], $row['brandname']);
             $brand .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SitemapBrand");
             $brand .= "</ul>";
         }
     }
     $GLOBALS['Brand'] = $brand;
     $CustomPages = '<ul><li><img id="staticDivImg" onclick="hideStaticUrls()" width="19" height="16" src="' . GetConfig('ShopPath') . '/admin/images/minus.gif">Static Pages<ul id="staticDiv">';
     if (class_exists('DOMDocument')) {
         $xml = new DOMDocument();
         $xml->load(ISC_BASE_PATH . '/sitemaps/static-pages.xml');
         $locDom = $xml->getElementsByTagName('loc');
         foreach ($locDom as $loc) {
             $CustomPages .= '<li><a href="' . $loc->nodeValue . '">' . $loc->nodeValue . '</a></li>';
         }
     } else {
         //ini_set("display_errors","1");
         ini_set("memory_limit", "-1");
         require_once ISC_BASE_PATH . '/class.opxml.php';
         $xml = new OpXML();
         $xml->load(ISC_BASE_PATH . '/sitemaps/static-pages.xml');
         $locDom = $xml->getElementsByTagName('loc');
         foreach ($locDom as $loc) {
             $CustomPages .= '<li><a href="' . $loc->nodeValue . '">' . $loc . '</a></li>';
         }
     }
     $GLOBALS['CustomPages'] = $CustomPages . '</ul></li></ul>';
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sitemap");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     /* }
        else {
            ob_end_clean();
            header(sprintf("Location: %s", $GLOBALS['ShopPath']));   
            die();
        } */
 }