PageRenderTime 62ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/wp-shopping-cart/product_display_functions.php

http://cartonbank.googlecode.com/
PHP | 505 lines | 442 code | 46 blank | 17 comment | 40 complexity | 1941fc66935ba3d42e6c9e40d5438260 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, LGPL-2.1, AGPL-1.0, LGPL-3.0
  1. <?php
  2. //ales
  3. function product_display_paginated($search_sql = '', $offset, $items_on_page)
  4. {
  5. global $wpdb, $colorfilter, $totalitems,$siteurl,$sword;
  6. $siteurl = get_option('siteurl');
  7. $javascript_functions ='';
  8. $product_list = $GLOBALS['wpdb']->get_results($search_sql,ARRAY_A);
  9. //$totalitems = count($product_list);
  10. if($product_list != null)
  11. {
  12. $preview_mode=1; // display as popup window
  13. // $preview_mode=0; // display as Lightbox slideshow
  14. $output = "<div id='items' class='items'>";
  15. $counter = 0;
  16. foreach($product_list as $product)
  17. {
  18. if(($product['image'] !=null) and ($counter < $items_on_page))
  19. {
  20. $imagedir = ABSPATH."wp-content/plugins/wp-shopping-cart/product_images/";
  21. $image_size = @getimagesize($imagedir.$product['image']);
  22. $image_link = "index.php?productid=".$product['id']."&width=".$image_size[0]."&height=".$image_size[1]."";
  23. // thumbs output
  24. $output .= "<div id='item".$counter."' class='item'>"; // start item
  25. $vstavka = "document.getElementById('bigpic').innerHTML = '<img src=\'".$siteurl."/wp-content/plugins/wp-shopping-cart/product_images/".$product['image']."\'>';";
  26. // here we prepare data for the BIGPIC preview
  27. if(stristr($product['image'], 'jpg') != FALSE) {
  28. $_file_format = 'jpg';
  29. }
  30. if(stristr($product['image'], 'gif') != FALSE) {
  31. $_file_format = 'gif';
  32. }
  33. if(stristr($product['image'], 'png') != FALSE) {
  34. $_file_format = 'png';
  35. }
  36. $_number = $product['id'];
  37. $_description = htmlspecialchars_decode(nl2br(hilite(htmlspecialchars(stripslashes($product['description']),ENT_QUOTES))));
  38. $_size_warning='';
  39. if (isset($product['brandid']))
  40. {$_brandid = $product['brandid'];}
  41. else {$_brandid = '';}
  42. if (isset($product['category_id']))
  43. {$_category_id = $product['category_id'];}
  44. else {$_category_id = '';}
  45. $_author = "<a href=\'".$siteurl."/?page_id=29&brand=".$_brandid."\'>".$product['brand']."</a>";//$product['brand'];
  46. //$_name = hilite(nl2br(htmlspecialchars(stripslashes($product['name']),ENT_QUOTES)));
  47. $_name = nl2br(stripslashes($product['name']));
  48. $_avatarurl = ""; //"<a href=\"".get_option('siteurl')."/?page_id=29&brand=$_brandid\"><img src=".$product['avatarurl']." width=32 height=32 align=top border=0></a>";
  49. $_category = "<a href=\'".get_option('product_list_url')."&category=".$_category_id."\'>".$product['kategoria']."</a>";
  50. //$options .= "<a href='".get_option('product_list_url')."/&category=".$option['id']."'>".stripslashes($option['name'])."</a><br />";
  51. $product['additional_description'] = stripslashes ($product['additional_description']);
  52. $product['additional_description'] = htmlspecialchars($product['additional_description'],ENT_QUOTES);
  53. $_tags = hilite(nl2br($product['additional_description']));
  54. //$_tags = hilite(nl2br(htmlspecialchars(stripslashes($product['additional_description']))));
  55. //$_tags = hilite($product[0]['additional_description']);
  56. $_bigpicimgalt = addslashes("??????????. ".$_name.". ".$_description.". ".$_tags);
  57. $_tags_array = explode(',',$_tags);
  58. //$i=0;
  59. foreach ($_tags_array as $key => $value)
  60. {
  61. $_tags_array[$key] = "<a href=\'".get_option('siteurl')."/?page_id=29&cs=".trim($_tags_array[$key])."\'>".trim($_tags_array[$key])."</a>";
  62. }
  63. $_tags_imploded = implode(", ", $_tags_array);
  64. $_tags = $_tags_imploded;
  65. $_sharethis_html = "<div id=\'share_this\' style=\'line-height:200%;\'></div>";
  66. $_dimensions_html = "<div id='dimensions'><img src='".get_option('siteurl')."/img/ldng.gif'></div>";
  67. $_dimensions_html = str_replace("\"","\'",$_dimensions_html);
  68. $_dimensions_html = str_replace("'","\'",$_dimensions_html);
  69. $_rating_html = "<div id='star_rating'><img src='".get_option('siteurl')."/img/ldng.gif'></div>";
  70. $_rating_html = str_replace("\"","\'",$_rating_html);
  71. $_rating_html = str_replace("'","\'",$_rating_html);
  72. if (current_user_can('manage_options'))
  73. {
  74. $_edid = " <a href=".get_option('siteurl')."/wp-admin/admin.php?page=wp-shopping-cart/display-items.php&edid=".$_number." target=_blank><img border=0 src=".get_option('siteurl')."/img/edit.jpg title=\'??????? ????????\'></a> <a href=".get_option('siteurl')."/wp-admin/admin.php?page=wp-shopping-cart/display-items.php&updateimage=".$_number." target=_blank><img border=0 src=".get_option('siteurl')."/img/reload.gif title=\'???????? ??????? ????\'></a> <a href=".get_option('siteurl')."/ales/wordassociations/words.php?id=".$_number." target=_blank><img border=0 src=".get_option('siteurl')."/img/tags.gif title=\'???????? ?????\'></a>";
  75. }
  76. else
  77. {
  78. $_edid = "";
  79. }
  80. $current_user = wp_get_current_user();
  81. // $_SESSION['id']= $current_user->ID;
  82. // setcookie('uid', $_SESSION['id']);
  83. //pokazh($_COOKIE,"cookie");
  84. //pokazh ($_SESSION,"session");
  85. //pokazh ($current_user);
  86. ///pokazh($_SERVER);
  87. if (is_user_logged_in())
  88. {
  89. $logged = true; //" ????????? ";
  90. $klop = "";//"_";
  91. }
  92. else
  93. {
  94. $logged = false; //" ?? ????????? ";
  95. $klop = ""; //"|";
  96. }
  97. if ($logged)
  98. {
  99. $_bigpicstrip = "<div style=\'float:left;\'><b>????????: </b>" .$_name."&nbsp;$klop<span id=\'thumb\' onclick=\'fave_it();\'>$klop<img src=\'".$siteurl."/img/thumbupp.jpg\' border=0 title=\'???????? ? ???????\'></span></div> "."<div>?&nbsp;<a id=\'cuid\' title=\'?????????? ????? ???????? ? ???? ????????????\' href=\'".get_option('siteurl')."/?page_id=29&cartoonid=".$_number."\'>".$_number."</a>&nbsp;<b>".$_author."</a></b></div>";
  100. }
  101. else
  102. {
  103. $_bigpicstrip = "<div style=\'float:left;\'><b>????????: </b>" .$_name." $klop</div> "."<div>?&nbsp;<a id=\'cuid\' title=\'?????????? ????? ???????? ? ???? ????????????\' href=\'".get_option('siteurl')."/?page_id=29&cartoonid=".$_number."\'>".$_number."</a>&nbsp;<b>".$_author."</a></b></div>";
  104. }
  105. $_bigpictext = "<b>?????????: </b><br />".$_category."<br /><br /><b>????????: </b> ".$_description."<br /><br /><b>????: </b><br />".$_tags."<br /><br /><b>??????:</b><a title=\'?????????? ????? ???????? ? ???? ????????????\' href=\'".get_option('siteurl')."/?page_id=29&cartoonid=".$_number."\'> ?&nbsp;".$_number."</a><br /><br /><b>??????:</b><br />".$_dimensions_html."<br /><br /><b>??????:</b><br />".$_rating_html.$_sharethis_html.$_edid;
  106. $_bigpic = "<img src=\'".$siteurl."/wp-content/plugins/wp-shopping-cart/product_images/".$product['image']."\' border=0 alt=\'".$_bigpicimgalt."\' />";
  107. if($product['l1_price']=='0') {$l1_disabled = 'disabled=true';} else {$l1_disabled = '';}
  108. if($product['l2_price']=='0') {$l2_disabled = 'disabled=true';} else {$l2_disabled = '';}
  109. if($product['l3_price']=='0') {$l3_disabled = 'disabled=true';} else {$l3_disabled = '';}
  110. if (isset($product['not_for_sale']) && $product['not_for_sale']=='1')
  111. {
  112. $_bottomstriptext = "??????? ???????? ?? ?????? ??????????? ?? ????????? ???????";
  113. }
  114. else
  115. {
  116. // ????????? ????????
  117. if(isset($product['l1_price']) && $product['l1_price'] != 0)
  118. {$l1_price_text = "<td style=\'vertical-align:middle;text-align:right;\'><b>".round($product['l1_price'])."&nbsp;???.</b></td>";}
  119. else
  120. {$l1_price_text = "<td style=\'vertical-align:middle;text-align:right;\'>?? ????????</td>";}
  121. if(isset($product['l2_price']) && $product['l2_price'] != 0)
  122. {$l2_price_text = "<td style=\'vertical-align:middle;text-align:right;\'><b>".round($product['l2_price'])."&nbsp;???.</b></td>";}
  123. else
  124. {$l2_price_text = "<td style=\'vertical-align:middle;text-align:right;\'>?? ????????</td>";}
  125. if(isset($product['l3_price']) && $product['l3_price'] != 0)
  126. {$l3_price_text = "<td style=\'vertical-align:middle;text-align:right;\'><b>".round($product['l3_price'])."&nbsp;???.</b></td>";}
  127. else
  128. {$l3_price_text = "<td style=\'vertical-align:middle;text-align:right;\'>?? ????????</td>";}
  129. $_bottomstriptext = $_size_warning."<div style=\'width:450px;float:right;\'><form name=\'licenses\' id=\'licenses\' onsubmit=\'submitform(this);return false;\' action=\'".get_option('siteurl')."/?page_id=29\' method=\'POST\'><table class=\'licenses\'> <tr> <td class=\'wh\' style=\'width:80px;vertical-align:bottom;\'><b>?????</b></td> <td class=\'wh\' style=\'text-align:left;\'><input type=\'radio\' name=\'license\' $l1_disabled value=\'l1_price\'></td> ".$l1_price_text." <td rowspan=\'2\' style=\'width:20px;\'>&nbsp;</td> <td class=\'wh\' style=\'text-align:left;\'><input type=\'radio\' name=\'license\' $l2_disabled value=\'l2_price\'></td> ".$l2_price_text." <td rowspan=\'2\' style=\'width:20px;\'>&nbsp;</td> <td class=\'wh\' style=\'text-align:left;\'><input type=\'radio\' name=\'license\' $l3_disabled value=\'l3_price\'></td> ".$l3_price_text." <td rowspan=\'2\' class=\'wh\' style=\'width:80px; text-align:right; vertical-align:bottom;\'><input id=\'searchsubmit\' value=\'????????\' type=\'submit\' class=\'borders\' style=\'cursor:pointer;background-color:#FFFF99;padding:6px;margin-bottom:2px;\' title=\'???????? ??????? ? ??????? ???????\'></td> </tr> <tr> <td class=\'wh\' style=\'vertical-align:top;\'><b>????????:</b></td> <td colspan=\'2\' style=\'padding-left:6px;\'><a target=\'_blank\'href=\'".get_option('siteurl')."/?page_id=238\' title=\'????????? ?? ???????????? ????????\'>????????????</a></td> <td colspan=\'2\' style=\'padding-left:6px;\'><a target=\'_blank\'href=\'".get_option('siteurl')."/?page_id=242\' title=\'????????? ? ??????????? ????????\'>???????????</a></td> <td colspan=\'2\' style=\'padding-left:6px;\'><a target=\'_blank\'href=\'".get_option('siteurl')."/?page_id=245\' title=\'????????? ?? ??????????? ????????\'>???????????</a></td> </tr> </table><input type=\'hidden\' value=\'".$_number."\' name=\'prodid\'> </form></div>";
  130. }
  131. $_next_item = $counter + 1;
  132. if ($_next_item == 20)
  133. {
  134. $vstavka = "document.getElementById('bigpic').innerHTML ='<a title=\"????????? ???????? > \" href=\"#pt\" onclick=\"next_page();return false;\">".$_bigpic."</a>';";
  135. }
  136. else
  137. {
  138. $vstavka = "document.getElementById('bigpic').innerHTML ='<a title=\"????????? ??????????? > \" href=\"#pt\" onclick=\"get_item". $_next_item ."();\">".$_bigpic."</a>';";
  139. }
  140. $vstavka .= "document.getElementById('bigpictext').innerHTML ='".$_bigpictext."';";
  141. $vstavka .= "document.getElementById('bigpictopstrip').innerHTML ='".$_bigpicstrip."';";
  142. $vstavka .= "document.getElementById('bigpicbottomstrip').innerHTML ='".$_bottomstriptext."';";
  143. $output .= "<a href=\"#pt\" onclick=\"get_item". ($_next_item - 1) ."();\">";
  144. $jq_stars = ' get_5stars(); ';
  145. $jq_dimensions = ' get_dimensions(); ';
  146. $share_this = ' get_share_this(); ';
  147. $add_hash_2url = ' change_url(); ';
  148. $get_favorite = ' get_fave(); ';
  149. if (isset($sword)&&$sword!=''){
  150. //$highlight = " highlight(\"".$sword."\"); ";
  151. $highlight = " highlight(\"".htmlentities($sword, ENT_QUOTES)."\"); ";
  152. }
  153. else{$highlight = "";}
  154. $javascript_functions .= " function get_item".$counter."() { ".$vstavka.$highlight.$jq_stars.$jq_dimensions.$get_favorite.$share_this.$add_hash_2url." } ";
  155. $_offset = $offset + 20;
  156. $javascript_functions .=' function next_page(){window.location = "'.get_option('siteurl').'/?'.get_url_vars().'offset='.$_offset.'"; var cuid = document.getElementById("cuid").innerHTML; document.getElementById("navbar").innerHTML = cuid; window.location.hash = "bububu="+cuid; }';
  157. $fiilename =ABSPATH.'/wp-content/plugins/wp-shopping-cart/images/'.$product['image'];
  158. if (file_exists($fiilename))
  159. {
  160. $output .= "<img src='".$siteurl."/wp-content/plugins/wp-shopping-cart/images/".$product['image']."' title='".$product['name']."' alt='".$_bigpicimgalt."' class='thumb' />";
  161. }
  162. else
  163. {
  164. $output .= "<img src='".$siteurl."/wp-content/plugins/wp-shopping-cart/images/icon-rest.gif' class='thumb' />";
  165. }
  166. $output .= "</a>";
  167. $output .= "</div>"; // stop item
  168. }
  169. $counter = $counter + 1;
  170. }
  171. $output .= "</div>";
  172. $pagination = pagination($offset,$totalitems,$items_on_page);
  173. return "<script>get_item0();".$javascript_functions. "</script>" . " " . $pagination . $output;
  174. }
  175. // end function output first page
  176. }
  177. /// ales
  178. function get_random_image(){
  179. global $wpdb, $colorfilter;
  180. $sql = "SELECT `wp_product_list`.`id` FROM `wp_product_list` WHERE `active`='1' ".$colorfilter.$exclude_category_sql.$approved_or_not." AND `visible`='1' ORDER BY RAND(NOW()) LIMIT 1";
  181. $product_list = $wpdb->get_results($sql,ARRAY_A);
  182. }
  183. function pagination($offset,$totalitems,$items_on_page){
  184. // PAGINATION
  185. $page_id = $_GET['page_id'];
  186. $page = round($offset/$items_on_page)+1;
  187. if (isset($_REQUEST['new']) && $_REQUEST['new']!=1 )
  188. {
  189. $totalitems = 400;
  190. }
  191. $limit = $items_on_page;
  192. if (isset($_GET['category'])&&is_numeric($_GET['category'])) {$catid=$_GET['category'];}else{$catid='';}
  193. // Brand filter
  194. if (isset($_GET['brand']) && is_numeric($_GET['brand']))
  195. {
  196. $_brand = $_GET['brand'];
  197. $brand_group_sql = "&amp;brand=".$_brand;
  198. }
  199. elseif (isset($_POST['brand']) && is_numeric($_POST['brand']))
  200. {
  201. $_brand = $_POST['brand'];
  202. $brand_group_sql = "&amp;brand=".$_brand;
  203. }
  204. else
  205. {
  206. $_brand = '';
  207. $brand_group_sql = '';
  208. }
  209. //$_pages_navigation = getPaginationString($page, $totalitems, $limit, $adjacents = 1, $targetpage = get_option('siteurl'), $pagestring = "?page_id=29".$newfilter.$brand_group_sql."&amp;color=".$color.$__category.$_url_cs.$_url_cs_exact.$_url_cs_any.$_url_cs_exclude.$_url_666."&amp;offset=", $filter_list, $new, $brand_group_sql,$_category,$color_url);
  210. $_pages_navigation = getPaginationString($page, $totalitems, $limit, $adjacents = 1, $targetpage = get_option('siteurl'), $pagestring = "?".get_url_vars()."offset=");
  211. if (isset($_GET['cartoonid']) && is_numeric($_GET['cartoonid']))
  212. {
  213. $output = "";
  214. }
  215. else
  216. {
  217. $output = "<div style='clear:both;'>".$_pages_navigation."</div>";
  218. }
  219. return $output;
  220. }
  221. function get_url_vars(){
  222. $output = '';
  223. foreach($_REQUEST as $key=>$val)
  224. {
  225. if ($key!='offset')
  226. $output .= $key."=".urlencode($val)."&";
  227. }
  228. return $output;
  229. //return htmlentities($output);
  230. }
  231. function add_or_change_parameter($parameter='', $value='')
  232. {
  233. $params = array();
  234. $output = "?";
  235. $firstRun = true;
  236. foreach($_GET as $key=>$val)
  237. {
  238. if($key != $parameter)
  239. {
  240. if(!$firstRun)
  241. {
  242. $output .= "&";
  243. }
  244. else
  245. {
  246. $firstRun = false;
  247. }
  248. $output .= $key."=".urlencode($val);
  249. }
  250. }
  251. if(!$firstRun)
  252. $output .= "&";
  253. $output .= $parameter."=".urlencode($value);
  254. //return $output;
  255. return htmlentities($output);
  256. }
  257. function hilite($string)
  258. {
  259. global $aKeywords;
  260. if (count($aKeywords)==0)
  261. {return $string;}
  262. foreach ($aKeywords as $key => $value)
  263. {
  264. $string = preg_replace('/('.$value.')/ui', '<span class="hilite">$1</span>', $string);
  265. }
  266. return $string;
  267. }
  268. function getPaginationString($page = 1, $totalitems, $limit = 20, $adjacents = 1, $targetpage = "/", $pagestring = "?page=")
  269. {
  270. //function to return the pagination string
  271. global $siteurl;
  272. $filter_list='';
  273. // if the image is single set totalitems to 1
  274. if (isset($_GET['cartoonid']) && is_numeric($_GET['cartoonid']))
  275. {$totalitems = 1;}
  276. //defaults
  277. if(!$adjacents) $adjacents = 1;
  278. if(!$limit) $limit = 20;
  279. if(!$page) $page = 1;
  280. if(!$targetpage) $targetpage = "/";
  281. //other vars
  282. $prev = $page - 1; //previous page is page - 1
  283. $next = $page + 1; //next page is page + 1
  284. $lastpage = ceil($totalitems / $limit); //lastpage is = total items / items per page, rounded up.
  285. $lpm1 = $lastpage - 1; //last page minus 1
  286. /*
  287. Now we apply our rules and draw the pagination object.
  288. We're actually saving the code to a variable in case we want to draw it more than once.
  289. */
  290. $pagination = "";
  291. $margin = '0px';
  292. $padding = '0px';
  293. if($lastpage > 1)
  294. {
  295. $pagination .= "<div class='pagination' style='padding-top:4px;'>";
  296. //previous button
  297. if ($page > 1)
  298. $pagination .= "<a href=\"".$targetpage. $pagestring. ($prev*$limit - $limit). "\">Ť</a> ????????: ";
  299. else
  300. $pagination .= "<span class=\"disabled\">Ť</span> ????????: ";
  301. //pages
  302. if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
  303. {
  304. for ($counter = 1; $counter <= $lastpage; $counter++)
  305. {
  306. if ($counter == $page)
  307. $pagination .= "<span class=\"current\">$counter</span>";
  308. else
  309. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($counter*$limit - $limit) . "\">$counter</a>";
  310. }
  311. }
  312. elseif($lastpage >= 7 + ($adjacents * 2)) //enough pages to hide some
  313. {
  314. //close to beginning; only hide later pages
  315. if($page < 1 + ($adjacents * 3))
  316. {
  317. for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
  318. {
  319. if ($counter == $page)
  320. $pagination .= "<span class=\"current\">$counter</span>";
  321. else
  322. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($counter*$limit - $limit) . "\">$counter</a>";
  323. }
  324. $pagination .= "<span class=\"elipses\">...</span>";
  325. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($lpm1*$limit - $limit) . "\">$lpm1</a>";
  326. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($lastpage*$limit - $limit) . "\">$lastpage</a>";
  327. }
  328. //in middle; hide some front and some back
  329. elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
  330. {
  331. $pagination .= "<a href=\"" . $targetpage . $pagestring . "0\">1</a>";
  332. $pagination .= "<a href=\"" . $targetpage . $pagestring . "20\">2</a>";
  333. $pagination .= "<span class=\"elipses\">...</span>";
  334. for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
  335. {
  336. if ($counter == $page)
  337. $pagination .= "<span class=\"current\">$counter</span>";
  338. else
  339. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($counter*$limit - $limit) . "\">$counter</a>";
  340. }
  341. $pagination .= "...";
  342. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($lpm1*$limit - $limit) . "\">$lpm1</a>";
  343. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($lastpage*$limit - $limit) . "\">$lastpage</a>";
  344. }
  345. //close to end; only hide early pages
  346. else
  347. {
  348. $pagination .= "<a href=\"" . $targetpage . $pagestring . "0\">1</a>";
  349. $pagination .= "<a href=\"" . $targetpage . $pagestring . "20\">2</a>";
  350. $pagination .= "<span class=\"elipses\">...</span>";
  351. for ($counter = $lastpage - (1 + ($adjacents * 3)); $counter <= $lastpage; $counter++)
  352. {
  353. if ($counter == $page)
  354. $pagination .= "<span class=\"current\">$counter</span>";
  355. else
  356. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($counter*$limit - $limit) . "\">$counter</a>";
  357. }
  358. }
  359. }
  360. //next button
  361. if (isset($_REQUEST['new']) && $_REQUEST['new']==1)
  362. {
  363. $button_sort = "<a href='".$siteurl."/?".add_or_change_parameter('new','0')."' style='border:0px; padding:4px; color:#6C6C6C; background-color:#bfccf8;'>???????? ?????????</a>";
  364. }
  365. else
  366. {
  367. $button_sort = "<a href='".$siteurl."/?".add_or_change_parameter('new','1')."' style='border:0px; padding:4px; color:#6C6C6C; background-color:#bfccf8;'>??????????? ?? ????</a>";
  368. }
  369. if (isset($_REQUEST['cs'])&&$_REQUEST['cs']!=''){$filter_list = $_REQUEST['cs'];}else{$filter_list = '';}
  370. if ($page < $counter - 1)
  371. $pagination .= "<a href=\"" . $targetpage . $pagestring . ($next*$limit - $limit) . "\">ť</a>";
  372. else
  373. $pagination .= "<span class=\"disabled\">ť</span>";
  374. if (isset($filter_list)&&$filter_list=='')
  375. $pagination .= " ?????: ".$totalitems. "<div style='float:right;'>".$button_sort."</div></div>";
  376. else
  377. $pagination .= " ?????: ".$totalitems. " ???.&nbsp;<b>??????</b>: <span style='color:#CC3399;'>".stripslashes($filter_list)."</span><div style='float:right;'>".$button_sort."</div></div>";
  378. }//if($lastpage > 1)
  379. if ($totalitems < 20){
  380. if (isset($_REQUEST['cs'])&&$_REQUEST['cs']!=''){$filter_list = $_REQUEST['cs'];}else{$filter_list = '';}
  381. $pagination .= " ????? ???????: ".$totalitems. ".&nbsp;<b>??????</b>: <span style='color:#CC3399;'>".$filter_list."</span>";
  382. }
  383. return $pagination;
  384. }//function getPaginationString
  385. function ssearch($words){
  386. $hostname = "127.0.0.1:9306";
  387. $user = "mysql";
  388. $bd = mysql_connect($hostname, $user) or die("Could not connect database. ". mysql_error());
  389. //$searchQuery = "select id from wp1i where match('$words') OPTION ranker=matchany, max_matches=1000";
  390. $searchQuery = "select id from wp1i where match('$words') LIMIT 15000 OPTION ranker=matchany, max_matches=1000";
  391. $result = mysql_query($searchQuery);
  392. if (!$result) {die('Invalid query: ' . mysql_error());}
  393. $id_list = "";
  394. while ($row = mysql_fetch_array ($result)) {
  395. $id_list .= $row['id'].", ";
  396. }
  397. if (strlen($id_list>2))
  398. $id_list = substr($id_list,0,-2);
  399. mysql_close($bd);
  400. return $id_list;
  401. }
  402. ?>