Pair of Vintage Old School Fru
query("DELETE FROM `inbox` WHERE `inbox_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `outbox` WHERE `outbox_author`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `trash` WHERE `trash_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `contact` WHERE `contact_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `ignore` WHERE `ignore_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `bank` WHERE `bank_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `lotusers` WHERE `lot_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `rating` WHERE `rating_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `visit` WHERE `visit_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `wall` WHERE `wall_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `notebook` WHERE `note_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `person` WHERE `pers_user`=?;", array($uz)); DB :: $dbh -> query("DELETE FROM `users` WHERE `users_login`=?;", array($uz)); } // ------------------- E --------------------// function delete_album($uz) { $userpic = DB :: $dbh -> querySingle("SELECT `users_picture` FROM `users` WHERE `users_login`=?;", array($uz)); if (file_exists(BASEDIR . "gallery/avatаrs/$uz.gif")) { unlink (BASEDIR . "gallery/avatаrs/$uz.gif"); } if (!empty($userpic) && file_exists(BASEDIR . "gallery/photos/$userpic")) { unlink (BASEDIR . "gallery/photos/$userpic"); } // ---------------------// $querydel = DB :: $dbh -> query("SELECT `photo_id`, `photo_link` FROM `photo` WHERE `photo_user`=?;", array($uz)); $arr_photo = $querydel -> fetchAll(); if (count($arr_photo) > 0) { foreach ($arr_photo as $delete) { DB :: $dbh -> query("DELETE FROM `photo` WHERE `photo_id`=?;", array($delete['photo_id'])); DB :: $dbh -> query("DELETE FROM `commphoto` WHERE `commphoto_gid`=?;", array($delete['photo_id'])); if (file_exists(BASEDIR . 'gallery/pictures/' . $delete['photo_link'])) { unlink(BASEDIR . 'gallery/pictures/' . $delete['photo_link']); } } } } // --------------- f -------------------// function moneys($string) { $string = (int)$string; $str1 = abs($string) % 100; $str2 = $string % 10; if ($str1 > 10 && $str1 < 20) return 'Rp.'.$string.',-'; if ($str2 > 1 && $str2 < 5) return 'Rp.'.$string.',-'; if ($str2 == 1) return 'Rp.'.$string.',-'; return 'Rp.'.$string.',-'; } // --------------- point -------------------// function points($string) { $string = (int)$string; $str1 = abs($string) % 100; $str2 = $string % 10; if ($str1 > 10 && $str1 < 20) return $string . ' poin'; if ($str2 > 1 && $str2 < 5) return $string . ' poin'; if ($str2 == 1) return $string . ' poin'; return $string . ' poin'; } // ------------------ g -------------------------// function highlight_code($code) { $code = nosmiles($code); $code = strtr($code, array('<' => '<', '>' => '>', '&' => '&', '"' => '"', '$' => '$', '%' => '%', ''' => "'", '\' => '\\', '^' => '^', '`' => '`', '|' => '|', '
' => "\r\n")); $code = highlight_string($code, true); $code = strtr($code, array("\r\n" => '
', '$' => '$', "'" => ''', '%' => '%', '\\' => '\', '`' => '`', '^' => '^', '|' => '|')); $code = '
' . $code . '
'; return $code; } // ------------------------------// function hidden_text($msg) { if (is_user()) { $text = '
Text Tersembunyi: ' . $msg . '
'; } else { $text = '
Text Tersembunyi. Anda Kurang Beruntung!
'; } return $text; } // ---------------------------// function url_replace($m) { global $config; if (!isset($m[3])) { $target = (strpos($m[1], $config['home']) === false) ? ' target="_blank"' : ''; return '' . $m[2] . ''; } else { $target = (strpos($m[3], $config['home']) === false) ? ' target="_blank"' : ''; return '' . $m[3] . ''; } } // -----------------------// function bb_code($msg) { $msg = preg_replace('#\[code\](.*?)\[/code\]#ie', 'highlight_code("\1")', $msg); $msg = preg_replace('#\[hide\](.*?)\[/hide\]#ie', 'hidden_text("\1")', $msg); $msg = preg_replace('#\[big\](.*?)\[/big\]#si', '\1', $msg); $msg = preg_replace('#\[b\](.*?)\[/b\]#si', '\1', $msg); $msg = preg_replace('#\[i\](.*?)\[/i\]#si', '\1', $msg); $msg = preg_replace('#\[u\](.*?)\[/u\]#si', '\1', $msg); $msg = preg_replace('#\[small\](.*?)\[/small\]#si', '\1', $msg); $msg = preg_replace('#\[red\](.*?)\[/red\]#si', '\1', $msg); $msg = preg_replace('#\[green\](.*?)\[/green\]#si', '\1', $msg); $msg = preg_replace('#\[blue\](.*?)\[/blue\]#si', '\1', $msg); $msg = preg_replace('#\[q\](.*?)\[/q\]#si', '
\1
', $msg); $msg = preg_replace('#\[del\](.*?)\[/del\]#si', '\1', $msg); $msg = preg_replace_callback('~\\[url=(http://.+?)\\](.+?)\\[/url\\]|(http://(www.)?[0-9a-z\.\-]+\.[0-9a-z]{2,6}[0-9a-zA-Z/\?\.\-\~&;_=%:#\+]*)~', 'url_replace', $msg); return $msg; } // ----------------------// function utf_to_win($str) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'windows-1251', 'utf-8'); if (function_exists('iconv')) return iconv('utf-8', 'windows-1251', $str); $utf8win1251 = array("А" => "\xC0", "Б" => "\xC1", "В" => "\xC2", "Г" => "\xC3", "Д" => "\xC4", "Е" => "\xC5", "Ё" => "\xA8", "Ж" => "\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", "а" => "\xE0", "б" => "\xE1", "в" => "\xE2", "г" => "\xE3", "д" => "\xE4", "е" => "\xE5", "ё" => "\xB8", "ж" => "\xE6", "з" => "\xE7", "и" => "\xE8", "й" => "\xE9", "к" => "\xEA", "л" => "\xEB", "м" => "\xEC", "н" => "\xED", "о" => "\xEE", "п" => "\xEF", "р" => "\xF0", "с" => "\xF1", "т" => "\xF2", "у" => "\xF3", "ф" => "\xF4", "х" => "\xF5", "ц" => "\xF6", "ч" => "\xF7", "ш" => "\xF8", "щ" => "\xF9", "ъ" => "\xFA", "ы" => "\xFB", "ь" => "\xFC", "э" => "\xFD", "ю" => "\xFE", "я" => "\xFF"); return strtr($str, $utf8win1251); } // ----------------------// function win_to_utf($str) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'utf-8', 'windows-1251'); if (function_exists('iconv')) return iconv('windows-1251', 'utf-8', $str); $win1251utf8 = array("\xC0" => "А", "\xC1" => "Б", "\xC2" => "В", "\xC3" => "Г", "\xC4" => "Д", "\xC5" => "Е", "\xA8" => "Ё", "\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" => "Я", "\xE0" => "а", "\xE1" => "б", "\xE2" => "в", "\xE3" => "г", "\xE4" => "д", "\xE5" => "е", "\xB8" => "ё", "\xE6" => "ж", "\xE7" => "з", "\xE8" => "и", "\xE9" => "й", "\xEA" => "к", "\xEB" => "л", "\xEC" => "м", "\xED" => "н", "\xEE" => "о", "\xEF" => "п", "\xF0" => "р", "\xF1" => "с", "\xF2" => "т", "\xF3" => "у", "\xF4" => "ф", "\xF5" => "х", "\xF6" => "ц", "\xF7" => "ч", "\xF8" => "ш", "\xF9" => "щ", "\xFA" => "ъ", "\xFB" => "ы", "\xFC" => "ь", "\xFD" => "э", "\xFE" => "ю", "\xFF" => "я"); return strtr($str, $win1251utf8); } // --------------------// function rus_utf_tolower($str) { if (function_exists('mb_strtolower')) return mb_strtolower($str, 'utf-8'); $arraytolower = array('А' => 'а', 'Б' => 'б', 'В' => 'в', 'Г' => 'г', 'Д' => 'д', 'Е' => 'е', 'Ё' => 'ё', 'Ж' => 'ж', 'З' => 'з', 'И' => 'и', 'Й' => 'й', 'К' => 'к', 'Л' => 'л', 'М' => 'м', 'Н' => 'н', 'О' => 'о', 'П' => 'п', 'Р' => 'р', 'С' => 'с', 'Т' => 'т', 'У' => 'у', 'Ф' => 'ф', 'Х' => 'х', 'Ц' => 'ц', 'Ч' => 'ч', 'Ш' => 'ш', 'Щ' => 'щ', 'Ь' => 'ь', 'Ъ' => 'ъ', 'Ы' => 'ы', 'Э' => 'э', 'Ю' => 'ю', 'Я' => 'я', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'I' => 'i', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z'); return strtr($str, $arraytolower); } // --------------------------------// function check($msg) { if (is_array($msg)) { foreach($msg as $key => $val) { $msg[$key] = check($val); } } else { $msg = htmlspecialchars($msg); $search = array('|', '\'', '$', '\\', '^', '%', '`', "\0", "\x00", "\x1A", "в��в��в��в��в��в��"); $replace = array('|', ''', '$', '\', '^', '%', '`', '', '', '', ''); $msg = str_replace($search, $replace, $msg); $msg = stripslashes(trim($msg)); } return $msg; } // ----------------------------// function GetUserAgent() { if (isset($_SERVER['HTTP_USER_AGENT'])) { $agent = check($_SERVER['HTTP_USER_AGENT']); if (stripos($agent, 'Avant Browser') !== false) { return 'Avant Browser'; } elseif (stripos($agent, 'Acoo Browser') !== false) { return 'Acoo Browser'; } elseif (stripos($agent, 'MyIE2') !== false) { return 'MyIE2'; } elseif (preg_match('|Iron/([0-9a-z\.]*)|i', $agent, $pocket)) { return 'SRWare Iron ' . subtok($pocket[1], '.', 0, 2); } elseif (preg_match('|Chrome/([0-9a-z\.]*)|i', $agent, $pocket)) { return 'Chrome ' . subtok($pocket[1], '.', 0, 3); } elseif (preg_match('#(Maxthon|NetCaptor)( [0-9a-z\.]*)?#i', $agent, $pocket)) { return $pocket[1] . $pocket[2]; } elseif (stripos($agent, 'Safari') !== false && preg_match('|Version/([0-9]{1,2}.[0-9]{1,2})|i', $agent, $pocket)) { return 'Safari ' . subtok($pocket[1], '.', 0, 3); } elseif (preg_match('#(NetFront|K-Meleon|Netscape|Galeon|Epiphany|Konqueror|Safari|Opera Mini|Opera Mobile)/([0-9a-z\.]*)#i', $agent, $pocket)) { return $pocket[1] . ' ' . subtok($pocket[2], '.', 0, 2); } elseif (stripos($agent, 'Opera') !== false && preg_match('|Version/([0-9]{1,2}.[0-9]{1,2})|i', $agent, $pocket)) { return 'Opera ' . $pocket[1]; } elseif (preg_match('|Opera[/ ]([0-9a-z\.]*)|i', $agent, $pocket)) { return 'Opera ' . subtok($pocket[1], '.', 0, 2); } elseif (preg_match('|Orca/([ 0-9a-z\.]*)|i', $agent, $pocket)) { return 'Orca ' . subtok($pocket[1], '.', 0, 2); } elseif (preg_match('#(SeaMonkey|Firefox|GranParadiso|Minefield|Shiretoko)/([0-9a-z\.]*)#i', $agent, $pocket)) { return $pocket[1] . ' ' . subtok($pocket[2], '.', 0, 3); } elseif (preg_match('|rv:([0-9a-z\.]*)|i', $agent, $pocket) && strpos($agent, 'Mozilla/') !== false) { return 'Mozilla ' . subtok($pocket[1], '.', 0, 2); } elseif (preg_match('|Lynx/([0-9a-z\.]*)|i', $agent, $pocket)) { return 'Lynx ' . subtok($pocket[1], '.', 0, 2); } elseif (preg_match('|MSIE ([0-9a-z\.]*)|i', $agent, $pocket)) { return 'IE ' . subtok($pocket[1], '.', 0, 2); } else { $agent = preg_replace('|http://|i', '', $agent); $agent = strtok($agent, '( '); $agent = substr($agent, 0, 22); $agent = subtok($agent, '.', 0, 2); if (!empty($agent)) { return $agent; } } } return 'Unknown'; } // ----------------------- Функция обрезки строки с условием -------------------------// function subtok($string, $chr, $pos, $len = null) { return implode($chr, array_slice(explode($chr, $string), $pos, $len)); } // -------------------------------// function no_br($msg) { $msg = nl2br($msg); $msg = preg_replace('|[\r\n]+|si', '', $msg); return $msg; } // -------------------------------// function yes_br($msg) { $msg = preg_replace('|
|i', "\r\n", $msg); return $msg; } // ---------------------------------// function smiles($str) { global $config; $querysmiles = DB :: $dbh -> query("SELECT `smiles_name`, `smiles_code` FROM `smiles` WHERE `smiles_cats`=? ORDER BY LENGTH(`smiles_code`) DESC;", array(1)); $arrsmiles = $querysmiles -> fetchAll(); $count = 0; foreach($arrsmiles as $val) { $str = preg_replace('|' . preg_quote($val['smiles_code']) . '|', 'smile ', $str, $config['resmiles'] - $count, $cnt); $count += $cnt; if ($count >= $config['resmiles']) { break; } } if (is_admin(array(101, 102, 103, 105))) { $querysmiles = DB :: $dbh -> query("SELECT `smiles_name`, `smiles_code` FROM `smiles` WHERE `smiles_cats`=? ORDER BY LENGTH(`smiles_code`) DESC;", array(2)); $arrsmiles = $querysmiles -> fetchAll(); foreach($arrsmiles as $val) { $str = str_replace($val['smiles_code'], 'adminsmile ', $str); } } return $str; } // --------------------------// function nosmiles($string) { $string = preg_replace('|smile |', ':$1', $string); $string = preg_replace('|smile |', ':$1', $string); return $string; } // ------------------------// function formatsize($file_size) { if ($file_size >= 1048576000) { $file_size = round(($file_size / 1073741824), 2) . " Gb"; } elseif ($file_size >= 1024000) { $file_size = round(($file_size / 1048576), 2) . " Mb"; } elseif ($file_size >= 1000) { $file_size = round(($file_size / 1024), 2) . " Kb"; } else { $file_size = round($file_size) . " byte"; } return $file_size; } // ------------------------// function read_file($file) { if (file_exists($file)) { return formatsize(filesize($file)); } else { return 0; } } // ------------------------------// function read_dir($dir) { if (empty($allsize)) { $allsize = 0; } if ($path = opendir($dir)) { while ($file_name = readdir($path)) { if (($file_name !== '.') && ($file_name !== '..')) { if (is_dir($dir . "/" . $file_name)) { $allsize += read_dir($dir . "/" . $file_name); } else { $allsize += filesize($dir . "/" . $file_name); } } } closedir ($path); } return $allsize; } // --------------------------// function formattime($file_time) { if ($file_time >= 86400) { $file_time = 'Hari: ' . round((($file_time / 60) / 60) / 24, 1); } elseif ($file_time >= 3600) { $file_time = 'Jam: ' . round(($file_time / 60) / 60, 1); } elseif ($file_time >= 60) { $file_time = 'Menit: ' . round($file_time / 60); } else { $file_time = 'Detik: ' . round($file_time); } return $file_time; } // ----------------------------// function antimat($str) { $querymat = DB :: $dbh -> query("SELECT `mat_string` FROM `antimat` ORDER BY LENGTH(`mat_string`) DESC;"); $arrmat = $querymat -> fetchAll(); if (count($arrmat) > 0) { foreach($arrmat as $val) { $str = preg_replace('|' . preg_quote($val['mat_string']) . '|iu', '*SensoR*', $str); } } return $str; } // -------------------------// function user_status($level) { switch ($level) { case '101': $status = 'Senior-Admin'; break; case '102': $status = 'Admin'; break; case '103': $status = 'Senior-Moderator'; break; case '105': $status = 'Moderator'; break; default: $status = 'Junior'; } return $status; } // --------------// function user_title($login) { static $arrstat; if (empty($arrstat)) { if (@filemtime(DATADIR . "temp/status.dat") < time()-3600) { $querylevel = DB :: $dbh -> query("SELECT `users`.`users_login`, `users`.`users_status`, `status`.`status_name`, `status`.`status_color` FROM `users`, `status` WHERE `users`.`users_point` BETWEEN `status`.`status_topoint` AND `status`.`status_point`;"); $allstat = array(); while ($row = $querylevel -> fetch()) { if (!empty($row['users_status'])) { $allstat[$row['users_login']] = '' . $row['users_status'] . ''; continue; } if (!empty($row['status_color'])) { $allstat[$row['users_login']] = '' . $row['status_name'] . ''; continue; } $allstat[$row['users_login']] = $row['status_name']; } file_put_contents(DATADIR . "temp/status.dat", serialize($allstat), LOCK_EX); } $arrstat = unserialize(file_get_contents(DATADIR . "temp/status.dat")); } if (isset($arrstat[$login])) { $status = $arrstat[$login]; } else { $status = 'Junior'; } return $status; } // -----------------------------// function raiting_vote($str) { if (empty($str)) { $str = '0'; } if ($str > '0' && $str <= '0.5') { $str = '0.5'; } if ($str > '0.5' && $str <= '1') { $str = '1'; } if ($str > '1' && $str <= '1.5') { $str = '1.5'; } if ($str > '1.5' && $str <= '2') { $str = '2'; } if ($str > '2' && $str <= '2.5') { $str = '2.5'; } if ($str > '2.5' && $str <= '3') { $str = '3'; } if ($str > '3' && $str <= '3.5') { $str = '3.5'; } if ($str > '3.5' && $str <= '4') { $str = '4'; } if ($str > '4' && $str <= '4.5') { $str = '4.5'; } if ($str > '4.5' && $str <= '5') { $str = '5'; } return $str; } // ----------------------// function nickname($login) { static $arrnick; if (empty($arrnick)) { $queryuser = DB :: $dbh -> query("SELECT * FROM `users` WHERE `users_login`=? LIMIT 1;", array($login)); $rownameasli = $queryuser -> fetch(); if (!empty($queryuser)) { if (!empty($rownameasli['users_name'])) { $login = $rownameasli['users_name']; } else { $login = $rownameasli['users_login']; } } } return $login; } // ---------------------------// function save_setting() { $queryset = DB :: $dbh -> query("SELECT `setting_name`, `setting_value` FROM `setting`;"); $config = $queryset -> fetchAssoc(); file_put_contents(DATADIR . "temp/setting.dat", serialize($config), LOCK_EX); } // ----------------------------// function save_navigation() { $querynav = DB :: $dbh -> query("SELECT `nav_url`, `nav_title` FROM `navigation` ORDER BY `nav_order` ASC;"); $arrnav = $querynav -> fetchAll(); file_put_contents(DATADIR . "temp/navigation.dat", serialize($arrnav), LOCK_EX); } // ---------------------------// function save_avatar() { $queryavat = DB :: $dbh -> query("SELECT `users_login`, `users_avatar` FROM `users`;"); $allavat = $queryavat -> fetchAssoc(); file_put_contents(DATADIR . "temp/avatar.dat", serialize($allavat), LOCK_EX); } // -----------------------// function save_nickname() { $querynick = DB :: $dbh -> query("SELECT `users_login`, `users_nickname` FROM `users` WHERE `users_nickname`<>?;", array('')); $allnick = $querynick -> fetchAssoc(); file_put_contents(DATADIR . "temp/nickname.dat", serialize($allnick), LOCK_EX); } // -------------------// function save_ipban() { $querybanip = DB :: $dbh -> query("SELECT `ban_ip` FROM `ban`;"); $arrbanip = $querybanip -> fetchAll(); file_put_contents(DATADIR . "temp/ipban.dat", serialize($arrbanip), LOCK_EX); } // ---------------------------------------// function is_quarantine($log) { global $config; if (!empty($config['karantin'])) { $queryuser = DB :: $dbh -> querySingle("SELECT `users_joined` FROM users WHERE `users_login`=? LIMIT 1;", array($log)); if ($queryuser + $config['karantin'] > SITETIME) { return false; } } return true; } // ----------------------------------------// function flood_period() { global $config, $udata; $period = $config['floodstime']; if ($udata['users_point'] >= 500) { $period = round($config['floodstime'] / 2); } if ($udata['users_point'] >= 1000) { $period = round($config['floodstime'] / 3); } if ($udata['users_point'] >= 5000) { $period = round($config['floodstime'] / 6); } if (is_admin()) { $period = 0; } return $period; } // ----------------------------------------// function is_flood($log, $period = "") { global $php_self; if (empty($period)) { $period = flood_period(); } if (empty($period)) { return true; } DB :: $dbh -> query("DELETE FROM `flood` WHERE `flood_time` querySingle("SELECT `flood_id` FROM `flood` WHERE `flood_user`=? AND `flood_page`=? LIMIT 1;", array($log, $php_self)); if (empty($queryflood)) { DB :: $dbh -> query("INSERT INTO `flood` (`flood_user`, `flood_page`, `flood_time`) VALUES (?, ?, ?);", array($log, $php_self, SITETIME + $period)); return true; } else { return false; } } // -------------------------// function safe_encode($string) { $data = base64_encode($string); $data = str_replace(array('+', '/', '='), array('_', '-', ''), $data); return $data; } function safe_decode($string) { $string = str_replace(array('_', '-'), array('+', '/'), $string); $data = base64_decode($string); return $data; } // -------------------------// function xoft_encode($string, $key) { $result = ""; for($i = 1; $i <= strlen($string); $i++) { $char = substr($string, $i-1, 1); $keychar = substr($key, ($i % strlen($key)) - 1, 1); $char = chr(ord($char) + ord($keychar)); $result .= $char; } return safe_encode($result); } // -------------------------// function xoft_decode($string, $key) { $string = safe_decode($string); $result = ""; for($i = 1; $i <= strlen($string); $i++) { $char = substr($string, $i - 1, 1); $keychar = substr($key, ($i % strlen($key)) - 1, 1); $char = chr(ord($char) - ord($keychar)); $result .= $char; } return $result; } // ---------------------------// function generate_password($length = "") { if (empty($length)) { $length = mt_rand(10, 12); } $salt = str_split('aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789'); $makepass = ""; for ($i = 0; $i < $length; $i++) { $makepass .= $salt[array_rand($salt)]; } return $makepass; } // ---------------------------// function text_dump($var, $level = 0) { if (is_array($var)) $type = "array[" . count($var) . "]"; else if (is_object($var)) $type = "object"; else $type = ""; if ($type) { echo $type . '
'; for(Reset($var), $level++; list($k, $v) = each($var);) { if (is_array($v) && $k === "GLOBALS") continue; for($i = 0; $i < $level * 3; $i++) echo ' '; echo '' . htmlspecialchars($k) . ' => ', text_dump($v, $level); } } else echo '"', htmlspecialchars($var), '"
'; } function dump($var) { if ((is_array($var) || is_object($var)) && count($var)) { echo '
', text_dump($var), '
'; } else { echo '', text_dump($var), ''; } } // -------------------// function scan_check($dirname) { global $arr, $config; if (empty($arr['files'])) { $arr['files'] = array(); } if (empty($arr['totalfiles'])) { $arr['totalfiles'] = 0; } if (empty($arr['totaldirs'])) { $arr['totaldirs'] = 0; } $no_check = explode(',', $config['nocheck']); $dirs = array_diff(scandir($dirname), array(".", "..")); foreach ($dirs as $file) { if (is_file($dirname . '/' . $file)) { $ext = strtolower(substr($file, strrpos($file, '.') + 1)); if (!in_array($ext, $no_check)) { $arr['files'][] = $dirname . '/' . $file . ' - ' . date_fixed(filemtime($dirname . '/' . $file), 'j.m.Y / H:i') . ' - ' . read_file($dirname . '/' . $file); $arr['totalfiles']++; } } if (is_dir($dirname . '/' . $file)) { $arr['files'][] = $dirname . '/' . $file; $arr['totaldirs']++; scan_check($dirname . '/' . $file); } } return $arr; } // ------------------------// function makeCal ($month, $year) { $wday = date("w", mktime(0, 0, 0, $month, 1, $year)); if ($wday == 0) { $wday = 7; } $n = - ($wday-2); $cal = array(); for ($y = 0; $y < 6; $y++) { $row = array(); $notEmpty = false; for ($x = 0; $x < 7; $x++, $n++) { if (checkdate($month, $n, $year)) { $row[] = $n; $notEmpty = true; } else { $row[] = ""; } } if (!$notEmpty) break; $cal[] = $row; } return $cal; } // ---------------------// function user_advert($login) { return DB :: $dbh -> querySingle("SELECT count(*) FROM `reklama` WHERE `rek_user`=?;", array($login)); } // --------------------// function user_money($login) { static $arrmoney; if (empty($arrmoney)) { if (@filemtime(DATADIR . "temp/money.dat") < time()-7200) { $queryuser = DB :: $dbh -> query("SELECT `users_login`, `users_money` FROM `users`;"); $alluser = $queryuser -> fetchAssoc(); file_put_contents(DATADIR . "temp/money.dat", serialize($alluser), LOCK_EX); } $arrmoney = unserialize(file_get_contents(DATADIR . "temp/money.dat")); } if (isset($arrmoney[$login])) { $money = $arrmoney[$login]; } else { $money = 0; } return $money; } // -------------------// function user_bankmoney($login) { static $arrbank; if (empty($arrbank)) { if (@filemtime(DATADIR . "temp/moneybank.dat") < time()-7200) { $querybank = DB :: $dbh -> query("SELECT `bank_user`, `bank_sum` FROM `bank`;"); $allbank = $querybank -> fetchAssoc(); file_put_contents(DATADIR . "temp/moneybank.dat", serialize($allbank), LOCK_EX); } $arrbank = unserialize(file_get_contents(DATADIR . "temp/moneybank.dat")); } if (isset($arrbank[$login])) { $money = $arrbank[$login]; } else { $money = 0; } return $money; } // --------------------// function user_mail($login) { $all_privat = DB :: $dbh -> querySingle("SELECT count(*) FROM `inbox` WHERE `inbox_user`=?;", array($login)); $new_privat = DB :: $dbh -> querySingle("SELECT `users_newprivat` FROM `users` WHERE `users_login`=? LIMIT 1;", array($login)); return $new_privat . '/' . $all_privat; } // ----------------------------// function user_avatars($login) { global $config; static $arravat; if ($login == $config['guestsuser']) { return ' '; } if (empty($arravat)) { if (@filemtime(DATADIR . "temp/avatar.dat") < time()-3600) { save_avatar(); } $arravat = unserialize(file_get_contents(DATADIR . "temp/avatar.dat")); } if (isset($arravat[$login]) && file_exists(BASEDIR . $arravat[$login])) { return ' '; } return ' '; } // -------------------// function cards_score($str) { if ($str > 32) return 11; if ($str > 20) return (int)(($str-1) / 4)-3; return (int)(($str-1) / 4) + 6; } // ------------------// function cards_points($str) { $str = (int)$str; $str1 = abs($str) % 100; $str2 = $str % 10; if ($str1 == 21) return $str . ' kosong!!!'; if ($str1 > 10 && $str1 < 20) return $str . ' card poin'; if ($str2 > 1 && $str2 < 5) return $str . ' card poin'; if ($str2 == 1) return $str . ' card poin'; return $str . ' card poin'; } // -------------------// function user_kontakt($login) { return DB :: $dbh -> querySingle("SELECT count(*) FROM `contact` WHERE `contact_user`=?;", array($login)); } // -------------------// function user_ignore($login) { return DB :: $dbh -> querySingle("SELECT count(*) FROM `ignore` WHERE `ignore_user`=?;", array($login)); } // -------------------// function user_wall($login) { return DB :: $dbh -> querySingle("SELECT count(*) FROM `wall` WHERE `wall_user`=?;", array($login)); } // -----------------------// function stats_online() { if (@filemtime(DATADIR . "temp/online.dat") < time()-10) { $queryonline = DB :: $dbh -> query("SELECT count(*) FROM `online` WHERE `online_user`<>? UNION ALL SELECT count(*) FROM `online`;", array('')); $online = $queryonline -> fetchAll(PDO :: FETCH_COLUMN); file_put_contents(DATADIR . "temp/online.dat", serialize($online), LOCK_EX); } return unserialize(file_get_contents(DATADIR . "temp/online.dat")); } // ---------------------------// function stats_counter() { if (@filemtime(DATADIR . "temp/counter.dat") < time()-10) { $querycount = DB :: $dbh -> query("SELECT * FROM `counter`;"); $counts = $querycount -> fetch(); file_put_contents(DATADIR . "temp/counter.dat", serialize($counts), LOCK_EX); } return unserialize(file_get_contents(DATADIR . "temp/counter.dat")); } // -------------------------// function stats_users() { if (@filemtime(DATADIR . "temp/statusers.dat") < time()-3600) { $total = DB :: $dbh -> querySingle("SELECT count(*) FROM `users`;"); $new = DB :: $dbh -> querySingle("SELECT count(*) FROM `users` WHERE `users_joined`>UNIX_TIMESTAMP(CURDATE());"); if (empty($new)) { $stat = $total; } else { $stat = $total . '/+' . $new; } file_put_contents(DATADIR . "temp/statusers.dat", $stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statusers.dat"); } // ---------------------------// function stats_admins() { if (@filemtime(DATADIR . "temp/statadmins.dat") < time()-3600) { $stat = DB :: $dbh -> querySingle("SELECT count(*) FROM `users` WHERE `users_level`>=? AND `users_level`<=?;", array(101, 105)); file_put_contents(DATADIR . "temp/statadmins.dat", $stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statadmins.dat"); } // ------------------------// function stats_spam() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `spam`;"); } // -------------------------------// function stats_banned() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `users` WHERE `users_ban`=? AND `users_timeban`>?;", array(1, SITETIME)); } // ----------------------// function stats_reglist() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `users` WHERE `users_confirmreg`>?;", array(0)); } // --------------------// function stats_ipbanned() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `ban`;"); } // -------------------------------// function stats_gallery() { if (@filemtime(DATADIR . "temp/statgallery.dat") < time()-900) { $total = DB :: $dbh -> querySingle("SELECT count(*) FROM `photo`;"); $totalnew = DB :: $dbh -> querySingle("SELECT count(*) FROM `photo` WHERE `photo_time`>?;", array(SITETIME-86400 * 3)); if (empty($totalnew)) { $stat = $total; } else { $stat = $total . '/+' . $totalnew; } file_put_contents(DATADIR . "temp/statgallery.dat", $stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statgallery.dat"); } // ---------------------------// function stats_allnews() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `news`;"); } // -----------------// function stats_blacklogin() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `blacklogin`;"); } // -------------// function stats_blackmail() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `blackmail`;"); } // --------------------------// function stats_headlines() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `headers`;"); } // --------------------------// function stats_navigation() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `navigation`;"); } // --------------------------// function stats_antimat() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `antimat`;"); } // -----------------------// function stats_smiles() { $usersmiles = DB :: $dbh -> querySingle("SELECT count(*) FROM `smiles` WHERE `smiles_cats`=?;", array(1)); $admsmiles = DB :: $dbh -> querySingle("SELECT count(*) FROM `smiles` WHERE `smiles_cats`=?;", array(2)); return $usersmiles . '/' . $admsmiles; } // ------------------------// function stats_avatars() { $freeavatars = DB :: $dbh -> querySingle("SELECT count(*) FROM `avatars` WHERE `avatars_cats`=?;", array(1)); $payavatars = DB :: $dbh -> querySingle("SELECT count(*) FROM `avatars` WHERE `avatars_cats`=?;", array(2)); return $freeavatars . '/' . $payavatars; } // ------------------------// function stats_checker() { if (file_exists(DATADIR . "temp/checker.dat")) { return date_fixed(filemtime(DATADIR . "temp/checker.dat"), "j.m.y"); } else { return 0; } } // -----------------------// function stats_advert() { return DB :: $dbh -> querySingle("SELECT count(*) FROM `reklama`;"); } // --------------------------// function user_position($url) { $position = 'Sembunyi'; $queryhead = DB :: $dbh -> querySingle("SELECT `head_title` FROM `headers` WHERE `head_url`=? LIMIT 1;", array($url)); if (!empty($queryhead)) { $position = '' . $queryhead . ''; } return $position; } // ---------------------------// function show_advertadmin() { if (@filemtime(DATADIR . "temp/rekadmin.dat") < time()-1800) { save_advertadmin(); } $datafile = unserialize(file_get_contents(DATADIR . "temp/rekadmin.dat")); if (!empty($datafile)) { $quot_rand = array_rand($datafile); return $datafile[$quot_rand]; } } // --------------------------// function save_advertadmin() { $queryadv = DB :: $dbh -> query("SELECT `adv_url`, `adv_title` FROM `advert`;"); $data = $queryadv -> fetchAll(); $arraylink = array(); if (count($data) > 0) { foreach ($data as $val) { $arraylink[] = '' . $val['adv_title'] . '
'; } } file_put_contents(DATADIR . "temp/rekadmin.dat", serialize($arraylink), LOCK_EX); } // ----------------------// function chmode ($path = ".") { if ($handle = opendir ($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $file_path = $path . "/" . $file; if (is_dir ($file_path)) { $old = umask(0); chmod ($file_path, 0777); umask($old); chmode ($file_path); } else { chmod ($file_path, 0666); } } } closedir($handle); } } function mc($str) { global $config; if (empty($config['rotorlicense'])) { return preg_replace('#
#i', '
'.str_rot13('Cbjrerq ol ').''.str_rot13('EbgbePZF').'·Lulubook
', $str, 1); } else { return $str; } } // ----------------------// function user_online($login) { static $arrvisit; $statwho = '[Off]'; if (empty($arrvisit)) { if (@filemtime(DATADIR . "temp/visit.dat") < time()-10) { $queryvisit = DB :: $dbh -> query("SELECT `visit_user` FROM `visit` WHERE `visit_nowtime`>?;", array(SITETIME-600)); $allvisits = $queryvisit -> fetchAll(PDO :: FETCH_COLUMN); file_put_contents(DATADIR . "temp/visit.dat", serialize($allvisits), LOCK_EX); } $arrvisit = unserialize(file_get_contents(DATADIR . "temp/visit.dat")); } if (in_array($login, $arrvisit)) { $statwho = '[On]'; } return $statwho; } // ---------------------// function allonline() { if (@filemtime(DATADIR . "temp/allonline.dat") < time()-180) { $queryvisit = DB :: $dbh -> query("SELECT `visit_user` FROM `visit` WHERE `visit_nowtime`>? ORDER BY `visit_nowtime` DESC;", array(SITETIME-600)); $allvisits = $queryvisit -> fetchAll(PDO :: FETCH_COLUMN); file_put_contents(DATADIR . "temp/allonline.dat", serialize($allvisits), LOCK_EX); } return unserialize(file_get_contents(DATADIR . "temp/allonline.dat")); } // --------------------------// function user_visit($login) { $visit = '(Offline)'; $queryvisit = DB :: $dbh -> querySingle("SELECT `visit_nowtime` FROM `visit` WHERE `visit_user`=? LIMIT 1;", array($login)); if (!empty($queryvisit)) { if ($queryvisit > SITETIME-600) { $visit = '(Online)'; } else { $visit = '(Kunjungan Terakhir: ' . date_fixed($queryvisit) . ')'; } } return $visit; } // ------------------------// function compress_output_gzip($output) { return gzencode($output, 5); } function compress_output_deflate($output) { return gzdeflate($output, 5); } // ---------------// function check_string($string) { $string = strtolower($string); $string = str_replace(array('http://www.', 'http://wap.', 'http://', 'https://'), '', $string); $string = strtok($string, '/?'); return $string; } // -----------------// function utf_substr($str, $offset, $length = null) { if (function_exists('mb_substr')) return mb_substr($str, $offset, $length, 'utf-8'); if (function_exists('iconv_substr')) return iconv_substr($str, $offset, $length, 'utf-8'); $str = utf_to_win($str); $str = substr($str, $offset, $length); return win_to_utf($str); } // -----------------------// function utf_strlen($str) { if (function_exists('mb_strlen')) return mb_strlen($str, 'utf-8'); if (function_exists('iconv_strlen')) return iconv_strlen($str, 'utf-8'); if (function_exists('utf8_decode')) return strlen(utf8_decode($str)); return strlen(utf_to_win($str)); } // ------------------// function utf_wordwrap($str, $width = 75, $break = ' ', $cut = 1) { $str = utf_to_win($str); $str = wordwrap($str, $width, $break, $cut); return win_to_utf($str); } // --------------------------------// function is_utf($str) { $c = 0; $b = 0; $bits = 0; $len = strlen($str); for($i = 0; $i < $len; $i++) { $c = ord($str[$i]); if ($c > 128) { if (($c >= 254)) return false; elseif ($c >= 252) $bits = 6; elseif ($c >= 248) $bits = 5; elseif ($c >= 240) $bits = 4; elseif ($c >= 224) $bits = 3; elseif ($c >= 192) $bits = 2; else return false; if (($i + $bits) > $len) return false; while ($bits > 1) { $i++; $b = ord($str[$i]); if ($b < 128 || $b > 191) return false; $bits--; } } } return true; } // --------------------------// function addmail($usermail, $subject, $msg, $mail = "", $name = "") { global $config; if ($mail == "") { $mail = $config['emails']; $name = $config['nickname']; } $subject = utf_to_win($subject); $msg = utf_to_win($msg); $name = utf_to_win($name); $subject = convert_cyr_string($subject, 'w', 'k'); $msg = convert_cyr_string($msg, 'w', 'k'); $name = convert_cyr_string($name, 'w', 'k'); $subject = '=?KOI8-R?B?' . base64_encode($subject) . '?='; $adds = "Dari: " . $name . " <" . $mail . ">\n"; $adds .= "X-sender: " . $name . " <" . $mail . ">\n"; $adds .= "Content-Type: text/plain; charset=koi8-r\n"; $adds .= "MIME-Version: 1.0\n"; $adds .= "Content-Transfer-Encoding: 8bit\n"; $adds .= "X-Mailer: PHP v." . phpversion(); return mail($usermail, $subject, $msg, $adds); } // ----------------------------------// function page_jumpnavigation($link, $posts, $start, $total) { /** * echo '
'; * if ($start != 0) {echo '<-Kembali ';}else{echo '<-Kembali';} * echo ' | '; * if ($total > $start + $posts) {echo 'Lanjut->';}else{echo 'Lanjut->';} */ } // ---------------------------------// function page_strnavigation($link, $posts, $start, $total, $koll = 4) { if ($total > 0) { echo '
'; } } // ------------------------------// function forum_navigation($link, $posts, $total) { if ($total > 0) { $ba = ceil($total / $posts); $ba2 = $ba * $posts - $posts; $max = $posts * 5; for($i = 0; $i < $max;) { if ($i < $total && $i >= 0) { $ii = floor(1 + $i / $posts); echo ' ' . $ii . ' '; } $i += $posts; } if ($max < $total) { if ($max + $posts < $total) { echo ' ... ' . $ba . ''; } else { echo ' ' . $ba . ''; } } echo '
'; } } // -----------------------------// function stats_blog() { if (@filemtime(DATADIR . "temp/statblog.dat") < time()-900) { $totalblog = DB :: $dbh -> querySingle("SELECT SUM(`cats_count`) FROM `catsblog`;"); $totalnew = DB :: $dbh -> querySingle("SELECT count(*) FROM `blogs` WHERE `blogs_time`>?;", array(SITETIME-86400 * 3)); if (empty($totalnew)) { $stat = (int)$totalblog; } else { $stat = $totalblog . '/+' . $totalnew; } file_put_contents(DATADIR . "temp/statblog.dat", $stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statblog.dat"); } // ------------------------------// function stats_forum() { if (@filemtime(DATADIR . "temp/statforum.dat") < time()-600) { $queryforum = DB :: $dbh -> query("SELECT SUM(`forums_topics`) FROM `forums` UNION ALL SELECT SUM(`forums_posts`) FROM `forums`;"); $total = $queryforum -> fetchAll(PDO :: FETCH_COLUMN); file_put_contents(DATADIR . "temp/statforum.dat", (int)$total[0] . '/' . (int)$total[1], LOCK_EX); } return file_get_contents(DATADIR . "temp/statforum.dat"); } // --------------------------------// function stats_guest() { if (@filemtime(DATADIR . "temp/statguest.dat") < time()-600) { global $config; $total = DB :: $dbh -> querySingle("SELECT count(*) FROM `guest`;"); if ($total > ($config['maxpostbook']-10)) { $stat = DB :: $dbh -> querySingle("SELECT MAX(`guest_id`) FROM `guest`;"); } else { $stat = $total; } file_put_contents(DATADIR . "temp/statguest.dat", (int)$stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statguest.dat"); } // --------------------------// function stats_chat() { global $config; $total = DB :: $dbh -> querySingle("SELECT count(*) FROM `chat`;"); if ($total > ($config['chatpost']-10)) { return DB :: $dbh -> querySingle("SELECT MAX(`chat_id`) FROM `chat`;"); } else { return $total; } } // --------------------------------// function stats_load() { if (@filemtime(DATADIR . "temp/statload.dat") < time()-900) { $totalloads = DB :: $dbh -> querySingle("SELECT SUM(`cats_count`) FROM `cats`;"); $totalnew = DB :: $dbh -> querySingle("SELECT count(*) FROM `downs` WHERE `downs_time`>?;", array(SITETIME-86400 * 5)); if (empty($totalnew)) { $stat = intval($totalloads); } else { $stat = $totalloads . '/+' . $totalnew; } file_put_contents(DATADIR . "temp/statload.dat", $stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statload.dat"); } // ------------------------------// function crypt_mail($mail) { $output = ""; $strlen = strlen($mail); for ($i = 0; $i < $strlen; $i++) { $output .= '&#' . ord($mail[$i]) . ';'; } return $output; } // -----------------------// function intar($string) { if (is_array($string)) { $newstring = array_map('intval', $string); } else { $newstring = (int)$string; } return $newstring; } // -------------------------------// function stats_votes() { if (@filemtime(DATADIR . "temp/statvote.dat") < time()-900) { $totalvote = DB :: $dbh -> query("SELECT count(*) AS `count`, SUM(`vote_count`) AS `sum` FROM `vote` WHERE `vote_closed`=?;", array(0)); $data = $totalvote -> fetch(); if (empty($data['sum'])) { $data['sum'] = 0; } file_put_contents(DATADIR . "temp/statvote.dat", $data['count'] . '/' . $data['sum'], LOCK_EX); } return file_get_contents(DATADIR . "temp/statvote.dat"); } // ---------------------------// function stats_news() { if (@filemtime(DATADIR . "temp/statnews.dat") < time()-900) { $stat = 0; $querynews = DB :: $dbh -> query("SELECT `news_time` FROM `news` ORDER BY `news_id` DESC LIMIT 1;"); $data = $querynews -> fetch(); if ($data > 0) { $stat = date_fixed($data['news_time'], "d.m.y"); if ($stat == 'Hari Ini') { $stat = 'Hari Ini'; } } file_put_contents(DATADIR . "temp/statnews.dat", $stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statnews.dat"); } // ----------------------------// function last_news() { global $config; if ($config['lastnews'] > 0) { $total = DB :: $dbh -> querySingle("SELECT count(*) FROM `news`;"); if ($total > 0) { $querynews = DB :: $dbh -> query("SELECT * FROM `news` ORDER BY `news_id` DESC LIMIT " . $config['lastnews'] . ";"); while ($data = $querynews -> fetch()) { echo ' '; echo '' . $data['news_title'] . '
'; echo bb_code($data['news_text']) . '
'; echo 'Komentar (' . $data['news_comments'] . ') '; echo '»'; } } } } // ------------------------------------// function verifi($link) { if (strpos($link, '?') === false) { return $link . '?' . SID; } else { return $link . '&' . SID; } } // ----------------------------// function quickcode() { echo 'BB-Kode
'; echo 'url'; echo 'b'; echo 'big'; echo 'small'; echo 'i'; echo 'u'; echo 'q'; echo 'del'; echo 'hide'; echo 'code'; echo 'red'; echo 'green'; echo 'blue'; echo '
'; } // -------------------------------// function quicksmiles() { echo 'Smiles
'; echo ':) '; echo ':( '; echo ':E '; echo 'hello '; echo 'cry '; echo 'obana '; echo 'infat '; echo 'krut '; echo 'klass '; echo 'vtopku '; echo '
'; } // -----------------------// function quickpaste($form) { echo ''; } // ----------------------// function check_user($login) { $queryuser = DB :: $dbh -> querySingle("SELECT `users_id` FROM `users` WHERE `users_login`=? LIMIT 1;", array($login)); if (!empty($queryuser)) { return true; } return false; } // ----------------------// function is_user() { static $user = 0; if (empty($user)) { if (isset($_SESSION['log']) && isset($_SESSION['par'])) { $querycheck = DB :: $dbh -> query("SELECT `users_login`, `users_pass` FROM `users` WHERE `users_login`=? LIMIT 1;", array(check($_SESSION['log']))); $udata = $querycheck -> fetch(); if (!empty($udata)) { if ($_SESSION['log'] == $udata['users_login'] && md5(md5($_SESSION['par'])) == $udata['users_pass']) { $user = 1; } } } } return $user; } // ----------------------// function is_admin($access = array()) { if (empty($access)) { $access = array(101, 102, 103, 105); } if (is_user()) { global $udata; if (in_array($udata['users_level'], $access)) { return true; } } return false; } // ------------------------------------// function copyright_image($file){ if (file_exists($file)){ $ext = getimagesize($file); if ($ext[2]==1){ $img = imagecreatefromgif($file); $color = imagecolorallocate($img, 51, 51, 51); $color2 = imagecolorallocate($img, 255, 255, 255); imageTTFtext($img, 10, 0, imagesx($img)-59, imagesy($img)-2, $color, BASEDIR."gallery/fonts/font2.ttf",'AreykCreatioN'); imageTTFtext($img, 10, 0, imagesx($img)-60, imagesy($img)-3, $color2, BASEDIR."gallery/fonts/font2.ttf",'AreykCreatioN'); imagegif($img, $file); imagedestroy($img); } else if ($ext[2]==2){ $img = imagecreatefromjpeg($file); $color = imagecolorallocate($img, 51, 51, 51); $color2 = imagecolorallocate($img, 255, 255, 255); imageTTFtext($img, 10, 0, imagesx($img)-59, imagesy($img)-2, $color, BASEDIR."gallery/fonts/font2.ttf",'AreykCreatioN'); imageTTFtext($img, 10, 0, imagesx($img)-60, imagesy($img)-3, $color2, BASEDIR."gallery/fonts/font2.ttf",'AreykCreatioN'); imagejpeg ($img, $file); imagedestroy($img); } return true; }} // ----------------------------------// function show_title($image, $title) { echo '' . $title . ' ' . $title . '

'; } // ------------------------------// function show_error($error) { echo 'Ошибка ' . $error . '

'; } // --------------------------------// function show_login($notice) { echo '
' . $notice . '
Masuk Atau '; echo 'Mendaftar
'; } // ----------------------------------// function ob_processing($str) { global $config; if (isset($config['newtitle'])) { $str = str_replace('%TITLE%', $config['newtitle'] . ' - ' . $config['title'], $str); } else { $str = str_replace('%TITLE%', $config['logos'] . ' - ' . $config['title'], $str); } $str = str_replace('%KEYWORDS%', $config['keywords'], $str); $str = str_replace('%DESCRIPTION%', $config['description'], $str); return $str; } // --------------------------// function icons($ext) { switch ($ext) { case 'dir': $ico = 'dir.gif'; break; case '.php': $ico = 'php.gif'; break; case '.txt': case '.css': case '.dat': $ico = 'txt.gif'; break; case '.htm': case '.html': $ico = 'htm.gif'; break; case '.wav': case '.amr': $ico = 'wav.gif'; break; case '.zip': case '.rar': $ico = 'zip.gif'; break; case '.jpg': case '.jpeg': $ico = 'jpg.gif'; break; case '.bmp': case '.wbmp': $ico = 'bmp.gif'; break; case '.gif': $ico = 'gif.gif'; break; case '.png': $ico = 'png.gif'; break; case '.mmf': $ico = 'mmf.gif'; break; case '.jad': $ico = 'jad.gif'; break; case '.jar': $ico = 'jar.gif'; break; case '.mid': $ico = 'mid.gif'; break; case '.mp3': $ico = 'mp3.gif'; break; case '.exe': $ico = 'exe.gif'; break; case '.ttf': $ico = 'ttf.gif'; break; case '.htaccess': $ico = 'htaccess.gif'; break; default: $ico = 'file.gif'; } return $ico; } // --------------------------// function shuffle_assoc(&$array) { $keys = array_keys($array); shuffle($keys); $new = array(); foreach($keys as $key) { $new[$key] = $array[$key]; } $array = $new; return true; } // -------------------------------// function strip_str($str) { $str = str_replace('
', ' ', $str); return implode(' ', array_slice(explode(' ', strip_tags($str)), 0, 20)); } // ---------------------------// function show_advertuser($view) { if (@filemtime(DATADIR . "temp/rekuser.dat") < time()-1800) { save_advertuser(); } $datafile = unserialize(file_get_contents(DATADIR . "temp/rekuser.dat")); $total = count($datafile); if ($total > 0) { if ($view > $total) { $view = $total; } $quot_rand = array_rand($datafile, $view); if ($view > 1) { $result = array(); for($i = 0;$i < $view;$i++) { $result[] = $datafile[$quot_rand[$i]]; } $result = implode('
', $result); } else { $result = $datafile[$quot_rand]; } return '
'.$result.'[+]'; } } // --------------------------// function save_advertuser() { $queryrek = DB :: $dbh -> query("SELECT * FROM `rekuser` WHERE `rek_time`>?;", array(SITETIME)); $data = $queryrek -> fetchAll(); $arraylink = array(); if (count($data) > 0) { foreach ($data as $val) { if (!empty($val['rek_color'])) { $val['rek_name'] = '' . $val['rek_name'] . ''; } $link = '' . $val['rek_name'] . ''; if (!empty($val['rek_bold'])) { $link = '' . $link . ''; } $arraylink[] = $link; } } file_put_contents(DATADIR . "temp/rekuser.dat", serialize($arraylink), LOCK_EX); } // -------------------// function site_verification() { global $config; if (!empty($config['rotorlicense'])) { echo 'image Лицензионная версия (' . $config['rotorversion'] . ')

'; } else { echo 'image RotorCMS Versi (' . $config['rotorversion'] . ') ACN-TEAM

'; } if (stats_changes() > $config['rotorversion']) { if (file_exists(DATADIR . 'upgrade_' . stats_changes() . '.dat')) { include_once (DATADIR . 'upgrade_' . stats_changes() . '.dat'); } else { echo 'image Upgrade RotorCMS Versi ' . stats_changes() . '

'; } } } function license_verification() { if ($_SERVER['HTTP_HOST']) { $servername = $_SERVER['HTTP_HOST']; } else { $servername = $_SERVER['SERVER_NAME']; } $geturl = 'http://visavi.net/rotorcms/index.php?act=check&site=' . $servername; if (@file_get_contents($geturl)) { $data = file_get_contents($geturl); } else { $data = curl_connect($geturl, $brow); } $activate = 0; if (stristr($data, '')) { $activate = 1; } if (stristr($data, '')) { $activate = 0; } if (!empty($activate)) { echo 'image Situs Anda ' . $servername . ' telah resmi membeli LISENSI RotorCMS

'; } else { echo 'image Situs Anda ' . $servername . ' belum resmi memakai RotorCMS

'; echo 'image Tentang Lisensi

'; } DB :: $dbh -> query("REPLACE INTO `setting` (`setting_name`, `setting_value`) VALUES (?, ?);", array('rotorlicense', $activate)); save_setting(); } // ---------------------// function stats_changes() { if (@filemtime(DATADIR . "temp/changes.dat") < time()-86400) { if (@copy("http://visavi.net/rotorcms/rotor.txt", DATADIR . "temp/changes.dat")) { } else { $data = curl_connect("http://visavi.net/rotorcms/rotor.txt"); file_put_contents(DATADIR . "temp/changes.dat", $data); } } $data = file_get_contents(DATADIR . "temp/changes.dat"); if (is_serialized($data)) { $data = unserialize($data); return $data['version']; } } // ----------------------// function is_serialized($data) { if (trim($data) == "") { return false; } if (preg_match("/^(i|s|a|o|d)(.*);/si", $data)) { return true; } return false; } // ---------------------// function curl_connect($url, $user_agent = 'Mozilla/5.0') { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_REFERER, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_TIMEOUT, 10); $result = curl_exec ($ch); curl_close ($ch); return $result; } } // modifikasi AreykCreation // // --------------------- Shout ------------------------// function stats_shout() { if (filemtime(DATADIR . "temp/statshout.dat") < time()-600) { global $config; $total = DB :: $dbh -> querySingle("SELECT count(*) FROM `shout`;"); if ($total > ($config['maxpostbook']-10)) { $stat = DB :: $dbh -> querySingle("SELECT MAX(`shout_id`) FROM `shout`;"); } else { $stat = $total; } file_put_contents(DATADIR . "temp/statshout.dat", (int)$stat, LOCK_EX); } return file_get_contents(DATADIR . "temp/statshout.dat"); } // ------------------ situs --------------------// function user_site($login) { static $arrstat; if (empty($arrstat)) { $queryusersite = DB :: $dbh -> query("SELECT * FROM `users` WHERE `users_login`=? LIMIT 1;", array($login)); $rowsite = $queryusersite -> fetch(); if($rowsite['users_site']!="" && $rowsite['users_site']!="http://") { $sites = 'My site '.$rowsite['users_site'].' '; } } return $sites; } //--------------- file downloads -------------------// function count_dir($dir) { $count=0; $newcount=0; $path = opendir($dir); while ($file = readdir($path)) { if (( $file != ".")&&($file != "..")&&($file != ".htaccess")&&($file != "index.php")&&($file != "name.dat")&& !ereg (".txt$", "$file")&& !ereg (".JPG$", "$file")&& !ereg (".GIF$", "$file")) { $count ++; $filetime=filemtime("$dir/$file")+(3600*24*5); if($filetime>SITETIME){ $newcount ++; } }} if($newcount>0){ $input=(int)$count.'/+'.(int)$newcount; }else{ $input=(int)$count; } closedir ($path); return $input; } //--------------- artikel file -------------------// function count_libdir($dir) { $count=0; $newcount=0; $path = opendir($dir); while ($file = readdir($path)) { if (ereg(".txt$", $file)){ $count ++; $filetime=filemtime("$dir/$file")+(3600*24*5); if($filetime>SITETIME){ $newcount ++; } }} if($newcount>0){ $input=(int)$count.'/+'.(int)$newcount; }else{ $input=(int)$count; } closedir ($path); return $input; } //------------------------ Transfer data ------------------------// function write_files($filename, $text, $clear=0, $chmod=""){ $fp = fopen($filename, "a+"); flock ($fp,LOCK_EX); if ($clear==1) {ftruncate($fp,0);} fputs ($fp,$text); fflush($fp); flock ($fp,LOCK_UN); fclose($fp); if ($chmod!="") {chmod($filename, $chmod);} } // --------------------- photo gallery avatar ------------------------// function user_photoku($login) { static $arrstat; if (empty($arrstat)) { $queryuserphotoku = DB :: $dbh -> query("SELECT * FROM `users` WHERE `users_login`=? LIMIT 1;", array($login)); $rowphoto = $queryuserphotoku -> fetch(); if (!empty($rowphoto['users_picture']) && file_exists(BASEDIR . 'gallery/photos/' . $rowphoto['users_picture'])) { $photoku = 'photo'; } else { $photoku = ''; } } return $photoku; } //--------------- waktu mundur --------------------// function lama_waktu($waktu){ $lama=round((SITETIME-$waktu)/60); if($lama<10){$lama='Perdetik yang lalu';} if($lama>=10 && $lama<60){$lama="$lama menit yang lalu";} if($lama>=60 && $lama<1440){$lama=round($lama/60); $lama="$lama jam yang lalu";} if($lama>=1440){$lama=round($lama/60/24); $lama="$lama hari yang lalu";} return $lama; } ?>