function dequy_menu_doc($id) { $cnDB1 = Zend_Registry::get('connectDB'); $tv = "select * from menu where parent_id='{$id}' order by id"; $stml1 = $cnDB1->prepare($tv); $stml1->execute(); while ($result1 = $stml1->fetch(PDO::FETCH_ASSOC)) { $id = $result1['id']; $ten = $result1['title']; $url = khongdau($ten); $link_menu = "san-pham-{$url}-{$id}.html"; echo "<li>"; echo "<a href=\"{$link_menu}\">"; echo $result1['title']; echo "</a>"; $xacdinh_menu_con_doc = $this->xacdinh_menu_con_doc($id); if ($xacdinh_menu_con_doc == "co") { echo "<ul>"; $this->dequy_menu_doc($id); echo "</ul>"; } else { } echo "</li>"; } }
public function news() { $view = new Zend_View(); $base = $view->baseurl(); try { $query = "SELECT * FROM page where menu like '12' ORDER BY id DESC limit 0,4"; $stml = $this->db->prepare($query); $stml->execute(); while ($result = $stml->fetch(PDO::FETCH_ASSOC)) { $id = $result['id']; $title = $result['title']; $url = khongdau($title); $date = $result['date']; $menu = $result['menu']; $images = $result['images']; $link = "{$base}/trang/{$url}-{$id}-{$menu}.html"; echo "<div class='clear_10'></div>"; echo "<a href=\"{$url}/pages/tin-tuc-12.html\" title=\"{$ten}\"> <img src=\"{$base}/Upload/{$images}\"> </a>"; echo "<a href=\"{$link}\"> <h5> {$title} </h5></a>"; echo "<span>{$date} <span>"; echo "<div class='clear'></div>"; echo "<div class='clear_border'></div>"; } } catch (Exception $exc) { echo $exc->getTraceAsString(); } }
private function dequy_menu_doc($id) { $vie = new Zend_View(); $base = $vie->baseurl(); $cnDB1 = Zend_Registry::get('connectDB'); $tv = "select * from add_page where cat_page_id='{$id}' and active=1 order by position ASC"; $stml1 = $cnDB1->prepare($tv); $stml1->execute(); while ($result1 = $stml1->fetch(PDO::FETCH_ASSOC)) { $id = $result1['id']; $ten = $result1['title']; $url = khongdau($ten); $link_menu = "{$base}/pages/{$url}-{$id}.html"; echo "<li>"; echo "<a href=\"{$link_menu}\">"; echo $result1['title']; echo "</a>"; $xacdinh_menu_con_doc = $this->xacdinh_menu_con_doc($id); if ($xacdinh_menu_con_doc == "co") { echo "<ul>"; $this->dequy_menu_doc($id); echo "</ul>"; } else { } echo "</li>"; } }
public function page_2() { $view = new Zend_View(); $base = $view->baseUrl(); $query = "SELECT * FROM add_page where active like '1' order by position ASC limit 1,5 "; $stml = $this->db->prepare($query); $stml->execute(); while ($result = $stml->fetch(PDO::FETCH_ASSOC)) { $id = $result['id']; $title = $result['title']; $url = khongdau($title); echo "<li><a href=\"{$base}/pages/{$url}-{$id}.html\">" . $result['title'] . "</a></li>"; } }
function dequy_menu_doc($id) { $tv = "select * from menu where thuoc_menu='{$id}' and vitri_menu='doc' order by id"; $tv_1 = mysql_query($tv); while ($tv_2 = mysql_fetch_array($tv_1)) { $id = $tv_2['id']; $ten = $tv_2['ten']; $url = khongdau($ten); $link_menu = "san-pham-" . $url . "-{$id}.html"; echo "<li>"; echo "<a href=\"{$link_menu}\">"; echo $tv_2['ten']; echo "</a>"; $xacdinh_menu_con_doc = xacdinh_menu_con_doc($id); if ($xacdinh_menu_con_doc == "co") { echo "<ul>"; dequy_menu_doc($id); echo "</ul>"; } else { } echo "</li>"; } }
public function top_km() { $view = new Zend_View(); $base = $view->baseurl(); $query = "SELECT * FROM products where type like '4' and active like '1' order by date DESC, id DESC limit 0,10 "; $stml = $this->db->prepare($query); $stml->execute(); while ($result = $stml->fetch(PDO::FETCH_ASSOC)) { $id = $result['id']; $date = $result['date']; $title = $result['title']; $url = khongdau($title); echo " <a href=\"{$base}/chi-tiet/{$url}-{$id}.html\" title=\"{$title}\"> <h5> {$title} </h5></a> "; } }
function addproductsAction() { $muser = new Admin_Model_Page(); $paginator = Zend_Paginator::factory($muser->option_page()); $paginator->setItemCountPerPage(10); $paginator->setPageRange(10); $currentPage = $this->_request->getParam('page', 1); $paginator->setCurrentPageNumber($currentPage); $this->view->books = $paginator; $system = new Admin_Model_Category(); $menu = $system->option_menu(); $this->view->bookss = $menu; $district = $system->option_dictrict(); $this->view->bokk = $district; if ($this->_request->isPost()) { $this->view->purifier = Zend_Registry::get('purifier'); $conf = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($conf); $menu_id = $purifier->purify($this->_request->getParam('parent_id')); $title = $purifier->purify($this->_request->getParam('title')); $dis = $purifier->purify($this->_request->getParam('dis')); $key = $purifier->purify($this->_request->getParam('key')); $description = $purifier->purify($this->_request->getParam('description')); $home = $purifier->purify($this->_request->getParam('home')); $upload = new Zend_File_Transfer(); // $images=$upload->addValidator('IsImage', false, array('application/gif')); $images = $upload->addValidator('Extension', false, 'jpg,png,gif'); // if($images==true){ thongbao('Không đúng định dạng hình ảnh'); return;} $images = $upload->getFilename(); $images = basename($images); $url = khongdau($title); $random_digit = rand(00, 99999); $img = $url . "-" . $random_digit . $images; $filterRename = new Zend_Filter_File_Rename(array('target' => 'Upload/' . $img, 'overwrite' => false)); $upload->addFilter($filterRename); $upload->receive(); $position = $purifier->purify($this->_request->getParam('position')); $active = $purifier->purify($this->_request->getParam('active')); $content = $purifier->purify($this->_request->getParam('content')); $price = $purifier->purify($this->_request->getParam('price')); $state = $purifier->purify($this->_request->getParam('state')); $sales = $purifier->purify($this->_request->getParam('sales')); $code = $purifier->purify($this->_request->getParam('code')); $members = $purifier->purify($this->_request->getParam('members')); $dictrict_id = $purifier->purify($this->_request->getParam('dictrict_id')); $type = $purifier->purify($this->_request->getParam('type')); $category_id = $purifier->purify($this->_request->getParam('category_id')); $add = new Admin_Model_Products(); $add->insert_products($title, $description, $img, $content, $menu_id, $price, $state, $sales, $dis, $key, $position, $active, $home, $code, $members, $dictrict_id, $type, $category_id); } $this->view->idmenu = $this->_request->getParam('idmenu'); }
function addpagesAction() { $muser = new Admin_Model_Page(); $paginator = Zend_Paginator::factory($muser->option_page()); $paginator->setItemCountPerPage(15); $paginator->setPageRange(10); $currentPage = $this->_request->getParam('page', 1); $paginator->setCurrentPageNumber($currentPage); $this->view->books = $paginator; if ($this->_request->isPost()) { $this->view->purifier = Zend_Registry::get('purifier'); $conf = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($conf); $menu = $purifier->purify($this->_request->getParam('cat_page_id')); $title = $purifier->purify($this->_request->getParam('title')); $dis = $purifier->purify($this->_request->getParam('dis')); $key = $purifier->purify($this->_request->getParam('key')); $description = $purifier->purify($this->_request->getParam('description')); $home = $purifier->purify($this->_request->getParam('home')); $upload = new Zend_File_Transfer_Adapter_Http(); $images = $upload->getFilename(); $images = basename($images); $url = khongdau($title); $random_digit = rand(00, 99999); $img = time() . $url . "-" . $images; $filterRename = new Zend_Filter_File_Rename(array('target' => 'Upload/' . $img, 'overwrite' => false)); $upload->addFilter($filterRename); $upload->receive(); $img_1_2 = APPLICATION_PATH . "/../Upload/{$img}"; $img_2 = time() . ".png"; $img_2_2 = APPLICATION_PATH . "/../Upload/{$img_2}"; rename($img_1_2, $img_2_2); $img = $img_2; $position = $purifier->purify($this->_request->getParam('position')); $active = $purifier->purify($this->_request->getParam('active')); $content = stripslashes($this->_request->getParam('content')); $address = $purifier->purify($this->_request->getParam('address')); $add = new Admin_Model_Page(); $add->insert_page($menu, $title, $dis, $key, $description, $img, $position, $active, $content, $home, $address); } }
require 'db.php'; $p = new pager(); $limit = 12; $start = $p->findStart($limit); $count = mysql_num_rows(mysql_query("SELECT*FROM du_an")); $pages = $p->findPages($count, $limit); $id = $_REQUEST["id"]; $result = mysql_query("SELECT * FROM du_an where id<>{$id} ORDER BY id DESC limit {$start},{$limit}"); // hiển thị DL if (mysql_num_rows($result) != 0) { echo " <table width='100%' border='0'>"; $stt = 0; while ($row = mysql_fetch_object($result)) { $id = $row->id; $tieude = $row->tieude; $url = khongdau($tieude); // $ngay=$row->ngay; /* $hinhanh="Hinh CTSP/".$row->hinhanh; $hinhanh="<img src='$hinhanh' height='140' width='160''alt='$tieude' border='0'>"; $link_hinh="Hinh CTSP/".$row->hinhanh; */ if ($stt % 1 == 0) { echo "<tr >"; } echo "<td align='left' style='padding-left:4px;padding-right:4px'>"; echo "<a class='doichu' href='San-pham-ban-chay-{$url}-{$id}.html'> »» {$tieude} </a> "; echo "</td>"; $stt = $stt + 1; if ($stt % 1 == 0) { echo "</tr>"; }
function postingAction() { $captcha = new Zend_Captcha_Image(); $vi = new Zend_View(); $base = $vi->baseurl(); $muser = new Admin_Model_Page(); $paginator = Zend_Paginator::factory($muser->option_page()); $paginator->setItemCountPerPage(10); $paginator->setPageRange(10); $currentPage = $this->_request->getParam('page', 1); $paginator->setCurrentPageNumber($currentPage); $this->view->books = $paginator; $system = new Admin_Model_Category(); $menu = $system->option_menu(); $this->view->bookss = $menu; $district = $system->option_dictrict(); $this->view->bokk = $district; if (!$this->_request->isPost()) { $captcha->setTimeout('300')->setWordLen('4')->setHeight('60')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../public_html/captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../public_html/font/AHGBold.ttf')->setFontSize(24); $captcha->generate(); $this->view->captcha = $captcha->render($this->view); $this->view->captchaID = $captcha->getId(); // Dua chuoi Captcha vao session $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId()); $captchaSession->word = $captcha->getWord(); } else { $captchaID = $this->_request->captcha_id; $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID); $captchaIterator = $captchaSession->getIterator(); $captchaWord = $captchaIterator['word']; if ($this->_request->captcha == $captchaWord) { $this->view->purifier = Zend_Registry::get('purifier'); $conf = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($conf); $content = $purifier->purify($this->_request->getParam('content')); $menu_id = $purifier->purify($this->_request->getParam('parent_id')); $title = $purifier->purify($this->_request->getParam('title')); $dis = $purifier->purify($this->_request->getParam('dis')); $key = $purifier->purify($this->_request->getParam('key')); $description = $purifier->purify($this->_request->getParam('description')); // $home = $purifier->purify($this->_request->getParam('home')); $upload = new Zend_File_Transfer(); $images = $upload->addValidator('Extension', false, 'jpg,png,gif'); //print_r($images, FALSE) ; $images = $upload->getFilename(); $images = basename($images); $url = khongdau($title); $random_digit = rand(00, 99999); if (basename($images)) { $img = $url . "-" . $random_digit . $images; $filterRename = new Zend_Filter_File_Rename(array('target' => 'Upload/' . $img, 'overwrite' => false)); $upload->addFilter($filterRename); if (!$upload->receive()) { thongbao("Vui lòng nhập đúng định dạng hình ảnh"); trang_truoc(); return; } $upload->receive(); } else { $img == "no-img.png"; } // $position = $purifier->purify($this->_request->getParam('position')); // $active = $purifier->purify($this->_request->getParam('active')); $price = $purifier->purify($this->_request->getParam('price')); $state = $purifier->purify($this->_request->getParam('state')); $sales = $purifier->purify($this->_request->getParam('sales')); $made_in = $purifier->purify($this->_request->getParam('made_in')); //$members = $purifier->purify($this->_request->getParam('members')); $session = new Zend_Session_Namespace('identity'); $members = $session->username; $dictrict_id = $purifier->purify($this->_request->getParam('dictrict_id')); // $type = $purifier->purify($this->_request->getParam('type')); $add = new Admin_Model_Products(); $add->insert_products($title, $description, $img, $content, $menu_id, $price, $state, $sales, $dis, $key, "", 1, 2, $made_in, $members, $dictrict_id, 1); thongbao("Chúc mừng {$members}, bạn đã đăng tin thành công"); chuyen_trang($base . "/thanh-vien.html"); } else { thongbao('Ban nhap sai chuoi Captcha'); trang_truoc(); } $this->_helper->viewRenderer->setNoRender(); $mask = APPLICATION_PATH . "/../public_html/captcha/images/*.png"; array_map("unlink", glob($mask)); } }
function addpartnersAction() { if ($this->_request->isPost()) { $this->view->purifier = Zend_Registry::get('purifier'); $conf = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($conf); $title = $purifier->purify($this->_request->getParam('title')); $description = $purifier->purify($this->_request->getParam('description')); $link = $purifier->purify($this->_request->getParam('link')); $position = $purifier->purify($this->_request->getParam('position')); $upload = new Zend_File_Transfer_Adapter_Http(); $images = $upload->getFilename(); $images = basename($images); $url = khongdau($title); $random_digit = rand(00, 99999); $img = $random_digit . $images; $filterRename = new Zend_Filter_File_Rename(array('target' => 'Upload/' . $img, 'overwrite' => false)); $upload->addFilter($filterRename); $upload->receive(); $add = new Admin_Model_Side(); $add->insert_side($img, $title, $description, $link, $position, 1); } }
function hot_product() { $vie = new Zend_View(); $base = $vie->baseurl(); echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$base}/template/css/sagscroller.css\" />\n<script src=\"{$base}/template/js/sagscroller.js\"></script><script src=\"{$base}/template/js/jquery-1.7.2.min.js\"></script>"; echo "<script>\n\n \n\n var sagscroller1=new sagscroller({\n id:'mysagscroller',\n mode: 'auto', //<--no comma following last option\n pause: 1000,\n animatespeed: 3000\n })\n\n \n\n </script>\n "; echo " <div class=\"title1\">\n <div style=\"padding-top:10px;\" align=\"center\">Liên kết</div>\n </div>"; echo "<div class=\"hotro\">\n \n <div id=\"mysagscroller\" class=\"sagscroller\">\n<ul>\n "; $cndb = $this->_db; $tv = "select * from page where menu=57 and active=1 order by id"; $stml = $cndb->prepare($tv); $stml->execute(); // echo 123; die; while ($tv_2 = $stml->fetch(PDO::FETCH_ASSOC)) { $id = $tv_2['id']; $title = $tv_2['title']; $images = $tv_2['images']; $url = khongdau($title); $mask = APPLICATION_PATH . "/../Upload/{$images}"; if (file_exists($mask)) { $images = $tv_2['images']; } else { $images = "no-img.png"; } $link = "{$base}/chi-tiet/{$url}-{$id}.html"; echo "<li><a href=\"{$link}\" title='{$title}'><img src=\"{$base}/Upload/{$images}\" title='{$title}' alt='{$title}' /><br />{$title}</a></li>"; } echo "</ul></div></div>"; echo " <script type=\"text/javascript\" src=\"{$base}/template/js_side/jquery-1.4.3.min.js\"></script>"; echo " <script type=\"text/javascript\" src=\"{$base}/template/js_side/jquery.nivo.slider.pack.js\"></script>"; echo "<script type=\"text/javascript\">\n \$(window).load(function() {\n \$('#slider').nivoSlider();\n });\n </script>"; }
function url_title($str, $separator = 'dash', $lowercase = FALSE) { if ($separator == 'dash') { $search = '_'; $replace = '-'; } else { $search = '-'; $replace = '_'; } $trans = array('&\\#\\d+?;' => '', '&\\S+?;' => '', '\\s+' => $replace, '[^a-z0-9\\-\\._]' => '', $replace . '+' => $replace, $replace . '$' => $replace, '^' . $replace => $replace, '\\.+$' => ''); $str = khongdau($str); $str = strip_tags($str); foreach ($trans as $key => $val) { $str = preg_replace("#" . $key . "#i", $val, $str); } if ($lowercase === TRUE) { $str = strtolower($str); } return trim(stripslashes($str)); }
public function member($member) { $view = new Zend_View(); $base = $view->baseurl(); $query = "SELECT * FROM products where members like '{$member}' order by date DESC, id DESC limit 0,5 "; $stml = $this->db->prepare($query); $stml->execute(); while ($result = $stml->fetch(PDO::FETCH_ASSOC)) { $id = $result['id']; $mystring = $result['date']; $findme = '-'; $pos = strpos($mystring, $findme); if ($pos === false) { $date = gmdate("d-m-Y", $result['date'] + 7 * 3600); } else { $date = $result['date']; } $title = $result['title']; $url = khongdau($title); echo " <a href=\"{$base}/chi-tiet/{$url}-{$id}.html\" title=\"{$title}\"> <h5> {$title} ({$date})</h5></a> "; } }