<?php

/////////////////////////
// LATEST COMMENTS
/////////////////////////
$tpl->setCacheKey('cached/latest_comment.tpl', 'latest_comment');
if ($tpl->isCached('cached/latest_comment.tpl', 60) == false) {
    $rs = $db->select('SELECT
            c.date      AS date,
            c.name      AS name,
            c.message   AS message

            FROM  map_comment AS c
            JOIN  map         AS m ON c.map_id=m.id

            WHERE     c.status = 1
            AND       m.date < ' . time() . '
            AND       m.status = 1

            ORDER BY c.date DESC', 0, 14);
    foreach ($rs['result'] as $key => $item) {
        $tpl->assignLoopVar('comment', array('date' => timeWarp($item['date']), 'name' => $item['name'], 'message' => encodeCurly(cutText($item['message'], 120))));
    }
}
示例#2
0
/////////////////////////
// COMMENT
/////////////////////////
$rs = $db->select('SELECT
        c.id                    AS id,
        c.parent_id             AS parent_id,
        c.date                  AS date,
        c.name                  AS name,
        c.message               AS message,
        m.id                    AS map_id,
        m.title                 AS map_title,
        m.guid                  AS map_guid,
        m.image_id              AS image,
        g.guid                  AS game_guid,
        t.guid                  AS gametype_guid

                FROM      map_comment     AS c
        JOIN      map             AS m    ON m.id = c.map_id
        JOIN      game            AS g    ON m.game_id = g.id
        JOIN      gametype        AS t    ON m.gametype_id = t.id

        WHERE c.status = 1
        ORDER BY c.date DESC', 0, 50);
foreach ($rs['result'] as $comment) {
    $tpl->assignLoopVar('comment', array('time' => timeWarp($comment['date']), 'name' => $comment['name'], 'message' => $comment['message'], 'id' => $comment['id'], 'class' => $comment['parent_id'] != 0 ? 'repply' : 'main', 'image' => $comment['image'], 'map_id' => $comment['map_id'], 'map_title' => $comment['map_title'], 'map_guid' => $comment['map_guid'], 'game_guid' => $comment['game_guid'], 'gametype_guid' => $comment['gametype_guid'], 'author_guid' => $comment['author_guid']));
}
/////////////////////////
// RESULT INFOS
/////////////////////////
$to = 1;
$tpl->assignVar(array('result_from' => number_format(50 + 1, 0, '', ','), 'result_to' => number_format($to > $rs['total'] ? $rs['total'] : $to, 0, '', ','), 'result_total' => number_format($rs['total'], 0, '', ',')));
示例#3
0
    $rs_response = $db->select('SELECT date, parent_id, name, message
    		FROM map_comment
    		WHERE parent_id IN (' . implode(',', $idList) . ') AND status = 1
    		ORDER BY date ASC');
    $n = 0;
    foreach ($rs['result'] as $comment) {
        $message = nl2br($comment['message']);
        $message = preg_replace('/([\\t\\r\\n\\v\\f]+)/is', '', $message);
        $message = preg_replace('/((?:<br \\/>){2,})/is', '<br /><br />', $message);
        $tpl->assignLoopVar('comment', array('time' => timeWarp($comment['date']), 'name' => encodeCurly($comment['name']), 'message' => encodeCurly($message), 'id' => $comment['id']));
        foreach ($rs_response['result'] as $response) {
            if ($response['parent_id'] == $comment['id']) {
                $message = nl2br($response['message']);
                $message = preg_replace('/([\\t\\r\\n\\v\\f]+)/is', '', $message);
                $message = preg_replace('/((?:<br \\/>){2,})/is', '<br /><br />', $message);
                $tpl->assignLoopVar('comment.response', array('time' => timeWarp($response['date']), 'name' => encodeCurly($response['name']), 'message' => encodeCurly($message)));
            }
        }
        $n++;
        if ($n > COMMENT_PER_PAGE) {
            break;
        }
    }
} else {
    $tpl->assignVar('commentDisplay', 'none');
    $tpl->assignVar('commentClass', 'off');
}
/////////////////////////
// PAGINATION
/////////////////////////
$pageTotal = ceil($rs['total'] / COMMENT_PER_PAGE);
示例#4
0
            echo "<br>Skipping because tf not active: " . $tf->get_value("tfName");
            continue 2;
        }
        $tf = new tf();
        $tf->set_id($transactionRepeat->get_value("fromTfID"));
        $tf->select();
        if (!$tf->get_value("tfActive")) {
            echo "<br>Skipping because tf not active: " . $tf->get_value("tfName");
            continue 2;
        }
        $amount = page::money_out($transactionRepeat->get_value("currencyTypeID"), $transactionRepeat->get_value("amount"));
        $transaction = new transaction();
        $transaction->set_value("fromTfID", $transactionRepeat->get_value("fromTfID"));
        $transaction->set_value("tfID", $transactionRepeat->get_value("tfID"));
        $transaction->set_value("companyDetails", $transactionRepeat->get_value("companyDetails"));
        $transaction->set_value("amount", $amount);
        $transaction->set_value("currencyTypeID", $transactionRepeat->get_value("currencyTypeID"));
        $transaction->set_value("product", $transactionRepeat->get_value("product"));
        $transaction->set_value("transactionType", $transactionRepeat->get_value("transactionType"));
        $transaction->set_value("status", "pending");
        $transaction->set_value("transactionRepeatID", $transactionRepeat->get_id());
        $transaction->set_value("transactionDate", date("Y-m-d", $nextScheduled));
        $transaction->save();
        echo "\n<br>" . $transaction->get_value("transactionDate");
        echo " " . $transactionRepeat->get_value("paymentBasis") . " \$" . $transaction->get_value("amount") . " for TF: " . tf::get_name($transaction->get_value("tfID"));
        echo " (transactionID: " . $transaction->get_id() . " transactionRepeatID:" . $transactionRepeat->get_id() . " name:" . $transactionRepeat->get_value("product") . ")";
        $nextScheduled = timeWarp($nextScheduled, $timeBasisString);
    }
}
$TPL["main_alloc_title"] = "Execute Repeating Expenses - " . APPLICATION_NAME;
include_template("templates/checkRepeatM.tpl");