"); fclose($cache_file); } function getImages($data) { if (strpos($data, "|") == false) return array(0=> $data); else return explode("|", $data); } // get site language function get_lang($lang="") { global $INFO; if ($_COOKIE["NewLang"]=="" or $lang != "") { if ($lang == "") { $language = $INFO['site_lang']; } else { if (file_exists("lang/" . $lang . ".php")) { $language = $lang; setcookie("NewLang", "", time()+60*60*24*30); setcookie("NewLang", $lang, time()+60*60*24*30); } else { $language = $INFO['site_lang']; } } } else { $language=$_COOKIE["NewLang"]; } return $language; } function msg($msg, $goto_link="") { global $Smarty; if ($goto_link != "") { $linkgoto = ""; } $Smarty->assign("msg",$msg . $linkgoto); $Smarty->assign("page_n","msg.htm"); $Smarty->assign("page_c","msg.htm"); } function fullpage_msg($msg, $goto_link="") { global $Smarty; if ($goto_link != "") { $linkgoto = ""; } $Smarty->assign("msg",$msg . $linkgoto); if ($Smarty->template_exists("msg.htm")) { $Smarty->display("msg.htm"); } else { echo $lang[general_notemplate]; } } function cleanInput($str) { return preg_replace("/[^0-9a-z\-_,]+/i", "", $str); // Remove anything but 0-9,a-z,-_ } // show menus function show_menus($hideleft=0) { global $DB, $Smarty, $INFO, $language; if ($hideleft==0) $menuquery= " OR align=1"; $menu_query = $DB->query("SELECT * FROM ".$INFO['sql_tbl_prefix']."menus where active=1 AND (align=0". $menuquery .") ORDER BY menu_order"); while($menu_row = $DB->fetch_array($menu_query)) { //if ($menu_row[block_vars] != "") $menu_row[block_vars]=explode(',', $menu_row[block_vars]); // if is file $images_path= "templates/".$INFO['site_theme']; if ($menu_row[is_file]==1) { include("blocks/$menu_row[file_name]"); $menu_row['content']=$content; } $menu_row['content']=str_replace("%templates_path%", $images_path, $menu_row[content]); $menu[] = $menu_row; $Smarty->assign("menu",$menu); if ($menu_row[align] == 1) { $Smarty->assign("left_menu","1"); } } $DB->free_result($menu_query); } // get loading page time function loading_page_time() { $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; return $mtime; } function strip_js($text) { $text = preg_replace('//ims',"",$text); $text = preg_replace('/on(Load|Click|DblClick|DragStart|KeyDown|KeyPress|KeyUp|MouseDown|MouseMove|MouseOut'. '|MouseOver|SelectStart|Blur|Focus|Scroll|Select|Unload|Change)\s*=\s*(\'|").*?\\2/smi',"",$text); $text = preg_replace('/(\'|")javascript:.*?\\1/smi','',$text); return $text; } function ajax_str($str) { $str= preg_replace("/%u([0-9A-F]{3,4})/i","&#x\\1;",urldecode($str)); $cp1256 = array ("\x81", "\x8A", "\x8D", "\x8E", "\x8F", "\x90", "\x9A", "\x9F", "\xA1", "\xBF", "\xC0", "\xC1", "\xC2", "\xC3", "\xC4", "\xC5", "\xC6", "\xC7", "\xC8", "\xC9", "\xCA", "\xCB", "\xCC", "\xCD", "\xCE", "\xCF", "\xD0", "\xD1", "\xD2", "\xD3", "\xD4", "\xD5", "\xD6", "\xD7", "\xD8", "\xD9", "\xDA", "\xDB", "\xDC", "\xDD", "\xDE", "\xDF", "\xE1", "\xE3", "\xE4", "\xE5", "\xE6", "\xEC", "\xED", "\xF0", "\xF1", "\xF2", "\xF3", "\xF5", "\xF6", "\xF8", "\xFA", "\xFF"); $utf8 = array ("پ","ٹ","چ","ژ","ڈ","گ","ڑ", "ں","،","؟","ہ","ء","آ","أ", "ؤ","إ","ئ","ا","ب","ة","ت", "ث","ج","ح","خ","د","ذ","ر", "ز","س","ش","ص","ض","×","ط", "ظ","ع","غ","ـ","ف","ق","ك", "ل","م","ن","ه","و","ى","ي", "ً","ٌ","ٍ","َ","ُ","ِ","ّ", "ْ", "ے"); return str_replace($utf8,$cp1256,$str); } function safe_vars() { if (!get_magic_quotes_gpc()) { foreach ($_GET as $key => $value) { if (!is_array($_GET[$key])) { $_GET[$key] = addslashes($value); } } foreach ($_POST as $key => $value) { if (is_array($_POST[$key])) { foreach ($_POST[$key] as $k => $val) { if (!is_array($_POST[$key][$k])) { $_POST[$key][$k] = addslashes($val); } } } else { $_POST[$key] = addslashes($value); } } foreach ($_COOKIE as $key => $value) { if (!is_array($_COOKIE[$key])) { $_COOKIE[$key] = addslashes($value); } } } } function cp1256_to_utf8($text) { $cp1256 = array ("\x81", "\x8A", "\x8D", "\x8E", "\x8F", "\x90", "\x9A", "\x9F", "\xA1", "\xBF", "\xC0", "\xC1", "\xC2", "\xC3", "\xC4", "\xC5", "\xC6", "\xC7", "\xC8", "\xC9", "\xCA", "\xCB", "\xCC", "\xCD", "\xCE", "\xCF", "\xD0", "\xD1", "\xD2", "\xD3", "\xD4", "\xD5", "\xD6", "\xD7", "\xD8", "\xD9", "\xDA", "\xDB", "\xDC", "\xDD", "\xDE", "\xDF", "\xE1", "\xE3", "\xE4", "\xE5", "\xE6", "\xEC", "\xED", "\xF0", "\xF1", "\xF2", "\xF3", "\xF5", "\xF6", "\xF8", "\xFA", "\xFF"); $utf8 = array ("پ","ٹ","چ","ژ","ڈ","گ","ڑ", "ں","،","؟","ہ","ء","آ","أ", "ؤ","إ","ئ","ا","ب","ة","ت", "ث","ج","ح","خ","د","ذ","ر", "ز","س","ش","ص","ض","×","ط", "ظ","ع","غ","ـ","ف","ق","ك", "ل","م","ن","ه","و","ى","ي", "ً","ٌ","ٍ","َ","ُ","ِ","ّ", "ْ", "ے"); return str_replace($cp1256,$utf8,$text); } function is_wri_login() { global $INFO, $DB; if(empty($_SESSION['session_id']) or empty($_SESSION['user_id'])) { $_SESSION['user_id'] = $_COOKIE['ip_user']; $_SESSION['session_id']= $_COOKIE['ip_session']; } $result = $DB->query("SELECT id, pass FROM ".$INFO['sql_tbl_prefix']."writers WHERE id='". $_SESSION['user_id'] ."' and sessionid='". $_SESSION['session_id'] ."' and can_login='1' and type!='2'"); if ($DB->num_rows($result) == 1) { return true; } else { return false; } } function is_adm_login() { global $INFO, $DB; if(empty($_SESSION['session_id']) or empty($_SESSION['user_id'])) { $_SESSION['user_id'] = $_COOKIE['ip_user']; $_SESSION['session_id']= $_COOKIE['ip_session']; } $result = $DB->query("SELECT id, pass FROM ".$INFO['sql_tbl_prefix']."authors WHERE id='". $_SESSION['user_id'] ."' and sessionid='". $_SESSION['session_id'] ."'"); if ($DB->num_rows($result) == 1) { return true; } else { return false; } } function isMobileBrowser() { $op = strtolower($_SERVER['HTTP_X_OPERAMINI_PHONE']); $ua = strtolower($_SERVER['HTTP_USER_AGENT']); $ac = strtolower($_SERVER['HTTP_ACCEPT']); $isMobile = strpos($ac, 'application/vnd.wap.xhtml+xml') !== false || $op != '' || strpos($ua, 'sony') !== false || strpos($ua, 'symbian') !== false || strpos($ua, 'nokia') !== false || strpos($ua, 'samsung') !== false || strpos($ua, 'mobile') !== false || strpos($ua, 'windows ce') !== false || strpos($ua, 'epoc') !== false || strpos($ua, 'opera mini') !== false || strpos($ua, 'nitro') !== false || strpos($ua, 'j2me') !== false || strpos($ua, 'midp-') !== false || strpos($ua, 'cldc-') !== false || strpos($ua, 'netfront') !== false || strpos($ua, 'mot') !== false || strpos($ua, 'up.browser') !== false || strpos($ua, 'up.link') !== false || strpos($ua, 'audiovox') !== false || strpos($ua, 'blackberry') !== false || strpos($ua, 'ericsson,') !== false || strpos($ua, 'panasonic') !== false || strpos($ua, 'philips') !== false || strpos($ua, 'sanyo') !== false || strpos($ua, 'sharp') !== false || strpos($ua, 'sie-') !== false || strpos($ua, 'portalmmm') !== false || strpos($ua, 'blazer') !== false || strpos($ua, 'avantgo') !== false || strpos($ua, 'danger') !== false || strpos($ua, 'palm') !== false || strpos($ua, 'series60') !== false || strpos($ua, 'palmsource') !== false || strpos($ua, 'pocketpc') !== false || strpos($ua, 'smartphone') !== false || strpos($ua, 'rover') !== false || strpos($ua, 'ipaq') !== false || strpos($ua, 'au-mic,') !== false || strpos($ua, 'alcatel') !== false || strpos($ua, 'ericy') !== false || strpos($ua, 'up.link') !== false || strpos($ua, 'vodafone/') !== false || strpos($ua, 'wap1.') !== false || strpos($ua, 'wap2.') !== false; return $isMobile; } function iportal_info($returnfull=0) { $info['name']="InnoPortal"; $info['version']="1.6.0"; $info['edition']=""; $info['build']="300"; $info['full']= "Powered by: " . $info['name'] . " v" . $info['version']; if ($returnfull==1) { return $info['full']; } else { return $info; } } ?>