Commit 1c90fa2b authored by sept_7's avatar sept_7

[FIX] coding style no function in for loop statements, PHPCS errors

parent a8e2603c
......@@ -15,8 +15,8 @@ if (strpos($_SERVER['SCRIPT_NAME'],basename(__FILE__)) !== FALSE) {
require_once 'lib/setup/third_party.php';
require_once (defined('SMARTY_DIR') ? SMARTY_DIR : 'lib/smarty/libs/') . 'Smarty.class.php';
class Smarty_Tikiwiki extends Smarty {
class Smarty_Tikiwiki extends Smarty
{
function Smarty_Tikiwiki($tikidomain = '') {
parent::Smarty();
if ($tikidomain) { $tikidomain.= '/'; }
......
......@@ -44,30 +44,30 @@ $confs = $logslib->get_all_actionlog_conf();
$nbViewedConfs = 0;
if ($tiki_p_admin == 'y') {
if (isset($_REQUEST['save'])) {
for ($i = 0; $i < sizeof($confs); ++$i) {
if (isset($_REQUEST['v_' . $confs[$i]['code']]) && $_REQUEST['v_' . $confs[$i]['code']] == 'on') { //viewed and reported
$logslib->set_actionlog_conf($confs[$i]['action'], $confs[$i]['objectType'], 'v');
$confs[$i]['status'] = 'v';
} elseif (isset($_REQUEST[$confs[$i]['code']]) && $_REQUEST[$confs[$i]['code']] == 'on') {
$logslib->set_actionlog_conf($confs[$i]['action'], $confs[$i]['objectType'], 'y');
$confs[$i]['status'] = 'y';
foreach($confs as $index => $conf) {
if (isset($_REQUEST['v_' . $conf['code']]) && $_REQUEST['v_' . $conf['code']] == 'on') { //viewed and reported
$logslib->set_actionlog_conf($conf['action'], $conf['objectType'], 'v');
$confs[$index]['status'] = 'v';
} elseif (isset($_REQUEST[$conf['code']]) && $_REQUEST[$conf['code']] == 'on') {
$logslib->set_actionlog_conf($conf['action'], $conf['objectType'], 'y');
$confs[$index]['status'] = 'y';
} else {
$logslib->set_actionlog_conf($confs[$i]['action'], $confs[$i]['objectType'], 'n');
$confs[$i]['status'] = 'n';
$logslib->set_actionlog_conf($conf['action'], $conf['objectType'], 'n');
$confs[$index]['status'] = 'n';
}
}
}
} else {
if (isset($_REQUEST['save'])) {
$_prefs = 'v';
for ($i = 0; $i < sizeof($confs); ++$i) {
if ($confs[$i]['status'] == 'v' || $confs[$i]['status'] == 'y') { // can only change what is recorded
if (isset($_REQUEST['v_' . $confs[$i]['code']]) && $_REQUEST['v_' . $confs[$i]['code']] == 'on') { //viewed
$_prefs.= $confs[$i]['id'] . 'v';
$confs[$i]['status'] = 'v';
foreach($confs as $index => $conf) {
if ($conf['status'] == 'v' || $conf['status'] == 'y') { // can only change what is recorded
if (isset($_REQUEST['v_' . $conf['code']]) && $_REQUEST['v_' . $conf['code']] == 'on') { //viewed
$_prefs.= $conf['id'] . 'v';
$confs[$index]['status'] = 'v';
} else {
$_prefs.= $confs[$i]['id'] . 'y';
$confs[$i]['status'] = 'y';
$_prefs.= $conf['id'] . 'y';
$confs[$index]['status'] = 'y';
}
}
}
......
......@@ -193,8 +193,8 @@ if ($prefs['feature_freetags'] == 'y' && ($prefs['wikiapproval_update_freetags']
$tags = $freetaglib->get_tags_on_object($staging_page, 'wiki page');
$taglist = '';
for ($i=0; $i<sizeof($tags['data']); $i++) {
$taglist .= $tags['data'][$i]['tag'] . ' ';
foreach( $tags['data'] as $t) {
$taglist .= $t['tag'] . ' ';
}
$freetaglib->update_tags($user, $page, 'wiki page', $taglist);
......
......@@ -246,12 +246,12 @@ global $objectlib;
if ($prefs['feature_categories'] == 'y') {
$type = 'image';
$arr = array();
for ($i = 0; $i <= count($images['data']) - 1; $i++) {
$img_id = $images['data'][$i]['imageId'];
foreach( $images['data'] as $index => $imgd ) {
$img_id = $imgd['imageId'];
$arr = $categlib->get_object_categories($type, $img_id);
//adding categories to the object
for ($k = 0; $k <= count($arr) - 1; $k++) {
$images['data'][$i]['categories'][$k] = $categlib->get_category_name($arr[$k]);
foreach( $arr as $cat_name ) {
$images['data'][$index]['categories'][] = $categlib->get_category_name($cat_name);
}
}
}
......
......@@ -56,9 +56,9 @@ $arrscales = $imagegallib->get_gallery_scale_info($galleryId);
// adjust scale size to existing ones
if ($scalesize && !$prefs['preset_galleries_info'] == 'y') {
$testscale = 0;
for ($iscale = 0; $iscale < count($arrscales); $iscale++) {
if ($scalesize <= $arrscales[$iscale]['scale']) {
$testscale = $arrscales[$iscale]['scale'];
foreach( $arrscales as $arrscale ) {
if ($scalesize <= $arrscale['scale']) {
$testscale = $arrscale['scale'];
break;
}
}
......@@ -165,16 +165,16 @@ $resultscale = $scalesize < $maxsize ? $scalesize : 0;
$scaleinfo['nextscale'] = 0;
$scaleinfo['prevscale'] = 0;
$testscale = $resultscale ? $resultscale : $maxsize;
for ($iscale = 0; $iscale < count($arrscales); $iscale++) {
if ($testscale == $arrscales[$iscale]['scale']) {
foreach($arrscales as $arrscale) {
if ($testscale == $arrscale['scale']) {
continue;
}
if ($testscale > $arrscales[$iscale]['scale']) {
$scaleinfo['prevscale'] = $arrscales[$iscale]['scale'];
if ($testscale > $arrscale['scale']) {
$scaleinfo['prevscale'] = $arrscale['scale'];
continue;
}
if ($maxsize > $arrscales[$iscale]['scale']) {
$scaleinfo['nextscale'] = $arrscales[$iscale]['scale'];
if ($maxsize > $arrscale['scale']) {
$scaleinfo['nextscale'] = $arrscale['scale'];
}
break;
}
......
......@@ -69,24 +69,24 @@ if (is_array($calendarIds) && (count($calendarIds) > 0) && $_REQUEST["export"]==
$cal = $iCal->getSkeletonCalendar();
foreach ($events as $day=>$day_data) {
for ($i=0; $i < count($day_data); $i++) {
foreach( $day_data as $dd) {
$ea=array();
$ea["Summary"]=$day_data[$i]["result"]["name"];
$ea["dateStart"]=$day_data[$i]["result"]["start"];
$ea["dateEnd"]=$day_data[$i]["result"]["end"];
$ea["Description"]=preg_replace("/\n/","\\n",$day_data[$i]["result"]["description"]);
if ($day_data[$i]["result"]["participants"]) {
$ea["Attendees"]=$day_data[$i]["result"]["participants"];
$ea["Summary"]=$dd["result"]["name"];
$ea["dateStart"]=$dd["result"]["start"];
$ea["dateEnd"]=$dd["result"]["end"];
$ea["Description"]=preg_replace("/\n/","\\n",$dd["result"]["description"]);
if ($dd["result"]["participants"]) {
$ea["Attendees"]=$dd["result"]["participants"];
}
$ea["LastModified"]=$day_data[$i]["result"]["lastModif"];
$ea["LastModified"]=$dd["result"]["lastModif"];
// Second character of duration value must be a 'P' ??
$ea["Duration"]=($day_data[$i]["result"]["end"] - $day_data[$i]["result"]["start"]);
$ea["Contact"]=array($day_data[$i]["result"]["user"]);
$ea["organizer"]=array($day_data[$i]["result"]["organizers"]);
$ea["URL"]=$day_data[$i]["result"]["url"];
$ea["DateStamp"]=$day_data[$i]["result"]["created"];
//$ea["RequestStatus"]=$day_data[$i]["result"]["status"];
$ea["UID"]="tiki-".$day_data[$i]["result"]["calendarId"]."-".$day_data[$i]["result"]["calitemId"];
$ea["Duration"]=($dd["result"]["end"] - $dd["result"]["start"]);
$ea["Contact"]=array($dd["result"]["user"]);
$ea["organizer"]=array($dd["result"]["organizers"]);
$ea["URL"]=$dd["result"]["url"];
$ea["DateStamp"]=$dd["result"]["created"];
//$ea["RequestStatus"]=$dd["result"]["status"];
$ea["UID"]="tiki-".$dd["result"]["calendarId"]."-".$dd["result"]["calitemId"];
$c = $iCal->factory("Event",$ea);
$cal->addEvent($c);
}
......
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