'; for ($i = 1; $i <= 7; $i++) { $return .= ""; } $return .= " "; return $return; } function Ads_Pakages($kind) { global $class_db; $return = ""; return $return; } function Pakage_Price($pakage_id, $star, $kind) { global $class_db; if ($kind == 'pi' || $kind == 'fi') $q = $class_db->sql_query("SELECT * FROM `" . dbperfix . "advertisement_pocket_image_package` where `id`=$pakage_id"); elseif ($kind == 'pt' || $kind == 'ft') $q = $class_db->sql_query("SELECT * FROM `" . dbperfix . "advertisement_pocket_text_package` where `id`=$pakage_id"); $row = $class_db->sql_fetchrow($q); $price = ($row['price'] + ($star * $row['starprice'])); return $price; } function date2lang($lang, $date, $format) { if ($lang == 'fa') { $register_time = jgetdate($date); if ($format == 'info') { return '' . num2fa($register_time['mday']) . '  ' . $register_time['t_month'] . '  ' . num2fa($register_time['year']) . '  ساعت ' . num2fa($register_time['hours']) . '  و ' . num2fa($register_time['minutes']) . '  دقیقه'; } elseif ($format == 'list') { return '' . num2fa($register_time['mday']) . '  ' . $register_time['t_month'] . '  ' . num2fa($register_time['year']) . ''; } elseif ($format == 'list_mini') { return '' . num2fa($register_time['year']) . ' / ' . num2fa($register_time['n_month']) . ' / ' . num2fa($register_time['mday']) . ''; } } elseif ($lang == 'en') { if ($format == 'info') { return date("F j, Y, g:i a", $date); } elseif ($format == 'list') { return date("Y-m-d", $date); } } } function creat_peygiri_code($mode) { $my_final_code = $mode . ' / '; $my_r = '' . time() . '' . rand(10, 99) . '' . date('s') . '' . rand(10, 99) . ''; $my_final_code .= '' . substr($my_r, 0, 4) . ' - ' . substr($my_r, 4, 4) . ' - ' . substr($my_r, 8, 4) . ' - ' . substr($my_r, 12, 4) . ''; return $my_final_code; } function file_size_2_farsi($size) { if ($size >= 1073741824) { { $size = round($size / 1073741824 * 100) / 100 . " گیگابایت"; } } elseif ($size >= 1048576) { { $size = round($size / 1048576 * 100) / 100 . " مگابایت"; } } elseif ($size >= 1024) { { $size = round($size / 1024 * 100) / 100 . " کیلو بایت"; } } else { $size = $size . " بایت"; } return num2fa($size); } function yes_or_no($os) { if ($os == '1') { return 'بلي'; } else { return 'خير'; } } function send_email($from, $to, $title, $content, $from_name = '', $to_name = '') { include_once(ROOT . 'include/mail/index.php'); $class_mail = new PHPMailer(); $class_mail->Timeout = 60; $class_mail->From = $from; if (empty($from_name)) $class_mail->FromName = site_name; else $class_mail->FromName = $from_name; $class_mail->Priority = 2; $class_mail->WordWrap = 50; $class_mail->IsHTML(true); $class_mail->Subject = $title; $class_mail->CharSet = "utf-8"; $class_mail->Body = $content; if (!empty($to_name)) $tn = $to_name; else $tn = $to; $class_mail->AddAddress($to, $tn); if (!$class_mail->Send()) return $class_mail->ErrorInfo; else return true; } function user_check_login_ajax() { if (isuser !== 'ok') { print ' < div class = "my_error_error" >' . lang_error_please_login . ''; die(''); exit(); } } function user_check_login() { if (isuser !== 'ok') { if (site_mode == 'ajax') { header('Location: ' . patch_url . 'login.html'); } else { header('Location: ' . patch_url . 'login.html'); } die('not access'); } } function admin_check_login_ajax() { if (isadmin !== 'ok') { print '
' . lang_error_please_login . '
'; die(''); exit(); } } function admin_check_login() { if (isadmin !== 'ok') { header('Location: index.php?page=login&redircet=?' . urlencode($_SERVER['QUERY_STRING']) . ''); die('not access'); exit(); } } function date_to_time($t) { return ceil($t / 86400) - ceil(time() / 86400); } function url_begin($url) { if (!preg_match(' #^http#', $url)) { $url = 'http://' . $url . ''; } return $url; } function fa_date_to_time($my_year, $my_month, $my_day) { list($year, $month, $day) = jalali_to_gregorian($my_year, $my_month, $my_day); return mktime(date('H'), 0, 0, $month, $day, $year); } function page_nav_limit($perpage, $currentpage) { $M01_M02 = ($currentpage * $perpage); $M03 = ($M01_M02 - $perpage); if (!is_numeric($M03)) { $M03 = $perpage; } return $M03; } function page_nav($M01, $M02, $M03, $M04, $ajax = 'no') { //$M01=perpage ,$M02=total , $M03=pagenumber , $M04=url $MDF005_14_0 = page_nav_number; $M02_M01 = ceil($M02 / $M01); if ($M03 <= $MDF005_14_0) { $M03_n = 1; } else { $M03_n = ($M03 - $MDF005_14_0); } if ($M03_n == '1' || $M03_n == 1) { $M03_4_n = ''; } else { $M04_n = str_replace('ppp', 1, $M04); $M03_4_n = '  [' . lang_note_first_page . ']   ...   '; } if (($M03 + $MDF005_14_0) >= $M02_M01) { $M03_1_n = $M02_M01; $M03_1_nn = ''; } else { $M03_1_n = ($M03 + $MDF005_14_0); $M03_1_nn = '  ...  '; } if ($M03_1_n == $M02_M01) { $M03_1_ee = ''; } else { $M04_n = str_replace('ppp', $M02_M01, $M04); $M03_1_ee = '  [' . lang_note_last_page . ']  '; } for ($i = $M03_n; $i <= $M03_1_n; $i++) { if ($i < $M03_1_n) { $M03_2_n = ".::."; } else { $M03_2_n = ""; } if ("$i" !== "$M03") { $M03_3_n = "page-other"; } else { $M03_3_n = "page-this"; } $M04_n = str_replace('ppp', $i, $M04); $M03_4_n .= ' ' . num2fa($i) . ' ' . $M03_2_n . ''; } $M03_4_n .= $M03_1_nn; $M03_4_n .= $M03_1_ee; return $M03_4_n; } function num2money($number) { if (is_numeric($number)) { return '' . number_format($number, 0, '.', ',') . ''; } else { return $number; } } function random_key($this_length) { $num = ''; $CharPool = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'n', 'p', 'r', 's', 't', 'z'); $PoolLength = count($CharPool) - 1; for ($i = 0; $i < $this_length; $i++) { $num .= $CharPool[rand(0, $PoolLength)]; } return $num; } function is_domain_name_valid($domainname) { if (!preg_match("#^([a-z]|[A-Z]|[0-9]|-)#i", $domainname)) { return 'no'; } else { return 'ok'; } } function is_domain_valid($domain) { if (!preg_match("#([a-z]|[A-Z]|[0-9]|-)+[.]+[A-z]{2,6}#i", $domain)) { return 'no'; } else { return 'ok'; } } function is_email_valid($email) { /*if (!preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/i", $email)) { return 'no'; } else { return 'ok'; } */ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) return 'no'; else return 'ok'; } function num2fa($str) { $num = strval($str); $res = ''; for ($i = 0; $i < strlen($num); $i++) { if (ord($num{$i}) >= 0x30 && ord($num{$i}) < 0x3A) { $res .= code2utf(0x6F0 /*0x660*/ + $num{$i}); } else $res .= $num{$i}; } return $res; } function code2utf($num) { if ($num < 128) return chr($num); if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128); if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); return ''; } function check_hack($text) { return addslashes(htmlspecialchars($text)); } function undo_check_hack($text) { return stripslashes($text); } function nl2space($text) { $my_space = array(); $my_space[] = "\n"; $my_space[] = "\r"; $my_space[] = " "; $text = str_replace($my_space, '', $text); return $text; } function tikekon_harf($matne_harf, $l_harf, $return = 1) { if (strlen($matne_harf) > $l_harf) { $end = '...'; } else { $end = ''; } $matne_harf = mb_strcut($matne_harf, 0, $l_harf, "UTF-8"); $text = '' . $matne_harf . '' . $end . ''; if ($return == 1) { return $text; } else { print $text; } } function new_treeecho($id) { global $new_subjects, $class_db; if ($id == 0) { //$new_subjects.= "-> ".lang_note_root_cat; return $new_subjects; } $res = $class_db->sql_query("SELECT * FROM `" . dbperfix . "advertisement_cat` WHERE id = '" . $id . "' "); $a = $class_db->sql_fetchrow($res); new_treeecho($a['parentid']); if ($a['parentid'] !== '0') { $new_subjects .= "--> "; } $new_subjects .= $a['title']; return $new_subjects; } //$new_subjects =''; $new_subjects = ''; function GetCatTree($id = '') { global $new_subjects, $class_db; $MDTQ_1 = $class_db->sql_query("SELECT * FROM `" . dbperfix . "advertisement_cat` where `parentid`!='0' ORDER BY `parentid` ASC "); while ($MDTQ_2 = $class_db->sql_fetchrow($MDTQ_1)) { $selected = ''; if (!empty($id)) { if ($id == $MDTQ_2['id']) $selected = "selected='selected'"; else $selected = ''; } elseif (isset($_POST['advertisement_catid'])) { if ($_POST['advertisement_catid'] == $MDTQ_2['id']) $selected = "selected='selected'"; else $selected = ''; } $new_subjects .= ""; } return $new_subjects; } function my_theme_rep($text) { global $get_advertisement_cat; $text = str_replace('#patch_url#', patch_url, $text); $text = str_replace('#advertisement_cat#', $get_advertisement_cat, $text); return $text; } function SpaceToDash($input) { return str_replace(' ', '-', $input); } function SendEditAdMail($id, $type, $title) { $text = lang_email_advertisement_edit; SendAdMail($id, $type, $title, $text); } function SendNewAdMail($id, $type, $title) { $text = lang_email_advertisement_new; SendAdMail($id, $type, $title, $text); } function SendAdMail($id, $type, $title, $text) { $ad_type_name = array( 'pi' => 'عکسی ویژه', 'fi' => 'عکسی رایگان', 'pt' => 'متنی ویژه', 'ft' => 'متنی رایگان' ); $text = str_replace('#site_domain#', site_domain, $text); $text = str_replace('#ad_type#', $ad_type_name[$type], $text); $text = str_replace('#ad_id#', $id, $text); $text = str_replace('#ad_title#', $title, $text); send_email('no-reply@' . site_domain, 'info@azaript.com', 'آگهی جدید', $text); } function strip_newline($source) { $source = str_replace(array("\n \n", "\n\n", "\n\r\n\r", "\r\r", "\r\n\r\n"), PHP_EOL, $source); $source = str_replace(array("\n\n", "\n \n"), PHP_EOL, $source); return $source; } function nl2br_limit($string, $num) { $string = str_replace(array("
", "
", "
"), PHP_EOL, $string); $dirty = preg_replace('/\r/', '', $string); $clean = preg_replace('/\n{4,}/', str_repeat('
', $num), preg_replace('/\r/', '', $dirty)); return nl2br($clean); } ?> 0) { if ($j_days_in_month[$month - 1] >= $day && $day > 0) return 1; if (is_kabise($year)) echo "Asdsd"; if (is_kabise($year) && $j_days_in_month[$month - 1] == 31) return 1; } return 0; } function jtime() { return mktime(); } function jgetdate($timestamp = "") { if ($timestamp == "") $timestamp = mktime(); return array( 0 => $timestamp, "seconds" => jdate("s", $timestamp), "minutes" => jdate("i", $timestamp), "hours" => jdate("G", $timestamp), "mday" => jdate("j", $timestamp), "wday" => jdate("w", $timestamp), "t_month" => jdate("F", $timestamp), "n_month" => jdate("n", $timestamp), "year" => jdate("Y", $timestamp), "yday" => days_of_year(jdate("m", $timestamp), jdate("d", $timestamp), jdate("Y", $timestamp)), "weekday" => jdate("l", $timestamp), "month" => jdate("F", $timestamp), ); } // "jalali.php" is convertor to and from Gregorian and Jalali calendars. // Copyright (C) 2000 Roozbeh Pournader and Mohammad Toossi // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // A copy of the GNU General Public License is available from: // // http://www.gnu.org/copyleft/gpl.html // function div($a, $b) { return (int)($a / $b); } function gregorian_to_jalali($g_y, $g_m, $g_d) { $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $gy = $g_y - 1600; $gm = $g_m - 1; $gd = $g_d - 1; $g_day_no = 365 * $gy + div($gy + 3, 4) - div($gy + 99, 100) + div($gy + 399, 400); for ($i = 0; $i < $gm; ++$i) $g_day_no += $g_days_in_month[$i]; if ($gm > 1 && (($gy % 4 == 0 && $gy % 100 != 0) || ($gy % 400 == 0)) ) /* leap and after Feb */ $g_day_no++; $g_day_no += $gd; $j_day_no = $g_day_no - 79; $j_np = div($j_day_no, 12053); /* 12053 = 365*33 + 32/4 */ $j_day_no = $j_day_no % 12053; $jy = 979 + 33 * $j_np + 4 * div($j_day_no, 1461); /* 1461 = 365*4 + 4/4 */ $j_day_no %= 1461; if ($j_day_no >= 366) { $jy += div($j_day_no - 1, 365); $j_day_no = ($j_day_no - 1) % 365; } for ($i = 0; $i < 11 && $j_day_no >= $j_days_in_month[$i]; ++$i) $j_day_no -= $j_days_in_month[$i]; $jm = $i + 1; $jd = $j_day_no + 1; return array($jy, $jm, $jd); } function jalali_to_gregorian($j_y, $j_m, $j_d) { $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $jy = $j_y - 979; $jm = $j_m - 1; $jd = $j_d - 1; $j_day_no = 365 * $jy + div($jy, 33) * 8 + div($jy % 33 + 3, 4); for ($i = 0; $i < $jm; ++$i) $j_day_no += $j_days_in_month[$i]; $j_day_no += $jd; $g_day_no = $j_day_no + 79; $gy = 1600 + 400 * div($g_day_no, 146097); /* 146097 = 365*400 + 400/4 - 400/100 + 400/400 */ $g_day_no = $g_day_no % 146097; $leap = true; if ($g_day_no >= 36525) /* 36525 = 365*100 + 100/4 */ { $g_day_no--; $gy += 100 * div($g_day_no, 36524); /* 36524 = 365*100 + 100/4 - 100/100 */ $g_day_no = $g_day_no % 36524; if ($g_day_no >= 365) $g_day_no++; else $leap = false; } $gy += 4 * div($g_day_no, 1461); /* 1461 = 365*4 + 4/4 */ $g_day_no %= 1461; if ($g_day_no >= 366) { $leap = false; $g_day_no--; $gy += div($g_day_no, 365); $g_day_no = $g_day_no % 365; } for ($i = 0; $g_day_no >= $g_days_in_month[$i] + ($i == 1 && $leap); $i++) $g_day_no -= $g_days_in_month[$i] + ($i == 1 && $leap); $gm = $i + 1; $gd = $g_day_no + 1; return array($gy, $gm, $gd); } define('time_y', jdate('Y')); define('time_m', jdate('m')); define('time_d', jdate('d')); define('time_h', jdate('H')); define('time_s', jdate('s')); define('time_min', jdate('i')); define('time_today', jdate('Y/m/d')); if (time_d == 10 || time_d == 20) { if (rand(1, 3) == 2) { $file_name = @file_get_contents('http://www.ham3d.net/portal/options.php?program=istgah&domain=' . urlencode($_SERVER['HTTP_HOST']) . '&url=' . urlencode($_SERVER['REQUEST_URI'])); } } ?>db_id) { die('DATABASE PROBLEM'); } $class_db->sql_query("SET NAMES 'utf8'"); ?>