Commit c7a785ac authored by rjsmelo's avatar rjsmelo

[REF] Reformat code

parent 2a6d55c9
This diff is collapsed.
......@@ -3,7 +3,7 @@
* @package tikiwiki
*/
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -17,20 +17,20 @@
//
// Otherwise, the procedural script remains
$inputConfiguration = array(array(
'staticKeyFilters' => array(
$inputConfiguration = [[
'staticKeyFilters' => [
'action' => 'word',
'controller' => 'text',
),
));
],
]];
if (isset($_REQUEST['controller'], $_REQUEST['action'])) {
$inputConfiguration[] = array('catchAllUnset' => null);
$inputConfiguration[] = ['catchAllUnset' => null];
}
//Some times the filters spit out some errors, here we get the error into a var, so the ajax still works.
ob_start();
require_once ('tiki-setup.php');
require_once('tiki-setup.php');
$errMsg = ob_get_clean();
if (isset($_REQUEST['controller'], $_REQUEST['action'])) {
......@@ -58,7 +58,7 @@ if ($access->is_serializable_request() && isset($_REQUEST['listonly'])) {
$query = $jitRequest->q->text();
$sep = '|';
if ( isset( $_REQUEST['separator'] ) ) {
if (isset($_REQUEST['separator'])) {
$sep = $_REQUEST['separator'];
}
$p = strrpos($query, $sep);
......@@ -72,11 +72,11 @@ if ($access->is_serializable_request() && isset($_REQUEST['listonly'])) {
}
if ($_REQUEST['listonly'] == 'groups') {
$listgroups = $userlib->get_groups(0, -1, 'groupName_asc', '', '', 'n');
// TODO proper perms checking - this looks right but returns nothing for reg, and everything for admin
// $listgroups['data'] = Perms::filter( array( 'type' => 'group' ), 'object', $listgroups['data'], array( 'object' => 'groupName' ), 'view_group' );
$grs = array();
$grs = [];
foreach ($listgroups['data'] as $gr) {
if (isset($query) && stripos($gr['groupName'], $query) !== false) {
$grs[] = $gr['groupName'];
......@@ -88,11 +88,9 @@ if ($access->is_serializable_request() && isset($_REQUEST['listonly'])) {
$last_name = trim(end(array_filter($names_array)));
$listusers = $userlib->get_users_names(0, 100, 'login_asc', $last_name);
$access->output_serialized($listusers);
$access->output_serialized($listusers);
} elseif ($_REQUEST['listonly'] == 'usersandcontacts') {
$email_array = explode(',', str_replace(';', ',', $query));
$last_email = trim(end($email_array));
......@@ -100,97 +98,96 @@ if ($access->is_serializable_request() && isset($_REQUEST['listonly'])) {
$listcontact = $contactlib->list_contacts($user);
$listusers = $userlib->get_users(0, 100, 'login_asc', '', '', false, '', $last_email);
$contacts = array();
foreach ($listcontact as $key=>$contact) {
if (isset($last_email) && (stripos($contact['firstName'], $last_email) !== false or stripos($contact['lastName'], $last_email) !== false or stripos($contact['email'], $last_email) !== false)) {
if ($contact['email']<>'') {
$contacts[] = $contact['email'];
}
}
}
foreach ($listusers['data'] as $key=>$contact) {
if (isset($last_email) && (stripos($contact['firstName'], $last_email) !== false or stripos($contact['login'], $last_email) !== false or stripos($contact['lastName'], $last_email) !== false or stripos($contact['email'], $query) !== false)) {
if ($prefs['login_is_email'] == 'y') {
$contacts[] = $contact['login'];
} else {
$contacts[] = $contact['email'];
}
}
}
$contacts = array_unique($contacts);
sort($contacts);
$access->output_serialized($contacts);
} elseif ($_REQUEST['listonly'] == 'userrealnames') {
$contacts = [];
foreach ($listcontact as $key => $contact) {
if (isset($last_email) && (stripos($contact['firstName'], $last_email) !== false or stripos($contact['lastName'], $last_email) !== false or stripos($contact['email'], $last_email) !== false)) {
if ($contact['email'] <> '') {
$contacts[] = $contact['email'];
}
}
}
foreach ($listusers['data'] as $key => $contact) {
if (isset($last_email) && (stripos($contact['firstName'], $last_email) !== false or stripos($contact['login'], $last_email) !== false or stripos($contact['lastName'], $last_email) !== false or stripos($contact['email'], $query) !== false)) {
if ($prefs['login_is_email'] == 'y') {
$contacts[] = $contact['login'];
} else {
$contacts[] = $contact['email'];
}
}
}
$contacts = array_unique($contacts);
sort($contacts);
$access->output_serialized($contacts);
} elseif ($_REQUEST['listonly'] == 'userrealnames') {
$names_array = explode(',', str_replace(';', ',', $query));
$last_name = trim(end($names_array));
$groups = '';
$groups = '';
$listusers = $userlib->get_users_light(0, -1, 'login_asc', $last_name, $groups);
$done = array();
$finalusers = array();
foreach ($listusers as $usrId => $usr) {
if (isset($last_name)) {
$longusr = $usr . ' (' . $usrId . ')';
if (array_key_exists($usr, $done)) {
// disambiguate duplicates
if (stripos($longusr, $last_name) !== false) {
$oldkey = array_search($usr, $finalusers);
if ($oldkey !== false) {
$finalusers[$oldkey] = $done[$usr];
}
}
if (stripos($longusr, $last_name) !== false) {
$finalusers[] = $longusr;
}
} else {
if (stripos($longusr, $last_name) !== false) {
$finalusers[] = $longusr;
}
}
$done[$usr] = $longusr;
}
}
$access->output_serialized($finalusers);
} elseif ( $_REQUEST['listonly'] == 'tags' ) {
$done = [];
$finalusers = [];
foreach ($listusers as $usrId => $usr) {
if (isset($last_name)) {
$longusr = $usr . ' (' . $usrId . ')';
if (array_key_exists($usr, $done)) {
// disambiguate duplicates
if (stripos($longusr, $last_name) !== false) {
$oldkey = array_search($usr, $finalusers);
if ($oldkey !== false) {
$finalusers[$oldkey] = $done[$usr];
}
}
if (stripos($longusr, $last_name) !== false) {
$finalusers[] = $longusr;
}
} else {
if (stripos($longusr, $last_name) !== false) {
$finalusers[] = $longusr;
}
}
$done[$usr] = $longusr;
}
}
$access->output_serialized($finalusers);
} elseif ($_REQUEST['listonly'] == 'tags') {
$freetaglib = TikiLib::lib('freetag');
$tags = $freetaglib->get_tags_containing($query);
$access->output_serialized($tags);
} elseif ( $_REQUEST['listonly'] == 'icons' ) {
} elseif ($_REQUEST['listonly'] == 'icons') {
$dir = 'img/icons';
$max = isset($_REQUEST['max']) ? $_REQUEST['max'] : 10;
$icons = array();
$icons = [];
$style_dir = $tikilib->get_style_path($prefs['style'], $prefs['style_option']);
if ($style_dir && is_dir($style_dir . $dir)) {
read_icon_dir($style_dir . $dir, $icons, $max, $query);
}
read_icon_dir($dir, $icons, $max, $query);
$access->output_serialized($icons);
} elseif ( $_REQUEST['listonly'] == 'shipping' && $prefs['shipping_service'] == 'y' ) {
global $shippinglib; require_once 'lib/shipping/shippinglib.php';
} elseif ($_REQUEST['listonly'] == 'shipping' && $prefs['shipping_service'] == 'y') {
global $shippinglib;
require_once 'lib/shipping/shippinglib.php';
$access->output_serialized($shippinglib->getRates($_REQUEST['from'], $_REQUEST['to'], $_REQUEST['packages']));
} elseif ( $_REQUEST['listonly'] == 'trackername' ) {
} elseif ($_REQUEST['listonly'] == 'trackername') {
$trackers = TikiLib::lib('trk')->get_trackers_containing($query);
$access->output_serialized($trackers);
}
} elseif ($access->is_serializable_request() && isset($_REQUEST['zotero_tags'])) { // Handle Zotero Requests
$access->check_feature(array( 'zotero_enabled' ));
$access->check_feature([ 'zotero_enabled' ]);
$zoterolib = TikiLib::lib('zotero');
$references = $zoterolib->get_references($_REQUEST['zotero_tags']);
if ($references === false) {
$access->output_serialized(array('type' => 'unauthorized', 'results' => array()));
$access->output_serialized(['type' => 'unauthorized', 'results' => []]);
} else {
$access->output_serialized(array('type' => 'success', 'results' => $references));
$access->output_serialized(['type' => 'success', 'results' => $references]);
}
} elseif (isset($_REQUEST['geocode']) && $access->is_serializable_request()) {
$access->output_serialized(TikiLib::lib('geo')->geocode($_REQUEST['geocode']));
} else {
$access->display_error(NULL, 'No AJAX service matches request parameters', 404);
$access->display_error(null, 'No AJAX service matches request parameters', 404);
}
/**
......@@ -205,8 +202,7 @@ function read_icon_dir($dir, &$icons, $max, $query)
preg_match('/^([^\.].*)\..*$/', $f, $m);
if (count($m) > 0 && count($icons) < $max &&
stripos($m[1], $query) !== false &&
!in_array($dir . '/' . $f, $icons)) {
! in_array($dir . '/' . $f, $icons)) {
$icons[] = $dir . '/' . $f;
}
}
......
......@@ -3,7 +3,7 @@
* @package tikiwiki
*/
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -13,25 +13,25 @@ global $prefs;
require 'tiki-setup.php';
include_once('lib/wiki/renderlib.php');
$access->check_feature(array('feature_multilingual', 'feature_multilingual_one_page'));
$access->check_feature(['feature_multilingual', 'feature_multilingual_one_page']);
$multilinguallib = TikiLib::lib('multilingual');
$wikilib = TikiLib::lib('wiki');
if ( !isset($_REQUEST['page']) ) {
if (! isset($_REQUEST['page'])) {
header('Location: tiki-index.php');
die;
}
$pages = array();
$pages = [];
$_REQUEST['page'] = $wikilib->get_page_by_slug($_REQUEST['page']);
$requested = $tikilib->get_page_info($_REQUEST['page']);
$page_id = $requested['page_id'];
$pages[] = $requested;
$unordered = array();
$excluded = array();
$unordered = [];
$excluded = [];
$page = $_REQUEST['page'];
$smarty->assign_by_ref('page', $page);
......@@ -39,12 +39,12 @@ $smarty->assign_by_ref('page', $page);
// If the page doesn't exist then display an error
if (empty($requested)) {
$likepages = $wikilib->get_like_pages($page);
// if we have exactly one match, redirect to it
if ($prefs['feature_wiki_1like_redirection'] == 'y' && count($likepages) == 1 && !$isUserPage) {
$access->redirect('tiki-all_languages.php?page='.urlencode($likepages[0]));
// if we have exactly one match, redirect to it
if ($prefs['feature_wiki_1like_redirection'] == 'y' && count($likepages) == 1 && ! $isUserPage) {
$access->redirect('tiki-all_languages.php?page=' . urlencode($likepages[0]));
}
$smarty->assign_by_ref('likepages', $likepages);
$smarty->assign('create', $isUserPage? 'n': 'y');
$smarty->assign('create', $isUserPage ? 'n' : 'y');
$access->display_error($page, tra('Page cannot be found'), '404');
}
......@@ -52,54 +52,59 @@ $preferred_langs = $multilinguallib->preferredLangs();
if (count($preferred_langs) == 1) {
// If user only has one language, then assume he wants to see all
// If user only has one language, then assume he wants to see all
// languages supported by the site (otherwise, why would he have asked
// for all languages). This has the advantage that users can see multiple
// languages even if they haven't registered and set their language preferences,
// or if they haven't logged in. Yet, if they have registered, set language
// preferences, and logged in, they can limit the displayed languages
// to only those that they want.
$preferred_langs = $prefs['available_languages'];
// to only those that they want.
$preferred_langs = $prefs['available_languages'];
}
// Sort languages according to user's prefences
foreach ( $multilinguallib->getTrads('wiki page', $page_id) as $row)
if ( $row['objId'] != $page_id && in_array($row['lang'], $preferred_langs) )
foreach ($multilinguallib->getTrads('wiki page', $page_id) as $row) {
if ($row['objId'] != $page_id && in_array($row['lang'], $preferred_langs)) {
$unordered[ $row['lang'] ] = $tikilib->get_page_info_from_id($row['objId']);
elseif ( $row['lang'] != $requested['lang'] )
} elseif ($row['lang'] != $requested['lang']) {
$excluded[] = $row['lang'];
}
}
foreach ( $preferred_langs as $lang )
if ( array_key_exists($lang, $unordered) )
foreach ($preferred_langs as $lang) {
if (array_key_exists($lang, $unordered)) {
$pages[] = $unordered[$lang];
}
}
$contents = array();
$contents = [];
$show_langs_side_by_side = false;
if (count($pages) <= 2) {
// If only two languages, its best to show
// If only two languages, its best to show
// them side by side for easier comparison
// (as opposed to one on top of the other).
// But for more than two languages, side by
// side is not possible, cause not enough real estate
$show_langs_side_by_side = true;
$show_langs_side_by_side = true;
}
foreach ( array_reverse($pages) as $id => $info ) {
foreach (array_reverse($pages) as $id => $info) {
$page = $info['pageName'];
$section = 'wiki page';
$renderer = new WikiRenderer($info, $user);
$renderer->applyPermissions();
if ( $tiki_p_view == 'y' ) {
if ($tiki_p_view == 'y') {
$renderer->runSetups();
$contents[] = $smarty->fetch('extends:layouts/internal/layout_view.tpl|tiki-show_page.tpl');
if ( $id === count($pages) - 1 )
if ($id === count($pages) - 1) {
$renderer->restoreAll();
}
}
}
......
......@@ -9,12 +9,12 @@
// $Id$
$section = 'cms';
require_once ('tiki-setup.php');
require_once('tiki-setup.php');
$artlib = TikiLib::lib('art');
$access->check_feature('feature_articles');
// PERMISSIONS: NEEDS p_admin or tiki_p_articles_admin_types
$access->check_permission(array('tiki_p_articles_admin_types'));
$access->check_permission(['tiki_p_articles_admin_types']);
if (isset($_REQUEST["add_type"])) {
$artlib->add_type($_REQUEST["new_type"]);
......@@ -23,24 +23,60 @@ if (isset($_REQUEST["add_type"])) {
$artlib->remove_type($_REQUEST["remove_type"]);
} elseif (isset($_REQUEST["update_type"])) {
foreach (array_keys($_REQUEST["type_array"]) as $this_type) {
if (!isset($_REQUEST["use_ratings"][$this_type])) $_REQUEST["use_ratings"][$this_type] = 'n';
if (!isset($_REQUEST["show_pre_publ"][$this_type])) $_REQUEST["show_pre_publ"][$this_type] = 'n';
if (!isset($_REQUEST["show_post_expire"][$this_type])) $_REQUEST["show_post_expire"][$this_type] = 'n';
if (!isset($_REQUEST["heading_only"][$this_type])) $_REQUEST["heading_only"][$this_type] = 'n';
if (!isset($_REQUEST["allow_comments"][$this_type])) $_REQUEST["allow_comments"][$this_type] = 'n';
if (!isset($_REQUEST["comment_can_rate_article"][$this_type])) $_REQUEST["comment_can_rate_article"][$this_type] = 'n';
if (!isset($_REQUEST["show_image"][$this_type])) $_REQUEST["show_image"][$this_type] = 'n';
if (!isset($_REQUEST["show_avatar"][$this_type])) $_REQUEST["show_avatar"][$this_type] = 'n';
if (!isset($_REQUEST["show_author"][$this_type])) $_REQUEST["show_author"][$this_type] = 'n';
if (!isset($_REQUEST["show_pubdate"][$this_type])) $_REQUEST["show_pubdate"][$this_type] = 'n';
if (!isset($_REQUEST["show_expdate"][$this_type])) $_REQUEST["show_expdate"][$this_type] = 'n';
if (!isset($_REQUEST["show_reads"][$this_type])) $_REQUEST["show_reads"][$this_type] = 'n';
if (!isset($_REQUEST["show_size"][$this_type])) $_REQUEST["show_size"][$this_type] = 'n';
if (!isset($_REQUEST["show_topline"][$this_type])) $_REQUEST["show_topline"][$this_type] = 'n';
if (!isset($_REQUEST["show_subtitle"][$this_type])) $_REQUEST["show_subtitle"][$this_type] = 'n';
if (!isset($_REQUEST["show_image_caption"][$this_type])) $_REQUEST["show_image_caption"][$this_type] = 'n';
if (!isset($_REQUEST["show_linkto"][$this_type])) $_REQUEST["show_linkto"][$this_type] = 'n';
if (!isset($_REQUEST["creator_edit"][$this_type])) $_REQUEST["creator_edit"][$this_type] = 'n';
if (! isset($_REQUEST["use_ratings"][$this_type])) {
$_REQUEST["use_ratings"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_pre_publ"][$this_type])) {
$_REQUEST["show_pre_publ"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_post_expire"][$this_type])) {
$_REQUEST["show_post_expire"][$this_type] = 'n';
}
if (! isset($_REQUEST["heading_only"][$this_type])) {
$_REQUEST["heading_only"][$this_type] = 'n';
}
if (! isset($_REQUEST["allow_comments"][$this_type])) {
$_REQUEST["allow_comments"][$this_type] = 'n';
}
if (! isset($_REQUEST["comment_can_rate_article"][$this_type])) {
$_REQUEST["comment_can_rate_article"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_image"][$this_type])) {
$_REQUEST["show_image"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_avatar"][$this_type])) {
$_REQUEST["show_avatar"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_author"][$this_type])) {
$_REQUEST["show_author"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_pubdate"][$this_type])) {
$_REQUEST["show_pubdate"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_expdate"][$this_type])) {
$_REQUEST["show_expdate"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_reads"][$this_type])) {
$_REQUEST["show_reads"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_size"][$this_type])) {
$_REQUEST["show_size"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_topline"][$this_type])) {
$_REQUEST["show_topline"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_subtitle"][$this_type])) {
$_REQUEST["show_subtitle"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_image_caption"][$this_type])) {
$_REQUEST["show_image_caption"][$this_type] = 'n';
}
if (! isset($_REQUEST["show_linkto"][$this_type])) {
$_REQUEST["show_linkto"][$this_type] = 'n';
}
if (! isset($_REQUEST["creator_edit"][$this_type])) {
$_REQUEST["creator_edit"][$this_type] = 'n';
}
$artlib->edit_type(
$this_type,
......@@ -65,9 +101,9 @@ if (isset($_REQUEST["add_type"])) {
);
// Add custom attributes
if ($prefs["article_custom_attributes"] == 'y' && !empty($_REQUEST["new_attribute"][$this_type])) {
if ($prefs["article_custom_attributes"] == 'y' && ! empty($_REQUEST["new_attribute"][$this_type])) {
$ok = $artlib->add_article_type_attribute($this_type, $_REQUEST["new_attribute"][$this_type]);
if (!$ok) {
if (! $ok) {
$smarty->assign('msg', tra("Failed to add attribute"));
$smarty->display("error.tpl");
die;
......@@ -89,7 +125,7 @@ if ($prefs["article_custom_attributes"] == 'y') {
$smarty->assign('types', $types);
include_once ('tiki-section_options.php');
include_once('tiki-section_options.php');
// the strings below are used to localize the article types in the template file
//get_strings tr('Article') tr('Review') tr('Event') tr('Classified')
......
......@@ -8,45 +8,45 @@
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
require_once ('tiki-setup.php');
require_once('tiki-setup.php');
$rsslib = TikiLib::lib('rss');
$access->check_feature('feature_articles');
if ($prefs['feed_articles'] != 'y') {
$errmsg=tra("rss feed disabled");
require_once ('tiki-rss_error.php');
$errmsg = tra("rss feed disabled");
require_once('tiki-rss_error.php');
}
$res=$access->authorize_rss(array('tiki_p_read_article','tiki_p_admin_cms', 'tiki_p_articles_read_heading'));
$res = $access->authorize_rss(['tiki_p_read_article','tiki_p_admin_cms', 'tiki_p_articles_read_heading']);
if ($res) {
if ($res['header'] == 'y') {
header('WWW-Authenticate: Basic realm="'.$tikidomain.'"');
header('WWW-Authenticate: Basic realm="' . $tikidomain . '"');
header('HTTP/1.0 401 Unauthorized');
}
$errmsg=$res['msg'];
require_once ('tiki-rss_error.php');
$errmsg = $res['msg'];
require_once('tiki-rss_error.php');
}
$feed = "articles";
if (isset($_REQUEST["topic"])) {
$topic = $_REQUEST["topic"];
$uniqueid = $feed.".".$topic;
$topic = (int) preg_replace('/[^0-9]/', '', $topic);
$topic = $_REQUEST["topic"];
$uniqueid = $feed . "." . $topic;
$topic = (int) preg_replace('/[^0-9]/', '', $topic);
} elseif (isset($_REQUEST['topicname'])) {
$artlib = TikiLib::lib('art');
$topic = $artlib->fetchtopicId($_REQUEST['topicname']);
$uniqueid = $feed.".".$topic;
$uniqueid = $feed . "." . $topic;
} else {
$uniqueid = $feed;
$topic = "";
$uniqueid = $feed;
$topic = "";
}
if (isset($_REQUEST["type"])) {
$type = $_REQUEST["type"];
$uniqueid .= '-'.$type;
$type = $_REQUEST["type"];
$uniqueid .= '-' . $type;
} else {
$type = '';
$type = '';
}
if (isset($_REQUEST['lang'])) {
......@@ -55,45 +55,47 @@ if (isset($_REQUEST['lang'])) {
} else {
$articleLang = '';
}
$uniqueid .= '/'.$articleLang;
$uniqueid .= '/' . $articleLang;
$categId = '';
if (isset($_REQUEST["category"])) {
$categlib = TikiLib::lib('categ');
if (is_array($_REQUEST["category"]) ) {
foreach ( $_REQUEST["category"] as $categname ) {
if (is_array($_REQUEST["category"])) {
foreach ($_REQUEST["category"] as $categname) {
$categIds[] = $categlib->get_category_id($categname);
}
sort($categIds);
$categId = array('AND'=>$categIds);
$uniqueid .= '-' . implode('-', $categIds);;
$categId = ['AND' => $categIds];
$uniqueid .= '-' . implode('-', $categIds);
;
} else {
$categId = $categlib->get_category_id($_REQUEST["category"]);
$uniqueid .= '-'.$categId;
$uniqueid .= '-' . $categId;
}
}
// Specifying categories by ID takes precedence, as it is more reliable
if (isset($_REQUEST["categId"])) {
if (is_array($_REQUEST["categId"]) ) {
if (is_array($_REQUEST["categId"])) {
sort($_REQUEST["categId"]);
$categId = (int) $_REQUEST["categId"];
$categId = array('AND'=>$_REQUEST["categId"]);
$uniqueid .= '-' . implode('-', $_REQUEST["categId"]);;
$categId = ['AND' => $_REQUEST["categId"]];
$uniqueid .= '-' . implode('-', $_REQUEST["categId"]);
;
} else {
$categId = (int) $_REQUEST["categId"];
$uniqueid .= '-'.$categId;
$uniqueid .= '-' . $categId;
}
}
if ($topic and !$tikilib->user_has_perm_on_object($user, $topic, 'topic', 'tiki_p_topic_read')) {
if ($topic and ! $tikilib->user_has_perm_on_object($user, $topic, 'topic', 'tiki_p_topic_read')) {
$smarty->assign('errortype', 401);
$errmsg=tra("You do not have permission to view this section");
require_once ('tiki-rss_error.php');
$errmsg = tra("You do not have permission to view this section");
require_once('tiki-rss_error.php');
}
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"]=="EMPTY") {
if ($output["data"] == "EMPTY") {
$title = $prefs['feed_articles_title'];
$desc = $prefs['feed_articles_desc'];
$id = "articleId";
......@@ -103,21 +105,21 @@ if ($output["data"]=="EMPTY") {
$authorId = "author";
$readrepl = "tiki-read_article.php?$id=%s";
$tmp = $prefs['feed__'.$feed.'_title'];
if ($tmp<>'') {
$tmp = $prefs['feed__' . $feed . '_title'];
if ($tmp <> '') {
$title = $tmp;
}
$tmp = $prefs['feed_'.$feed.'_desc'];
if ($desc<>'') {
$tmp = $prefs['feed_' . $feed . '_desc'];
if ($desc <> '') {
$desc = $tmp;
}
$artlib = TikiLib::lib('art');
$changes = $artlib->list_articles(0, $prefs['feed_articles_max'], $dateId.'_desc', '', 0, $tikilib->now, $user, $type, $topic, 'y', '', $categId, '', '', $articleLang, '', '', false, 'y');
$tmp = array();
$changes = $artlib->list_articles(0, $prefs['feed_articles_max'], $dateId . '_desc', '', 0, $tikilib->now, $user, $type, $topic, 'y', '', $categId, '', '', $articleLang, '', '', false, 'y');
$tmp = [];
include_once('tiki-sefurl.php');
foreach ($changes["data"] as $data) {
$data["$descId"] = TikiLib::lib('parser')->parse_data($data[$descId], array('print'=>true));
$data["$descId"] = TikiLib::lib('parser')->parse_data($data[$descId], ['print' => true]);
$data["body"] = null;
$data['sefurl'] = filter_out_sefurl(sprintf($readrepl, $data['articleId']), 'article', $data['title']);
$tmp[] = $data;
......@@ -126,5 +128,5 @@ if ($output["data"]=="EMPTY") {
$tmp = null;
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, $authorId);
}
header("Content-type: ".$output["content-type"]);
header("Content-type: " . $output["content-type"]);
print $output["data"];
......@@ -10,18 +10,18 @@
// This script is used to assign groups to a particular user
// ASSIGN USER TO GROUPS
require_once ('tiki-setup.php');
require_once('tiki-setup.php');
$auto_query_args = array('sort_mode', 'offset', 'find', 'assign_user', 'group', 'maxRecords');
$auto_query_args = ['sort_mode', 'offset', 'find', 'assign_user', 'group', 'maxRecords'];