@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | // you want to allow, and if so: |
| 24 | 24 | header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); |
| 25 | 25 | header('Access-Control-Allow-Credentials: true'); |
| 26 | - header('Access-Control-Max-Age: 86400'); // cache for 1 day |
|
| 26 | + header('Access-Control-Max-Age: 86400'); // cache for 1 day |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Access-Control headers are received during OPTIONS requests |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | if (is_numeric($val)) { |
| 92 | - $int = (int)$val; |
|
| 93 | - $float = (float)$val; |
|
| 92 | + $int = (int) $val; |
|
| 93 | + $float = (float) $val; |
|
| 94 | 94 | |
| 95 | 95 | $val = ($int == $float) ? $int : $float; |
| 96 | 96 | return $val; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | function get_includes() |
| 179 | 179 | { |
| 180 | - $included = array_values(array_filter(array_map(function ($arr) { |
|
| 180 | + $included = array_values(array_filter(array_map(function($arr) { |
|
| 181 | 181 | if (is_string($arr)) { |
| 182 | 182 | if (strpos($arr, 'vendor')) { |
| 183 | 183 | return ''; |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function cors() |
| 17 | 17 | { |
| 18 | - if (!headers_sent()) return; |
|
| 18 | + if (!headers_sent()) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 19 | 21 | |
| 20 | 22 | // Allow from any origin |
| 21 | 23 | if (isset($_SERVER['HTTP_ORIGIN'])) { |
@@ -151,7 +153,9 @@ discard block |
||
| 151 | 153 | if (!file_exists(dirname($file))) { |
| 152 | 154 | mkdir(dirname($file)); |
| 153 | 155 | } |
| 154 | - if (file_exists($file)) delete($file); |
|
| 156 | + if (file_exists($file)) { |
|
| 157 | + delete($file); |
|
| 158 | + } |
|
| 155 | 159 | file_put_contents($file, $content, ($append ? FILE_APPEND : 0)); |
| 156 | 160 | } |
| 157 | 161 | |
@@ -19,9 +19,13 @@ |
||
| 19 | 19 | $thePost = $_POST[$name]; |
| 20 | 20 | if ($flag != POST_DEFAULT_FLAG) { |
| 21 | 21 | if ($flag == POST_NOT_NULL) { |
| 22 | - if ($thePost != null) return $thePost; |
|
| 22 | + if ($thePost != null) { |
|
| 23 | + return $thePost; |
|
| 24 | + } |
|
| 23 | 25 | } else if ($flag == POST_NOT_EMPTY) { |
| 24 | - if (!empty($thePost)) return $thePost; |
|
| 26 | + if (!empty($thePost)) { |
|
| 27 | + return $thePost; |
|
| 28 | + } |
|
| 25 | 29 | } |
| 26 | 30 | } else { |
| 27 | 31 | return $thePost; |
@@ -9,7 +9,11 @@ |
||
| 9 | 9 | function current_timestamp($date = null) |
| 10 | 10 | { |
| 11 | 11 | $timestamp = $date; |
| 12 | - if (is_string($date)) $timestamp = strtotime($date); |
|
| 13 | - if (is_null($date)) $timestamp = time(); |
|
| 12 | + if (is_string($date)) { |
|
| 13 | + $timestamp = strtotime($date); |
|
| 14 | + } |
|
| 15 | + if (is_null($date)) { |
|
| 16 | + $timestamp = time(); |
|
| 17 | + } |
|
| 14 | 18 | return date("Y-m-d H:i:s", $timestamp); |
| 15 | 19 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | $username = $_REQUEST['user']; |
| 5 | 5 | $password = $_REQUEST['pass']; |
| 6 | 6 | if (isset($_REQUEST['g-recaptcha-response'])) { |
| 7 | - GoogleExt\recaptcha::verifyCaptcha(function () use ($username, $password) { |
|
| 7 | + GoogleExt\recaptcha::verifyCaptcha(function() use ($username, $password) { |
|
| 8 | 8 | dologin($username, $password); |
| 9 | 9 | }); |
| 10 | 10 | } else { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | if (isset($_REQUEST['check'])) { |
| 16 | - user()->check_login(function ($session) { |
|
| 16 | + user()->check_login(function($session) { |
|
| 17 | 17 | e($session); |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -49,7 +49,9 @@ discard block |
||
| 49 | 49 | public static function get_profile_picture() |
| 50 | 50 | { |
| 51 | 51 | if (!empty(self::get_profile())) { |
| 52 | - if (isset(self::get_profile()['picture'])) return self::get_profile()['picture']; |
|
| 52 | + if (isset(self::get_profile()['picture'])) { |
|
| 53 | + return self::get_profile()['picture']; |
|
| 54 | + } |
|
| 53 | 55 | } |
| 54 | 56 | return 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/480px-No_image_available.svg.png'; |
| 55 | 57 | } |
@@ -57,7 +59,9 @@ discard block |
||
| 57 | 59 | public static function get_profile_name() |
| 58 | 60 | { |
| 59 | 61 | if (!empty(self::get_profile())) { |
| 60 | - if (isset(self::get_profile()['name'])) return self::get_profile()['name']; |
|
| 62 | + if (isset(self::get_profile()['name'])) { |
|
| 63 | + return self::get_profile()['name']; |
|
| 64 | + } |
|
| 61 | 65 | } |
| 62 | 66 | return 'Login Required'; |
| 63 | 67 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | function get_blog_byurl(string $url) |
| 25 | 25 | { |
| 26 | - $blog = $this->service->blogs->getByUrl($url); |
|
| 26 | + $blog = $this->service->blogs->getByUrl($url); |
|
| 27 | 27 | $this->blogid = $blog->getId(); |
| 28 | 28 | return $blog; |
| 29 | 29 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | resolve_dir(ROOT . '/src/Session/sessions'); |
| 12 | 12 | |
| 13 | 13 | // define php error file |
| 14 | -define('PHP_ERROR_FILE', ROOT . '/tmp/php-error.log'); |
|
| 14 | +define('PHP_ERROR_FILE', ROOT . '/tmp/php-error.log'); |
|
| 15 | 15 | |
| 16 | 16 | // define cors detector |
| 17 | 17 | define('CORS', \MVC\helper::cors()); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | throw new Exception('Callback must be function', 1); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - return array_map(function ($key, $val) use ($callback) { |
|
| 256 | + return array_map(function($key, $val) use ($callback) { |
|
| 257 | 257 | return call_user_func($callback, $key, $val); |
| 258 | 258 | }, array_keys($arr), $arr); |
| 259 | 259 | } |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | function maintenance() |
| 9 | 9 | { |
| 10 | - include __DIR__ . '/maintenance.php'; |
|
| 11 | - exit; |
|
| 10 | + include __DIR__ . '/maintenance.php'; |
|
| 11 | + exit; |
|
| 12 | 12 | } |
| 13 | 13 | /** |
| 14 | 14 | * Debug Error |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function show_error() |
| 19 | 19 | { |
| 20 | - error_reporting(E_ALL); |
|
| 21 | - ini_set('display_errors', 'On'); |
|
| 20 | + error_reporting(E_ALL); |
|
| 21 | + ini_set('display_errors', 'On'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function is_admin() |
| 28 | 28 | { |
| 29 | - if (isset($_SESSION['login'])) { |
|
| 30 | - if (isset($_SESSION['login']['role'])) { |
|
| 31 | - return preg_match('/^superadmin$/s', $_SESSION['login']['role']); |
|
| 32 | - } |
|
| 33 | - } |
|
| 29 | + if (isset($_SESSION['login'])) { |
|
| 30 | + if (isset($_SESSION['login']['role'])) { |
|
| 31 | + return preg_match('/^superadmin$/s', $_SESSION['login']['role']); |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | </ul> |
| 41 | 41 | |
| 42 | 42 | <div class="tab-content border" id="myTabContent"> |
| 43 | - <div class="tab-pane fade show active" id="editor" role="tabpanel" aria-labelledby="editor-tab"><textarea id="body" name="body" class="form-control" cols="5"><?php echo isset($singlepost->content) ? htmlentities($singlepost->content) : 'Contet Empty'; ?></textarea></div> |
|
| 43 | + <div class="tab-pane fade show active" id="editor" role="tabpanel" aria-labelledby="editor-tab"><textarea id="body" name="body" class="form-control" cols="5"><?php echo isset($singlepost->content) ? htmlentities($singlepost->content) : 'Contet Empty'; ?></textarea></div> |
|
| 44 | 44 | <div class="tab-pane fade" id="preview" role="tabpanel" aria-labelledby="preview-tab"><iframe id="FileFrame" src="about:blank" frameborder="0" width="100%"></iframe></div> |
| 45 | 45 | </div> |
| 46 | 46 | </div> |