@@ -1,88 +1,88 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * ajax save name |
|
| 4 | - * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | - * @link www.phpletter.com |
|
| 6 | - * @since 22/May/2007 |
|
| 7 | - * |
|
| 8 | - */ |
|
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | - $error = ''; |
|
| 11 | - $path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name']; |
|
| 12 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 13 | - { |
|
| 14 | - $error = SYS_DISABLED; |
|
| 15 | - } |
|
| 16 | - elseif(isset($_POST['save_as_request'])) |
|
| 17 | - { |
|
| 18 | - if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name'])) |
|
| 19 | - { |
|
| 20 | - $error = TXT_SAVE_AS_ERR_NAME_INVALID; |
|
| 21 | - }elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) |
|
| 22 | - { |
|
| 23 | - $error = TXT_DISALLOWED_EXT; |
|
| 24 | - }elseif(!isUnderRoot($_POST['folder'])) |
|
| 25 | - { |
|
| 26 | - $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
|
| 27 | - } |
|
| 28 | - else |
|
| 29 | - { |
|
| 2 | + /** |
|
| 3 | + * ajax save name |
|
| 4 | + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) |
|
| 5 | + * @link www.phpletter.com |
|
| 6 | + * @since 22/May/2007 |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 10 | + $error = ''; |
|
| 11 | + $path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name']; |
|
| 12 | + if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 13 | + { |
|
| 14 | + $error = SYS_DISABLED; |
|
| 15 | + } |
|
| 16 | + elseif(isset($_POST['save_as_request'])) |
|
| 17 | + { |
|
| 18 | + if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name'])) |
|
| 19 | + { |
|
| 20 | + $error = TXT_SAVE_AS_ERR_NAME_INVALID; |
|
| 21 | + }elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) |
|
| 22 | + { |
|
| 23 | + $error = TXT_DISALLOWED_EXT; |
|
| 24 | + }elseif(!isUnderRoot($_POST['folder'])) |
|
| 25 | + { |
|
| 26 | + $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
|
| 27 | + } |
|
| 28 | + else |
|
| 29 | + { |
|
| 30 | 30 | |
| 31 | - if(!empty($_POST['save_as_request'])) |
|
| 32 | - {//save as request |
|
| 33 | - if(file_exists($path)) |
|
| 34 | - { |
|
| 35 | - $error = TXT_FILE_EXIST; |
|
| 36 | - }else |
|
| 37 | - { |
|
| 38 | - if(($fp = @fopen($path, 'w+')) !== false) |
|
| 39 | - { |
|
| 40 | - if(@fwrite($fp, $_POST['text'])) |
|
| 41 | - { |
|
| 42 | - @fclose($fp); |
|
| 43 | - }else |
|
| 44 | - { |
|
| 45 | - $error = TXT_CONTENT_WRITE_FAILED; |
|
| 46 | - } |
|
| 47 | - }else |
|
| 48 | - { |
|
| 49 | - $error = TXT_CREATE_FAILED; |
|
| 50 | - } |
|
| 51 | - } |
|
| 31 | + if(!empty($_POST['save_as_request'])) |
|
| 32 | + {//save as request |
|
| 33 | + if(file_exists($path)) |
|
| 34 | + { |
|
| 35 | + $error = TXT_FILE_EXIST; |
|
| 36 | + }else |
|
| 37 | + { |
|
| 38 | + if(($fp = @fopen($path, 'w+')) !== false) |
|
| 39 | + { |
|
| 40 | + if(@fwrite($fp, $_POST['text'])) |
|
| 41 | + { |
|
| 42 | + @fclose($fp); |
|
| 43 | + }else |
|
| 44 | + { |
|
| 45 | + $error = TXT_CONTENT_WRITE_FAILED; |
|
| 46 | + } |
|
| 47 | + }else |
|
| 48 | + { |
|
| 49 | + $error = TXT_CREATE_FAILED; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | - }else |
|
| 55 | - { |
|
| 56 | - if(!file_exists($path)) |
|
| 57 | - { |
|
| 58 | - $error = TXT_FILE_NOT_EXIST; |
|
| 59 | - }else |
|
| 60 | - { |
|
| 61 | - if(($fp = @fopen($path, 'w')) !== false) |
|
| 62 | - { |
|
| 63 | - if(@fwrite($fp, $_POST['text'])) |
|
| 64 | - { |
|
| 65 | - @fclose($fp); |
|
| 66 | - }else |
|
| 67 | - { |
|
| 68 | - $error = TXT_CONTENT_UPDATE_FAILED; |
|
| 69 | - } |
|
| 70 | - }else |
|
| 71 | - { |
|
| 72 | - $error = TXT_FILE_OPEN_FAILED; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - } |
|
| 54 | + }else |
|
| 55 | + { |
|
| 56 | + if(!file_exists($path)) |
|
| 57 | + { |
|
| 58 | + $error = TXT_FILE_NOT_EXIST; |
|
| 59 | + }else |
|
| 60 | + { |
|
| 61 | + if(($fp = @fopen($path, 'w')) !== false) |
|
| 62 | + { |
|
| 63 | + if(@fwrite($fp, $_POST['text'])) |
|
| 64 | + { |
|
| 65 | + @fclose($fp); |
|
| 66 | + }else |
|
| 67 | + { |
|
| 68 | + $error = TXT_CONTENT_UPDATE_FAILED; |
|
| 69 | + } |
|
| 70 | + }else |
|
| 71 | + { |
|
| 72 | + $error = TXT_FILE_OPEN_FAILED; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - }else |
|
| 80 | - { |
|
| 81 | - $error = TXT_UNKNOWN_REQUEST; |
|
| 82 | - } |
|
| 83 | - echo "{"; |
|
| 84 | - echo "error:'" . $error . "',\n"; |
|
| 85 | - echo "path:'" . $path . "'"; |
|
| 86 | - echo "}"; |
|
| 79 | + }else |
|
| 80 | + { |
|
| 81 | + $error = TXT_UNKNOWN_REQUEST; |
|
| 82 | + } |
|
| 83 | + echo "{"; |
|
| 84 | + echo "error:'" . $error . "',\n"; |
|
| 85 | + echo "path:'" . $path . "'"; |
|
| 86 | + echo "}"; |
|
| 87 | 87 | |
| 88 | 88 | ?> |
| 89 | 89 | \ No newline at end of file |
@@ -6,68 +6,68 @@ discard block |
||
| 6 | 6 | * @since 22/May/2007 |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | - require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); |
|
| 9 | + require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); |
|
| 10 | 10 | $error = ''; |
| 11 | - $path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name']; |
|
| 12 | - if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 11 | + $path = addTrailingSlash(backslashToSlash($_POST['folder'])).$_POST['name']; |
|
| 12 | + if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
|
| 13 | 13 | { |
| 14 | 14 | $error = SYS_DISABLED; |
| 15 | 15 | } |
| 16 | - elseif(isset($_POST['save_as_request'])) |
|
| 16 | + elseif (isset($_POST['save_as_request'])) |
|
| 17 | 17 | { |
| 18 | - if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name'])) |
|
| 18 | + if (!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name'])) |
|
| 19 | 19 | { |
| 20 | 20 | $error = TXT_SAVE_AS_ERR_NAME_INVALID; |
| 21 | - }elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) |
|
| 21 | + }elseif (array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) |
|
| 22 | 22 | { |
| 23 | 23 | $error = TXT_DISALLOWED_EXT; |
| 24 | - }elseif(!isUnderRoot($_POST['folder'])) |
|
| 24 | + }elseif (!isUnderRoot($_POST['folder'])) |
|
| 25 | 25 | { |
| 26 | 26 | $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
| 27 | 27 | } |
| 28 | 28 | else |
| 29 | 29 | { |
| 30 | 30 | |
| 31 | - if(!empty($_POST['save_as_request'])) |
|
| 31 | + if (!empty($_POST['save_as_request'])) |
|
| 32 | 32 | {//save as request |
| 33 | - if(file_exists($path)) |
|
| 33 | + if (file_exists($path)) |
|
| 34 | 34 | { |
| 35 | 35 | $error = TXT_FILE_EXIST; |
| 36 | - }else |
|
| 36 | + } else |
|
| 37 | 37 | { |
| 38 | - if(($fp = @fopen($path, 'w+')) !== false) |
|
| 38 | + if (($fp = @fopen($path, 'w+')) !== false) |
|
| 39 | 39 | { |
| 40 | - if(@fwrite($fp, $_POST['text'])) |
|
| 40 | + if (@fwrite($fp, $_POST['text'])) |
|
| 41 | 41 | { |
| 42 | 42 | @fclose($fp); |
| 43 | - }else |
|
| 43 | + } else |
|
| 44 | 44 | { |
| 45 | 45 | $error = TXT_CONTENT_WRITE_FAILED; |
| 46 | 46 | } |
| 47 | - }else |
|
| 47 | + } else |
|
| 48 | 48 | { |
| 49 | 49 | $error = TXT_CREATE_FAILED; |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - }else |
|
| 54 | + } else |
|
| 55 | 55 | { |
| 56 | - if(!file_exists($path)) |
|
| 56 | + if (!file_exists($path)) |
|
| 57 | 57 | { |
| 58 | 58 | $error = TXT_FILE_NOT_EXIST; |
| 59 | - }else |
|
| 59 | + } else |
|
| 60 | 60 | { |
| 61 | - if(($fp = @fopen($path, 'w')) !== false) |
|
| 61 | + if (($fp = @fopen($path, 'w')) !== false) |
|
| 62 | 62 | { |
| 63 | - if(@fwrite($fp, $_POST['text'])) |
|
| 63 | + if (@fwrite($fp, $_POST['text'])) |
|
| 64 | 64 | { |
| 65 | 65 | @fclose($fp); |
| 66 | - }else |
|
| 66 | + } else |
|
| 67 | 67 | { |
| 68 | 68 | $error = TXT_CONTENT_UPDATE_FAILED; |
| 69 | 69 | } |
| 70 | - }else |
|
| 70 | + } else |
|
| 71 | 71 | { |
| 72 | 72 | $error = TXT_FILE_OPEN_FAILED; |
| 73 | 73 | } |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - }else |
|
| 79 | + } else |
|
| 80 | 80 | { |
| 81 | 81 | $error = TXT_UNKNOWN_REQUEST; |
| 82 | 82 | } |
| 83 | 83 | echo "{"; |
| 84 | - echo "error:'" . $error . "',\n"; |
|
| 85 | - echo "path:'" . $path . "'"; |
|
| 84 | + echo "error:'".$error."',\n"; |
|
| 85 | + echo "path:'".$path."'"; |
|
| 86 | 86 | echo "}"; |
| 87 | 87 | |
| 88 | 88 | ?> |
| 89 | 89 | \ No newline at end of file |
@@ -12,20 +12,18 @@ discard block |
||
| 12 | 12 | if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) |
| 13 | 13 | { |
| 14 | 14 | $error = SYS_DISABLED; |
| 15 | - } |
|
| 16 | - elseif(isset($_POST['save_as_request'])) |
|
| 15 | + } elseif(isset($_POST['save_as_request'])) |
|
| 17 | 16 | { |
| 18 | 17 | if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name'])) |
| 19 | 18 | { |
| 20 | 19 | $error = TXT_SAVE_AS_ERR_NAME_INVALID; |
| 21 | - }elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) |
|
| 20 | + } elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) |
|
| 22 | 21 | { |
| 23 | 22 | $error = TXT_DISALLOWED_EXT; |
| 24 | - }elseif(!isUnderRoot($_POST['folder'])) |
|
| 23 | + } elseif(!isUnderRoot($_POST['folder'])) |
|
| 25 | 24 | { |
| 26 | 25 | $error = ERR_FOLDER_PATH_NOT_ALLOWED; |
| 27 | - } |
|
| 28 | - else |
|
| 26 | + } else |
|
| 29 | 27 | { |
| 30 | 28 | |
| 31 | 29 | if(!empty($_POST['save_as_request'])) |
@@ -33,41 +31,41 @@ discard block |
||
| 33 | 31 | if(file_exists($path)) |
| 34 | 32 | { |
| 35 | 33 | $error = TXT_FILE_EXIST; |
| 36 | - }else |
|
| 34 | + } else |
|
| 37 | 35 | { |
| 38 | 36 | if(($fp = @fopen($path, 'w+')) !== false) |
| 39 | 37 | { |
| 40 | 38 | if(@fwrite($fp, $_POST['text'])) |
| 41 | 39 | { |
| 42 | 40 | @fclose($fp); |
| 43 | - }else |
|
| 41 | + } else |
|
| 44 | 42 | { |
| 45 | 43 | $error = TXT_CONTENT_WRITE_FAILED; |
| 46 | 44 | } |
| 47 | - }else |
|
| 45 | + } else |
|
| 48 | 46 | { |
| 49 | 47 | $error = TXT_CREATE_FAILED; |
| 50 | 48 | } |
| 51 | 49 | } |
| 52 | 50 | |
| 53 | 51 | |
| 54 | - }else |
|
| 52 | + } else |
|
| 55 | 53 | { |
| 56 | 54 | if(!file_exists($path)) |
| 57 | 55 | { |
| 58 | 56 | $error = TXT_FILE_NOT_EXIST; |
| 59 | - }else |
|
| 57 | + } else |
|
| 60 | 58 | { |
| 61 | 59 | if(($fp = @fopen($path, 'w')) !== false) |
| 62 | 60 | { |
| 63 | 61 | if(@fwrite($fp, $_POST['text'])) |
| 64 | 62 | { |
| 65 | 63 | @fclose($fp); |
| 66 | - }else |
|
| 64 | + } else |
|
| 67 | 65 | { |
| 68 | 66 | $error = TXT_CONTENT_UPDATE_FAILED; |
| 69 | 67 | } |
| 70 | - }else |
|
| 68 | + } else |
|
| 71 | 69 | { |
| 72 | 70 | $error = TXT_FILE_OPEN_FAILED; |
| 73 | 71 | } |
@@ -76,7 +74,7 @@ discard block |
||
| 76 | 74 | |
| 77 | 75 | } |
| 78 | 76 | |
| 79 | - }else |
|
| 77 | + } else |
|
| 80 | 78 | { |
| 81 | 79 | $error = TXT_UNKNOWN_REQUEST; |
| 82 | 80 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | define('PMF_ROOT_DIR', dirname(dirname(dirname(dirname(__DIR__))))); |
| 19 | 19 | define('IS_VALID_PHPMYFAQ', null); |
| 20 | 20 | |
| 21 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
| 21 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
| 22 | 22 | |
| 23 | 23 | $user = PMF_User_CurrentUser::getFromCookie($faqConfig); |
| 24 | -if (! $user instanceof PMF_User_CurrentUser) { |
|
| 24 | +if (!$user instanceof PMF_User_CurrentUser) { |
|
| 25 | 25 | $user = PMF_User_CurrentUser::getFromSession($faqConfig); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | $protocol = 'http'; |
| 23 | - if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
| 23 | + if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
| 24 | 24 | $protocol = 'https'; |
| 25 | 25 | } |
| 26 | - header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); |
|
| 26 | + header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
|
| 27 | 27 | exit(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -require PMF_ROOT_DIR . '/inc/libs/twitteroauth/twitteroauth.php'; |
|
| 30 | +require PMF_ROOT_DIR.'/inc/libs/twitteroauth/twitteroauth.php'; |
|
| 31 | 31 | |
| 32 | 32 | if (!empty($_SESSION['access_token'])) { |
| 33 | 33 | $connection = new TwitterOAuth( |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $templates = $faqSystem->getAvailableTemplates(); |
| 135 | 135 | |
| 136 | 136 | foreach ($templates as $template => $selected) { |
| 137 | - printf ("<option%s>%s</option>", |
|
| 137 | + printf("<option%s>%s</option>", |
|
| 138 | 138 | ($selected === true ? ' selected="selected"' : ''), |
| 139 | 139 | $template |
| 140 | 140 | ); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | break; |
| 143 | 143 | |
| 144 | 144 | case "records.attachmentsStorageType": |
| 145 | - foreach($PMF_LANG['att_storage_type'] as $i => $item) { |
|
| 145 | + foreach ($PMF_LANG['att_storage_type'] as $i => $item) { |
|
| 146 | 146 | $selected = $faqConfig->get($key) == $i |
| 147 | 147 | ? ' selected="selected"' |
| 148 | 148 | : ''; |
@@ -226,18 +226,18 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | echo '<a target="_blank" href="https://dev.twitter.com/apps/new">Create Twitter App for your FAQ</a>'; |
| 228 | 228 | echo "<br />\n"; |
| 229 | - echo "Your Callback URL is: " .$faqConfig->get('main.referenceURL') . "/services/twitter/callback.php"; |
|
| 229 | + echo "Your Callback URL is: ".$faqConfig->get('main.referenceURL')."/services/twitter/callback.php"; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (!isset($content)) { |
| 233 | 233 | echo '<a target="_blank" href="../services/twitter/redirect.php">'; |
| 234 | 234 | echo '<img src="../assets/img/twitter.signin.png" alt="Sign in with Twitter"/></a>'; |
| 235 | 235 | } elseif (isset($content)) { |
| 236 | - echo $content->screen_name . "<br />\n"; |
|
| 237 | - echo "<img src='" . $content->profile_image_url_https . "'><br />\n"; |
|
| 238 | - echo "Follower: " . $content->followers_count . "<br />\n"; |
|
| 239 | - echo "Status Count: " . $content->statuses_count . "<br />\n"; |
|
| 240 | - echo "Status: " . $content->status->text; |
|
| 236 | + echo $content->screen_name."<br />\n"; |
|
| 237 | + echo "<img src='".$content->profile_image_url_https."'><br />\n"; |
|
| 238 | + echo "Follower: ".$content->followers_count."<br />\n"; |
|
| 239 | + echo "Status Count: ".$content->statuses_count."<br />\n"; |
|
| 240 | + echo "Status: ".$content->status->text; |
|
| 241 | 241 | } |
| 242 | 242 | echo '</div>'; |
| 243 | 243 | echo '</div>'; |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * AJAX: lists the complete configuration items as text/html |
|
| 4 | - * |
|
| 5 | - * PHP 5.2 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Administration |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @author Thomas Zeithaml <[email protected]> |
|
| 15 | - * @copyright 2005-2016 phpMyFAQ Team |
|
| 16 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | - * @link http://www.phpmyfaq.de |
|
| 18 | - * @since 2005-12-26 |
|
| 19 | - */ |
|
| 3 | + * AJAX: lists the complete configuration items as text/html |
|
| 4 | + * |
|
| 5 | + * PHP 5.2 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Administration |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @author Thomas Zeithaml <[email protected]> |
|
| 15 | + * @copyright 2005-2016 phpMyFAQ Team |
|
| 16 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | + * @link http://www.phpmyfaq.de |
|
| 18 | + * @since 2005-12-26 |
|
| 19 | + */ |
|
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | $protocol = 'http'; |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | echo PMF_Language::languageOptions( |
| 99 | 99 | str_replace( |
| 100 | 100 | array( |
| 101 | - 'language_', |
|
| 102 | - '.php' |
|
| 101 | + 'language_', |
|
| 102 | + '.php' |
|
| 103 | 103 | ), |
| 104 | 104 | '', |
| 105 | 105 | $faqConfig->get('main.language') |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | } else { |
| 111 | 111 | echo '<option value="language_en.php">English</option>'; |
| 112 | 112 | } |
| 113 | - break; |
|
| 113 | + break; |
|
| 114 | 114 | |
| 115 | 115 | case 'records.orderby': |
| 116 | 116 | echo PMF_Configuration::sortingOptions($faqConfig->get($key)); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | ? ' selected="selected"' |
| 148 | 148 | : ''; |
| 149 | 149 | printf('<option value="%d"%s>%s</option>', |
| 150 | - $i, $selected, $item); |
|
| 150 | + $i, $selected, $item); |
|
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | |
@@ -51,102 +51,102 @@ |
||
| 51 | 51 | switch($ajax_action) { |
| 52 | 52 | |
| 53 | 53 | // save active FAQs |
| 54 | - case 'save_active_records': |
|
| 55 | - if ($permission['approverec']) { |
|
| 56 | - if (!empty($items)) { |
|
| 57 | - $faq = new PMF_Faq($faqConfig); |
|
| 54 | + case 'save_active_records': |
|
| 55 | + if ($permission['approverec']) { |
|
| 56 | + if (!empty($items)) { |
|
| 57 | + $faq = new PMF_Faq($faqConfig); |
|
| 58 | 58 | |
| 59 | - foreach ($items as $item) { |
|
| 60 | - if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) { |
|
| 61 | - echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'active'); |
|
| 59 | + foreach ($items as $item) { |
|
| 60 | + if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) { |
|
| 61 | + echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'active'); |
|
| 62 | + } |
|
| 62 | 63 | } |
| 63 | 64 | } |
| 65 | + } else { |
|
| 66 | + echo $PMF_LANG['err_NotAuth']; |
|
| 64 | 67 | } |
| 65 | - } else { |
|
| 66 | - echo $PMF_LANG['err_NotAuth']; |
|
| 67 | - } |
|
| 68 | - break; |
|
| 68 | + break; |
|
| 69 | 69 | |
| 70 | - // save sticky FAQs |
|
| 71 | - case 'save_sticky_records': |
|
| 72 | - if ($permission['editbt']) { |
|
| 70 | + // save sticky FAQs |
|
| 71 | + case 'save_sticky_records': |
|
| 72 | + if ($permission['editbt']) { |
|
| 73 | 73 | |
| 74 | - if (!empty($items)) { |
|
| 75 | - $faq = new PMF_Faq($faqConfig); |
|
| 74 | + if (!empty($items)) { |
|
| 75 | + $faq = new PMF_Faq($faqConfig); |
|
| 76 | 76 | |
| 77 | - foreach ($items as $item) { |
|
| 78 | - if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) { |
|
| 79 | - echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'sticky'); |
|
| 77 | + foreach ($items as $item) { |
|
| 78 | + if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) { |
|
| 79 | + echo $faq->updateRecordFlag((int)$item[0], addslashes($item[1]), $item[2], 'sticky'); |
|
| 80 | + } |
|
| 80 | 81 | } |
| 81 | 82 | } |
| 83 | + } else { |
|
| 84 | + echo $PMF_LANG['err_NotAuth']; |
|
| 82 | 85 | } |
| 83 | - } else { |
|
| 84 | - echo $PMF_LANG['err_NotAuth']; |
|
| 85 | - } |
|
| 86 | - break; |
|
| 86 | + break; |
|
| 87 | 87 | |
| 88 | - // search FAQs for suggestions |
|
| 89 | - case 'search_records': |
|
| 90 | - if ($permission['editbt']) { |
|
| 88 | + // search FAQs for suggestions |
|
| 89 | + case 'search_records': |
|
| 90 | + if ($permission['editbt']) { |
|
| 91 | 91 | |
| 92 | - $faq = new PMF_Faq($faqConfig); |
|
| 93 | - $faqSearch = new PMF_Search($faqConfig); |
|
| 94 | - $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig); |
|
| 95 | - $searchResult = ''; |
|
| 96 | - $searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED); |
|
| 92 | + $faq = new PMF_Faq($faqConfig); |
|
| 93 | + $faqSearch = new PMF_Search($faqConfig); |
|
| 94 | + $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig); |
|
| 95 | + $searchResult = ''; |
|
| 96 | + $searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED); |
|
| 97 | 97 | |
| 98 | - if (!is_null($searchString)) { |
|
| 99 | - $searchResult = $faqSearch->search($searchString, false); |
|
| 98 | + if (!is_null($searchString)) { |
|
| 99 | + $searchResult = $faqSearch->search($searchString, false); |
|
| 100 | 100 | |
| 101 | - $faqSearchResult->reviewResultset($searchResult); |
|
| 101 | + $faqSearchResult->reviewResultset($searchResult); |
|
| 102 | 102 | |
| 103 | - $searchHelper = new PMF_Helper_Search($faqConfig); |
|
| 104 | - $searchHelper->setSearchterm($searchString); |
|
| 103 | + $searchHelper = new PMF_Helper_Search($faqConfig); |
|
| 104 | + $searchHelper->setSearchterm($searchString); |
|
| 105 | 105 | |
| 106 | - echo $searchHelper->renderAdminSuggestionResult($faqSearchResult); |
|
| 107 | - } |
|
| 106 | + echo $searchHelper->renderAdminSuggestionResult($faqSearchResult); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - } else { |
|
| 110 | - echo $PMF_LANG['err_NotAuth']; |
|
| 111 | - } |
|
| 112 | - break; |
|
| 109 | + } else { |
|
| 110 | + echo $PMF_LANG['err_NotAuth']; |
|
| 111 | + } |
|
| 112 | + break; |
|
| 113 | 113 | |
| 114 | - // delete FAQs |
|
| 115 | - case 'delete_record': |
|
| 116 | - if ($permission['delbt']) { |
|
| 114 | + // delete FAQs |
|
| 115 | + case 'delete_record': |
|
| 116 | + if ($permission['delbt']) { |
|
| 117 | 117 | |
| 118 | - $recordId = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT); |
|
| 119 | - $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING); |
|
| 118 | + $recordId = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT); |
|
| 119 | + $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING); |
|
| 120 | 120 | |
| 121 | - $logging = new PMF_Logging($faqConfig); |
|
| 122 | - $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId); |
|
| 121 | + $logging = new PMF_Logging($faqConfig); |
|
| 122 | + $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId); |
|
| 123 | 123 | |
| 124 | - $faq->deleteRecord($recordId, $recordLang); |
|
| 125 | - echo $PMF_LANG['ad_entry_delsuc']; |
|
| 124 | + $faq->deleteRecord($recordId, $recordLang); |
|
| 125 | + echo $PMF_LANG['ad_entry_delsuc']; |
|
| 126 | 126 | |
| 127 | - } else { |
|
| 128 | - echo $PMF_LANG['err_NotAuth']; |
|
| 129 | - } |
|
| 130 | - break; |
|
| 131 | - |
|
| 132 | - // delete open questions |
|
| 133 | - case 'delete_question': |
|
| 134 | - if ($permission['delquestion']) { |
|
| 135 | - |
|
| 136 | - $checks = array( |
|
| 137 | - 'filter' => FILTER_VALIDATE_INT, |
|
| 138 | - 'flags' => FILTER_REQUIRE_ARRAY |
|
| 139 | - ); |
|
| 140 | - $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks)); |
|
| 141 | - |
|
| 142 | - if (!is_null($questionIds['questions'])) { |
|
| 143 | - foreach ($questionIds['questions'] as $questionId) { |
|
| 144 | - $faq->deleteQuestion((int)$questionId); |
|
| 127 | + } else { |
|
| 128 | + echo $PMF_LANG['err_NotAuth']; |
|
| 129 | + } |
|
| 130 | + break; |
|
| 131 | + |
|
| 132 | + // delete open questions |
|
| 133 | + case 'delete_question': |
|
| 134 | + if ($permission['delquestion']) { |
|
| 135 | + |
|
| 136 | + $checks = array( |
|
| 137 | + 'filter' => FILTER_VALIDATE_INT, |
|
| 138 | + 'flags' => FILTER_REQUIRE_ARRAY |
|
| 139 | + ); |
|
| 140 | + $questionIds = PMF_Filter::filterInputArray(INPUT_POST, array('questions' => $checks)); |
|
| 141 | + |
|
| 142 | + if (!is_null($questionIds['questions'])) { |
|
| 143 | + foreach ($questionIds['questions'] as $questionId) { |
|
| 144 | + $faq->deleteQuestion((int)$questionId); |
|
| 145 | + } |
|
| 145 | 146 | } |
| 147 | + echo $PMF_LANG['ad_entry_delsuc']; |
|
| 148 | + } else { |
|
| 149 | + echo $PMF_LANG['err_NotAuth']; |
|
| 146 | 150 | } |
| 147 | - echo $PMF_LANG['ad_entry_delsuc']; |
|
| 148 | - } else { |
|
| 149 | - echo $PMF_LANG['err_NotAuth']; |
|
| 150 | - } |
|
| 151 | - break; |
|
| 151 | + break; |
|
| 152 | 152 | } |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | $protocol = 'http'; |
| 23 | - if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
| 23 | + if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
| 24 | 24 | $protocol = 'https'; |
| 25 | 25 | } |
| 26 | - header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); |
|
| 26 | + header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
|
| 27 | 27 | exit(); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $items[0][2] = 0; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -switch($ajax_action) { |
|
| 51 | +switch ($ajax_action) { |
|
| 52 | 52 | |
| 53 | 53 | // save active FAQs |
| 54 | 54 | case 'save_active_records': |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $recordLang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING); |
| 120 | 120 | |
| 121 | 121 | $logging = new PMF_Logging($faqConfig); |
| 122 | - $logging->logAdmin($user, 'Deleted FAQ ID ' . $recordId); |
|
| 122 | + $logging->logAdmin($user, 'Deleted FAQ ID '.$recordId); |
|
| 123 | 123 | |
| 124 | 124 | $faq->deleteRecord($recordId, $recordLang); |
| 125 | 125 | echo $PMF_LANG['ad_entry_delsuc']; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | case 'delete_question': |
| 134 | 134 | if ($permission['delquestion']) { |
| 135 | 135 | |
| 136 | - $checks = array( |
|
| 136 | + $checks = array( |
|
| 137 | 137 | 'filter' => FILTER_VALIDATE_INT, |
| 138 | 138 | 'flags' => FILTER_REQUIRE_ARRAY |
| 139 | 139 | ); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // |
| 29 | 29 | // Bootstrapping |
| 30 | 30 | // |
| 31 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
| 31 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Initialize attachment factory |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | $Language = new PMF_Language($faqConfig); |
| 47 | 47 | $LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language')); |
| 48 | 48 | |
| 49 | -require_once PMF_ROOT_DIR . '/lang/language_en.php'; |
|
| 49 | +require_once PMF_ROOT_DIR.'/lang/language_en.php'; |
|
| 50 | 50 | |
| 51 | 51 | if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) { |
| 52 | - require_once PMF_ROOT_DIR . '/lang/language_'.$LANGCODE.'.php'; |
|
| 52 | + require_once PMF_ROOT_DIR.'/lang/language_'.$LANGCODE.'.php'; |
|
| 53 | 53 | } else { |
| 54 | 54 | $LANGCODE = 'en'; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $auth = false; |
| 58 | 58 | $user = PMF_User_CurrentUser::getFromCookie($faqConfig); |
| 59 | -if (! $user instanceof PMF_User_CurrentUser) { |
|
| 59 | +if (!$user instanceof PMF_User_CurrentUser) { |
|
| 60 | 60 | $user = PMF_User_CurrentUser::getFromSession($faqConfig); |
| 61 | 61 | } |
| 62 | 62 | if ($user) { |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | <?php |
| 120 | 120 | } |
| 121 | 121 | if (is_null($currentAction) && $auth && $permission['addattachment']) { |
| 122 | - $recordId = filter_input(INPUT_GET, 'record_id', FILTER_VALIDATE_INT); |
|
| 122 | + $recordId = filter_input(INPUT_GET, 'record_id', FILTER_VALIDATE_INT); |
|
| 123 | 123 | $recordLang = filter_input(INPUT_GET, 'record_lang', FILTER_SANITIZE_STRING); |
| 124 | 124 | ?> |
| 125 | 125 | <form action="attachment.php?action=save" enctype="multipart/form-data" method="post" accept-charset="utf-8"> |
| 126 | 126 | <fieldset> |
| 127 | 127 | <legend> |
| 128 | 128 | <?php echo $PMF_LANG["ad_att_addto"]." ".$PMF_LANG["ad_att_addto_2"]; ?> |
| 129 | - (max <?php echo round($faqConfig->get('records.maxAttachmentSize') / pow(1024, 2), 2) ?> MB) |
|
| 129 | + (max <?php echo round($faqConfig->get('records.maxAttachmentSize')/pow(1024, 2), 2) ?> MB) |
|
| 130 | 130 | </legend> |
| 131 | 131 | <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $faqConfig->get('records.maxAttachmentSize'); ?>" /> |
| 132 | 132 | <input type="hidden" name="record_id" value="<?php echo $recordId; ?>" /> |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (!is_null($currentSave) && $currentSave == true && $auth && $permission['addattachment']) { |
| 155 | - $recordId = filter_input(INPUT_POST, 'record_id', FILTER_VALIDATE_INT); |
|
| 155 | + $recordId = filter_input(INPUT_POST, 'record_id', FILTER_VALIDATE_INT); |
|
| 156 | 156 | $recordLang = filter_input(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING); |
| 157 | 157 | ?> |
| 158 | 158 | <p><strong><?php echo $PMF_LANG["ad_att_addto"]." ".$PMF_LANG["ad_att_addto_2"]; ?></strong></p> |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | '<p>%s</p>', |
| 195 | 195 | sprintf( |
| 196 | 196 | $PMF_LANG['ad_attach_4'], |
| 197 | - round($faqConfig->get('records.maxAttachmentSize') / pow(1024, 2), 2) |
|
| 197 | + round($faqConfig->get('records.maxAttachmentSize')/pow(1024, 2), 2) |
|
| 198 | 198 | ) |
| 199 | 199 | ); |
| 200 | 200 | |
@@ -75,8 +75,9 @@ |
||
| 75 | 75 | // check user rights, set them TRUE |
| 76 | 76 | $allUserRights = $user->perm->getAllUserRights($user->getUserId()); |
| 77 | 77 | foreach ($allRights as $right) { |
| 78 | - if (in_array($right['right_id'], $allUserRights)) |
|
| 79 | - $permission[$right['name']] = true; |
|
| 78 | + if (in_array($right['right_id'], $allUserRights)) { |
|
| 79 | + $permission[$right['name']] = true; |
|
| 80 | + } |
|
| 80 | 81 | } |
| 81 | 82 | } |
| 82 | 83 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // |
| 27 | 27 | // Check if config/database.php exist -> if not, redirect to installer |
| 28 | 28 | // |
| 29 | -if (!file_exists(PMF_ROOT_DIR . '/config/database.php')) { |
|
| 29 | +if (!file_exists(PMF_ROOT_DIR.'/config/database.php')) { |
|
| 30 | 30 | header("Location: ".str_replace('admin/index.php', '', $_SERVER['SCRIPT_NAME']).'install/setup.php'); |
| 31 | 31 | exit(); |
| 32 | 32 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | // |
| 40 | 40 | // Bootstrapping |
| 41 | 41 | // |
| 42 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
| 42 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
| 43 | 43 | |
| 44 | 44 | // get language (default: english) |
| 45 | 45 | $Language = new PMF_Language($faqConfig); |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) { |
| 52 | 52 | // Overwrite English strings with the ones we have in the current language |
| 53 | - if (! file_exists(PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php')) { |
|
| 53 | + if (!file_exists(PMF_ROOT_DIR.'/lang/language_'.$LANGCODE.'.php')) { |
|
| 54 | 54 | $LANGCODE = 'en'; |
| 55 | 55 | } |
| 56 | - require PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php'; |
|
| 56 | + require PMF_ROOT_DIR.'/lang/language_'.$LANGCODE.'.php'; |
|
| 57 | 57 | } else { |
| 58 | 58 | $LANGCODE = 'en'; |
| 59 | 59 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } else { |
| 144 | 144 | // error |
| 145 | 145 | $logging = new PMF_Logging($faqConfig); |
| 146 | - $logging->logAdmin($user, 'Loginerror\nLogin: '.$faqusername.'\nErrors: ' . implode(', ', $user->errors)); |
|
| 146 | + $logging->logAdmin($user, 'Loginerror\nLogin: '.$faqusername.'\nErrors: '.implode(', ', $user->errors)); |
|
| 147 | 147 | $error = $PMF_LANG['ad_auth_fail']; |
| 148 | 148 | $user = null; |
| 149 | 149 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | // Try to authenticate with cookie information |
| 152 | 152 | $user = PMF_User_CurrentUser::getFromCookie($faqConfig); |
| 153 | 153 | // authenticate with session information |
| 154 | - if (! $user instanceof PMF_User_CurrentUser) { |
|
| 154 | + if (!$user instanceof PMF_User_CurrentUser) { |
|
| 155 | 155 | $user = PMF_User_CurrentUser::getFromSession($faqConfig); |
| 156 | 156 | } |
| 157 | 157 | if ($user instanceof PMF_User_CurrentUser) { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $auth = null; |
| 185 | 185 | $ssoLogout = $faqConfig->get('security.ssoLogoutRedirect'); |
| 186 | 186 | if ($faqConfig->get('security.ssoSupport') && !empty ($ssoLogout)) { |
| 187 | - header ("Location: $ssoLogout"); |
|
| 187 | + header("Location: $ssoLogout"); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | // are we running a PMF export file request? |
| 253 | -switch($action) { |
|
| 253 | +switch ($action) { |
|
| 254 | 254 | case 'exportfile': |
| 255 | 255 | require 'export.file.php'; |
| 256 | 256 | exit(); |
@@ -75,8 +75,9 @@ |
||
| 75 | 75 | // check user rights, set them TRUE |
| 76 | 76 | $allUserRights = $user->perm->getAllUserRights($user->getUserId()); |
| 77 | 77 | foreach ($allRights as $right) { |
| 78 | - if (in_array($right['right_id'], $allUserRights)) |
|
| 79 | - $permission[$right['name']] = true; |
|
| 78 | + if (in_array($right['right_id'], $allUserRights)) { |
|
| 79 | + $permission[$right['name']] = true; |
|
| 80 | + } |
|
| 80 | 81 | } |
| 81 | 82 | } |
| 82 | 83 | |
@@ -1,25 +1,25 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The main admin backend index file |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Administraion |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @author Bastian Poettner <[email protected]> |
|
| 15 | - * @author Meikel Katzengreis <[email protected]> |
|
| 16 | - * @author Minoru TODA <[email protected]> |
|
| 17 | - * @author Matteo Scaramuccia <[email protected]> |
|
| 18 | - * @copyright 2002-2016 phpMyFAQ Team |
|
| 19 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 20 | - * @link http://www.phpmyfaq.de |
|
| 21 | - * @since 2002-09-16 |
|
| 22 | - */ |
|
| 3 | + * The main admin backend index file |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Administraion |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @author Bastian Poettner <[email protected]> |
|
| 15 | + * @author Meikel Katzengreis <[email protected]> |
|
| 16 | + * @author Minoru TODA <[email protected]> |
|
| 17 | + * @author Matteo Scaramuccia <[email protected]> |
|
| 18 | + * @copyright 2002-2016 phpMyFAQ Team |
|
| 19 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 20 | + * @link http://www.phpmyfaq.de |
|
| 21 | + * @since 2002-09-16 |
|
| 22 | + */ |
|
| 23 | 23 | |
| 24 | 24 | define('PMF_ROOT_DIR', dirname(__DIR__)); |
| 25 | 25 | |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 24 | 24 | $protocol = 'http'; |
| 25 | - if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
| 25 | + if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
| 26 | 26 | $protocol = 'https'; |
| 27 | 27 | } |
| 28 | - header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); |
|
| 28 | + header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
|
| 29 | 29 | exit(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { |
| 57 | 57 | $csrfOkay = false; |
| 58 | 58 | } |
| 59 | - if (0 === (int) $userId || !$csrfOkay) { |
|
| 59 | + if (0 === (int)$userId || !$csrfOkay) { |
|
| 60 | 60 | $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_noId']); |
| 61 | 61 | } else { |
| 62 | 62 | $user = new PMF_User($faqConfig); |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | $stats = $user->getStatus(); |
| 100 | 100 | // set new password an send email if user is switched to active |
| 101 | 101 | if ($stats == 'blocked' && $userStatus == 'active') { |
| 102 | - $consonants = array("b","c","d","f","g","h","j","k","l","m","n","p","r","s","t","v","w","x","y","z"); |
|
| 103 | - $vowels = array("a","e","i","o","u"); |
|
| 102 | + $consonants = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z"); |
|
| 103 | + $vowels = array("a", "e", "i", "o", "u"); |
|
| 104 | 104 | $newPassword = ''; |
| 105 | 105 | srand((double)microtime()*1000000); |
| 106 | 106 | for ($i = 1; $i <= 4; $i++) { |
| 107 | - $newPassword .= $consonants[rand(0,19)]; |
|
| 108 | - $newPassword .= $vowels[rand(0,4)]; |
|
| 107 | + $newPassword .= $consonants[rand(0, 19)]; |
|
| 108 | + $newPassword .= $vowels[rand(0, 4)]; |
|
| 109 | 109 | } |
| 110 | 110 | $user->changePassword($newPassword); |
| 111 | 111 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { |
| 186 | 186 | $csrfOkay = false; |
| 187 | 187 | } |
| 188 | - if (0 === (int) $userId || !$csrfOkay) { |
|
| 188 | + if (0 === (int)$userId || !$csrfOkay) { |
|
| 189 | 189 | $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_noId']); |
| 190 | 190 | } else { |
| 191 | 191 | if (!$user->getUserById($userId, true)) { |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $userAction = 'add'; |
| 282 | 282 | $message = '<p class="alert alert-error">'; |
| 283 | 283 | foreach ($messages as $err) { |
| 284 | - $message .= $err . '<br />'; |
|
| 284 | + $message .= $err.'<br />'; |
|
| 285 | 285 | } |
| 286 | 286 | $message .= '</p>'; |
| 287 | 287 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | <?php |
| 523 | 523 | if (isset($_GET['user_id'])) { |
| 524 | - $userId = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT, 0); |
|
| 524 | + $userId = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT, 0); |
|
| 525 | 525 | echo '<script type="text/javascript">updateUser('.$userId.');</script>'; |
| 526 | 526 | } |
| 527 | 527 | } |
@@ -533,8 +533,8 @@ discard block |
||
| 533 | 533 | $numUsers = count($allUsers); |
| 534 | 534 | $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 0); |
| 535 | 535 | $perPage = 10; |
| 536 | - $numPages = ceil($numUsers / $perPage); |
|
| 537 | - $lastPage = $page * $perPage; |
|
| 536 | + $numPages = ceil($numUsers/$perPage); |
|
| 537 | + $lastPage = $page*$perPage; |
|
| 538 | 538 | $firstPage = $lastPage - $perPage; |
| 539 | 539 | |
| 540 | 540 | $baseUrl = sprintf( |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | <tr class="row_user_id_<?php print $user->getUserId() ?>"> |
| 603 | 603 | <td><?php print $user->getUserId() ?></td> |
| 604 | 604 | <td><i class="<?php |
| 605 | - switch($user->getStatus()) { |
|
| 605 | + switch ($user->getStatus()) { |
|
| 606 | 606 | case 'active': |
| 607 | 607 | echo "icon-ok"; |
| 608 | 608 | break; |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Displays the user managment frontend |
|
| 4 | - * |
|
| 5 | - * PHP 5.2 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Administration |
|
| 13 | - * @author Lars Tiedemann <[email protected]> |
|
| 14 | - * @author Uwe Pries <[email protected]> |
|
| 15 | - * @author Sarah Hermann <[email protected]> |
|
| 16 | - * @author Thorsten Rinne <[email protected]> |
|
| 17 | - * @copyright 2005-2016 phpMyFAQ Team |
|
| 18 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 19 | - * @link http://www.phpmyfaq.de |
|
| 20 | - * @since 2005-12-15 |
|
| 21 | - */ |
|
| 3 | + * Displays the user managment frontend |
|
| 4 | + * |
|
| 5 | + * PHP 5.2 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Administration |
|
| 13 | + * @author Lars Tiedemann <[email protected]> |
|
| 14 | + * @author Uwe Pries <[email protected]> |
|
| 15 | + * @author Sarah Hermann <[email protected]> |
|
| 16 | + * @author Thorsten Rinne <[email protected]> |
|
| 17 | + * @copyright 2005-2016 phpMyFAQ Team |
|
| 18 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 19 | + * @link http://www.phpmyfaq.de |
|
| 20 | + * @since 2005-12-15 |
|
| 21 | + */ |
|
| 22 | 22 | |
| 23 | 23 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 24 | 24 | $protocol = 'http'; |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | $protocol = 'http'; |
| 23 | - if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
| 23 | + if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
| 24 | 24 | $protocol = 'https'; |
| 25 | 25 | } |
| 26 | - header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); |
|
| 26 | + header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
|
| 27 | 27 | exit(); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $perpage = 15; |
| 35 | 35 | $pages = PMF_Filter::filterInput(INPUT_GET, 'pages', FILTER_VALIDATE_INT); |
| 36 | - $page = PMF_Filter::filterInput(INPUT_GET, 'page' , FILTER_VALIDATE_INT, 1); |
|
| 36 | + $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 1); |
|
| 37 | 37 | |
| 38 | 38 | $search = new PMF_Search($faqConfig); |
| 39 | 39 | $searchesCount = $search->getSearchesCount(); |
| 40 | 40 | $searchesList = $search->getMostPopularSearches($searchesCount + 1, true); |
| 41 | 41 | |
| 42 | 42 | if (is_null($pages)) { |
| 43 | - $pages = round((count($searchesList) + ($perpage / 3)) / $perpage, 0); |
|
| 43 | + $pages = round((count($searchesList) + ($perpage/3))/$perpage, 0); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $start = ($page - 1) * $perpage; |
|
| 46 | + $start = ($page - 1)*$perpage; |
|
| 47 | 47 | $ende = $start + $perpage; |
| 48 | 48 | |
| 49 | 49 | $baseUrl = sprintf( |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $counter = $displayedCounter = 0; |
| 84 | 84 | $self = substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT'])); |
| 85 | 85 | |
| 86 | - foreach($searchesList as $searchItem) { |
|
| 86 | + foreach ($searchesList as $searchItem) { |
|
| 87 | 87 | |
| 88 | 88 | if ($displayedCounter >= $perpage) { |
| 89 | 89 | $displayedCounter++; |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | $displayedCounter++; |
| 98 | 98 | |
| 99 | - $num = round(($searchItem['number']*100 / $searchesCount), 2); |
|
| 99 | + $num = round(($searchItem['number']*100/$searchesCount), 2); |
|
| 100 | 100 | ?> |
| 101 | 101 | <tr class="row_search_id_<?php echo $searchItem['id'] ?>"> |
| 102 | - <td><?php echo PMF_String::htmlspecialchars($searchItem['searchterm']); ?></td> |
|
| 102 | + <td><?php echo PMF_String::htmlspecialchars($searchItem['searchterm']); ?></td> |
|
| 103 | 103 | <td><?php echo $searchItem['number'] ?></td> |
| 104 | 104 | <td><?php echo $languageCodes[PMF_String::strtoupper($searchItem['lang'])] ?></td> |
| 105 | 105 | <td> |
@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Frontend for search log statistics |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Administration |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @author Thorsten Rinne <[email protected]> |
|
| 15 | - * @copyright 2003-2016 phpMyFAQ Team |
|
| 16 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | - * @link http://www.phpmyfaq.de |
|
| 18 | - * @since 2003-03-30 |
|
| 19 | - */ |
|
| 3 | + * Frontend for search log statistics |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Administration |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @author Thorsten Rinne <[email protected]> |
|
| 15 | + * @copyright 2003-2016 phpMyFAQ Team |
|
| 16 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | + * @link http://www.phpmyfaq.de |
|
| 18 | + * @since 2003-03-30 |
|
| 19 | + */ |
|
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | $protocol = 'http'; |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | // |
| 28 | 28 | // Bootstrapping |
| 29 | 29 | // |
| 30 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
| 30 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
| 31 | 31 | |
| 32 | 32 | $action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING); |
| 33 | 33 | |
| 34 | 34 | $auth = false; |
| 35 | 35 | $user = PMF_User_CurrentUser::getFromCookie($faqConfig); |
| 36 | -if (! $user instanceof PMF_User_CurrentUser) { |
|
| 36 | +if (!$user instanceof PMF_User_CurrentUser) { |
|
| 37 | 37 | $user = PMF_User_CurrentUser::getFromSession($faqConfig); |
| 38 | 38 | } |
| 39 | 39 | if ($user) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | if ($permission['backup']) { |
| 68 | 68 | |
| 69 | 69 | $tables = $tableNames = $faqConfig->getDb()->getTableNames(PMF_Db::getTablePrefix()); |
| 70 | - $tablePrefix = (PMF_Db::getTablePrefix() !== '') ? PMF_Db::getTablePrefix() . '.phpmyfaq' : 'phpmyfaq'; |
|
| 70 | + $tablePrefix = (PMF_Db::getTablePrefix() !== '') ? PMF_Db::getTablePrefix().'.phpmyfaq' : 'phpmyfaq'; |
|
| 71 | 71 | $tableNames = ''; |
| 72 | 72 | $majorVersion = substr($faqConfig->get('main.currentVersion'), 0, 3); |
| 73 | 73 | $dbHelper = new PMF_DB_Helper($faqConfig); |
@@ -75,24 +75,24 @@ discard block |
||
| 75 | 75 | switch ($action) { |
| 76 | 76 | case 'backup_content' : |
| 77 | 77 | foreach ($tables as $table) { |
| 78 | - if ((PMF_Db::getTablePrefix() . 'faqadminlog' == trim($table)) || (PMF_Db::getTablePrefix() . 'faqsessions' == trim($table))) { |
|
| 78 | + if ((PMF_Db::getTablePrefix().'faqadminlog' == trim($table)) || (PMF_Db::getTablePrefix().'faqsessions' == trim($table))) { |
|
| 79 | 79 | continue; |
| 80 | 80 | } |
| 81 | - $tableNames .= $table . ' '; |
|
| 81 | + $tableNames .= $table.' '; |
|
| 82 | 82 | } |
| 83 | 83 | break; |
| 84 | 84 | case 'backup_logs' : |
| 85 | 85 | foreach ($tables as $table) { |
| 86 | - if ((PMF_Db::getTablePrefix() . 'faqadminlog' == trim($table)) || (PMF_Db::getTablePrefix() . 'faqsessions' == trim($table))) { |
|
| 87 | - $tableNames .= $table . ' '; |
|
| 86 | + if ((PMF_Db::getTablePrefix().'faqadminlog' == trim($table)) || (PMF_Db::getTablePrefix().'faqsessions' == trim($table))) { |
|
| 87 | + $tableNames .= $table.' '; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | break; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $text[] = "-- pmf" . $majorVersion . ": " . $tableNames; |
|
| 93 | + $text[] = "-- pmf".$majorVersion.": ".$tableNames; |
|
| 94 | 94 | $text[] = "-- DO NOT REMOVE THE FIRST LINE!"; |
| 95 | - $text[] = "-- pmftableprefix: " . PMF_Db::getTablePrefix(); |
|
| 95 | + $text[] = "-- pmftableprefix: ".PMF_Db::getTablePrefix(); |
|
| 96 | 96 | $text[] = "-- DO NOT REMOVE THE LINES ABOVE!"; |
| 97 | 97 | $text[] = "-- Otherwise this backup will be broken."; |
| 98 | 98 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | header($header); |
| 107 | 107 | foreach (explode(' ', $tableNames) as $table) { |
| 108 | 108 | print implode("\r\n", $text); |
| 109 | - $text = $dbHelper->buildInsertQueries("SELECT * FROM " . $table, $table); |
|
| 109 | + $text = $dbHelper->buildInsertQueries("SELECT * FROM ".$table, $table); |
|
| 110 | 110 | } |
| 111 | 111 | break; |
| 112 | 112 | case 'backup_logs' : |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | header($header); |
| 119 | 119 | foreach (explode(' ', $tableNames) as $table) { |
| 120 | 120 | print implode("\r\n", $text); |
| 121 | - $text = $dbHelper->buildInsertQueries("SELECT * FROM " . $table, $table); |
|
| 121 | + $text = $dbHelper->buildInsertQueries("SELECT * FROM ".$table, $table); |
|
| 122 | 122 | } |
| 123 | 123 | break; |
| 124 | 124 | } |
@@ -75,8 +75,9 @@ |
||
| 75 | 75 | // check user rights, set them TRUE |
| 76 | 76 | $allUserRights = $user->perm->getAllUserRights($user->getUserId()); |
| 77 | 77 | foreach ($allRights as $right) { |
| 78 | - if (in_array($right['right_id'], $allUserRights)) |
|
| 79 | - $permission[$right['name']] = true; |
|
| 78 | + if (in_array($right['right_id'], $allUserRights)) { |
|
| 79 | + $permission[$right['name']] = true; |
|
| 80 | + } |
|
| 80 | 81 | } |
| 81 | 82 | } |
| 82 | 83 | |