GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 2.9 ( f9b502...496820 )
by Thorsten
13:17
created
phpmyfaq/admin/ajax.category.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         if (empty($ajaxData['categories'])) {
51 51
             $categories = array(-1); // Access for all users and groups
52 52
         } else {
53
-            $categories = explode(',', (int) $ajaxData['categories']);
53
+            $categories = explode(',', (int)$ajaxData['categories']);
54 54
         }
55 55
 
56 56
         echo json_encode(
Please login to merge, or discard this patch.
phpmyfaq/admin/ajax.group.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         foreach ($userList as $single_user) {
67 67
             $user->getUserById($single_user, true);
68 68
             $users[] = array('user_id' => $user->getUserId(),
69
-                             'login' => $user->getLogin(), );
69
+                                'login' => $user->getLogin(), );
70 70
         }
71 71
         echo json_encode($users);
72 72
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         foreach ($memberList as $single_member) {
79 79
             $user->getUserById($single_member, true);
80 80
             $members[] = array('user_id' => $user->getUserId(),
81
-                               'login' => $user->getLogin(), );
81
+                                'login' => $user->getLogin(), );
82 82
         }
83 83
         echo json_encode($members);
84 84
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         foreach ($userList as $single_user) {
67 67
             $user->getUserById($single_user, true);
68 68
             $users[] = array('user_id' => $user->getUserId(),
69
-                             'login' => $user->getLogin(), );
69
+                             'login' => $user->getLogin(),);
70 70
         }
71 71
         echo json_encode($users);
72 72
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         foreach ($memberList as $single_member) {
79 79
             $user->getUserById($single_member, true);
80 80
             $members[] = array('user_id' => $user->getUserId(),
81
-                               'login' => $user->getLogin(), );
81
+                               'login' => $user->getLogin(),);
82 82
         }
83 83
         echo json_encode($members);
84 84
     }
Please login to merge, or discard this patch.
phpmyfaq/admin/ajax.records.php 2 patches
Switch Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -48,96 +48,96 @@
 block discarded – undo
48 48
 switch ($ajax_action) {
49 49
 
50 50
     // save active FAQs
51
-    case 'save_active_records':
52
-        if ($user->perm->checkRight($user->getUserId(), 'approverec')) {
53
-            if (!empty($items)) {
54
-                $faq = new PMF_Faq($faqConfig);
55
-
56
-                foreach ($items as $item) {
57
-                    if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
58
-                        echo $faq->updateRecordFlag((int) $item[0], addslashes($item[1]), $item[2], 'active');
51
+        case 'save_active_records':
52
+            if ($user->perm->checkRight($user->getUserId(), 'approverec')) {
53
+                if (!empty($items)) {
54
+                    $faq = new PMF_Faq($faqConfig);
55
+
56
+                    foreach ($items as $item) {
57
+                        if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
58
+                            echo $faq->updateRecordFlag((int) $item[0], addslashes($item[1]), $item[2], 'active');
59
+                        }
59 60
                     }
60 61
                 }
62
+            } else {
63
+                echo $PMF_LANG['err_NotAuth'];
61 64
             }
62
-        } else {
63
-            echo $PMF_LANG['err_NotAuth'];
64
-        }
65
-        break;
66
-
67
-    // save sticky FAQs
68
-    case 'save_sticky_records':
69
-        if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
70
-            if (!empty($items)) {
71
-                $faq = new PMF_Faq($faqConfig);
72
-
73
-                foreach ($items as $item) {
74
-                    if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
75
-                        echo $faq->updateRecordFlag((int) $item[0], addslashes($item[1]), $item[2], 'sticky');
65
+            break;
66
+
67
+        // save sticky FAQs
68
+        case 'save_sticky_records':
69
+            if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
70
+                if (!empty($items)) {
71
+                    $faq = new PMF_Faq($faqConfig);
72
+
73
+                    foreach ($items as $item) {
74
+                        if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
75
+                            echo $faq->updateRecordFlag((int) $item[0], addslashes($item[1]), $item[2], 'sticky');
76
+                        }
76 77
                     }
77 78
                 }
79
+            } else {
80
+                echo $PMF_LANG['err_NotAuth'];
78 81
             }
79
-        } else {
80
-            echo $PMF_LANG['err_NotAuth'];
81
-        }
82
-        break;
82
+            break;
83 83
 
84
-    // search FAQs for suggestions
85
-    case 'search_records':
86
-        if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
87
-            $faq = new PMF_Faq($faqConfig);
88
-            $faqSearch = new PMF_Search($faqConfig);
89
-            $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
90
-            $searchResult = '';
91
-            $searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED);
84
+        // search FAQs for suggestions
85
+        case 'search_records':
86
+            if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
87
+                $faq = new PMF_Faq($faqConfig);
88
+                $faqSearch = new PMF_Search($faqConfig);
89
+                $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);
90
+                $searchResult = '';
91
+                $searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED);
92 92
 
93
-            if (!is_null($searchString)) {
94
-                $searchResult = $faqSearch->search($searchString, false);
93
+                if (!is_null($searchString)) {
94
+                    $searchResult = $faqSearch->search($searchString, false);
95 95
 
96
-                $faqSearchResult->reviewResultset($searchResult);
96
+                    $faqSearchResult->reviewResultset($searchResult);
97 97
 
98
-                $searchHelper = new PMF_Helper_Search($faqConfig);
99
-                $searchHelper->setSearchterm($searchString);
98
+                    $searchHelper = new PMF_Helper_Search($faqConfig);
99
+                    $searchHelper->setSearchterm($searchString);
100 100
 
101
-                echo $searchHelper->renderAdminSuggestionResult($faqSearchResult);
101
+                    echo $searchHelper->renderAdminSuggestionResult($faqSearchResult);
102
+                }
103
+            } else {
104
+                echo $PMF_LANG['err_NotAuth'];
102 105
             }
103
-        } else {
104
-            echo $PMF_LANG['err_NotAuth'];
105
-        }
106
-        break;
107
-
108
-    // delete FAQs
109
-    case 'delete_record':
110
-        if ($user->perm->checkRight($user->getUserId(), 'delbt')) {
111
-            $recordId = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
112
-            $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
113
-
114
-            $logging = new PMF_Logging($faqConfig);
115
-            $logging->logAdmin($user, 'Deleted FAQ ID '.$recordId);
116
-
117
-            $faq->deleteRecord($recordId, $recordLang);
118
-            echo $PMF_LANG['ad_entry_delsuc'];
119
-        } else {
120
-            echo $PMF_LANG['err_NotAuth'];
121
-        }
122
-        break;
123
-
124
-    // delete open questions
125
-    case 'delete_question':
126
-        if ($user->perm->checkRight($user->getUserId(), 'delquestion')) {
127
-            $checks = array(
128
-                'filter' => FILTER_VALIDATE_INT,
129
-                'flags' => FILTER_REQUIRE_ARRAY,
130
-            );
131
-            $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks));
132
-
133
-            if (!is_null($questionIds['questions'])) {
134
-                foreach ($questionIds['questions'] as $questionId) {
135
-                    $faq->deleteQuestion((int) $questionId);
106
+            break;
107
+
108
+        // delete FAQs
109
+        case 'delete_record':
110
+            if ($user->perm->checkRight($user->getUserId(), 'delbt')) {
111
+                $recordId = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
112
+                $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
113
+
114
+                $logging = new PMF_Logging($faqConfig);
115
+                $logging->logAdmin($user, 'Deleted FAQ ID '.$recordId);
116
+
117
+                $faq->deleteRecord($recordId, $recordLang);
118
+                echo $PMF_LANG['ad_entry_delsuc'];
119
+            } else {
120
+                echo $PMF_LANG['err_NotAuth'];
121
+            }
122
+            break;
123
+
124
+        // delete open questions
125
+        case 'delete_question':
126
+            if ($user->perm->checkRight($user->getUserId(), 'delquestion')) {
127
+                $checks = array(
128
+                    'filter' => FILTER_VALIDATE_INT,
129
+                    'flags' => FILTER_REQUIRE_ARRAY,
130
+                );
131
+                $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks));
132
+
133
+                if (!is_null($questionIds['questions'])) {
134
+                    foreach ($questionIds['questions'] as $questionId) {
135
+                        $faq->deleteQuestion((int) $questionId);
136
+                    }
136 137
                 }
138
+                echo $PMF_LANG['ad_entry_delsuc'];
139
+            } else {
140
+                echo $PMF_LANG['err_NotAuth'];
137 141
             }
138
-            echo $PMF_LANG['ad_entry_delsuc'];
139
-        } else {
140
-            echo $PMF_LANG['err_NotAuth'];
141
-        }
142
-        break;
142
+            break;
143 143
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
                 foreach ($items as $item) {
57 57
                     if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
58
-                        echo $faq->updateRecordFlag((int) $item[0], addslashes($item[1]), $item[2], 'active');
58
+                        echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'active');
59 59
                     }
60 60
                 }
61 61
             }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
                 foreach ($items as $item) {
74 74
                     if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) {
75
-                        echo $faq->updateRecordFlag((int) $item[0], addslashes($item[1]), $item[2], 'sticky');
75
+                        echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'sticky');
76 76
                     }
77 77
                 }
78 78
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
             if (!is_null($questionIds['questions'])) {
134 134
                 foreach ($questionIds['questions'] as $questionId) {
135
-                    $faq->deleteQuestion((int) $questionId);
135
+                    $faq->deleteQuestion((int)$questionId);
136 136
                 }
137 137
             }
138 138
             echo $PMF_LANG['ad_entry_delsuc'];
Please login to merge, or discard this patch.
phpmyfaq/admin/ajax.trans.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@
 block discarded – undo
224 224
         }
225 225
 
226 226
         $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'),
227
-                                     $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals);
227
+                                        $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals);
228 228
 
229 229
         $retval = @file_put_contents(PMF_ROOT_DIR.'/lang/language_'.strtolower($langCode).'.php', $fileTpl);
230 230
         echo intval($retval);
Please login to merge, or discard this patch.
Switch Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -40,167 +40,167 @@  discard block
 block discarded – undo
40 40
 
41 41
 switch ($ajax_action) {
42 42
 
43
-    case 'save_page_buffer':
44
-        /*
43
+        case 'save_page_buffer':
44
+            /*
45 45
          * Build language variable definitions
46 46
          * @todo Change input handling using PMF_Filter
47 47
          */
48
-        foreach ((array) @$_POST['PMF_LANG'] as $key => $val) {
49
-            if (is_string($val)) {
50
-                $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val);
51
-                $val = str_replace("'", "\\'", $val);
52
-                $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key]"] = $val;
53
-            } elseif (is_array($val)) {
54
-                /*
48
+            foreach ((array) @$_POST['PMF_LANG'] as $key => $val) {
49
+                if (is_string($val)) {
50
+                    $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val);
51
+                    $val = str_replace("'", "\\'", $val);
52
+                    $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key]"] = $val;
53
+                } elseif (is_array($val)) {
54
+                    /*
55 55
                  * Here we deal with a two dimensional array
56 56
                  */
57
-                foreach ($val as $key2 => $val2) {
58
-                    $val2 = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val2);
59
-                    $val2 = str_replace("'", "\\'", $val2);
60
-                    $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key][$key2]"] = $val2;
57
+                    foreach ($val as $key2 => $val2) {
58
+                        $val2 = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val2);
59
+                        $val2 = str_replace("'", "\\'", $val2);
60
+                        $_SESSION['trans']['rightVarsOnly']["PMF_LANG[$key][$key2]"] = $val2;
61
+                    }
61 62
                 }
62 63
             }
63
-        }
64
-
65
-        foreach ((array) @$_POST['LANG_CONF'] as $key => $val) {
66
-            // if string like array(blah-blah-blah), extract the contents inside the brackets
67
-            if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/', $val, $matches1)) {
68
-                // split the resulting string of delimiters such as "number =>"
69
-                $valArr = preg_split(
70
-                    '/\s*(\d+)\s*\=\>\s*/',
71
-                    $matches1[1],
72
-                    null,
73
-                    PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
74
-                );
75
-                $numVal = count($valArr);
76
-                if ($numVal > 1) {
77
-                    $newValArr = [];
78
-                    for ($i = 0; $i < $numVal; $i += 2) {
79
-                        if (is_numeric($valArr[$i])) {
80
-                            // clearing quotes
81
-                            if (preg_match('/^\s*\\\\*[\"|\'](.+)\\\\*[\"|\'][\s\,]*$/', $valArr[$i + 1], $matches2)) {
82
-                                $subVal = $matches2[1];
83
-                                // normalize quotes
84
-                                $subVal = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $subVal);
85
-                                $subVal = str_replace("'", "\\'", $subVal);
86
-                                // assembly of the original substring back
87
-                                $newValArr[] = $valArr[$i].' => \''.$subVal.'\'';
64
+
65
+            foreach ((array) @$_POST['LANG_CONF'] as $key => $val) {
66
+                // if string like array(blah-blah-blah), extract the contents inside the brackets
67
+                if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/', $val, $matches1)) {
68
+                    // split the resulting string of delimiters such as "number =>"
69
+                    $valArr = preg_split(
70
+                        '/\s*(\d+)\s*\=\>\s*/',
71
+                        $matches1[1],
72
+                        null,
73
+                        PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
74
+                    );
75
+                    $numVal = count($valArr);
76
+                    if ($numVal > 1) {
77
+                        $newValArr = [];
78
+                        for ($i = 0; $i < $numVal; $i += 2) {
79
+                            if (is_numeric($valArr[$i])) {
80
+                                // clearing quotes
81
+                                if (preg_match('/^\s*\\\\*[\"|\'](.+)\\\\*[\"|\'][\s\,]*$/', $valArr[$i + 1], $matches2)) {
82
+                                    $subVal = $matches2[1];
83
+                                    // normalize quotes
84
+                                    $subVal = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $subVal);
85
+                                    $subVal = str_replace("'", "\\'", $subVal);
86
+                                    // assembly of the original substring back
87
+                                    $newValArr[] = $valArr[$i].' => \''.$subVal.'\'';
88
+                                }
88 89
                             }
89 90
                         }
91
+                        $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = 'array('.implode(', ', $newValArr).')';
90 92
                     }
91
-                    $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = 'array('.implode(', ', $newValArr).')';
93
+                } else {  // compatibility for old behavior
94
+                    $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val);
95
+                    $val = str_replace("'", "\\'", $val);
96
+                    $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = $val;
92 97
                 }
93
-            } else {  // compatibility for old behavior
94
-                $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val);
95
-                $val = str_replace("'", "\\'", $val);
96
-                $_SESSION['trans']['rightVarsOnly']["LANG_CONF[$key]"] = $val;
97 98
             }
98
-        }
99 99
 
100
-        echo 1;
101
-    break;
100
+            echo 1;
101
+        break;
102 102
     
103
-    case 'save_translated_lang':
104
-
105
-        if (!$user->perm->checkRight($user->getUserId(), 'edittranslation')) {
106
-            echo $PMF_LANG['err_NotAuth'];
107
-            exit;
108
-        }
109
-
110
-        $lang = strtolower($_SESSION['trans']['rightVarsOnly']['PMF_LANG[metaLanguage]']);
111
-        $filename = PMF_ROOT_DIR.'/lang/language_'.$lang.'.php';
112
-
113
-        if (!is_writable(PMF_ROOT_DIR.'/lang')) {
114
-            echo 0;
115
-            exit;
116
-        }
117
-
118
-        if (!copy($filename, PMF_ROOT_DIR.'/lang/language_'.$lang.'.bak.php')) {
119
-            echo 0;
120
-            exit;
121
-        }
122
-
123
-        $newFileContents = '';
124
-        $tmpLines = [];
125
-
126
-        // Read in the head of the file we're writing to
127
-        $fh = fopen($filename, 'r');
128
-        do {
129
-            $line = fgets($fh);
130
-            array_push($tmpLines, rtrim($line));
131
-        } while ('*/' != substr(trim($line), -2));
132
-        fclose($fh);
133
-
134
-        // Construct lines with variable definitions
135
-        foreach ($_SESSION['trans']['rightVarsOnly'] as $key => $val) {
136
-            if (0 === strpos($key, 'PMF_LANG')) {
137
-                $val = "'$val'";
103
+        case 'save_translated_lang':
104
+
105
+            if (!$user->perm->checkRight($user->getUserId(), 'edittranslation')) {
106
+                echo $PMF_LANG['err_NotAuth'];
107
+                exit;
138 108
             }
139
-            array_push($tmpLines, '$'.str_replace(array('[', ']'), array("['", "']"), $key)." = $val;");
140
-        }
141 109
 
142
-        $newFileContents .= implode("\n", $tmpLines);
110
+            $lang = strtolower($_SESSION['trans']['rightVarsOnly']['PMF_LANG[metaLanguage]']);
111
+            $filename = PMF_ROOT_DIR.'/lang/language_'.$lang.'.php';
143 112
 
144
-        unset($_SESSION['trans']);
113
+            if (!is_writable(PMF_ROOT_DIR.'/lang')) {
114
+                echo 0;
115
+                exit;
116
+            }
145 117
 
146
-        $retval = file_put_contents($filename, $newFileContents);
147
-        echo intval($retval);
148
-        break;
118
+            if (!copy($filename, PMF_ROOT_DIR.'/lang/language_'.$lang.'.bak.php')) {
119
+                echo 0;
120
+                exit;
121
+            }
149 122
 
150
-    case 'remove_lang_file':
123
+            $newFileContents = '';
124
+            $tmpLines = [];
125
+
126
+            // Read in the head of the file we're writing to
127
+            $fh = fopen($filename, 'r');
128
+            do {
129
+                $line = fgets($fh);
130
+                array_push($tmpLines, rtrim($line));
131
+            } while ('*/' != substr(trim($line), -2));
132
+            fclose($fh);
133
+
134
+            // Construct lines with variable definitions
135
+            foreach ($_SESSION['trans']['rightVarsOnly'] as $key => $val) {
136
+                if (0 === strpos($key, 'PMF_LANG')) {
137
+                    $val = "'$val'";
138
+                }
139
+                array_push($tmpLines, '$'.str_replace(array('[', ']'), array("['", "']"), $key)." = $val;");
140
+            }
141
+
142
+            $newFileContents .= implode("\n", $tmpLines);
151 143
 
152
-        if (!$user->perm->checkRight($user->getUserId(), 'deltranslation')) {
153
-            echo $PMF_LANG['err_NotAuth'];
154
-            exit;
155
-        }
144
+            unset($_SESSION['trans']);
156 145
 
157
-        $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING);
146
+            $retval = file_put_contents($filename, $newFileContents);
147
+            echo intval($retval);
148
+            break;
158 149
 
159
-        if (!is_writable(PMF_ROOT_DIR.'/lang')) {
160
-            echo 0;
161
-            exit;
162
-        }
150
+        case 'remove_lang_file':
163 151
 
164
-        if (!copy(PMF_ROOT_DIR."/lang/language_$lang.php", PMF_ROOT_DIR."/lang/language_$lang.bak.php")) {
165
-            echo 0;
166
-            exit;
167
-        }
152
+            if (!$user->perm->checkRight($user->getUserId(), 'deltranslation')) {
153
+                echo $PMF_LANG['err_NotAuth'];
154
+                exit;
155
+            }
168 156
 
169
-        if (!unlink(PMF_ROOT_DIR."/lang/language_$lang.php")) {
170
-            echo 0;
171
-            exit;
172
-        }
157
+            $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING);
173 158
 
174
-        echo 1;
175
-        break;
159
+            if (!is_writable(PMF_ROOT_DIR.'/lang')) {
160
+                echo 0;
161
+                exit;
162
+            }
163
+
164
+            if (!copy(PMF_ROOT_DIR."/lang/language_$lang.php", PMF_ROOT_DIR."/lang/language_$lang.bak.php")) {
165
+                echo 0;
166
+                exit;
167
+            }
176 168
 
177
-    case 'save_added_trans':
178
-
179
-        if (!$user->perm->checkRight($user->getUserId(), 'addtranslation')) {
180
-            echo $PMF_LANG['err_NotAuth'];
181
-            exit;
182
-        }
183
-
184
-        if (!is_writable(PMF_ROOT_DIR.'/lang')) {
185
-            echo 0;
186
-            exit;
187
-        }
188
-
189
-        $langCode = PMF_Filter::filterInput(INPUT_POST, 'translang', FILTER_SANITIZE_STRING);
190
-        $langName = @$languageCodes[$langCode];
191
-        $langCharset = 'UTF-8';
192
-        $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING);
193
-        $langNPlurals = strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1));
194
-        $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING);
195
-        $author = (array) @$_POST['author'];
196
-
197
-        if (empty($langCode) || empty($langName) || empty($langCharset) ||
198
-           empty($langDir) || empty($langDesc) || empty($author)) {
199
-            echo 0;
200
-            exit;
201
-        }
202
-
203
-        $fileTpl = <<<FILE
169
+            if (!unlink(PMF_ROOT_DIR."/lang/language_$lang.php")) {
170
+                echo 0;
171
+                exit;
172
+            }
173
+
174
+            echo 1;
175
+            break;
176
+
177
+        case 'save_added_trans':
178
+
179
+            if (!$user->perm->checkRight($user->getUserId(), 'addtranslation')) {
180
+                echo $PMF_LANG['err_NotAuth'];
181
+                exit;
182
+            }
183
+
184
+            if (!is_writable(PMF_ROOT_DIR.'/lang')) {
185
+                echo 0;
186
+                exit;
187
+            }
188
+
189
+            $langCode = PMF_Filter::filterInput(INPUT_POST, 'translang', FILTER_SANITIZE_STRING);
190
+            $langName = @$languageCodes[$langCode];
191
+            $langCharset = 'UTF-8';
192
+            $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING);
193
+            $langNPlurals = strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1));
194
+            $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING);
195
+            $author = (array) @$_POST['author'];
196
+
197
+            if (empty($langCode) || empty($langName) || empty($langCharset) ||
198
+               empty($langDir) || empty($langDesc) || empty($author)) {
199
+                echo 0;
200
+                exit;
201
+            }
202
+
203
+            $fileTpl = <<<FILE
204 204
 <?php
205 205
 /**
206 206
  * %s
@@ -226,40 +226,40 @@  discard block
 block discarded – undo
226 226
 \$PMF_LANG['nplurals'] = '%s';
227 227
 FILE;
228 228
 
229
-        $authorTpl = '';
230
-        foreach ($author as $authorData) {
231
-            $authorTpl .= " * @author    $authorData\n";
232
-        }
229
+            $authorTpl = '';
230
+            foreach ($author as $authorData) {
231
+                $authorTpl .= " * @author    $authorData\n";
232
+            }
233 233
 
234
-        $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'),
235
-                                     $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals);
234
+            $fileTpl = sprintf($fileTpl, $langDesc, $authorTpl, date('Y-m-d'), $langCode, date('Y'),
235
+                                         $langCharset, strtolower($langCode), $langName, $langDir, $langNPlurals);
236 236
 
237
-        $retval = @file_put_contents(PMF_ROOT_DIR.'/lang/language_'.strtolower($langCode).'.php', $fileTpl);
238
-        echo intval($retval);
239
-    break;
237
+            $retval = @file_put_contents(PMF_ROOT_DIR.'/lang/language_'.strtolower($langCode).'.php', $fileTpl);
238
+            echo intval($retval);
239
+        break;
240 240
 
241
-    case 'send_translated_file':
241
+        case 'send_translated_file':
242 242
 
243
-        $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING);
244
-        $filename = PMF_ROOT_DIR.'/lang/language_'.$lang.'.php';
243
+            $lang = PMF_Filter::filterInput(INPUT_GET, 'translang', FILTER_SANITIZE_STRING);
244
+            $filename = PMF_ROOT_DIR.'/lang/language_'.$lang.'.php';
245 245
 
246
-        if (!file_exists($filename)) {
247
-            echo 0;
248
-            exit;
249
-        }
246
+            if (!file_exists($filename)) {
247
+                echo 0;
248
+                exit;
249
+            }
250 250
 
251
-        $letterTpl = '';
251
+            $letterTpl = '';
252 252
 
253
-        $mail = new PMF_Mail($faqConfig);
254
-        $mail->subject = 'New phpMyFAQ language file submitted';
255
-        $mail->message = sprintf('The file below was sent by %s, which is using phpMyFAQ %s on %s',
256
-            $user->userdata->get('email'),
257
-            $faqConfig->get('main.currentVersion'),
258
-            $_SERVER['HTTP_HOST']);
253
+            $mail = new PMF_Mail($faqConfig);
254
+            $mail->subject = 'New phpMyFAQ language file submitted';
255
+            $mail->message = sprintf('The file below was sent by %s, which is using phpMyFAQ %s on %s',
256
+                $user->userdata->get('email'),
257
+                $faqConfig->get('main.currentVersion'),
258
+                $_SERVER['HTTP_HOST']);
259 259
 
260
-        $mail->addTo('[email protected]');
261
-        $mail->addAttachment($filename, null, 'text/plain');
260
+            $mail->addTo('[email protected]');
261
+            $mail->addAttachment($filename, null, 'text/plain');
262 262
 
263
-        echo (int) $mail->send();
264
-    break;
263
+            echo (int) $mail->send();
264
+        break;
265 265
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 }
30 30
 
31 31
 $ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING);
32
-$csrfToken  = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
32
+$csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
33 33
 if (is_null($csrfToken)) {
34
-    $csrfToken  = PMF_Filter::filterInput(INPUT_GET, 'csrf', FILTER_SANITIZE_STRING);
34
+    $csrfToken = PMF_Filter::filterInput(INPUT_GET, 'csrf', FILTER_SANITIZE_STRING);
35 35
 }
36 36
 
37 37
 if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
          * Build language variable definitions
46 46
          * @todo Change input handling using PMF_Filter
47 47
          */
48
-        foreach ((array) @$_POST['PMF_LANG'] as $key => $val) {
48
+        foreach ((array)@$_POST['PMF_LANG'] as $key => $val) {
49 49
             if (is_string($val)) {
50 50
                 $val = str_replace(array('\\\\', '\"', '\\\''), array('\\', '"', "'"), $val);
51 51
                 $val = str_replace("'", "\\'", $val);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             }
63 63
         }
64 64
 
65
-        foreach ((array) @$_POST['LANG_CONF'] as $key => $val) {
65
+        foreach ((array)@$_POST['LANG_CONF'] as $key => $val) {
66 66
             // if string like array(blah-blah-blah), extract the contents inside the brackets
67 67
             if (preg_match('/^\s*array\s*\(\s*(\d+.+)\s*\).*$/', $val, $matches1)) {
68 68
                 // split the resulting string of delimiters such as "number =>"
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $langDir = PMF_Filter::filterInput(INPUT_POST, 'langdir', FILTER_SANITIZE_STRING);
193 193
         $langNPlurals = strval(PMF_Filter::filterVar(@$_POST['langnplurals'], FILTER_VALIDATE_INT, -1));
194 194
         $langDesc = PMF_Filter::filterInput(INPUT_POST, 'langdesc', FILTER_SANITIZE_STRING);
195
-        $author = (array) @$_POST['author'];
195
+        $author = (array)@$_POST['author'];
196 196
 
197 197
         if (empty($langCode) || empty($langName) || empty($langCharset) ||
198 198
            empty($langDir) || empty($langDesc) || empty($author)) {
@@ -260,6 +260,6 @@  discard block
 block discarded – undo
260 260
         $mail->addTo('[email protected]');
261 261
         $mail->addAttachment($filename, null, 'text/plain');
262 262
 
263
-        echo (int) $mail->send();
263
+        echo (int)$mail->send();
264 264
     break;
265 265
 }
Please login to merge, or discard this patch.
phpmyfaq/admin/att.main.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 $itemsPerPage = 32;
34 34
 $allCrumbs = $fa->getBreadcrumbs();
35 35
 
36
-$crumbs = array_slice($allCrumbs, ($page - 1) * $itemsPerPage, $itemsPerPage);
36
+$crumbs = array_slice($allCrumbs, ($page - 1)*$itemsPerPage, $itemsPerPage);
37 37
 
38 38
 $pagination = new PMF_Pagination(
39 39
     $faqConfig,
Please login to merge, or discard this patch.
phpmyfaq/admin/attachment.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 }
111 111
 if (is_null($currentAction) && $auth && $user->perm->checkRight($user->getUserId(), 'addattachment')) {
112
-    $recordId = filter_input(INPUT_GET, 'record_id',   FILTER_VALIDATE_INT);
112
+    $recordId = filter_input(INPUT_GET, 'record_id', FILTER_VALIDATE_INT);
113 113
     $recordLang = filter_input(INPUT_GET, 'record_lang', FILTER_SANITIZE_STRING);
114 114
     ?>
115 115
         <form action="attachment.php?action=save" enctype="multipart/form-data" method="post" accept-charset="utf-8">
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             <legend>
118 118
                 <?php echo $PMF_LANG['ad_att_addto'].' '.$PMF_LANG['ad_att_addto_2'];
119 119
     ?>
120
-                (max <?php echo round($faqConfig->get('records.maxAttachmentSize') / pow(1024, 2), 2) ?> MB)
120
+                (max <?php echo round($faqConfig->get('records.maxAttachmentSize')/pow(1024, 2), 2) ?> MB)
121 121
             </legend>
122 122
                 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $faqConfig->get('records.maxAttachmentSize');
123 123
     ?>" />
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 if (!is_null($currentSave) && $currentSave == true && $auth &&
153 153
     $user->perm->checkRight($user->getUserId(), 'addattachment')) {
154
-    $recordId = filter_input(INPUT_POST, 'record_id',   FILTER_VALIDATE_INT);
154
+    $recordId = filter_input(INPUT_POST, 'record_id', FILTER_VALIDATE_INT);
155 155
     $recordLang = filter_input(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING);
156 156
     ?>
157 157
 <p><strong><?php echo $PMF_LANG['ad_att_addto'].' '.$PMF_LANG['ad_att_addto_2'];
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             '<p>%s</p>',
193 193
             sprintf(
194 194
                 $PMF_LANG['ad_attach_4'],
195
-                round($faqConfig->get('records.maxAttachmentSize') / pow(1024, 2), 2)
195
+                round($faqConfig->get('records.maxAttachmentSize')/pow(1024, 2), 2)
196 196
             )
197 197
         );
198 198
 
Please login to merge, or discard this patch.
phpmyfaq/admin/category.showstructure.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
             'parent_id' => $parent_id,
52 52
             'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING),
53 53
             'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING),
54
-            'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT), );
54
+            'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT),);
55 55
 
56 56
         // translate.category only returns non-existent languages to translate too
57 57
         if ($category->addCategory($category_data, $parent_id, $category_data['id'])) {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,14 +99,14 @@
 block discarded – undo
99 99
         print '<td>';
100 100
         if ($cat['lang'] != $LANGCODE) {
101 101
             // translate category
102
-           printf(
103
-               '<a href="%s?action=translatecategory&amp;cat=%s&amp;trlang=%s" title="%s"><span title="%s" class="fa fa-share"></span></a></a>',
104
-               $currentLink,
105
-               $cat['id'],
106
-               $LANGCODE,
107
-               $PMF_LANG['ad_categ_translate'],
108
-               $PMF_LANG['ad_categ_translate']
109
-           );
102
+            printf(
103
+                '<a href="%s?action=translatecategory&amp;cat=%s&amp;trlang=%s" title="%s"><span title="%s" class="fa fa-share"></span></a></a>',
104
+                $currentLink,
105
+                $cat['id'],
106
+                $LANGCODE,
107
+                $PMF_LANG['ad_categ_translate'],
108
+                $PMF_LANG['ad_categ_translate']
109
+            );
110 110
         }
111 111
         printf('&nbsp;%s<strong>%s</strong>',
112 112
             $indent,
Please login to merge, or discard this patch.
phpmyfaq/admin/category.translate.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,9 +68,11 @@
 block discarded – undo
68 68
                     <?php if ($faqConfig->get('security.permLevel') !== 'basic'): ?>
69 69
                     <input type="hidden" name="restricted_groups" value="<?php print $group_permission[0];
70 70
     ?>" />
71
-                    <?php else: ?>
71
+                    <?php else {
72
+    : ?>
72 73
                     <input type="hidden" name="restricted_groups" value="-1" />
73 74
                     <?php endif;
75
+}
74 76
     ?>
75 77
                     <input type="hidden" name="restricted_users" value="<?php print $user_permission[0];
76 78
     ?>" />
Please login to merge, or discard this patch.
phpmyfaq/admin/dashboard.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@
 block discarded – undo
190 190
                     $getJson = PMF_Filter::filterInput(INPUT_POST, 'getJson', FILTER_SANITIZE_STRING);
191 191
                     if (!is_null($getJson) && 'verify' === $getJson) {
192 192
                         set_error_handler(
193
-                            function ($severity, $message, $file, $line) {
193
+                            function($severity, $message, $file, $line) {
194 194
                                 throw new ErrorException($message, $severity, $severity, $file, $line);
195 195
                             }
196 196
                         );
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,11 @@
 block discarded – undo
38 38
                     <a href="?action=config">
39 39
                         <?php if ($faqConfig->get('main.maintenanceMode')): ?>
40 40
                         <span class="label label-important"><?php print $PMF_LANG['msgMaintenanceMode']; ?></span>
41
-                        <?php else: ?>
42
-                        <span class="label label-success"><?php print $PMF_LANG['msgOnlineMode']; ?></span>
41
+                        <?php else {
42
+    : ?>
43
+                        <span class="label label-success"><?php print $PMF_LANG['msgOnlineMode'];
44
+}
45
+?></span>
43 46
                         <?php endif; ?>
44 47
                     </a>
45 48
                 </div>
Please login to merge, or discard this patch.