/** * Display authentication log. * * @param array $vars * @return none * */ function print_authlog($vars) { $authlog = get_authlog_array($vars); if (!$authlog['count']) { // There have been no entries returned. Print the warning. Shouldn't happen, how did you get here without auth?! print_warning('<h4>No authentication entries found!</h4>'); } else { // Entries have been returned. Print the table. $string = "<table class=\"table table-bordered table-striped table-hover table-condensed table-rounded\">\n <thead>\n <tr>\n <th style=\"width: 200px;\">Date</th>\n <th style=\"width: 200px;\">User</th>\n <th style=\"width: 200px;\">From</th>\n <th>Action</th>\n </tr>\n </thead>\n <tbody>"; foreach ($authlog['entries'] as $entry) { if (strstr(strtolower($entry['result']), 'fail', true)) { $class = " class=\"error\""; } else { $class = ""; } $string .= ' <tr' . $class . '> <td>' . $entry['datetime'] . '</td> <td>' . $entry['user'] . '</td> <td>' . $entry['address'] . '</td> <td>' . $entry['result'] . '</td> </tr>' . PHP_EOL; } $string .= ' </tbody>' . PHP_EOL; $string .= '</table>'; // Add pagination header if ($authlog['pagination'] && !$authlog['short']) { $string = pagination($vars, $authlog['count']) . $string . pagination($vars, $authlog['count']); } // Print authlog echo $string; } }
/** * Name: getData * * @param type $url link za paginaciju * @param type $cookie_name naziv kolacica * @param type $is_archive da li je anketa arhivira ili nije; 1 - jeste, 0 - nije */ function getData($url, $cookie_name, $is_archive = 0) { $q = get_cookie($cookie_name); $perPage = $this->input->post('perPage'); $perP = $perPage ? $perPage : $q; $has_error = 0; $message = __('Uspesno dobavljeni podaci!!', $this->template['module']); // var_dump($message); exit; if (is_numeric($this->anketa->getTotalRows($is_archive))) { pagination($url, $this->anketa->getTotalRows($is_archive), $perP, '4', 'ankete'); } else { $has_error = 2; $message = "Doslo je do greske."; } $page = uri_segment('4'); if (!($data = $this->anketa->fetch_ankete($perP, $page, $is_archive))) { $has_error = 1; $message = __('Trenutno nema anketa!!! Unesite anketu klikom na', $this->template['module']); } if (!empty($data)) { $redni_broj = isset($page) ? $page : 0; foreach ($data as $anketa) { $anketa->datum_kreiranja = formatDate($anketa->datum_kreiranja); $anketa->redni_broj = ++$redni_broj; } } $links = create_links(); $uri = $page; $result = array('data' => $data, 'links' => $links, 'error' => $has_error, 'uri' => $uri, 'poruka' => $message); $this->response($result); }
public function doWebList() { global $_GPC, $_W; $uniacid = $_W["uniacid"]; $pindex = max(1, intval($_GPC['page'])); $psize = 20; $where = ""; $mark = $_GPC['mark']; $keyword = $_GPC['keyword']; if (!empty($mark)) { $where .= " AND mark = '{$mark}'"; } if (!empty($keyword)) { $where .= " AND title like '%{$keyword}%'"; } if (!empty($_GPC['Deleteall']) && !empty($_GPC['select'])) { foreach ($_GPC['select'] as $k => $v) { pdo_delete('hx_dialect_questions', array('id' => $v, 'uniacid' => $_W['uniacid'])); } message('成功删除选中的防伪码!', referer(), 'success'); } if (!empty($_GPC['Frozenall']) && !empty($_GPC['select'])) { foreach ($_GPC['select'] as $k => $v) { pdo_update('securitys_data', array('status' => 0), array('id' => $v, 'uniacid' => $_W['uniacid'])); } message('成功冻结选中的防伪码!', referer(), 'success'); } $list = pdo_fetchall("SELECT * from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn("SELECT COUNT(*) from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc"); $pager = pagination($total, $pindex, $psize); load()->func('tpl'); include $this->template('list'); }
public function doWebList() { //这个操作被定义用来呈现 管理中心导航菜单 global $_W, $_GPC; $pindex = max(1, intval($_GPC['page'])); $psize = 20; $condition = ''; if (!empty($_GPC['keyword'])) { $condition .= " AND title LIKE '%{$_GPC['keyword']}%'"; } if (!empty($_GPC['createtime'])) { $c_s = strtotime($_GPC['createtime']['start']); $c_e = strtotime($_GPC['createtime']['end']); $condition .= " AND createtime >= '{$c_s}' AND createtime <= '{$c_e}'"; } if (empty($_GPC['createtime'])) { $c_s = time() - 86400 * 30; $c_e = time() + 84400; } $list = pdo_fetchall("SELECT * FROM " . tablename('hx_pictorial') . " WHERE weid = '{$_W['uniacid']}' {$condition} ORDER BY displayorder DESC, id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('hx_pictorial') . " WHERE weid = '{$_W['uniacid']}' {$condition}"); $pager = pagination($total, $pindex, $psize); if (!empty($list)) { foreach ($list as &$row) { $row['total'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('hx_pictorial_photo') . " WHERE pictorialid = :pictorialid", array(':pictorialid' => $row['id'])); } } load()->func('tpl'); include $this->template('list'); }
public function doWebAwardlist() { global $_GPC, $_W; $id = intval($_GPC['id']); if (checksubmit('delete')) { pdo_delete('zzz_user', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page']))); } if (!empty($_GPC['wid'])) { $wid = intval($_GPC['wid']); pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid)); message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page']))); } $pindex = max(1, intval($_GPC['page'])); $psize = 50; $where = ''; $condition = array('mobile' => " AND `b`.`mobile` LIKE '%" . $_GPC['profilevalue'] . "%'", 'realname' => " AND `b`.`realname` LIKE '%" . $_GPC['profilevalue'] . "%'", 'nickname' => " AND `b`.`nickname` LIKE '%" . $_GPC['profilevalue'] . "%'"); if (!empty($_GPC['profile'])) { $where .= $condition[$_GPC['profile']]; } $sql = 'SELECT `a`.`id`, `a`.`friendcount`, `a`.`points`, `a`.`createtime`, `b`.`realname`, `b`.`nickname`, `b`.`mobile` FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` = `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . " AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid {$where} ORDER BY `a`.`points`\n DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize; $params = array(':rid' => $id); $list = pdo_fetchall($sql, $params); if (!empty($list)) { $sql = 'SELECT COUNT(*) FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` = `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . ' AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid' . $where; $total = pdo_fetchcolumn($sql, $params); $pager = pagination($total, $pindex, $psize); } include $this->template('awardlist'); }
public function doWebDisplay() { global $_W, $_GPC; if (empty($_GPC['do'])) { $_GPC['do'] = 'display'; } $pindex = max(1, intval($_GPC['page'])); $psize = 20; $condition = ''; if (!empty($_GPC['keyword'])) { $condition .= " AND title LIKE '%{$_GPC['keyword']}%'"; } if (is_array($_GPC['industry'])) { if (!empty($_GPC['industry']['parent'])) { $condition .= " AND industry1 = '{$_GPC['industry']['parent']}'"; } if (!empty($_GPC['industry']['child'])) { $condition .= " AND industry2 = '{$_GPC['industry']['child']}'"; } } $list = pdo_fetchall("SELECT * FROM " . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition}"); $pager = pagination($total, $pindex, $psize); include $this->template('display'); }
function get_authlog_array($vars) { $array = array(); // Short authlog? (no pagination, small out) $array['short'] = isset($vars['short']) && $vars['short']; // With pagination? (display page numbers in header) $array['pagination'] = isset($vars['pagination']) && $vars['pagination']; pagination($vars, 0, TRUE); // Get default pagesize/pageno $array['pageno'] = $vars['pageno']; $array['pagesize'] = $vars['pagesize']; $start = $array['pagesize'] * $array['pageno'] - $array['pagesize']; $pagesize = $array['pagesize']; $query = " FROM `authlog`"; $query_count = 'SELECT COUNT(`id`) ' . $query; $query_updated = 'SELECT MAX(`datetime`) ' . $query; $query = 'SELECT * ' . $query; $query .= ' ORDER BY `datetime` DESC '; $query .= "LIMIT {$start},{$pagesize}"; // Query authlog $array['entries'] = dbFetchRows($query, $param); // Query authlog count if ($array['pagination'] && !$array['short']) { $array['count'] = dbFetchCell($query_count, $param); $array['pagination_html'] = pagination($vars, $array['count']); } else { $array['count'] = count($array['entries']); } // Query for last timestamp $array['updated'] = dbFetchCell($query_updated, $param); return $array; }
public function index() { if (!$this->session->userdata('access_token')) { redirect('login', 'refresh'); } else { $data = $this->tq_admin_header_info(); $id = $this->input->get('id'); $results = $this->input->get('results'); $page = $this->input->get('page'); $data['results'] = $results ? $results : 10; $data['page'] = $page ? $page : 1; if (!empty($id)) { $results = doCurl(API_BASE_LINK . 'priest_preach/get_priest_preach_by_id?id=' . $id . '&' . 'limit=' . $data['results'] . '&' . 'page=' . $data['page']); if ($results && $results['http_status_code'] == 200) { $content = json_decode($results['output']); $status_code = $content->status_code; if ($status_code == 200) { $data['total'] = $content->total; $data['content'] = $content->results; $uri = 'priest_preach'; $data['pagination'] = pagination($content->total, $data['page'], $content->results, $uri); } } else { show_404(); exit; } } else { show_404(); exit; } $this->load->view('priest_preach/priest_preach_view', isset($data) ? $data : ""); } }
public function index() { if ($this->session->flashdata('success')) { $data['success'] = $this->session->flashdata('success'); } elseif ($this->session->flashdata('failed')) { $data['failed'] = $this->session->flashdata('failed'); } if ($this->checkTA() == FALSE) { $this->session->set_flashdata('failed', 'Maaf, anda tidak dapat mengakses halaman tersebut!'); redirect('thread/'); } $user = sentinel()->getUser(); $data['categoriesSide'] = $this->model_thread->get_categories(); $data['threadSide'] = $this->model_thread->get_all_threads($user->id); $data['closeThreads'] = $this->model_thread->get_close_threads($user->id); $data['tenagaAhli'] = $user->id; $data['draftSide'] = $this->model_thread->get_all_drafts($user->id); $data['authorSide'] = $this->model_thread->get_thread_from_author($user->id); $data['provinsi'] = $this->getWilayah(); $topics = collect($this->model_topic->get_topics_from_id($user->id)); $perPage = 5; $data['topics'] = pagination($topics, $perPage, 'topic', 'bootstrap_md'); $data['perPage'] = $perPage; $this->load->view('topic/view', $data); }
public function doWebAwardlist() { global $_GPC, $_W; checklogin(); $id = intval($_GPC['id']); if (checksubmit('delete')) { pdo_delete('zzz_user', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page']))); } if (!empty($_GPC['wid'])) { $wid = intval($_GPC['wid']); pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid)); message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page']))); } $pindex = max(1, intval($_GPC['page'])); $psize = 50; $where = ''; $condition = array('mobile' => " AND b.mobile ='{$_GPC['profilevalue']}'", 'realname' => " AND b.realname ='{$_GPC['profilevalue']}'"); if (!empty($_GPC['profile'])) { $where .= $condition[$_GPC['profile']]; } $sql = "SELECT a.id,a.friendcount,a.points,a.createtime, b.realname,b.nickname, b.mobile FROM " . tablename('zzz_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = '{$id}' {$where} ORDER BY a.points DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}"; //echo $sql; $list = pdo_fetchall($sql); if (!empty($list)) { $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('zzz_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = '{$id}' {$where}"); $pager = pagination($total, $pindex, $psize); } include $this->template('awardlist'); }
function admin_order_index() { $pagination = pagination(15, 'orders'); $subject_index = '<table class="table table-hover table-bordered">'; $subject_index .= '<tr><th>Order #</th><th>Order by</th><th>Order Total</th><th>Status</th><th>Modification</th></tr>'; while ($subject = mysql_fetch_array($pagination['query'])) { $subject_index .= '<tr>'; $subject_index .= '<td>' . $subject['id'] . '</td>'; // get user name by its id ! $order_by = get_user_by_id($subject['user_id']); $subject_index .= '<td>' . $order_by['username'] . '</td>'; $subject_index .= '<td style="color: green;">$' . $subject['order_total'] . '</td>'; if ($subject['status'] == 1) { $subject_index .= '<td style="color: red;">Recieved</td>'; } elseif ($subject['status'] == 2) { $subject_index .= '<td style="color: orange;">Process</td>'; } elseif ($subject['status'] == 3) { $subject_index .= '<td style="color: green;">Completed</td>'; } else { $subject_index .= '<td>No Status !</td>'; } $subject_index .= '<td><a href="' . site_options('link') . 'admin/edit_order.php?order=' . $subject['id'] . '">Details </a>'; $alert = "'Are you sure you want to delete this page?'"; $subject_index .= '/ <a href="' . site_options('link') . 'admin/delete_order.php?order=' . $subject['id'] . '" onclick="return confirm(' . $alert . ');">Delete</a></td>'; $subject_index .= '</tr>'; } $subject_index .= '</table>'; $subject_index .= $pagination['index']; return $subject_index; }
function travel_article_search($cid, $type = '', $psize = 20, $orderby = 'id DESC') { global $_GPC, $_W; $pindex = max(1, intval($_GPC['page'])); $result = array(); $condition = " WHERE weid = '{$_W['weid']}' AND "; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= "ccate = '{$cid}'"; } else { $condition .= "pcate = '{$cid}'"; } } if (!empty($cid) && !empty($type)) { $condition .= " OR "; } if (!empty($type)) { $type = explode(',', $type); foreach ($type as $item) { $condition .= "type LIKE '%{$item},%'"; } } $sql = "SELECT * FROM " . tablename('travel') . $condition . ' ORDER BY ' . $orderby; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('travel') . $condition); $result['pager'] = pagination($total, $pindex, $psize); return $result; }
public function doWebList() { global $_GPC, $_W; checklogin(); $weid = $_W['account']['weid']; //当前公众号ID $id = intval($_GPC['id']); $condition = ''; if (!empty($_GPC['name'])) { $condition .= " AND ( grabername LIKE '%{$_GPC['realname']}%' OR fitername LIKE '%{$_GPC['realname']}%' )"; } if (!empty($_GPC['mobile'])) { $condition .= " AND ( grabermobile = '{$_GPC['mobile']}' OR fitermobile = '{$_GPC['mobile']}' )"; } if (checksubmit('delete')) { pdo_delete('grabseat_record', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page']))); } if (!empty($_GPC['wid'])) { $wid = intval($_GPC['wid']); pdo_update('grabseat_record', array('status' => intval($_GPC['status'])), array('id' => $wid)); message('标识领奖成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page']))); } $pindex = max(1, intval($_GPC['page'])); $psize = 25; $list = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $listtotal = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} "); $total = count($listtotal); $pager = pagination($total, $pindex, $psize); include $this->template('list'); }
public function show() { $weiboid = intval($_GET['id']); $strWeibo = $this->getOneWeibo($weiboid); if ($weiboid == 0 || $strWeibo == '') { ts404(); } if ($strWeibo['isaudit'] == 1) { tsNotice('内容审核中...'); } //comment $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('weibo', 'show', array('id' => $weiboid, 'page' => '')); $lstart = $page * 20 - 20; $arrComments = $this->findAll('weibo_comment', array('weiboid' => $weiboid), 'addtime desc', 'commentid', $lstart . ',20'); foreach ($arrComments as $key => $item) { $arrComment[] = $this->getOneComment($item['commentid']); } $commentNum = $this->findCount('weibo_comment', array('weiboid' => $weiboid)); $pageUrl = pagination($commentNum, 20, $page, $url); //他的更多唠叨 $arrWeibo = $this->findAll('weibo', array('userid' => $strWeibo['userid']), 'addtime desc', null, 20); $weiboNum = $this->findCount('weibo', array('userid' => $strWeibo['userid'])); if ($weiboNum < 20) { $num = 20 - $weiboNum; $userid = $strWeibo['userid']; $arrNewWeibo = $this->findAll('weibo', "`userid`!='{$userid}'", 'addtime desc', null, $num); $arrWeibo = array_merge($arrWeibo, $arrNewWeibo); } $title = cututf8(t(tsDecode($strWeibo['content'])), 0, 100, false); include template('show'); }
function display($params) { $Log_Model = new Log_Model(); $options_cache = Option::getAll(); extract($options_cache); $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1; $tag = isset($params[1]) && $params[1] == 'tag' ? addslashes(urldecode(trim($params[2]))) : ''; $pageurl = ''; //page meta $site_title = stripslashes($tag) . ' - ' . $site_title; $Tag_Model = new Tag_Model(); $blogIdStr = $Tag_Model->getTagByName($tag); if ($blogIdStr === false) { show_404_page(); } $sqlSegment = "and gid IN ({$blogIdStr}) order by date desc"; $lognum = $Log_Model->getLogNum('n', $sqlSegment); $total_pages = ceil($lognum / $index_lognum); if ($page > $total_pages) { $page = $total_pages; } $pageurl .= Url::tag(urlencode($tag), 'page'); $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum); $page_url = pagination($lognum, $index_lognum, $page, $pageurl); include View::getView('header'); include View::getView('log_list'); }
public function detail($id) { $this->form_validation->set_rules('isi', 'Isi', 'required'); if ($this->form_validation->run() == FALSE) { $detail['konsultasi'] = $this->M_konsultasi->getByIdKonsultasi($id); $detail['kategori'] = $this->M_konsultasi->getKatByKons($id); $balasan = collect($this->M_konsultasi->getReply($id)); $detail['reply'] = pagination($balasan, 3, 'konsultasi/detail/' . $id, 'bootstrap_md'); $this->template->build('detail', $detail); } else { $config['upload_path'] = PATH_KONSULTASI_ATTACHMENT; $config['allowed_types'] = 'gif|jpg|jpeg|png|pdf|doc|xls|xlsx|docx|zip|txt|ppt|pptx'; $config['max_size'] = '10000'; $this->load->library('upload', $config); if (!$this->upload->do_upload('files')) { $reply = array('isi' => set_value('isi', '', FALSE), 'id_konsultasi' => $id, 'id_user' => sentinel()->getUser()->id); $updateat = date('Y-m-d H:i:s'); } else { $file_data = $this->upload->data(); $reply = array('attachment' => $file_data['file_name'], 'isi' => set_value('isi', '', FALSE), 'id_konsultasi' => $id, 'id_user' => sentinel()->getUser()->id); $updateat = date('Y-m-d H:i:s'); } $id_konsultasi = set_value('id_konsultasi'); $update = $this->M_konsultasi->updatedAt($updateat, $id_konsultasi); $save = $this->M_konsultasi->sendReply($reply, $id_konsultasi); redirect('dashboard/detail/' . $id); } }
public function doWebWishlist() { global $_GPC, $_W; $rid = intval($_GPC['rid']); if (empty($rid)) { message('抱歉,传递的参数错误!', '', 'error'); } $where = ''; $params = array(':rid' => $rid, ':weid' => $_W['uniacid']); if (isset($_GPC['status'])) { $where .= ' and status=:status'; $params[':status'] = $_GPC['status']; } if (!empty($_GPC['keywords'])) { $where .= 'AND `dream` LIKE :keywords'; $params[':keywords'] = "%{$_GPC['keywords']}%"; } $total = pdo_fetchcolumn("SELECT count(*) FROM " . tablename('dream_wish') . " WHERE rid = :rid and weid=:weid " . $where . "", $params); $pindex = max(1, intval($_GPC['page'])); $psize = 5; $pager = pagination($total, $pindex, $psize); $start = ($pindex - 1) * $psize; $limit .= " LIMIT {$start},{$psize}"; $list = pdo_fetchall("SELECT a.* FROM " . tablename('dream_wish') . " a WHERE a.rid = :rid and a.weid=:weid " . $where . " ORDER BY a.id DESC " . $limit, $params); //一些参数的显示 $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid", array(':rid' => $rid)); $viewnum = $reply['viewnum']; $dreamnum = $reply['dreamnum']; include $this->template('wishlist'); }
public function all_list($params = array()) { global $_GPC, $_W; extract($params); $result = array(); $pindex = max(1, intval($_GPC['page'])); $psize = $psize ? $psize : '20'; $where = "WHERE `uniacid` = :uniacid AND ischeck=:ischeck"; $paras = array(); $paras[':uniacid'] = $_W['uniacid']; $paras[':ischeck'] = intval($ischeck); $sql = "SELECT * FROM " . tablename('qiyue_canvas') . $where . ' ORDER BY createtime DESC, id DESC'; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $paras); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('qiyue_canvas') . $where, $paras); if ($_W['isajax']) { $context['ajaxcallback'] = 1; $result['pager'] = pagination($total, $pindex, $psize, '', $context); } else { $result['pager'] = pagination($total, $pindex, $psize); } if (!empty($result['list'])) { foreach ($result['list'] as &$row) { $row['url'] = url('mobile/module/index', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid'])); } } return $result; }
public function productsCat($id_dm) { //load mode, libraries //process... // get name's this category for $id_dm $cat = $this->mproducts->get_a_record_categories($id_dm); // get products of Cart if ($this->uri->segment(4)) { $page = $this->uri->segment(4); } else { $page = 1; } $perRow = 9; $rowsPerPage = ($page - 1) * $perRow; $proCat = $this->mproducts->listProCat($id_dm, $rowsPerPage, $perRow); // pagination $this->load->helper('pagination'); $url = "fproducts/productsCat/{$id_dm}"; $totalPage = ceil($this->mproducts->totalRowsProCat($id_dm) / $perRow); $char = '/'; $pagi = pagination($url, $page, $totalPage, $char); // data to view $this->data['cat'] = $cat; $this->data['proCat'] = $proCat; $this->data['_content'] = 'frontend/products/procategories'; $this->data['css'] = 'danhsachsp.css'; $this->data['pagination'] = $pagi; // load view $this->load->view('frontend/common/layout', $this->data); }
function display($params) { $Log_Model = new Log_Model(); $options_cache = Option::getAll(); extract($options_cache); $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1; $record = isset($params[1]) && $params[1] == 'record' ? intval($params[2]) : ''; $GLOBALS['record'] = $record; //for sidebar calendar $pageurl = ''; //page meta $site_title = $record . ' - ' . $site_title; if (preg_match("/^([\\d]{4})([\\d]{2})\$/", $record, $match)) { $days = getMonthDayNum($match[2], $match[1]); $record_stime = emStrtotime($record . '01'); $record_etime = $record_stime + 3600 * 24 * $days; } else { $record_stime = emStrtotime($record); $record_etime = $record_stime + 3600 * 24; } $sqlSegment = "and date>={$record_stime} and date<{$record_etime} order by date desc"; $lognum = $Log_Model->getLogNum('n', $sqlSegment); $total_pages = ceil($lognum / $index_lognum); if ($page > $total_pages) { $page = $total_pages; } $start_limit = ($page - 1) * $index_lognum; $pageurl .= Url::record($record, 'page'); $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum); $page_url = pagination($lognum, $index_lognum, $page, $pageurl); include View::getView('header'); include View::getView('log_list'); }
public function index() { $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsurl('feed', 'index', array('page' => '')); $lstart = $page * 20 - 20; $arrFeeds = $this->findAll('feed', null, 'addtime desc', null, $lstart . ',20'); $feedNum = $this->findCount("feed"); $pageUrl = pagination($feedNum, 20, $page, $url); if ($page > 1) { $title = '社区动态 - 第' . $page . '页'; } else { $title = '社区动态'; } foreach ($arrFeeds as $key => $item) { $data = json_decode($item['data'], true); if (is_array($data)) { foreach ($data as $key => $itemTmp) { $tmpkey = '{' . $key . '}'; $tmpdata[$tmpkey] = stripslashes(urldecode($itemTmp)); } } $arrFeed[] = array('user' => aac('user')->getOneUser($item['userid']), 'content' => strtr($item['template'], $tmpdata), 'addtime' => $item['addtime']); } include template('index'); }
public function doWebAwardlist() { global $_GPC, $_W; $id = intval($_GPC['id']); if (checksubmit('delete')) { pdo_delete('zzz_user', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page']))); } if (!empty($_GPC['wid'])) { $wid = intval($_GPC['wid']); pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid)); message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page']))); } $pindex = max(1, intval($_GPC['page'])); $psize = 15; $where = ''; $condition = array('mobile' => " AND `b`.`mobile` LIKE '%" . $_GPC['profilevalue'] . "%'", 'realname' => " AND `b`.`realname` LIKE '%" . $_GPC['profilevalue'] . "%'", 'nickname' => " AND `b`.`nickname` LIKE '%" . $_GPC['profilevalue'] . "%'"); if (!empty($_GPC['profile'])) { $where .= $condition[$_GPC['profile']]; } $sql = 'SELECT `a`.`id`, `a`.`friendcount`, `a`.`points`, `a`.`createtime`, `a`.`sharevalue`, `b`.`realname`, `b`.`nickname`, `b`.`mobile` FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` = `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . " AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid\n {$where} ORDER BY `a`.`points` DESC "; $params = array(':rid' => $id); if (empty($_GPC['export'])) { $sql .= ' LIMIT ' . ($pindex - 1) * $psize . ',' . $psize; } else { $list = pdo_fetchall($sql, $params); $tableHeader = array('realname' => '姓名', 'nickname' => '昵称', 'mobile' => '手机', 'points' => '分数'); $tableLength = count($tableHeader) + 1; /* 输入到CSV文件 */ $html = ""; /* 输出表头 */ foreach ($tableHeader as $header) { $html .= $header . "\t ,"; } $html .= "创建时间\t, \n"; /* 输出内容 */ foreach ($list as $value) { foreach ($tableHeader as $key => $header) { $html .= $value[$key] . "\t ,"; } $html .= date('Y-m-d H:i:s', $value['createtime']) . "\t ,"; $html .= "\n"; } /* 输出CSV文件 */ header("Content-type:text/csv"); header("Content-Disposition:attachment; filename=全部数据.csv"); echo $html; exit; } $list = pdo_fetchall($sql, $params); if (!empty($list)) { $sql = 'SELECT COUNT(*) FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` = `a`.`fanid` LEFT JOIN ' . tablename('mc_members') . ' AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid' . $where; $total = pdo_fetchcolumn($sql, $params); $pager = pagination($total, $pindex, $psize); } include $this->template('awardlist'); }
function site_article($params = array()) { global $_GPC, $_W; extract($params); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $result = array(); $condition = " WHERE weid = '{$_W['weid']}'"; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= " AND ccate = '{$cid}'"; } else { $condition .= " AND pcate = '{$cid}'"; } } if ($iscommend == 'true') { $condition .= " AND iscommend = '1'"; } if ($ishot == 'true') { $condition .= " AND ishot = '1'"; } $sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY id DESC'; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition); $result['pager'] = pagination($total, $pindex, $psize); if (!empty($result['list'])) { foreach ($result['list'] as &$row) { $row['url'] = create_url('mobile/module/detail', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid'])); } } return $result; }
public function index() { $data['users'] = sentinel()->findRoleBySlug('ta')->users->pluck('email', 'id')->toArray(); $forum = collect(Model\Forum\Category::all()); $data['categories'] = pagination($forum, '5', 'forum/category'); $this->template->build('category_index', $data); }
public function doWebTalklist() { global $_W, $_GPC; $pageIndex = max(1, intval($_GPC['page'])); $pageSize = 50; $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename($this->table_comments) . " WHERE `uniacid`=:uniacid ", array(':uniacid' => $_W['uniacid'])); if ($_GPC['foo'] == 'change') { if (empty($_GPC['id'])) { message('缺失重要的参数', '', 'error'); } pdo_update($this->table_comments, array('isok' => $_GPC['doit']), array('uniacid' => $_W['uniacid'], 'id' => $_GPC['id'])); message('哎呦,状态修改成功了哦', referer(), 'success'); } if ($_GPC['foo'] == 'delete') { if (empty($_GPC['id'])) { message('缺失重要的参数', '', 'error'); } pdo_delete($this->table_comments, array('id' => $_GPC['id'], 'uniacid' => $_W['uniacid'])); message('哎呦,删除了哦..', referer(), 'success'); } $list = pdo_fetchall('SELECT * FROM' . tablename($this->table_comments) . " WHERE uniacid = :uniacid GROUP BY createtime DESC LIMIT " . ($pageIndex - 1) * $pageSize . ',' . $pageSize, array(':uniacid' => $_W['uniacid'])); foreach ($list as $key => $value) { $temp = pdo_fetch('SELECT * FROM' . tablename($this->table_fans) . " WHERE uniacid = :uniacid AND openid = :openid", array(':uniacid' => $_W['uniacid'], ':openid' => $value['openid'])); $list[$key]['nickname'] = $temp['nickname']; } $pager = pagination($total, $pageIndex, $pageSize); include $this->template('talklist'); }
public function category($idCategory) { $getCategory = $this->model_thread->get_category($idCategory); foreach ($getCategory as $cat) { $data['category'] = $cat->category_name; } $user = sentinel()->getUser(); $daerahUser = $user->profile->desa_id; if ($this->checkTA() == TRUE) { $data['addTopic'] = anchor('topic/create', '<i class="fa fa-plus"></i> Topic Baru', 'class="btn btn-primary btn-sm"'); $data['dashTopic'] = anchor('topic/', 'Your Topics', 'class="btn btn-primary btn-sm"'); $data['draftSide'] = $this->model_thread->get_all_drafts($user->id); $data['tenagaAhli'] = $user->id; $data['threadSide'] = $this->model_thread->get_all_threads($daerahUser, $user->id); $threads = collect($this->model_thread->get_threads_category($idCategory, $user->id)); } else { $data['threadSide'] = $this->model_thread->get_threads_by_user($daerahUser, $user->id); $threads = collect($this->model_thread->get_threads_category_by_user($idCategory, $user->id, $daerahUser)); } $data['categoryUser'] = $this->model_thread->get_all_category_user(); $data['authorSide'] = $this->model_thread->get_thread_from_author($user->id); $data['comments'] = $this->model_thread->get_count_reply(); $data['visitors'] = $this->model_visitor->get_visitors(); $data['categoriesHead'] = $getCategory; $data['categoriesSide'] = $this->model_thread->get_categories(); $data['topics'] = $this->model_topic->get_approved_topics(); $data['closeThreads'] = $this->model_thread->get_close_threads($user->id); $data['threadMembers'] = $this->model_thread->get_thread_members(); $data['commentsSide'] = $this->model_thread->get_comments_from_author($user->id); $data['userID'] = $user->id; $data['threads'] = pagination($threads, 10, 'thread/category/' . $idCategory, 'bootstrap_md'); $this->load->view('thread/all_threads', $data); }
function display($params) { $Log_Model = new Log_Model(); $CACHE = Cache::getInstance(); $options_cache = Option::getAll(); extract($options_cache); $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1; $author = isset($params[1]) && $params[1] == 'author' ? intval($params[2]) : ''; $pageurl = ''; $user_cache = $CACHE->readCache('user'); if (!isset($user_cache[$author])) { show_404_page(); } $author_name = $user_cache[$author]['name']; //page meta $site_title = $author_name . ' - ' . $site_title; $sqlSegment = "and author={$author} order by date desc"; $sta_cache = $CACHE->readCache('sta'); $lognum = $sta_cache[$author]['lognum']; $total_pages = ceil($lognum / $index_lognum); if ($page > $total_pages) { $page = $total_pages; } $start_limit = ($page - 1) * $index_lognum; $pageurl .= Url::author($author, 'page'); $Log_Model = new Log_Model(); $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum); $page_url = pagination($lognum, $index_lognum, $page, $pageurl); include View::getView('header'); include View::getView('log_list'); }
public function ordersAction() { if ($this->checkLogin()) { $model = new OrderModel(); $find_text = null; if (isset($_GET['find_text']) && ($find_text = $_GET['find_text'])) { $addQueryWhere = "where `order`.text like '%{$find_text}%'"; $orders = $model->getOrders($addQueryWhere); $pagination = ""; } else { $Allorders = $model->getOrders(); $countAll = count($Allorders); $limit = 100; $currentPage = isset($_GET['page']) ? (int) $_GET['page'] : 1; $pagination = pagination($countAll, $currentPage, $limit, "/admin/orders"); $offset = $limit * ($currentPage - 1); $addQuery = " LIMIT {$limit} OFFSET {$offset}"; $orders = $model->getOrders("", $addQuery); } $winners = $model->getWinnersIds(); $view = new AdminView(); return $this->_controller->setPage($view->showOrders(['orders' => $orders, 'pagination' => $pagination, 'find_text' => $find_text, 'winnersWeek' => $winners], 'orders')); } else { header('Location: /admin/login'); die; } }
public function onlineBibile() { if (!$this->session->userdata('access_token')) { redirect('login', 'refresh'); } else { $data = $this->tq_header_info(); $temp_results = $this->input->get('results'); $page = $this->input->get('page'); $data['results'] = $temp_results ? $temp_results : 10; $data['page'] = $page ? $page : 1; $search_keyword = $this->input->get('search_keyword'); $search_keyword = trim($search_keyword); // echo strlen($search_keyword);exit; $result = doCurl(API_BASE_LINK . 'bibile/onlineBibile?search_keyword=' . $search_keyword . '&' . 'limit=' . $data['results'] . '&' . 'page=' . $data['page']); if ($result && $result['http_status_code'] == 200) { $content = json_decode($result['output']); if (isset($content->message)) { $message = $content->message; $this->session->set_flashdata('error', $message); } else { $data['total'] = $content->total; // var_dump() $data['results'] = $content->results; $uri = 'onlineBibile'; $data['pagination'] = pagination($content->total, $data['page'], $content->results, $uri); $this->session->set_flashdata(''); } } $this->load->view('bibile/onlineBibile_view', isset($data) ? $data : ""); } }
function showData($data, $con, $limit, $adjacent) { $page = $data['page']; if ($page == 1) { $start = 0; } else { $start = ($page - 1) * $limit; } $workFlow = new WorkFlow(); $rows = $workFlow->cntWFList(); $selOpt1 = $workFlow->getWFList($start, $limit); foreach ($selOpt1 as $key => $val) { ?> <ul style="float: left; display: inline; width: 100%;"> <li style="float: left; width: 5%;"><?php echo $key + 1; ?> )</li> <li style="float: left; width: 20%; padding-left: 10px;"><?php echo ucfirst($val['wf_name']); ?> </li> <li style="float: left; width: 20%; padding-left: 100px;"><?php echo $val['wf_created']; ?> </li> <li style="float: left; padding-left: 100px;"><a href="workflow.php?id=<?php echo $val['wf_id']; ?> ">[View]</a> / <a href="#" onclick="popup('popUpDiv', 'edit', < ?php echo $val['wf_id']; ? > )">[Edit]</a> / <a href="#" onclick="deleteWF( < ?php echo $val['wf_id']; ? > )">[Delete]</a></li> </ul> <?php } pagination($limit, $adjacent, $rows, $page); }