|
12.02.2006, 18:29
16. Уберем пару запросов в функции подсчета дней до окончании подписки пользователя (мало кто этим пользуется, но все-таки), находим:
PHP код:
function paid() { global $db, $user, $cookie, $adminmail, $sitename, $nukeurl, $subscription_url, $user_prefix, $prefix; if (is_user($user)) { if ($subscription_url != "") { $renew = ""._SUBRENEW." $subscription_url"; } else { $renew = ""; } cookiedecode($user); $sql = "SELECT * FROM ".$prefix."_subscriptions WHERE userid='$cookie[0]'"; $result = $db->sql_query($sql); $numrows = $db->sql_numrows($result); $row = $db->sql_fetchrow($result); if ($numrows == 0) { return 0; } elseif ($numrows != 0) { $time = time(); if ($row[subscription_expire] <= $time) { $db->sql_query("DELETE FROM ".$prefix."_subscriptions WHERE userid='$cookie[0]' AND id='$row[id]'"); $from = "$sitename <$adminmail>"; $subject = "$sitename: "._SUBEXPIRED.""; $body = ""._HELLO." $cookie[1]:\n\n"._SUBSCRIPTIONAT." $sitename "._HASEXPIRED."\n$renew\n\n"._HOPESERVED."\n\n$sitename "._TEAM."\n$nukeurl"; $row = $db->sql_fetchrow($db->sql_query("SELECT user_email FROM ".$user_prefix."_users WHERE id='$cookie[0]' AND nickname='$cookie[1]' AND password='$cookie[2]'")); $mailheaders = "Content-Type: text/plain; charset="._CHARSET."\n"; $mailheaders .= "From: $sitename <$adminmail>\n"; mail($row[user_email], $subject, $body, $mailheaders); } return 1; } } else { return 0; } }
Заменяем ее на:
PHP код:
//Copyright Soniks http://mynuke.ru function paid() { global $db, $user, $userinfo, $adminmail, $sitename, $nukeurl, $subscription_url, $user_prefix, $prefix; if (is_user($user)) { if ($subscription_url != "") { $renew = ""._SUBRENEW." $subscription_url"; } else { $renew = ""; } $sql = "SELECT * FROM ".$prefix."_subscriptions WHERE userid='".$userinfo['user_id']."'"; $result = $db->sql_query($sql); $numrows = $db->sql_numrows($result); $row = $db->sql_fetchrow($result); if ($numrows == 0) { return 0; } elseif ($numrows != 0) { $time = time(); if ($row[subscription_expire] <= $time) { $db->sql_query("DELETE FROM ".$prefix."_subscriptions WHERE userid='".$userinfo['user_id']."' AND id='".$row['id']."'"); $from = "$sitename <$adminmail>"; $subject = "$sitename: "._SUBEXPIRED.""; $body = ""._HELLO." ".$userinfo['username'].":\n\n"._SUBSCRIPTIONAT." $sitename "._HASEXPIRED."\n$renew\n\n"._HOPESERVED."\n\n$sitename "._TEAM."\n$nukeurl"; $mailheaders = "Content-Type: text/plain; charset="._CHARSET."\n"; $mailheaders .= "From: $sitename <$adminmail>\n"; mail($userinfo['user_email'], $subject, $body, $mailheaders); } return 1; } } else { return 0; } }
17. И последнее изменение в этом файле, обновим функцию банерной системы (данная система появилась в версии 7.9, сл-но у версий ниже данное делать не нужно), находим:
PHP код:
function ads($position) { global $prefix, $db, $admin, $sitename, $adminmail, $nukeurl; $position = intval($position); if (paid()) { return; } $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner WHERE position='$position' AND active='1'")); /* Get a random banner if exist any. */ if ($numrows > 1) { $numrows = $numrows-1; mt_srand((double)microtime()*1000000); $bannum = mt_rand(0, $numrows); } else { $bannum = 0; } $sql = "SELECT bid, impmade, imageurl, clickurl, alttext FROM ".$prefix."_banner WHERE position='$position' AND active='1' LIMIT $bannum,1"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $bid = $row[bid]; $imageurl = filter($row[imageurl], nohtml); $clickurl = filter($row[clickurl], nohtml); $alttext = filter($row[alttext], nohtml); $db->sql_query("UPDATE ".$prefix."_banner SET impmade=impmade+1 WHERE bid='$bid'"); if($numrows > 0) { $sql2 = "SELECT cid, imptotal, impmade, clicks, date, ad_class, ad_code, ad_width, ad_height FROM ".$prefix."_banner WHERE bid='$bid'"; $result2 = $db->sql_query($sql2); $row2 = $db->sql_fetchrow($result2); $cid = $row2[cid]; $imptotal = $row2[imptotal]; $imptotal = intval($imptotal); $impmade = $row2[impmade]; $impmade = intval($impmade); $clicks = $row2[clicks]; $clicks = intval($clicks); $date = $row2[date]; $ad_class = filter($row2[ad_class], nohtml); $ad_code = $row2[ad_code]; $ad_width = intval($row['ad_width']); $ad_height = intval($row['ad_height']); /* Check if this impression is the last one and print the banner */ if (($imptotal <= $impmade) AND ($imptotal != 0)) { $db->sql_query("UPDATE ".$prefix."_banner SET active='0' WHERE bid='$bid'"); $sql3 = "SELECT name, contact, email FROM ".$prefix."_banner_clients WHERE cid='$cid'"; $result3 = $db->sql_query($sql3); $row3 = $db->sql_fetchrow($result3); $c_name = filter($row3[name], nohtml); $c_contact = filter($row3[contact], nohtml); $c_email = filter($row3[email], nohtml);
Заменяем на:
PHP код:
//Copyright Soniks http://mynuke.ru function ads($position) { global $prefix, $db, $admin, $sitename, $adminmail, $nukeurl, $adsinfo; $position = intval($position); if(!is_array($adsinfo) or !$adsinfo){ $adsinfo = array(); $rows = $db->sql_query("SELECT * FROM ".$prefix."_banner WHERE active='1' ORDER BY position"); while($ads_result = $db->sql_fetchrow($rows)){ $adsinfo[$ads_result['position']][$ads_result['bid']] = $ads_result; } } if(!empty($adsinfo[$position])){ $bid = array_rand($adsinfo[$position]); $now_ads = $adsinfo[$position][$bid]; if(!is_admin($admin)) $db->sql_query("UPDATE ".$prefix."_banner SET impmade=impmade+1 WHERE bid='$bid'"); $imageurl = filter($now_ads['imageurl'], nohtml); $clickurl = filter($now_ads['clickurl'], nohtml); $alttext = filter($now_ads['alttext'], nohtml); $cid = $now_ads['cid']; $imptotal = intval($now_ads['imptotal']); $impmade = intval($now_ads['impmade']); $clicks = intval($now_ads['clicks']); $date = $now_ads['date']; $ad_class = filter($now_ads['ad_class'], nohtml); $ad_code = $now_ads['ad_code']; $ad_width = intval($now_ads['ad_width']); $ad_height = intval($now_ads['ad_height']); /* Check if this impression is the last one and print the banner */ if (($imptotal <= $impmade) AND ($imptotal != 0)) { $db->sql_query("UPDATE ".$prefix."_banner SET active='0' WHERE bid='$bid'"); $result = $db->sql_query("SELECT name, contact, email FROM ".$prefix."_banner_clients WHERE cid='$cid'"); $row = $db->sql_fetchrow($result); $c_name = filter($row['name'], nohtml); $c_contact = filter($row['contact'], nohtml); $c_email = filter($row['email'], nohtml);
|
|