', 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'] . '
#i', '
', $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 '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '
';
}
// -------------------------------//
function quicksmiles() {
echo 'Smiles
';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
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 . '
';
}
// ------------------------------//
function show_error($error) {
echo ' ' . $error . '
';
}
// --------------------------------//
function show_login($notice) {
echo '
';
}
// ----------------------------------//
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 ' Лицензионная версия (' . $config['rotorversion'] . ')
';
} else {
echo ' 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 ' 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 ' Situs Anda ' . $servername . ' telah resmi membeli LISENSI RotorCMS
';
} else {
echo ' Situs Anda ' . $servername . ' belum resmi memakai RotorCMS
';
echo ' 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 = '';
} 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;
}
?>