Inheritance: extends PW_BaseLoader
Example #1
0
function getSendToUsernames($type, $tid)
{
    global $windid, $db;
    $usernames = array();
    if (!$type || !$tid) {
        return $usernames;
    }
    $remindUsernames = $db->get_value("SELECT db_value FROM pw_config WHERE db_name = 'report_remind'");
    $remindUsernames = $remindUsernames ? unserialize($remindUsernames) : array();
    foreach ($remindUsernames as $key => $value) {
        if ($value['username'] == $windid) {
            continue;
        }
        $usernames[] = $value['username'];
    }
    if ($type != 'topic') {
        return $usernames;
    }
    $_cacheService = Perf::gatherCache('pw_threads');
    $threads = $_cacheService->getThreadByThreadId($tid);
    $fid = $threads['fid'];
    L::loadClass('forum', 'forum', false);
    $forumService = new PwForum($fid);
    $foruminfo = $forumService->foruminfo;
    $forumadmins = $foruminfo['forumadmin'];
    $forumadmins = explode(',', $forumadmins);
    foreach ($forumadmins as $forumadmin) {
        if (!$forumadmin || $forumadmin == $windid) {
            continue;
        }
        $usernames[] = $forumadmin;
    }
    return $usernames;
}
Example #2
0
 public function query($limit = 25, $index = 0)
 {
     if ($this->user->getClass() < User::CLASS_ADMIN) {
         throw new Exception(L::get("PERMISSION_DENIED"), 401);
     }
     $sth = $this->db->query("SELECT COUNT(*) FROM nyregg");
     $res = $sth->fetch();
     $totalCount = $res[0];
     $sth = $this->db->prepare("SELECT nyregg.ip, nyregg.userid, nyregg.datum AS added, nyregg.email, nyregg.hostname, nyregg.log_mail, nyregg.log_ip, nyregg.level, users.warned, users.enabled, users.username FROM nyregg LEFT JOIN users ON nyregg.userid = users.id ORDER BY nyregg.id DESC LIMIT ?, ?");
     $sth->bindParam(1, $index, PDO::PARAM_INT);
     $sth->bindParam(2, $limit, PDO::PARAM_INT);
     $sth->execute();
     $result = array();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $r = array();
         $r["added"] = $row["added"];
         $r["hostname"] = $row["hostname"];
         $r["ip"] = $row["ip"];
         $r["email"] = $row["email"];
         $r["log_ip"] = $row["log_ip"];
         $r["level"] = $row["level"];
         $r["log_mail"] = $row["log_mail"];
         $r["user"] = array("id" => $row["userid"], "username" => $row["username"], "warned" => $row["warned"], "enabled" => $row["enabled"]);
         array_push($result, $r);
     }
     return array($result, $totalCount);
 }
Example #3
0
 public function run()
 {
     if ($_SERVER['SERVER_ADDR'] != $_SERVER["REMOTE_ADDR"]) {
         throw new Exception(L::get("MUST_BE_RUN_BY_SERVER_ERROR"), 401);
     }
     /* 1. Save all users current seed amount. Run every hour */
     $now = time('Y-m-d H');
     $user = $this->db->query('SELECT * FROM users WHERE enabled = "yes"');
     while ($u = $user->fetch(PDO::FETCH_ASSOC)) {
         $res = $this->db->query('SELECT torrents.size, peers.to_go FROM peers JOIN torrents ON peers.torrent = torrents.id WHERE userid = ' . $u["id"] . ' GROUP BY userid, torrent');
         $seededAmount = 0;
         while ($r = $res->fetch(PDO::FETCH_ASSOC)) {
             $seededAmount += $r["size"] - $r["to_go"];
         }
         $gb = round($seededAmount / 1073741824);
         if ($gb > 0) {
             $this->db->query('INSERT INTO leechbonus(userid, datum, gbseed) VALUES(' . $u["id"] . ', ' . $now . ', ' . $gb . ')');
         }
     }
     /* 2. Erase all logs older than 3 days */
     $timeSpan = time() - 259200;
     // 3 days
     $this->db->query('DELETE FROM leechbonus WHERE datum < ' . $timeSpan);
     /* 3. Update all leechbonus percent based on the last 3 days */
     $user = $this->db->query('SELECT id, UNIX_TIMESTAMP(added) AS added FROM users');
     while ($u = $user->fetch(PDO::FETCH_ASSOC)) {
         $res = $this->db->query('SELECT SUM(gbseed) AS seedsum FROM leechbonus WHERE userid = ' . $u["id"] . ' ');
         $res2 = $res->fetch(PDO::FETCH_ASSOC);
         $leechbonus = $this->leechbonus($res2["seedsum"] / 72);
         // Split into 24*3 hours
         $this->db->query('UPDATE users SET leechbonus = ' . $leechbonus . ' WHERE id = ' . $u["id"]);
     }
 }
Example #4
0
 function update($uploaddb)
 {
     $fieldService = L::loadClass('ActivityField', 'activity');
     if ($this->tid) {
         $defaultAttach = $userAttach = array();
         foreach ($uploaddb as $key => $value) {
             if ($value['id']) {
                 $attach = array();
                 $attach = $fieldService->getField($value['id']);
                 $this->attachs[$attach['fieldname']] = $value['fileuploadurl'];
                 if ($attach['fieldname'] && $attach['ifdel'] == 1) {
                     $userAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 } elseif ($attach['fieldname'] && !$attach['ifdel']) {
                     $defaultAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 }
             }
         }
         $defaultValueTableName = getActivityValueTableNameByActmid();
         $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
         if ($defaultAttach) {
             $this->db->update("UPDATE {$defaultValueTableName} SET " . S::sqlSingle($defaultAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
         if ($userAttach) {
             $this->db->update("UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($userAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
     } else {
         foreach ($uploaddb as $key => $value) {
             $this->attachs['fileuploadurl'] = $value['fileuploadurl'];
         }
     }
     return true;
 }
Example #5
0
function CheckUserTool($uid, $tooldb)
{
    global $db, $groupid, $credit;
    if (!$tooldb['state']) {
        Showmsg('tool_close');
    }
    $condition = unserialize($tooldb['conditions']);
    if ($condition['group'] && strpos($condition['group'], ",{$groupid},") === false) {
        Showmsg('tool_grouplimit');
    }
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    $userdb = $userService->get($uid, false, true);
    require_once R_P . 'require/credit.php';
    $creditdb = $credit->get($uid, 'CUSTOM');
    foreach ($condition['credit'] as $key => $value) {
        if ($value) {
            if (is_numeric($key)) {
                $creditdb[$key] < $value && Showmsg('tool_creditlimit');
            } elseif ($userdb[$key] < $value) {
                Showmsg('tool_creditlimit');
            }
        }
    }
}
 function transfer()
 {
     if (empty($this->flashatt)) {
         return false;
     }
     global $timestamp, $winddb;
     require_once R_P . 'require/functions.php';
     $pw_attachs = L::loadDB('attachs', 'forum');
     $saveAttach = $this->getSaveAttach($this->uid);
     $deltmp = array();
     $attach = $pw_attachs->gets(array('tid' => 0, 'pid' => 0, 'uid' => $this->uid, 'did' => 0, 'mid' => 0));
     foreach ($attach as $rt) {
         $deltmp[] = $rt['aid'];
         if (!isset($this->flashatt[$rt['aid']])) {
             pwDelatt($rt['attachurl'], $this->ifftp);
             continue;
         }
         $saveAttach && $saveAttach->add($rt);
         $value = $this->flashatt[$rt['aid']];
         $rt['descrip'] = $value['desc'];
         $this->attachs[] = array('id' => $rt['aid'], 'attname' => 'attachment', 'name' => $rt['name'], 'type' => $rt['type'], 'fileuploadurl' => $rt['attachurl'], 'size' => $rt['size'], 'descrip' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']);
         $winddb['uploadnum']++;
         $winddb['uploadtime'] = $timestamp;
     }
     $saveAttach && $saveAttach->execute();
     $deltmp && $pw_attachs->delete($deltmp);
     return true;
 }
 function _getDataAnalyseService()
 {
     if (!$this->_dataAnalyseService) {
         $this->_dataAnalyseService = L::loadClass('datanalyseService', 'datanalyse');
     }
     return $this->_dataAnalyseService;
 }
Example #8
0
 /**
  * Create the category menu with his childrens
  * @todo test
  */
 public function create()
 {
     // get the categories
     $categories = $this->r->getRootNodes();
     $cat_menu = new Collection();
     if ($categories) {
         foreach ($categories as $category) {
             // get the childrens
             $childrens = $category->children()->whereLang(L::get())->count() ? $category->children()->whereLang(L::get())->get(["id", "description", "slug_lang"]) : null;
             // create the menuitems
             //@todo handle multiple recursive subitems with a better algorithm
             $cat_menu_item = new MenuItem($category->description, $category->slug_lang, $this->cat_type, null, $this->getActive($category->slug_lang));
             if ($childrens) {
                 foreach ($childrens as $children) {
                     $children_item = new MenuItem($children->description, $children->slug_lang, $this->cat_type, null, $this->getActive($children->slug_lang));
                     // if has sub-subcategories
                     if ($children->children()->whereLang(L::get())->count()) {
                         $childrens_children = $children->children()->whereLang(L::get())->get(["id", "description", "slug_lang"]);
                         foreach ($childrens_children as $children_children) {
                             $children_item->add(new MenuItem($children_children->description, $children_children->slug_lang, $this->cat_type, null, $this->getActive($children_children->slug_lang)));
                         }
                     }
                     $cat_menu_item->add($children_item);
                 }
             }
             // append to original menu
             $cat_menu->push($cat_menu_item);
         }
     }
     return $cat_menu;
 }
 public function actionConfirmation()
 {
     $hash = trim(Yii::app()->request->getParam('hash', null));
     if (!empty($hash) && ($user = User::model()->find('sha(concat(email, "' . Yii::app()->params['salt'] . '")) = :hash', array(':hash' => $hash)))) {
         // Пользователь найден, регистрация окончена
         $user->password_confirm = $user->password;
         $user->status = L::r_item('userStatus', 'active');
         $user->activated = date('Y-m-d H:i:s');
         $user->save();
         if (empty($user->errors)) {
             // добавляю пользователя в RBAC
             $auth = Yii::app()->authManager;
             $auth->assign('user', $user->username);
             $loginForm = new LoginForm();
             $loginForm->username = $user->username;
             $loginForm->password = $user->password;
             $loginForm->login();
             $this->redirect(array('users/view', 'username' => $user->username));
         }
     } elseif (!empty($hash)) {
         Yii::app()->user->setFlash('registration', 'Вы ввели неверный ключ. Попробуйте еще раз.');
     } else {
         Yii::app()->user->setFlash('registration', 'На указанный Вами e-mail было отправленно письмо с кодом подтверждения. Введите его.');
     }
     $this->render('confirmation', array('hash' => $hash));
 }
Example #10
0
 function _getElement()
 {
     if (!$this->_element) {
         $this->_element = L::loadClass('element');
     }
     return $this->_element;
 }
Example #11
0
 public function query($postdata)
 {
     if ($this->user->getClass() < User::CLASS_ADMIN) {
         throw new Exception(L::get("PERMISSION_DENIED"), 401);
     }
     $limit = (int) $postdata["limit"] ?: 25;
     $index = (int) $postdata["index"] ?: 0;
     $search = $postdata["search"] ?: "";
     $where = "";
     if (strlen($search) > 0) {
         $searchWords = Helper::searchTextToWordParams($search);
         $where = "WHERE MATCH (adminlog.search_text) AGAINST (" . $this->db->quote($searchWords) . " IN BOOLEAN MODE)";
     }
     $sth = $this->db->query("SELECT COUNT(*) FROM adminlog " . $where);
     $res = $sth->fetch();
     $totalCount = $res[0];
     $sth = $this->db->prepare("SELECT adminlog.added, adminlog.id AS aid, adminlog.txt, users.id, users.username FROM adminlog LEFT JOIN users ON adminlog.userid = users.id " . $where . " ORDER BY adminlog.id DESC LIMIT ?, ?");
     $sth->bindParam(1, $index, PDO::PARAM_INT);
     $sth->bindParam(2, $limit, PDO::PARAM_INT);
     $sth->execute();
     $result = array();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $r = array();
         $r["id"] = $row["aid"];
         $r["added"] = $row["added"];
         $r["txt"] = str_replace("{{username}}", "[url=/user/" . $row["id"] . "/" . $row["username"] . "][b]" . $row["username"] . "[/b][/url]", $row["txt"]);
         array_push($result, $r);
     }
     return array($result, $totalCount);
 }
 public function addPluginsTo(SSLPluggable $sslpluggable)
 {
     L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, "yielding %d plugins", array(count($this->plugins)));
     foreach ($this->plugins as $plugin) {
         $sslpluggable->addPlugin($plugin);
     }
 }
 public function create($postdata = null)
 {
     if ($this->user->getClass() < User::CLASS_ACTOR) {
         throw new Exception(L::get("SEED_REQUEST_CLASS_REQUIREMENT"), 401);
     }
     $sth = $this->db->prepare('SELECT * FROM reseed_requests WHERE torrentid = ? AND added > DATE_ADD(NOW(),INTERVAL -1 MONTH)');
     $sth->bindParam(1, $postdata["torrentid"], PDO::PARAM_INT);
     $sth->execute();
     if ($sth->rowCount() > 0) {
         throw new Exception(L::get("SEED_REQUEST_ALREADY_REQUESTED"), 412);
     }
     if ($this->user->getBonus() < 5) {
         throw new Exception(L::get("NOT_ENOUGH_BONUS"), 412);
     }
     $torrent = $this->torrent->get($postdata["torrentid"]);
     if ($torrent["seeders"] > 2) {
         throw new Exception(L::get("SEED_REQUEST_SEEDERS_REQUIREMENT"), 412);
     }
     $this->user->bonusLog(-5, L::get("SEED_REQUEST_BONUS_LOG"), $this->user->getId());
     $sth = $this->db->query("SELECT snatch.userid, users.language FROM snatch LEFT JOIN users ON users.id = snatch.userid WHERE torrentid = " . $torrent["id"] . " AND lastaction > DATE_ADD(NOW(),INTERVAL -6 MONTH) AND timesCompleted > 0 AND userid != " . $this->user->getId());
     while ($res = $sth->fetch(PDO::FETCH_ASSOC)) {
         $this->mailbox->sendSystemMessage($res["userid"], L::get("SEED_REQUEST_PM_SUBJECT", null, $res["language"]), L::get("SEED_REQUEST_PM_BODY", [$torrent["id"], $torrent["name"], $torrent["name"]], $res["language"]));
     }
     $sth = $this->db->prepare("INSERT INTO reseed_requests(torrentid, userid, added) VALUES(?, ?, NOW())");
     $sth->bindParam(1, $torrent["id"], PDO::PARAM_INT);
     $sth->bindValue(2, $this->user->getId(), PDO::PARAM_INT);
     $sth->execute();
     $this->log->log(1, L::get("SEED_REQUEST_SITE_LOG", [$torrent["id"], $torrent["name"], $torrent["name"]], Config::DEFAULT_LANGUAGE), $this->user->getId(), 1);
 }
Example #14
0
 function AttUpload($uid, $flashatt = null, $savetoalbum = 0, $albumid = 0)
 {
     global $db, $pwforum, $pwpost, $db_ifathumb, $db_athumbsize, $db_uploadfiletype;
     parent::uploadBehavior();
     $this->pw_attachs = L::loadDB('attachs', 'forum');
     $this->uid = $uid;
     $this->db =& $db;
     $this->forum =& $pwforum;
     $this->post =& $pwpost;
     if ($pwforum->forumset['ifthumb'] == 1) {
         $this->ifthumb = 1;
         $this->thumbsize = $pwforum->forumset['thumbsize'];
     } elseif ($pwforum->forumset['ifthumb'] == 2) {
         $this->ifthumb = 0;
         $this->thumbsize = 0;
     } else {
         $this->ifthumb = $db_ifathumb;
         $this->thumbsize = $db_athumbsize;
     }
     list($uploadcredit, $uploadmoney) = explode("\t", $pwforum->forumset['uploadset']);
     $this->uploadmoney = $uploadmoney;
     $this->uploadcredit = $uploadcredit;
     $this->ftype =& $db_uploadfiletype;
     $this->uploadImgNum = 0;
     $this->uptype = 'all';
     $this->setFlashAtt($flashatt, $savetoalbum, $albumid);
 }
Example #15
0
 function update($uploaddb)
 {
     global $windid, $winduid, $timestamp, $pintro;
     foreach ($uploaddb as $key => $value) {
         $this->attachs[] = array('aid' => $this->aid, 'pintro' => $pintro[$value['id']] ? $pintro[$value['id']] : substr($value['name'], 0, strrpos($value['name'], '.')), 'path' => $value['fileuploadurl'], 'uploader' => $windid, 'uptime' => $timestamp, 'ifthumb' => $value['ifthumb']);
     }
     if ($this->attachs) {
         $this->db->update("INSERT INTO pw_cnphoto (aid,pintro,path,uploader,uptime,ifthumb) VALUES " . S::sqlMulti($this->attachs));
         $this->pid = $this->db->insert_id();
         $cnalbum = $this->db->get_one("SELECT * FROM pw_cnalbum WHERE aid=" . S::sqlEscape($this->aid));
         if ($this->atype) {
             if (!$cnalbum['private']) {
                 updateDatanalyse($this->pid, 'groupPicNew', $timestamp);
             }
         } else {
             $statistics = L::loadClass('Statistics', 'datanalyse');
             $statistics->photouser($winduid, count($this->attachs));
         }
         if (isset($cnalbum['lastphoto']) && !$cnalbum['lastphoto']) {
             $lastphoto = $this->getLastPhotoThumb();
             $lastphotosqlAdd = ",lastphoto= " . S::sqlEscape($lastphoto);
         }
         $this->db->update("UPDATE pw_cnalbum SET photonum=photonum+" . S::sqlEscape(count($this->attachs)) . ",lasttime=" . S::sqlEscape($timestamp) . $lastphotosqlAdd . " WHERE aid=" . S::sqlEscape($this->aid));
     }
     return true;
 }
Example #16
0
 function topicPost($tid, $postdata)
 {
     global $timestamp, $winduid, $windid;
     if (!$this->info) {
         return false;
     }
     $this->_db->update("INSERT INTO pw_argument SET " . S::sqlSingle(array('tid' => $tid, 'cyid' => $this->info['id'], 'postdate' => $timestamp, 'lastpost' => $timestamp)));
     if ($postdata['ifcheck'] > 0) {
         require_once R_P . 'u/require/core.php';
         //tnum加一
         //* $this->_db->update("UPDATE pw_colonys SET tnum=tnum+'1',pnum=pnum+'1',todaypost=todaypost+'1' WHERE id=" . S::sqlEscape($this->cyid));
         $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET tnum=tnum+1,pnum=pnum+1,todaypost=todaypost+1 WHERE id=:id", array('pw_colonys', $this->cyid)));
         $this->info['tnum']++;
         $this->info['pnum']++;
         updateGroupLevel($this->cyid, $this->info);
         if ($this->info['ifopen']) {
             $weiboService = L::loadClass('weibo', 'sns');
             /* @var $weiboService PW_Weibo */
             $weiboContent = substrs(stripWindCode($postdata['content']), 125);
             $weiboExtra = array('cyid' => $this->cyid, 'title' => stripslashes($postdata['title']), 'cname' => $this->info['cname']);
             $weiboService->send($winduid, $weiboContent, 'group_article', $tid, $weiboExtra);
         }
     }
     //更新群成员表里面的最后发言时间
     $this->_db->update("UPDATE pw_cmembers SET lastpost=" . S::sqlEscape($timestamp) . " WHERE uid=" . S::sqlEscape($winduid));
 }
 /**
  * @test
  **/
 public function it_translates_to()
 {
     L::shouldReceive('get')->once()->andReturn('en')->shouldReceive('t')->andReturn('prova');
     $transl = new UrlTranslatorIlluminate();
     $url = $transl->to('prova');
     $this->assertContains('/en/prova', $url);
 }
Example #18
0
 function syncredit($arr)
 {
     if (is_array($arr)) {
         foreach ($arr as $uid => $setv) {
             $updateMemberData = array();
             foreach ($setv as $cid => $value) {
                 if (is_numeric($cid)) {
                     $value = intval($value);
                     /**
                     						$this->db->pw_update(
                     							"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"UPDATE pw_membercredit SET value=" . S::sqlEscape($value) .  ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))
                     						);
                     						**/
                     $this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
                 } elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) {
                     $cid == 'rvrc' && ($value *= 10);
                     $updateMemberData[$cid] = intval($value);
                 }
             }
             if ($updateMemberData) {
                 $userService = L::loadClass('UserService', 'user');
                 /* @var $userService PW_UserService */
                 $userService->update($uid, array(), $updateMemberData);
             }
         }
     }
     return new ApiResponse(1);
 }
Example #19
0
 /**
  * 上传csv文件到服务器端
  *
  */
 function _uploadCsv()
 {
     L::loadClass('csvupload', 'upload', false);
     $csvupload = new CsvUpload($this->_uid);
     PwUpload::upload($csvupload);
     $this->_filename = $csvupload->pathname;
 }
Example #20
0
 /**
  * @return Unpacker|NULL
  */
 protected function loadCompiled($filename)
 {
     $basename = basename($filename, '.xoup');
     $class = 'XOUP' . $basename . 'Unpacker';
     if (!class_exists($class, false)) {
         $dirname = dirname($filename);
         $compiled_name = $dirname . '/' . $basename . '.php';
         if (file_exists($dirname . '/' . $basename . '.php')) {
             $source_ts = filemtime($filename);
             $compiled_ts = filemtime($compiled_name);
             if ($compiled_ts < $source_ts) {
                 L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'source modified since last compilation', array());
                 return null;
             }
             require_once $compiled_name;
             if (!class_exists($class)) {
                 throw new RuntimeException("{$class} not present in {$compiled_name}");
             }
             L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'loaded compiled XOUP class %s from file %s', array($class, $compiled_name));
         } else {
             // no compiled file exists
             L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'compiled XOUP file %s does not (yet) exist', array($compiled_name));
             return null;
         }
     }
     return new $class();
 }
Example #21
0
 function get_cat_select_arr($with_empty_field = false)
 {
     $cat_arr = $with_empty_field ? ["0" => ""] : [];
     Category::whereLang(L::get_admin())->get(["id", "description"])->each(function ($cat) use(&$cat_arr) {
         $cat_arr[$cat->id] = $cat->description;
     });
     return $cat_arr;
 }
 /**
  * @return PW_Weibo_ContentDB
  */
 function _getWeiboDao()
 {
     static $sWeiboDao;
     if (!$sWeiboDao) {
         $sWeiboDao = L::loadDB('weibo_content', 'sns');
     }
     return $sWeiboDao;
 }
 public static function line()
 {
     $mem = memory_get_usage();
     $diffmem = memory_get_usage() - self::$lastmem;
     self::$lastmem = $mem;
     $args = func_get_args();
     echo implode(" ", $args) . " [" . number_format($mem / 1024, 2) . "KB / " . number_format($diffmem / 1024, 2) . "KB]\n";
 }
Example #24
0
 function getRewardDao()
 {
     static $sRewardDao;
     if (!$sRewardDao) {
         $sRewardDao = L::loadDB('reward', 'forum');
     }
     return $sRewardDao;
 }
Example #25
0
 function _render()
 {
     $layoutService = L::loadClass('layout', 'framework');
     $layoutService->init($this->_viewPath, $this->_layoutFile, $this->_layoutExt);
     $layoutService->setPartial($this->_partial);
     $layoutService->setTemplate($this->_template ? $this->_template : $this->_controller . '.' . $this->_action);
     $layoutService->display($this->_layoutFile, $this->_viewer);
 }
Example #26
0
/**
 * 重置消息数
 */
function resetUserMsgCount($num)
{
    global $winduid, $winddb;
    $num = intval($num);
    $userService = L::loadclass('UserService', 'user');
    /* @var $userService PW_UserService */
    $userService->update($winduid, array('newpm' => $num));
}
 function run()
 {
     $tid = $this->getVar('tid');
     $uid = $this->getVar('winduid');
     $pid = $this->getVar('pid');
     $replyRewardRecordService = L::loadClass('ReplyRewardRecord', 'forum');
     $GLOBALS['isReplyRewardSuccess'] = $replyRewardRecordService->rewardReplyUser($uid, $tid, $pid);
 }
Example #28
0
 /**
  * Set this to true and debug messages will be logged/output
  *
  * @static
  * @param boolean    
  */
 static function setDebug($bool)
 {
     if ($bool) {
         self::$debug = true;
     } else {
         self::$debug = false;
     }
 }
 public function delete($id, $postdata = null)
 {
     $bookmark = $this->get($id);
     if ($bookmark["userid"] != $this->user->getId()) {
         throw new Exception(L::get("PERMISSION_DENIED"), 401);
     }
     $this->db->query('DELETE FROM torrent_list_bookmarks WHERE id = ' . $bookmark["id"]);
 }
Example #30
0
 function getDefaultBlockByStamp($stamp)
 {
     $stampdata = $this->getDataByStamp($stamp);
     if ($stampdata['init']) {
         $pw_block = L::loadDB('block');
         return $pw_block->getData($stampdata['init']);
     }
 }