fetch() static public method

Shortcut for mysql_fetch_array
static public fetch ( resource $result, const $type = MYSQL_ASSOC ) : array
$result resource the unfetched result from db::query()
$type const PHP flag for mysql_fetch_array
return array The key/value result array
Example #1
0
function tujuanDes($destkota, $stat = 'provinsi', $tambah)
{
    global $app;
    $dbu = new db();
    $appx = new app();
    $urlx = new url();
    if ($stat == "destinasi") {
        while ($desty = $dbu->fetch($destkota)) {
            $destinasi = $desty[nama];
            $desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
            $desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
            $outnya .= '<li>
							<div class="img_box">
								<img src="' . $desty[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $destinasi . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    } elseif ($stat == "provinsi") {
        while ($desty = $dbu->fetch($destkota)) {
            $destinasi = $desty[nama];
            $desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
            $desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
            $outnya .= '<li>
							<div class="img_box">

								<img src="' . $desty[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $destinasi . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    } else {
        //echo "sedel";exit;
        while ($dkota = $dbu->fetch($destkota)) {
            $dkota[thumb] = $appx->cekFile("/kota/thumb/", $dkota[thumb], 'default.jpg');
            $dkota[thumb] = $app[data_www] . "/kota/thumb/" . $dkota[thumb];
            //echo "asdasdas".$dkota[thumb];
            $outnya .= '<li>
							<div class="img_box">
								<img src="' . $dkota[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $dkota[nama] . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][kota_bahasa], "id_kota ='" . $dkota[id] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='2' and id_bahasa='" . $_SESSION[bhs] . "'") . "/id_" . $urlx->shortLink($dkota[nama]) . "_" . $urlx->shortLink($tambah) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    }
    return $outnya;
}
Example #2
0
function username($id)
{
    $username = new db();
    $username->query("select name from accounts where id = '{$id}'");
    $username->fetch();
    return $username->element("name");
}
Example #3
0
 /**
  * Returns a slightly opened tree from an element with number $nodeId.
  *
  * @param integer $nodeId Node unique id
  * @param string|array $fields Fields to be selected
  * @param string|array $condition array key - condition (AND, OR, etc), value - condition string
  * @return array Needed fields
  * @throws USER_Exception
  */
 function Ajar($nodeId, $fields = '*', $condition = '')
 {
     $condition = $this->PrepareCondition($condition, false, 'A.');
     $sql = 'SELECT A.' . $this->tableLeft . ', A.' . $this->tableRight . ', A.' . $this->tableLevel . ' ';
     $sql .= 'FROM ' . $this->table . ' A, ' . $this->table . ' B ';
     $sql .= 'WHERE B.' . $this->tableId . ' = ' . $nodeId . ' ';
     $sql .= 'AND B.' . $this->tableLeft . ' BETWEEN A.' . $this->tableLeft . ' ';
     $sql .= 'AND A.' . $this->tableRight;
     $sql .= $condition;
     $sql .= ' ORDER BY A.' . $this->tableLeft;
     $res = $this->db->query($sql);
     if (0 == $this->db->numRows($res)) {
         throw new USER_Exception(DBTREE_NO_ELEMENT, 0);
     }
     $alen = $this->db->numRows($res);
     $i = 0;
     $fields = $this->PrepareSelectFields($fields, 'A');
     $sql = 'SELECT A.' . $this->tableId . ', A.' . $this->tableLeft . ', A.' . $this->tableRight . ', A.' . $this->tableLevel . ', ' . $fields . ' ';
     $sql .= 'FROM ' . $this->table . ' A ';
     $sql .= 'WHERE (' . $this->tableLevel . ' = 1';
     while ($row = $this->db->fetch($res)) {
         if (++$i == $alen && $row[$this->tableLeft] + 1 == $row[$this->tableRight]) {
             break;
         }
         $sql .= ' OR (' . $this->tableLevel . ' = ' . ($row[$this->tableLevel] + 1) . ' AND ' . $this->tableLeft . ' > ' . $row[$this->tableLeft] . ' AND ' . $this->tableRight . ' < ' . $row[$this->tableRight] . ')';
     }
     $sql .= ') ' . $condition;
     $sql .= ' ORDER BY ' . $this->tableLeft;
     $result = $this->db->getInd($this->tableId, $sql);
     return $result;
 }
Example #4
0
 public static function getSector($x, $y)
 {
     global $db;
     $result = $db->query('select * from grid where x="' . $x . '" and y="' . $y . '"');
     $sector = db::fetch($result);
     return $sector;
 }
 public static function get($type)
 {
     global $db;
     $result = $db->query('select * from blacklist where type="' . $type . '"');
     $blacklist = array();
     for ($i = 0; $row = db::fetch($result); $i++) {
         $blacklist[$i] = $row;
     }
     return $blacklist;
 }
Example #6
0
function f2()
{
    $db = new db();
    $obj = $db->async_query('select sleep(1)');
    echo "f2 async_query\n";
    (yield $obj);
    $row = $db->fetch();
    echo "f2 fetch\n";
    (yield $row);
}
Example #7
0
    function feedCheckIn($dfeed, $sBahasa, $member)
    {
        global $app;
        $appx = new app();
        $dbu = new db();
        $urlx = new url();
        $fcek_in = "";
        $icon = $app[css_www] . "/images/ic_cat_2.png";
        $avatar = $appx->cekFile('/pengguna/avatar/', $member[avatar], 'default.jpg');
        $avatar = $app[data_www] . '/pengguna/avatar/' . $avatar;
        $linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($member[username]) . "/";
        $fcek_in = '<div class="con_newsfeed add_fix">
					<div class="line_newsfeed">
						<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
						<div class="bar"></div>
						<div class="ic_cat"><a href="#"><img src="' . $icon . '"></a></div>
					</div>';
        $dipost = $appx->time_delta('now', $dfeed[tgl_post], 0, 2, true);
        if ($_SESSION[member][id] != "") {
            $bolehKomen = '<li>
							<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
							<textarea id="cekin" placeholder="Write your comment..."></textarea>
						</li>';
        }
        $sql = "SELECT a.nama , b.nama as kota , c.nama as provinsi, d.nama as negara FROM " . $app[table][destinasi_bahasa] . " as a LEFT JOIN " . $app[table][destinasi] . " as e ON (a.id_reff = e.id_reff)  LEFT JOIN " . $app[table][kota] . " as b ON(e.id_kota = b.id) LEFT JOIN " . $app[table][provinsi] . " as c ON(b.id_provinsi = c.id) LEFT JOIN " . $app[table][negara] . " as d ON(c.id_negara = d.id) LEFT JOIN " . $app[table][cekin] . " as f ON(e.id = f.id_destinasi ) LEFT JOIN " . $app[table][pengguna_feed] . " as g ON(f.id = g.id_tabel) WHERE g.id ='" . $dfeed[id] . "' AND a.id_bahasa ='" . $sBahasa . "'";
        $lokasi = $dbu->get_recordmix($sql);
        $cekin_di = '<span>Check in at <a href="#"><i>' . $lokasi[nama] . '(' . $lokasi[kota] . '), ' . $lokasi[provinsi] . ', ' . $lokasi[negara] . '</i></a></span>';
        $fcek_in .= '<div class="box_con_newsfeed">
						<h1>' . $member[nama] . '</h1>
						<span>' . $dipost . '</span>
						<div class="frame_post">
							' . $cekin_di . '
							<div class="box_comment">
								<ul class="add_fix" id="list_cekin" rel="cekin_' . $dfeed[id_tabel] . '">
									' . $bolehKomen;
        #komen cekin---------------------------
        $sql = "SELECT a.nama , a.avatar, a.username, b.id, b.komen, b.tgl_post as tgl_komen FROM " . $app[table][pengguna] . " as a LEFT JOIN " . $app[table][cekin_komen] . " as b ON(b.id_user = a.id) WHERE b.id_cekin = '" . $dfeed[id_tabel] . "'";
        $dbu->query($sql, $rkomen, $nkomen);
        if ($nkomen > 0) {
            while ($dkomen = $dbu->fetch($rkomen)) {
                $dkomen[avatar] = $appx->cekFile("/pengguna/avatar/", $dkomen[avatar]);
                $other_avatar = $app[data_www] . '/pengguna/avatar/' . $dkomen[avatar];
                $other_linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($dkomen[username]) . "/";
                $fcek_in .= '<li>		
							<div class="circle_pict circle_pict_nf"><a href="' . $other_linkAva . '"><img src="' . $other_avatar . '"></a></div>
							<div class="text_box_c">
								<h1>' . $dkomen[nama] . '</h1>
								<p>' . $dkomen[komen] . '</p>
							</div>					
						</li>';
            }
        }
        $fcek_in .= '</ul></div></div></div></div>';
        return $fcek_in;
    }
 public function get($user)
 {
     global $db;
     $result = $db->query('select * from activations where user="******"');
     $this->data = db::fetch($result);
     if (isset($this->data['user'])) {
         $status = 'done';
     } else {
         $status = 'noActivation';
     }
     return $status;
 }
Example #9
0
 function MailQueue()
 {
     $msg_config = jconf::get('mail_msg');
     $site_url = $this->Config['site_url'];
     $site_name = $this->Config['site_name'];
     $page_url = 'admin.php?mod=notice&code=mailq';
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $count = DB::result_first(" select count(*) from `" . TABLE_PREFIX . "mailqueue` ");
     $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array'), '20 50 100 200 500');
     $sql = " select mq.*,m.username,m.nickname\r\n\t\t\t\t from `" . TABLE_PREFIX . "mailqueue` mq\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m on m.uid = mq.uid\r\n\t\t\t\t where `dateline` > 0\r\n\t\t\t\t order by `dateline` {$page_arr['limit']}";
     $query = DB::query($sql);
     while ($rs = db::fetch($query)) {
         $msg = array();
         $rs['dateline'] = date('Y-m-d H:i:s', $rs['dateline']);
         if ($rs['msg']) {
             $nickname = $rs['nickname'];
             $msg = unserialize($rs['msg']);
             $site_new_data = array();
             $newpm = $msg['newpm'] ? $msg['newpm'] : 0;
             $newpm && ($site_new_data['newpm'] = "有{$newpm}条未读私信");
             $at_new = $msg['at_new'] ? $msg['at_new'] : 0;
             $at_new && ($site_new_data['at_new'] = "被@{$at_new}次");
             $comment_new = $msg['comment_new'] ? $msg['comment_new'] : 0;
             $comment_new && ($site_new_data['comment_new'] = "被评论{$comment_new}次");
             $event_new = $msg['event_new'] ? $msg['event_new'] : 0;
             $event_new && ($site_new_data['event_new'] = "有{$event_new}个活动更新");
             $fans_new = $msg['fans_new'] ? $msg['fans_new'] : 0;
             $fans_new && ($site_new_data['fans_new'] = "新增加{$fans_new}个粉丝");
             $qun_new = $msg['qun_new'] ? $msg['qun_new'] : 0;
             $qun_new && ($site_new_data['qun_new'] = "有{$qun_new}个群更新");
             $vote_new = $msg['vote_new'] ? $msg['vote_new'] : 0;
             $vote_new && ($site_new_data['vote_new'] = "投票有{$vote_new}个更新");
             $dig_new = $msg['dig_new'] ? $msg['dig_new'] : 0;
             $dig_new && ($site_new_data['dig_new'] = "被赞{$dig_new}次");
             $channel_new = $msg['channel_new'] ? $msg['channel_new'] : 0;
             $channel_new && ($site_new_data['channel_new'] = "频道有{$channel_new}个更新");
             $company_new = $msg['company_new'] ? $msg['company_new'] : 0;
             $company_new && ($site_new_data['company_new'] = "单位有{$company_new}个更新");
             $load = $msg['load'] ? $msg['load'] . "天" : '';
             $site_new_data = $site_new_data ? '<br>您' . implode(',', $site_new_data) . '。' : '';
             if ($msg_config['msg']) {
                 $message = $msg_config['msg'];
                 $message = str_replace(array('newpm', 'at_new', 'comment_new', 'event_new', 'fans_new', 'qun_new', 'vote_new', 'dig_new', 'channel_new', 'company_new', 'load', 'site_url', 'site_name', 'time', 'nickname', 'site_new_data', 'time'), array($newpm, $at_new, $comment_new, $event_new, $fans_new, $qun_new, $vote_new, $dig_new, $channel_new, $company_new, $load, $site_url, $site_name, date('Y:m:d H:i:s'), $nickname, $site_new_data, $time), $message);
             } else {
                 $message = "尊敬的{$nickname:}<br>您好!<br>在未登录{$site_name}的{$load}期间,您收到了一些信息:" . "{$site_new_data}<br>点击<a href='{$site_url}'>{$site_url}</a>查看" . "<br><br>(<font color='gray'>如此邮件提醒对您产生了干扰,请<a href='{$site_url}/index.php?mod=settings&code=sendmail' targegt='_blank'>点击修改提醒设置</a></font>)<br>" . data('Y-m-d H:i:s');
             }
             $message .= $recommend_tips ? '<br><br><b>官方推荐内容:</b>' . $recommend_tips : '';
             $rs['message'] = $message;
         }
         $mailQueue[$rs['qid']] = $rs;
     }
     include template('admin/mail_queue');
 }
Example #10
0
 public static function get($index)
 {
     global $db;
     $result = $db->query('select * from flags');
     $flags = array();
     if ($index == 'name') {
         while ($row = db::fetch($result)) {
             $flags[$row['name']] = $row['value'];
         }
     } else {
         for ($i = 0; $row = db::fetch($result); $i++) {
             $flags[$i] = $row;
         }
     }
     return $flags;
 }
Example #11
0
function run($query, $param, $action = '', $db = null)
{
    $response = false;
    $db = new db(null, $db);
    $db->query($query);
    $db->execute($param);
    switch ($action) {
        case 'fetch':
            $response = $db->fetch();
            break;
        case 'update':
            $response = $db;
            break;
        case 'insert':
            $response = $db->lastInsertId();
            break;
        default:
            $response = $db->fetchset();
            break;
    }
    return $response;
}
Example #12
0
<?php

function __autoload($classname)
{
    if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/object/" . $classname . ".php")) {
    } else {
        if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/static/" . $classname . ".php")) {
        } else {
            if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/form/" . $classname . ".php")) {
            } else {
                echo '<pre><p>Class not found ' . $classname . '</p><p>' . print_r(debug_backtrace(), 1) . '</p></pre>';
            }
        }
    }
    include_once $filename;
}
\db::connect();
$res = \db::query('SELECT DISTINCT(mid) FROM glider');
$insert_statement = \db::prepare('INSERT INTO manufacturer SET title=:title');
$update_statement = \db::prepare('UPDATE glider SET manufacturer =:mid WHERE manufacturer = :title');
while ($row = \db::fetch($res)) {
    $insert_statement->execute(array('title' => $row->manufacturer));
    $id = \db::insert_id();
    $update_statement->execute(array('title' => $row->manufacturer, 'mid' => $id));
}
Example #13
0
$dbu->connect();
$appx->load_lib('url');
$uly = new url();
//Get our locations from the database.
$radius = 20;
// Search the rows in the markers table
$kat = "";
if ($_POST[kate] != "") {
    $kat = "WHERE a.id_kat ='" . $_POST[kate] . "'";
}
$lat = $_POST[lat];
$lng = $_POST[lng];
//$alamat = $_POST[alamat];
$urlnya = $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'");
$query = "SELECT distinct a.website, b.nama as dest,a.id_kat, b.slogan, b.alamat, a.pos_lat as lat , a.pos_long as lng, ( 3959 * acos( cos( radians('" . $lat . "') ) * cos( radians( a.pos_lat ) ) * cos( radians( a.pos_long ) - radians('" . $lng . "') ) + sin( radians('" . $lat . "') ) * sin( radians( a.pos_lat ) ) ) ) AS distance, a.thumb, a.icon_map ,LTRIM(' url') as urlc FROM " . $app[table][destinasi] . " as a LEFT JOIN " . $app[table][destinasi_bahasa] . " as b ON(a.id_reff = b.id_reff) " . $kat . " HAVING distance < '" . $radius . "' ORDER BY distance asc";
$dbu->query($query, $rnear, $hit_near);
$dnear = "";
if ($hit_near > 0) {
    $hit = 0;
    while ($nea = $dbu->fetch($rnear)) {
        $nea[urlc] = $app[www] . "/" . $urlnya . "/" . $uly->shortLink($nea[dest]) . "/";
        $nea[thumb] = $appx->cekFile('/destinasi/thumb/', $nea[thumb], 'default.jpg');
        $nea[thumb] = $app[data_www] . '/destinasi/thumb/' . $nea[thumb];
        $nea[icon_map] = $appx->cekFile('/destinasi/icon/', $nea[icon_map], 'default.png');
        $nea[icon_map] = $app[data_www] . '/destinasi/icon/' . $nea[icon_map];
        $dnear[$hit] = $nea;
        $hit++;
    }
}
header('Content-Type: application/json');
echo json_encode($dnear);
Example #14
0
$appx = new app();
$urlx = new url();
if ($id_related != "") {
    // AND $dnews[id_reff]!=0
    $sql = "SELECT a.id, b.username , c.judul, c.thumb  FROM " . $app[table][berita] . " as a LEFT JOIN " . $app[table][pengguna] . " as b ON (a.id_user = b.id) LEFT JOIN " . $app[table][berita_bahasa] . " as c ON (c.id_berita = a.id) WHERE a.id_reff='" . $id_related . "' AND a.ket_id ='" . $tabel . "' AND a.id <> '" . $idnya . "' ORDER BY a.tgl_post DESC LIMIT 5 ";
    //echo $sql;exit;
    $dbu->query($sql, $rsnews, $hit_related);
}
if ($hit_related > 0) {
    ?>

<div class="thread related_news">
<h1 class="main_title" style="padding: 15px 15px 7px;">RELATED NEWS<span class="border"></span></h1>
<ul>
<?php 
    while ($dtnews = $dbu->fetch($rsnews)) {
        $dtnews[thumb] = $appx->cekFile('/berita/thumb/', $dtnews[thumb], 'default.jpg');
        $dtnews[thumb] = $app[data_www] . "/berita/thumb/" . $dtnews[thumb];
        $linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($dtnews[username]) . "/";
        ?>
		<li>
			<a href="<?php 
        echo $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='51'") . "/" . $urlx->shortLink($dtnews[judul]) . "_" . $dtnews[id] . "/";
        ?>
">
				<div class="thumb_img"><img src="<?php 
        echo $dtnews[thumb];
        ?>
" width="97" height="84"></div>
				<span><?php 
        echo $dtnews[judul];
Example #15
0
<fieldset><legend>預約單</legend>
<table border=2>
<tr><th><a href=".?sort=0">預約單編號</a></th><th><a href=".?sort=1">使用日期</a><br>(年/月/日)</th><th>使用時段</th><th>會議室編號</th><th>借用人</th><th></th></tr>
<?php 
$A = new db();
$B = new db();
switch (get("sort")) {
    case 0:
        $A->query("select * from reserves where name='" . getsession("id") . "' order by serial") ?: $A->error();
        break;
    case 1:
        $A->query("select * from reserves where name='" . getsession('id') . "' order by date") ?: $A->error();
        break;
}
if ($A->count() > 0) {
    while ($A->fetch()) {
        ?>
<tr>
<td><?php 
        echo $A->element("serial");
        ?>
</td>
<td><?php 
        echo str_replace("-", "/", $A->element("date"));
        ?>
</td>
<td><?php 
        echo section($A->element("section"));
        ?>
</td>
<td><?php 
Example #16
0
function step4()
{
    global $pref;
    $mes = e107::getMessage();
    $ns = e107::getRender();
    $stepCaption = 'Step 4: Move user specific forum data and forum prefs';
    if (!isset($_POST['move_user_data'])) {
        $text = "\n\t\tThis step will move the main forum preferences into its own table row.  It will also move all user_viewed data from user table into the user extended table.<br />\n\t\tThe user_forum field data will not be moved, as it will be recalculated later.<br />\n\t\t<br />\n\t\tDepending on the size of your user table, this step could take a while.\n\t\t<br /><br />\n\t\t<form method='post'>\n\t\t<input class='btn btn-success' data-loading-text='Please wait...' type='submit' name='move_user_data' value='Proceed with user data move' />\n\t\t</form>\n\t\t";
        $ns->tablerender($stepCaption, $text);
        return;
    }
    /** Convert forum prefs to their own row **/
    $fconf = e107::getPlugConfig('forum', '', false);
    $coreConfig = e107::getConfig();
    $old_prefs = array();
    foreach ($pref as $k => $v) {
        if (substr($k, 0, 6) == 'forum_') {
            $nk = substr($k, 6);
            $mes->addDebug("Converting {$k} to {$nk}");
            $old_prefs[$nk] = $v;
            $coreConfig->remove($k);
        }
    }
    $forumPrefList = array('reported_post_email', 'email_notify', 'email_notify_on');
    foreach ($forumPrefList as $_fp) {
        $mes->addDebug("converting {$_fp} to {$_fp}");
        $old_prefs[$_fp] = $coreConfig->get($_fp);
        $coreConfig->remove($_fp);
    }
    $fconf->setPref($old_prefs)->save(false, true);
    $coreConfig->save(false, true);
    $result = array('usercount' => 0, 'viewcount' => 0, 'trackcount' => 0);
    $db = new db();
    if ($db->select('user', 'user_id, user_viewed, user_realm', "user_viewed != '' OR user_realm != ''")) {
        require_once e_HANDLER . 'user_extended_class.php';
        $ue = new e107_user_extended();
        while ($row = $db->fetch(MYSQL_ASSOC)) {
            $result['usercount']++;
            $userId = (int) $row['user_id'];
            $viewed = $row['user_viewed'];
            $viewed = trim($viewed, '.');
            $tmp = preg_split('#\\.+#', $viewed);
            $viewed = implode(',', $tmp);
            $realm = $row['user_realm'];
            $realm = str_replace('USERREALM', '', $realm);
            $realm = trim($realm, '-.');
            $trackList = preg_split('#\\D+#', $realm);
            $debug = 'user_id = ' . $userId . '<br />';
            $debug .= 'viewed = ' . $viewed . '<br />';
            $debug .= 'realm = ' . $realm . '<br />';
            $debug .= 'tracking = ' . implode(',', $trackList) . '<br />';
            //	$debug .= print_a($trackList, true);
            //	$mes -> addDebug($debug);
            if ($viewed != '') {
                $ue->user_extended_setvalue($userId, 'plugin_forum_viewed', mysql_real_escape_string($viewed));
                $result['viewcount']++;
            }
            if (is_array($trackList) && count($trackList)) {
                foreach ($trackList as $threadId) {
                    $result['trackcount']++;
                    $threadId = (int) $threadId;
                    if ($threadId > 0) {
                        $tmp = array();
                        $tmp['track_userid'] = $userId;
                        $tmp['track_thread'] = $threadId;
                        e107::getDb()->insert('forum_track', $tmp);
                    }
                }
            }
        }
    }
    $mes->addSuccess("User data move results:\n\t<ul>\n\t<li>Number of users processed: {$result['usercount']} </li>\n\t<li>Number of viewed data processed: {$result['viewcount']} </li>\n\t<li>Number of tracked records added: {$result['trackcount']} </li>\n\t</ul>\n\t");
    $text = "<form method='post' action='" . e_SELF . "?step=5'>\n\t<input class='btn btn-success' type='submit' name='nextStep[5]' value='Proceed to step 5' />\n\t</form>";
    $ns->tablerender($stepCaption, $mes->render() . $text);
}
Example #17
0
 $formix->validate('', 'p_uname,p_pwdx');
 if ($formix->is_error()) {
     $msgx->build_msg();
     header("location: index.php");
     exit;
 }
 if ($dbu->anti_sql_injection($_POST['p_uname']) and $dbu->anti_sql_injection($_POST['p_uname'])) {
     // lakukan proses login
     $passwordhash = md5(serialize($p_pwdx));
     $sql = "select *\n\t\t\t\tfrom " . $app['table']['pengguna'] . "\n\t\t\t\twhere username = '******'\n\t\t\t\t\t  and password = '******' and status = 'aktif'\n\t\t\t\tlimit 1";
     $dbu->query($sql, $rs['login'], $nr['login']);
     //echo $nr['login'];exit;
     if ($nr['login']) {
         $formix->reset();
         // $_SESSION['inline_edit'] = "on";
         $_SESSION['adminsession'] = $appx->serialize64($dbu->fetch($rs['login']));
         header("location: " . $app['webmin'] . "/index.php?act=home");
         exit;
     } else {
         //echo "masuk jeh nang kene";exit;
         $msgx->set_msg($app[lang][error]['invalid_login']);
         $msgx->build_msg();
         header("location: index.php");
         exit;
     }
 } else {
     $msgx->set_msg($app[lang][error]['invalid_login']);
     $msgx->build_msg();
     header("location: index.php");
     exit;
 }
Example #18
0
 /**
  * Render a single comment and any nested comments it may have. 
  *
  * @param array $row
  * @param string $table
  * @param string $action
  * @param integer $id
  * @param interger $width
  * @param string $subject
  * @param integer $addrating
  * @return html
  */
 function render_comment($row, $table, $action, $id, $width, $subject, $addrating = FALSE)
 {
     if ($this->engine != 'e107') {
         return null;
     }
     if ($user_func = e107::getOverride()->check($this, 'render_comment')) {
         return call_user_func($user_func, array('row' => $row, 'table' => $table, 'action' => $action, 'id' => $id, 'width' => $width, 'subject' => $subject, 'addrating' => $addrating));
     }
     //addrating	: boolean, to show rating system in rendered comment
     global $sc_style, $gen;
     $tp = e107::getParser();
     $sql = e107::getDb();
     $pref = e107::getPref();
     if (vartrue($pref['comments_disabled'])) {
         return;
     }
     global $NEWIMAGE, $USERNAME, $RATING, $datestamp;
     global $thisaction, $thistable, $thisid, $e107;
     $comrow = $row;
     $thistable = $table;
     $thisid = $id;
     $thisaction = $action;
     //FIXME - new level handler, currently commented to avoid parse errors
     //require_once (e_HANDLER."level_handler.php");
     if (!$width) {
         $width = 0;
     }
     if (!defined("IMAGE_nonew_comments")) {
         define("IMAGE_nonew_comments", file_exists(THEME . "images/nonew_comments.png") ? "<img src='" . THEME_ABS . "images/nonew_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/nonew_comments.png' alt=''  />");
     }
     if (!defined("IMAGE_new_comments")) {
         define("IMAGE_new_comments", file_exists(THEME . "images/new_comments.png") ? "<img src='" . THEME_ABS . "images/new_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/new_comments.png' alt=''  /> ");
     }
     //		$ns = new e107table;
     if (!$gen || !is_object($gen)) {
         $gen = new convert();
     }
     $row['rating_enabled'] = true;
     // Toggles rating shortcode. //TODO add pref
     e107::getScBatch('comment')->setVars($row);
     $COMMENT_TEMPLATE = $this->template;
     //	$COMMENT_TEMPLATE['ITEM_START'] 	= "\n\n<div id='{COMMENT_ITEMID}' class='comment-box clearfix'>\n";
     //	$COMMENT_TEMPLATE['ITEM_END']		= "\n</div><div class='clear_b'><!-- --></div>\n";
     //XXX Do NOT add to template - too important to allow for modification.
     $COMMENT_TEMPLATE['item_start'] = "\n\n<li id='{COMMENT_ITEMID}' class='media comment-box clearfix'>\n";
     $COMMENT_TEMPLATE['item_end'] = "\n</li>\n";
     if (defset('BOOTSTRAP') === 2 || defset('BOOTSTRAP') === true) {
         $COMMENT_TEMPLATE['item'] = str_replace("row", "row-fluid", $COMMENT_TEMPLATE['item']);
     }
     if (vartrue($pref['nested_comments'])) {
         //	$width2 = 100 - $width;
         //	$total_width = "95%";
         if ($width) {
             $renderstyle = $COMMENT_TEMPLATE['item_start'];
             $renderstyle .= "<div class='media offset" . $width . " col-md-offset-" . $width . "' >" . $COMMENT_TEMPLATE['item'] . "</div>";
             $renderstyle .= $COMMENT_TEMPLATE['item_end'];
         } else {
             $renderstyle = $COMMENT_TEMPLATE['item_start'] . $COMMENT_TEMPLATE['item'] . $COMMENT_TEMPLATE['item_end'];
         }
         if ($pref['comments_icon']) {
             if ($comrow['comment_datestamp'] > USERLV) {
                 $NEWIMAGE = IMAGE_new_comments;
             } else {
                 $NEWIMAGE = IMAGE_nonew_comments;
             }
         } else {
             $NEWIMAGE = "";
         }
     } else {
         $renderstyle = $COMMENT_TEMPLATE['item'];
     }
     $highlight_search = FALSE;
     if (isset($_POST['highlight_search'])) {
         $highlight_search = TRUE;
     }
     if (!defined("IMAGE_rank_main_admin_image")) {
         define("IMAGE_rank_main_admin_image", isset($pref['rank_main_admin_image']) && $pref['rank_main_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_main_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_main_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/main_admin.png' alt='' />");
     }
     if (!defined("IMAGE_rank_moderator_image")) {
         define("IMAGE_rank_moderator_image", isset($pref['rank_moderator_image']) && $pref['rank_moderator_image'] && file_exists(THEME . "forum/" . $pref['rank_moderator_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_moderator_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/admin.png' alt='' />");
     }
     if (!defined("IMAGE_rank_admin_image")) {
         define("IMAGE_rank_admin_image", isset($pref['rank_admin_image']) && $pref['rank_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/admin.png' alt='' />");
     }
     //	$RATING = ($addrating == TRUE && $comrow['user_id'] ? $rater->composerating($thistable, $thisid, FALSE, $comrow['user_id']) : "");
     $comment_shortcodes = e107::getScBatch('comment');
     $text = $tp->parseTemplate($renderstyle, TRUE, $comment_shortcodes);
     //FIXME - dramatically increases the number of queries performed.
     if ($action == "comment" && vartrue($pref['nested_comments'])) {
         $type = $this->getCommentType($thistable);
         $sub_query = "\n\t\t\tSELECT c.*, u.*, ue.*, r.*\n\t\t\tFROM #comments AS c\n\t\t\tLEFT JOIN #user AS u ON c.comment_author_id = u.user_id\n\t\t\tLEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id\n\t\t\tLEFT JOIN #rate AS r ON c.comment_id = r.rate_itemid AND r.rate_table = 'comments' \n\t\t\t\n\t\t\tWHERE comment_item_id='" . intval($thisid) . "' AND comment_type='" . $tp->toDB($type, true) . "' AND comment_pid='" . intval($comrow['comment_id']) . "'\n\t\t\t\n\t\t\t\n\t\t\tORDER BY comment_datestamp\n\t\t\t";
         $sql_nc = new db();
         /* a new db must be created here, for nested comment  */
         if ($sub_total = $sql_nc->gen($sub_query)) {
             while ($row1 = $sql_nc->fetch()) {
                 if ($this->isPending($row1)) {
                     $sub_total = $sub_total - 1;
                     continue;
                 }
                 if ($pref['nested_comments']) {
                     //	$width = min($width + 1, 80);
                     $width = $width + 1;
                     //	$width = $width=+1;
                     //	$text .= "WIDTH=".$width;
                 }
                 $text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating);
                 unset($width);
             }
         }
         $this->totalComments = $this->totalComments + $sub_total;
     }
     // End (nested comment handling)
     return $text;
 }
Example #19
0
//the identifier for the rss feed url
$feed['topic_id'] = '';
//the topic_id, empty on default (to select a certain category)
$feed['path'] = 'featurebox';
//this is the plugin path location
$feed['text'] = 'this is the rss feed for the featurebox entries';
$feed['class'] = '0';
$feed['limit'] = '9';
$eplug_rss_feed[] = $feed;
//##### ------------------------------------------------------------------------------------
//##### create rss data, return as array $eplug_rss_data -----------------------------------
$rss = array();
$sqlrss = new db();
if ($items = $sqlrss->select('featurebox', "*", "fb_class = 0 DESC LIMIT 0," . $this->limit)) {
    $i = 0;
    while ($rowrss = $sqlrss->fetch()) {
        $rss[$i]['author'] = '';
        $rss[$i]['author_email'] = '';
        $rss[$i]['link'] = '';
        $rss[$i]['linkid'] = '';
        $rss[$i]['title'] = $rowrss['fb_title'];
        $rss[$i]['description'] = $rowrss['fb_text'];
        $rss[$i]['category_name'] = '';
        $rss[$i]['category_link'] = '';
        $rss[$i]['datestamp'] = '';
        $rss[$i]['enc_url'] = '';
        $rss[$i]['enc_leng'] = '';
        $rss[$i]['enc_type'] = '';
        $i++;
    }
}
Example #20
0
        </th>
        <th>
          <div><span>rute</span></div>
        </th>
        <th>
          <div><span>biaya</span></div>
        </th>
        <th>
          <div><span>aktifitas</span></div>
        </th>
      </tr>
    </thead>
    <tbody>
      <?php 
$nors = 1;
while ($rshasil = $dbu->fetch($rsbrowse)) {
    ?>
        <tr <?php 
    echo $nors % 2 == 1 ? 'class="odd"' : 'class="even"';
    ?>
>
          <td style="text-align:center;"><?php 
    echo $nors;
    ?>
</td>
          <td style="text-align:center">
            <a href="index.php?act=update&p_id=<?php 
    echo $rshasil[id];
    ?>
" >
              <span class="ion-compose"></span>
Example #21
0
 /**
  *	Show the 'Send to' form
  *	@param array|int $to_uid - a PM block of message to reply to, or UID of user to send to
  *
  *	@return string text for display
  */
 function show_send($to_uid)
 {
     $pm_info = array();
     $pm_outbox = $this->pmManager->pm_getInfo('outbox');
     if (is_array($to_uid)) {
         $pm_info = $to_uid;
         // We've been passed a 'reply to' PM
         $to_uid = $pm_info['pm_from'];
     }
     if ($to_uid) {
         $sql2 = new db();
         if ($sql2->select('user', 'user_name', 'user_id = ' . intval($to_uid))) {
             $row = $sql2->fetch();
             $pm_info['from_name'] = $row['user_name'];
         }
     }
     //echo "Show_send: {$to_uid} from {$pm_info['from_name']} is happening<br />";
     if ($pm_outbox['outbox']['filled'] >= 100) {
         return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13);
     }
     $tpl_file = THEME . 'pm_template.php';
     include_once is_readable($tpl_file) ? $tpl_file : e_PLUGIN . 'pm/pm_template.php';
     $enc = check_class($this->pmPrefs['attach_class']) ? "enctype='multipart/form-data'" : '';
     //	setScVar('pm_handler_shortcodes','pmInfo', $pm_info);
     $sc = e107::getScBatch('pm', TRUE);
     $sc->setVars($pm_info);
     $PM_SEND_PM = $this->updateTemplate($PM_SEND_PM);
     $text = "<form {$enc} method='post' action='" . e_SELF . "' id='dataform'>\n\t\t<div><input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />" . e107::getParser()->parseTemplate($PM_SEND_PM, TRUE, $sc) . '</div></form>';
     return $text;
 }
Example #22
0
 public static function getUnreadCount($recipient)
 {
     global $db;
     $result = $db->query('select count(*) as count from messages where recipient="' . $recipient . '" and viewed=0');
     $row = db::fetch($result);
     return $row['count'];
 }
Example #23
0
?>
<body >
	<div class="wrapall">
		<div class="wrapcontent">
			<div class="content add_fix news">
				<div class="head_nf">
					<ul>
						<li <?php 
echo $tabnya == 0 ? 'class="active"' : "";
?>
><a href="<?php 
echo $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='5' and id_bahasa='" . $_SESSION[bhs] . "'") . "/all/";
?>
">ALL</a></li>
						<?php 
while ($dtab = $dbu->fetch($tabKat)) {
    $hitTab = $dbu->count_record("id", $app[table][berita], " where id_kat ='" . $dtab[id] . "'");
    if ($hitTab > 0) {
        ?>
								<li <?php 
        echo $tabnya == $dtab[id] ? 'class="active"' : "";
        ?>
><a href="<?php 
        echo $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='5' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($dtab[kategori]) . "/";
        ?>
"><?php 
        echo strtoupper($dtab[kategori]);
        ?>
</a></li>
								<?php 
    }
Example #24
0
/**
 * @param $parm
 * @usage {USER_EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
 * @example {USER_EXTENDED=user_gender.value.5}  will show the value of the extended field user_gender for user #5
 * @return bool|string
 */
function user_extended_shortcode($parm)
{
    $currentUser = e107::user();
    $tp = e107::getParser();
    global $loop_uid, $e107, $sc_style;
    //	include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user_extended.php');
    $parms = explode('.', $parm);
    if (isset($loop_uid) && intval($loop_uid) == 0) {
        return '';
    }
    $key = $parms[0] . "." . $parms[1];
    $sc_style['USER_EXTENDED']['pre'] = isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '';
    $sc_style['USER_EXTENDED']['post'] = isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '';
    //include_once(e_HANDLER.'user_extended_class.php');
    $ueStruct = e107::getUserExt()->user_extended_getStruct();
    //	$ueStruct = e107_user_extended::user_extended_getStruct();
    $uid = intval(varset($parms[2], 0));
    if ($uid == 0) {
        if (isset($loop_uid) && intval($loop_uid) > 0) {
            $uid = $loop_uid;
        } else {
            $uid = USERID;
        }
    }
    $udata = e107::user($uid);
    $udata['user_class'] .= $udata['user_class'] == '' ? '' : ',';
    $udata['user_class'] .= e_UC_PUBLIC . "," . e_UC_MEMBER;
    if (!empty($udata['user_admin'])) {
        $udata['user_class'] .= ',' . e_UC_ADMIN;
    }
    // Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
    // And I don't think this should apply to icons
    /**
     *	@todo - must be a better way of picking up the 'Miscellaneous' category
     */
    include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_user.php');
    if ($parms[1] != 'icon' && $parms[0] != LAN_USER_44) {
        $fkeyApplic = varset($ueStruct["user_" . $parms[0]]['user_extended_struct_applicable']);
        $fkeyRead = varset($ueStruct["user_" . $parms[0]]['user_extended_struct_read']);
        $fkeyStruct = varset($ueStruct["user_" . $parms[0]]['user_extended_struct_parms']);
        $ret_cause = 0;
        if (!check_class($fkeyApplic, $udata['user_class'])) {
            $ret_cause = 1;
        }
        if (!check_class($fkeyRead, $udata['user_class'])) {
            $ret_cause = 2;
        }
        if ($ueStruct["user_" . $parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID)) {
            $ret_cause = 3;
        }
        if (!ADMIN && substr($fkeyStruct, -1) == 1 && strpos($udata['user_hidden_fields'], "^user_" . $parms[0] . "^") !== FALSE && $uid != USERID) {
            $ret_cause = 4;
        }
        if ($ret_cause != 0) {
            return FALSE;
        }
    }
    if ($parms[1] == 'text_value') {
        //	$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
        $_value = user_extended_shortcode($parms[0] . ".value");
        if ($_value) {
            $__pre = isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '';
            $__post = isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '';
            //		$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
            $_text = user_extended_shortcode($parms[0], ".text");
            $_mid = isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : '';
            return $__pre . $_text . $_mid . $_value . $__post;
        }
        return false;
    }
    if ($parms[1] == 'text') {
        $text_val = $ueStruct['user_' . $parms[0]]['user_extended_struct_text'];
        if ($text_val) {
            return defined($text_val) ? constant($text_val) : $text_val;
        } else {
            return FALSE;
        }
    }
    if ($parms[1] == 'icon') {
        if (defined(strtoupper($parms[0]) . '_ICON')) {
            return constant(strtoupper($parms[0]) . '_ICON');
        } elseif (is_readable(e_IMAGE . "user_icons/user_{$parms[0]}.png")) {
            return "<img src='" . e_IMAGE_ABS . "user_icons/user_{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
        } elseif (is_readable(e_IMAGE . "user_icons/{$parms[0]}.png")) {
            return "<img src='" . e_IMAGE_ABS . "user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
        }
        //return '';
        return FALSE;
    }
    if ($parms[1] == 'value') {
        $uVal = str_replace(chr(1), '', $udata['user_' . $parms[0]]);
        switch ($ueStruct["user_" . $parms[0]]['user_extended_struct_type']) {
            case EUF_DB_FIELD:
                // check for db_lookup type
                $tmp = explode(',', $ueStruct['user_' . $parms[0]]['user_extended_struct_values']);
                $sql_ue = new db();
                // Use our own DB object to avoid conflicts
                if ($sql_ue->select($tmp[0], "{$tmp[1]}, {$tmp[2]}", "{$tmp[1]} = '{$uVal}'")) {
                    $row = $sql_ue->fetch();
                    $ret_data = $row[$tmp[2]];
                } else {
                    $ret_data = FALSE;
                }
                break;
            case EUF_DATE:
                //check for 0000-00-00 in date field
                if ($uVal == '0000-00-00') {
                    $uVal = '';
                }
                $ret_data = $uVal;
                break;
            case EUF_PREDEFINED:
                // Predefined field - have to look up display string in relevant file
                $ret_data = e107::getUserExt()->user_extended_display_text($ueStruct['user_' . $parms[0]]['user_extended_struct_values'], $uVal);
                break;
            default:
                $ret_data = $uVal;
        }
        if ($ret_data != '') {
            return $tp->toHTML($ret_data, TRUE, 'no_make_clickable', "class:{$udata['user_class']}");
        }
        return FALSE;
    }
    // return TRUE;
    return FALSE;
}
Example #25
0
</form>
<?php 
        } else {
            ?>
<fieldset><legend>忘記密碼</legend>
<label>查無此帳號!!</label></fieldset>
<?php 
        }
        break;
    case 2:
        $A = new db();
        $account = get("account");
        $answer = get("answer");
        $A->query("select * from accounts where account = '{$account}' and answer='{$answer}'");
        if ($A->count() > 0) {
            $A->fetch();
            setsession("account", get("account"));
            setsession("id", $A->element("id"));
            ?>
<form action="/44/member/" method="post">
<fieldset><legend>忘記密碼</legend>
<label>已成功回答問題,已將您登入。</label><br>
<input type="submit" value="確定">
</fieldset>
</form>
<?php 
        } else {
            ?>
<fieldset><legend>忘記密碼</legend>
<label>答案錯誤!!</label></fieldset>
<?php 
Example #26
0
 function get_bottom_parent($id, &$child)
 {
     global $app;
     // $appx = new app();
     $dbu = new db();
     $adminlib = new admlib();
     $dat = $dbu->get_recordset('product_parent', 'parent_id', $id);
     while ($record = $dbu->fetch($dat)) {
         $child[] = $record['id'];
     }
     while (list($k, $v) = @each($child)) {
         $admlib->get_bottom_parent($v, $child);
     }
     return $child;
 }
Example #27
0
        $text .= $mains;
        $text .= $rs->form_select_close();
        $text .= "<br />";
    } else {
        $text .= $cap . "<br />";
        $text .= $mains . "<br />";
    }
}
//categories ------------------------
if (isset($linkspage_pref['link_menu_category']) && $linkspage_pref['link_menu_category']) {
    $mains = "";
    $cap = isset($linkspage_pref['link_menu_category_caption']) && $linkspage_pref['link_menu_category_caption'] ? $linkspage_pref['link_menu_category_caption'] : LCLAN_OPT_83;
    $sqlc = new db();
    $sql2 = new db();
    if ($sqlc->db_Select("links_page_cat", "link_category_id, link_category_name, link_category_sef", "link_category_class REGEXP '" . e_CLASS_REGEXP . "' ORDER BY link_category_order")) {
        while ($rowc = $sqlc->fetch()) {
            if (isset($linkspage_pref['link_menu_category_amount']) && $linkspage_pref['link_menu_category_amount']) {
                $amount = $sql2->count("links_page", "(*)", "WHERE link_category = '" . $rowc['link_category_id'] . "' AND link_active = 1 AND link_class REGEXP '" . e_CLASS_REGEXP . "' ");
                $amount = "(" . $amount . ")";
            } else {
                $amount = "";
            }
            if (isset($linkspage_pref['link_menu_category_rendertype']) && $linkspage_pref['link_menu_category_rendertype'] == "1") {
                $mains .= $rs->form_option($rowc['link_category_name'] . " " . $amount, "0", e107::url('links_page', 'category', $rowc, 'full'), "");
            } else {
                $mains .= $bullet . " <a href='" . e107::url('links_page', 'category', $rowc, 'full') . "'>" . $rowc['link_category_name'] . "</a> " . $amount . "<br />";
            }
        }
        if (isset($linkspage_pref['link_menu_category_rendertype']) && $linkspage_pref['link_menu_category_rendertype'] == "1") {
            $selectjs = "style='width:100%;' onchange=\"if(this.options[this.selectedIndex].value != ''){ return document.location=this.options[this.selectedIndex].value; }\" ";
            $text .= $rs->form_select_open("category", $selectjs);
Example #28
0
        $f_index = 'USE INDEX(dateline)';
    }
}
$appid = empty($_GET['appid']) ? 0 : intval($_GET['appid']);
if ($appid) {
    $wheresql['appid'] = "appid='{$appid}'";
}
$icon = empty($_GET['icon']) ? '' : trim($_GET['icon']);
if ($icon) {
    $wheresql['icon'] = "icon='{$icon}'";
}
$gid = !isset($_GET['gid']) ? '-1' : intval($_GET['gid']);
if ($gid >= 0) {
    $fuids = array();
    $query = db::query("SELECT * FROM " . db::table('home_friend') . " WHERE uid='{$_G['uid']}' AND gid='{$gid}' ORDER BY num DESC LIMIT 0,100");
    while ($value = db::fetch($query)) {
        $fuids[] = $value['fuid'];
    }
    if (empty($fuids)) {
        $need_count = false;
    } else {
        $wheresql['uid'] = "uid IN (" . dimplode($fuids) . ")";
    }
}
$gidactives[$gid] = ' class="a"';
$feed_users = $feed_list = $user_list = $filter_list = $list = $mlist = array();
$count = $filtercount = 0;
$multi = '';
if ($need_count) {
    $query = DB::query("SELECT * FROM " . DB::table('home_feed') . " {$f_index}\n\t\tWHERE " . implode(' AND ', $wheresql) . "\n\t\tORDER BY {$ordersql}\n\t\tLIMIT {$start},{$perpage}");
    if ($_GET['view'] == 'me') {
Example #29
0
echo $dbu->lookup("nama", "destinasi_bahasa", "id_reff ='" . $dbu->lookup("id_reff", "destinasi", "id='" . $p_id . "'") . "'");
?>
</h2>
  <br/> 
<form method="post" enctype="multipart/form-data">
<div>
	<?php 
$sql = "SELECT id from " . $app[table][bahasa] . " where status = 'aktif' order by id";
//echo $sql;
$dbu->query($sql, $rsp, $nrp);
?>
	<div>bahasa (masukan semua isian sesuai pilihan bahasa)</div>
	<div>
	<select name="p_bahasa" id="p_bahasa" >
		<?php 
while ($frsp = $dbu->fetch($rsp)) {
    ?>
			<option value="<?php 
    echo $frsp[id];
    ?>
"><?php 
    echo $dbu->lookup("bahasa", "bahasa", "id='" . $frsp[id] . "'");
    ?>
</option>
		<?php 
}
?>
	</select>
	</div>
</div>
<br/>
Example #30
0
	private function __configLoad($class="",$init=false)
	{
		if(!$class)$class=$this->class;
		if($class==$this->class)
		{
			//очищаем конфиг, если нужно
			if($init && isset($this->config[$this->class]) && isset($this->config[$this->class]["config-reload"]["value"]))
			{
				$t=time();
				if(($t-$this->configTime)>(0+$this->config[$this->class]["config-reload"]["value"]))
				{
					$this->configTime=$t;
					$this->config=array();
				}
			}
			//загружаем с нуля
			if(!isset($this->config[$this->class]))
			{
				$this->config[$this->class]=array(
					"config-reload"		=>	array("params"=>"","value"=>"300"),
					"domainName"		=>	array("params"=>"","value"=>"mydomain.ru"),
					"domainNameDev"		=>	array("params"=>"","value"=>"dev.mydomain.ru"),
					"domainNameLoc"		=>	array("params"=>"","value"=>"mydomain.loc"),
					"elNameAction"		=>	array("params"=>"","value"=>"action"),
					"elNameForm"		=>	array("params"=>"","value"=>"form-main"),
					"siteName"			=>	array("params"=>"","value"=>"Web-site"),
					"template"			=>	array("params"=>"","value"=>"default"),
					"uriParseType"		=>	array("params"=>"CORE_URI_PARSE_FIRSTSECT","value"=>CORE_URI_PARSE_FIRSTSECT),
				);
				//перезаписывам значения по-умолчанию значенияи из пользовательского конфига
				$cincl=FLEX_APP_DIR_DAT."/_".$this->class."/config.php";
				if(@file_exists($cincl))include $cincl;
				else {
					$cincl=FLEX_APP_DIR."/config.php";
					if(@file_exists($cincl))include $cincl;
					else die("Critical: config file was not found.");
				}
				if(!isset($global_cfg) || !count($global_cfg))die("Critical: config data was not found.");
				foreach($global_cfg as $mod=>$cfg)
				{
					if(!is_array($cfg))continue;
					if(!isset($this->config[$mod]))$this->config[$mod]=array();
					foreach($cfg as $name=>$val)
					{
						if(is_string($val))$this->config[$mod][$name]=array("params"=>"","value"=>$val);
						else
						{
							if(is_array($val))
							{
								if(isset($va["params"]) && isset($val["value"]))$this->config[$mod][$name]=$val;
							}
						}
					}
				}
			}
			if($init)
			{
				//инициализация базы данных
				$dl=$this->config[$this->class]["domainNameLoc"]["value"];
				$dd=$this->config[$this->class]["domainNameDev"]["value"];
				if($dl && (strpos($_SERVER["HTTP_HOST"],$dl)!==false))$this->domainType=CORE_DOMAIN_TYPE_LOC;
				elseif($dd && strpos($_SERVER["HTTP_HOST"],$dd)!==false)$this->domainType=CORE_DOMAIN_TYPE_DEV;
				else $this->domainType=CORE_DOMAIN_TYPE_MAIN;
				@call_user_func(array(__NAMESPACE__."\\db",$this->modHookNames["init"]));
			}
			$mid=0;
		}
		else
		{
			$mid=$this->modId($class);
			if(!$mid)return;
		}
		$r=db::q("SELECT * FROM ".db::tn("config")." WHERE `mid`=".$mid,true);
		while($row=db::fetch($r))$this->config[$class][$row["name"]]=array("params"=>$row["params"],"value"=>$row["value"]);
	}