break; case '4': (require './mod/edit/link.php') or $view->set404(); break; case 'gallery': (require './mod/edit/photos.php') or $view->set404(); break; default: if (file_exists('./mod/edit/' . $TYPE . '.php')) { (require './mod/edit/' . $TYPE . '.php') or $view->set404(); } else { return; } } unset($_POST); return 1; } #Tytul $view->title = $lang['mantxt']; #Ostatni komentarz if (admit('CM') && ($c = $db->query('SELECT name,date,text FROM ' . PRE . 'comms ORDER BY ID DESC LIMIT 1')->fetch(3))) { if (isset($cfg['bbcode'])) { require_once './lib/bbcode.php'; $c[2] = BBCode($c[2]); } $last = array('title' => $c[0], 'date' => genDate($c[1], 1), 'text' => emots($c[2]), 'color' => isset($cfg['colorCode'])); } else { $last = array(); } #Wolne strony $view->add('content', array('comment' => &$last, 'page' => admit('P') ? url('editPage', '', 'admin') : null, 'pages' => admit('P') ? url('pages', '', 'admin') : null));
require './cfg/content.php'; #Get data if (!($img = $db->query('SELECT i.*,c.opt FROM ' . PRE . 'imgs i INNER JOIN ' . PRE . 'cats c ON i.cat=c.ID WHERE c.access!=3 AND i.ID=' . $id)->fetch(2))) { return; } #Disabled if (!$img['access']) { if (!admit($img['cat'], 'CAT')) { return; } $view->info(sprintf($lang['NVAL'], $img['name']), null, 'warning'); } #Dimensions $size = strpos($img['size'], '|') ? explode('|', $img['size']) : null; #Data, autor $img['date'] = genDate($img['date'], true); $img['author'] = autor($img['author']); #Ocena if (isset($cfg['irate']) and $img['opt'] & 4) { $view->css(SKIN_DIR . 'rate.css'); $rates = 'vote.php?type=3&id=' . $id; } else { $rates = 0; } #Tag title and meta description - clean temporary $view->title = $img['name']; $view->desc = $img['dsc'] ? clean(substr($img['dsc'], 0, 150)) : $cfg['metaDesc']; #Description $img['dsc'] = nl2br($img['dsc']); #Template $view->add('img', array('img' => &$img, 'size' => &$size, 'rates' => $rates, 'image' => $img['type'] === '1' ? true : false, 'flash' => $img['type'] === '2' ? true : false, 'audio' => $img['type'] === '3' ? true : false, 'video' => $img['type'] === '4' ? true : false, 'path' => catPath($img['cat']), 'edit' => admit($img['cat'], 'CAT') ? url('edit/3/' . $id, 'ref') : false, 'root' => isset($cfg['allCat']) ? $lang['cats'] : $lang['imgs'], 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/images'), 'lightbox' => isset($cfg['lightbox'])));
$res = $db->query('SELECT n.*,login FROM ' . PRE . 'news n LEFT JOIN ' . PRE . 'users u ON n.author=u.ID WHERE n.' . $cats . ' AND n.access=1 ORDER BY n.ID DESC LIMIT ' . $st . ',' . $cfg['newsNum']); #Prawa $rights = admit($d, 'CAT') ? true : false; #Komentarze $comm = $cat['opt'] & 2 && isset($cfg['ncomm']) ? true : false; #URL $userURL = url('user/'); $fullURL = url('news/'); $editURL = url('edit/5/'); #Tu zapisuj: $news = array(); $num = 0; foreach ($res as $n) { #Data, itd. $news[] = array('title' => $n['name'], 'date' => genDate($n['date']), 'wrote' => $n['login'], 'comm' => $n['comm'], 'img' => $n['img'], 'url' => $fullURL . $n['ID'], 'comm_url' => $comm ? $fullURL . $n['ID'] : false, 'full_url' => $n['opt'] & 4 ? $fullURL . $n['ID'] : false, 'edit_url' => $rights ? $editURL . $n['ID'] : false, 'wrote_url' => $userURL . urlencode($n['login'])); #TreϾ - Emoty if ($n['opt'] & 2) { $n['txt'] = emots($n['txt']); } #Zawijanie if ($n['opt'] & 1) { $n['txt'] = nl2br($n['txt']); } #Przypisz treϾ $news[$num++]['text'] = $n['txt']; } #Strony if (isset($cfg['newsPages']) && $cat['num'] > $num) { $pages = pages($page, $cat['num'], $cfg['newsNum'], url($d), 0, '/'); } else {
#Art title $view->title = $art['name']; #Art description - clean [temporary] if ($art['dsc']) { $view->desc = clean($art['dsc']); } #Emots if ($art['opt'] & 2) { $art['text'] = emots($art['text']); } #BR if ($art['opt'] & 1) { $art['text'] = nl2br($art['text']); } #Date, author $art['date'] = genDate($art['date'], true); $art['author'] = autor($art['author']); #Ocena if (isset($cfg['arate']) && $art['catOpt'] & 4) { $view->css(SKIN_DIR . 'rate.css'); $rates = 'vote.php?type=1&id=' . $id; } else { $rates = 0; } #Count popularity if (isset($cfg['adisp'])) { register_shutdown_function(array($db, 'exec'), 'UPDATE ' . PRE . 'arts SET views=views+1 WHERE ID=' . $id); ++$art['views']; } else { $art['ent'] = 0; }
$lv = $lang['editor']; break; case '3': $lv = $lang['admin']; break; case '4': $lv = $lang['owner']; break; default: $lv = $lang['user']; } #Plec switch ($u[2]) { case '1': $sex = 'male'; break; case '2': $sex = 'female'; break; default: $sex = 'group'; } $users[] = array('login' => $u[1], 'city' => $u[5], 'date' => genDate($u[4]), 'url' => url('user/' . urlencode($u[1])), 'photo' => $u[6] ? $u[6] : 'img/user/0.png', 'level' => $lv, 'sex' => $sex, 'num' => ++$st); } $res = null; #Z³±cz parametry $url = $url ? '&' . join('&', $url) : ''; #Dane do szablonu $view->add('users', array('users' => &$users, 'total' => $total, 'id' => $id, 'find' => isset($cfg['userFind']), 'joined_url' => url($toURL, 'sort=2' . $url), 'login_url' => url($toURL, 'sort=1' . $url), 'level_url' => url($toURL, 'sort=4' . $url), 'last_url' => url($toURL, 'sort=3' . $url), 'find_login' => !empty($sl) ? $sl : '', 'find_www' => !empty($www) ? $www : '', 'find_place' => !empty($pl) ? $pl : '', 'find_gg' => !empty($gg) ? $gg : '', 'pages' => $total > 30 ? pages($page, $total, 30, url($toURL, $sortURL . $url)) : false)); #Usuñ zbêdne dane unset($u, $url, $total, $www, $pl, $sl);
$sort = 'name'; break; case '5': $sort = 'rate DESC, ID DESC'; break; default: $sort = 'ID DESC'; } #Zacznij od... if ($st != 0) { $st = ($page - 1) * $cfg['inp']; } #Odczyt $res = $db->query('SELECT ID,name,date,th FROM ' . PRE . 'imgs WHERE ' . $cats . ' AND access=1 ORDER BY priority,' . $sort . ' LIMIT ' . $st . ',' . $cfg['inp']); $res->setFetchMode(3); $total = 0; $url = url('img/'); $img = array(); #Lista foreach ($res as $x) { $img[] = array('num' => ++$total, 'title' => $x[1], 'src' => $x[3], 'url' => $url . $x[0], 'date' => genDate($x[2])); } #Strony if ($cat['num'] > $total) { $pages = pages($page, $cat['num'], $cfg['inp'], url($d), 0, '/'); } else { $pages = null; } #Do szablonu $view->add('cat_images', array('pages' => &$pages, 'image' => &$img, 'add' => admit($d, 'CAT') ? url('edit/3') : null, 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/images'), 'type' => isset($cfg['allCat']) ? $lang['cats'] : $lang['imgs'])); unset($res, $total, $x);
$file['size'] = round($size / 1048576) . ' MB'; } else { $file['size'] = round($size / 1024) . ' KB'; } } } else { $file['size'] = 'File not found'; $file['url'] = '#'; } #Mark if (isset($cfg['frate']) && $file['opt'] & 4) { $view->css(SKIN_DIR . 'rate.css'); $rate = 'vote.php?type=2&id=' . $id; } else { $rate = 0; } #Date, author $file['date'] = genDate($file['date'], true); $file['author'] = autor($file['author']); #Template $view->add('file', array('file' => &$file, 'path' => catPath($file['cat']), 'rates' => $rate, 'edit' => admit($file['cat'], 'CAT') ? url('edit/2/' . $id, 'ref') : false, 'root' => isset($cfg['allCat']) ? $lang['cats'] : $lang['files'], 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/files'))); #Tags if (isset($cfg['tags'])) { include './lib/tags.php'; tags($id, 2); } #Comments if (isset($cfg['fcomm']) && $file['opt'] & 2) { require './lib/comm.php'; comments($id, 2); }
} #Page number if (isset($URL[3]) && is_numeric($URL[3]) && $URL[3] > 1) { $page = $URL[3]; $st = ($page - 1) * $cfg['bugsNum']; } else { $page = 1; $st = 0; } #Get issues $res = $db->prepare('SELECT ID,name,num,date,status,level FROM ' . PRE . 'bugs WHERE cat=?' . (admit('BUGS') ? '' : ' AND status!=5') . ' ORDER BY ID DESC LIMIT ?,?'); $res->bindValue(1, $id, 1); $res->bindValue(2, $st, 1); $res->bindValue(3, $cfg['bugsNum'], 1); $res->execute(); $all = array(); $num = 0; foreach ($res as $x) { $all[] = array('id' => $x['ID'], 'title' => $x['name'], 'status' => $x['status'], 'lv' => $x['level'], 'num' => $x['num'], 'url' => url('bugs/' . $x['ID']), 'date' => genDate($x['date'], 1), 'class' => BugIsNew('', $x['date']) ? 'New' : 'Old', 'level' => $lang['L' . $x['level']]); ++$num; } #Pages if (!$num) { $view->info($lang['noc']); } elseif ($cat['num'] > $num) { $pages = pages($page, $cat['num'], $cfg['bugsNum'], url('bugs/list/' . $id), 0, '/'); } else { $pages = ''; } #template $view->add('bugs', array('issue' => &$all, 'postURL' => BugRights($cat['post']) ? url('bugs/post', 'f=' . $id) : false));
if (iCMSa != 1 || !admit('L')) { exit; } require LANG_DIR . 'events.php'; #Delete events if ($_POST && ($x = GetID(true))) { $db->exec('DELETE FROM ' . PRE . 'log WHERE ID IN (' . $x . ')'); event('ERASE'); } #Page number if (isset($_GET['page']) && $_GET['page'] > 1) { $page = $_GET['page']; $st = ($page - 1) * 30; } else { $page = 1; $st = 0; } #Total events $total = dbCount('log'); $event = array(); #Get events - FETCH_ASSOC $res = $db->query('SELECT l.*,u.login FROM ' . PRE . 'log l LEFT JOIN ' . PRE . 'users u ON l.user=u.ID AND l.user!=0 ORDER BY date DESC LIMIT ' . $st . ',30'); $res->setFetchMode(3); #List events foreach ($res as $i) { $event[] = array('id' => $i[0], 'text' => isset($events[$i[1]]) ? $events[$i[1]] : $i[1], 'date' => genDate($i[2], true), 'login' => $i[5], 'ip' => $i[3], 'user' => $i[4] ? url('user/' . urlencode($i[5])) : false); } #Prepare template $view->add('log', array('event' => &$event, 'pages' => pages($page, $total, 30, url('log', '', 'admin'), 1), 'url' => url('log', 'page=' . $page, 'admin')));
$page = 1; $st = 0; } #Total $total = dbCount('guestbook WHERE lang="' . LANG . '"'); $num = 0; $all = array(); #Get posts $query = $db->prepare('SELECT * FROM ' . PRE . 'guestbook WHERE lang=? ORDER BY ID DESC LIMIT ?,?'); $query->bindValue(1, LANG); $query->bindValue(2, $st, 1); $query->bindValue(3, $cfg['gbNum'], 1); //PARAM_INT $query->execute(); #BBCode if (isset($cfg['bbcode'])) { require './lib/bbcode.php'; } #Posts foreach ($query as $x) { $all[] = array('id' => $x['ID'], 'who' => $x['UID'] ? '<a href="' . url('user/' . urlencode($x['who'])) . '">' . $x['who'] . '</a>' : $x['who'], 'date' => genDate($x['date'], true), 'www' => $x['www'], 'text' => emots(isset($cfg['bbcode']) ? BBCode($x['txt']) : $x['txt']), 'gg' => $x['gg'], 'icq' => $x['icq'], 'tlen' => $x['tlen'], 'skype' => $x['skype'], 'jabber' => $x['jabber'], 'mail' => str_replace('@', '@', $x['mail']), 'ip' => $right ? $x['ip'] : false, 'edit' => $right ? url('guestbook/post/' . $x['ID']) : false); ++$num; } #Pages if ($total > $num) { $pages = pages($page, $total, $cfg['gbNum'], url('guestbook')); } else { $pages = false; } #Template $view->add($cfg['gbSkin'], array('post' => &$all, 'pages' => &$pages, 'intro' => &$cfg['gbIntro'], 'rights' => $right, 'postURL' => ($cfg['gbPost'] == 1 || UID && $cfg['gbPost'] == 2) && stripos($cfg['gbBan'], $_SERVER['REMOTE_ADDR']) === false ? url('guestbook/post') : false));
/** * 生成表单域对应的html * @param array $input * @param array $field 字段信息 * @return string */ public function genHtml(&$input, $field) { $width = $input['width']; $height = $input['height']; $value = $input['value']; $type = $input['type']; $remark = $input['remark']; $class = 'input'; if ('file' == $type) { $fn = "{$field['name']}"; } else { $fn = "{$field['model']}[{$field['name']}]"; } $html = ''; if ('text' == $type) { $html = genText($fn, $width, $value, $class); } else { if ('password' == $type) { $html = genPassword($fn, $width, $value, $class); } else { if ('select' == $type) { $list = $this->optValueToArray($input['opt_value']); $html = genSelect($fn, $list['opt_value'], $list['selected']); } else { if ('radio' == $type) { $list = $this->optValueToArray($input['opt_value']); $html = genRadios($fn, $list['opt_value'], $list['selected']); } else { if ('checkbox' == $type) { $list = $this->optValueToArray($input['opt_value'], true); $html = genCheckboxs($fn, $list['opt_value'], $list['selected']); } else { if ('file' == $type) { $html = genFile($fn); } else { if ('textarea' == $type) { $html = genTextarea($fn, $value, $width, $height, $remark); } else { if ('date' == $type) { $html = genDate($fn, $value, $class); } else { if ('relation_select' == $type) { $relaOpts = $this->getRelationOpts($field); $input['opt_value'] = $this->optArrayToString($relaOpts); $html = genSelect($fn, $relaOpts['opt_value']); } else { if ('editor' == $type) { $html = genEditor($fn, empty($value) ? $remark : $value, $width, $height, $input['editor']); } } } } } } } } } } $input['html'] = $html; }
} elseif (is_numeric($URL[1]) && is_numeric($URL[2])) { if (!isset($URL[2][1])) { $URL[2] = '0' . $URL[2]; } $q = 'date BETWEEN \'' . $URL[1] . '-' . $URL[2] . '-01\' AND \'' . $URL[1] . '-' . $URL[2] . '-31\''; } else { return; } #Pobierz newsy $res = $db->query('SELECT ID,name,date FROM ' . PRE . 'news WHERE ' . $q . ' AND access=1 ORDER BY ID DESC'); $res->setFetchMode(3); $news = array(); $num = 0; #Przygotuj dane foreach ($res as $n) { $news[] = array('num' => ++$num, 'date' => genDate($n[2], true), 'title' => $n[1], 'url' => url('news/' . $n[0])); } $res = null; #Do szablonu $view->add('archive', array('news' => &$news, 'newslist' => true)); return 1; } #Lista lat i miesiêcy $date = $db->query('SELECT date FROM ' . PRE . 'news LIMIT 1')->fetchColumn(); #Brak nowo¶ci? if (!$date[0]) { return; } #Data 1. newsa $year = (int) ($date[0] . $date[1] . $date[2] . $date[3]); $mon = (int) ($date[5] . $date[6]);
$db->commit(); $group['num']--; $mayLeave = $member = 0; $mayJoin = 1; } catch (Exception $e) { $view->info($e); } } elseif (!$_POST) { $view->add('ask', array('url' => '', 'query' => $askLeave)); return 1; } } } #Owner, date $group['who'] = $group['who'] > 0 ? autor($group['who']) : false; $group['date'] = genDate($group['date']); #Who joined $new = array(); if (UID || empty($cfg['hideUser'])) { $res = $db->query('SELECT * FROM ' . PRE . 'users u INNER JOIN ' . PRE . 'groupuser g ON u.ID=g.u WHERE g.g=' . $id); foreach ($res as $x) { $new[] = array('login' => $x['login'], 'date' => genDate($x['date']), 'url' => url('user/' . urlencode($x['login']))); } } #Template $view->add('group', array('group' => &$group, 'user' => &$new, 'edit' => admit('G') ? url('editGroup/' . $id, 'ref', 'admin') : false, 'groups' => url('groups'), 'status' => $group['opened'] ? $lang['open'] : $lang['shut'], 'join' => $mayJoin ? $url . '/join' : false, 'leave' => $mayLeave ? $url . '/leave' : false, 'query' => $mayJoin ? $askJoin : ($mayLeave ? $askLeave : false), 'all' => $new ? url('users/' . $id) : false)); #Comments if (true) { require './lib/comm.php'; comments($id, 11); }
<?php if (iCMS != 1) { exit; } #Page title $view->title = $lang['archive']; #Get polls from database $res = $db->query('SELECT ID,name,num,date FROM ' . PRE . 'polls WHERE access="' . LANG . '" ORDER BY ID DESC'); $res->setFetchMode(3); #Initialize $poll = array(); $num = 0; foreach ($res as $p) { $poll[] = array('title' => $p[1], 'url' => url('poll/' . $p[0]), 'date' => genDate($p[3]), 'votes' => $p[2], 'num' => ++$num); } #Template if ($num > 0) { $view->add('polls', array('poll' => &$poll)); } else { $view->info($lang['noc']); } unset($res, $poll, $lp);
$total = dbCount('comms' . $q); $com = array(); #Get comments from database $res = $db->query('SELECT c.*,u.login FROM ' . PRE . 'comms c LEFT JOIN ' . PRE . 'users u ON c.UID!=0 AND c.UID=u.ID ' . $q . ' ORDER BY c.ID DESC LIMIT ' . $st . ',20'); #BBCode support if (isset($cfg['bbcode'])) { include_once './lib/bbcode.php'; } #Get category types $type = parse_ini_file('cfg/types.ini', 1); foreach ($res as $x) { switch ($x['TYPE']) { case '10': $co = 'user'; break; case '59': $co = 'page'; break; case '15': $co = 'poll'; break; case '11': $co = 'group'; break; default: $co = isset($type[$x['TYPE']]) ? $type[$x['TYPE']]['name'] : null; } $com[] = array('text' => nl2br(emots(isset($cfg['bbcode']) ? BBCode($x['text']) : $x['text'])), 'date' => genDate($x['date'], 1), 'url' => url('comment/' . $x['ID']), 'findIP' => url('moderate/' . $x['ip']), 'item' => $co ? url($co . '/' . $x['CID']) : null, 'id' => $x['ID'], 'title' => $x['name'], 'user' => $x['login'] ? $x['login'] : $x['author'], 'ip' => $x['ip'], 'access' => $x['access'], 'profile' => $x['login'] ? url('user/' . urlencode($x['login'])) : null); } #Prepare template $view->add('moderate', array('comment' => $com, 'total' => $total, 'url' => url('moderate'), 'nourl' => url('moderate/hidden'), 'color' => isset($cfg['colorCode']), 'pages' => pages($page, $total, 20, url('moderate'), 1)));
function query_builder() { $this->load->helper('query_builder'); $campaign = $this->mdl_campaign->query_builder(); $id_type = $this->mdl_individual->query_builder('id_type'); $city = $this->mdl_individual->query_builder('city'); $curr_brand = $this->mdl_individual->query_builder('brand'); $sec_brand = $this->mdl_individual->query_builder('brand_'); $source_type = $this->mdl_individual->query_builder('source_type'); $status_verifikasi = $this->mdl_individual->query_builder('status_verifikasi'); $data[] = genSelect('campaign_id', 'Campaign', $campaign); $data[] = genString('id', 'Individual ID'); $data[] = genString('mop_id', 'MOP ID'); $data[] = genString('firstname', 'Firstname'); $data[] = genString('lastname', 'Lastname'); $data[] = genString('nickname', 'Nickname'); $data[] = genSelect('sex', 'Sex', array("M" => "MALE", "F" => "FEMALE")); $data[] = genDate('dob', 'Day of Birth'); $data[] = genInteger("DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(dob)), '%Y')", 'Age'); $data[] = genSelect('id_type', 'ID Type', $id_type); $data[] = genString('id_number', 'ID Number'); $data[] = genString('tlp', 'Telephone'); $data[] = genString('email', 'Email'); $data[] = genString('fb', 'Facebook'); $data[] = genString('tw', 'Twitter'); $data[] = genString('address', 'Address'); $data[] = genSelect('city', 'City', $city); $data[] = genString('pos_code', 'Pos Code'); $data[] = genSelect('brand', 'Current Brand', $curr_brand); $data[] = genSelect('brand_', 'Second Brand', $sec_brand); $data[] = genSelect('source_type', 'Source Type', $source_type); $data[] = genString('source_user', 'Source User'); $data[] = genDate('survey_date', 'Survey Date'); $data[] = genDate('upload_date', 'Upload Date'); $data[] = genDate('entry_date', 'Entry Date'); $data[] = genDate('verifikasi_date', 'Verification Date'); $data[] = genString('referred', 'Referred by'); $data[] = genSelect('status_verifikasi', 'Status Verification', $status_verifikasi); echo json_encode($data); }
$view->title = $poll['name']; $view->desc = $poll['q']; $id = $poll['ID']; #No votes if ($poll['num'] == 0) { $view->info($lang['novotes'], array(url('polls') => $lang['archive'])); return 1; } #Get answers if ($id) { $option = $db->query('SELECT ID,a,color,num FROM ' . PRE . 'answers WHERE IDP=' . $id . ' ORDER BY ' . (isset($cfg['pollSort']) ? 'num DESC,' : '') . 'seq')->fetchAll(3); } #How much answers? $num = count($option); #Creation date $poll['date'] = genDate($poll['date'], true); # % $item = array(); $file = 'poll'; #Pie chart if (true) { $file = 'poll-svg'; $x0 = 50; $y0 = $a = $sum = 0; foreach ($option as &$o) { $sum += $o[3]; } $half = $sum / 2; foreach ($option as &$o) { if ($o[3] === '0') { continue;
#Page title $view->title = $news['name']; #Emoticons if ($news['opt'] & 2) { $news['txt'] = emots($news['txt']); if ($full) { $full = emots($full); } } #Line breaks if ($news['opt'] & 1) { $news['txt'] = nl2br($news['txt']); if ($full) { $full = nl2br($full); } } #Date, author $news['date'] = genDate($news['date'], true); $news['wrote'] = autor($news['author']); #Assign to template $view->add('news', array('news' => &$news, 'full' => &$full, 'path' => catPath($news['cat']), 'edit' => admit($news['cat'], 'CAT') ? url('edit/5/' . $id, 'ref') : false, 'root' => isset($cfg['allCat']) ? $lang['cats'] : $lang['news'], 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/news'))); #Tags if (isset($cfg['tags'])) { include './lib/tags.php'; tags($id, 5); } #Comments if (isset($cfg['ncomm']) && $news['catOpt'] & 2) { require './lib/comm.php'; comments($id, 5); }
case 2: $u['sex'] = $lang['female']; break; default: $u['sex'] = false; } #URL linku EDYTUJ if (UID) { if ($u['ID'] == UID) { $may = url('account'); } elseif (IS_ADMIN && admit('U')) { $may = url('editUser/' . $u['ID'], '', 'admin'); } else { $may = false; } } else { $may = false; } #Grupy $g = array(); $r = $db->query('SELECT g.ID,g.name,g.num FROM ' . PRE . 'groups g INNER JOIN ' . PRE . 'groupuser u ON g.ID=u.g WHERE u.u=' . $u['ID'] . ' ORDER BY g.num DESC'); foreach ($r as $x) { $g[] = array('title' => $x['name'], 'num' => $x['num'], 'url' => url('group/' . $x['ID'])); } #Szablon $view->title = $u['login']; $view->add('user', array('u' => &$u, 'pm' => isset($cfg['pmOn']) && UID ? url('pms/edit', 'to=' . $u['ID']) : false, 'edit' => $may, 'group' => $g, 'users' => url('users'), 'join_date' => genDate($u['regt'], 1), 'last_visit' => $u['lvis'] ? genDate($u['lvis'], 1) : NA)); if (isset($cfg['userComm']) && $u['opt'] & 2) { include './lib/comm.php'; comments($u['ID'], 10); }
#Page title $view->title = $bug['name']; #Does not exist if (!$bug) { $view->set404(); return; } #Not approved if ($bug['status'] == 5 && $bug['who'] != UID && !$rights) { header('Location: ' . URL . url('bugs')); return; } #BBCode if (isset($cfg['bbcode'])) { require 'lib/bbcode.php'; $bug['text'] = BBCode($bug['text']); } #Date, author $bug['date'] = genDate($bug['date'], 1); $bug['who'] = $bug['UID'] ? autor($bug['UID']) : $bug['who']; $bug['text'] = nl2br(emots($bug['text'])); $bug['level'] = $lang['L' . $bug['level']]; $bug['status'] = $lang['S' . $bug['status']]; #Rate if ($bug['rate'] == 2) { $bug['mark'] = $bug['pos'] ? $bug['pos'] : $lang['lack']; $bug['marks'] = $bug['neg'] ? $bug['neg'] : 0; $view->css(SKIN_DIR . 'rate.css'); } #Template $view->add('view', array('bug' => &$bug, 'edit' => $rights || $bug['poster'] == UID && isset($cfg['bugsEdit']) ? url('bugs/post/' . $id) : false, 'hands' => $bug['rate'] == 1, 'stars' => $bug['rate'] == 2, 'catURL' => url('bugs/list/' . $bug['cat']), 'mainURL' => url('bugs'), 'canVote' => $bug['rate'] && (UID || isset($cfg['bugsVote'])), 'editStatus' => $rights));
function comments($id, $type = 5, $mayPost = true, $url = '') { global $db, $cfg, $view, $URL; #Page division if ($cfg['commNum']) { #Select page if (isset($_GET['page']) && $_GET['page'] > 1) { $page = $_GET['page']; $st = ($page - 1) * $cfg['commNum']; } else { $page = 1; $st = 0; } if (!$url) { $url = url($URL[0] . '/' . $id); } $total = dbCount('comms WHERE TYPE=' . $type . ' AND CID=' . $id); $CP = $total > $cfg['commNum'] ? pages($page, $total, $cfg['commNum'], $url) : null; } else { $total = null; $CP = null; } $comm = array(); #May edit or delete $mayEdit = admit('CM'); $mayDel = $mayEdit || $type == 10 && $id == UID; $comURL = url('comment/'); $modURL = url('moderate/'); $userURL = url('user/'); #Get from database if ($total !== 0) { $res = $db->query('SELECT c.ID,c.access,c.name,c.author,c.ip,c.date,c.UA,c.text,u.login,u.photo,u.mail FROM ' . PRE . 'comms c LEFT JOIN ' . PRE . 'users u ON c.UID!=0 AND c.UID=u.ID WHERE c.TYPE=' . $type . ' AND c.CID=' . $id . ($mayEdit ? '' : ' AND c.access=1') . ($cfg['commSort'] == 2 ? '' : ' ORDER BY c.ID DESC') . ($total ? ' LIMIT ' . $st . ',' . $cfg['commNum'] : '')); $res->setFetchMode(3); #BBCode if (isset($cfg['bbcode'])) { include_once './lib/bbcode.php'; } foreach ($res as $x) { $comm[] = array('text' => nl2br(emots(isset($cfg['bbcode']) ? BBCode($x[7]) : $x[7])), 'date' => genDate($x[5], 1), 'title' => $x[2], 'user' => $x[8] ? $x[8] : $x[3], 'ip' => $mayEdit ? $x[4] : null, 'edit' => $mayEdit ? $comURL . $x[0] : false, 'del' => $mayDel ? $comURL . $x[0] : false, 'agent' => $x[6], 'accept' => $mayEdit && $x[1] != 1 ? $comURL . $x[0] : false, 'findIP' => $mayEdit ? $modURL . $x[4] : false, 'profile' => $x[8] ? $userURL . urlencode($x[8]) : false, 'photo' => empty($cfg['commPhoto']) ? false : ($x[9] ? $x[9] : ($cfg['commPhoto'] == 2 ? PROTO . 'www.gravatar.com/avatar/' . md5(strtolower($x[10])) . '?d=' . $cfg['gdef'] : false))); } $res = null; } #Prepare template $data['comment'] =& $comm; $data['parts'] =& $CP; #Highlight code $data['color'] = isset($cfg['colorCode']); #May comment if (UID || isset($cfg['commGuest'])) { if (empty($_SESSION['post']) or $_SESSION['post'] < $_SERVER['REQUEST_TIME']) { $data['url'] = $comURL . $id . '/' . $type; $_SESSION['CV'][$type][$id] = true; } else { $data['url'] = null; } $data['mustLogin'] = false; } else { $data['mustLogin'] = true; } #Assign to template $view->add('comments', $data); }
$sort = 'name'; break; case '4': $sort = 'dls DESC, ID DESC'; break; case '5': $sort = 'rate DESC, ID DESC'; break; default: $sort = 'ID DESC'; } #Odczyt $res = $db->query('SELECT ID,name,date,dsc,file,size FROM ' . PRE . 'files WHERE ' . $cats . ' AND access=1 ORDER BY priority,' . $sort . ' LIMIT ' . $st . ',' . $cfg['np']); $res->setFetchMode(3); $total = 0; $files = array(); $url = url('file/'); #Lista foreach ($res as $file) { $files[] = array('title' => $file[1], 'desc' => $file[3], 'size' => $file[5], 'url' => $url . $file[0], 'num' => ++$st, 'date' => genDate($file[2]), 'file_url' => isset($cfg['fcdl']) ? url('get/' . $file[0]) : $file[4]); ++$total; } #Strony if ($cat['num'] > $total) { $pages = pages($page, $cat['num'], $cfg['np'], url($d), 0, '/'); } else { $pages = null; } #Do szablonu $view->add('cat_files', array('files' => &$files, 'pages' => &$pages, 'add' => admit($d, 'CAT') ? url('edit/2') : null, 'cats' => url(isset($cfg['allCat']) ? 'cats' : 'cats/files'), 'type' => isset($cfg['allCat']) ? $lang['cats'] : $lang['files'])); unset($res, $total, $file);
$view->set404(); return; } #BBCode if (isset($cfg['bbcode'])) { include './lib/bbcode.php'; } #Oznaczymy jako przeczytane $read = array(); $th = 0; #Przygotuj posty foreach ($q as $x) { if ($x['th'] == '0') { $th = $x['ID']; } $pm[] = array('topic' => $x['topic'], 'date' => genDate($x['date'], true), 'txt' => nl2br(emots(isset($cfg['bbcode']) ? BBCode($x['txt']) : $x['txt'])), 'fwd' => url('pms/edit/' . $x['ID'], 'fwd'), 'edit' => $x['st'] == 3 ? url('pms/edit/' . $x['ID']) : false, 'reply' => $x['st'] < 3 ? url('pms/edit/' . $x['ID'], 'th=' . $th) : false, 'read' => $x['st'] == 2, 'photo' => $x['photo'], 'id' => $x['ID'], 'who' => $x['login'], 'url' => $x['login'] ? url('user/' . urlencode($x['login'])) : ''); #Dodaj do oznaczenia jako przeczytane if ($x['st'] == 1 && $x['owner'] == UID) { $read[] = $x['ID']; } #Tytu³ strony if ($x['ID'] == $URL[2]) { $view->title = $x['topic']; } } #Brak? if (!$pm) { $view->info($lang['noex']); return 1; } #Przeczytana?