diff --git a/admin/admin.php b/admin/admin.php index c75b667..9df48c6 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -139,7 +139,5 @@ $admin_logs = AdminLog::with('user') - - \ No newline at end of file diff --git a/admin/dashboard.php b/admin/dashboard.php index 7a6d760..d6f3301 100644 --- a/admin/dashboard.php +++ b/admin/dashboard.php @@ -297,8 +297,5 @@ function getRecentadmin($count = 5) { - - - diff --git a/admin/ipbans.php b/admin/ipbans.php index 3f36b92..ca50ca4 100644 --- a/admin/ipbans.php +++ b/admin/ipbans.php @@ -284,7 +284,5 @@ if (isset($_GET['delete'])) { - - \ No newline at end of file diff --git a/admin/pastes.php b/admin/pastes.php index 6a3eba7..fbf464b 100644 --- a/admin/pastes.php +++ b/admin/pastes.php @@ -222,8 +222,6 @@ require_once('common.php'); - - - \ No newline at end of file diff --git a/admin/reports.php b/admin/reports.php index 873c5e4..54e6718 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -291,8 +291,6 @@ if ($last_ip == $ip) { - - - \ No newline at end of file diff --git a/admin/ssp.pastes.php b/admin/ssp.pastes.php deleted file mode 100644 index 65f409d..0000000 --- a/admin/ssp.pastes.php +++ /dev/null @@ -1,397 +0,0 @@ - intval($request['draw']), - "recordsTotal" => intval($recordsTotal), - "recordsFiltered" => intval($recordsFiltered), - "data" => self::data_output($columns2, $data) - ); - } - - - /** - * Connect to the database - * - * @param array $sql_details SQL server connection details array, with the - * properties: - * * host - host name - * * db - database name - * * user - user name - * * pass - user password - * @return resource Database connection handle - */ - static function sql_connect($sql_details) { - try { - $db = @new PDO( - "mysql:host={$sql_details['host']};dbname={$sql_details['db']}", - $sql_details['user'], - $sql_details['pass'], - array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) - ); - } catch (PDOException $e) { - self::fatal( - "An error occurred while connecting to the database. " . - "The error reported by the server was: " . $e->getMessage() - ); - } - - return $db; - } - - - /** - * Execute an SQL query on the database - * - * @param resource $db Database handler - * @param array $bindings Array of PDO binding values from bind() to be - * used for safely escaping strings. Note that this can be given as the - * SQL query string if no bindings are required. - * @param string $sql SQL query to execute. - * @return array Result from the query (all rows) - */ - static function sql_exec($db, $bindings, $sql = null) { - // Argument shifting - if ($sql === null) { - $sql = $bindings; - } - - $stmt = $db->prepare($sql); - //echo $sql; - - // Bind parameters - if (is_array($bindings)) { - for ($i = 0, $ien = count($bindings); $i < $ien; $i++) { - $binding = $bindings[$i]; - $stmt->bindValue($binding['key'], $binding['val'], $binding['type']); - } - } - - // Execute - try { - $stmt->execute(); - } catch (PDOException $e) { - self::fatal("An SQL error occurred: " . $e->getMessage()); - } - $result = $stmt->fetchAll(); - return $result; - } - - static function Ssql_exec($db, $bindings, $sql = null) { - // Argument shifting - if ($sql === null) { - $sql = $bindings; - } - - $stmt = $db->prepare($sql); - - // Bind parameters - if (is_array($bindings)) { - for ($i = 0, $ien = count($bindings); $i < $ien; $i++) { - $binding = $bindings[$i]; - $stmt->bindValue($binding['key'], $binding['val'], $binding['type']); - } - } - - // Execute - try { - $stmt->execute(); - } catch (PDOException $e) { - self::fatal("An SQL error occurred: " . $e->getMessage()); - } - $loop = '0'; - - while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) { - $result[$loop]['id'] = $arr['id']; - $result[$loop]['member'] = $arr['member']; - $result[$loop]['ip'] = $arr['ip']; - $vis = Trim($arr['visible']); - if ($vis == '0') { - $result[$loop]['visible'] = "Public"; - } elseif ($vis == '1') { - $result[$loop]['visible'] = "Unlisted"; - } elseif ($vis == '2') { - $result[$loop]['visible'] = "Private"; - } - $myid = $arr['id']; - $result[$loop]['details'] = " Details "; - $result[$loop]['view'] = " View "; - $result[$loop]['delete'] = " Delete Ban IP "; - $loop = $loop + 1; - } - // Return all - return $result; - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Internal methods - */ - - /** - * Throw a fatal error. - * - * This writes out an error message in a JSON string which DataTables will - * see and show to the user in the browser. - * - * @param string $msg Message to send to the client - */ - static function fatal($msg) { - echo json_encode(array( - "error" => $msg - )); - - exit(0); - } - - /** - * Create a PDO binding key which can be used for escaping variables safely - * when executing a query with sql_exec() - * - * @param array &$a Array of bindings - * @param * $val Value to bind - * @param int $type PDO field type - * @return string Bound key to be used in the SQL where this parameter - * would be used. - */ - static function bind(&$a, $val, $type) { - $key = ':binding_' . count($a); - - $a[] = array( - 'key' => $key, - 'val' => $val, - 'type' => $type - ); - - return $key; - } - - - /** - * Pull a particular property from each assoc. array in a numeric array, - * returning and array of the property values from each item. - * - * @param array $a Array to get data from - * @param string $prop Property to read - * @return array Array of property values - */ - static function pluck($a, $prop) { - $out = array(); - - for ($i = 0, $len = count($a); $i < $len; $i++) { - $out[] = $a[$i][$prop]; - } - - return $out; - } -} - diff --git a/admin/ssp.reports.php b/admin/ssp.reports.php deleted file mode 100644 index 5ff22c5..0000000 --- a/admin/ssp.reports.php +++ /dev/null @@ -1,397 +0,0 @@ - intval($request['draw']), - "recordsTotal" => intval($recordsTotal), - "recordsFiltered" => intval($recordsFiltered), - "data" => self::data_output($columns2, $data) - ); - } - - - /** - * Connect to the database - * - * @param array $sql_details SQL server connection details array, with the - * properties: - * * host - host name - * * db - database name - * * user - user name - * * pass - user password - * @return resource Database connection handle - */ - static function sql_connect($sql_details) { - try { - $db = @new PDO( - "mysql:host={$sql_details['host']};dbname={$sql_details['db']}", - $sql_details['user'], - $sql_details['pass'], - array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) - ); - } catch (PDOException $e) { - self::fatal( - "An error occurred while connecting to the database. " . - "The error reported by the server was: " . $e->getMessage() - ); - } - - return $db; - } - - - /** - * Execute an SQL query on the database - * - * @param resource $db Database handler - * @param array $bindings Array of PDO binding values from bind() to be - * used for safely escaping strings. Note that this can be given as the - * SQL query string if no bindings are required. - * @param string $sql SQL query to execute. - * @return array Result from the query (all rows) - */ - static function sql_exec($db, $bindings, $sql = null) { - // Argument shifting - if ($sql === null) { - $sql = $bindings; - } - - $stmt = $db->prepare($sql); - //echo $sql; - - // Bind parameters - if (is_array($bindings)) { - for ($i = 0, $ien = count($bindings); $i < $ien; $i++) { - $binding = $bindings[$i]; - $stmt->bindValue($binding['key'], $binding['val'], $binding['type']); - } - } - - // Execute - try { - $stmt->execute(); - } catch (PDOException $e) { - self::fatal("An SQL error occurred: " . $e->getMessage()); - } - $result = $stmt->fetchAll(); - return $result; - } - - static function Ssql_exec($db, $bindings, $sql = null) { - // Argument shifting - if ($sql === null) { - $sql = $bindings; - } - - $stmt = $db->prepare($sql); - - // Bind parameters - if (is_array($bindings)) { - for ($i = 0, $ien = count($bindings); $i < $ien; $i++) { - $binding = $bindings[$i]; - $stmt->bindValue($binding['key'], $binding['val'], $binding['type']); - } - } - - // Execute - try { - $stmt->execute(); - } catch (PDOException $e) { - self::fatal("An SQL error occurred: " . $e->getMessage()); - } - $loop = '0'; - - while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) { - $result[$loop]['id'] = $arr['id']; - $result[$loop]['m_report'] = $arr['m_report']; - $result[$loop]['p_report'] = $arr['p_report']; - $vis = Trim($arr['rep_reason']); - if ($vis == '0') { - $result[$loop]['rep_reason'] = "Public"; - } elseif ($vis == '1') { - $result[$loop]['rep_reason'] = "Unlisted"; - } elseif ($vis == '2') { - $result[$loop]['rep_reason'] = "Private"; - } - $rid = $arr['p_report']; - $result[$loop]['details'] = " Details "; - $result[$loop]['view'] = " View "; - $result[$loop]['delete'] = " Remove "; - $result[$loop]['delete'] = " Delete "; - $loop = $loop + 1; - } - // Return all - return $result; - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Internal methods - */ - - /** - * Throw a fatal error. - * - * This writes out an error message in a JSON string which DataTables will - * see and show to the user in the browser. - * - * @param string $msg Message to send to the client - */ - static function fatal($msg) { - echo json_encode(array( - "error" => $msg - )); - - exit(0); - } - - /** - * Create a PDO binding key which can be used for escaping variables safely - * when executing a query with sql_exec() - * - * @param array &$a Array of bindings - * @param * $val Value to bind - * @param int $type PDO field type - * @return string Bound key to be used in the SQL where this parameter - * would be used. - */ - static function bind(&$a, $val, $type) { - $key = ':binding_' . count($a); - - $a[] = array( - 'key' => $key, - 'val' => $val, - 'type' => $type - ); - - return $key; - } - - - /** - * Pull a particular property from each assoc. array in a numeric array, - * returning and array of the property values from each item. - * - * @param array $a Array to get data from - * @param string $prop Property to read - * @return array Array of property values - */ - static function pluck($a, $prop) { - $out = array(); - - for ($i = 0, $len = count($a); $i < $len; $i++) { - $out[] = $a[$i][$prop]; - } - - return $out; - } -} - diff --git a/admin/ssp.users.php b/admin/ssp.users.php deleted file mode 100644 index d622159..0000000 --- a/admin/ssp.users.php +++ /dev/null @@ -1,401 +0,0 @@ - intval($request['draw']), - "recordsTotal" => intval($recordsTotal), - "recordsFiltered" => intval($recordsFiltered), - "data" => self::data_output($columns2, $data) - ); - } - - - /** - * Connect to the database - * - * @param array $sql_details SQL server connection details array, with the - * properties: - * * host - host name - * * db - database name - * * user - user name - * * pass - user password - * @return resource Database connection handle - */ - static function sql_connect($sql_details) { - try { - $db = @new PDO( - "mysql:host={$sql_details['host']};dbname={$sql_details['db']}", - $sql_details['user'], - $sql_details['pass'], - array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) - ); - } catch (PDOException $e) { - self::fatal( - "An error occurred while connecting to the database. " . - "The error reported by the server was: " . $e->getMessage() - ); - } - - return $db; - } - - - /** - * Execute an SQL query on the database - * - * @param resource $db Database handler - * @param array $bindings Array of PDO binding values from bind() to be - * used for safely escaping strings. Note that this can be given as the - * SQL query string if no bindings are required. - * @param string $sql SQL query to execute. - * @return array Result from the query (all rows) - */ - static function sql_exec($db, $bindings, $sql = null) { - // Argument shifting - if ($sql === null) { - $sql = $bindings; - } - - $stmt = $db->prepare($sql); - //echo $sql; - - // Bind parameters - if (is_array($bindings)) { - for ($i = 0, $ien = count($bindings); $i < $ien; $i++) { - $binding = $bindings[$i]; - $stmt->bindValue($binding['key'], $binding['val'], $binding['type']); - } - } - - // Execute - try { - $stmt->execute(); - } catch (PDOException $e) { - self::fatal("An SQL error occurred: " . $e->getMessage()); - } - $result = $stmt->fetchAll(); - return $result; - } - - static function Ssql_exec($db, $bindings, $sql = null) { - // Argument shifting - if ($sql === null) { - $sql = $bindings; - } - - $stmt = $db->prepare($sql); - - // Bind parameters - if (is_array($bindings)) { - for ($i = 0, $ien = count($bindings); $i < $ien; $i++) { - $binding = $bindings[$i]; - $stmt->bindValue($binding['key'], $binding['val'], $binding['type']); - } - } - - // Execute - try { - $stmt->execute(); - } catch (PDOException $e) { - self::fatal("An SQL error occurred: " . $e->getMessage()); - } - $loop = '0'; - - while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) { - $result[$loop]['id'] = $arr['id']; - $result[$loop]['username'] = $arr['username']; - $result[$loop]['platform'] = $arr['platform']; - $result[$loop]['date'] = $arr['date']; - $ver = $arr['verified']; - - $myid = $arr['id']; - if ($ver == '0') { - $result[$loop]['ban'] = "User unverified"; - } elseif ($ver == '1') { - $result[$loop]['ban'] = " Ban "; - } elseif ($ver == '2') { - $result[$loop]['ban'] = " Unban "; - } - $result[$loop]['view'] = " Details "; - $result[$loop]['delete'] = " Delete "; - $loop = $loop + 1; - } - // Return all - return $result; - } - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Internal methods - */ - - /** - * Throw a fatal error. - * - * This writes out an error message in a JSON string which DataTables will - * see and show to the user in the browser. - * - * @param string $msg Message to send to the client - */ - static function fatal($msg) { - echo json_encode(array( - "error" => $msg - )); - - exit(0); - } - - /** - * Create a PDO binding key which can be used for escaping variables safely - * when executing a query with sql_exec() - * - * @param array &$a Array of bindings - * @param * $val Value to bind - * @param int $type PDO field type - * @return string Bound key to be used in the SQL where this parameter - * would be used. - */ - static function bind(&$a, $val, $type) { - $key = ':binding_' . count($a); - - $a[] = array( - 'key' => $key, - 'val' => $val, - 'type' => $type - ); - - return $key; - } - - - /** - * Pull a particular property from each assoc. array in a numeric array, - * returning and array of the property values from each item. - * - * @param array $a Array to get data from - * @param string $prop Property to read - * @return array Array of property values - */ - static function pluck($a, $prop) { - $out = array(); - - for ($i = 0, $len = count($a); $i < $len; $i++) { - $out[] = $a[$i][$prop]; - } - - return $out; - } -} - -if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { - header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z"); - die(); -} diff --git a/admin/stats.php b/admin/stats.php index 07b9365..dc8ff36 100644 --- a/admin/stats.php +++ b/admin/stats.php @@ -327,7 +327,5 @@ if ($last_ip == $ip) { - - \ No newline at end of file diff --git a/admin/users.php b/admin/users.php index efe858d..885c0b2 100644 --- a/admin/users.php +++ b/admin/users.php @@ -184,8 +184,6 @@ require_once(__DIR__ . '/common.php'); - - - - - - '[ProbablyAutistic] Have more than Fifty pastes', @@ -87,11 +44,11 @@

Badges

'; + echo ''; } elseif (strtotime($profile_join_date) <= 1608422400) { - echo ''; + echo ''; } elseif (strtotime($profile_join_date) <= 1609459200) { - echo ''; + echo ''; } if (!str_contains($profile_badge, '0')) { echo $profile_badge; @@ -143,15 +100,15 @@ - - + + Visibility"; + echo ""; } ?> - - + + Delete"; + echo ""; } ?> @@ -165,9 +122,13 @@ 1 => 'Unlisted', 2 => 'Private' }; + $pasteJson = array_merge( + $paste->only('id', 'title', 'tags', 'views', 'created_at'), + ['visibility' => $p_visible] + ); ?> - + @@ -180,29 +141,30 @@ - - + + Visibility"; } ?> - - + + Delete"; } ?>
TitlePaste TimeTitlePaste Time VisibilityViewsTagsViewsTags Delete
format('d F Y') ?>
TitlePaste TimeTitlePaste Time ViewsTagsViewsTags
+
- - - - + + + + @@ -212,11 +174,15 @@ $f_date = new DateTime($paste->pivot->f_time); $update_date = new DateTime($paste->updated_at); $delta = $update_date->diff(new DateTime(), true); + $pasteJson = array_merge( + $paste->only('id', 'title', 'tags', 'views', 'created_at'), + ['recently_updated' => ($delta->days <= 2), 'favourited_at' => $f_date->format('d F Y')] + ); ?> - + - +
TitleDate FavouritedStatusTagsTitleDate FavouritedStatusTags
format('d F Y') ?>format('d F Y') ?> days <= 2): ?> @@ -239,6 +205,7 @@
+
diff --git a/user.php b/user.php index a43e681..1f83998 100644 --- a/user.php +++ b/user.php @@ -14,7 +14,10 @@ if (empty($_GET['user'])) { $profile_username = trim($_GET['user']); -$profile_info = User::with('favourites')->where('username', $profile_username)->select('id', 'date', 'badge')->first(); +$profile_info = User::with('favourites') + ->where('username', $profile_username) + ->select('id', 'date', 'badge') + ->first(); if (!$profile_info) { // Invalid username @@ -50,7 +53,7 @@ $profile_pastes = $profile_info->pastes; $profile_favs = $profile_info->favourites; $is_current_user = ($current_user !== null) && ($profile_info->id == $current_user->id); -updatePageViews($conn); +updatePageViews(); if (isset($_GET['del'])) { if ($current_user !== null) { // Prevent unauthorized deletes @@ -70,4 +73,5 @@ if (isset($_GET['del'])) { // Theme $page_template = 'user_profile'; +array_push($script_bundles, 'user_profile'); require_once('theme/' . $default_theme . '/common.php');