Jeremy D commited on 2012-01-23 20:50:29
Showing 4 changed files, with 23 additions and 15 deletions.
... | ... |
@@ -21,6 +21,10 @@ if (isset($_GET['view'])) |
21 | 21 |
else |
22 | 22 |
$pasteBin->action_index(); |
23 | 23 |
|
24 |
+// Shutdown. |
|
25 |
+if (!defined('PB_CONTINUE')) |
|
26 |
+ exit; |
|
27 |
+ |
|
24 | 28 |
/* |
25 | 29 |
* Main PasteBin class |
26 | 30 |
*/ |
... | ... |
@@ -55,10 +59,10 @@ class pB |
55 | 59 |
if (class_exists($class)) |
56 | 60 |
$this->db = new $class; |
57 | 61 |
else |
58 |
- this->error('Database is defined but no such class exists.'); |
|
62 |
+ $this->error('Database is defined but no such class exists.'); |
|
59 | 63 |
} |
60 | 64 |
else |
61 |
- this->error('No database handler is defined.'); |
|
65 |
+ $this->error('No database handler is defined.'); |
|
62 | 66 |
|
63 | 67 |
// Start up our User handler. |
64 | 68 |
require_once(pBS::get('sources') . '/user.php'); |
... | ... |
@@ -70,10 +74,10 @@ class pB |
70 | 74 |
if (class_exists($class)) |
71 | 75 |
$this->usr = new $class; |
72 | 76 |
else |
73 |
- this->error('User is defined but no such class exists.'); |
|
77 |
+ $this->error('User is defined but no such class exists.'); |
|
74 | 78 |
} |
75 | 79 |
else |
76 |
- this->error('No user handler is defined.'); |
|
80 |
+ $this->error('No user handler is defined.'); |
|
77 | 81 |
|
78 | 82 |
// Start up our Template handler. |
79 | 83 |
require_once(pBS::get('sources') . '/tpl.php'); |
... | ... |
@@ -85,10 +89,10 @@ class pB |
85 | 89 |
if (class_exists($class)) |
86 | 90 |
$this->tpl = new $class; |
87 | 91 |
else |
88 |
- this->error('Template is defined but no such class exists.'); |
|
92 |
+ $this->error('Template is defined but no such class exists.'); |
|
89 | 93 |
} |
90 | 94 |
else |
91 |
- this->error('No template handler is defined.'); |
|
95 |
+ $this->error('No template handler is defined.'); |
|
92 | 96 |
|
93 | 97 |
// Start getting things going. |
94 | 98 |
$this->loadLanguage(); |
... | ... |
@@ -106,7 +110,7 @@ class pB |
106 | 110 |
elseif (isset($_GET['lang']) && file_exists(pBS::get('languages') . '/' . strtolower(htmlspecialchars($_GET['lang'])) . '.php')) |
107 | 111 |
{ |
108 | 112 |
if (strpos($_GET['lang'], 'http://') !== false || strpos($_GET['lang'], 'ftp://') !== false) |
109 |
- exit('Hacking attempt'); |
|
113 |
+ $this->error('Invalid string in url.'); |
|
110 | 114 |
|
111 | 115 |
$language = strtolower(htmlspecialchars($_GET['lang'])); |
112 | 116 |
} |
... | ... |
@@ -302,7 +306,7 @@ class pB |
302 | 306 |
); |
303 | 307 |
|
304 | 308 |
// Do a test. |
305 |
- $this->db->addPasteTest(&$data); |
|
309 |
+ $this->db->addPasteTest(&$data, &$do_create); |
|
306 | 310 |
|
307 | 311 |
if (!$do_create) |
308 | 312 |
{ |
... | ... |
@@ -321,8 +325,8 @@ class pB |
321 | 325 |
|
322 | 326 |
// Send us there. |
323 | 327 |
redirectexit($this->URL('view', $result['id'], array( |
324 |
- 'update' => isset($data['updated']) ? 't' . time() : '', |
|
325 |
- 'key' => !empty($data['key']) ? $data['key'] : '', |
|
328 |
+ 'update' => isset($result['updated']) ? 't' . time() : '', |
|
329 |
+ 'key' => !empty($result['key']) ? $result['key'] : '', |
|
326 | 330 |
))); |
327 | 331 |
} |
328 | 332 |
|
... | ... |
@@ -5,28 +5,31 @@ |
5 | 5 |
*/ |
6 | 6 |
class pBL |
7 | 7 |
{ |
8 |
+ /* Our language */ |
|
8 | 9 |
public static $language = 'english'; |
9 | 10 |
|
11 |
+ /* Create Paste Page */ |
|
10 | 12 |
public static $index_title = 'Create new'; |
11 | 13 |
public static $user_name = 'Name'; |
12 | 14 |
public static $email = 'Email'; |
13 | 15 |
public static $code = 'Code/text to paste'; |
14 | 16 |
|
17 |
+ /* Additional options */ |
|
15 | 18 |
public static $enable_geshi = 'Enable code highlighting'; |
16 |
- |
|
17 | 19 |
public static $force_new_key = 'Force new key'; |
18 |
- |
|
19 | 20 |
public static $submit = 'Submit'; |
20 | 21 |
|
22 |
+ /* Recent menu */ |
|
21 | 23 |
public static $recent = 'Recent'; |
22 | 24 |
public static $create_new = 'Create new'; |
23 | 25 |
|
26 |
+ /* Some language defined errors */ |
|
24 | 27 |
public static $error_no_access = 'Invlaid Key used'; |
25 | 28 |
public static $error_approval = 'This Paste requires approval'; |
26 | 29 |
|
30 |
+ /* Viewing a paste */ |
|
27 | 31 |
// %1$s = ID of the paste. |
28 | 32 |
public static $view_title = 'Viewing Paste %1$s'; |
29 |
- |
|
30 | 33 |
public static $formated_paste = 'Formated Paste'; |
31 | 34 |
public static $plain_paste = 'Plain Paste'; |
32 | 35 |
} |
... | ... |
@@ -119,8 +119,9 @@ class pDB_smf extends pDB |
119 | 119 |
$data[use_geshi] Bool If we should use geshi highlighting or not. |
120 | 120 |
$data[language] String The language of the code, default is php. |
121 | 121 |
$data[body] String the actual contents of the paste. |
122 |
+ * @param $do_create Should we create this or not? Only set this to false when we shouldn't. |
|
122 | 123 |
*/ |
123 |
- public function addPasteTest($data) |
|
124 |
+ public function addPasteTest($data, $do_create) |
|
124 | 125 |
{ |
125 | 126 |
} |
126 | 127 |
|