include mnminclude . 'external_post.php'; include_once mnminclude . 'ban.php'; define('DEBUG', false); header("Content-Type: text/html"); define(MAX, 1.15); define(MIN, 1.0); define(PUB_MIN, 1); define(PUB_MAX, 75); define(PUB_PERC, 0.15); $sites = SitesMgr::get_active_sites(); foreach ($sites as $site) { echo "*** SITE: " . $site . "\n"; // benjami 18-08-2012 SitesMgr::__init($site); $site_info = SitesMgr::get_info($site); promote($site); if (!$site_info->sub) { promote_from_subs($site, 24, 80, 8); } } function promote_from_subs($destination, $hours, $min_karma, $min_votes) { global $db; echo "Promote to main: {$destination}\n"; $res = $db->get_results("select sub_statuses.*, link_url, link_karma, link_votes from sub_statuses, subs, links where date > date_sub(now(), interval {$hours} hour) and status = 'published' and link_karma >= {$min_karma} and sub_statuses.id = origen and subs.id = sub_statuses.id and subs.created_from = {$destination} and not subs.private and not subs.nsfw and sub_statuses.id not in (select src from subs_copy where dst={$destination}) and {$destination} not in (select id from sub_statuses as t where t.link=sub_statuses.link) and link_id = sub_statuses.link and link_votes >= {$min_votes}"); foreach ($res as $status) { // If there are more of the same sub in queue or published, multiply minimums $promoted = $db->get_var("select count(*) from sub_statuses where id = {$destination} and origen = {$status->id} and date > date_sub(now(), interval {$hours} hour)"); echo "PROMOTED {$status->id} -> {$destination}: {$promoted}\n"; if ($promoted > 0 && $status->link_karma < min(4, $promoted * 0.5 + 1) * $min_karma && $status->link_votes < min(4, $promoted * 0.5 + 1) * $min_votes) { echo "Already in main {$promoted}, doesn't have minimums, {$status->link_url}\n";
defined('IN_WZ') or exit('No direct script access allowed'); include $this->template('header', 'core'); ?> <body class="body pxgridsbody"> <section class="wrapper"> <div class="row"> <div class="col-lg-12"> <section class="panel"> <div class="panel-body"> 广告预览:<?php echo $r['name']; ?> <br><br> <?php echo promote($pid, $id); ?> </div> </section> </div> </div> <!-- page end--> </section> <script src="<?php echo R; ?> js/bootstrap.min.js"></script> <script src="<?php echo R; ?>