Commit 12479e43 authored by changi67's avatar changi67

[FIX] Indentation

parent e000a243
......@@ -41,12 +41,10 @@ if ($output["data"]=="EMPTY") {
$descId = "description";
$dateId = "created";
$readrepl = "tiki-directory_redirect.php?$id=%s";
$tmp = $prefs['title_rss_'.$feed];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['desc_rss_'.$feed];
if ($desc<>'') $desc = $tmp;
$tmp = $prefs['title_rss_'.$feed];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['desc_rss_'.$feed];
if ($desc<>'') $desc = $tmp;
$changes = $tikilib->dir_list_all_valid_sites2(0, $prefs['max_rss_directories'], $dateId.'_desc', '');
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, '');
}
......
......@@ -41,11 +41,9 @@ $all = 0;
if ($_REQUEST["parent"] == 0) {
$parent_name = 'Top';
$all = 1;
} else {
$parent_info = $dirlib->dir_get_category($_REQUEST['parent']);
$parent_name = $parent_info['name'];
}
......@@ -54,7 +52,6 @@ $smarty->assign('parent_name', $parent_name);
if (isset($parent_info) && $user) {
if (in_array($parent_info['editorGroup'], $userlib->get_user_groups($user))) {
$tiki_p_autosubmit_link = 'y';
$smarty->assign('tiki_p_autosubmit_link', 'y');
}
}
......@@ -73,7 +70,6 @@ if ($_REQUEST["siteId"]) {
$info = $dirlib->dir_get_site($_REQUEST["siteId"]);
} else {
$info = array();
$info["name"] = '';
$info["description"] = '';
$info["url"] = '';
......@@ -82,7 +78,6 @@ if ($_REQUEST["siteId"]) {
}
$smarty->assign_by_ref('info', $info);
$smarty->assign('save', 'n');
// Replace (add or edit) a site
......@@ -91,7 +86,7 @@ if (isset($_REQUEST["save"])) {
$msg = "";
if (empty($user) && $prefs['feature_antibot'] == 'y' && (!isset($_SESSION['random_number']) || $_SESSION['random_number'] != $_REQUEST['antibotcode'])) {
$msg .= tra("You have mistyped the anti-bot verification code; please try again.");
$msg .= tra("You have mistyped the anti-bot verification code; please try again.");
}
if (empty($_REQUEST["name"])) {
......@@ -133,7 +128,7 @@ if (isset($_REQUEST["save"])) {
}
if ($msg == "") { // no error
$siteId = $dirlib->dir_replace_site($_REQUEST["siteId"], $_REQUEST["name"], $_REQUEST["description"], $_REQUEST["url"],
$_REQUEST["country"], $_REQUEST["isValid"]);
$_REQUEST["country"], $_REQUEST["isValid"]);
$dirlib->remove_site_from_categories($siteId);
foreach ($_REQUEST["siteCats"] as $acat) {
......@@ -207,11 +202,12 @@ $smarty->assign_by_ref('items', $items["data"]);
$categs = $dirlib->dir_get_all_categories_accept_sites(0, -1, 'name asc', $find, $_REQUEST["siteId"]);
if (isset($_REQUEST["save"]) && $msg != "" && isset($_REQUEST["siteCats"])) { // an error occured, the chosen categs have to be set again
$temp_max = sizeof($categs);
foreach ($_REQUEST["siteCats"] as $acat)
foreach ($_REQUEST["siteCats"] as $acat){
for ($ix = 0; $ix < $temp_max ; ++$ix) {
if ($categs[$ix]["categId"] == $acat)
$categs[$ix]["belongs"] = 'y';
}
}
}
$smarty->assign('categs', $categs);
......@@ -228,11 +224,11 @@ $smarty->assign('mid', 'tiki-directory_add_site.tpl');
$smarty->display("tiki.tpl");
function country_sort($a, $b) {
if ($a == 'None' || $b == 'Other') {
return -1;
} elseif ($b == 'None' || $a == 'Other') {
return 1;
} else {
return strcmp($a, $b);
}
if ($a == 'None' || $b == 'Other') {
return -1;
} elseif ($b == 'None' || $a == 'Other') {
return 1;
} else {
return strcmp($a, $b);
}
}
......@@ -5,9 +5,9 @@ require_once('tiki-setup.php');
include_once('lib/directory/dirlib.php');
if($prefs['feature_directory'] != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("error.tpl");
die;
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("error.tpl");
die;
}
// Set parent category to 2 ("tiki sites")
......@@ -27,33 +27,33 @@ $_REQUEST["siteId"]=0;
$smarty->assign('siteId',$_REQUEST["siteId"]);
if (empty($_REQUEST["name"])) {
$smarty->assign('msg',tra("Must enter a name to add a site"));
$smarty->display("error.tpl");
die;
$smarty->assign('msg',tra("Must enter a name to add a site"));
$smarty->display("error.tpl");
die;
}
if (empty($_REQUEST["url"])) {
$smarty->assign('msg',tra("Must enter a url to add a site"));
$smarty->display("error.tpl");
die;
$smarty->assign('msg',tra("Must enter a url to add a site"));
$smarty->display("error.tpl");
die;
}
if ((substr($_REQUEST["url"],0,7)<>'http://') && (substr($_REQUEST["url"],0,8)<>'https://')) {
$_REQUEST["url"]='http://'.$_REQUEST["url"];
$_REQUEST["url"]='http://'.$_REQUEST["url"];
}
if($dirlib->dir_url_exists($_REQUEST['url'])) {
$smarty->assign('msg',tra("URL already added to the directory. Duplicate site?"));
$smarty->display("error.tpl");
die;
$smarty->assign('msg',tra("URL already added to the directory. Duplicate site?"));
$smarty->display("error.tpl");
die;
}
if($prefs['directory_validate_urls'] == 'y') {
@$fsh = fopen($_REQUEST['url'],'r');
if(!$fsh) {
$smarty->assign('msg',tra("URL cannot be accessed: wrong URL or site is offline and cannot be added to the directory"));
$smarty->display("error.tpl");
die;
@$fsh = fopen($_REQUEST['url'],'r');
if(!$fsh) {
$smarty->assign('msg',tra("URL cannot be accessed: wrong URL or site is offline and cannot be added to the directory"));
$smarty->display("error.tpl");
die;
}
}
......
......@@ -13,16 +13,13 @@ include_once ('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
if ($tiki_p_admin_directory
!= 'y' && $tiki_p_admin_directory_sites != 'y' && $tiki_p_admin_directory_cats != 'y' && $tiki_p_validate_links != 'y') {
if ($tiki_p_admin_directory != 'y' && $tiki_p_admin_directory_sites != 'y' && $tiki_p_admin_directory_cats != 'y' && $tiki_p_validate_links != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......
......@@ -34,7 +34,6 @@ if ($_REQUEST["parent"] == 0) {
$parent_name = 'Top';
} else {
$parent_info = $dirlib->dir_get_category($_REQUEST['parent']);
$parent_name = $parent_info['name'];
}
......@@ -56,7 +55,6 @@ if ($_REQUEST["categId"]) {
$info = $dirlib->dir_get_category($_REQUEST["categId"]);
} else {
$info = array();
$info["name"] = '';
$info["childrenType"] = 'c';
$info["viewableChildren"] = 3;
......@@ -69,13 +67,13 @@ $smarty->assign_by_ref('info', $info);
// Remove a category
if (isset($_REQUEST["remove"])) {
$area = 'deldircateg';
if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$area = 'deldircateg';
if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$dirlib->dir_remove_category($_REQUEST["remove"]);
} else {
key_get($area);
}
} else {
key_get($area);
}
}
// Replace (add or edit) a category
......
......@@ -13,7 +13,6 @@ include_once ('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -21,7 +20,6 @@ if ($prefs['feature_directory'] != 'y') {
if ($tiki_p_admin_directory_cats != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......@@ -36,7 +34,6 @@ if ($_REQUEST["parent"] == 0) {
$parent_name = 'Top';
} else {
$parent_info = $dirlib->dir_get_category($_REQUEST['parent']);
$parent_name = $parent_info['name'];
}
......@@ -48,9 +45,9 @@ $smarty->assign_by_ref('path', $path);
// Remove a relationship
if (isset($_REQUEST["remove"])) {
$area = 'deldirrelated';
if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$area = 'deldirrelated';
if ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
$dirlib->dir_remove_related($_REQUEST["parent"], $_REQUEST["categId"]);
} else {
key_get($area);
......@@ -61,7 +58,6 @@ if (isset($_REQUEST["remove"])) {
if (isset($_REQUEST["update"])) {
check_ticket('dir-admin-related');
$dirlib->dir_remove_related($_REQUEST["parent"], $_REQUEST["oldcategId"]);
$dirlib->dir_add_categ_rel($_REQUEST["parent"], $_REQUEST["categId"]);
}
......@@ -69,7 +65,6 @@ if (isset($_REQUEST["update"])) {
if (isset($_REQUEST["add"])) {
check_ticket('dir-admin-related');
$dirlib->dir_add_categ_rel($_REQUEST["parent"], $_REQUEST["categId"]);
if (isset($_REQUEST["mutual"]) && $_REQUEST["mutual"] == 'on') {
$dirlib->dir_add_categ_rel($_REQUEST["categId"], $_REQUEST["parent"]);
}
......
......@@ -13,7 +13,6 @@ include_once('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -27,11 +26,9 @@ $all = 0;
if ($_REQUEST["parent"] == 0) {
$parent_name = 'Top';
$all = 1;
} else {
$parent_info = $dirlib->dir_get_category($_REQUEST['parent']);
$parent_name = $parent_info['name'];
}
......@@ -40,7 +37,6 @@ $smarty->assign('parent_name', $parent_name);
if (isset($parent_info) && $user) {
if (in_array($parent_info['editorGroup'], $userlib->get_user_groups($user))) {
$tiki_p_admin_directory_sites = 'y';
$smarty->assign('tiki_p_admin_directory_sites', 'y');
}
}
......@@ -48,7 +44,6 @@ if (isset($parent_info) && $user) {
if ($tiki_p_admin_directory_sites != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......@@ -69,7 +64,6 @@ if ($_REQUEST["siteId"]) {
$info = $dirlib->dir_get_site($_REQUEST["siteId"]);
} else {
$info = array();
$info["name"] = '';
$info["description"] = '';
$info["url"] = '';
......@@ -102,14 +96,12 @@ if (isset($_REQUEST["save"])) {
check_ticket('dir-admin-sites');
if (empty($_REQUEST["name"])) {
$smarty->assign('msg', tra("Must enter a name to add a site"));
$smarty->display("error.tpl");
die;
}
if (empty($_REQUEST["url"])) {
$smarty->assign('msg', tra("Must enter a url to add a site"));
$smarty->display("error.tpl");
die;
}
......@@ -123,7 +115,6 @@ if (isset($_REQUEST["save"])) {
if (!isset($_REQUEST["siteCats"]) || count($_REQUEST["siteCats"]) == 0) {
$smarty->assign('msg', tra("Must select a category"));
$smarty->display("error.tpl");
die;
}
......@@ -182,7 +173,6 @@ if ($all) {
}
$smarty->assign_by_ref('cant_pages', $items["cant"]);
$smarty->assign_by_ref('items', $items["data"]);
$categs = $dirlib->dir_get_all_categories_accept_sites(0, -1, 'name asc', $find, $_REQUEST["siteId"]);
......
......@@ -14,7 +14,6 @@ include_once('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -22,7 +21,6 @@ if ($prefs['feature_directory'] != 'y') {
if ($tiki_p_view_directory != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......@@ -36,7 +34,6 @@ $all = 0;
if ($_REQUEST["parent"] == 0) {
$parent_name = 'Top';
$all = 1;
} else {
$parent_info = $dirlib->dir_get_category($_REQUEST['parent']);
......@@ -74,10 +71,7 @@ for ($i = 0; $i < $temp_max; $i++) {
if ($categs['data'][$i]['childrenType'] == 'c' && $categs['data'][$i]['viewableChildren'] > 0) {
// Generate the subcategories with most hist as the subcategories to show.
$subcats
= $dirlib->dir_list_categories($categs['data'][$i]['categId'], 0, $categs['data'][$i]['viewableChildren'], 'hits_desc',
'');
$subcats = $dirlib->dir_list_categories($categs['data'][$i]['categId'], 0, $categs['data'][$i]['viewableChildren'], 'hits_desc', '');
$categs['data'][$i]['subcats'] = $subcats['data'];
}
......@@ -87,8 +81,7 @@ for ($i = 0; $i < $temp_max; $i++) {
}
if ($categs['data'][$i]['childrenType'] == 'r' && $categs['data'][$i]['viewableChildren'] > 0) {
$categs['data'][$i]['subcats']
= $dirlib->get_random_subcats($categs['data'][$i]['categId'], $categs['data'][$i]['viewableChildren']);
$categs['data'][$i]['subcats'] = $dirlib->get_random_subcats($categs['data'][$i]['categId'], $categs['data'][$i]['viewableChildren']);
}
}
......@@ -102,7 +95,6 @@ $smarty->assign_by_ref('categ_info', $categ_info);
if ($user) {
if (in_array($categ_info['editorGroup'], $userlib->get_user_groups($user))) {
$tiki_p_admin_directory_sites = 'y';
$smarty->assign('tiki_p_admin_directory_sites', 'y');
}
}
......@@ -131,9 +123,7 @@ if ($categ_info['allowSites'] == 'y') {
$smarty->assign('find', $find);
$items = $dirlib->dir_list_sites($_REQUEST['parent'], $offset, $prefs['directory_links_per_page'], $sort_mode, '', 'y');
$smarty->assign_by_ref('cant_pages', $items["cant"]);
$smarty->assign_by_ref('items', $items["data"]);
}
......
......@@ -14,7 +14,6 @@ include_once ('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -22,7 +21,6 @@ if ($prefs['feature_directory'] != 'y') {
if ($tiki_p_view_directory != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......
......@@ -13,7 +13,6 @@ include_once ('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -21,14 +20,12 @@ if ($prefs['feature_directory'] != 'y') {
if ($tiki_p_view_directory != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
if (!isset($_REQUEST['siteId'])) {
$smarty->assign('msg', tra("No site indicated"));
$smarty->display("error.tpl");
die;
}
......
......@@ -5,30 +5,30 @@
// 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.
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once('tiki-setup.php');
require_once('lib/tikilib.php');
require_once('lib/directory/dirlib.php');
require_once ('lib/rss/rsslib.php');
require_once('lib/rss/rsslib.php');
if ($prefs['rss_directories'] != 'y') {
$errmsg=tra("rss feed disabled");
require_once ('tiki-rss_error.php');
require_once('tiki-rss_error.php');
}
if ($prefs['feature_directory'] != 'y') {
$errmsg=tra("This feature is disabled").": feature_directory";
require_once ('tiki-rss_error.php');
require_once('tiki-rss_error.php');
}
if ($tiki_p_view_directory != 'y') {
$smarty->assign('errortype', 401);
$errmsg=tra("Permission denied");
require_once ('tiki-rss_error.php');
require_once('tiki-rss_error.php');
}
if (!isset($_REQUEST["parent"])) {
$errmsg=tra("No parent specified");
require_once ('tiki-rss_error.php');
$errmsg=tra("No parent specified");
require_once('tiki-rss_error.php');
}
$feed = "directory";
......@@ -44,12 +44,10 @@ if ($output["data"]=="EMPTY") {
$descId = "description";
$dateId = "created";
$readrepl = "tiki-directory_redirect.php?$id=%s";
$tmp = $prefs['title_rss_'.$feed];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['desc_rss_'.$feed];
if ($desc<>'') $desc = $tmp;
$tmp = $prefs['title_rss_'.$feed];
if ($tmp<>'') $title = $tmp;
$tmp = $prefs['desc_rss_'.$feed];
if ($desc<>'') $desc = $tmp;
$changes = $dirlib->dir_list_sites($_REQUEST["parent"], 0, $prefs['max_rss_directories'], $dateId.'_desc', '', 'y');
$output = $rsslib->generate_feed($feed, $uniqueid, '', $changes, $readrepl, '', $id, $title, $titleId, $desc, $descId, $dateId, '');
}
......
......@@ -14,7 +14,6 @@ include_once ('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -22,7 +21,6 @@ if ($prefs['feature_directory'] != 'y') {
if ($tiki_p_view_directory != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......@@ -60,7 +58,6 @@ if ($_REQUEST['where'] == 'all') {
}
$smarty->assign_by_ref('cant_pages', $items["cant"]);
$smarty->assign_by_ref('items', $items["data"]);
include_once ('tiki-section_options.php');
......
......@@ -13,7 +13,6 @@ include_once ('lib/directory/dirlib.php');
if ($prefs['feature_directory'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_directory");
$smarty->display("error.tpl");
die;
}
......@@ -21,7 +20,6 @@ if ($prefs['feature_directory'] != 'y') {
if ($tiki_p_validate_links != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied"));
$smarty->display("error.tpl");
die;
}
......@@ -34,9 +32,9 @@ if (isset($_REQUEST["validate"]) && isset($_REQUEST['sites'])) {
}
if (isset($_REQUEST["remove"])) {
$area = 'deldirvalidate';
if ($prefs['feature_ticketlib2'] != 'y' or ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"])))) {
key_check($area);
$area = 'deldirvalidate';
if ($prefs['feature_ticketlib2'] != 'y' or ($prefs['feature_ticketlib2'] != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"])))) {
key_check($area);
$dirlib->dir_remove_site($_REQUEST["remove"]);
} else {
key_get($area);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment