Esempio n. 1
0
function usertable($res, $frame_caption)
{
    global $CURUSER, $lang;
    $htmlout = '';
    $htmlout .= begin_frame($frame_caption, true);
    $htmlout .= begin_table();
    $htmlout .= "<tr>\r\n    <td class='colhead'>{$lang['common_rank']}</td>\r\n    <td class='colhead' align='left'>{$lang['user']}</td>\r\n    <td class='colhead'>{$lang['user_ul']}</td>\r\n    <td class='colhead' align='left'>{$lang['user_ulspeed']}</td>\r\n    <td class='colhead'>{$lang['user_dl']}</td>\r\n    <td class='colhead' align='left'>{$lang['user_dlspeed']}</td>\r\n    <td class='colhead' align='right'>{$lang['common_ratio']}</td>\r\n    <td class='colhead' align='left'>{$lang['user_joined']}</td>\r\n\r\n    </tr>";
    $num = 0;
    while ($a = mysql_fetch_assoc($res)) {
        ++$num;
        $highlight = $CURUSER["id"] == $a["userid"] ? " bgcolor='#BBAF9B'" : "";
        if ($a["downloaded"]) {
            $ratio = $a["uploaded"] / $a["downloaded"];
            $color = get_ratio_color($ratio);
            $ratio = number_format($ratio, 2);
            if ($color) {
                $ratio = "<font color='{$color}'>{$ratio}</font>";
            }
        } else {
            $ratio = $lang['common_infratio'];
        }
        $htmlout .= "<tr{$highlight}><td align='center'>{$num}</td><td align='left'{$highlight}><a href='userdetails.php?id=" . $a["userid"] . "'><b>" . $a["username"] . "</b></a>" . "</td><td align='right'{$highlight}>" . mksize($a["uploaded"]) . "</td><td align='right'{$highlight}>" . mksize($a["upspeed"]) . "/s" . "</td><td align='right'{$highlight}>" . mksize($a["downloaded"]) . "</td><td align='right'{$highlight}>" . mksize($a["downspeed"]) . "/s" . "</td><td align='right'{$highlight}>" . $ratio . "</td><td align='left'>" . get_date($a['added'], '') . " (" . get_date($a['added'], '', 0, 1) . ")</td></tr>";
    }
    $htmlout .= end_table();
    $htmlout .= end_frame();
    return $htmlout;
}
Esempio n. 2
0
function do_log_sql($stdlog, $text_log, &$LINK)
{
    if (!mysql_ping($GLOBALS["LINK"])) {
        $do_mysql_reconect = 1;
        fputs($stdlog, get_date() . " MySQL Connect failed" . "\n");
    } else {
        $do_mysql_reconect = 0;
        fputs($stdlog, get_date() . " " . $text_log . "\n");
    }
    while ($do_mysql_reconect == 1) {
        $config_file = '../../app/etc/config.xml';
        if (file_exists($config_file)) {
            $xml = simplexml_load_file($config_file);
            $CONF_MYSQL_HOST = (string) $xml->parameters->mysql->host;
            $CONF_MYSQL_USERNAME = (string) $xml->parameters->mysql->username;
            $CONF_MYSQL_PASSWORD = (string) $xml->parameters->mysql->password;
            $CONF_MYSQL_DBNAME = (string) $xml->parameters->mysql->dbname;
        }
        $GLOBALS["LINK"] = mysql_pconnect($CONF_MYSQL_HOST, $CONF_MYSQL_USERNAME, $CONF_MYSQL_PASSWORD);
        mysql_select_db($CONF_MYSQL_DBNAME, $GLOBALS["LINK"]);
        if (mysql_ping($GLOBALS["LINK"])) {
            $do_mysql_reconect = 0;
            fputs($stdlog, get_date() . " MySQL Connect restored" . "\n");
        }
    }
    return "1";
}
Esempio n. 3
0
function calendar($m, $y)
{
    $today = get_date('', 'j');
    $weekday = get_date(mktime(0, 0, 0, $m, 1, $y), 'w');
    $totalday = Days4month($y, $m);
    $start = strtotime($y . '-' . $m . '-1');
    $end = strtotime($y . '-' . $m . '-' . $totalday);
    //    $rs=iCMS_DB::getArray("SELECT A.*,F.name,F.dir FROM `#iCMS@__article` AS A,#iCMS@__forum AS F WHERE A.status='1' AND A.fid=F.fid AND F.status='1' AND pubdate>='$start' AND pubdate<='$end'");
    //    for ($i=0;$i<count($rs);$i++) {
    //        $pubdate=get_date($rs[$i]['pubdate'],'Y-n-j');
    //        $dates[$pubdate]
    //        //$postdates .= ($postdates ? ',' : '').get_date($rs[$i]['pubdate'],'Y-n-j');
    //    }
    $br = 0;
    $days = '<tr>';
    for ($i = 1; $i <= $weekday; $i++) {
        $days .= '<td>&nbsp;</td>';
        $br++;
    }
    for ($i = 1; $i <= $totalday; $i++) {
        $br++;
        //$td = (strpos(",$postdates,",','.$y.'-'.$m.'-'.$i.",") !== false) ? '<a href="index.php?date='.$y.'_'.$m.'_'.$i.'"><b>'.$i.'</b></a>' :$i;
        $days .= '<td>' . $i . '</td>';
        if ($br >= 7) {
            $days .= '</tr><tr>';
            $br = 0;
        }
    }
    if ($br != 0) {
        for ($i = $br; $i < 7; $i++) {
            $days .= '<td>&nbsp;</td>';
        }
    }
    return $days;
}
Esempio n. 4
0
/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                			    |
|--------------------------------------------------------------------------|
|   Licence Info: GPL			                                    |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V5					    |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless, Autotron, whocares, Swizzles.					    |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    require_once INCL_DIR . 'function_happyhour.php';
    //==Putyns HappyHour
    $f = $INSTALLER09['happyhour'];
    $happy = unserialize(file_get_contents($f));
    $happyHour = strtotime($happy["time"]);
    $curDate = TIME_NOW;
    $happyEnd = $happyHour + 3600;
    if ($happy["status"] == 0 && $INSTALLER09['happy_hour'] == true) {
        write_log("Happy hour was @ " . get_date($happyHour, 'LONG', 1, 0) . " and Catid " . $happy["catid"] . " ");
        happyFile("set");
    } elseif ($curDate > $happyEnd && $happy["status"] == 1) {
        happyFile("reset");
    }
    //== End
    if ($queries > 0) {
        write_log("Happyhour Clean -------------------- Happyhour cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Esempio n. 5
0
 function calendar($m, $y)
 {
     $today = get_date(0, 'j');
     $weekday = get_date(mktime(0, 0, 0, $m, 1, $y), 'w');
     $totalday = days_in_month($y, $m);
     $start = strtotime($y . '-' . $m . '-1');
     $end = strtotime($y . '-' . $m . '-' . $totalday);
     $br = 0;
     $days = '<tr class="day">';
     for ($i = 1; $i <= $weekday; $i++) {
         $days .= '<td></td>';
         $br++;
     }
     for ($i = 1; $i <= $totalday; $i++) {
         $br++;
         $dcp = $this->day_count_post[$y . '-' . $m . '-' . $i];
         $dcp or $dcp = 0;
         if ($i == $today) {
             $days .= '<td class="today"><b>' . $i . '</b><hr />' . $dcp . '篇</td>';
         } else {
             $days .= '<td><b>' . $i . '</b><hr />' . $dcp . '篇</td>';
         }
         if ($br >= 7) {
             $days .= '</tr><tr class="day">';
             $br = 0;
         }
     }
     if ($br != 0) {
         for ($i = $br; $i < 7; $i++) {
             $days .= '<td></td>';
         }
     }
     return $days;
 }
Esempio n. 6
0
function calendar($m, $y, $iCMS)
{
    $today = get_date('', 'j');
    $weekday = get_date(mktime(0, 0, 0, $m, 1, $y), 'w');
    $totalday = Days4month($y, $m);
    $start = strtotime($y . '-' . $m . '-1');
    $end = strtotime($y . '-' . $m . '-' . $totalday);
    $postdates = '';
    $rs = $iCMS->db->getArray("SELECT A.*,C.name,C.dir FROM `#iCMS@__article` AS A,#iCMS@__catalog AS C WHERE visible='1' AND A.cid=C.id AND C.ishidden='0' AND pubdate>='{$start}' AND pubdate<='{$end}'");
    for ($i = 0; $i < count($rs); $i++) {
        $postdates .= ($postdates ? ',' : '') . get_date($rs[$i]['pubdate'], 'Y-n-j');
    }
    $br = 0;
    $days = '<tr>';
    for ($i = 1; $i <= $weekday; $i++) {
        $days .= '<td>&nbsp;</td>';
        $br++;
    }
    for ($i = 1; $i <= $totalday; $i++) {
        $br++;
        $td = strpos(",{$postdates},", ',' . $y . '-' . $m . '-' . $i . ",") !== false ? '<a href="index.php?date=' . $y . '_' . $m . '_' . $i . '"><b>' . $i . '</b></a>' : $i;
        $days .= '<td>' . $td . '</td>';
        if ($br >= 7) {
            $days .= '</tr><tr>';
            $br = 0;
        }
    }
    if ($br != 0) {
        for ($i = $br; $i < 7; $i++) {
            $days .= '<td>&nbsp;</td>';
        }
    }
    return $days;
}
Esempio n. 7
0
 function postcheck()
 {
     global $db_openpost, $db_postallowtime, $timestamp;
     //list($openpost, $poststart, $postend) = explode("\t", $db_openpost);
     list($openpost, $poststart, $poststartminute, $postend, $postendminute) = explode("\t", $db_openpost);
     $minute = get_date($timestamp, 'i');
     $GLOBALS['db_poststart'] = $poststart;
     $GLOBALS['db_poststartminute'] = $poststartminute;
     $GLOBALS['db_postend'] = $postend;
     $GLOBALS['db_postendminute'] = $postendminute;
     if ($openpost == 1 && $this->groupid != 3 && $this->groupid != 4) {
         if ($poststart < $postend && ($this->hours < $poststart || $this->hours == $poststart && $minute < $poststartminute || ($this->hours > $postend || $this->hours == $postend && $minute > $postendminute))) {
             return $this->showmsg('post_openpost');
         } elseif ($poststart > $postend && (($this->hours < $poststart || $this->hours == $poststart && $minute < $poststartminute) && ($this->hours > $postend || $this->hours == $postend && $minute > $postendminute))) {
             return $this->showmsg('post_openpost');
         } elseif ($poststart == $postend && $this->hours == $poststart && ($minute < $poststartminute || $minute > $postendminute)) {
             return $this->showmsg('post_openpost');
         }
     }
     if ($this->groupid == '7') {
         return $this->showmsg('reg_check');
     }
     $userGroupsService = L::loadClass('UserGroups', 'user');
     $systemGroup = $userGroupsService->getUserGroupIds('system');
     if (!in_array($this->groupid, $systemGroup) && $db_postallowtime && $timestamp - $this->user['regdate'] < $db_postallowtime * 60) {
         return $this->showmsg('post_newrg_limit');
     }
 }
 /**
  * 某日的实名认证验证码发送量
  * @param string $day 'Y-m-d'
  * @return int
  */
 function getCodeSentNumOfDay($day = null)
 {
     $platformApiClient = $this->_getPlatformApiClient();
     $day == null && ($day = get_date(time(), 'Y-m-d'));
     $response = (int) $this->_jsonDecode($platformApiClient->get('credit.statistics.countsitemobileverifybyday', array('day' => $day)));
     return new ApiResponse($response);
 }
Esempio n. 9
0
function cleanup_show_main()
{
    $count1 = get_row_count('cleanup');
    $perpage = 15;
    $pager = pager($perpage, $count1, 'staffpanel.php?tool=cleanup_manager&amp;');
    $htmlout = "<h2>Current Cleanup Tasks</h2>\n    <table class='torrenttable' bgcolor='#333333' border='1' cellpadding='5px' width='80%'>\n    <tr>\n      <td class='colhead'>Cleanup Title &amp; Description</td>\n      <td class='colhead' width='150px'>Runs every</td>\n      <td class='colhead' width='150px'>Next Clean Time</td>\n      <td class='colhead' width='40px'>Edit</td>\n      <td class='colhead' width='40px'>Delete</td>\n      <td class='colhead' width='40px'>Off/On</td>\n      <td class='colhead' style='width: 40px;'>Run&nbsp;now</td>\n    </tr>";
    $sql = sql_query("SELECT * FROM cleanup ORDER BY clean_time ASC " . $pager['limit']) or sqlerr(__FILE__, __LINE__);
    if (!mysqli_num_rows($sql)) {
        stderr('Error', 'F*****g panic now!');
    }
    while ($row = mysqli_fetch_assoc($sql)) {
        $row['_clean_time'] = get_date($row['clean_time'], 'LONG');
        $row['clean_increment'] = $row['clean_increment'];
        $row['_class'] = $row['clean_on'] != 1 ? " style='color:red'" : '';
        $row['_title'] = $row['clean_on'] != 1 ? " (Locked)" : '';
        $row['_clean_time'] = $row['clean_on'] != 1 ? "<span style='color:red'>{$row['_clean_time']}</span>" : $row['_clean_time'];
        $htmlout .= "<tr>\n          <td{$row['_class']}><strong>{$row['clean_title']}{$row['_title']}</strong><br />{$row['clean_desc']}</td>\n          <td>" . mkprettytime($row['clean_increment']) . "</td>\n          <td>{$row['_clean_time']}</td>\n          <td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=edit&amp;cid={$row['clean_id']}'>\n            <img src='./pic/aff_tick.gif' alt='Edit Cleanup' title='Edit' border='0' height='12' width='12' /></a></td>\n\n          <td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=delete&amp;cid={$row['clean_id']}'>\n            <img src='./pic/aff_cross.gif' alt='Delete Cleanup' title='Delete' border='0' height='12' width='12' /></a></td>\n          <td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=unlock&amp;cid={$row['clean_id']}&amp;clean_on={$row['clean_on']}'>\n            <img src='./pic/warned.png' alt='On/Off Cleanup' title='on/off' border='0' height='12' width='12' /></a></td>\n<td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=run&amp;cid={$row['clean_id']}'>Run it now</a></td>\n </tr>";
    }
    $htmlout .= "</table>";
    if ($count1 > $perpage) {
        $htmlout .= $pager['pagerbottom'];
    }
    $htmlout .= "<br />\n                <span class='btn'><a href='./staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=new'>Add New</a></span>";
    echo stdhead('Cleanup Manager - View') . $htmlout . stdfoot();
}
 function parse($data, $query)
 {
     $items = array('domain.name' => 'Nome de domínio / Domain Name:', 'domain.created' => 'Data de registo / Creation Date (dd/mm/yyyy):', 'domain.nserver.' => 'Nameserver:', 'domain.status' => 'Estado / Status:', 'owner' => 'Titular / Registrant', 'bill' => 'Entidade Gestora / Billing Contact', 'admin' => 'Responsável Administrativo / Admin Contact', 'tech' => 'Responsável Técnico / Tech Contact', '#' => 'Nameserver Information');
     $r['regrinfo'] = get_blocks($data['rawdata'], $items);
     if (empty($r['regrinfo']['domain']['name'])) {
         $r['regrinfo']['registered'] = 'no';
         return;
     }
     $r['regrinfo']['domain']['created'] = get_date($r['regrinfo']['domain']['created'], 'dmy');
     if ($r['regrinfo']['domain']['status'] == 'ACTIVE') {
         $r['regrinfo']['registered'] = 'yes';
     } else {
         $r['regrinfo']['registered'] = 'no';
     }
     if (isset($r['regrinfo']['admin'])) {
         $r['regrinfo']['admin'] = get_contact($r['regrinfo']['admin']);
     }
     if (isset($r['regrinfo']['owner'])) {
         $r['regrinfo']['owner'] = get_contact($r['regrinfo']['owner']);
     }
     if (isset($r['regrinfo']['tech'])) {
         $r['regrinfo']['tech'] = get_contact($r['regrinfo']['tech']);
     }
     if (isset($r['regrinfo']['bill'])) {
         $r['regrinfo']['bill'] = get_contact($r['regrinfo']['bill']);
     }
     $r['regyinfo'] = array('referrer' => 'http://www.fccn.pt', 'registrar' => 'FCCN');
     return $r;
 }
Esempio n. 11
0
function plugin_epoch_inline()
{
    $value = func_get_args();
    $args = func_num_args();
    if ($args > 3) {
        return '&epoch(utime[,class]);';
    }
    $array = explode(',', $value[0]);
    $format = Time::format($array[0]);
    $passaage = Time::passage($array[0]);
    $class = !empty($array[1]) ? $array[1] : 'epoch';
    $ret = '<time datetime="' . get_date('c', $value[0]) . '" class="' . $class . '" title="' . $passaage . '">' . $format . '</time>';
    if (!empty($value[1])) {
        $erapse = MUTIME - $value[0];
        if ($erapse < 432000) {
            $ret .= ' <span class="';
            if ($erapse < 86400) {
                $ret .= 'new1';
            } else {
                $ret .= 'new5';
            }
            $ret .= '">New</span>';
        }
    }
    return $ret;
}
Esempio n. 12
0
function plugin_counter_get_count($page)
{
    global $vars;
    static $counters = array();
    static $default;
    if (!isset($default)) {
        $default = array('total' => 0, 'date' => get_date('Y/m/d'), 'today' => 0, 'yesterday' => 0, 'ip' => '');
    }
    if (!is_page($page)) {
        return $default;
    }
    if (isset($counters[$page])) {
        return $counters[$page];
    }
    // Set default
    $counters[$page] = $default;
    $modify = FALSE;
    $file = COUNTER_DIR . encode($page) . PLUGIN_COUNTER_SUFFIX;
    $fp = fopen($file, file_exists($file) ? 'r+' : 'w+') or die('counter.inc.php: Cannot open COUTER_DIR/' . basename($file));
    set_file_buffer($fp, 0);
    flock($fp, LOCK_EX);
    rewind($fp);
    foreach ($default as $key => $val) {
        // Update
        $counters[$page][$key] = rtrim(fgets($fp, 256));
        if (feof($fp)) {
            break;
        }
    }
    if ($counters[$page]['date'] != $default['date']) {
        // New day
        $modify = TRUE;
        $is_yesterday = $counters[$page]['date'] == get_date('Y/m/d', strtotime('yesterday', UTIME));
        $counters[$page]['ip'] = $_SERVER['REMOTE_ADDR'];
        $counters[$page]['date'] = $default['date'];
        $counters[$page]['yesterday'] = $is_yesterday ? $counters[$page]['today'] : 0;
        $counters[$page]['today'] = 1;
        $counters[$page]['total']++;
    } else {
        if ($counters[$page]['ip'] != $_SERVER['REMOTE_ADDR']) {
            // Not the same host
            $modify = TRUE;
            $counters[$page]['ip'] = $_SERVER['REMOTE_ADDR'];
            $counters[$page]['today']++;
            $counters[$page]['total']++;
        }
    }
    // Modify
    if ($modify && $vars['cmd'] == 'read') {
        rewind($fp);
        ftruncate($fp, 0);
        foreach (array_keys($default) as $key) {
            fputs($fp, $counters[$page][$key] . "\n");
        }
    }
    flock($fp, LOCK_UN);
    fclose($fp);
    return $counters[$page];
}
Esempio n. 13
0
 function resetInfo($tid, $atcdb)
 {
     global $timestamp;
     $reset = $this->db->get_one("SELECT obtitle,retitle,endtime,umpire,judge FROM pw_debates WHERE tid=" . S::sqlEscape($tid));
     $reset['debateable'] = !$reset['judge'] && $reset['endtime'] > $timestamp ? '' : "disabled";
     $reset['endtime'] = get_date($reset['endtime'], "Y-m-d H:i");
     return $reset;
 }
function docleanup($data)
{
    global $INSTALLER09, $queries;
    set_time_limit(0);
    ignore_user_abort(1);
    $lconf = sql_query('SELECT * FROM lottery_config') or sqlerr(__FILE__, __LINE__);
    while ($aconf = mysqli_fetch_assoc($lconf)) {
        $lottery_config[$aconf['name']] = $aconf['value'];
    }
    if ($lottery_config['enable'] && TIME_NOW > $lottery_config['end_date']) {
        $q = mysqli_query($GLOBALS["___mysqli_ston"], 'SELECT t.user as uid, u.seedbonus, u.modcomment FROM tickets as t LEFT JOIN users as u ON u.id = t.user ORDER BY RAND() ') or sqlerr(__FILE__, __LINE__);
        while ($a = mysqli_fetch_assoc($q)) {
            $tickets[] = $a;
        }
        shuffle($tickets);
        $lottery['winners'] = array();
        $lottery['total_tickets'] = count($tickets);
        for ($i = 0; $i < $lottery['total_tickets']; $i++) {
            if (!isset($lottery['winners'][$tickets[$i]['uid']])) {
                $lottery['winners'][$tickets[$i]['uid']] = $tickets[$i];
            }
            if ($lottery_config['total_winners'] == count($lottery['winners'])) {
                break;
            }
        }
        if ($lottery_config['use_prize_fund']) {
            $lottery['total_pot'] = $lottery_config['prize_fund'];
        } else {
            $lottery['total_pot'] = $lottery['total_tickets'] * $lottery_config['ticket_amount'];
        }
        $lottery['user_pot'] = round($lottery['total_pot'] / $lottery_config['total_winners'], 2);
        $msg['subject'] = sqlesc('You have won the lottery');
        $msg['body'] = sqlesc('Congratulations, You have won : ' . $lottery['user_pot'] . '. This has been added to your seedbonus total amount. Thanks for playing Lottery.');
        foreach ($lottery['winners'] as $winner) {
            $_userq[] = '(' . $winner['uid'] . ',' . ($winner['seedbonus'] + $lottery['user_pot']) . ',' . sqlesc("User won the lottery: " . $lottery['user_pot'] . " at " . get_date(TIME_NOW, 'LONG') . "\n" . $winner['modcomment']) . ')';
            $_pms[] = '(0,' . $winner['uid'] . ',' . $msg['subject'] . ',' . $msg['body'] . ',' . TIME_NOW . ')';
        }
        $lconfig_update = array('(\'enable\',0)', '(\'lottery_winners_time\',' . TIME_NOW . ')', '(\'lottery_winners_amount\',' . $lottery['user_pot'] . ')', '(\'lottery_winners\',\'' . join('|', array_keys($lottery['winners'])) . '\')');
        if (count($_userq)) {
            sql_query('INSERT INTO users(id,seedbonus,modcomment) VALUES ' . join(',', $_userq) . ' ON DUPLICATE KEY UPDATE seedbonus = values(seedbonus), modcomment = values(modcomment)') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        }
        if (count($_pms)) {
            sql_query('INSERT INTO messages(sender, receiver, subject, msg, added) VALUES ' . join(',', $_pms)) or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        }
        sql_query('INSERT INTO lottery_config(name,value) VALUES ' . join(',', $lconfig_update) . ' ON DUPLICATE KEY UPDATE value=values(value)') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        sql_query('DELETE FROM tickets') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
    }
    //==End 09 seedbonus lottery by putyn
    if ($queries > 0) {
        write_log("Lottery clean-------------------- lottery Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Esempio n. 15
0
function plugin_recent_convert()
{
    global $vars, $date_format, $_recent_plugin_frame, $show_passage;
    static $exec_count = 1;
    $recent_lines = PLUGIN_RECENT_DEFAULT_LINES;
    if (func_num_args()) {
        $args = func_get_args();
        if (!is_numeric($args[0]) || isset($args[1])) {
            return PLUGIN_RECENT_USAGE . '<br />';
        } else {
            $recent_lines = $args[0];
        }
    }
    // Show only N times
    if ($exec_count > PLUGIN_RECENT_EXEC_LIMIT) {
        return '#recent(): You called me too much' . '<br />' . "\n";
    } else {
        ++$exec_count;
    }
    if (!file_exists(PLUGIN_RECENT_CACHE)) {
        return '#recent(): Cache file of RecentChanges not found' . '<br />';
    }
    // Get latest N changes
    $lines = file_head(PLUGIN_RECENT_CACHE, $recent_lines);
    if ($lines == FALSE) {
        return '#recent(): File can not open' . '<br />' . "\n";
    }
    $script = get_script_uri();
    $date = $items = '';
    foreach ($lines as $line) {
        list($time, $page) = explode("\t", rtrim($line));
        $_date = get_date($date_format, $time);
        if ($date != $_date) {
            // End of the day
            if ($date != '') {
                $items .= '</ul>' . "\n";
            }
            // New day
            $date = $_date;
            $items .= '<strong>' . $date . '</strong>' . "\n" . '<ul class="recent_list">' . "\n";
        }
        $s_page = htmlsc($page);
        if ($page == $vars['page']) {
            // No need to link to the page you just read, or notify where you just read
            $items .= ' <li>' . $s_page . '</li>' . "\n";
        } else {
            $r_page = rawurlencode($page);
            $passage = $show_passage ? ' ' . get_passage($time) : '';
            $items .= ' <li><a href="' . $script . '?' . $r_page . '"' . ' title="' . $s_page . $passage . '">' . $s_page . '</a></li>' . "\n";
        }
    }
    // End of the day
    if ($date != '') {
        $items .= '</ul>' . "\n";
    }
    return sprintf($_recent_plugin_frame, count($lines), $items);
}
Esempio n. 16
0
 function resetInfo($tid, $atcdb)
 {
     $reset = $this->db->get_one("SELECT * FROM pw_activity WHERE tid=" . S::sqlEscape($tid));
     $reset['starttime'] = get_date($reset['starttime'], "Y-m-d H:i");
     $reset['endtime'] = get_date($reset['endtime'], "Y-m-d H:i");
     $reset['deadline'] = get_date($reset['deadline'], "Y-m-d H:i");
     $reset['sel_' . $reset['sexneed']] = 'checked';
     return $reset;
 }
Esempio n. 17
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    // ===Clear funds on first day of the month
    if (date("d") == 1) {
        sql_query("TRUNCATE funds");
    }
    //if (mysqli_affected_rows() > 0)
    $mc1->delete_value('totalfunds_');
    // ===End
    //== Donation Progress Mod Updated For Tbdev 2009/2010 by Bigjoos/pdq
    $res = sql_query("SELECT id, modcomment, vipclass_before FROM users WHERE donor='yes' AND donoruntil < " . TIME_NOW . " AND donoruntil <> '0'") or sqlerr(__FILE__, __LINE__);
    $msgs_buffer = $users_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        $subject = "Donor status removed by system.";
        $msg = "Your Donor status has timed out and has been auto-removed by the system, and your Vip status has been removed. We would like to thank you once again for your support to {$INSTALLER09['site_name']}. If you wish to re-new your donation, Visit the site paypal link. Cheers!\n";
        while ($arr = mysqli_fetch_assoc($res)) {
            $modcomment = $arr['modcomment'];
            $modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Donation status Automatically Removed By System.\n" . $modcomment;
            $modcom = sqlesc($modcomment);
            $msgs_buffer[] = '(0,' . $arr['id'] . ',' . TIME_NOW . ', ' . sqlesc($msg) . ',' . sqlesc($subject) . ')';
            $users_buffer[] = '(' . $arr['id'] . ',' . $arr['vipclass_before'] . ',\'no\',\'0\', ' . $modcom . ')';
            $update['class'] = $arr['vipclass_before'];
            $mc1->begin_transaction('user' . $arr['id']);
            $mc1->update_row(false, array('class' => $update['class'], 'donor' => 'no', 'donoruntil' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
            $mc1->begin_transaction('user_stats_' . $arr['id']);
            $mc1->update_row(false, array('modcomment' => $modcomment));
            $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
            $mc1->begin_transaction('MyUser_' . $arr['id']);
            $mc1->update_row(false, array('class' => $update['class'], 'donor' => 'no', 'donoruntil' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
            $mc1->delete_value('inbox_new_' . $arr['id']);
            $mc1->delete_value('inbox_new_sb_' . $arr['id']);
        }
        $count = count($users_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
            sql_query("INSERT INTO users (id, class, donor, donoruntil, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),\n            donor=values(donor),donoruntil=values(donoruntil),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup: Donation status expired - " . $count . " Member(s)");
        }
        unset($users_buffer, $msgs_buffer, $update, $count);
    }
    //===End===//
    if ($queries > 0) {
        write_log("Delete Old Funds Clean -------------------- Delete Old Funds cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Esempio n. 18
0
 function do_get_reply()
 {
     $this->id or exit("请选择要操作的评论");
     $comment = iDB::row("SELECT * FROM `#iCMS@__comment` WHERE `id`='{$this->id}' LIMIT 1");
     empty($comment) && exit('<div class="claerfix mb10"></div>评论已被删除');
     echo nl2br($comment->content);
     echo '<div class="claerfix mb10"></div>';
     echo '<span class="label">' . get_date($comment->addtime, 'Y-m-d H:i:s') . '</span> ';
     echo '<span class="label label-info"><i class="fa fa-thumbs-o-up"></i> ' . $comment->up . '</span>';
 }
Esempio n. 19
0
function snatchtable_staff($res)
{
    global $INSTALLER09, $lang, $CURUSER, $id;
    $htmlout_snatch = '';
    $count2 = 0;
    //    $htmlout_snatch .= "<tr><td class='one' align='right' valign='top'><b>{$lang['userdetails_snatched']}</b></td><td class='one'>";
    $htmlout_snatch .= "<table border='1' cellspacing='0' cellpadding='5' align='center'><tr><td class='colhead' align='center'>{$lang['userdetails_s_cat']}</td><td class='colhead' align='left'>{$lang['userdetails_s_torr']}</td>" . "<td class='colhead' align='center'>{$lang['userdetails_s_sl']}</td><td class='colhead' align='center'>{$lang['userdetails_s_up']}" . ($INSTALLER09['ratio_free'] ? "" : "{$lang['userdetails_s_down']}") . "</td><td class='colhead' align='center'>{$lang['userdetails_s_tsize']}</td>" . "<td class='colhead' align='center'>{$lang['userdetails_ratio']}</td><td class='colhead' align='center'>{$lang['userdetails_client']}</td></tr>";
    while ($arr = mysqli_fetch_assoc($res)) {
        //=======change colors
        $count2 = ++$count2 % 2;
        $class = $count2 == 0 ? 'one' : 'two';
        //=== speed color red fast green slow ;)
        if ($arr["upspeed"] > 0) {
            $ul_speed = $arr["upspeed"] > 0 ? mksize($arr["upspeed"]) : ($arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0));
        } else {
            $ul_speed = mksize($arr["uploaded"] / ($arr['l_a'] - $arr['s'] + 1));
        }
        if ($arr["downspeed"] > 0) {
            $dl_speed = $arr["downspeed"] > 0 ? mksize($arr["downspeed"]) : ($arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0));
        } else {
            $dl_speed = mksize($arr["downloaded"] / ($arr['c'] - $arr['s'] + 1));
        }
        switch (true) {
            case $dl_speed > 600:
                $dlc = 'red';
                break;
            case $dl_speed > 300:
                $dlc = 'orange';
                break;
            case $dl_speed > 200:
                $dlc = 'yellow';
                break;
            case $dl_speed < 100:
                $dlc = 'Chartreuse';
                break;
        }
        if ($arr["downloaded"] > 0) {
            $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
            $ratio = "<font color='" . get_ratio_color($ratio) . "'><b>{$lang['userdetails_s_ratio']}</b><br />{$ratio}</font>";
        } else {
            if ($arr["uploaded"] > 0) {
                $ratio = $lang['userdetails_inf'];
            } else {
                $ratio = "N/A";
            }
        }
        if (XBT_TRACKER === false) {
            $htmlout_snatch .= "<tr><td class='{$class}' align='center'>" . ($arr['owner'] == $id ? "<b><font color='orange'>{$lang['userdetails_s_towner']}</font></b><br />" : "" . ($arr['complete_date'] != '0' ? "<b><font color='lightgreen'>{$lang['userdetails_s_fin']}</font></b><br />" : "<b><font color='red'>{$lang['userdetails_s_nofin']}</font></b><br />") . "") . "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr['image']) . "' alt='" . htmlsafechars($arr['name']) . "' title='" . htmlsafechars($arr['name']) . "' /></td>" . "\n    <td class='{$class}'><a class='altlink' href='{$INSTALLER09['baseurl']}/details.php?id=" . (int) $arr['torrentid'] . "'><b>" . htmlsafechars($arr['torrent_name']) . "</b></a>" . ($arr['complete_date'] != '0' ? "<br /><font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['start_date'], 0, 1) . "</font><br />" : "<font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['start_date'], 0, 1) . "</font><br /><font color='orange'>{$lang['userdetails_s_laction']}" . get_date($arr['last_action'], 0, 1) . "</font>" . get_date($arr['complete_date'], 0, 1) . " " . ($arr['complete_date'] == '0' ? "" . ($arr['owner'] == $id ? "" : "[ " . mksize($arr["size"] - $arr["downloaded"]) . "{$lang['userdetails_s_still']}]") . "" : "") . "") . $lang['userdetails_s_finished'] . get_date($arr['complete_date'], 0, 1) . "" . ($arr['complete_date'] != '0' ? "<br /><font color='silver'>{$lang['userdetails_s_ttod']}" . ($arr['leechtime'] != '0' ? mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s']) . "") . "</font> <font color='{$dlc}'>[ {$lang['userdetails_s_dled']} {$dl_speed} ]</font><br />" : "<br />") . "<font color='lightblue'>" . ($arr['seedtime'] != '0' ? $lang['userdetails_s_tseed'] . mkprettytime($arr['seedtime']) . " </font><font color='{$dlc}'> " : $lang['userdetails_s_tseedn']) . "</font><font color='lightgreen'> [ {$lang['userdetails_s_uspeed']} " . $ul_speed . " ] </font>" . ($arr['complete_date'] == '0' ? "<br /><font color='{$dlc}'>{$lang['userdetails_s_dspeed']}{$dl_speed}</font>" : "") . "</td>" . "\n    <td align='center' class='{$class}'>{$lang['userdetails_s_seed']}" . (int) $arr['seeders'] . "<br />{$lang['userdetails_s_leech']}" . (int) $arr['leechers'] . "</td><td align='center' class='{$class}'><font color='lightgreen'>{$lang['userdetails_s_upld']}<br /><b>" . mksize($arr["uploaded"]) . "</b></font>" . ($INSTALLER09['ratio_free'] ? "" : "<br /><font color='orange'>{$lang['userdetails_s_dld']}<br /><b>" . mksize($arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . mksize($arr["size"]) . "" . ($INSTALLER09['ratio_free'] ? "" : "<br />{$lang['userdetails_s_diff']}<br /><font color='orange'><b>" . mksize($arr['size'] - $arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . $ratio . "<br />" . ($arr['seeder'] == 'yes' ? "<font color='lightgreen'><b>{$lang['userdetails_s_seeding']}</b></font>" : "<font color='red'><b>{$lang['userdetails_s_nseeding']}</b></font>") . "</td><td align='center' class='{$class}'>" . htmlsafechars($arr["agent"]) . "<br />{$lang['userdetails_s_port']}" . (int) $arr["port"] . "<br />" . ($arr["connectable"] == 'yes' ? "<b>{$lang['userdetails_s_conn']}</b> <font color='lightgreen'>{$lang['userdetails_yes']}</font>" : "<b>{$lang['userdetails_s_conn']}</b> <font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td></tr>\n";
        } else {
            $htmlout_snatch .= "<tr><td class='{$class}' align='center'>" . ($arr['owner'] == $id ? "<b><font color='orange'>{$lang['userdetails_s_towner']}</font></b><br />" : "" . ($arr['completedtime'] != '0' ? "<b><font color='lightgreen'>{$lang['userdetails_s_fin']}</font></b><br />" : "<b><font color='red'>{$lang['userdetails_s_nofin']}</font></b><br />") . "") . "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr['image']) . "' alt='" . htmlsafechars($arr['name']) . "' title='" . htmlsafechars($arr['name']) . "' /></td>" . "\n    <td class='{$class}'><a class='altlink' href='{$INSTALLER09['baseurl']}/details.php?id=" . (int) $arr['fid'] . "'><b>" . htmlsafechars($arr['torrent_name']) . "</b></a>" . ($arr['completedtime'] != '0' ? "<br /><font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['started'], 0, 1) . "</font><br />" : "<font color='yellow'>started:" . get_date($arr['started'], 0, 1) . "</font><br /><font color='orange'>{$lang['userdetails_s_laction']}" . get_date($arr['mtime'], 0, 1) . "</font>" . get_date($arr['completedtime'], 0, 1) . " " . ($arr['completedtime'] == '0' ? "" . ($arr['owner'] == $id ? "" : "[ " . mksize($arr["size"] - $arr["downloaded"]) . "{$lang['userdetails_s_still']}]") . "" : "") . "") . "{$lang['userdetails_s_finished']}" . get_date($arr['completedtime'], 0, 1) . "" . ($arr['completedtime'] != '0' ? "<br /><font color='silver'>{$lang['userdetails_s_ttod']}" . ($arr['leechtime'] != '0' ? mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s']) . "") . "</font> <font color='{$dlc}'>[ {$lang['userdetails_s_dled']} {$dl_speed} ]</font><br />" : "<br />") . "<font color='lightblue'>" . ($arr['seedtime'] != '0' ? "{$lang['userdetails_s_tseed']}" . mkprettytime($arr['seedtime']) . " </font><font color='{$dlc}'> " : "{$lang['userdetails_s_tseedn']}") . "</font><font color='lightgreen'> [{$lang['userdetails_s_uspeed']}" . $ul_speed . " ] </font>" . ($arr['completedtime'] == '0' ? "<br /><font color='{$dlc}'>{$lang['userdetails_s_dspeed']} {$dl_speed}</font>" : "") . "</td>" . "\n    <td align='center' class='{$class}'>{$lang['userdetails_s_seed']}" . (int) $arr['seeders'] . "<br />{$lang['userdetails_s_leech']}" . (int) $arr['leechers'] . "</td><td align='center' class='{$class}'><font color='lightgreen'>{$lang['userdetails_s_upld']}<br /><b>" . mksize($arr["uploaded"]) . "</b></font>" . ($INSTALLER09['ratio_free'] ? "" : "<br /><font color='orange'>{$lang['userdetails_s_dld']}<br /><b>" . mksize($arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . mksize($arr["size"]) . "" . ($INSTALLER09['ratio_free'] ? "" : "<br />{$lang['userdetails_s_diff']}<br /><font color='orange'><b>" . mksize($arr['size'] - $arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . $ratio . "<br />" . ($arr['active'] == 1 ? "<font color='lightgreen'><b>{$lang['userdetails_s_seeding']}</b></font>" : "<font color='red'><b>{$lang['userdetails_s_nseeding']}</b></font>") . "</td><td align='center' class='{$class}'>" . htmlsafechars($arr["peer_id"]) . "<br />" . ($arr["connectable"] == 1 ? "<b>{$lang['userdetails_s_conn']}</b> <font color='lightgreen'>{$lang['userdetails_yes']}</font>" : "<b>{$lang['userdetails_s_conn']}</b> <font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td></tr>\n";
        }
    }
    $htmlout_snatch .= "</table>\n";
    return $htmlout_snatch;
}
Esempio n. 20
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== Updated promote power users
    $limit = 25 * 1024 * 1024 * 1024;
    $minratio = 1.05;
    $maxdt = TIME_NOW - 86400 * 28;
    $res = sql_query("SELECT id, uploaded, downloaded, invites, modcomment FROM users WHERE class = " . UC_USER . " AND uploaded >= {$limit} AND uploaded / downloaded >= {$minratio} AND enabled='yes' AND added < {$maxdt}") or sqlerr(__FILE__, __LINE__);
    $msgs_buffer = $users_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        $subject = "Auto Promotion";
        $msg = "Congratulations, you have been Auto-Promoted to [b]Power User[/b]. :)\n You get one extra invite.\n";
        while ($arr = mysqli_fetch_assoc($res)) {
            $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
            $modcomment = $arr['modcomment'];
            $modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Promoted to Power User by System (UL=" . mksize($arr['uploaded']) . ", DL=" . mksize($arr['downloaded']) . ", R=" . $ratio . ").\n" . $modcomment;
            $modcom = sqlesc($modcomment);
            $msgs_buffer[] = '(0,' . $arr['id'] . ', ' . TIME_NOW . ', ' . sqlesc($msg) . ', ' . sqlesc($subject) . ')';
            $users_buffer[] = '(' . $arr['id'] . ', 1, 1, ' . $modcom . ')';
            $update['invites'] = $arr['invites'] + 1;
            $mc1->begin_transaction('user' . $arr['id']);
            $mc1->update_row(false, array('class' => 1, 'invites' => $update['invites']));
            $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
            $mc1->begin_transaction('user_stats_' . $arr['id']);
            $mc1->update_row(false, array('modcomment' => $modcomment));
            $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
            $mc1->begin_transaction('MyUser_' . $arr['id']);
            $mc1->update_row(false, array('class' => 1, 'invites' => $update['invites']));
            $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
            $mc1->delete_value('inbox_new_' . $arr['id']);
            $mc1->delete_value('inbox_new_sb_' . $arr['id']);
        }
        $count = count($users_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
            sql_query("INSERT INTO users (id, class, invites, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class), invites = invites+values(invites), modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup: Promoted " . $count . " member(s) from User to Power User");
        }
        unset($users_buffer, $msgs_buffer, $update, $count);
        status_change($arr['id']);
        //== For Retros announcement mod
    }
    //==
    if ($queries > 0) {
        write_log("Power User Updates -------------------- Power User Updates Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Esempio n. 21
0
/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                			    |
|--------------------------------------------------------------------------|
|   Licence Info: GPL			                                    |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V5					    |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless, Autotron, whocares, Swizzles.					    |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== 09 Auto invite by Bigjoos/pdq
    $ratiocheck = 1.0;
    $joined = TIME_NOW - 86400 * 90;
    $res = sql_query("SELECT id, uploaded, invites, downloaded, modcomment FROM users WHERE invites='1' AND class = " . UC_USER . " AND uploaded / downloaded <= {$ratiocheck} AND enabled='yes' AND added < {$joined}") or sqlerr(__FILE__, __LINE__);
    $msgs_buffer = $users_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        $subject = "Auto Invites";
        $msg = "Congratulations, your user group met a set out criteria therefore you have been awarded 2 invites  :)\n Please use them carefully. Cheers " . $INSTALLER09['site_name'] . " staff.\n";
        while ($arr = mysqli_fetch_assoc($res)) {
            $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
            $modcomment = $arr['modcomment'];
            $modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Awarded 2 bonus invites by System (UL=" . mksize($arr['uploaded']) . ", DL=" . mksize($arr['downloaded']) . ", R=" . $ratio . ") .\n" . $modcomment;
            $modcom = sqlesc($modcomment);
            $msgs_buffer[] = '(0,' . $arr['id'] . ', ' . TIME_NOW . ', ' . sqlesc($msg) . ', ' . sqlesc($subject) . ')';
            $users_buffer[] = '(' . $arr['id'] . ', 2, ' . $modcom . ')';
            //== 2 in the user_buffer is award amount :)
            $update['invites'] = $arr['invites'] + 2;
            //== 2 in the user_buffer is award amount :)
            $mc1->begin_transaction('user' . $arr['id']);
            $mc1->update_row(false, array('invites' => $update['invites']));
            $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
            $mc1->begin_transaction('user_stats_' . $arr['id']);
            $mc1->update_row(false, array('modcomment' => $modcomment));
            $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
            $mc1->begin_transaction('MyUser_' . $arr['id']);
            $mc1->update_row(false, array('invites' => $update['invites']));
            $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
            $mc1->delete_value('inbox_new_' . $arr['id']);
            $mc1->delete_value('inbox_new_sb_' . $arr['id']);
        }
        $count = count($users_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
            sql_query("INSERT INTO users (id, invites, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE invites = invites+values(invites), modcomment=values(modcomment)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup: Awarded 2 bonus invites to " . $count . " member(s) ");
        }
        unset($users_buffer, $msgs_buffer, $update, $count);
    }
    //==
    if ($queries > 0) {
        write_log("Auto Invites -------------------- Auto Cleanups cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Esempio n. 22
0
 function doAdd()
 {
     $id = intval($_GET['advid']);
     $rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__advertise` where id='{$id}'", ARRAY_A);
     $rs['starttime'] = get_date($rs['starttime'], 'Y-m-d');
     $rs['endtime'] = empty($rs['endtime']) ? '' : get_date($rs['endtime'], 'Y-m-d');
     $adv = stripslashes_deep(unserialize($rs['code']));
     empty($adv) && ($adv = array());
     empty($rs['style']) && ($rs['style'] = 'code');
     include admincp::tpl();
 }
function peer_list($array)
{
    global $INSTALLER09, $lang;
    $htmlout = '';
    $htmlout .= "<table width='100%' border='1' cellpadding='5' style='border-collapse:collapse'>\n                <tr>\n            <td align='center' class='colhead'>{$lang['catol_user']}</td>\n            <td align='center' class='colhead'>{$lang['catol_port']}&amp;{$lang['catol_ip']}</td>\n            <td align='center' class='colhead'>{$lang['catol_ratio']}</td>\n            <td align='center' class='colhead'>{$lang['catol_downloaded']}</td>\n            <td align='center' class='colhead'>{$lang['catol_uploaded']}</td>\n            <td align='center' class='colhead'>{$lang['catol_started']}</td>\n            <td align='center' class='colhead'>{$lang['catol_finished']}</td>\n       </tr>";
    foreach ($array as $p) {
        $time = max(1, TIME_NOW - $p["started"] - (TIME_NOW - $p["last_action"]));
        $htmlout .= "<tr>\n            <td align='center'><a href='userdetails.php?id=" . (int) $p["p_uid"] . "' >" . htmlsafechars($p["p_user"]) . "</a></td>\n            <td align='center'>" . ($CURUSER['class'] >= UC_STAFF ? htmlsafechars($p["ip"]) . " : " . (int) $p["port"] : "xx.xx.xx.xx:xxxx") . "</td>\n            <td align='center'>" . ($p["downloaded"] > 0 ? number_format($p["uploaded"] / $p["downloaded"], 2) : ($p["uploaded"] > 0 ? "&infin;" : "---")) . "</td>\n            <td align='center'>" . ($p["downloaded"] > 0 ? mksize($p["downloaded"]) . " @" . mksize(($p["downloaded"] - $p["downloadoffset"]) / $time) . "s" : "0kb") . "</td>\n            <td align='center'>" . ($p["uploaded"] > 0 ? mksize($p["uploaded"]) . " @" . mksize(($p["uploaded"] - $p["uploadoffset"]) / $time) . "s" : "0kb") . "</td>\n            <td align='center'>" . get_date($p["started"], 'LONG', 0, 1) . "</td>\n            <td align='center'>" . get_date($p["finishedat"], 'LONG', 0, 1) . "</td>\n            </tr>";
    }
    $htmlout .= "</table>";
    return $htmlout;
}
Esempio n. 24
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== Updated demote power users
    $minratio = 0.85;
    $res = sql_query("SELECT id, uploaded, downloaded, modcomment FROM users WHERE class = " . UC_POWER_USER . " AND uploaded / downloaded < {$minratio}") or sqlerr(__FILE__, __LINE__);
    $subject = "Auto Demotion";
    $msgs_buffer = $users_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        $msg = "You have been auto-demoted from [b]Power User[/b] to [b]User[/b] because your share ratio has dropped below  {$minratio}.\n";
        while ($arr = mysqli_fetch_assoc($res)) {
            $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
            $modcomment = $arr['modcomment'];
            $modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Demoted To User by System (UL=" . mksize($arr['uploaded']) . ", DL=" . mksize($arr['downloaded']) . ", R=" . $ratio . ").\n" . $modcomment;
            $modcom = sqlesc($modcomment);
            $msgs_buffer[] = '(0,' . $arr['id'] . ', ' . TIME_NOW . ', ' . sqlesc($msg) . ', ' . sqlesc($subject) . ')';
            $users_buffer[] = '(' . $arr['id'] . ', 0, ' . $modcom . ')';
            $mc1->begin_transaction('user' . $arr['id']);
            $mc1->update_row(false, array('class' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
            $mc1->begin_transaction('user_stats_' . $arr['id']);
            $mc1->update_row(false, array('modcomment' => $modcomment));
            $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
            $mc1->begin_transaction('MYuser_' . $arr['id']);
            $mc1->update_row(false, array('class' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
            $mc1->delete_value('inbox_new_' . $arr['id']);
            $mc1->delete_value('inbox_new_sb_' . $arr['id']);
        }
        $count = count($users_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
            sql_query("INSERT INTO users (id, class, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup: Demoted " . $count . " member(s) from Power User to User");
            status_change($arr['id']);
        }
        unset($users_buffer, $msgs_buffer, $count);
        status_change($arr['id']);
        //== For Retros announcement mod
    }
    //==End
    if ($queries > 0) {
        write_log("Power User Demote Updates -------------------- Power User Demote Updates Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Esempio n. 25
0
function cleanup_new_row($new_row)
{
    foreach ($new_row as $key => $value) {
        if (is_array($value) and isset($value['d'])) {
            $new_row[$key] = get_date($value);
        }
        if ($value == '') {
            $new_row[$key] = null;
        }
    }
    return $new_row;
}
Esempio n. 26
0
function peer_list($array)
{
    global $INSTALLER09, $lang;
    $htmlout = '';
    $htmlout .= "<table width='100%' border='1' cellpadding='5' style='border-collapse:collapse'>\r\n\t\t        <tr>\r\n       \t\t  <td align='center' class='colhead'>User</td>\r\n            <td align='center' class='colhead'>Port&amp;Ip</td>\r\n            <td align='center' class='colhead'>Ratio</td>\r\n            <td align='center' class='colhead'>Downloaded</td>\r\n            <td align='center' class='colhead'>Uploaded</td>\r\n            <td align='center' class='colhead'>Started</td>\r\n            <td align='center' class='colhead'>Finished</td>\r\n       </tr>";
    foreach ($array as $p) {
        $time = max(1, time() - $p["started"] - (time() - $p["last_action"]));
        $htmlout .= "<tr>\r\n       \t\t<td align='center'><a href='userdetails.php?id={$p["p_uid"]}' >{$p["p_user"]}</a></td>\r\n            <td align='center'>" . ($CURUSER['class'] >= UC_MODERATOR ? $p["ip"] . ":" . $p["port"] : "xx.xx.xx.xx:xxxx") . "</td>\r\n            <td align='center'>" . ($p["downloaded"] > 0 ? number_format($p["uploaded"] / $p["downloaded"], 2) : ($p["uploaded"] > 0 ? "&infin;" : "---")) . "</td>\r\n            <td align='center'>" . ($p["downloaded"] > 0 ? mksize($p["downloaded"]) . " @" . mksize(($p["downloaded"] - $p["downloadoffset"]) / $time) . "s" : "0kb") . "</td>\r\n            <td align='center'>" . ($p["uploaded"] > 0 ? mksize($p["uploaded"]) . " @" . mksize(($p["uploaded"] - $p["uploadoffset"]) / $time) . "s" : "0kb") . "</td>\r\n            <td align='center'>" . get_date($p["started"], 'LONG', 0, 1) . "</td>\r\n            <td align='center'>" . get_date($p["finishedat"], 'LONG', 0, 1) . "</td>\r\n\t\t\t</tr>";
    }
    $htmlout .= "</table>";
    return $htmlout;
}
Esempio n. 27
0
function plugin_loglist_convert()
{
    global $script, $log;
    global $vars;
    global $_loglist_messages;
    list($kind) = func_get_args();
    $kind = empty($kind) ? 'update' : htmlsc($kind, ENT_QUOTES);
    if (!$log[$kind]['use']) {
        return $_loglist_messages['not_active'];
    }
    if (!empty($log[$kind]['file'])) {
        $vars['kind'] = $kind;
        $rc = do_plugin_action('logview');
        return $rc['body'];
    }
    $dir = log::get_filename($kind, '', '');
    $pages = Auth::get_existpages($dir);
    if (count($pages) == 0) {
        return $_loglist_messages['msg_not_found'];
    }
    $data = array();
    foreach ($pages as $_real => $_page) {
        $data[] = array(filemtime($dir . '/' . $_real), $_page, log_count($kind, $_page));
    }
    usort($data, function ($a, $b) {
        return $b[0] - $a[0];
    });
    // D
    // usort($data,create_function('$a,$b','return $a[0] - $b[0];')); // A
    //$str_view = $script.'?plugin=logview&kind='.$kind.'&page=';
    $str_view = get_cmd_uri('logview', $_page, null, array('kind' => $kind));
    $rc = '';
    $rc .= '|' . $_loglist_messages['fld_UTIME'] . '|' . $_loglist_messages['fld_PAGE'] . '|' . $_loglist_messages['fld_COUNT'] . "|h\n";
    foreach ($data as $_line) {
        $i = 0;
        foreach ($_line as $_field) {
            $rc .= '|';
            switch ($i) {
                case 0:
                    $rc .= get_date('Y-m-d H:i:s', $_field) . ' ' . get_passage($_field);
                    continue;
                case 1:
                    $rc .= '[' . $str_view . rawurlencode($_field) . ' ' . $_field . ']';
                    continue;
                default:
                    $rc .= $_field;
            }
            $i++;
        }
        $rc .= "|\n";
    }
    return RendererFactory::factory($rc);
}
Esempio n. 28
0
 function alterinfo()
 {
     if ($this->post->groupid != 3 && $this->atcdb['postdate'] + 300 < $GLOBALS['timestamp']) {
         global $altername, $db_anonymousname, $timeofedit, $timestamp;
         $altername = $this->data['anonymous'] && $this->post->uid == $this->atcdb['authorid'] ? $db_anonymousname : $this->post->username;
         $timeofedit = get_date($timestamp);
         $alterinfo = getLangInfo('post', 'edit_post');
     } else {
         $alterinfo = '';
     }
     return $alterinfo;
 }
Esempio n. 29
0
 function load($limit = 5)
 {
     $db = new DB("notifications");
     $db->setColPrefix("notification_");
     $db->setSort("notification_added DESC");
     if (intval($limit)) {
         $db->setLimit($limit);
     }
     $db->select("notification_user = '******'");
     if ($db->numRows()) {
         $return = "";
         while ($db->nextRecord()) {
             $return .= "<li>";
             switch ($db->type) {
                 case 'friend':
                     $data = json_decode($db->data);
                     $user = new Acl($data->user);
                     switch ($data->type) {
                         case 'accept':
                             $return .= "<b><a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a></b> <small>" . get_date($db->added) . "</small> <br /> " . _t("Has accepted your friend request");
                             break;
                         case 'decline':
                             $return .= "<b><a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a></b> <small>" . get_date($db->added) . "</small> <br /> " . _t("Has declined your friend request");
                             break;
                         case 'remove':
                             $return .= "<b><a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a></b> <small>" . get_date($db->added) . "</small> <br /> " . _t("Has removed you from his friends list");
                             break;
                     }
                     break;
                 case 'system':
                     $data = json_decode($db->data);
                     $group = new DB("groups");
                     $group->setColPrefix("group_");
                     $group->select("group_id = '" . $data->group . "'");
                     $group->nextRecord();
                     switch ($data->type) {
                         case 'upgrade':
                             $return .= _t("You have been upgraded to ") . "<b>" . $group->name . "</b><br /><small>" . get_date($db->added) . "</small>";
                             break;
                         case 'downgrade':
                             $return .= _t("You have been demoted to ") . "<b>" . $group->name . "</b><br /><small>" . get_date($db->added) . "</small>";
                             break;
                     }
                     break;
             }
             $return .= "</li>";
         }
     } else {
         $return = "<li>" . _t("No notifications found") . "</li>";
     }
     echo $return;
 }
Esempio n. 30
0
function stealth($id, $stealth = true)
{
    global $CURUSER, $mc1, $INSTALLER09;
    $setbits = $clrbits = 0;
    if ($stealth) {
        $display = 'is';
        $setbits |= bt_options::PERMS_STEALTH;
        // stealth on
    } else {
        $display = 'is not';
        $clrbits |= bt_options::PERMS_STEALTH;
        // stealth off
    }
    // update perms
    if ($setbits || $clrbits) {
        sql_query('UPDATE users SET perms = ((perms | ' . $setbits . ') & ~' . $clrbits . ') 
                 WHERE id = ' . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
    }
    // grab current data
    $res = sql_query('SELECT username, perms, modcomment FROM users 
                     WHERE id = ' . sqlesc($id) . ' LIMIT 1') or sqlerr(__FILE__, __LINE__);
    $row = mysqli_fetch_assoc($res);
    $row['perms'] = (int) $row['perms'];
    $modcomment = get_date(TIME_NOW, '', 1) . ' - ' . $display . ' in Stealth Mode thanks to ' . $CURUSER['username'] . "\n" . $row['modcomment'];
    sql_query('UPDATE users SET modcomment = ' . sqlesc($modcomment) . ' WHERE id = ' . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
    // update caches
    $mc1->begin_transaction('user' . $id);
    $mc1->update_row(false, array('perms' => $row['perms']));
    $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
    $mc1->begin_transaction('MyUser_' . $id);
    $mc1->update_row(false, array('perms' => $row['perms']));
    $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
    $mc1->begin_transaction('user_stats_' . $id);
    $mc1->update_row(false, array('modcomment' => $modcomment));
    $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
    if ($id == $CURUSER['id']) {
        $mc1->begin_transaction('user' . $CURUSER['id']);
        $mc1->update_row(false, array('perms' => $row['perms']));
        $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
        $mc1->begin_transaction('MyUser_' . $CURUSER['id']);
        $mc1->update_row(false, array('perms' => $row['perms']));
        $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
        $mc1->begin_transaction('user_stats_' . $CURUSER['id']);
        $mc1->update_row(false, array('modcomment' => $modcomment));
        $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
    }
    write_log('Member [b][url=userdetails.php?id=' . $id . ']' . htmlsafechars($row['username']) . '[/url][/b] ' . $display . ' in Stealth Mode thanks to [b]' . $CURUSER['username'] . '[/b]');
    // header ouput
    $mc1->cache_value('display_stealth' . $CURUSER['id'], $display, 5);
    header('Location: userdetails.php?id=' . $id);
    exit;
}