public static function cadastrados()
 {
     self::$departamento->getConnection()->with_limits(get_limit());
     $o = self::$departamento->registros();
     if ($o) {
         $ds = self::$departamento->get_lista($o);
     }
     return $ds;
 }
Example #2
0
            $bads[$row['user_id']] = $row['bads'];
        }
        $result = sql_query('
			SELECT SQL_CALC_FOUND_ROWS
				' . (PRO_VERSION ? 'users.*' : implode(',', $GLOBALS['USERS_FIELDS'])) . ',
				SUM(IF(t.type="d", t.amount, NULL)) as deposit,
				SUM(IF(t.type="w", t.amount, NULL)) as withdrawal,
				SUM(IF(t.type="e", t.amount, NULL)) as earning,
				SUM(IF(t.type="r", t.amount, NULL)) as referral,
				SUM(IF(t.type="i", t.amount, NULL)) as reinvest,
				SUM(IF(t.type="b", t.amount, NULL)) as bonus
			FROM users
			LEFT JOIN translines as t ON t.user_id = users.id AND t.stamp < ' . Project::getInstance()->getNow() . ' AND t.status > 0
			GROUP BY users.id
			ORDER BY ' . (!empty($_REQUEST['order_by']) ? addslashes($_REQUEST['order_by']) : 'reg_date DESC') . '
			' . get_limit() . '
		');
        $users = array();
        while ($row = mysql_fetch_assoc($result)) {
            $row['ips'] = isset($ips[$row['id']]) ? $ips[$row['id']] : array();
            $row['bads'] = isset($bads[$row['id']]) ? intval($bads[$row['id']]) : 0;
            $row['ipsec'] = 0;
            $users[$row['id']] = $row;
        }
        foreach ($users_by_ips as $ip => $u_ids) {
            if (count($u_ids) > 1) {
                foreach ($u_ids as $u_id) {
                    if (!isset($users[$u_id])) {
                        continue;
                    }
                    $users[$u_id]['ipsec'] = 1;
Example #3
0
                ?>
</div>
							</div>
							<div class="clear"></div>
<?php 
            }
            if ($content_type == 'people') {
                ?>
							<ul>
								<li class="first_column">
									<?php 
                echo get_avatar($row->username);
                if ($body_title == 'Leaderboard') {
                    ?>
									<div class="rank"><?php 
                    $rank = get_limit() * ($page - 1) + $i;
                    echo $rank;
                    ?>
</div>
<?php 
                }
                ?>
								</li>
								<li class="second_column">
									<div class="fullname">
										<?php 
                echo get_fullname($row->username);
                ?>
									</div>
									<div class="username">@<?php 
                echo $row->username;
Example #4
0
     /* TODO: what other options could be in "php_handler_type"? */
 }
 /* TODO: plesk offers some more options:
  * sys_user_id -> owner of files?
  * ip_address_id - needed?
  * fp - frontpage extensions
  * miva - ?
  * coldfusion
  * asp
  * asp_dot_net
  * traffic_bandwidth
  * max_connections
  */
 $web_folder = $entry['www_root'];
 $web_folder = preg_replace('/^\\/(var|srv)\\/www\\/(vhosts\\/)?[^\\/]+\\/(.*)\\/httpdocs.*/', '$3', $web_folder);
 $params = array('server_id' => $server_id, 'ip_address' => '*', 'domain' => $entry['name'] . '.' . $parent_domain['name'], 'web_folder' => $web_folder, 'type' => 'vhostsubdomain', 'parent_domain_id' => $domain_ids[$entry['dom_id']], 'vhost_type' => 'name', 'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)), 'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)), 'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0), 'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0), 'suexec' => yes_no(1), 'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0, 'subdomain' => '', 'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0), 'php' => $phpmode, 'fastcgi_php_version' => '', 'ruby' => yes_no(0), 'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0), 'active' => yes_no($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true' ? 1 : 0), 'redirect_type' => $redir_type, 'redirect_path' => $redir_path, 'seo_redirect' => '', 'ssl_state' => $entry[''], 'ssl_locality' => $entry[''], 'ssl_organisation' => $entry[''], 'ssl_organisation_unit' => $entry[''], 'ssl_country' => $entry[''], 'ssl_domain' => $entry[''], 'ssl_request' => $entry[''], 'ssl_cert' => $entry[''], 'ssl_bundle' => $entry[''], 'ssl_action' => $entry[''], 'stats_password' => '', 'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer', 'backup_interval' => 'none', 'backup_copies' => 1, 'allow_override' => 'All', 'pm_process_idle_timeout' => 10, 'pm_max_requests' => 0);
 $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . '.' . $parent_domain['name'] . "'");
 if (!$old_domain) {
     $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
 }
 if ($old_domain) {
     $new_id = $old_domain['domain_id'];
     $params = array_merge($old_domain, $params);
     $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
     $ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
     if ($ok === false) {
         $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
     }
 } else {
     $new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true);
     // read only...
Example #5
0
		  <?php 
    } else {
        echo "<input type='hidden' value='yes' name='agree' />";
        echo "";
    }
    ?>

	</table>

	<fieldset>
<?php 
    //echo "<pre>";
    //print_r($userdata);
    //echo "</pre>";
    $limit_data = get_limit($userdata->ID);
    $stop_date = $limit_data[0]->stop_date;
    $limit = $limit_data[0]->limit;
    ?>
<legend><?php 
    _e('Ваш <span title="Предоплаченный Вами или авансированный сайтом для последующей оплаты" style="border: 1px dashed ; cursor:help"> &nbsp;лимит&nbsp;</span> на скачивание');
    ?>
</legend>
<label><?php 
    _e('Количество файлов: ');
    echo $limit;
    ?>
<br />
<!-- <input type="text" name="user_login" value="<?php 
    echo $limit;
    ?>
function get_sql_query_clauses_NEW($db, $params, $currentUser = null)
{
    global $mysqli, $wg_ids, $publicOnly;
    $mysqli = $db;
    if (!$params) {
        $params = array();
    }
    //$_REQUEST;
    // 1. DETECT CURRENT USER AND ITS GROUPS, if not logged search only all records (no bookmarks) ----------------------
    $wg_ids = array();
    //may be better use $system->get_user_group_ids() ???
    if ($currentUser && @$currentUser['ugr_ID'] > 0) {
        if (@$currentUser['ugr_Groups']) {
            $wg_ids = array_keys($currentUser['ugr_Groups']);
        }
        $currUserID = $currentUser['ugr_ID'];
        array_push($wg_ids, $currUserID);
    } else {
        $currUserID = 0;
        $params['w'] = 'all';
    }
    array_push($wg_ids, 0);
    // be sure to include the generic everybody workgroup
    $publicOnly = @$params['publiconly'] == 1;
    //@todo change to vt - visibility type parameter of query
    // 2. DETECT SEARCH DOMAIN ------------------------------------------------------------------------------------------
    if (strcasecmp(@$params['w'], 'B') == 0 || strcasecmp(@$params['w'], BOOKMARK) == 0) {
        // my bookmark entries
        $search_domain = BOOKMARK;
    } else {
        if (@$params['w'] == 'e') {
            //everything - including temporary
            $search_domain = EVERYTHING;
        } else {
            if (@$params['w'] == 'nobookmark') {
                //all without BOOKMARK
                $search_domain = NO_BOOKMARK;
            } else {
                // all records entries
                $search_domain = "a";
            }
        }
    }
    if (is_array(@$params['q'])) {
        $query_json = $params['q'];
    } else {
        $query_json = json_decode(@$params['q'], true);
    }
    $query = new HQuery("0", $query_json, $search_domain, $currUserID);
    $query->makeSQL();
    //1. create tree of predicates
    //2. make where
    // 6. DEFINE LIMIT AND OFFSET ---------------------------------------------------------------------------------------
    $limit = get_limit($params);
    $offset = get_offset($params);
    if (!$query->where_clause) {
        $query->where_clause = "(1=1)";
    }
    // 7. COMPOSE QUERY  ------------------------------------------------------------------------------------------------
    return array("from" => " FROM " . $query->from_clause, "where" => $query->where_clause, "sort" => $query->sort_clause, "limit" => " LIMIT {$limit}", "offset" => $offset > 0 ? " OFFSET {$offset} " : "");
}
Example #7
0
    <td height="25" colspan="2" bgcolor="#EDEEF8">&nbsp;留言列表</td>
  </tr>
  <?php
  //列表
   $sql = "select * from lyb order by id desc";
   	mysql_query("SET NAMES 'utf8'"); 

   $rs = mysql_query($sql);
  if($rs)
  {
	  $num = mysql_num_rows($rs);
  }

  $page_size = 3; //每页显示数目更改

  $sql = "select * from lyb order by id desc ".get_limit($page_size);
  	mysql_query("SET NAMES 'utf8'"); 
  $rs = mysql_query($sql);

  if($rs)
  {
  while($rows = mysql_fetch_object($rs))
  {
  ?>
  <tr>
    <td width="167" height="25" bgcolor="#FFFFFF">
      <table width="100%" height="100%" border="0">
        <tr>
          <td align="center"><img src="images/<?=$rows->touxiang?>.gif"   border="0" /></td>
        </tr>
        <tr>
Example #8
0
 function build_query($query, $page, $order = 'id DESC')
 {
     $CI =& get_instance();
     return $CI->db->query($query . ' ORDER BY ' . $order . ' LIMIT ' . get_offset($page) . ', ' . get_limit());
 }
Example #9
0
/**
* Use the supplied _REQUEST variables (or $params if supplied) to construct a query starting with $query prefix
*
* @param System $system
* @param mixed $query  -  prefix (usually SELECT with list of fields)
* @param mixed $params
*
parameters:

stype  - (OUTDATED) type of search: key - by tag title, all - by title of record and titles of its resource, by default by record title
s - sort order   (NOTE!!!  sort may be defined in "q" parameter also)
l or limit  - limit of records
o or offset
w - domain of search a|all, b|bookmark, e (everything)

qq - several conjunctions and disjunctions
q  - query string

keywords for 'q' parameter
url:  url
title: title contains
t:  record type id
f:   field id
tag:   tag
id:  id
n:   description
usr:   user id
any:
relatedto:
sortby:

*
* @param mixed $currentUser - array with indexes ugr_ID, ugr_Groups (list of group ids)
*                       we can access; Records records marked with a rec_OwnerUGrpID not in this list are omitted
*/
function get_sql_query_clauses($db, $params, $currentUser = null)
{
    global $mysqli;
    $mysqli = $db;
    /* use the supplied _REQUEST variables (or $params if supplied) to construct a query starting with $select_clause */
    if (!$params) {
        $params = array();
    }
    //$_REQUEST;
    if (!defined('stype') && @$params['stype']) {
        define('stype', @$params['stype']);
    }
    // 1. DETECT CURRENT USER AND ITS GROUPS, if not logged search only all records (no bookmarks) ----------------------
    $wg_ids = array();
    //may be better use $system->get_user_group_ids() ???
    if ($currentUser && @$currentUser['ugr_ID'] > 0) {
        if (@$currentUser['ugr_Groups']) {
            $wg_ids = array_keys($currentUser['ugr_Groups']);
        }
        $currUserID = $currentUser['ugr_ID'];
        array_push($wg_ids, $currUserID);
    } else {
        $currUserID = 0;
        $params['w'] = 'all';
    }
    array_push($wg_ids, 0);
    // be sure to include the generic everybody workgroup
    $publicOnly = @$params['publiconly'] == 1;
    //@todo
    // 2. DETECT SEARCH DOMAIN ------------------------------------------------------------------------------------------
    if (strcasecmp(@$params['w'], 'B') == 0 || strcasecmp(@$params['w'], BOOKMARK) == 0) {
        // my bookmark entries
        $search_domain = BOOKMARK;
    } else {
        if (@$params['w'] == 'e') {
            //everything - including temporary
            $search_domain = EVERYTHING;
        } else {
            // all records entries
            $search_domain = null;
        }
    }
    // 3a. SPECIAL CASE for _BROKEN_
    $needbroken = false;
    if (@$params['q'] && preg_match('/\\b_BROKEN_\\b/', $params['q'])) {
        $params['q'] = preg_replace('/\\b_BROKEN_\\b/', '', $params['q']);
        $needbroken = true;
    }
    // 3b. SPECIAL CASE for _NOTLINKED_
    $neednotlinked = false;
    if (@$params['q'] && preg_match('/\\b_NOTLINKED_\\b/', $params['q'])) {
        $params['q'] = preg_replace('/\\b_NOTLINKED_\\b/', '', $params['q']);
        $neednotlinked = true;
    }
    // 4. QUERY MAY BE SIMPLE or full expressiveness ----------------------------------------------------------------------
    $query = parse_query($search_domain, @$params['q'], @$params['s'], @$params['parentquery'], $currUserID);
    $where_clause = $query->where_clause;
    // 4a. SPECIAL CASE for _BROKEN_
    if ($needbroken) {
        $where_clause = '(to_days(now()) - to_days(rec_URLLastVerified) >= 8) ' . ($where_clause ? ' and ' . $where_clause : '');
    }
    // 4b. SPECIAL CASE for _NOTLINKED_
    if ($neednotlinked) {
        $where_clause = '(not exists (select rl_ID from recLinks where rl_SourceID=TOPBIBLIO.rec_ID  or rl_TargetID=TOPBIBLIO.rec_ID )) ' . ($where_clause ? ' and ' . $where_clause : '');
    }
    // 5. DEFINE USERGROUP RESTRICTIONS ---------------------------------------------------------------------------------
    if ($search_domain != EVERYTHING) {
        if ($where_clause) {
            $where_clause = '(' . $where_clause . ') and ';
        }
        if ($search_domain == BOOKMARK) {
            $where_clause .= ' (bkm_UGrpID=' . $currUserID . ' and not TOPBIBLIO.rec_FlagTemporary) ';
        } else {
            if ($search_domain == BIBLIO) {
                //NOT USED
                $where_clause .= ' (bkm_UGrpID is null and not TOPBIBLIO.rec_FlagTemporary) ';
            } else {
                $where_clause .= ' not TOPBIBLIO.rec_FlagTemporary ';
            }
        }
    }
    if ($publicOnly) {
        $query->recVisibilityType = "public";
    }
    if ($query->recVisibilityType && $query->recVisibilityType != "hidden") {
        $where2 = '(TOPBIBLIO.rec_NonOwnerVisibility="' . $query->recVisibilityType . '")';
        //'pending','public','viewable'
    } else {
        if ($query->recVisibilityType) {
            //hidden
            $where2 = 'TOPBIBLIO.rec_NonOwnerVisibility="hidden" and ';
        } else {
            $where2 = '(not TOPBIBLIO.rec_NonOwnerVisibility="hidden") or ';
        }
        $where2 = '( ' . $where2 . 'TOPBIBLIO.rec_OwnerUGrpID in (' . join(',', $wg_ids) . ') )';
    }
    $where_clause = $where_clause . ' and ' . $where2;
    // 6. DEFINE LIMIT AND OFFSET ---------------------------------------------------------------------------------------
    $limit = get_limit($params);
    $offset = get_offset($params);
    // 7. COMPOSE QUERY  ------------------------------------------------------------------------------------------------
    return array("from" => $query->from_clause, "where" => $where_clause, "sort" => $query->sort_clause, "limit" => " LIMIT {$limit}", "offset" => $offset > 0 ? " OFFSET {$offset} " : "");
}