Example #1
0
 /**
  * 书籍管理主页
  * 
  * @author frenlee <*****@*****.**>
  * @since 2015年5月13日 上午10:39:17
  */
 function index($catid = '', $start = '', $end = '', $p = '0')
 {
     $m = D('Booklist');
     $map = array();
     $limit = page_limit($p);
     $order = 'id desc';
     $data = $m->where($map)->order($order)->limit($limit)->select();
     $this->assign('info', $data);
     //列表数据
     $this->display();
 }
 function showList($id = '', $p = '0')
 {
     if (empty($id)) {
         return false;
     }
     $b = M('booklist');
     $book = $b->field('isbn,title,today')->find($id);
     $this->assign('book', $book);
     $map = array('bookid' => $id);
     $m = D('Annotations');
     $limit = page_limit($p);
     $data = $m->where($map)->limit($limit)->select();
     $this->assign('info', $data);
     $this->display();
 }
Example #3
0
 /**
  * 首页
  * @param number $p
  * @author frenlee <*****@*****.**>
  * @since 2015年5月14日 下午1:24:54
  */
 function index($p = 0)
 {
     $m = D('Type');
     if (IS_POST) {
         //添加
         $data = $m->create();
         if ($data) {
             $m->add();
             $this->ajaxReturn(ajax_return_data());
         } else {
             $this->ajaxReturn(ajax_return_data(1, $m->getError()));
         }
     }
     //显示
     $limit = page_limit($p);
     $data = $m->limit($limit)->select();
     $this->assign('info', $data);
     $this->display();
 }
 public function index()
 {
     $page = rintval(I('get.p', 1));
     $start = null;
     $limit = $this->limit;
     list($start, $limit, $page) = page_limit($page, $limit);
     $count = null;
     $list = array();
     $order = 'aid desc';
     $search = I('get.');
     $this->__proFilter($search);
     $data = $this->objListServ->getAdminArticleList($search, $start, $limit, $order);
     list($count, $list) = $data;
     $this->_assignPage($count, $limit, $search);
     $this->__assignCate();
     $this->assign('count', $count);
     $this->assign('list', $list);
     $search['act_url'] = U('Home/Admin/Index/index');
     $this->assign('search', $search);
     $this->loadSystemView();
 }
Example #5
0
        }
        foreach ($TimelineIn as $Month) {
            list($Label, $Amount) = $Month;
            $Labels[] = $Label;
            $InFlow[] = number_format($Amount / $Max * 100, 4);
        }
        foreach ($TimelineOut as $Month) {
            list($Label, $Amount) = $Month;
            $OutFlow[] = number_format($Amount / $Max * 100, 4);
        }
        $Cache->cache_value('users_timeline', array($Labels, $InFlow, $OutFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2));
    }
}
//End timeline generation
define('DAYS_PER_PAGE', 100);
list($Page, $Limit) = page_limit(DAYS_PER_PAGE);
$RS = $DB->query("SELECT\n\t\tSQL_CALC_FOUND_ROWS\n\t\tj.Date,\n\t\tDATE_FORMAT(j.Date,'%Y-%m') AS Month,\n\t\tCASE ISNULL(j.Flow)\n\t\t\tWHEN 0 THEN j.Flow\n\t\t\tELSE '0'\n\t\tEND AS Joined,\n\t\tCASE ISNULL(m.Flow)\n\t\t\tWHEN 0 THEN m.Flow\n\t\t\tELSE '0'\n\t\tEND AS Manual,\n\t\tCASE ISNULL(r.Flow)\n\t\t\tWHEN 0 THEN r.Flow\n\t\t\tELSE '0'\n\t\tEND AS Ratio,\n\t\tCASE ISNULL(i.Flow)\n\t\t\tWHEN 0 THEN i.Flow\n\t\t\tELSE '0'\n\t\tEND AS Inactivity\n\t\tFROM (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(JoinDate,'%Y-%m-%d') AS Date,\n\t\t\t\tCOUNT(UserID) AS Flow\n\t\t\t\tFROM users_info\n\t\t\t \tWHERE JoinDate != '0000-00-00 00:00:00'\n\t\t\t\tGROUP BY Date\n\t\t) AS j\n\t\tLEFT JOIN (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(BanDate,'%Y-%m-%d') AS Date,\n\t\t\t \tCOUNT(UserID) AS Flow\n\t\t\t \tFROM users_info\n\t\t\t \tWHERE BanDate != '0000-00-00 00:00:00'\n\t\t\t \tAND BanReason = '1'\n\t\t\t \tGROUP BY Date\n\t\t) AS m ON j.Date=m.Date\n\t\tLEFT JOIN (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(BanDate,'%Y-%m-%d') AS Date,\n\t\t\t \tCOUNT(UserID) AS Flow\n\t\t\t \tFROM users_info\n\t\t\t \tWHERE BanDate != '0000-00-00 00:00:00'\n\t\t\t \tAND BanReason = '2'\n\t\t\t \tGROUP BY Date\n\t\t) AS r ON j.Date=r.Date\n\t\tLEFT JOIN (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(BanDate,'%Y-%m-%d') AS Date,\n\t\t\t \tCOUNT(UserID) AS Flow\n\t\t\t \tFROM users_info\n\t\t\t \tWHERE BanDate != '0000-00-00 00:00:00'\n\t\t\t \tAND BanReason = '3'\n\t\t\t \tGROUP BY Date\n\t\t) AS i ON j.Date=i.Date\n\t\tORDER BY j.Date DESC\n\t\tLIMIT {$Limit}");
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
show_header('User Flow');
?>
<div class="thin">
<?php 
if (!isset($_GET['page'])) {
    ?>
	<div class="box pad">
		<img src="http://chart.apis.google.com/chart?cht=lc&chs=820x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?php 
    echo implode('|', $Labels);
    ?>
&chxr=0,0,<?php 
Example #6
0
	function create_footer(){
	// Bottom pagination
?>
	<div class="linkbox">
<?
//---------------------------------------------------
		list($Page,$Limit) = page_limit(REQUESTS_PER_PAGE);
		echo get_pages($Page,$this->Results,REQUESTS_PER_PAGE, 11);
//--------------------------------------------------------
?>
	</div>
</div>
<?
	} // create_footer
Example #7
0
            $Bans = $Cache->get_value('ip_bans');
            $Cache->begin_transaction();
            $Cache->update_row($_POST['id'], array($_POST['id'], $Start, $End));
            $Cache->commit_transaction();
        } else {
            //Create
            $DB->query("INSERT INTO ip_bans\n\t\t\t\t(FromIP, ToIP, Reason) VALUES\n\t\t\t\t('{$Start}','{$End}', '{$Notes}')");
            $ID = $DB->inserted_id();
            $Bans = $Cache->get_value('ip_bans');
            $Bans[$ID] = array($ID, $Start, $End);
            $Cache->cache_value('ip_bans', $Bans, 0);
        }
    }
}
define('BANS_PER_PAGE', '20');
list($Page, $Limit) = page_limit(BANS_PER_PAGE);
$sql = "SELECT SQL_CALC_FOUND_ROWS ID, FromIP, ToIP, Reason FROM ip_bans AS i ";
if (!empty($_REQUEST['notes'])) {
    $sql .= "WHERE Reason LIKE '%" . db_string($_REQUEST['notes']) . "%' ";
}
if (!empty($_REQUEST['ip']) && preg_match('/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $_REQUEST['ip'])) {
    if (!empty($_REQUEST['notes'])) {
        $sql .= "AND '" . ip2unsigned($_REQUEST['ip']) . "' BETWEEN FromIP AND ToIP ";
    } else {
        $sql .= "WHERE '" . ip2unsigned($_REQUEST['ip']) . "' BETWEEN FromIP AND ToIP ";
    }
}
$sql .= "ORDER BY FromIP ASC";
$sql .= " LIMIT " . $Limit;
$Bans = $DB->query($sql);
$DB->query('SELECT FOUND_ROWS()');
Example #8
0
/*
User topic subscription page
*/
if (!empty($LoggedUser['DisableForums'])) {
    print json_encode(array('status' => 'failure'));
    die;
}
include SERVER_ROOT . '/classes/class_text.php';
// Text formatting class
$Text = new TEXT();
if (isset($LoggedUser['PostsPerPage'])) {
    $PerPage = $LoggedUser['PostsPerPage'];
} else {
    $PerPage = POSTS_PER_PAGE;
}
list($Page, $Limit) = page_limit($PerPage);
if ($LoggedUser['CustomForums']) {
    unset($LoggedUser['CustomForums']['']);
    $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
    $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
}
$ShowUnread = !isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread'];
$ShowCollapsed = !isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse'];
$sql = 'SELECT
	SQL_CALC_FOUND_ROWS
	MAX(p.ID) AS ID
	FROM forums_posts AS p
	LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
	JOIN users_subscriptions AS s ON s.TopicID = t.ID
	LEFT JOIN forums AS f ON f.ID = t.ForumID
	LEFT JOIN forums_last_read_topics AS l ON p.TopicID = l.TopicID AND l.UserID = s.UserID
Example #9
0
define ("DB_PASSWORD", "' . DB_PASSWORD . '"); // пароль для доступа к БД
define ("SITE_NAME",   "' . SITE_NAME . '"); // название сайта
define ("TEMPLATE",    "' . TEMPLATE . '"); // тема оформления
define ("VERSION",     "' . VERSION . '"); // текущая версия CMS
define ("LOG_LEVEL",   "' . $_POST['log_level'] . '"); // уровень детализации журнала
?>';
    $fop = fopen($_SERVER["DOCUMENT_ROOT"] . '/config.php', 'w');
    if ($fwr = fwrite($fop, $w_string)) {
        fclose($fop);
        $message = 'Настройки журнала обновлены';
    } else {
        $error = 'Возникла ошибка при обновлении настроек журнала';
    }
}
// Выводим журнал
if (($_GET['action'] == 'list' || $_GET['action'] == 'delete') && empty($error)) {
    $limit = '10';
    // количесвто результатов на страницу
    page_limit($limit);
    // считаем количество страниц
    // поля разрешенные для сортировки
    !in_array($_GET['order'], array('user', 'type', 'status', 'ip', 'date')) ? $order = 'date' : ($order = $_GET['order']);
    $user_list = $db->getIndCol("id", "SELECT id, login FROM " . DB_PREFIX . "_users");
    $log_list = $db->getAll("SELECT * FROM " . DB_PREFIX . "_logs ORDER BY ?n DESC LIMIT ?i, ?i", $order, $start, $end);
    $tpl = 'logs_list_tpl.php';
}
// Выводим найстройки журнала
if ($_GET['action'] == 'settings' && empty($error)) {
    $tpl = 'logs_settings_tpl.php';
}
include "logs_main_tpl.php";
Example #10
0
//---------- Things to sort out before it can start printing/generating content

// Check for lame SQL injection attempts
$ForumID = $_GET['forumid'];
if(!is_number($ForumID)) {
	error(0);
}

if (isset($LoggedUser['PostsPerPage'])) {
	$PerPage = $LoggedUser['PostsPerPage'];
} else {
	$PerPage = POSTS_PER_PAGE;
}

list($Page,$Limit) = page_limit(TOPICS_PER_PAGE);

//---------- Get some data to start processing

// Caching anything beyond the first page of any given forum is just wasting ram
// users are more likely to search then to browse to page 2
if($Page==1) {
	list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
}
if(!isset($Forum) || !is_array($Forum)) {
	$DB->query("SELECT
		t.ID,
		t.Title,
		t.AuthorID,
		author.Username AS AuthorUsername,
		t.IsLocked,
Example #11
0
define('ASN_PER_PAGE', 100);
if (!check_perms('users_view_ips')) {
    error(403);
}
$UserID = $_GET['userid'];
if (!is_number($UserID)) {
    error(404);
}
$UsersOnly = $_GET['usersonly'];
$DB->query("SELECT UserName FROM users_main WHERE ID = {$UserID}");
list($Username) = $DB->next_record();
show_header("ASN history for {$Username}");
?>
<div class="thin">
<?php 
list($Page, $Limit) = page_limit(ASN_PER_PAGE);
if ($UsersOnly == 1) {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t        h1.ASN,\n\t       \th1.StartTime,\n\t       \th1.EndTime,\n\t        GROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t        GROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t   \tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t        FROM users_history_asns AS h1\n\t        LEFT JOIN users_history_asns AS h2 ON h2.ASN=h1.ASN AND h2.UserID!={$UserID}\n\t        LEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t        LEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tAND h2.UserID>0\n\t        GROUP BY h1.ASN, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
} else {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t\th1.ASN, \n\t\th1.StartTime, \n\t\th1.EndTime,\n\t\tGROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t\tFROM users_history_asns AS h1\n\t\tLEFT JOIN users_history_asns AS h2 ON h2.ASN=h1.ASN AND h2.UserID!={$UserID}\n\t\tLEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t\tLEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tGROUP BY h1.ASN, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
}
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
$DB->set_query_id($RS);
$Pages = get_pages($Page, $NumResults, ASN_PER_PAGE, 9);
?>
	<h2>ASN history for <a href="/user.php?id=<?php 
echo $UserID;
?>
"><?php 
echo $Username;
Example #12
0
<?
define('COLLAGES_PER_PAGE', 25);

include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;

list($Page,$Limit) = page_limit(COLLAGES_PER_PAGE);


$OrderVals = array('Time', 'Name', 'Torrents');
$WayVals = array('Ascending', 'Descending');
$OrderTable = array('Time'=>'ID', 'Name'=>'c.Name', 'Torrents'=>'NumTorrents');
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');

// Are we searching in bodies, or just names?
if(!empty($_GET['type'])) {
	$Type = $_GET['type'];
	if(!in_array($Type, array('c.name', 'description'))) {
		$Type = 'c.name';
	}
} else {
	$Type = 'c.name';
}

if(!empty($_GET['search'])) {
	// What are we looking for? Let's make sure it isn't dangerous.
	$Search = strtr(db_string(trim($_GET['search'])),$SpecialChars);
	// Break search string down into individual words
	$Words = explode(' ', $Search);
}
Example #13
0
<?
if(!check_perms('site_torrents_notify')) { error(403); }

define('NOTIFICATIONS_PER_PAGE', 50);
list($Page,$Limit) = page_limit(NOTIFICATIONS_PER_PAGE);

$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS
		t.ID,
		g.ID,
		g.Name,
		g.CategoryID,
		g.TagList,
		t.Size,
		t.FileCount,
		t.Format,
		t.Encoding,
		t.Media,
		t.Scene,
		t.RemasterYear,
		g.Year,
		t.RemasterYear,
		t.RemasterTitle,
		t.Snatched,
		t.Seeders,
		t.Leechers,
		t.Time,
		unt.UnRead,
		unt.FilterID,
		unf.Label
		FROM users_notify_torrents AS unt
		JOIN torrents AS t ON t.ID=unt.TorrentID
Example #14
0
	parse_str($LoggedUser['DefaultSearch'],$_GET);
}

// If a user is hammering the search page (either via a <script type="text/javascript">, or just general zeal)
if($_SERVER['QUERY_STRING'] != '' && !check_perms('torrents_search_fast') && $_SERVER['QUERY_STRING'] != 'action=basic' && $_SERVER['QUERY_STRING'] != 'action=advanced') {
	if($LoggedUser['last_browse']>time()-1) {
		error('You can only search for torrents once every second.');
	} else {
		$_SESSION['logged_user']['last_browse'] = time();
	}
}

$OrderBy="s3"; // We order by GroupTime by default
$OrderWay="DESC"; // We also order descending by default

list($Page,$Limit) = page_limit(TORRENTS_PER_PAGE);

if (preg_match('/^s[1-7]$/',$_GET['order_by'])) { $OrderBy=strtolower($_GET['order_by']); }
if (in_array(strtolower($_GET['order_way']),array('desc','asc'))) { $OrderWay=strtoupper($_GET['order_way']); }

// Uploaded, seeding, leeching, snatched lists
if($_GET['userid'] && is_number($_GET['userid'])) {
	$UserID=ceil($_GET['userid']);
	
	$DB->query("SELECT Paranoia FROM users_main WHERE ID='".$UserID."'");
	list($Paranoia)=$DB->next_record();

	$TorrentWhere='';
	$TorrentJoin='';
	if($_GET['type']=="uploaded") {
		if(!check_perms('users_view_uploaded') && $UserID != $LoggedUser['ID'] && $Paranoia>=3) { error(403); }
Example #15
0
function get_catalog_list($limit)
{
    global $db;
    global $start;
    global $end;
    page_limit($limit);
    $result = $db->getAll('SELECT id, title, phone, city, street, build FROM ' . DB_PREFIX . '_catalog ORDER BY id LIMIT ?i, ?i', $start, $end);
    return $result;
}
Example #16
0
	page = 1 is the same as no page

********************************************************************************/

//---------- Things to sort out before it can start printing/generating content

include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;

// Check for lame SQL injection attempts
$CollageID = $_GET['collageid'];
if(!is_number($CollageID)) { 
	error(0);
}

list($Page,$Limit) = page_limit(POSTS_PER_PAGE);

//Get the cache catalogue
$CatalogueID = floor((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)/THREAD_CATALOGUE);
$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;

//---------- Get some data to start processing

// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
if(!list($Catalogue,$Posts) = $Cache->get_value('collage_'.$CollageID.'_catalogue_'.$CatalogueID)) {
	$DB->query("SELECT SQL_CALC_FOUND_ROWS
		ID,
		UserID,
		Time,
		Body
		FROM collages_comments
Example #17
0
<?


$UserID = $LoggedUser['ID'];


if(empty($_GET['action'])) { $Section = 'inbox'; }
else {
	$Section = $_GET['action']; // either 'inbox' or 'sentbox'
}
if(!in_array($Section, array('inbox', 'sentbox'))) { error(404); }

list($Page,$Limit) = page_limit(MESSAGES_PER_PAGE);

show_header('Inbox');
show_message();
?>
<div class="thin">
	<h2><?php 
echo $Section == 'sentbox' ? 'Sentbox' : 'Inbox';
?>
</h2>
	<div class="linkbox">
<?

if($Section == 'inbox') { ?>
		<a href="inbox.php?action=sentbox">[Sentbox]</a>
<? } elseif($Section == 'sentbox') { ?>
		<a href="inbox.php">[Inbox]</a>
<? }
Example #18
0
There's no real point in caching this page. I doubt users load it that 
much.
************************************************************************/

// Number of users per page 
define('FRIENDS_PER_PAGE', '20');



show_header('Friends');
 

$UserID = $LoggedUser['ID'];


list($Page,$Limit) = page_limit(FRIENDS_PER_PAGE);

// Main query
$Friends = $DB->query("SELECT 
	SQL_CALC_FOUND_ROWS
	f.FriendID,
	f.Comment,
	m.Username,
	m.Uploaded,
	m.Downloaded,
	m.PermissionID,
	m.Enabled,
	m.Paranoia,
	i.Donor,
	i.Warned,
	m.Title,
Example #19
0
<?
/************************************************************************

 ************************************************************************/
if(!check_perms('admin_reports')) {
	error(404);
}

// Number of reports per page
define('REPORTS_PER_PAGE', '10');
include(SERVER_ROOT.'/classes/class_text.php');
$Text = NEW TEXT;

list($Page,$Limit) = page_limit(REPORTS_PER_PAGE);

include(SERVER_ROOT.'/sections/reports/array.php');

// Header
show_header('Reports');

$Reports = $DB->query("SELECT SQL_CALC_FOUND_ROWS r.ID, r.UserID, um.Username, r.ThingID, r.Type, r.ReportedTime, r.Reason FROM reports AS r JOIN users_main AS um ON r.UserID=um.ID WHERE Status='New' ORDER BY ReportedTime DESC LIMIT ".$Limit);

// Number of results (for pagination)
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();

// Done with the number of results. Move $DB back to the result set for the reports
$DB->set_query_id($Reports);

// Start printing stuff
?>
Example #20
0
<?
if(empty($_GET['nojump'])) {
	$ArticleID = $Alias->to_id($_GET['search']);
	if($ArticleID) { //Found Article
		header('Location: wiki.php?action=article&id='.$ArticleID);
	}
}

define('ARTICLES_PER_PAGE', 25);
list($Page,$Limit) = page_limit(ARTICLES_PER_PAGE);

$OrderVals = array('Title', 'Created', 'Edited');
$WayVals = array('Ascending', 'Descending');
$TypeTable = array('Title'=>'w.Title', 'Body'=>'w.Body');
$OrderTable = array('Title'=>'w.Title', 'Created'=>'w.ID', 'Edited'=>'w.Date');
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');

// What are we looking for? Let's make sure it isn't dangerous.
$Search = db_string(trim($_GET['search']));

if(!in_array($Type, array('w.Title', 'w.Body'))) { $Type = 'w.Title'; }

// Break search string down into individual words
$Words = explode(' ', $Search);

$Type = $TypeTable[$_GET['type']];
if(!$Type) { $Type = 'w.Title'; }

$Order = $OrderTable[$_GET['order']];
if(!$Order) { $Order = 'ID'; }
Example #21
0
<?php

if (!check_perms('users_view_invites')) {
    error(403);
}
show_header('Invite Pool');
define('INVITES_PER_PAGE', 50);
list($Page, $Limit) = page_limit(INVITES_PER_PAGE);
if (!empty($_POST['invitekey']) && check_perms('users_edit_invites')) {
    authorize();
    $DB->query("DELETE FROM invites WHERE InviteKey='" . db_string($_POST['invitekey']) . "'");
}
if (!empty($_GET['search'])) {
    $Search = db_string($_GET['search']);
} else {
    $Search = "";
}
$sql = "SELECT \n\tSQL_CALC_FOUND_ROWS\n\tum.ID,\n\tum.Username,\n\tum.PermissionID,\n\tum.Enabled,\n\tui.Donor,\n\tui.Warned,\n\ti.InviteKey,\n\ti.Expires,\n\ti.Email\n\tFROM invites as i\n\tJOIN users_main AS um ON um.ID=i.InviterID\n\tJOIN users_info AS ui ON ui.UserID=um.ID ";
if ($Search) {
    $sql .= "WHERE i.Email LIKE '%{$Search}%' ";
}
$sql .= "ORDER BY i.Expires DESC LIMIT {$Limit}";
$RS = $DB->query($sql);
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
?>
	<div class="box pad">
		<p><?php 
echo number_format($Results);
?>
Example #22
0
<?
if(!check_perms('admin_donor_log')) { error(403); }

include(SERVER_ROOT.'/sections/donate/config.php');

define('DONATIONS_PER_PAGE', 50);
list($Page,$Limit) = page_limit(DONATIONS_PER_PAGE);


$sql = "SELECT 
	SQL_CALC_FOUND_ROWS
	d.UserID, 
	d.Amount, 
	d.Email, 
	m.Username,
	m.PermissionID,
	m.Enabled,
	i.Donor,
	i.Warned,
	d.Time 
	FROM donations AS d 
	LEFT JOIN users_main AS m ON m.ID=d.UserID
	LEFT JOIN users_info AS i ON i.UserID=d.UserID ";
if(!empty($_GET['search'])) {
	$sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' ";
}
$sql .= "ORDER BY d.Time DESC LIMIT $Limit";
$DB->query($sql);
$Donations = $DB->to_array(false,MYSQLI_NUM);

$DB->query("SELECT FOUND_ROWS()");
Example #23
0
$DB->query("SELECT um.Username, p.Level AS Class FROM users_main AS um LEFT JOIN permissions AS p ON p.ID=um.PermissionID WHERE um.ID = " . $UserID);
list($Username, $Class) = $DB->next_record();
if (!check_perms('users_view_ips', $Class)) {
    error(403);
}
$UsersOnly = $_GET['usersonly'];
show_header("IP history for {$Username}");
?>
<script type="text/javascript">
function ShowIPs(rowname) {
	$('tr[name="'+rowname+'"]').toggle();
}
</script>
<div class="thin">
<?php 
list($Page, $Limit) = page_limit(IPS_PER_PAGE);
if ($UsersOnly == 1) {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t        h1.IP,\n\t       \th1.StartTime,\n\t       \th1.EndTime,\n\t        GROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t        GROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t   \tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t        FROM users_history_ips AS h1\n\t        LEFT JOIN users_history_ips AS h2 ON h2.IP=h1.IP AND h2.UserID!={$UserID}\n\t        LEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t        LEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tAND h2.UserID>0\n\t        GROUP BY h1.IP, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
} else {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t\th1.IP, \n\t\th1.StartTime, \n\t\th1.EndTime,\n\t\tGROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t\tFROM users_history_ips AS h1\n\t\tLEFT JOIN users_history_ips AS h2 ON h2.IP=h1.IP AND h2.UserID!={$UserID}\n\t\tLEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t\tLEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tGROUP BY h1.IP, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
}
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
$DB->set_query_id($RS);
$Pages = get_pages($Page, $NumResults, IPS_PER_PAGE, 9);
?>
	<h2>IP history for <a href="/user.php?id=<?php 
echo $UserID;
?>
"><?php 
echo $Username;
Example #24
0
<?

$Queries = array();

$OrderWays = array('votes', 'bounty', 'created', 'lastvote', 'filled');
list($Page,$Limit) = page_limit(REQUESTS_PER_PAGE);
$Submitted = !empty($_GET['submit']);

if(empty($_GET['type'])) { 
	$Title = 'Requests';
	if(!check_perms('site_see_old_requests') || empty($_GET['showall'])) {
		$SS->SetFilter('visible', array(1));
	}
} else {
	switch($_GET['type']) {
		case 'created':
			$Title = 'My requests';
			$SS->SetFilter('userid', array($LoggedUser['ID']));
			break;
		case 'voted':
			if(!empty($_GET['userid'])) {
				if(is_number($_GET['userid'])) {
					$DB->query("SELECT Username FROM users_main WHERE ID = ".$_GET['userid']);
					list($Username) = $DB->next_record();
					$Title = "Requests voted for by ".$Username;
					$SS->SetFilter('voter', array($_GET['userid']));
				} else {
					error(404);
				}
			} else {
				$Title = "Requests I've voted on";
Example #25
0
    print json_encode(array('status' => 'failure'));
}
//Post links utilize the catalogue & key params to prevent issues with custom posts per page
if ($ThreadInfo['Posts'] > $PerPage) {
    if (isset($_GET['post']) && is_number($_GET['post'])) {
        $PostNum = $_GET['post'];
    } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
        $DB->query("SELECT COUNT(ID) FROM forums_posts WHERE TopicID = {$ThreadID} AND ID <= {$_GET['postid']}");
        list($PostNum) = $DB->next_record();
    } else {
        $PostNum = 1;
    }
} else {
    $PostNum = 1;
}
list($Page, $Limit) = page_limit($PerPage, min($ThreadInfo['Posts'], $PostNum));
list($CatalogueID, $CatalogueLimit) = catalogue_limit($Page, $PerPage, THREAD_CATALOGUE);
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
if (!($Catalogue = $Cache->get_value('thread_' . $ThreadID . '_catalogue_' . $CatalogueID))) {
    $DB->query("SELECT\n\t\tp.ID,\n\t\tp.AuthorID,\n\t\tp.AddedTime,\n\t\tp.Body,\n\t\tp.EditedUserID,\n\t\tp.EditedTime,\n\t\ted.Username\n\t\tFROM forums_posts as p\n\t\tLEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID\n\t\tWHERE p.TopicID = '{$ThreadID}' AND p.ID != '" . $ThreadInfo['StickyPostID'] . "'\n\t\tLIMIT {$CatalogueLimit}");
    $Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
    if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
        $Cache->cache_value('thread_' . $ThreadID . '_catalogue_' . $CatalogueID, $Catalogue, 0);
    }
}
$Thread = catalogue_select($Catalogue, $Page, $PerPage, THREAD_CATALOGUE);
$LastPost = end($Thread);
$LastPost = $LastPost['ID'];
reset($Thread);
//Handle last read
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
Example #26
0
<?
enforce_login();

define('LOG_ENTRIES_PER_PAGE', 25);
list($Page,$Limit) = page_limit(LOG_ENTRIES_PER_PAGE);

if(!empty($_GET['search'])) {
	$Search = db_string($_GET['search']);
} else {
	$Search = false;
}
$Words = explode(' ', $Search);
$sql = "SELECT
	SQL_CALC_FOUND_ROWS 
	Message,
	Time
	FROM log ";
if($Search) {
	$sql .= "WHERE Message LIKE '%";
	$sql .= implode("%' AND Message LIKE '%", $Words);
	$sql .= "%' ";
}
if(!check_perms('site_view_full_log')) {
	if($Search) {
		$sql.=" AND "; 
	} else {
		$sql.=" WHERE ";
	}
	$sql .= " Time>'".time_minus(3600*24*28)."' ";
}
Example #27
0
</td>
			</tr>
		</table>
<?

$Results = $Cache->get_value('request_comments_'.$RequestID);
if($Results === false) {
	$DB->query("SELECT
			COUNT(c.ID)
			FROM requests_comments as c
			WHERE c.RequestID = '$RequestID'");
	list($Results) = $DB->next_record();
	$Cache->cache_value('request_comments_'.$RequestID, $Results, 0);
}

list($Page,$Limit) = page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);

//Get the cache catalogue
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
$CatalogueLimit=$CatalogueID*THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;

//---------- Get some data to start processing

// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('request_comments_'.$RequestID.'_catalogue_'.$CatalogueID);
if($Catalogue === false) {
	$DB->query("SELECT
			c.ID,
			c.AuthorID,
			c.AddedTime,
			c.Body,
Example #28
0
define('COUNTRIES_PER_PAGE', 100);
if (!check_perms('users_view_ips')) {
    error(403);
}
$UserID = $_GET['userid'];
if (!is_number($UserID)) {
    error(404);
}
$UsersOnly = $_GET['usersonly'];
$DB->query("SELECT UserName FROM users_main WHERE ID = {$UserID}");
list($Username) = $DB->next_record();
show_header("Country history for {$Username}");
?>
<div class="thin">
<?php 
list($Page, $Limit) = page_limit(COUNTRIES_PER_PAGE);
if ($UsersOnly == 1) {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t        h1.CountryCode,\n\t       \th1.StartTime,\n\t       \th1.EndTime,\n\t        GROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t        GROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t   \tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t        FROM users_history_country AS h1\n\t        LEFT JOIN users_history_country AS h2 ON h2.CountryCode=h1.CountryCode AND h2.UserID!={$UserID}\n\t        LEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t        LEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tAND h2.UserID>0\n\t        GROUP BY h1.CountryCode, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
} else {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t\th1.CountryCode, \n\t\th1.StartTime, \n\t\th1.EndTime,\n\t\tGROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t\tFROM users_history_country AS h1\n\t\tLEFT JOIN users_history_country AS h2 ON h2.CountryCode=h1.CountryCode AND h2.UserID!={$UserID}\n\t\tLEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t\tLEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tGROUP BY h1.CountryCode, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
}
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
$DB->set_query_id($RS);
$Pages = get_pages($Page, $NumResults, COUNTRIES_PER_PAGE, 9);
?>
	<h2>Country history for <a href="/user.php?id=<?php 
echo $UserID;
?>
"><?php 
echo $Username;
Example #29
0
<?
if(!check_perms('users_view_ips')) { error(403); }
show_header('Dupe IPs');
define('USERS_PER_PAGE', 50);
define('IP_OVERLAPS', 5);
list($Page,$Limit) = page_limit(USERS_PER_PAGE);


$RS = $DB->query("SELECT 
	SQL_CALC_FOUND_ROWS
	m.ID,
	m.IP,
	m.Username,
	m.PermissionID,
	m.Enabled,
	i.Donor,
	i.Warned,
	i.JoinDate,
	(SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) AS Uses
	FROM users_main AS m 
	LEFT JOIN users_info AS i ON i.UserID=m.ID
	WHERE (SELECT COUNT(DISTINCT h.UserID) FROM users_history_ips AS h WHERE h.IP=m.IP) >= ".IP_OVERLAPS."
	AND m.Enabled = '1'
	AND m.IP != '127.0.0.1'
	ORDER BY Uses DESC LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);

if($DB->record_count()) {
?>
Example #30
0
define('CIDR_PER_PAGE', 100);
if (!check_perms('users_view_ips')) {
    error(403);
}
$UserID = $_GET['userid'];
if (!is_number($UserID)) {
    error(404);
}
$UsersOnly = $_GET['usersonly'];
$DB->query("SELECT UserName FROM users_main WHERE ID = {$UserID}");
list($Username) = $DB->next_record();
show_header("Country history for {$Username}");
?>
<div class="thin">
<?php 
list($Page, $Limit) = page_limit(CIDR_PER_PAGE);
if ($UsersOnly == 1) {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t        h1.Cidr,\n\t       \th1.StartTime,\n\t       \th1.EndTime,\n\t        GROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t        GROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t        GROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t   \tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t        GROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t        FROM users_history_cidr AS h1\n\t        LEFT JOIN users_history_cidr AS h2 ON h2.Cidr=h1.Cidr AND h2.UserID!={$UserID}\n\t        LEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t        LEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tAND h2.UserID>0\n\t        GROUP BY h1.Cidr, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
} else {
    $RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t\th1.Cidr, \n\t\th1.StartTime, \n\t\th1.EndTime,\n\t\tGROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t\tFROM users_history_cidr AS h1\n\t\tLEFT JOIN users_history_cidr AS h2 ON h2.Cidr=h1.Cidr AND h2.UserID!={$UserID}\n\t\tLEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t\tLEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tGROUP BY h1.Cidr, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
}
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
$DB->set_query_id($RS);
$Pages = get_pages($Page, $NumResults, CIDR_PER_PAGE, 9);
?>
	<h2>Cidr history for <a href="/user.php?id=<?php 
echo $UserID;
?>
"><?php 
echo $Username;