Commit c1b0951e authored by changi67's avatar changi67

[MOD] access check: deploy some accesslib check functions. + Replace split by...

[MOD] access check: deploy some accesslib check functions. + Replace split by explode where no pattern is needed
parent 4d8228b8
......@@ -22,7 +22,7 @@ if ($prefs['feature_categories'] == 'y' && $catobjperms->modify_object_categorie
$smarty->assign('cat_categorize', 'n');
if (isset($_REQUEST['import']) and isset($_REQUEST['categories'])) {
$_REQUEST["cat_categories"] = split(',',$_REQUEST['categories']);
$_REQUEST["cat_categories"] = explode(',',$_REQUEST['categories']);
$_REQUEST["cat_categorize"] = 'on';
}
......
......@@ -309,7 +309,7 @@ if ( $script_mode ) {
$_REQUEST = array();
for ( $k = 1 ; $k < $_SERVER['argc'] ; $k++ ) {
list($key, $value) = split('=', $_SERVER['argv'][$k], 2);
list($key, $value) = explode('=', $_SERVER['argv'][$k], 2);
$_REQUEST[$key] = $value ? $value : 'y';
}
......
......@@ -334,7 +334,7 @@ if (isset($_REQUEST['list']) || isset($_REQUEST['export']) || isset($_REQUEST['g
}
}
if (isset($_REQUEST['sort_mode'])) {
list($col, $order) = split('_', $_REQUEST['sort_mode']);
list($col, $order) = explode('_', $_REQUEST['sort_mode']);
$sort = array();
foreach($actions as $a) {
$sort[] = isset($a[$col]) ? $a[$col] : '';
......
......@@ -75,7 +75,7 @@ else $addEmail = "n";
if (isset($_REQUEST["add"]) && isset($_REQUEST["email"]) && $_REQUEST["email"] != "") {
check_ticket('admin-nl-subsriptions');
if (strpos($_REQUEST["email"], ',')) {
$emails = split(',', $_REQUEST["email"]);
$emails = explode(',', $_REQUEST["email"]);
foreach($emails as $e) {
if ($userlib->user_exists(trim($e))) {
$nllib->newsletter_subscribe($_REQUEST["nlId"], trim($e) , "y", $confirmEmail, $addEmail);
......
......@@ -267,7 +267,7 @@ if (isset($_REQUEST["save"])) {
}
if (isset($_REQUEST['ui'])) {
if (!is_array($_REQUEST['ui'])) {
$_REQUEST['ui'] = split(',', $_REQUEST['ui']);
$_REQUEST['ui'] = explode(',', $_REQUEST['ui']);
}
$showlist = array();
$popupinfo = array();
......@@ -449,7 +449,7 @@ $smarty->assign_by_ref('info', $info);
$outatt = array();
$info["orderPopup"] = '';
if (strstr($info["orderAttachments"], '|')) {
$part = split("\|", $info["orderAttachments"]);
$part = explode('|', $info["orderAttachments"]);
$info["orderAttachments"] = $part[0];
$info["orderPopup"] = $part[1];
}
......
......@@ -99,7 +99,7 @@ if (empty($_REQUEST['tsort_mode'])) {
}
$most_popular_tags = $freetaglib->get_most_popular_tags('', 0, $maxPopular, $tsort_mode);
if (!empty($prefs['freetags_cloud_colors'])) {
$colors = split(',', $prefs['freetags_cloud_colors']);
$colors = explode(',', $prefs['freetags_cloud_colors']);
$prev = '';
foreach($most_popular_tags as $id => $tag) {
if (count($colors) == 1) {
......
......@@ -170,7 +170,7 @@ $errors = array();
if (empty($_REQUEST['emails']) || $prefs['feature_cms_emails'] != 'y')
$emails = '';
elseif (!empty($_REQUEST['emails'])) {
$emails = split(',', $_REQUEST['emails']);
$emails = explode(',', $_REQUEST['emails']);
foreach ($emails as $email) {
if (!validate_email($email, $prefs['validateEmail']))
$errors[] = tra('Invalid email:').' '.$email;
......
......@@ -647,7 +647,7 @@ if ((isset($_REQUEST["template_name"]) || isset($_REQUEST["templateId"])) && !is
}
if (isset($_REQUEST["categId"]) && $_REQUEST["categId"] > 0) {
$categs = split("\+",$_REQUEST["categId"]);
$categs = explode('+',$_REQUEST["categId"]);
$smarty->assign('categIds',$categs);
$smarty->assign('categIdstr',$_REQUEST["categId"]);
} else {
......@@ -882,9 +882,9 @@ function parse_output(&$obj, &$parts,$i) {
}elseif( $obj['type'] == 'application/x-tikiwiki' ) {
$aux["body"] = $obj['body'];
$ccc=$obj['header']["content-type"];
$items = split(';',$ccc);
$items = explode(';',$ccc);
foreach($items as $item) {
$portions = split('=',$item);
$portions = explode('=',$item);
if(isset($portions[0])&&isset($portions[1])) {
$aux[trim($portions[0])]=trim($portions[1]);
}
......
......@@ -8,12 +8,7 @@
@ini_set('max_execution_time', 0); //will not work in safe_mode is on
require_once('tiki-setup.php');
if ($prefs['feature_trackers'] != 'y') {
$smarty->assign('msg', tra('This feature is disabled').': feature_trackers');
$smarty->display('error.tpl');
die;
}
$access->check_feature('feature_trackers');
if (!isset($_REQUEST['trackerId'])) {
$smarty->assign('msg', tra('No tracker indicated'));
$smarty->display('error.tpl');
......@@ -211,4 +206,4 @@ while (($items = $trklib->list_items($_REQUEST['trackerId'], $offset, $maxRecord
if (!empty($fp)) {
fclose($fp);
}
die;
\ No newline at end of file
die;
......@@ -8,17 +8,9 @@
@ini_set('max_execution_time', 0); //will not work if safe_mode is on
require_once('tiki-setup.php');
$access->check_feature('feature_trackers');
$access->check_feature('feature_ajax');
if ($prefs['feature_trackers'] != 'y') {
$smarty->assign('msg', tra('This feature is disabled').': feature_trackers');
$smarty->display('error.tpl');
die;
}
if ($prefs['feature_ajax'] != 'y') {
$smarty->assign('msg', tra('This feature is disabled').': feature_ajax');
$smarty->display('error.tpl');
die;
}
if (!isset($_REQUEST['trackerId'])) {
$smarty->assign('msg', tra('No tracker indicated'));
$smarty->display('error.tpl');
......
......@@ -13,13 +13,7 @@ require_once ('tiki-setup.php');
global $imagegallib; include_once ("lib/imagegals/imagegallib.php");
global $categlib; include_once ('lib/categories/categlib.php');
include_once ('lib/map/usermap.php');
if ($prefs['feature_galleries'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_galleries");
$smarty->display("error.tpl");
die;
}
$access->check_feature('feature_galleries');
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
......@@ -252,7 +246,7 @@ if (isset($_REQUEST["edit"]) && $prefs['feature_categories'] == 'y' && $prefs['f
#add scales
if (isset($_REQUEST["scaleSize"])) {
if (strstr($_REQUEST["scaleSize"],',')) {
$sc = split(',',$_REQUEST["scaleSize"]);
$sc = explode(',',$_REQUEST["scaleSize"]);
foreach ($sc as $thisc) {
$thisc = trim($thisc);
if (is_numeric($thisc)) {
......
<?php
include 'tiki-setup.php';
include_once ('lib/trackers/trackerlib.php');
if ($prefs['feature_gmap'] != 'y') {
$smarty->assign('msg', tra('This feature is disabled').": feature_gmap");
$smarty->display("error.tpl");
die;
}
$access->check_feature('feature_gmap');
$auto_query_args = array('for', 'itemId', 'fieldId', 'trackerId', 'view_user');
if ($tiki_p_admin == 'y' and isset($_REQUEST['view_user']) and $userlib->user_exists($_REQUEST['view_user'])) {
......@@ -65,7 +60,7 @@ if (isset($_REQUEST['set_default']) && ($user == $userwatch || $tiki_p_admin =='
}
}
}
$xyz = split(',', $trklib->get_item_value($_REQUEST['trackerId'],$_REQUEST['itemId'],$_REQUEST['fieldId']));
$xyz = explode(',', $trklib->get_item_value($_REQUEST['trackerId'],$_REQUEST['itemId'],$_REQUEST['fieldId']));
$pointx = $xyz['0'];
$pointy = $xyz['1'];
$pointz = $xyz['2'];
......
......@@ -54,7 +54,7 @@ for ($index = 0, $count_arrayTrackerId = count($arrayTrackerId); $index < $count
$listfields[$fid]['type'] = $xfields["data"][$dfid]["type"];
$listfields[$fid]['name'] = $xfields["data"][$dfid]["name"];
$listfields[$fid]['options'] = $xfields["data"][$dfid]["options"];
$listfields[$fid]['options_array'] = split(',', $xfields["data"][$dfid]["options"]);
$listfields[$fid]['options_array'] = explode(',', $xfields["data"][$dfid]["options"]);
$listfields[$fid]['isMain'] = $xfields["data"][$dfid]["isMain"];
$listfields[$fid]['isTblVisible'] = $xfields["data"][$dfid]["isTblVisible"];
$listfields[$fid]['isHidden'] = $xfields["data"][$dfid]["isHidden"];
......
......@@ -626,7 +626,7 @@ if ($my and $writerfield) {
$smarty->assign('filtervalue', $filtervalue);
$smarty->assign('status', $_REQUEST["status"]);
if (isset($_REQUEST["trackerId"])) $trackerId = $_REQUEST["trackerId"];
if (isset($tracker_info['useRatings']) and $tracker_info['useRatings'] == 'y' and $user and $tiki_p_tracker_vote_ratings == 'y' and !empty($_REQUEST['trackerId']) and !empty($ratedItemId) and isset($newItemRate) and ($newItemRate == 'NULL' || in_array($newItemRate, split(',', $tracker_info['ratingOptions'])))) {
if (isset($tracker_info['useRatings']) and $tracker_info['useRatings'] == 'y' and $user and $tiki_p_tracker_vote_ratings == 'y' and !empty($_REQUEST['trackerId']) and !empty($ratedItemId) and isset($newItemRate) and ($newItemRate == 'NULL' || in_array($newItemRate, explode(',', $tracker_info['ratingOptions'])))) {
$trklib->replace_rating($_REQUEST['trackerId'], $ratedItemId, $newItemRateField, $user, $newItemRate);
}
$items = $trklib->list_items($_REQUEST["trackerId"], $offset, $maxRecords, $sort_mode, $listfields, $filterfield, $filtervalue, $_REQUEST["status"], $initial, $exactvalue,'', $xfields);
......
......@@ -249,7 +249,7 @@ if (isset($_REQUEST['reloff'])) {
$cant = 0;
$listfields = array();
if (substr($sort_mode, 0, 2) == 'f_') { //look at the field in case the field needs some processing to find the sort
list($a, $i, $o) = split('_', $sort_mode);
list($a, $i, $o) = explode('_', $sort_mode);
foreach($xfields['data'] as $f) {
if ($f['fieldId'] == $i) {
$listfields = array(
......@@ -734,7 +734,7 @@ if ($_REQUEST["itemId"]) {
}
} elseif ($fields["data"][$i]["type"] == 'l') {
if (isset($fields["data"][$i]["options_array"][3])) {
$l = split(':', $fields["data"][$i]["options_array"][1]);
$l = explode(':', $fields["data"][$i]["options_array"][1]);
$finalFields = explode('|', $fields['data'][$i]['options_array'][3]);
$ins_fields["data"][$i]['links'] = $trklib->get_join_values($_REQUEST['trackerId'], $_REQUEST['itemId'], array_merge(array(
$fields["data"][$i]["options_array"][2]
......@@ -878,7 +878,7 @@ if ($_REQUEST["itemId"]) {
if ($fields['data'][$i]['type'] == 'M') {
global $filegallib, $prefs;
if ($prefs['URLAppend'] == '') {
list($val1, $val2) = split('=', $ins_fields["data"][$i]["value"]);
list($val1, $val2) = explode('=', $ins_fields["data"][$i]["value"]);
} else {
$val2 = $ins_fields["data"][$i]["value"];
}
......@@ -1113,7 +1113,7 @@ if ($tracker_info["useAttachments"] == 'y') {
if (strstr($tracker_info["orderAttachments"], '|')) {
$attextra = 'y';
}
$attfields = split(',', strtok($tracker_info["orderAttachments"], '|'));
$attfields = explode(',', strtok($tracker_info["orderAttachments"], '|'));
$atts = $trklib->list_item_attachments($_REQUEST["itemId"], 0, -1, 'comment_asc', '');
$smarty->assign('atts', $atts["data"]);
$smarty->assign('attCount', $atts["cant"]);
......
......@@ -182,7 +182,7 @@ if ($_REQUEST['locSection'] == 'read') {
$to_addresses = $aux['from'];
// Get email addresses from the 'from' portion
$to_addresses = split(',', $to_addresses);
$to_addresses = explode(',', $to_addresses);
$temp_max = count($to_addresses);
for ($i = 0; $i < $temp_max; $i++) {
......@@ -204,7 +204,7 @@ if ($_REQUEST['locSection'] == 'read') {
$cc_addresses .= ',';
$cc_addresses .= $aux['to'];
$cc_addresses = split(',', $cc_addresses);
$cc_addresses = explode(',', $cc_addresses);
$temp_max = count($cc_addresses);
for ($i = 0; $i < $temp_max; $i++) {
......
......@@ -219,7 +219,7 @@ function takeGroupMail($destDiv = 'mod-webmail_inbox', $msgId) {
$ext = $contactlib->get_ext_by_name($user, tra('Wiki Page'), $contId);
}
$arr = split(" ", trim(html_entity_decode($m['sender']['name']), '"\' '), 2);
$arr = explode(" ", trim(html_entity_decode($m['sender']['name']), '"\' '), 2);
if (count($arr) < 2) {
$arr[] = '';
}
......
......@@ -38,8 +38,8 @@ $output = Mail_mimeDecode::decode($params);
$part = $output->parts[$_REQUEST["getpart"]];
$type = $part->headers["content-type"];
$content = $part->body;
$names = split(';', $part->headers["content-disposition"]);
$names = split('=', $names[1]);
$names = explode(';', $part->headers["content-disposition"]);
$names = explode('=', $names[1]);
$file = $names[1];
header ("Content-type: $type");
......
......@@ -27,7 +27,7 @@ if (!isset($_REQUEST["limit"])) {
if (isset($_REQUEST["categId"]) && $_REQUEST["categId"] > 0) {
$smarty->assign('categIdstr', $_REQUEST["categId"]);
$categs = split(",",$_REQUEST["categId"]);
$categs = explode(",",$_REQUEST["categId"]);
} else {
$categs = array();
}
......
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