function doAction($type = '')
 {
     global $CONF, $manager;
     if (!$type) {
         $type = 'google';
     }
     if ($type !== 'google' && $type !== 'yahoo') {
         return;
     }
     $sitemap = array();
     $blog_res = sql_query('SELECT * FROM ' . sql_table('blog'));
     while ($blog = sql_fetch_array($blog_res)) {
         if ($this->getBlogOption($blog['bnumber'], 'IncludeSitemap') == 'yes') {
             if ($blog['bnumber'] != $CONF['DefaultBlog']) {
                 $sitemap[] = array('loc' => $this->_prepareLink($blog['bnumber'], createBlogidLink($blog['bnumber'])), 'priority' => '1.0', 'changefreq' => 'daily');
             } else {
                 $sitemap[] = array('loc' => $blog['burl'], 'priority' => '1.0', 'changefreq' => 'daily');
             }
             $params = array(sql_table('category'), $blog['bnumber']);
             $cat_res = sql_query(vsprintf('SELECT * FROM %s WHERE cblog=%s ORDER BY catid', $params));
             while ($cat = sql_fetch_array($cat_res)) {
                 $sitemap[] = array('loc' => $this->_prepareLink($blog['bnumber'], createCategoryLink($cat['catid'])), 'priority' => '1.0', 'changefreq' => 'daily');
             }
             $b =& $manager->getBlog($blog['bnumber']);
             $item_res = sql_query('
                 SELECT 
                     *,
                     UNIX_TIMESTAMP(itime) AS timestamp
                 FROM 
                     ' . sql_table('item') . ' 
                 WHERE
                     iblog = ' . $blog['bnumber'] . ' AND
                     idraft = 0
                     AND itime <= ' . mysqldate($b->getCorrectTime()) . '
                 ORDER BY 
                     inumber DESC
             ');
             $now = $_SERVER['HTTP_REQUEST_TIME'];
             while ($item = sql_fetch_array($item_res)) {
                 $tz = date('O', $item['timestamp']);
                 $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
                 $pasttime = $now - $item['timestamp'];
                 if ($pasttime < 86400 * 2) {
                     $fq = 'hourly';
                 } elseif ($pasttime < 86400 * 14) {
                     $fq = 'daily';
                 } elseif ($pasttime < 86400 * 62) {
                     $fq = 'weekly';
                 } else {
                     $fq = 'monthly';
                 }
                 $sitemap[] = array('loc' => $this->_prepareLink($blog['bnumber'], createItemLink($item['inumber'])), 'lastmod' => gmdate('Y-m-d\\TH:i:s', $item['timestamp']) . $tz, 'priority' => '1.0', 'changefreq' => $fq);
             }
         }
     }
     $eventdata = array('sitemap' => &$sitemap);
     $manager->notify('SiteMap', $eventdata);
     if ($type == 'google') {
         header("Content-type: application/xml");
         echo "<?xml version='1.0' encoding='UTF-8'?>\n\n";
         echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' ";
         echo "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
         echo "xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'>\n";
         $tpl = "\t\t<%s>%s</%s>\n";
         foreach ($sitemap as $url) {
             echo "\t<url>\n";
             foreach ($url as $key => $value) {
                 echo sprintf($tpl, $key, htmlspecialchars($value, ENT_QUOTES, _CHARSET), $key);
             }
             echo "\t</url>\n";
         }
         echo "</urlset>\n";
     } else {
         header("Content-type: text/plain");
         foreach ($sitemap as $url) {
             echo $url['loc'] . "\n";
         }
     }
     exit;
 }
Beispiel #2
0
	<?php 
foreach ($category["subcats"] as $k => $subcat) {
    ?>
		<div class="categInfo">
			<h1><a href="<?php 
    echo createCategoryLink($subcat["id"]);
    ?>
"><?php 
    echo $subcat["name"];
    ?>
 (<?php 
    echo $subcat["products_count"];
    ?>
)</a></h1>
			<a href="<?php 
    echo createCategoryLink($subcat["id"]);
    ?>
">
				<?php 
    if (!$subcat["img"]) {
        ?>
					<img src="<?php 
        echo base_url();
        ?>
img/faraPoza100.png" class="categImg"/>
				<?php 
    } else {
        ?>
						<img src="<?php 
        echo site_url("images/get_category_image");
        ?>
Beispiel #3
0
 function _genarateObjectLink($data, $scatFlag = '')
 {
     global $CONF, $manager, $blog;
     $ext = substr(serverVar('REQUEST_URI'), -4);
     if ($ext == '.rdf' || $ext == '.xml') {
         $CONF['URLMode'] = 'pathinfo';
     }
     if ($CONF['URLMode'] != 'pathinfo') {
         return;
     }
     $query = 'SELECT %s as result FROM %s WHERE %s = "%s"';
     switch ($data[0]) {
         case 'b':
             if ($data[2] == 'n') {
                 $bid = getBlogIDFromName($data[1]);
             } else {
                 $bid = $data[1];
             }
             $blog_id = intval($bid);
             $param = array('blog', 'bnumber', $blog_id);
             if (!$this->_isValid($param)) {
                 $url = _NOT_VALID_BLOG;
             } else {
                 $url = $this->_generateBlogLink($blog_id) . '/';
             }
             break;
         case 'c':
             if ($data[2] == 'n') {
                 $cid = getCatIDFromName($data[1]);
             } else {
                 $cid = $data[1];
             }
             $cat_id = intval($cid);
             $param = array('category', 'catid', $cat_id);
             if (!$this->_isValid($param)) {
                 $url = _NOT_VALID_CAT;
             } else {
                 $url = createCategoryLink($cat_id);
             }
             break;
         case 's':
             $mcategories = $this->pluginCheck('MultipleCategories');
             if ($mcategories) {
                 if ($data[2] == 'n') {
                     $temp = $this->quote_smart($data[1]);
                     $sque = sprintf($query, 'scatid', _C_SUBCAT_TABLE, 'sname', $temp);
                     $scid = quickQuery($sque);
                 } else {
                     $scid = $data[1];
                 }
                 $sub_id = intval($scid);
                 $param = array('plug_multiple_categories_sub', 'scatid', $sub_id);
                 if (!$this->_isValid($param)) {
                     $url = _NOT_VALID_SUBCAT;
                 } else {
                     $cqe = sprintf($query, 'catid', _C_SUBCAT_TABLE, 'scatid', $sub_id);
                     $cid = quickQuery($cqe);
                     $cid = intval($cid);
                     if (method_exists($mcategories, "getRequestName")) {
                         $subrequest = $mcategories->getRequestName();
                     }
                     if (!$subrequest) {
                         $subrequest = 'subcatid';
                     }
                     $linkParam = array($subrequest => $sub_id);
                     $url = createCategoryLink($cid, $linkParam);
                 }
             }
             break;
         case 'i':
             $param = array('item', 'inumber', intval($data[1]));
             if (!$this->_isValid($param)) {
                 $url = _NOT_VALID_ITEM;
             } else {
                 if ($scatFlag) {
                     global $catid, $subcatid;
                     if (!empty($catid)) {
                         $linkparams['catid'] = intval($catid);
                     }
                     if (!empty($subcatid)) {
                         $mcategories = $this->pluginCheck('MultipleCategories');
                         if ($mcategories) {
                             if (method_exists($mcategories, 'getRequestName')) {
                                 $subrequest = $mcategories->getRequestName();
                             } else {
                                 $subrequest = 'subcatid';
                             }
                         }
                         $linkparams[$subrequest] = intval($subcatid);
                     }
                     $url = createItemLink(intval($data[1]), $linkparams);
                 } else {
                     $blink = $this->_generateBlogLink(getBlogIDFromItemID(intval($data[1])));
                     $i_query = 'SELECT obj_name as result ' . 'FROM %s ' . 'WHERE obj_param = "item" ' . 'AND      obj_id = %d';
                     $i_query = sprintf($i_query, _CUSTOMURL_TABLE, intval($data[1]));
                     $path = quickQuery($i_query);
                     if ($path) {
                         if ($data[2] == 'path') {
                             $url = $path;
                         } else {
                             $url = $blink . '/' . $path;
                         }
                     } else {
                         if ($data[2] == 'path') {
                             $url = $CONF['ItemKey'] . '/' . intval($data[1]);
                         } else {
                             $url = $blink . '/' . $CONF['ItemKey'] . '/' . intval($data[1]);
                         }
                     }
                 }
             }
             break;
         case 'm':
             if ($data[2] == 'n') {
                 $data[1] = $this->quote_smart($data[1]);
                 $mque = sprintf($query, 'mnumber', sql_table('member'), 'mname', $data[1]);
                 $mid = quickQuery($mque);
             } else {
                 $mid = $data[1];
             }
             $member_id = intval($mid);
             $param = array('member', 'mnumber', $member_id);
             if (!$this->_isValid($param)) {
                 $url = _NOT_VALID_MEMBER;
             } else {
                 $url = createMemberLink($member_id);
             }
             break;
     }
     return $url;
 }
Beispiel #4
0
<li>
<a href="<?php 
echo createCategoryLink($category["id"]);
?>
"><?php 
echo $category["name"];
?>
</a>
<?php 
if (count($category["categories"]) > 0) {
    ?>
	<ul>
		<?php 
    foreach ($category["categories"] as $subcat) {
        ?>
			<?php 
        echo $subcat["template"];
        ?>
		<?php 
    }
    ?>
	</ul>
<?php 
}
?>
</li>