"); } } set_error_handler('nice_error'); // LOAD CONFIG define('_FS_PATH', dirname(__FILE__).'/'); require_once _FS_PATH.'config.php'; // FEEDBACK $info = array(); $error = array(); // SEO if (isset($_GET['pathsec'])) { $seo = explode('/', $_GET['pathsec']); foreach ($seo AS $a=>$b) $seo[$a] = htmlspecialchars($b); } else $seo = array(''); // DATABASE $_sql = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME) or nice_error('Sorry, but we cant connect to the database server right now.'); $_sql->query("SET NAMES ".DBCHAR); $_sql->query("SET CHARACTER SET ".DBCHAR); // LANGUAGE $_locale = (array)json_decode(file_get_contents(_FS_PATH.'includes/locale/hu_HU.lng')); // OTHER CLEVER STUFFS function clear_cache() { header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); } function redirect($url = '/', $status = false) { header('Location: '.$url.($status ? '?status='.$status : '')); exit; } function isnum($in) { return is_numeric($in); } function sqlprot($in) { global $_sql; return $_sql->real_escape_string($in); } function trimlink($in, $length = 140) { $in = html_entity_decode(strip_tags($in)); if (strlen($in) > $length) return substr($in, 0, $length-3).'...'; return $in; } // SETTINGS require_once _FS_PATH.'includes/settings.class.php'; $_set = settings::getdata(); // CLASSES require_once _FS_PATH.'includes/user.class.php'; require_once _FS_PATH.'includes/blog.class.php'; require_once _FS_PATH.'includes/page.class.php'; require_once _FS_PATH.'includes/check.class.php'; require_once _FS_PATH.'includes/comment.class.php'; // FUNCTIONS function get_page_link($slug, $p = false) { global $_set; $prefix = ($p ? $_set['url'] : ''); if ($_set['seo']) return $prefix."/$_set[subPage]/$slug"; return $prefix."/?pathsec=$_set[subPage]/$slug"; } function get_entry_link($slug, $p = false, $admin = false) { global $_set; $prefix = ($p ? $_set['url'] : '').($admin ? '/admin' : null); if ($_set['seo']) return $prefix."/$_set[subEntry]/$slug"; return $prefix."/?pathsec=$_set[subEntry]/$slug"; } function get_profile_link($slug = false, $p = false) { global $_set; $prefix = ($p ? $_set['url'] : ''); if (!$slug) { global $user; if (LOGGEDIN) $slug = $user['userName']; else $slug = ''; } if ($_set['seo']) return $prefix."/$_set[subProfile]/$slug"; return $prefix."/?pathsec=$_set[subProfile]/$slug"; } function get_profile_picture($userData = false, $p = false) { global $_set; $prefix = ($p ? $_set['url'] : ''); if (!$userData) if (LOGGEDIN) { global $user; $userData = $user;} else $userData = array('userPic'=>0); return $prefix.($userData['userPic'] ? "/data/profile_pics/$userData[userId].jpg" : '/data/imgs/'.$_set['defaultProfilePic']); } function get_current_link($p = false) { global $_set, $seo; $prefix = ($p ? $_set['url'] : ''); $link = ''; for ($i = 0; $i < sizeof($seo); $i++) $link .= '/'.$seo[$i]; return $prefix.($_set['seo'] ? $link : '/?pathsec='.$link); } function get_theme_lib() { global $_set; if (file_exists(_FS_PATH.'themes/'.$_set['mainTheme'])) return 'themes/'.$_set['mainTheme']; return false; } function get_theme() { global $_set; if (file_exists(_FS_PATH.'themes/'.$_set['mainTheme'].'/template.php')) return _FS_PATH.'themes/'.$_set['mainTheme'].'/template.php'; return false; } function get_site_link() { global $_set; return $_set['url']; } function get_site_body() { global $output; return output_replacer($output); } function get_navigation($append = '', $returnarray = false) { global $_locale, $_sql, $seo, $_title; $navLinks = array(); if ($seo[0] && isset($_title[0])) array_push($navLinks, array('link' => '/', 'title' => $_locale['home'])); $navQuery = $_sql->query("SELECT pageSlug, pageTitle FROM pages WHERE pageDeleted IS NULL ORDER BY pageTitle ASC"); while ($navData = $navQuery->fetch_assoc()) array_push($navLinks, array('link' => get_page_link($navData['pageSlug']), 'title' => $navData['pageTitle'])); if ($returnarray) return $navLinks; for ($i = 0; $i < sizeof($navLinks); $i++) { $link = explode('/', $navLinks[$i]['link']); for ($b = 1; $b < sizeof($link); $b++) { $active = true; if (isset($seo[$b-1]) && $seo[$b-1] == $link[$b] && $active) $active = true; else $active = false; } echo "