1) { $offset = ($page*$max_each_page)-$max_each_page; } // language $_lang = strtolower($sysconf['default_lang']); // query content $_sql_content = "SELECT SQL_CALC_FOUND_ROWS * FROM content WHERE is_news=1"; if ($search_query) { $search_query = $obj_db->escape_string(trim($search_query)); $_sql_content .= " AND MATCH(`content_title`, `content_desc`) AGAINST('$search_query' IN BOOLEAN MODE)"; } $_sql_content .= " ORDER BY `last_update` DESC"; $_sql_content .= " LIMIT $max_each_page OFFSET $offset"; $_content_q = $obj_db->query($_sql_content); // echo $_sql_content; // get total rows $_total_rows = $obj_db->query('SELECT FOUND_ROWS()'); $_total_rows_d = $_total_rows->fetch_row(); $total = $_total_rows_d[0]; // get content data while ($_content_d = $_content_q->fetch_assoc()) { $contents[] = $_content_d; } return $contents; } public function get($obj_db, $str_path = '') { global $sysconf; $_path = strtolower(trim($str_path)); if (!$_path) { return; } if (preg_match('@^admin.+@i', $_path)) { $_unauthorized = !isset($_SESSION['uid']) AND !isset($_SESSION['uname']) AND !isset($_SESSION['realname']); if ($_unauthorized) { return; } } // language $_lang = strtolower($sysconf['default_lang']); $_path_lang = $_path.'_'.$_lang; // check for language $_sql_check = sprintf('SELECT COUNT(*) FROM content WHERE content_path=\'%s\'', $obj_db->escape_string($_path_lang)); $_check_q = $obj_db->query($_sql_check); $_check_d = $_check_q->fetch_row(); if ($_check_d[0] > 0) { $_path = $_path_lang; } // query content $_sql_content = sprintf('SELECT * FROM content WHERE content_path=\'%s\'', $obj_db->escape_string($_path)); $_content_q = $obj_db->query($_sql_content); // get content data $_content_d = $_content_q->fetch_assoc(); if (!$_content_d['content_title'] OR !$_content_d['content_path']) { return false; } else { $_content['Title'] = $_content_d['content_title']; $_content['Path'] = $_content_d['content_path']; $_content['Content'] = $_content_d['content_desc']; // strip html if ($this->strip_html) { $_content['Content'] = strip_tags($_content['Content'], $this->allowed_tags); } return $_content; } } }