本文整理汇总了PHP中L类的典型用法代码示例。如果您正苦于以下问题:PHP L类的具体用法?PHP L怎么用?PHP L使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了L类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSendToUsernames
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;
}
示例2: query
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);
}
示例3: run
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"]);
}
}
示例4: update
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;
}
示例5: CheckUserTool
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');
}
}
}
}
示例6: transfer
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;
}
示例7: _getDataAnalyseService
function _getDataAnalyseService()
{
if (!$this->_dataAnalyseService) {
$this->_dataAnalyseService = L::loadClass('datanalyseService', 'datanalyse');
}
return $this->_dataAnalyseService;
}
示例8: create
/**
* 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;
}
示例9: actionConfirmation
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));
}
示例10: _getElement
function _getElement()
{
if (!$this->_element) {
$this->_element = L::loadClass('element');
}
return $this->_element;
}
示例11: query
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);
}
示例12: addPluginsTo
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);
}
}
示例13: create
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);
}
示例14: AttUpload
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);
}
示例15: update
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;
}