예제 #1
0
 public function __construct($fields, \Classes\DB\Connection $db)
 {
     $this->db = $db;
     $this->table = $fields['table'];
     $this->tableId = isset($fields['id']) ? $fields['id'] : 'id';
     $this->tableLeft = isset($fields['left']) ? $fields['left'] : 'lkey';
     $this->tableRight = isset($fields['right']) ? $fields['right'] : 'rkey';
     $this->tableLevel = isset($fields['level']) ? $fields['level'] : 'level';
     $this->tableTree = $this->db->table($this->table, $this->pk);
 }
예제 #2
0
파일: main.module.php 프로젝트: rigidus/ea
 function _add()
 {
     $array = array('news_date' => 'NOW()', 'news_pub' => '1', 'news_title' => params::get('news_title'), 'news_content' => params::get('news_content'), 'news_desc' => params::get('news_desc'));
     db::table('news');
     db::smartInsert($array);
     headers::app('news');
 }
예제 #3
0
 function newPassword($new_pass)
 {
     if (!empty($new_pass)) {
         db::table('admin_users');
         db::where('user_id', ADMIN_USER_ID);
         db::update('user_password', md5($new_pass));
     }
 }
예제 #4
0
파일: mails.app.php 프로젝트: rigidus/ea
 function load()
 {
     db::table('mails');
     db::where('site_id', SITE_ID);
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         self::$mails[$row['mail_name']] = $row;
     }
 }
예제 #5
0
파일: adminUser.php 프로젝트: rigidus/ea
 function update($name, $value, $user_id = false)
 {
     if (!$user_id) {
         $user_id = ADMIN_USER_ID;
     }
     db::table('admin_users');
     db::where('user_id', $user_id);
     db::update($name, $value);
 }
예제 #6
0
파일: main.handler.php 프로젝트: rigidus/ea
 function getFile()
 {
     $file_id = params::get('file');
     $dir = FILES_ROOT . 'pages/';
     db::table('pages_files');
     db::where('file_id', $file_id);
     $file = db::assoc();
     $link = $dir . $file_id . '.' . $file['file_type'];
     files::downloadFile($link, $file['file_name'] . '.' . $file['file_type']);
 }
예제 #7
0
 function loadTmpls($site_id = 1)
 {
     db::table('templates');
     db::where('site_id', $site_id);
     db::where('tmpl_pub', '1');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         self::$tmpls[$row['tmpl_id']] = $row['tmpl_name'];
     }
 }
예제 #8
0
파일: menus.app.php 프로젝트: rigidus/ea
 function loadMenus($site_id)
 {
     db::table('menus');
     db::where('site_id', $site_id);
     db::where('menu_pub', '1');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         self::$menus[$row['menu_id']] = $row['menu_name'];
     }
 }
예제 #9
0
파일: blocks.app.php 프로젝트: rigidus/ea
 function loadBlocks($site_id = 1)
 {
     db::table('blocks');
     db::where('site_id', $site_id);
     db::where('block_pub', '1');
     $res = db::select('block_id', 'block_title', 'block_name', 'block_pub');
     while ($row = mysql_fetch_assoc($res)) {
         self::$blocks[$row['block_id']] = $row['block_name'];
     }
 }
예제 #10
0
파일: main.handler.php 프로젝트: rigidus/ea
 function show()
 {
     $dir = IMAGES_PATH . 'index/';
     db::table('images');
     db::where('img_set', '1');
     db::orderByRand();
     $img = db::assoc();
     if (db::rows() != 0) {
         $file = $dir . $img['img_id'] . '.jpg';
         buffer::set('<img src="' . $file . '" width="700" height="360" alt="" />');
     }
 }
예제 #11
0
파일: main.handler.php 프로젝트: rigidus/ea
 function show()
 {
     $event = web::getEvent();
     if ($event === false) {
         $year = date('Y');
     } else {
         $year = $event;
     }
     s::set('info_date_select', htmlspecialchars($year));
     $sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0'  GROUP BY `date` ORDER BY `date` DESC";
     $res = db::query($sql);
     $rows = mysql_num_rows($res);
     if ($rows > 1) {
         s::add('info_date_selector', '<ul class="years">');
         while ($row = mysql_fetch_assoc($res)) {
             if ($row['date'] == $year) {
                 $row['date'] = '<li><span>' . $row['date'] . '</span></li>';
             } else {
                 $row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
             }
             s::add('info_date_selector', $row['date']);
         }
         s::add('info_date_selector', '</ul>');
     }
     $files = array();
     db::table('info_files');
     $r = db::select();
     while ($a = mysql_fetch_assoc($r)) {
         $files[$a['section_id']][] = $a;
     }
     db::table('info_sections');
     db::order('section_order', 'DESC');
     db::where('section_year', $year);
     $r = db::select();
     if (db::rows() == 0) {
         web::error404();
     }
     while ($a = mysql_fetch_assoc($r)) {
         if ($a['section_view'] == '0') {
             s::roll('sections', $a);
         } else {
             s::roll('sections_view', $a);
         }
         if (isset($files[$a['section_id']])) {
             foreach ($files[$a['section_id']] as $v) {
                 $v['file_icon'] = files::getFileIco($v['file_type']);
                 $v['file_size'] = files::parseSizeSmart($v['file_size']);
                 s::roll('items' . $a['section_id'], $v);
             }
         }
     }
 }
예제 #12
0
파일: lists.php 프로젝트: rigidus/ea
 function country($array = false, $rollname = 'country')
 {
     $country = array();
     db::table('country');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         if ($array) {
             $country[$row['country_id']] = $row['country_name'];
         }
         s::roll($rollname, $row);
     }
     return $country;
 }
예제 #13
0
파일: loader.php 프로젝트: rigidus/ea
 function start()
 {
     db::connect();
     if (!router::get(1)) {
         return true;
     }
     self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
     s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
     define('APP', APPS . self::get('app') . '/');
     s::set('APP', APP);
     define('MODULE', APP . self::get('module') . '/');
     s::set('MODULE', MODULE);
     if (stristr(self::$map['mode'], 'admin')) {
         self::$map['mode'] = 'admin';
     } else {
         self::$map['mode'] = 'web';
     }
     if (self::$map['mode'] == 'admin') {
         if (defined('ADMIN_USER_SITE_ID')) {
             admin::observer();
             define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             db::table('admin_sites');
             db::where('site_id', ADMIN_USER_SITE_ID);
             db::limit(1);
             $row = db::select();
             define('ADMIN_SITE', db::get('site_domain'));
             s::set('ADMIN_SITE', ADMIN_SITE);
         }
     } else {
         web::getSite();
         $lang = lang::gets(LANG_INDEX, SITE_ID);
         /*
         	Authentification webUser
         */
         web::observer();
     }
     /*
     	Set params
     */
     params::send();
     if (router::get(0) == 'feed' || router::get(0) == 'rss') {
         self::$map['module'] = 'feed';
     }
     if (self::$map['mode'] == 'admin') {
         load::module(self::get('app'), self::get('module'), self::get('action'));
     } else {
         load::handler(self::get('app'), self::get('module'), self::get('action'));
     }
 }
예제 #14
0
파일: main.handler.php 프로젝트: rigidus/ea
 function showOne()
 {
     $news_id = web::getThis();
     db::table('news');
     db::where('news_pub', '1');
     $news = db::assoc();
     if (db::rows() == 0) {
         web::error404();
     }
     $news['news_date'] = dt::date2print('%d %F %Y', $news['news_date']);
     s::set('page_title', $news['news_title']);
     s::set('page_header', $news['news_title']);
     s::set($news);
 }
예제 #15
0
파일: db.php 프로젝트: rigidus/ea
 function table($table)
 {
     self::$sql = '';
     self::$res = false;
     self::$table = T_ . $table;
     self::$columns = array();
     self::$collector = array();
     self::$group_by = '';
     self::$order = '';
     self::$join_construct = '';
     self::$values = '';
     self::$limit = '';
     self::$last_where = false;
     self::$global_index = 0;
     self::$pager = false;
 }
예제 #16
0
파일: main.handler.php 프로젝트: rigidus/ea
 function upload()
 {
     $dir = FILES_ROOT . 'all/';
     if (!empty($_FILES['file']['name'])) {
         $file_name = urldecode($_GET['file_name']);
         $file_type = files::info($_FILES['file']['name'], 'type');
         $file_size = files::info($_FILES['file']['tmp_name'], 'size');
         db::table('files');
         db::insert('', 'NOW()', $file_name, $file_type, $file_size);
         $file_id = mysql_insert_id();
         $file = $dir . $file_id . '.' . $file_type;
         copy($_FILES['file']['tmp_name'], $file);
         $file_icon = files::getFileIco($file_type);
         buffer::set('<p class="load"><img src="/i/fileicons/' . $file_icon . '.png" width="18" height="18" alt="" />&nbsp;<a href="/download/files/download/?file=' . $file_id . '">' . $file_name . '</a> <span>(' . $file_type . ', ' . round($file_size / 1000) . ' Кб)</span></p>');
     }
 }
예제 #17
0
파일: trash.module.php 프로젝트: rigidus/ea
 function restore()
 {
     db::table('admin_log_trash');
     db::where('log_id', params::get('log_id'));
     $date = date('Y-m-d H:i:s');
     db::update('log_restored', $date);
     db::table('admin_log_trash');
     db::where('log_id', params::get('log_id'));
     $row = db::assoc();
     if ($row['log_tmpl'] == '1') {
         trash::restore(params::get('log_id'), SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/');
     } else {
         trash::restore(params::get('log_id'));
     }
     buffer::set(dt::date2print('%H:%i:%s<br />%d %F %y', $date));
 }
예제 #18
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     db::table('roles')->insert([['name' => 'user', 'display_name' => 'User', 'description' => 'A regular user. Able to update actions created by or assigned to them, in addition to viewing the entirety of the Business Plan'], ['name' => 'leader', 'display_name' => 'Leader', 'description' => 'A Leader of a team or Department. Able to create, modify, and delete actions and tasks of their respective team or department as well as the rights of a basic user.'], ['name' => 'bpLead', 'display_name' => 'Business Plan Lead', 'description' => 'A business executive who can create new business plans as well as Goals and Objectives for the current business plan. They also have the permissions of leaders and users.'], ['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'A system administrator who can make changes to any part of the system. Most importantly however, sets user up with user roles']]);
     $user = User::where('name', '=', 'BpLead')->first();
     $role = Role::where('name', '=', 'bpLead')->first();
     $user->attachRole($role);
     $user = User::where('name', '=', 'Vicky Varga')->first();
     $role = Role::where('name', '=', 'leader')->first();
     $user->attachRole($role);
     $user = User::where('name', '=', 'Elaine Jones')->first();
     $role = Role::where('name', '=', 'user')->first();
     $user->attachRole($role);
     $user = User::where('name', '=', 'J McPhee')->first();
     $role = Role::where('name', '=', 'user')->first();
     $user->attachRole($role);
     $user = User::where('name', '=', 'Alex Carruthers')->first();
     $user->attachRole($role);
 }
예제 #19
0
파일: main.module.php 프로젝트: rigidus/ea
 function upload()
 {
     $dir = IMAGES_ROOT . 'index/';
     @mkdir(IMAGES_ROOT);
     @mkdir($dir);
     if (!empty($_FILES['file']['name'])) {
         $img_id = md5(date('YmdHis'));
         $file = $dir . $img_id . '.jpg';
         $file_m = $dir . $img_id . '_m.jpg';
         copy($_FILES['file']['tmp_name'], $file);
         images::src($file);
         images::thumb($file_m);
         images::setWidth(150);
         images::resize();
         $array = array('img_id' => $img_id, 'img_set' => '0');
         db::table('images');
         db::smartInsert($array);
     }
     headers::self();
 }
예제 #20
0
파일: map.handler.php 프로젝트: rigidus/ea
 function show()
 {
     db::table('pages');
     db::where('site_id', SITE_ID);
     db::where('page_pub', '1');
     db::where('page_map', '1');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         if ($row['page_map'] == '1') {
             $row['page_map'] = ' checked="checked"';
         } else {
             $row['page_map'] = '';
         }
         if ($row['page_folder'] == '/') {
             $page_path = 'http://' . SITE;
         } else {
             $page_path = 'http://' . SITE . '' . $row['page_folder'];
         }
         $row['page_line'] = $row['page_title'] . '&nbsp;&nbsp;<a href="' . $page_path . '" class="ico11 icoRoundArrow" title="Посмотреть на сайте">&nbsp;</a>';
         $page_tree[$row['page_parent']][$row['page_id']] = $row;
     }
     s::tree('map_tree', $page_tree);
 }
예제 #21
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     db::table('permissions')->insert([['name' => 'createAT', 'display_name' => 'Create new Actions and Tasks', 'description' => 'Create new Actions and Tasks'], ['name' => 'updateAT', 'display_name' => 'Update new Actions and Tasks', 'description' => 'Update new Actions and Tasks'], ['name' => 'deleteAT', 'display_name' => 'Delete new Actions and Tasks', 'description' => 'Delete new Actions and Tasks'], ['name' => 'createGO', 'display_name' => 'Create new Goals and Objectives', 'description' => 'Create new Goals and Objectives'], ['name' => 'updateGO', 'display_name' => 'Update new Goals and Objectives', 'description' => 'Update new Goals and Objectives'], ['name' => 'deleteGO', 'display_name' => 'Delete new Goals and Objectives', 'description' => 'Delete new Goals and Objectives'], ['name' => 'createBP', 'display_name' => 'Create new Business Plans', 'description' => 'Create new Business Plans'], ['name' => 'setPerm', 'display_name' => 'Set User Permissions', 'description' => 'Set User Permissions']]);
     $user = Role::where('name', '=', 'user')->first();
     $leader = Role::where('name', '=', 'leader')->first();
     $bplead = Role::where('name', '=', 'bpLead')->first();
     $admin = Role::where('name', '=', 'admin')->first();
     $perm = Permission::where('name', '=', 'createAT')->first();
     $user->attachPermission($perm);
     $leader->attachPermission($perm);
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'updateAT')->first();
     $user->attachPermission($perm);
     $leader->attachPermission($perm);
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'deleteAT')->first();
     $leader->attachPermission($perm);
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'createGO')->first();
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'updateGO')->first();
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'deleteGO')->first();
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'createBP')->first();
     $bplead->attachPermission($perm);
     $admin->attachPermission($perm);
     $perm = Permission::where('name', '=', 'setPerm')->first();
     $admin->attachPermission($perm);
 }
예제 #22
0
파일: apps.module.php 프로젝트: rigidus/ea
 function delete()
 {
     $tmpl_file = params::get('tmpl_file');
     $app = params::get('app');
     @unlink(SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file);
     db::table('templates_versions');
     db::where('app', $app);
     db::where('tmpl_file', $tmpl_file);
     db::delete();
 }
예제 #23
0
<?php

/**
 *  该程序是脚本程序,不对浏览器请求,是执行自动下载的程序
 */
//header("Content-type: text/html; charset=utf-8");
include_once 'config.php';
$db = new db();
$table = 'robber';
$common = new Common();
$upload = new Upload();
while (1) {
    $condition = array('status' => 0);
    $waitDownVideos = $db->table($table)->getList($condition);
    if ($waitDownVideos) {
        foreach ($waitDownVideos as $key => $video) {
            if (!$video['url']) {
                continue;
            } else {
                $url = $video['url'];
                $className = $common->urlToClass($url);
                $site = new $className($url);
                $filename = $site->download($video['download_url']);
                if ($filename && file_exists($filename)) {
                    $condition = array('status' => 1, 'filename' => $filename);
                    $result = $db->table($table)->update($video['id'], $condition);
                    $log = $url . "下载成功\n";
                    file_put_contents('/tmp/download.txt', $log, FILE_APPEND);
                    //自动遮标
                    if (AUTODELOGO && $video['status'] && isset($video['coord'])) {
                        $delogoCmd = "ffmpeg -i " . $filename . ' -vf mp=delogo=' . $video['coord'] . ' -vcodec ... -acodec ... -f flv -y OUT.FLV';
예제 #24
0
$multi = '';
$query = DB::query("SELECT * FROM " . DB::table('portal_article_content') . " WHERE aid='{$aid}' ORDER BY pageorder LIMIT {$start},1");
$content = DB::fetch($query);
require_once libfile('function/blog');
$content['content'] = blog_bbcode($content['content']);
$multi = multi($article['contents'], 1, $page, "portal.php?mod=view&aid={$aid}");
$article['related'] = array();
$query = DB::query("SELECT a.aid,a.title\n\tFROM " . DB::table('portal_article_related') . " r\n\tLEFT JOIN " . DB::table('portal_article_title') . " a ON a.aid=r.raid\n\tWHERE r.aid='{$aid}'");
while ($value = DB::fetch($query)) {
    $article['related'][] = $value;
}
$common_url = '';
$commentlist = $org = array();
if ($article['id'] && $article['idtype']) {
    if ($article['idtype'] == 'blogid') {
        $org = db::fetch_first("SELECT * FROM " . db::table('home_blog') . " WHERE blogid='{$article['id']}'");
        $common_url = "home.php?mod=space&uid={$org['uid']}&do=blog&id={$article['id']}";
        $form_url = "home.php?mod=spacecp&ac=comment";
        $article['commentnum'] = getcount('home_comment', array('id' => $article['id'], 'idtype' => 'blogid'));
        $query = DB::query("SELECT authorid AS uid, author AS username, dateline, message\n\t\t\tFROM " . DB::table('home_comment') . " WHERE id='{$article['id']}' AND idtype='blogid' ORDER BY dateline DESC LIMIT 0,20");
        while ($value = DB::fetch($query)) {
            $commentlist[] = $value;
        }
    } else {
        $common_url = "forum.php?mod=viewthread&tid={$article['id']}";
        $form_url = "forum.php?mod=post&action=reply&tid={$article['id']}&replysubmit=yes&infloat=yes&handlekey=fastpost";
        require_once libfile('function/discuzcode');
        $posttable = getposttablebytid($article['id']);
        $article['commentnum'] = getcount($posttable, array('tid' => $article['id'], 'first' => '0'));
        $firstpost = DB::fetch_first("SELECT first, authorid AS uid, author AS username, dateline, message, smileyoff, bbcodeoff, htmlon, attachment, pid\n\t\t\tFROM " . DB::table($posttable) . " WHERE tid='{$article['id']}' AND first='1'");
        if (!($org = $firstpost)) {
예제 #25
0
function notification_add($touid, $type, $note, $notevars = array(), $system = 0)
{
    global $_G;
    $tospace = array('uid' => $touid);
    space_merge($tospace, 'field_home');
    $filter = empty($tospace['privacy']['filter_note']) ? array() : array_keys($tospace['privacy']['filter_note']);
    if ($filter && (in_array($type . '|0', $filter) || in_array($type . '|' . $_G['uid'], $filter))) {
        return false;
    }
    $notevars['actor'] = "<a href=\"home.php?mod=space&uid={$_G['uid']}\">" . $_G['member']['username'] . "</a>";
    $notestring = lang('notification', $note, $notevars);
    $oldnote = array();
    if ($notevars['from_id'] && $notevars['from_idtype']) {
        $oldnote = db::fetch_first("SELECT * FROM " . db::table('home_notification') . "\n\t\t\tWHERE from_id='{$notevars['from_id']}' AND from_idtype='{$notevars['from_idtype']}'");
    }
    if (empty($oldnote['from_num'])) {
        $oldnote['from_num'] = 0;
    }
    $setarr = array('uid' => $touid, 'type' => $type, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => addslashes($notestring), 'dateline' => $_G['timestamp'], 'from_id' => $notevars['from_id'], 'from_idtype' => $notevars['from_idtype'], 'from_num' => $oldnote['from_num'] + 1);
    if ($system) {
        $setarr['authorid'] = 0;
        $setarr['author'] = '';
    }
    if ($oldnote['id']) {
        db::update('home_notification', $setarr, array('id' => $oldnote['id']));
    } else {
        $oldnote['new'] = 0;
        DB::insert('home_notification', $setarr);
    }
    if (empty($oldnote['new'])) {
        DB::query("UPDATE " . DB::table('common_member_status') . " SET notifications=notifications+1 WHERE uid='{$touid}'");
        DB::query("UPDATE " . DB::table('common_member') . " SET newprompt=newprompt+1 WHERE uid='{$touid}'");
        require_once libfile('function/mail');
        $mail_subject = lang('notification', 'mail_to_user');
        sendmail_touser($touid, $mail_subject, $notestring, $type);
    }
    if (!$system && $_G['uid'] && $touid != $_G['uid']) {
        DB::query("UPDATE " . DB::table('home_friend') . " SET num=num+1 WHERE uid='{$_G['uid']}' AND fuid='{$touid}'");
    }
}
예제 #26
0
 /**
  * Анти-флуд проверка
  * @param string $table таблица
  * @param string $where условие
  * @param array $columns столбецы автора и времени постинга соотв.
  * @return null
  * @throws EngineException 
  */
 public function anti_flood($table, $where, $columns = array("poster_id", "posted_time"))
 {
     if (!is_array($columns) || !config::o()->v('antispam_time')) {
         return;
     }
     list($author, $time_var) = $columns;
     $time = time() - config::o()->v('antispam_time');
     $lang_var = 'anti_flood_subj';
     $uid = users::o()->v('id') ? users::o()->v('id') : -1;
     $c = db::o()->no_parse()->query('SELECT `' . $time_var . '` FROM `' . db::table($table) . '` WHERE ' . ($where ? $where . " AND " : "") . '`' . $author . "`=" . $uid . "\n                AND `" . $time_var . "` >= " . $time . '
             ORDER BY `' . $time_var . '` DESC LIMIT 1');
     $c = db::o()->fetch_assoc($c);
     if ($c) {
         $intrvl_time = display::o()->estimated_time(config::o()->v('antispam_time') + 1, time() - $c[$time_var]);
         throw new EngineException($lang_var, $intrvl_time);
     }
 }
예제 #27
0
        $ordersql = "dateline DESC";
        $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}");
예제 #28
0
파일: join.php 프로젝트: rlm80/Glue
 /**
  * Adds an operand to the expression.
  *
  * @param mixed $table $table Right operand of the join. It may be a table name, a table-alias array or any fragment (most likely a join fragment for nested joins).
  * @param integer $operator Operator.
  * @param \Glue\DB\Fragment_Table $operand Initialiazed with the join operand.
  *
  * @return \Glue\DB\Fragment_Builder_Join
  */
 protected function add($table, $operator, &$operand)
 {
     // Build operand :
     if (is_string($table)) {
         $operand = db::table($table);
     } elseif (is_array($table)) {
         $operand = db::table($table[0], isset($table[1]) ? $table[1] : null);
     } else {
         $operand = $table;
     }
     // Add fragment :
     $this->push(new \Glue\DB\Fragment_Item_Join($operand, $operator));
     return $this;
 }
예제 #29
0
파일: map.module.php 프로젝트: rigidus/ea
 function saveMap()
 {
     $map = $nomap = array();
     $map = explode(',', params::get('map'));
     $nomap = explode(',', params::get('nomap'));
     foreach ($map as $v) {
         db::table('pages');
         db::where('page_id', $v);
         db::update('page_map', '1');
     }
     foreach ($nomap as $v) {
         db::table('pages');
         db::where('page_id', $v);
         db::update('page_map', '0');
     }
 }
예제 #30
0
파일: content.php 프로젝트: SjayLiFe/CTRev
 /**
  * Простое отображение торрентов для блока
  * @param string $name имя категории
  * @return null
  * @throws EngineException 
  */
 public function show($name)
 {
     if (!users::o()->perm('content')) {
         return;
     }
     if (!$this->tstate) {
         throw new EngineException();
     }
     $crc = crc32($name);
     $cfile = 'tsimple/cat-' . $crc;
     lang::o()->get('blocks/torrents');
     if (($a = cache::o()->read($cfile)) === false) {
         list($where, $limit, $max_title_symb) = $this->show_prepare($name);
         $r = db::o()->no_parse()->query('SELECT t.*,c.*, u.username, u.group
         FROM ' . db::table('content') . ' AS c 
         LEFT JOIN ' . db::table('content_torrents') . ' AS t ON t.cid=c.id
         LEFT JOIN ' . db::table('users') . ' AS u ON u.id=c.poster_id
         WHERE ' . $where . '
         ORDER BY posted_time DESC
         LIMIT ' . $limit);
         $a = array();
         /* @var $content content */
         $content = plugins::o()->get_module('content');
         while ($row = db::o()->fetch_assoc($r)) {
             $this->show_row($content, $row, $max_title_symb);
             $a[] = $row;
         }
         cache::o()->write($a);
     }
     tpl::o()->assign('res', $a);
     tpl::o()->display('blocks/contents/torrents.tpl');
 }