function GetNewsItem($id,$line=null,$params=null) { global $par,$varsline; if($line==null) { $sql="SELECT * FROM $par->news1table WHERE `id`=$id AND `hide`=0"; $res = mysql_query($sql); $line = mysql_fetch_array($res,MYSQL_ASSOC); } $line = LangProcess($line); if(isset($line['titleh1']) && $line['titleh1']!='') $line['title']=$line['titleh1']; else $line['title']=$line['title']; $line['item_url'] = GetSeoUrl('news',$line['id'],$line); //формируем информацию о фото $line['item_fotos'] = Array(); if(is_file($par->document_root.'/fotos/news1_sm_'.$line['id'].'.jpg')) { $fname = 'fotos/news1_sm_'.$line['id'].'.jpg'; } else $fname = ''; if(is_file($par->document_root.'/fotos/news1_bg_'.$line['id'].'.jpg')) { $fnamebig = 'fotos/news1_bg_'.$line['id'].'.jpg'; } else $fnamebig=''; $line['item_fotos'][] = Array('fname'=>$fname, 'fnamebig'=>$fnamebig); return $line; }
function GetProductInfo($id,$line=null,$paramfunc = null) { global $par; if ($line == null){ $sql = "SELECT * FROM $par->objectstable WHERE id=$id AND hide=0"; $res = mysql_query($sql); $line = mysql_fetch_array($res,MYSQL_ASSOC); } $url = GetSeoUrl('tovar',$line['id'],$line); $instr = '(-1'; $tmp = explode(":",$line["colors"]); foreach ($tmp as $value) { if($value!="") $instr.=",".$value; } $instr.= ")"; $sql3 = "SELECT * FROM $par->fotorobjtable WHERE `title` IN $instr AND hide=0 GROUP BY `title` ORDER BY prior"; $res3 = mysql_query($sql3); while ($line3 = mysql_fetch_array($res3,MYSQL_ASSOC)){ $color = (int)$line3['title']; $sql4 = "SELECT * FROM $par->colorstable WHERE `id`=$color AND hide=0"; $res4 = mysql_query($sql4); $line4 = mysql_fetch_array($res4, MYSQL_ASSOC); $colors[] = array('id' => $line4['id'], 'color' => $line4['color']); } if (isset($colors) && !empty($colors)) $active_color = strval($colors[0]['id']); $parent = $line['id']; $sql2 = "SELECT * FROM $par->fotorobjtable WHERE `reportid`=$parent"; if (isset($active_color)) $sql2 .= " AND `title`='$active_color'"; $sql2 .= " ORDER by prior"; $res2 = mysql_query($sql2); while ($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)){ $img[] = img_check("products/product_",$line2['id']); } $size = size_explode($line['id']); if (isset($colors) && !empty($colors)) $productitem = array('id' => $line['id'], 'artikul' => $line['artikul'], 'url' => $url, 'title' => $line['title'], 'text' => $line['text'], 'price' => $line['price'], 'colors' => $colors, 'size' => $size); else $productitem = array('id' => $line['id'], 'artikul' => $line['artikul'], 'url' => $url, 'title' => $line['title'], 'text' => $line['text'], 'price' => $line['price'], 'size' => $size); $productitem['img'] = $img; return $productitem; }
function GetBreadcrumbsArr($act,$id) { global $par; $resarr = Array(); $tablename = ''; foreach($par->params AS $key=>$value) { if($value['actname']==$act) { $tablename = $value['tablename']; break; } } $pid = $id; $k=0; while($pid!=0) { $k++; if($k>10) break; //защита от вечного цикла, на всякий случай ;) $sql = "SELECT * FROM $tablename WHERE `id`=$pid"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $line = LangProcess($line); $item_url = GetSeoUrl($act,$line['id'],$line); $item_title = $line['title']; $resarr[] = Array('item_title'=>$item_title , 'item_url'=>$item_url); $pid = $line['parentid']; } else break; } $sql = "SELECT * FROM $par->topmenutable WHERE `url`='/$act'"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $item_url = GetSeoUrl($act,$line['id'],$line); $item_title = $line['title']; $resarr[] = Array('item_title'=>$item_title , 'item_url'=>$item_url); } if($act=="tovar") { $sql = "SELECT * FROM $par->objectstable WHERE `id`=$id"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $resarr = array_merge($resarr, GetBreadcrumbsArr('cat',$line['categid']) ); } } return $resarr; }
function GetArticlesItem($id,$line=null,$params=null) { global $par,$varsline; if($line==null) { $sql="SELECT * FROM $par->news2table WHERE `id`=$id AND `hide`=0"; $res = mysql_query($sql); $line = mysql_fetch_array($res,MYSQL_ASSOC); } $line = LangProcess($line); if(isset($line['titleh1']) && $line['titleh1']!='') $line['title']=$line['titleh1']; else $line['title']=$line['title']; $line['item_url'] = GetSeoUrl('articles',$line['id'],$line); $line['img'] = img_check("articles/article_",$line['id']); return $line; }
$cat_arr = Array(); $sql="SELECT * FROM $par->categorytable WHERE `hide`=0 ORDER by prior"; $res = mysql_query($sql); while($line = mysql_fetch_array($res,MYSQL_ASSOC)){ $img = img_check("cat/cat_",$line['id']); $url = GetSeoUrl('cat',$line['id'],$line); $line = LangProcess($line); $cat_arr[] = Array('title'=>$line['title'],'img'=>$img,'url'=>$url); } $_logic['cat_arr'] = $cat_arr; /////////////////// $slider_arr = Array(); $sql="SELECT * FROM $par->news1table WHERE `hide`=0 ORDER by prior"; $res = mysql_query($sql); while($line = mysql_fetch_array($res,MYSQL_ASSOC)){ $img = img_check("novelty/slide_novelty_",$line['id']); $url = GetSeoUrl('novelty',$line['id'],$line); $line = LangProcess($line); $slider_arr[] = Array('title'=>$line['title'],'img'=>$img,'caption'=>$line['caption'],'url'=>$url,'left'=>$line['position-left'],'right'=>$line['position-right'],'top'=>$line['position-top'],'bottom'=>$line['position-bottom']); } $_logic['slider_arr'] = $slider_arr; }
$filialsarr['title'] = $line['title']; $filialsarr['text'] = $line['text']; } //список подпунктов данного пункта $sql = "SELECT * FROM $par->filialstable WHERE `parentid`=$id AND `hide`=0"; //echo $sql.'<BR>'; $res = mysql_query($sql); $k = 0; $slng = 0; $slat = 0; if(mysql_num_rows($res)>0) { while($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $k++; $a = Array( 'id'=>$line['id'], 'lng'=>$line['lng'], 'lat'=>$line['lat'], 'zoom'=>$line['zoom'], 'title'=>$line['title'.$langadd], 'shorttext'=>$line['shorttext'.$langadd], ); $a['url'] = GetSeoUrl('filials',$line['id'],$line); $filialsarr['items'][] = $a; $slng += $line['lng']; $slat += $line['lat']; if($id==0 && $k!=0) { $filialsarr['mainitem']['zoom'] = $line['zoom']; } } if($id==0 && $k!=0) { $filialsarr['mainitem']['lng'] = $slng/$k;
<? //$_SESSION = array(); $_logic['lang_url_default'] = GetSeoUrl($act,$id,null,'ua','',true); $_logic['lang_url_ru'] = GetSeoUrl($act,$id,null,'ru','',true); $_logic['lang_url_en'] = GetSeoUrl($act,$id,null,'en','',true); $varsline = LangProcess($varsline); //Считаем сколько товаров и на какую сумму в корзине $all_in_basket = 0; $all_sum_in_basket = 0; if(isset($_SESSION['basket'])) { foreach ($_SESSION['basket'] AS $key=>$item) { $sql = "SELECT * FROM $par->objectstable WHERE id=$item[id]"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $all_in_basket += $item['count']; $all_sum_in_basket += $item['count'] * $line['price']; $sql2 = "SELECT title, color FROM $par->colorstable WHERE id=$item[color]"; $res2 = mysql_query($sql2); if ($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)) $basket_arr[] = array('title' => $line['title'], 'price' => $line['price'], 'count' => $item['count'], 'color' => $line2['title'], 'color_code' => $line2['color']); else $basket_arr[] = array('title' => $line['title'], 'price' => $line['price'], 'count' => $item['count']); } } }
function GenSiteMapXml($sitemapfile) { global $par; $path = 'http://'.$_SERVER['HTTP_HOST']; $buf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $buf.="<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"; foreach($par->params AS $param) { $actname = $param['actname']; $tablename = $param['tablename']; $urlprefix = $param['urlprefix']; if($tablename!='') { $sql = "SELECT * FROM $tablename"; $res = mysql_query($sql); //echo $sql.'<BR>'; while($line = @mysql_fetch_array($res,MYSQL_ASSOC)) { foreach($par->langsarr['admlangs'] AS $key=>$value) { if($value==true) { //$suffix = $this->langsarr['admlangssuffix'][$key]; $url = GetSeoUrl($actname,$line['id'],$line,$par->langsarr['plangsarr'][$key]); //$buf. = $path.$url; $buf.=" <url>\n"; $buf.=" <loc>".$path.$url."</loc>\n"; $buf.=" <lastmod>".date("Y-m-d",$line['modifydate'])."</lastmod>\n"; $buf.=" <changefreq>always</changefreq>\n"; $buf.=" <priority>1</priority>\n"; $buf.=" </url>\n"; } } } } } $buf.="</urlset>\n"; file_put_contents($sitemapfile,$buf); }
<? $k=0; ?> <ul class="breadscrumbs"> <li><a href="<?php echo GetSeoUrl('none'); ?> " class="home_link"></a></li> <? foreach( array_reverse($_breadcrumbsarr,true) AS $key=>$item): ?> <? $k++; ?> <? if($k==count($_breadcrumbsarr)): ?> <li><?php echo htmlspecialchars($item['item_title']); ?> </li> <? else: ?> <li><a href="<?php echo htmlspecialchars($item['item_url']); ?> "><?php echo htmlspecialchars($item['item_title']); ?> </a></li> <? endif; ?> <? endforeach; ?> </ul>
<? if ($act=='novelty' && $id!=0) { $_logic['content']=Array(); $_logic['content'] = GetNewsItem($id); $_logic['content']['allnewsurl'] = GetSeoUrl('novelty',0); } if ($act=='novelty' && $id==0) { $_logic['content']=Array(); $sql = "SELECT * FROM $par->topmenutable WHERE `url`='/novelty'"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $line = LangProcess($line); $_logic['content']['title'] = $line['title']; $_logic['content']['text'] = $line['text']; } $newsinpage = 5; $_logic['content']['items'] = GetNewsList( Array('orderby'=>'prior DESC', 'start'=>$start, 'itemsinpage'=>$newsinpage) ); $sql2 = "SELECT COUNT(id) AS ccc FROM $par->news1table WHERE `hide`=0"; $linkstr = GetSeoUrl('novelty',0); $_logic['content']['pagerarr']=GetPager($sql2,$linkstr,$newsinpage); } ?>
<?php $cat_arr = array(); $sql = "SELECT * FROM {$par->categorytable} WHERE `hide`=0 ORDER by prior"; $res = mysql_query($sql); while ($line = mysql_fetch_array($res, MYSQL_ASSOC)) { $img = img_check("cat/cat_", $line['id']); $url = GetSeoUrl('cat', $line['id'], $line); $line = LangProcess($line); $cat_arr[] = array('id' => $line['id'], 'title' => $line['title'], 'img' => $img, 'url' => $url); } $_logic['cat_arr'] = $cat_arr;
<? if ($act=='articles' && $id!=0) { $_logic['content']=Array(); $_logic['content'] = GetArticlesItem($id); $_logic['content']['allnewsurl'] = GetSeoUrl('articles',0); } if ($act=='articles' && $id==0) { $_logic['content']=Array(); $sql = "SELECT * FROM $par->topmenutable WHERE `url`='/articles'"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $line = LangProcess($line); $_logic['content']['title'] = $line['title']; $_logic['content']['text'] = $line['text']; } $newsinpage = 5; $_logic['content']['items'] = GetArticlesList( Array('orderby'=>'prior DESC', 'start'=>$start, 'itemsinpage'=>$newsinpage) ); $sql2 = "SELECT COUNT(id) AS ccc FROM $par->news2table WHERE `hide`=0"; $linkstr = GetSeoUrl('articles',0); $_logic['content']['pagerarr']=GetPager($sql2,$linkstr,$newsinpage); } ?>
$sql1 = "SELECT * FROM $par->topmenutable WHERE hide=0 AND `parentid`=0 ORDER BY prior"; $res1 = mysql_query($sql1); $nrows1 = mysql_num_rows($res1); $k = 0; while($line1 = mysql_fetch_array($res1,MYSQL_ASSOC)) { $k++; $submenu = Array(); $sql2 = "SELECT * FROM $par->topmenutable WHERE hide=0 AND `parentid`=$line1[id] ORDER BY prior"; $res2 = mysql_query($sql2); while($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)) { $url2 = GetSeoUrl('menu',$line2['id'],$line2); $submenu[] = Array("title"=>$line2["title"],"url"=>$url2); } if($line1['id']==$activemenuid) $isactive = true; else $isactive = false; $url1 = GetSeoUrl('menu',$line1['id'],$line1); $mainmenuarr[] = Array('url'=>$url1,'title'=>$line1['title'.$langadd],'isactive'=>$isactive,'isfirst'=>($k==1),'islast'=>($k==$nrows1),'submenu'=>$submenu); } $_logic['mainmenuarr'] = $mainmenuarr;
while($line = mysql_fetch_array($res,MYSQL_ASSOC)){ $parent = $line['id']; $sql2 = "SELECT * FROM $par->fotorobjtable WHERE `reportid`=$parent ORDER by prior"; $res2 = mysql_query($sql2); $line2 = mysql_fetch_array($res2,MYSQL_ASSOC); $img = img_check("products/product_",$line2['id']); $url = GetSeoUrl('tovar',$line['id'],$line); $line = LangProcess($line); $size = size_explode($line['id']); $carpets[] = Array('title'=>$line['title'],'img'=>$img,'url'=>$url,'price'=>$line['price'],'size'=>$size); } $sql2 = "SELECT COUNT(id) AS ccc FROM $par->objectstable WHERE `hide`=0 and `categid`=$id"; $linkstr = GetSeoUrl('cat',$id); $_logic['content']['pagerarr']=GetPager($sql2,$linkstr,$objinpage); $_logic['carpets'] = $carpets; ////////////////////////////// $shapes = Array(); $sql="SELECT * FROM $par->shapestable WHERE `hide`=0 ORDER by prior"; $res = mysql_query($sql); while($line = mysql_fetch_array($res,MYSQL_ASSOC)){ $line = LangProcess($line); $shapes[] = Array('id'=>$line['id'],'title'=>$line['title']); } $_logic['shapes'] = $shapes;
} $_logic['gallery_arr'] = $gallery_arr; $sql2 = "SELECT COUNT(id) AS ccc FROM $par->fototable WHERE `hide`=0 AND (`tip`=$_SESSION[thema] OR `tip`=1)"; $linkstr = GetSeoUrl('gallery',0); $_logic['content']['pagerarr']=GetPager($sql2,$linkstr,$newsinpage); }else{ $gallery_arr=Array(); $sql="SELECT * FROM $par->fototable WHERE `hide`=0 AND `id`=$id"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)){ $fotos = Array(); $sql2="SELECT * FROM $par->fotortable WHERE `reportid`=$line[id] order by prior"; $res2 = mysql_query($sql2); while($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)){ $fname = img_check("gallery_sm_",$line2['id']); $fnamebig = img_check("gallery_bg_",$line2['id']); $fotos[] = Array('fname'=>$fname,'fnamebig'=>$fnamebig,'title'=>$line2['title']); } $line['title'] = titleh1_check($line); $_logic['gallery_arr'] = Array('title'=>$line['title'],'fotos'=>$fotos,'backurl'=>GetSeoUrl($act,0)); } //debug($_logic['gallery_arr']); } ?>
} } } } $all_in_compare_list = 0; if(isset($_SESSION['compare'])){ foreach ($_SESSION['compare'] AS $key => $item){ $sql = "SELECT * FROM $par->objectstable WHERE id=$item[id]"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)){ $all_in_compare_list++; $url = GetSeoUrl('tovar',$item['id'],$line); $line['price'] = $line['price'];// * (($item['length']/100) * ($item['breadth']/100)) + ($line['price'] * (($item['length']/100) * ($item['breadth']/100)) * 0.1); $sql2 = "SELECT title, color FROM $par->colorstable WHERE id=$item[color]"; $res2 = mysql_query($sql2); if ($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)){ $sql3 = "SELECT id FROM fotorobj WHERE title=$item[color] AND reportid=$item[id]"; $res3 = mysql_query($sql3); $line3 = mysql_fetch_array($res3,MYSQL_ASSOC); $img = img_check("products/product_",$line3['id']); $compare_arr[] = array('id' => $line['id'], 'url' => $url, 'title' => $line['title'], 'price' => $line['price'], 'img' => $img, 'count' => $item['count'], 'color' => $line2['title'], 'color_code' => $line2['color'], 'length' => $item['length'], 'breadth' => $item['breadth']); } else{
} $product = GetProductInfo($key); $fname = $product['fname']; $addstr = ''; if($fname!='') { $addstr = GetAddStr(100,100,$fname); $fname = '/'.$fname; } echo ' <tr > <td class="td1"><img src="'.$fname.'" '.$addstr.' alt="'.htmlspecialchars($line['title']).'"/></td> <td class="td2"><a href="'.GetSeoUrl('tovar',$line['id'],$line).'">'.htmlspecialchars($line['title']).'</a></td> <td class="td3"><input type="text" name="tov['.$line['id'].']" value="'.$value.'" id="int_count" style="width:30px;" /></td> <td class="td4">'.PriceToStr($line['price']).'</td> <td class="td5"><a href="/work.php?act=changebasket&deltov['.$line['id'].']=1"><img src="/utils/images_z/kill.png" width="15" height="15" alt="убрать" /></a></td> </tr>'; $allsum+= $line['price']*$value; } } } echo ' <tr><td colspan="3"> </td><td class="total"><b>Итого: '.PriceToStr($allsum).' руб.</b></td><td> </td></td></tr> <tr>
{ $fname = 'fotos/object_sm'.$linetmp['id'].'.jpg'; } } $product = GetProductInfo($key); $fname = $product['fname']; if($fname!='') { $addstr = GetAddStr(74,68,$fname); $fname = '/'.$fname; } $myurl = GetSeoUrl('tovar',$line1['id'],$line1); if($kk!=1) echo ' <tr> <td colspan="4" height="20" valign="middle"> <div style="height:1px;font-size:1px;background:#ededed;overflow:hidden;"></div> </td> </tr>'; echo ' <tr> <td align="center"><a href="'.$myurl.'"><img src="'.$fname.'" '.$addstr.' alt=""></a></td> <td><a href="'.$myurl.'">'.htmlspecialchars($line1['title']).'</a></td> <td class="cena">Цена: '.$oldprice.' руб<br></td> <td><nobr>Кол-во: '.$value.'</nobr></td> </tr>';
<? if ($act=='articles') { $_logic['content']=Array(); if($id==0) { $sql = "SELECT * FROM $par->topmenutable WHERE `url`='/articles'"; $res = mysql_query($sql); if($line = mysql_fetch_array($res,MYSQL_ASSOC)) { $line = LangProcess($line); $_logic['content'] = $line; } } else $_logic['content'] = GetArticlesItem($id); $_logic['content']['allarticlesurl'] = GetSeoUrl('articles',0); $orderby = 'prior DESC'; $newsinpage = $varsline['articlesinpage']; $_logic['content']['items'] = GetArticlesList( Array('parentid'=>$id, 'orderby'=>$orderby, 'start'=>$start, 'itemsinpage'=>$newsinpage) ); $sql2 = "SELECT COUNT(id) AS ccc FROM $par->news1table WHERE `hide`=0"; $linkstr = GetSeoUrl('articles',$id); $_logic['content']['pagerarr']=GetPager($sql2,$linkstr,$newsinpage); } ?>