]> git.mxchange.org Git - friendica.git/commitdiff
Please use x() correctly:
authorRoland Haeder <roland@mxchange.org>
Thu, 30 Mar 2017 19:36:34 +0000 (21:36 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 30 Mar 2017 19:37:08 +0000 (21:37 +0200)
<?php
if (x($someArray, 'element')) {
// Do something
}
?>

Signed-off-by: Roland Haeder <roland@mxchange.org>
mod/admin.php
mod/network.php
view/theme/vier/theme.php

index b1bc8de5f20393b8c707cc549196b950f28a14ac..79fcebf47be52f072a24e157a28eed04c2393fb9 100644 (file)
@@ -2017,22 +2017,22 @@ function admin_page_features_post(App $a) {
        $features = get_features(false);
 
        foreach ($features as $fname => $fdata) {
-               foreach (array_slice($fdata,1) as $f) {
+               foreach (array_slice($fdata, 1) as $f) {
                        $feature = $f[0];
-                       $feature_state = 'feature_'.$feature;
-                       $featurelock = 'featurelock_'.$feature;
+                       $feature_state = 'feature_' . $feature;
+                       $featurelock = 'featurelock_' . $feature;
 
-                       if (x($_POST[$feature_state])) {
-                               $val = intval($_POST['feature_'.$feature]);
+                       if (x($_POST, $feature_state)) {
+                               $val = intval($_POST[$feature_state]);
                        } else {
                                $val = 0;
                        }
                        set_config('feature',$feature,$val);
 
-                       if (x($_POST[$featurelock])) {
-                               set_config('feature_lock',$feature,$val);
+                       if (x($_POST, $featurelock)) {
+                               set_config('feature_lock', $feature, $val);
                        } else {
-                               del_config('feature_lock',$feature);
+                               del_config('feature_lock', $feature);
                        }
                }
        }
index a1181a74cb3a295777c42e54d5262c8630aa00f1..d2c77f19d8694f8f36518a53937c57299130ec11 100644 (file)
@@ -6,7 +6,7 @@ function network_init(App $a) {
        }
 
        $is_a_date_query = false;
-       if (x($_GET['cid']) && intval($_GET['cid']) != 0) {
+       if (x($_GET, 'cid') && intval($_GET['cid']) != 0) {
                $cid = $_GET['cid'];
        }
 
@@ -103,24 +103,27 @@ function network_init(App $a) {
                }
        }
 
-       if(x($_GET['nets']) && $_GET['nets'] === 'all')
+       // If nets is set to all, unset it
+       if (x($_GET, 'nets') && $_GET['nets'] === 'all') {
                unset($_GET['nets']);
+       }
 
        $group_id = (($a->argc > 1 && is_numeric($a->argv[1])) ? intval($a->argv[1]) : 0);
 
        set_pconfig(local_user(), 'network.view', 'group.selected', $group_id);
 
-       require_once('include/group.php');
-       require_once('include/contact_widgets.php');
-       require_once('include/items.php');
-       require_once('include/ForumManager.php');
+       require_once 'include/group.php';
+       require_once 'include/contact_widgets.php';
+       require_once 'include/items.php';
+       require_once 'include/ForumManager.php';
 
-       if(! x($a->page,'aside'))
+       if (! x($a->page, 'aside')) {
                $a->page['aside'] = '';
+       }
 
-       $search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
+       $search = ((x($_GET, 'search')) ? escape_tags($_GET['search']) : '');
 
-       if(x($_GET,'save')) {
+       if (x($_GET, 'save')) {
                $r = qu("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
                        intval(local_user()),
                        dbesc($search)
@@ -132,7 +135,7 @@ function network_init(App $a) {
                        );
                }
        }
-       if(x($_GET,'remove')) {
+       if (x($_GET, 'remove')) {
                q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s'",
                        intval(local_user()),
                        dbesc($search)
@@ -140,7 +143,7 @@ function network_init(App $a) {
        }
 
        // search terms header
-       if(x($_GET,'search')) {
+       if (x($_GET, 'search')) {
                $a->page['content'] .= replace_macros(get_markup_template("section_title.tpl"),array(
                        '$title' => sprintf( t('Results for: %s'), $search)
                ));
@@ -157,8 +160,9 @@ function network_init(App $a) {
 
 function saved_searches($search) {
 
-       if(! feature_enabled(local_user(),'savedsearch'))
+       if (! feature_enabled(local_user(),'savedsearch')) {
                return '';
+       }
 
        $a = get_app();
 
index a35afa719bd5cd3207cef574f26ab8a756147c59..50e8cd377b8923753425f0bc1b642eefba49026d 100644 (file)
@@ -213,8 +213,9 @@ function vier_community_info() {
 
                require_once('include/ForumManager.php');
 
-               if (x($_GET['cid']) && intval($_GET['cid']) != 0)
+               if (x($_GET, 'cid') && intval($_GET['cid']) != 0) {
                        $cid = $_GET['cid'];
+               }
 
                //sort by last updated item
                $lastitem = true;
@@ -227,18 +228,18 @@ function vier_community_info() {
 
                        $id = 0;
 
-                       foreach($contacts as $contact) {
+                       foreach ($contacts as $contact) {
 
                                $selected = (($cid == $contact['id']) ? ' forum-selected' : '');
 
                                $entry = array(
-                                       'url' => 'network?f=&cid=' . $contact['id'],
+                                       'url'          => 'network?f=&cid=' . $contact['id'],
                                        'external_url' => 'redir/' . $contact['id'],
-                                       'name' => $contact['name'],
-                                       'cid' => $contact['id'],
-                                       'selected'      => $selected,
-                                       'micro' => App::remove_baseurl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)),
-                                       'id' => ++$id,
+                                       'name'         => $contact['name'],
+                                       'cid'          => $contact['id'],
+                                       'selected'     => $selected,
+                                       'micro'        => App::remove_baseurl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)),
+                                       'id'           => ++$id,
                                );
                                $entries[] = $entry;
                        }
@@ -247,12 +248,12 @@ function vier_community_info() {
                        $tpl = get_markup_template('widget_forumlist_right.tpl');
 
                        $page .= replace_macros($tpl,array(
-                               '$title'        => t('Forums'),
-                               '$forums'       => $entries,
-                               '$link_desc'    => t('External link to forum'),
-                               '$total'        => $total,
+                               '$title'          => t('Forums'),
+                               '$forums'         => $entries,
+                               '$link_desc'      => t('External link to forum'),
+                               '$total'          => $total,
                                '$visible_forums' => $visible_forums,
-                               '$showmore'     => t('show more'),
+                               '$showmore'       => t('show more'),
                        ));
 
                        $aside['$page'] = $page;