本文整理汇总了PHP中needRole函数 的典型用法代码示例。如果您正苦于以下问题:PHP needRole函数的具体用法?PHP needRole怎么用?PHP needRole使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了needRole函数 的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(RDR_User::ROLE_ADMIN, true);
$this->user = new RDR_User(db());
if (get("id")) {
$tmp = RDR_User::getById(get("id"));
if ($tmp) {
$this->user = $tmp;
}
}
$this->form = $this->getForm();
if (post("save")) {
if (!$this->form->validateAllFields()) {
v("message", t("form.validation.error"));
} elseif (post("password") && post("password") != post("password2")) {
v("message", t("admin.user.2"));
} else {
$this->form->setObjectMembersBySubmittedValues($this->user);
if (post("password")) {
$this->user->setPassword(post("password"));
}
$this->user->store();
v("message", t("saved"));
$this->form = $this->getForm();
}
}
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:31, 代码来源:User.class.php
示例2: onLoad
/**
* Load the View
*/
public function onLoad()
{
if (!needRole()) {
return;
}
if (get("type") == "image") {
$url = urldecode(get("url"));
if (substr($url, 0, 2) == "//") {
$url = "http:" . $url;
}
$exp = explode(".", preg_replace("~\\?.*~i", "", $url));
$extension = end($exp);
if (count($exp) <= 1 || !$extension || strlen($extension) > 4 || preg_match("~[^a-z]~i", $extension)) {
$extension = "jpg";
}
$slug = md5($url);
$tmpPath = CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp/filecontents.{$slug}.{$extension}";
if (!file_exists($tmpPath)) {
$data = @file_get_contents($url);
file_put_contents($tmpPath, $data !== false ? $data : "");
}
header("content-type: image/{$extension}");
header("content-length: " . filesize($tmpPath));
header("Last-Modified: " . date("r", filemtime($tmpPath)));
header("Expires: " . date("r", filemtime($tmpPath) + self::CACHETIME));
header("Cache-Control: public, max-age= " . self::CACHETIME);
readfile($tmpPath);
}
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:32, 代码来源:Proxy.class.php
示例3: changePassword
public function changePassword()
{
needRole('admin');
if (!$this->checkPassword(getRole('admin'), $_REQUEST['oldpasswd'])) {
$this->_tpl->assign('msg', '原密码不对!');
} else {
daocall('admin_user', 'updatePassword', array(getRole('admin'), $_REQUEST['passwd']));
$this->_tpl->assign('msg', '修改密码成功');
}
return $this->_tpl->display('msg.html');
}
开发者ID:srdc2014, 项目名称:vhms, 代码行数:11, 代码来源:session.ctl.php
示例4: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(null, true);
if (post("savepw")) {
if (post("newpw") && post("newpw") == post("newpw2")) {
user()->setPassword(post("newpw"));
user()->store();
v("message", t("saved"));
}
}
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:15, 代码来源:Settings.class.php
示例5: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(RDR_User::ROLE_ADMIN, true);
if (req()->isAjax()) {
if (post("update")) {
$feed = RDR_Feed::getById(post("update"));
if ($feed) {
RDR_Import::importFeedEntries($feed);
}
}
return;
}
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:17, 代码来源:System.class.php
示例6: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(RDR_User::ROLE_ADMIN, true);
$this->form = $this->getForm();
if (post("save")) {
foreach ($this->form->fields as $field) {
if ($field->attr->get("data-setting")) {
RDR_Setting::set($field->name, $field->getSubmittedValue());
}
}
v("message", t("saved"));
$this->form = $this->getForm();
}
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:18, 代码来源:Settings.class.php
示例7: needRole
<?php
needRole('user');
class FrameControl extends Control
{
public function __construct()
{
parent::__construct();
}
public function __destruct()
{
parent::__destruct();
}
public function login()
{
return $this->display('user/index.html');
}
public function index()
{
$request = '';
foreach ($_REQUEST as $k => $v) {
if ($k == 'a' || $k == 'c' || $k == 'fa' || $k == 'fc') {
continue;
}
$request .= '&' . $k . '=' . urlencode($v);
}
$this->assign('request', $request);
return $this->display('frame/index.html');
}
public function top()
{
开发者ID:srdc2014, 项目名称:vhms, 代码行数:31, 代码来源:frame.ctl.php
示例8: needRole
<?php
needRole('admin');
class NodesControl extends Control
{
public function __construct()
{
parent::__construct();
}
public function __destruct()
{
parent::__destruct();
}
public function listNode()
{
$username = $_GET['username'];
$list = daocall('nodes', "listNodes", null);
$sum = count($list);
$this->_tpl->assign('sum', $sum);
$this->_tpl->assign('username', $username);
$this->_tpl->assign('list', $list);
$this->_tpl->display('nodes/listnode.html');
}
public function addNode()
{
$this->_tpl->assign('action', 'insert');
$this->_tpl->display('nodes/addnode.html');
}
public function ajaxCheckNode()
{
$node = $_REQUEST['node'];
开发者ID:srdc2014, 项目名称:vhms, 代码行数:31, 代码来源:nodes.ctl.php
示例9: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(null, true);
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:8, 代码来源:BrowserScript.class.php
示例10: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(null, true);
# OPML
if (get("opml")) {
$categories = user()->getCategories();
$opml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><opml></opml>');
$opml->addAttribute("version", "1.0");
$head = $opml->addChild("head");
$head->addChild("title", "Subscriptions from nReeda");
$body = $opml->addChild("body");
foreach ($categories as $category) {
$cat = $body->addChild("outline");
$cat->addAttribute("title", $category->name);
$cat->addAttribute("text", $category->name);
$feeds = $category->feeds;
if ($feeds) {
foreach ($feeds as $feed) {
$f = $cat->addChild("outline");
$f->addAttribute("type", "rss");
$f->addAttribute("text", $feed->getCustomName($category));
$f->addAttribute("title", $feed->getCustomName($category));
$f->addAttribute("xmlUrl", $feed->url);
}
}
}
$data = $opml->asXML();
CHOQ_OutputManager::cleanAllBuffers();
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"nreeda.opml\"");
echo $data;
die;
}
# textfile
if (get("file")) {
$categories = user()->getCategories();
$lines = array();
foreach ($categories as $category) {
$feeds = $category->feeds;
if ($feeds) {
foreach ($feeds as $feed) {
$lines[] = $feed->url;
}
}
}
$data = implode("\n", $lines);
CHOQ_OutputManager::cleanAllBuffers();
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"nreeda.txt\"");
echo $data;
die;
}
# Import
if (isset($_FILES["file"]["tmp_name"])) {
$data = file_get_contents($_FILES["file"]["tmp_name"]);
if (strpos($data, "<?xml") === false || strpos($data, "</opml>") === false) {
$event = RDR_Import::importFromFile($_FILES["file"]["tmp_name"]);
if ($event->type == RDR_Event::TYPE_FILE_OK) {
RDR_Import::updateAllFeeds();
}
v("message", $event->getText());
} else {
$event = RDR_Import::importFromOPML($_FILES["file"]["tmp_name"]);
if ($event->type == RDR_Event::TYPE_OPML_OK) {
RDR_Import::updateAllFeeds();
}
v("message", $event->getText());
}
}
if (post("new") && trim(post("val"))) {
RDR_Category::get(post("val"));
redirect(url()->getUri(), 302);
}
if (req()->isAjax()) {
$categories = user()->getCategories();
$feeds = user()->getFeeds();
if (post("action") == "edit" && post("val")) {
if (isset($categories[post("category")])) {
$category = $categories[post("category")];
if (post("feed")) {
$feed = arrayValue($feeds, post("feed"));
if ($feed) {
$feed->setCustomName($category, post("val"));
$category->store();
}
} else {
$category->name = post("val");
$category->store();
}
}
}
if (post("action") == "move") {
if (isset($categories[post("categoryOld")])) {
$categoryOld = $categories[post("categoryOld")];
$categoryNew = $categories[post("categoryNew")];
if (post("feed")) {
$feed = arrayValue($feeds, post("feed"));
//.........这里部分代码省略.........
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:101, 代码来源:Organize.class.php
示例11: upgrade
public function upgrade()
{
needRole('user');
$user = getRole('user');
$product = apicall('product', 'newProduct', array($_REQUEST['product_type']));
if ($product->upgrade($user, $_REQUEST['name'], $_REQUEST['product_id'])) {
$this->_tpl->assign('msg', '升级成功');
} else {
$this->_tpl->assign('msg', '升级失败.' . $GLOBALS["last_error"]);
}
return $this->_tpl->fetch('public/msg.html');
}
开发者ID:srdc2014, 项目名称:vhms, 代码行数:12, 代码来源:product.ctl.php
示例12: onLoad
//.........这里部分代码省略.........
if (substr($file, 0, 1) == ".") {
continue;
}
if (!is_writable($file)) {
$count++;
}
}
if ($count) {
error(sprintf(t("update.3"), $count));
}
$version = RDR_Setting::get("latestversion")->value;
$data = array("message" => sprintf(t("update.5"), $version), "event" => "success", "next" => "prepare", "params" => array("version" => $version));
} catch (Exception $e) {
$data = array("message" => sprintf(t("update.7"), $e->getMessage()), "event" => "error");
}
break;
case "prepare":
try {
# downloading zip file from GIT
$url = "https://github.com/brainfoolong/nreeda/archive/" . get("version") . ".zip";
$data = RDR_FileContents::get($url);
if ($data === false) {
return;
}
$tmpZip = CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp/update.zip";
file_put_contents($tmpZip, $data);
$updateDir = CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp/update";
if (!is_dir($updateDir)) {
mkdir($updateDir);
}
# removing all old files
$files = CHOQ_FileManager::getFiles($updateDir, true, true);
foreach ($files as $file) {
if (!is_dir($file)) {
unlink($file);
}
}
foreach ($files as $file) {
if (is_dir($file)) {
rmdir($file);
}
}
# extract zip file to tmp folder
$zip = new ZipArchive();
$zip->open($tmpZip);
$zip->extractTo($updateDir);
$zip->close();
$folder = $updateDir . "/nreeda-" . get("version");
$data = array("message" => t("update.9"), "event" => "success", "next" => "update", "params" => array("updatefolder" => $folder, "rootfolder" => CHOQ_ROOT_DIRECTORY, "updateurl" => url()->getByAlias("base", "modules/RDR/tmp/update/nreeda-" . get("version") . "/update.php")));
} catch (Exception $e) {
$data = array("message" => sprintf(t("update.7"), $e->getMessage()), "event" => "error");
}
break;
case "db":
try {
RDR_DBUpdate::run();
$data = array("message" => t("update.10"), "event" => "success", "next" => "cleanup");
} catch (Exception $e) {
$data = array("message" => sprintf(t("update.7"), $e->getMessage()), "event" => "error");
}
break;
case "cleanup":
try {
# deleting all update files
$updateDir = CHOQ_ACTIVE_MODULE_DIRECTORY . "/tmp/update";
if (is_dir($updateDir)) {
$files = CHOQ_FileManager::getFiles($updateDir, true, true);
foreach ($files as $file) {
if (!is_dir($file)) {
unlink($file);
}
}
foreach ($files as $file) {
if (is_dir($file)) {
rmdir($file);
}
}
}
if (is_dir($updateDir)) {
rmdir($updateDir);
}
$updateFile = CHOQ_ROOT_DIRECTORY . "/update.php";
if (file_exists($updateFile)) {
unlink($updateFile);
}
$data = array("message" => t("update.11"), "event" => "success");
} catch (Exception $e) {
$data = array("message" => sprintf(t("update.7"), $e->getMessage()), "event" => "error");
}
break;
case "disable":
RDR_Maintenance::disableMaintenanceMode();
break;
}
echo json_encode($data);
return;
}
needRole(RDR_User::ROLE_ADMIN, true);
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:101, 代码来源:Update.class.php
示例13: onLoad
/**
* Load the View
*/
public function onLoad()
{
if (!needRole()) {
return;
}
# some ajax actions
switch (post("action")) {
case "admin-feed":
if (needRole(RDR_User::ROLE_ADMIN)) {
$entry = RDR_Entry::getById(post("eid"));
$feed = RDR_Feed::getById(post("fid"));
?>
<b><?php
echo t("feedadmin.raw.1");
?>
</b>
<div class="small">
<?php
echo t("feedadmin.raw.2");
?>
</div>
<code class="raw"><?php
echo s('<div>' . $entry->text . '</div>');
?>
</code><br/><br/>
<b><?php
echo t("feedadmin.format.1");
?>
</b>
<div class="small">
<?php
echo t("feedadmin.format.2");
?>
</div>
<code class="formated"></code><br/><br/>
<b><?php
echo sprintf(t("feedadmin.js.1"), s(cut($feed->name, 30)));
?>
</b>
<div class="small">
<?php
echo nl2br(sprintf(t("feedadmin.js.2"), s('<p>'), 'html = $(html); html.find("p").remove()'));
?>
<br/>
<textarea data-field="contentJS" style="width:90%" cols="45" rows="3"><?php
echo s($feed->contentJS);
?>
</textarea>
</div>
<?php
}
return;
break;
case "readed":
if (post("ids")) {
$entries = RDR_Entry::getByIds(post("ids"));
if ($entries) {
user()->loadReadedFlags(array_keys($entries));
$insertIds = $deleteIds = array();
foreach ($entries as $entry) {
$id = $entry->getId();
if ($id < user()->setting("init.entry")) {
continue;
}
if (isset(user()->_cacheReaded[$id])) {
$deleteIds[$id] = $id;
} else {
$insertIds[$id] = $id;
}
}
if ($insertIds) {
$query = "INSERT IGNORE INTO RDR_User_readed (o,k,v) VALUES ";
foreach ($insertIds as $id) {
$query .= " (" . user()->getId() . ", {$id}, 1), ";
}
$query = substr($query, 0, -2);
db()->query($query);
}
if ($deleteIds) {
$query = "DELETE FROM RDR_User_readed WHERE o = " . user()->getId() . " && k IN " . db()->toDb($deleteIds);
}
user()->updateReadedCount();
}
}
break;
case "saved":
if (post("ids")) {
$entry = RDR_Entry::getById(post("ids[0]"));
if ($entry) {
if (user()->getByKey("saved", $entry->getId())) {
user()->remove("saved", $entry->getId());
} else {
user()->add("saved", 1, $entry->getId());
}
user()->store();
}
}
//.........这里部分代码省略.........
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:101, 代码来源:Ajax.class.php
示例14: onLoad
/**
* Load the View
*/
public function onLoad()
{
if (!needRole()) {
return;
}
$jsonData = null;
switch (post("action")) {
case "delete-feed-user":
$feed = RDR_Feed::getById(post("data[fid]"));
if ($feed) {
$cats = user()->getCategories();
foreach ($cats as $category) {
$feeds = $category->feeds;
if ($feeds) {
foreach ($feeds as $key => $catFeed) {
if (compare($catFeed, $feed)) {
unset($feeds[$key]);
}
}
if (count($feeds) != count($category->feeds)) {
$category->feeds = $feeds;
$category->store();
}
}
}
}
break;
case "delete-feed-admin":
if (needRole(RDR_User::ROLE_ADMIN)) {
$feed = RDR_Feed::getById(post("data[fid]"));
if ($feed) {
$feed->delete();
}
}
break;
case "add-feed":
$event = RDR_Import::addFeed(post("data[url]"), RDR_Category::get(post("data[category]")));
if ($event->feed) {
RDR_Import::importFeedEntries($event->feed);
}
break;
case "mark-all-as-readed":
$cache = session("entry.ids.original");
if ($cache) {
$ids = array_keys($cache);
user()->loadReadedFlags(array_keys($ids));
$insertIds = array();
foreach ($ids as $id) {
if (!isset(user()->_cacheReaded[$id])) {
$insertIds[$id] = $id;
}
}
if ($insertIds) {
$query = "INSERT IGNORE INTO RDR_User_readed (o,k,v) VALUES ";
foreach ($insertIds as $id) {
$query .= " (" . user()->getId() . ", {$id}, 1), ";
}
$query = substr($query, 0, -2);
db()->query($query);
user()->updateReadedCount();
}
}
break;
case "update-setting-user":
user()->setting(post("data[key]"), post("data[value]"));
user()->store();
break;
case "update-newscache":
user()->updateNewsCache();
$jsonData = user()->getAjaxData();
break;
case "set-entries-readed":
if (post("data[ids]")) {
$entries = RDR_Entry::getByIds(post("data[ids]"));
if ($entries) {
user()->loadReadedFlags(array_keys($entries));
$insertIds = $deleteIds = array();
foreach ($entries as $entry) {
$id = $entry->getId();
if ($id < user()->setting("init.entry")) {
continue;
}
if (isset(user()->_cacheReaded[$id])) {
$deleteIds[$id] = $id;
} else {
$insertIds[$id] = $id;
}
}
if ($insertIds) {
$query = "INSERT IGNORE INTO RDR_User_readed (o,k,v) VALUES ";
foreach ($insertIds as $id) {
$query .= " (" . user()->getId() . ", {$id}, 1), ";
}
$query = substr($query, 0, -2);
db()->query($query);
}
if ($deleteIds) {
//.........这里部分代码省略.........
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:101, 代码来源:API.class.php
示例15: getContent
/**
* Get content
*/
public function getContent()
{
headline(t("dashboard"));
$settings = array("note.opml.import" => array("url" => l("RDR_Organize")), "note.addfeed" => array("url" => ""), "note.bug" => array("url" => "https://bfldev.com/nreeda"), "note.opml.export" => array("url" => l("RDR_Organize")), "note.search" => array("url" => ""), "note.settings" => array("url" => ""));
echo sprintf(t("hello"), '<b>' . user()->username . '</b>') . "<br/><br/>";
foreach ($settings as $key => $data) {
if (user()->setting($key)) {
continue;
}
echo '<div class="note" data-id="' . $key . '" data-url="' . $data["url"] . '">' . t($key) . '</div>';
}
?>
<script type="text/javascript">
$("#content .note").on("click", function(){
var url = $(this).attr("data-url");
var e = $(this);
$.post(Global.vars.ajaxUrl, {action : "changesetting", "key" : $(this).attr("data-id"), "value" : 1}, function(data){
e.remove();
if(url){
if(url.match(/^http/)){
window.open(url);
}else{
window.location.href = url;
}
}
})
});
</script>
<div class="spacer"></div>
<?php
if (needRole(RDR_User::ROLE_ADMIN)) {
headline(t("dashboard.eventlog"));
$logs = RDR_Event::getByCondition(null, null, "-id", 50);
?>
<div id="eventlog">
<?php
if ($logs) {
?>
<input type="button" class="btn" value="<?php
echo t("dashboard.clearlog");
?>
"/><?php
}
?>
<div class="spacer"></div>
<?php
foreach ($logs as $log) {
?>
<div class="event">
<time datetime="<?php
echo $log->createTime->getUnixtime();
?>
" class="inline-btn"></time>
<?php
echo $log->getText();
?>
</div>
<?php
}
?>
</div>
<div class="spacer"></div>
<script type="text/javascript">
$("#eventlog input.btn").on("click", function(){
$.post(window.location.href, {clearlog : 1});
$("#eventlog").remove();
});
</script>
<?php
$file = CHOQ_ACTIVE_MODULE_DIRECTORY . "/logs/error.log.php";
if (file_exists($file) && filesize($file)) {
$data = file_get_contents($file);
$data = substr($data, strpos($data, "\n\n"));
headline(t("dashboard.errorlog"));
?>
<div id="errorlog">
<input type="button" class="btn" value="<?php
echo t("dashboard.clearlog");
?>
"/>
<pre style="font-size:11px; overflow:auto; max-height:400px;"><code><?php
echo s(trim($data));
?>
</code></pre>
</div>
<script type="text/javascript">
$("#errorlog input.btn").on("click", function(){
$.post(window.location.href, {clearerrorlog : 1});
$("#errorlog").remove();
});
</script>
<?php
}
}
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:100, 代码来源:Home.class.php
示例16: displayEntry
/**
* Display contents for a entry
*
* @param RDR_Entry $entry
*/
private function displayEntry(RDR_Entry $entry)
{
$jsonData = $entry->_dbValues;
$jsonData["id"] = $entry->getId();
$readed = isset(user()->_cacheReaded[$entry->getId()]) || user()->setting("init.entry") >= $entry->getId();
$saved = user()->getByKey("saved", $entry->getId());
$categories = user()->getCategories();
$feed = $entry->feed;
$jsonData["contentJS"] = $feed->contentJS;
$jsonData["feedId"] = $feed->getId();
$category = user()->getCategoryToFeed($feed);
$layout = "default";
$favicon = $entry->feed->getFaviconUrl();
if (user()->setting("layout")) {
$layout = user()->setting("layout");
}
$smallTag = '<div class="feed-options small">';
if (!$readed) {
$smallTag .= '<span><a href="#" class="readed">' . t("mark.read") . '</a> · </span>';
}
$smallTag .= '<span><a href="#" class="saved">' . (!$saved ? t("saveit") : t("remove.save")) . '</a> · </span>';
$smallTag .= '<time datetime="' . $entry->datetime->getUnixtime() . '"></time> · ';
$smallTag .= t("feed") . ': ';
if ($favicon) {
$smallTag .= '<span class="favicon" style="background-image:url(' . $favicon . ')"></span>';
}
$smallTag .= sprintf(t("feeds.2"), '<a href="' . $entry->feed->getLink() . '">' . s(cut($entry->feed->name, 30)) . '</a>', '<a href="' . $category->getLink() . '">' . s(cut($category->name, 30)) . '</a>') . " · ";
$smallTag .= t("url") . ': <a href="' . $entry->link . '" target="_blank">' . s(cut($entry->link, 30)) . '</a>';
if (needRole(RDR_User::ROLE_ADMIN)) {
$smallTag .= ' · <a href="#" class="adminview">' . t("adminview") . '</a>';
}
$smallTag .= '</div>';
$titleTag = '<h2><a href="' . $entry->link . '" target="_blank" onclick="return false;" rel="noreferrer">' . s($entry->title) . '</a></h2>';
$imageTag = '<div class="image"></div>';
?>
<div class="<?php
echo user()->setting("hideimages") ? 'no-feed-images' : null;
?>
entry <?php
echo $readed && $this->readedLayoutEnabled ? 'readed' : null;
?>
layout-<?php
echo s($layout);
?>
" id="entry-<?php
echo $entry->getId();
?>
" data-id="<?php
echo $entry->getId();
?>
" data-feed="<?php
echo $feed->getId();
?>
">
<div class="feed-start"></div>
<?php
switch ($layout) {
case "big":
?>
<?php
echo $titleTag;
?>
<div class="clear"></div>
<div class="float-one">
<div class="inner"><?php
echo $imageTag;
?>
</div>
</div>
<div class="float-two">
<div class="inner">
<?php
echo $smallTag;
?>
<div class="text"></div>
</div>
</div>
<div class="clear"></div>
<?php
break;
case "headline":
echo $titleTag;
echo $smallTag;
break;
default:
?>
<div class="float-one">
<div class="inner"><?php
echo $imageTag;
?>
</div>
</div>
<div class="float-two">
<div class="inner">
<?php
//.........这里部分代码省略.........
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:101, 代码来源:Feeds.class.php
示例17: onLoad
/**
* Load the View
*/
public function onLoad()
{
needRole(null, true);
if (get("token")) {
$token = explode(".", get("token"));
if (count($token) == 2 && saltedHash("sha256", $token[0]) == $token[1]) {
session("user.id", $token[0]);
if (user()) {
$max = min(array(200, (int) get("max")));
$catmax = get("catmax") ? min(array($max, (int) get("catmax"))) : $max;
$feedmax = get("feedmax") ? min(array($max, (int) get("feedmax"))) : $max;
$feedIds = explode(",", get("f"));
$rss = new SimpleXMLElement('<' . '?xml version="1.0" encoding="utf-8"?><rss></rss>');
$rss->addAttribute("version", "2.0");
$channel = $rss->addChild("channel");
$channel->addChild("title", get("title"));
$channel->addChild("description", get("desc"));
$channel->addChild("pubDate", dt("now")->format("r"));
$feeds = user()->getFeeds();
$catCount = $feedCount = array();
$count = 0;
$allEntries = array();
$offset = 0;
$limit = 50;
while (true) {
if (!$feeds) {
break;
}
$entries = RDR_Entry::getByCondition("feed IN {0} && id > {1}", array($feeds, (int) user()->setting("init.entry")), array("-datetime", "-id"), $limit, $offset);
$offset += $limit;
if (!$entries) {
break;
}
user()->loadReadedFlags(array_keys($entries));
foreach ($entries as $entry) {
if (isset(user()->_cacheReaded[$entry->getId()])) {
continue;
}
if ($count >= $max) {
break 2;
}
$feed = $entry->feed;
$category = user()->getCategoryToFeed($feed);
$feedId = $feed->getId();
$catId = $category->getId();
if (!isset($catCount[$catId])) {
$catCount[$catId] = 0;
}
if (!isset($feedCount[$feedId])) {
$feedCount[$feedId] = 0;
}
if ($feedCount[$feedId] >= $feedmax) {
if (isset($feeds[$feedId])) {
unset($feeds[$feedId]);
}
continue;
}
if ($catCount[$catId] >= $catmax) {
continue;
}
$entry->category = $category;
$entry->time = $entry->datetime->getUnixtime();
$allEntries[] = $entry;
$feedCount[$feedId]++;
$catCount[$catId]++;
$count++;
}
}
foreach ($allEntries as $entry) {
$feed = $entry->feed;
$category = $entry->category;
$item = $channel->addChild("item");
$this->addCData($item->addChild("title"), $entry->title);
$this->addCData($item->addChild("link"), $entry->link);
$this->addCData($item->addChild("description"), $entry->text);
$this->addCData($item->addChild("category"), $category->name);
$item->addChild("guid", $entry->getId());
$item->addChild("pubDate", $entry->datetime->format("r"));
}
$data = $rss->asXML();
CHOQ_OutputManager::cleanAllBuffers();
header("Content-type: application/rss+xml");
echo $data;
die;
}
}
}
view("RDR_BasicFrame", array("view" => $this));
}
开发者ID:nonconforme, 项目名称:nreeda, 代码行数:92, 代码来源:RSS.class.php
GitbookIO/gitbook:
阅读:946| 2022-08-17
juleswhite/mobile-cloud-asgn1
阅读:1020| 2022-08-30
A vulnerability was found in Itech Movie Portal Script 7.36. It has been rated a
阅读:779| 2022-07-29
kyamagu/matlab-json: Use official API: https://mathworks.com/help/matlab/json-fo
阅读:919| 2022-08-17
书名:墙壁眼睛膝盖 作者:温柔一刀 类别:欲望丛林,饮食男女。 簡介:Wall(我)Eye(爱)Kn
阅读:649| 2022-11-06
万里平台武汉会场,用诗歌赞美大美武汉,一起来欣赏下吧。 大美武汉颂 词/绿野 江城武
阅读:781| 2022-07-30
sevenjay/cpp-markdown: Cpp-Markdown is a freely-available Markdown text-to-HTML
阅读:571| 2022-08-18
mathjax/MathJax-i18n: MathJax localization
阅读:382| 2022-08-16
源代码:------------------------------------------------------------------------
阅读:478| 2022-07-18
众所周知,我们的身份证号码里面包含的信息有很多,如出生日期、性别和识别码等,如果
阅读:247| 2022-11-06
请发表评论