Skip to content
This repository was archived by the owner on Apr 16, 2019. It is now read-only.

Commit d56c205

Browse files
committed
Tons of misc bug fixes.
1 parent 259874b commit d56c205

File tree

6 files changed

+39
-15
lines changed

6 files changed

+39
-15
lines changed

api.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ public function handleArgs($args){
8383
$this->data = array('success' => false);
8484
}
8585
break;
86+
case isset($args['download'])&&isset($args['pubID']):
87+
$pubID = $this->databaseHandle->real_escape_string($args['pubID']);
88+
$queryExist = $this->queryDatabase("SELECT * FROM repo_code WHERE pubID='$pubID'");
89+
if($queryExist->num_rows==1){
90+
$existRow = $queryExist->fetch_assoc();
91+
$this->data = array('success' => true, 'code' => $existRow['code']);
92+
}else{
93+
$this->data = array('success' => false);
94+
}
95+
break;
8696
default:
8797
$this->data = array('success' => false);
8898
}

assets/scriptrepo.class.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ public function getVariables($path){
259259
'typeError' => false,
260260
'tagError' => false,
261261
'tags' => false,
262-
'name' => false
262+
'name' => false,
263+
'output' => 'post.tpl'
263264
);
264265
if(!$_SESSION['loggedIn']){
265266
$_SESSION['loginInfo'] = 'You must be logged in to edit scripts!';
@@ -278,7 +279,7 @@ public function getVariables($path){
278279
$variableArray = array_merge($variableArray, $editSuccess);
279280
}
280281
}else{
281-
$queryCode = $connectionHandle->query("SELECT * FROM repo_code WHERE pubID='$pubID'");
282+
$queryCode = $this->queryDatabase("SELECT * FROM repo_code WHERE pubID='$pubID'");
282283
$rowCode = $queryCode->fetch_assoc();
283284
$variableArray = array_merge($variableArray, array(
284285
'name' => $checkRow['name'],
@@ -599,10 +600,6 @@ public function getVariables($path){
599600
}
600601
break;
601602
case 'user':
602-
if(!$_SESSION['loggedIn']){
603-
$_SESSION['loginInfo'] = 'You must be logged in to view user profiles!';
604-
$this->redirect('login');
605-
}
606603
$userToLookup = $this->databaseHandle->real_escape_string($path[1]);
607604
$userQuery = $this->queryDatabase("SELECT * FROM repo_users WHERE username='$userToLookup'");
608605
if($userQuery->num_rows!=1){

assets/templates/browse.tpl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<div style="background-color:white" class="span8 well well-small">
22
<h3 style="text-align:center;">Scripts</h3>
3+
{*{include file="pagination.tpl"}*}
34
<table class="table table-hover">
45
{foreach $resultArray as $result}{$pubID = $result.pubID}
56
{if $result}<tr style="cursor:pointer" onclick='document.location.href="{buildURL page='view/'}{$result.pubID}"'><td>
67
<span class="pull-left"><a href="{buildURL page='view/'}{$result.pubID}">{$result.name}</a></span> <span class="pull-right" data-placement="right" rel="tooltip" title="Views"><i class="icon-eye-open"></i> {$result.views}</span>
7-
<br><small>Author: {$result.author}</small><span class="pull-right" data-placement="right" rel="tooltip" title="Likes"><i class="icon-thumbs-up"></i> {if $result.author=="AgentKid"} &infin;{else}{$result.likes}{/if}</span>
8+
<br><small><b>Author:</b> {$result.author} <b style="padding-left:5em;">Created:</b> {$result.timestamp|date_format:"%D"}{if $result.timestamp!=$result.edited} <b style="padding-left:5em;">Edited:</b> {$result.edited|date_format:"%D"} {/if}</small><span class="pull-right" data-placement="right" rel="tooltip" title="Likes"><i class="icon-thumbs-up"></i> {if $result.author=="AgentKid"} &infin;{else}{$result.likes}{/if}</span>
89
<br><small><span class="muted">Tags: {$result.tags}</span></small><span class="pull-right" data-placement="right" rel="tooltip" title="Downloads"><i class="icon-download"></i> {$result.downloads}</span>
910
</td></tr>{/if}
1011
{/foreach}
@@ -29,6 +30,15 @@
2930
{if $sortType!="mostViewed"}<li><a href="{buildURL page='browse/'}{$listingType}/mostViewed/{$resultPageNumber}/{$resultsPerPage}/">Sort by number of views</a></li>{/if}
3031
{if $sortType!="mostDownloads"}<li><a href="{buildURL page='browse/'}{$listingType}/mostDownloads/{$resultPageNumber}/{$resultsPerPage}/">Sort by number of downloads</a></li>{/if}
3132
</ul>
33+
</div><br>
34+
<div class="btn-group">
35+
<a class="btn dropdown-toggle" data-toggle="dropdown">{if $resultsPerPage==20}20 results per page.{elseif $resultsPerPage==50}50 results per page.{elseif $resultsPerPage==100}100 results per page.{elseif $resultsPerPage==200}200 results per page.{/if} <span class="caret"></span></a>
36+
<ul class="dropdown-menu">
37+
{if $resultsPerPage!=20}<li><a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/20/">Show 20 results per page</a></li>{/if}
38+
{if $resultsPerPage!=50}<li><a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/50/">Show 50 results per page</a></li>{/if}
39+
{if $resultsPerPage!=100}<li><a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/100/">Show 100 results per page</a></li>{/if}
40+
{if $resultsPerPage!=200}<li><a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/200/">Show 200 results per page</a></li>{/if}
41+
</ul>
3242
</div>
3343
</div>
3444
<div style="background-color:white" class="span3 well well-small">
@@ -40,12 +50,11 @@
4050
</table>
4151
</div>
4252
<!-- Navigation -->
43-
<div id="navigation" style="text-align:center;">
44-
Results per page: {if $resultsPerPage!=20}<a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/20">{/if}20{if $resultsPerPage!=20}</a>{/if}, {if $resultsPerPage!=50}<a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/50">{/if}50{if $resultsPerPage!=50}</a>{/if}, {if $resultsPerPage!=100}<a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/100">{/if}100{if $resultsPerPage!=100}</a>{/if}, {if $resultsPerPage!=200}<a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$resultPageNumber}/200">{/if}200{if $resultsPerPage!=200}</a>{/if}
53+
<div class="span11" id="navigation" style="text-align:center;padding-bottom:12px">
4554
<div class="pagination pagination-centered">
4655
<ul>
4756
{if $resultPageNumber==1}<li class="disabled"><a>Prev</a></li>
48-
{else}<li><a href="{buildURL page='browse/'}{$listingType}/{math equation="x-1" x=$resultPageNumber}/{$resultsPerPage}/">Prev</a></li>
57+
{else}<li><a href="{buildURL page='browse/'}{$listingType}/{$sortType}/{math equation="x-1" x=$resultPageNumber}/{$resultsPerPage}/">Prev</a></li>
4958
{/if}{foreach $resultPages as $pageItem}{$maxPage = $pageItem}
5059
<li{if $pageItem==$resultPageNumber} class="disabled"{/if}><a{if $pageItem!=$resultPageNumber} href="{buildURL page='browse/'}{$listingType}/{$sortType}/{$pageItem}/{$resultsPerPage}/"{/if}>{$pageItem}</a></li>{/foreach}
5160
{if $resultPageNumber==$maxPage}<li class="disabled"><a>Next</a></li>

assets/templates/index.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@
8585
</div><!-- /navbar-inner -->
8686
</div><!-- /navbar -->
8787
</section>
88-
<div class="container">
88+
<div class="container container-fluid">
8989
<div class="alert alert-info">
9090
<strong>Notice!</strong> This site is the Citizens Script Repo v2.1 - Searching works :D
9191
</div>
9292
{include file="$output"}
93-
<footer class="footer">
93+
<footer class="footer span11">
9494
<div style="padding-bottom:12px; text-align:center;">Copyright &copy; 2012 - CitizensNPCs<br><a href="{buildURL page='support'}">Support</a> - <a href="{buildURL page='credits'}">Credits</a></div>
9595
</footer>
9696
</div>

assets/templates/result.tpl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@
3131
{if $sortType!="mostViewed"}<li><a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/mostViewed/{$resultPageNumber}/{$resultsPerPage}/">Sort by number of views</a></li>{/if}
3232
{if $sortType!="mostDownloads"}<li><a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/mostDownloads/{$resultPageNumber}/{$resultsPerPage}/">Sort by number of downloads</a></li>{/if}
3333
</ul>
34+
</div><br>
35+
<div class="btn-group">
36+
<a class="btn dropdown-toggle" data-toggle="dropdown">{if $resultsPerPage==20}20 results per page.{elseif $resultsPerPage==50}50 results per page.{elseif $resultsPerPage==100}100 results per page.{elseif $resultsPerPage==200}200 results per page.{/if} <span class="caret"></span></a>
37+
<ul class="dropdown-menu">
38+
{if $resultsPerPage!=20}<li><a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/1/20/">Show 20 results per page</a></li>{/if}
39+
{if $resultsPerPage!=50}<li><a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/1/50/">Show 50 results per page</a></li>{/if}
40+
{if $resultsPerPage!=100}<li><a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/1/100/">Show 100 results per page</a></li>{/if}
41+
{if $resultsPerPage!=200}<li><a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/1/200/">Show 200 results per page</a></li>{/if}
42+
</ul>
3443
</div>
3544
</div>
3645
<!-- Navigation -->
37-
<div id="navigation" style="text-align:center;">
38-
Results per page: {if $resultsPerPage!=20}<a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/{$resultPageNumber}/20">{/if}20{if $resultsPerPage!=20}</a>{/if}, {if $resultsPerPage!=50}<a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/{$resultPageNumber}/50">{/if}50{if $resultsPerPage!=50}</a>{/if}, {if $resultsPerPage!=100}<a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/{$resultPageNumber}/100">{/if}100{if $resultsPerPage!=100}</a>{/if}, {if $resultsPerPage!=200}<a href="{buildURL page='search/'}{$searchTermURL}/{$listingType}/{$sortType}/{$resultPageNumber}/200">{/if}200{if $resultsPerPage!=200}</a>{/if}
46+
<div class="span11" id="navigation" style="text-align:center;padding-bottom:12px">
3947
<div class="pagination pagination-centered">
4048
<ul>
4149
{if $resultPageNumber==1}<li class="disabled"><a>Prev</a></li>

assets/templates/view.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{if $ScriptRepo->loggedIn}{if $ScriptRepo->admin}<button onclick='document.location.href="{buildURL page='action/4/'}{$dataToUse.pubID}"' rel="tooltip" title="Delete" class="btn btn-danger"><i class="icon-remove"></i></button>{/if}{/if}
1414
<button onclick='document.location.href="{buildURL page='action/5/'}{$dataToUse.pubID}"' rel="tooltip" title="Report" class="btn btn-warning"><i class="icon-flag"></i></button>
1515
</span>
16-
<b>Description: </b>{nl2br($dataToUse.description)}<br><br>
16+
<b>Description: </b>{$dataToUse.description}<br><br>
1717
<pre class="brush: {if $dataToUse.scriptType==1}js{else}yaml{/if}">{$code}</pre>
1818
<script type="text/javascript">
1919
SyntaxHighlighter.all()

0 commit comments

Comments
 (0)