mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
ajax_pastes.php actually works now
This commit is contained in:
parent
168d5ad5a6
commit
75fa51f0c6
13 changed files with 32 additions and 61 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
// Turn off all error reporting
|
// Turn off all error reporting
|
||||||
error_reporting(0);
|
//error_reporting(0);
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ class SSP {
|
||||||
// Build the SQL query string from the request
|
// Build the SQL query string from the request
|
||||||
$limit = self::limit( $request, $columns );
|
$limit = self::limit( $request, $columns );
|
||||||
$order = self::order( $request, $columns );
|
$order = self::order( $request, $columns );
|
||||||
$where = self::filter( $request, $columns, $bindings );
|
//$where = self::filter( $request, $columns, $bindings );
|
||||||
|
|
||||||
// Main query to actually get the data
|
// Main query to actually get the data
|
||||||
$data = self::Ssql_exec($db, $bindings,
|
$data = self::Ssql_exec($db, $bindings,
|
||||||
|
@ -245,7 +245,7 @@ class SSP {
|
||||||
* Output
|
* Output
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
"draw" => intval( $request['draw'] ),
|
"draw" => isset($request['draw']) ? intval( $request['draw'] ) : 0,
|
||||||
"recordsTotal" => intval( $recordsTotal ),
|
"recordsTotal" => intval( $recordsTotal ),
|
||||||
"recordsFiltered" => intval( $recordsFiltered ),
|
"recordsFiltered" => intval( $recordsFiltered ),
|
||||||
"data" => self::data_output( $columns2, $data )
|
"data" => self::data_output( $columns2, $data )
|
||||||
|
@ -262,7 +262,7 @@ class SSP {
|
||||||
* * db - database name
|
* * db - database name
|
||||||
* * user - user name
|
* * user - user name
|
||||||
* * pass - user password
|
* * pass - user password
|
||||||
* @return resource Database connection handle
|
* @return PDO Database connection handle
|
||||||
*/
|
*/
|
||||||
static function sql_connect ( $sql_details )
|
static function sql_connect ( $sql_details )
|
||||||
{
|
{
|
||||||
|
@ -355,7 +355,7 @@ class SSP {
|
||||||
$result[$loop]['id']= $arr['id'];
|
$result[$loop]['id']= $arr['id'];
|
||||||
$result[$loop]['member']= $arr['member'];
|
$result[$loop]['member']= $arr['member'];
|
||||||
$result[$loop]['tagsys']= sandwitch( $arr['tagsys']);
|
$result[$loop]['tagsys']= sandwitch( $arr['tagsys']);
|
||||||
$date_time = strtotime($arr['date']);
|
$date_time = strtotime(isset($arr['date']) ? $arr['date'] : '0');
|
||||||
$result[$loop]['date']= date("d F Y", $date_time);
|
$result[$loop]['date']= date("d F Y", $date_time);
|
||||||
$myid = $arr['id'];
|
$myid = $arr['id'];
|
||||||
$mytitle = $arr['title'];
|
$mytitle = $arr['title'];
|
||||||
|
|
|
@ -12,17 +12,14 @@
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
session_start();
|
|
||||||
|
|
||||||
define('IN_PONEPASTE', 1);
|
define('IN_PONEPASTE', 1);
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
require_once('config.php');
|
|
||||||
|
|
||||||
// UTF-8
|
// UTF-8
|
||||||
header('Content-Type: text/html; charset=utf-8');
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
|
||||||
$date = date('jS F Y');
|
$date = date('jS F Y');
|
||||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
|
||||||
|
|
||||||
// Temp count for untagged pastes
|
// Temp count for untagged pastes
|
||||||
$total_untagged = intval($conn->query("SELECT COUNT(*) from pastes WHERE tagsys IS NULL")->fetch(PDO::FETCH_NUM)[0]);
|
$total_untagged = intval($conn->query("SELECT COUNT(*) from pastes WHERE tagsys IS NULL")->fetch(PDO::FETCH_NUM)[0]);
|
||||||
|
|
15
config.php
15
config.php
|
@ -41,7 +41,6 @@ define('G_Client_Secret', 'CHANGE THIS'); // What's your Secret key
|
||||||
define('G_Redirect_Uri', 'http://ponepaste.org//oauth/google.php'); // Leave this as is
|
define('G_Redirect_Uri', 'http://ponepaste.org//oauth/google.php'); // Leave this as is
|
||||||
define('G_Application_Name', 'Paste'); // Make sure this matches the name of your application
|
define('G_Application_Name', 'Paste'); // Make sure this matches the name of your application
|
||||||
|
|
||||||
|
|
||||||
$db_host = 'localhost';
|
$db_host = 'localhost';
|
||||||
$db_schema = 'p0nepast3s';
|
$db_schema = 'p0nepast3s';
|
||||||
$db_user = 'P0nedbAcc0unt';
|
$db_user = 'P0nedbAcc0unt';
|
||||||
|
@ -69,21 +68,19 @@ define('SECRET',md5($sec_key));
|
||||||
$mod_rewrite = "1";
|
$mod_rewrite = "1";
|
||||||
|
|
||||||
// Available GeSHi formats
|
// Available GeSHi formats
|
||||||
$geshiformats =array(
|
$geshiformats = [
|
||||||
|
|
||||||
'green' => 'Green Text',
|
'green' => 'Green Text',
|
||||||
'text' => 'Plain Text',
|
'text' => 'Plain Text',
|
||||||
'pastedown' => 'pastedown',
|
'pastedown' => 'pastedown',
|
||||||
'pastedown_old' => 'pastedown old',
|
'pastedown_old' => 'pastedown old'
|
||||||
);
|
];
|
||||||
|
|
||||||
// Popular formats that are listed first.
|
// Popular formats that are listed first.
|
||||||
$popular_formats=array(
|
$popular_formats = [
|
||||||
'green',
|
'green',
|
||||||
'text',
|
'text',
|
||||||
'pastedown',
|
'pastedown',
|
||||||
'pastedown_old'
|
'pastedown_old'
|
||||||
);
|
];
|
||||||
|
|
||||||
//Cookie
|
// Cookie - I want a cookie, can I have one?
|
||||||
?>
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
session_start();
|
|
||||||
|
|
||||||
define('IN_PONEPASTE', 1);
|
define('IN_PONEPASTE', 1);
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
|
|
|
@ -64,6 +64,8 @@ function updatePageViews($conn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
$conn = new PDO(
|
$conn = new PDO(
|
||||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||||
$db_user,
|
$db_user,
|
||||||
|
|
|
@ -2370,7 +2370,7 @@ class GeSHi {
|
||||||
unset($code);
|
unset($code);
|
||||||
|
|
||||||
//Preload some repeatedly used values regarding hardquotes ...
|
//Preload some repeatedly used values regarding hardquotes ...
|
||||||
$hq = isset($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false;
|
$hq = !empty($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false;
|
||||||
$hq_strlen = strlen($hq);
|
$hq_strlen = strlen($hq);
|
||||||
|
|
||||||
//Preload if line numbers are to be generated afterwards
|
//Preload if line numbers are to be generated afterwards
|
||||||
|
@ -4479,11 +4479,14 @@ class GeSHi {
|
||||||
$stylesheet .= "$selector.st$group {{$styles}}\n";
|
$stylesheet .= "$selector.st$group {{$styles}}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) {
|
if (isset($this->language_data['STYLES']['NUMBERS'])) {
|
||||||
if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) {
|
foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) {
|
||||||
$stylesheet .= "$selector.nu$group {{$styles}}\n";
|
if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) {
|
||||||
|
$stylesheet .= "$selector.nu$group {{$styles}}\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) {
|
foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) {
|
||||||
if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) {
|
if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) {
|
||||||
$stylesheet .= "$selector.me$group {{$styles}}\n";
|
$stylesheet .= "$selector.me$group {{$styles}}\n";
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
$directory = 'install';
|
$directory = 'install';
|
||||||
|
|
||||||
if (file_exists($directory)) {
|
if (file_exists($directory)) {
|
||||||
|
@ -24,12 +22,10 @@ if (file_exists($directory)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required functions
|
// Required functions
|
||||||
require_once('includes/captcha.php');
|
|
||||||
require_once('includes/functions.php');
|
|
||||||
define('IN_PONEPASTE', 1);
|
define('IN_PONEPASTE', 1);
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
|
require_once('includes/captcha.php');
|
||||||
// PHP <5.5 compatibility
|
require_once('includes/functions.php');
|
||||||
require_once('includes/password.php');
|
require_once('includes/password.php');
|
||||||
|
|
||||||
function calculatePasteExpiry($p_expiry) {
|
function calculatePasteExpiry($p_expiry) {
|
||||||
|
|
|
@ -13,20 +13,15 @@
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// PHP <5.5 compatibility
|
|
||||||
require_once('includes/password.php');
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Required functions
|
// Required functions
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
require_once('includes/functions.php');
|
require_once('includes/functions.php');
|
||||||
|
require_once('includes/password.php');
|
||||||
require_once('mail/mail.php');
|
require_once('mail/mail.php');
|
||||||
|
|
||||||
// Current Date & User IP
|
// Current Date & User IP
|
||||||
$date = date('jS F Y');
|
$date = date('jS F Y');
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
$mail_type = "1";
|
$mail_type = "1";
|
||||||
|
|
23
paste.php
23
paste.php
|
@ -13,11 +13,6 @@
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// PHP <5.5 compatibility
|
|
||||||
require_once('includes/password.php');
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// UTF-8
|
// UTF-8
|
||||||
header('Content-Type: text/html; charset=utf-8');
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
|
||||||
|
@ -26,14 +21,11 @@ define('IN_PONEPASTE', 1);
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
require_once('includes/geshi.php');
|
require_once('includes/geshi.php');
|
||||||
require_once('includes/functions.php');
|
require_once('includes/functions.php');
|
||||||
|
require_once('includes/password.php');
|
||||||
|
|
||||||
// Path of GeSHi object
|
require_once('includes/Parsedown/Parsedown.php');
|
||||||
$path = 'includes/geshi/';
|
require_once('includes/Parsedown/ParsedownExtra.php');
|
||||||
|
require_once('includes/Parsedown/SecureParsedown.php');
|
||||||
// Path of Parsedown object
|
|
||||||
$parsedown_path = 'includes/Parsedown/Parsedown.php';
|
|
||||||
$parsedownextra_path = 'includes/Parsedown/ParsedownExtra.php';
|
|
||||||
$parsedownsec_path = 'includes/Parsedown/SecureParsedown.php';
|
|
||||||
|
|
||||||
$paste_id = intval(trim($_REQUEST['id']));
|
$paste_id = intval(trim($_REQUEST['id']));
|
||||||
|
|
||||||
|
@ -159,15 +151,12 @@ if (!$row) {
|
||||||
|
|
||||||
// Apply syntax highlight
|
// Apply syntax highlight
|
||||||
$p_content = htmlspecialchars_decode($p_content);
|
$p_content = htmlspecialchars_decode($p_content);
|
||||||
if ( $p_code == "pastedown" ) {
|
if ($p_code === "pastedown") {
|
||||||
include( $parsedown_path );
|
|
||||||
include ($parsedownextra_path);
|
|
||||||
include ($parsedownsec_path);
|
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new Parsedown();
|
||||||
$Parsedown->setSafeMode(true);
|
$Parsedown->setSafeMode(true);
|
||||||
$p_content = $Parsedown->text( $p_content );
|
$p_content = $Parsedown->text( $p_content );
|
||||||
} else {
|
} else {
|
||||||
$geshi = new GeSHi($p_content, $p_code, $path);
|
$geshi = new GeSHi($p_content, $p_code, 'includes/geshi/');
|
||||||
|
|
||||||
$geshi->enable_classes();
|
$geshi->enable_classes();
|
||||||
$geshi->set_header_type(GESHI_HEADER_DIV);
|
$geshi->set_header_type(GESHI_HEADER_DIV);
|
||||||
|
|
|
@ -13,14 +13,11 @@
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// PHP <5.5 compatibility
|
|
||||||
require_once('includes/password.php');
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
define('IN_PONEPASTE', 1);
|
define('IN_PONEPASTE', 1);
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
require_once('includes/functions.php');
|
require_once('includes/functions.php');
|
||||||
|
require_once('includes/password.php');
|
||||||
|
|
||||||
|
|
||||||
// UTF-8
|
// UTF-8
|
||||||
header('Content-Type: text/html; charset=utf-8');
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
|
||||||
|
|
||||||
define('IN_PONEPASTE', 1);
|
define('IN_PONEPASTE', 1);
|
||||||
require_once ('includes/common.php');
|
require_once ('includes/common.php');
|
||||||
require_once('includes/functions.php');
|
require_once('includes/functions.php');
|
||||||
|
@ -14,4 +12,3 @@ $p_title = $lang['archive']; // "Pastes Archive";
|
||||||
require_once('theme/' . $default_theme . '/header.php');
|
require_once('theme/' . $default_theme . '/header.php');
|
||||||
require_once('theme/' . $default_theme . '/rules.php');
|
require_once('theme/' . $default_theme . '/rules.php');
|
||||||
require_once('theme/' . $default_theme . '/footer.php');
|
require_once('theme/' . $default_theme . '/footer.php');
|
||||||
?>
|
|
|
@ -230,7 +230,7 @@ overflow: hidden !important;
|
||||||
}} ?>
|
}} ?>
|
||||||
</div>
|
</div>
|
||||||
<!-- Guests -->
|
<!-- Guests -->
|
||||||
<?php if (strcasecmp($_SESSION['username'], $p_member)) { ?>
|
<?php if (!isset($_SESSION['username']) || strcasecmp($_SESSION['username'], $p_member)) { ?>
|
||||||
<hr>
|
<hr>
|
||||||
<label class="label">More from this Author </label>
|
<label class="label">More from this Author </label>
|
||||||
<?php
|
<?php
|
||||||
|
|
1
user.php
1
user.php
|
@ -12,7 +12,6 @@
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License in GPL.txt for more details.
|
* GNU General Public License in GPL.txt for more details.
|
||||||
*/
|
*/
|
||||||
session_start();
|
|
||||||
|
|
||||||
define('IN_PONEPASTE', 1);
|
define('IN_PONEPASTE', 1);
|
||||||
require_once('includes/common.php');
|
require_once('includes/common.php');
|
||||||
|
|
Loading…
Add table
Reference in a new issue