1
1
<?php
2
2
class ScriptRepo{
3
- public $ mainSite = 'http://scripts.citizensnpcs.co / ' ;
3
+ public $ mainSite = '/ ' ;
4
4
public $ rootDir = '/usr/share/nginx/www/scripts/ ' ;
5
5
public $ loggedIn = false ;
6
6
public $ admin = false ;
@@ -284,6 +284,7 @@ public function postScript($postData, $oldID=false){
284
284
if (isset ($ postData ['scriptCode ' ]) && $ postData ['scriptCode ' ]!="" ){ $ values = array_merge ($ values , array ('scriptCode ' => $ postData ['scriptCode ' ])); }
285
285
if (isset ($ postData ['Description ' ]) && $ postData ['Description ' ]!="" ){ $ values = array_merge ($ values , array ('description ' => $ postData ['Description ' ])); }
286
286
if (isset ($ postData ['tags ' ]) && $ postData ['tags ' ]!="" ){ $ values = array_merge ($ values , array ('tags ' => $ postData ['tags ' ])); }
287
+ if (isset ($ postData ['dVersion ' ]) && $ postData ['dVersion ' ]!="" ){ $ values = array_merge ($ values , array ('denizen_version ' => $ postData ['dVersion ' ])); }
287
288
if ($ postData ['name ' ]=="" ){
288
289
return array_merge ($ values , array (
289
290
'postSuccess ' => false ,
@@ -320,6 +321,12 @@ public function postScript($postData, $oldID=false){
320
321
'postError ' => 'You must enter at least one tag! ' ,
321
322
'tagError ' => true
322
323
));
324
+ }elseif (!isset ($ postData ['dVersion ' ]) || $ postData ['dVersion ' ]=="" ){
325
+ return array_merge ($ values , array (
326
+ 'postSuccess ' => false ,
327
+ 'postError ' => 'You must set a denizen version! ' ,
328
+ 'dVersionError ' => true
329
+ ));
323
330
}elseif (stripos ($ postData ['Description ' ], "<script> " )){
324
331
return array_merge ($ values , array (
325
332
'postSuccess ' => false ,
@@ -334,15 +341,16 @@ public function postScript($postData, $oldID=false){
334
341
$ description = $ this ->databaseHandle ->real_escape_string ($ postData ['Description ' ]);
335
342
$ name = $ this ->databaseHandle ->real_escape_string ($ postData ['name ' ]);
336
343
$ username = $ this ->username ;
344
+ $ dVersion = $ this ->databaseHandle ->real_escape_string ($ postData ['dVersion ' ]);
337
345
$ tagString = implode (', ' , $ tags );
338
346
$ timestamp = time ();
339
347
if (!$ oldID ){
340
348
$ pubID = $ this ->generatePublicID ();
341
- $ this ->queryDatabase ("INSERT INTO repo_entries (id, pubID, author, name, description, tags, privacy, scriptType, dscript, timestamp, edited, downloads, views) VALUES ('NULL', ' $ pubID', ' $ username', ' $ name', ' $ description', ' $ tagString', ' $ privacy', ' $ typeOfScript', ' $ dscript', ' $ timestamp', $ timestamp, 0, 0) " );
349
+ $ this ->queryDatabase ("INSERT INTO repo_entries (id, pubID, author, name, description, tags, denizen_version, privacy, scriptType, dscript, timestamp, edited, downloads, views) VALUES ('NULL', ' $ pubID', ' $ username', ' $ name', ' $ description', ' $ tagString', ' $ dVersion ', ' $ privacy', ' $ typeOfScript', ' $ dscript', ' $ timestamp', $ timestamp, 0, 0) " );
342
350
$ this ->queryDatabase ("INSERT INTO repo_code (id, pubID, code) VALUES ('NULL', ' $ pubID', ' $ scriptCode') " );
343
351
}else {
344
352
$ pubID = $ oldID ;
345
- $ this ->queryDatabase ("UPDATE repo_entries SET name=' $ name', description=' $ description', tags=' $ tagString', privacy=' $ privacy', scriptType=' $ typeOfScript', dscript=' $ dscript', edited=' $ timestamp' WHERE pubID=' $ pubID' " );
353
+ $ this ->queryDatabase ("UPDATE repo_entries SET name=' $ name', description=' $ description', tags=' $ tagString', denizen_version=' $ dVersion ', privacy='$ privacy', scriptType=' $ typeOfScript', dscript=' $ dscript', edited=' $ timestamp' WHERE pubID=' $ pubID' " );
346
354
$ this ->queryDatabase ("UPDATE repo_code SET code=' $ scriptCode' WHERE pubID=' $ pubID' " );
347
355
}
348
356
return array ( 'postSuccess ' => true , 'newID ' => $ pubID );
@@ -407,4 +415,4 @@ public function redirect($newPage){
407
415
exit ;
408
416
}
409
417
}
410
- ?>
418
+ ?>
0 commit comments