addreview.php, new icons, and more

master
Rubenwardy 2013-04-08 15:49:07 +01:00
parent f2d61687cf
commit 41ae36e4f8
25 changed files with 206 additions and 98 deletions

View File

@ -44,7 +44,7 @@ Overview:* <input type="text" size="70" name="mod_ov" placeholder="a short one l
<!--Description-->
<td colspan="2">
<p>Description:* <Br /><textarea name="mod_desc" cols="105" placeholder="The Entries Description. See help > description mark up link at top of page. this is like an article" rows="25"><?php
<p>Description:* <Br /><textarea name="mod_desc" cols="105" rows="25" placeholder="The Entries Description. See help > description mark up link at top of page. this is like an article"><?php
if ($desc==""){
?><!--This is a template on how you should layout mod pages.
The description should feature all these things, but not necessarily in this order

58
addreview.php Normal file
View File

@ -0,0 +1,58 @@
<?php
include "scripts/setup.php";
$id=$_GET['id'];
require_login();
// Validate the mod
if (is_numeric($id)==false)
SQLerrorFancy("Mod Error","Unable to find extension <i>(extension id not valid)</i>");
$mres = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerrorFancy("Mod Error","Unable to find extension <i>(sql query error)</i>");
$mod = mysql_fetch_array($mres) or SQLerrorFancy("Mod Error","Unable to find mod");
// Validate the user
$user_id = getUserId($_SESSION['user'],$handle);
$ures = mysql_query("SELECT * FROM reviews WHERE owner_id=$user_id AND mod_id=$id",$handle);
if ( mysql_num_rows($ures) > 0){
SQLerrorFancy("You have already reviewed this!","You can only review an extension once.");
}
// Get data
$overview = $_POST['overview'];
$desc = $_POST['description'];
// Submit code
if ($overview != "" && $desc != ""){
require_once "scripts/entry_adders_sql_safe.php";
// Insert the data into table
mysql_query("INSERT INTO reviews (mod_id,owner_id,overview,description)
VALUES ($id,$user_id,'$overview','$desc')") or die('insert error');
// Get the id
$the_id=mysql_insert_id($handle);
// Display the extension
header("location: review.php?id=$the_id");
}
// Write page
$page_title="Review '".$mod['name']."'";
include "scripts/pageheader.php";
?>
Help: <a href="help/markup.php" target="_blank">Description Markup</a> - Not creating? Make sure you filled in all sections.
<hr />
<form action="addreview.php?id=<?php echo $id;?>" method="post">
<p>
Overview: <input type="text" name="overview" maxlength="500" size="100" placeholder="A basic paragraph summarising your review" />
</p>
<textarea name="description" cols="105" rows="25" placeholder="Your article that will appear when the user clicks see more"></textarea>
<center><input type="submit" value="Add Review" /></center>
</form>
<?php
include "scripts/pagefooter.php";
?>

View File

@ -1,6 +1,6 @@
<?php
include "scripts/setup.php";
$page_title="Edit a Mod";
$page_title="Delete an extension";
require_login();
@ -15,9 +15,9 @@ include "scripts/pageheader.php";
$res = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error finding entry $id");
$row = mysql_fetch_array($res) or die("row error");
if (is_member_moderator($_SESSION['user'],$handle) || $_SESSION['user']==$row['owner']){
if (is_member_moderator($_SESSION['user'],$handle) || getUserId($_SESSION['user'],$handle)==$row['owner']){
}else{
SQLerror("Deleting Denied","You do not own that entry, and you are not a moderator");
SQLerror("Deleting Denied","You do not own that extension, and you are not a moderator");
}
// --------------------------
@ -38,8 +38,8 @@ if ($do==true){
}
?>
<form method="post" action="<?php echo curPageURL();?>">
<h1>Delete an Entry</h1>
<input type="text" name="mod_name" readonly="true" style="background-color:#EEEEEE;" value="<?php echo $name;?>"> will be permanatly deleted<br /><br />
<h1>Delete an extension</h1>
<input type="text" name="mod_name" readonly="true" style="background-color:#EEEEEE;" value="<?php echo $name;?>"> will be permanently deleted<br /><br />
<input type="submit" value="OK">
</form>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

BIN
images/like.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/like_high.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/like_high_over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

BIN
images/like_over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -35,35 +35,12 @@ include "scripts/pageheader.php";
<h2>Welcome to Minetest Extensions</h2>
<p>
Welcome to Minetest Extensions, the Mod, texture pack, sound pack and other things database.
<a href="#" onClick="toggle('bar_stat');">Statistics</a>
Minetest's full potential can only be obtained by installing mods, and other stuff. So shall we get started?
</p>
<?php
function tabCol($title,$msg){
echo "<tr><td><b>".$title.":</b></td><td>$msg</td></tr>\n";
}
echo "<p><div id='bar_stat' style=\"display:none;\">";
echo "<p>\n77 <b>users</b> contributing ".getNoTopics("",$handle)." <b>extensions</b>\n</p>\n";
echo "<table><tbody>\n";
tabCol("Mods",getNoTopics("mod",$handle));
tabCol("Games",getNoTopics("game",$handle));
tabCol("Code Mods",getNoTopics("code",$handle));
tabCol("Texture Packs",getNoTopics("texture",$handle));
tabCol("Visitors","380 a week");
tabCol("Extension Views","unknown");
tabCol("Downloads","unknown");
echo "</tbody></table></div></p>\n";
?>
<p>
If you have any questions at all, do not hesitate to contact us on <a href="http://tinyurl.com/mtmdfrm">this project's forum topic</a>
Here's how to install:
<a href="http://minetest.net/wiki/doku.php?id=installing_mods">mods</a>,
<a href="http://forum.minetest.net/viewtopic.php?id=1592">texture packs</a>
</p>
</div>
@ -72,7 +49,12 @@ echo "</tbody></table></div></p>\n";
<div id="home_reco">
<div class="constrain">
<div style="clear: both;"></div>
<h3>Featured</h3>
<h3><a style="color:white;" href="viewmod.php?id=random">Random Extension</a></h3>
<p>
Why dont you try something new? Click the above link to go randomly to one of our extensions.
</p>
<!--<h3>Featured</h3>
<table>
<tr>
@ -80,7 +62,7 @@ echo "</tbody></table></div></p>\n";
<td style="background-image:url('http://multa.bugs3.com/minetest/my_mods/food/banner.png');"><a href="viewmod.php?id=12">Food</a></td>
<td style="background-image:url('http://www.zimg.eu/i/944678586');"><a href="viewmod.php?id=16">Farming</a></td>
</tr>
</table>
</table>-->
</div>
</div>
@ -88,11 +70,11 @@ echo "</tbody></table></div></p>\n";
<div class="constrain">
<div style="clear: both;"></div>
<h3><a href="viewmod.php?id=random">Random Extension</a></h3>
<!--<h3><a href="viewmod.php?id=random">Random Extension</a></h3>
<p>
Why dont you try something new? Click the above link to go randomly to one of our extensions.
</p>
<br><br>
<br><br>-->
<h3>Hottest Extensions</h3>
<table style="border-spacing: 0; margin: 0; padding: 0; border: 0; width: 100%;">
@ -126,6 +108,37 @@ echo "</tbody></table></div></p>\n";
</td>
</tr></table>
<p>
<a href="#statistics" onClick="toggle('bar_stat');">Statistics</a>
</p>
<?php
function tabCol($title,$msg){
echo "<tr><td><b>".$title.":</b></td><td>$msg</td></tr>\n";
}
echo "<p><div id='bar_stat' style=\"display:none;\">";
echo "<p>\n77 <b>users</b> contributing ".getNoTopics("",$handle)." <b>extensions</b>\n</p>\n";
echo "<table id='statistics'><tbody>\n";
tabCol("Mods",getNoTopics("mod",$handle));
tabCol("Games",getNoTopics("game",$handle));
tabCol("Code Mods",getNoTopics("code",$handle));
tabCol("Texture Packs",getNoTopics("texture",$handle));
tabCol("Visitors","380 a week");
tabCol("Extension Views","unknown");
tabCol("Downloads","unknown");
echo "</tbody></table></div></p>\n";
?>
<p>
If you have any questions at all, do not hesitate to contact us on <a href="http://tinyurl.com/mtmdfrm">this project's forum topic</a>
</p>
<?php
include "scripts/pagefooter.php";
?>

View File

@ -12,8 +12,8 @@ $row = mysql_fetch_array($res) or SQLerrorFancy("Row Error","No results where fo
if (!$row)
SQLerrorFancy("Result error","No results where found for a review with the id $id");
$mres = mysql_query("SELECT * FROM mods WHERE mod_id={$row['mod_id']}",$handle) or SQLerrorFancy("MySQL Query Error","Error on searching database.mods.mod_id for '$id'");
$mod = mysql_fetch_array($mres) or SQLerrorFancy("Row Error","No results where found for a mod with the id $gen_num");
$mres = mysql_query("SELECT * FROM mods WHERE mod_id={$row['mod_id']}",$handle) or SQLerrorFancy("MySQL Query Error","Error on searching database.mods.mod_id for '{$row['mod_id']}'");
$mod = mysql_fetch_array($mres) or SQLerrorFancy("Row Error","No results where found for a mod with the id {$row['mod_id']}");
if (!$mod)
SQLerrorFancy("Result error","No results where found for a mod with the id {$row['mod_id']}");

View File

@ -173,15 +173,15 @@ return false;
}
function getDownload($mod){
if ($mod['repotype']=="git"){
return $mod['file']."/zipball/master";
}else if ($mod['repotype']=="archive"){
if (strstr($mod['tags'],"code")==true){
return "code_mod.php?url=".$mod[9];
}else{
return $mod['file'];
}
}else{
if ($mod['repotype']=="git"){
return $mod['file']."/zipball/master";
}else if ($mod['repotype']=="archive"){
if (strstr($mod['tags'],"code")==true){
return "code_mod.php?url=".$mod[9];
}else{
return $mod['file'];
}
}else{
}
return "";

View File

@ -1,39 +1,45 @@
<?php
require_once('formatcode.php');
$startrow = $_GET['page'];
if (is_numeric($id)==false)
return;
$res = mysql_query("SELECT * FROM reviews WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error on searching database.mods.id for '$query'");
echo "<table id='review'>\n";
$res = mysql_query("SELECT * FROM reviews WHERE mod_id=$id",$handle);
$reviews=false;
while ($hash = mysql_fetch_assoc($res)){
if ($res){
echo "<table id='review'>\n";
$reviews=true;
while ($hash = mysql_fetch_assoc($res)){
$reviews = true;
echo "<tr>";
echo "<tr>";
$owner="";
if (is_numeric($hash['owner_id'])==true){
$r = mysql_query("SELECT name FROM users WHERE id=".$hash['owner_id'],$handle) or SQLerror("MySQL Query Error","Error on getting owner name from users");
$ra = mysql_fetch_array($r);
$owner = $ra['name'];
}
$owner="";
if (is_numeric($hash['owner_id'])==true){
$r = mysql_query("SELECT name FROM users WHERE id=".$hash['owner_id'],$handle) or SQLerror("MySQL Query Error","Error on getting owner name from users");
$ra = mysql_fetch_array($r);
$owner = $ra['name'];
}
echo "<td><div style=\"height:100%;\"><a href=\"user.php?id={$hash['owner_id']}\" >$owner</a></div></td>\n";
echo "<td>".$hash['overview']."\n";
echo "<p><a href=\"review.php?id={$hash['id']}\">Read More</a></p>";
echo "</td>\n";
echo "<td><div style=\"height:100%;\"><a href=\"user.php?id={$hash['owner_id']}\" >$owner</a></div></td>\n";
echo "<td>".$hash['overview']."\n";
echo "<p><a href=\"review.php?id={$hash['id']}\">Read More</a></p>";
echo "</td>\n";
echo "</tr>";
echo "</tr>";
}
echo "</table>\n";
}
echo "</table>\n";
if ($reviews==false){
echo "<i>No reviews available</i>";
echo "<p>\n\tBe the first to <a href=\"addreview.php?id=$id\">review this mod</a>\n</p>";
}else{
echo "<p>\n\t<a href=\"addreview.php?id=$id\">Review this mod</a>\n</p>";
}
?>

View File

@ -269,4 +269,24 @@
top:-18px;
text-align:center;
width:100%;
}
.like_button{
display:block;
width:93px;
height:32px;
background-size:cover;
background-repeat:no-repeat;
text-align: center;
vertical-align: middle;
margin-left:20px;
margin-right:20px;
}
.big_link{
display:block;
width:61px;
height:24px;
padding-left:32px;
padding-top:8px;
}

View File

@ -3,9 +3,11 @@ include "scripts/setup.php";
include "scripts/voters.php";
// Get commands
$id=$_GET['id'];
$act=$_GET['action'];
// Check action
if ($act=="like"){
echo "Liking";
likeMod($id,$_SESSION['user'],$handle,true);
@ -14,9 +16,11 @@ if ($act=="like"){
header("location: viewmod.php?id=$id");
}
// Mod handlers
$res=0;
$gen_num=$id;
// Get the mod query
if ($id=="random"){
$gen_num= rand(0,getNoTopics("",$handle));
$res = mysql_query("SELECT * FROM mods LIMIT $gen_num, 1",$handle);
@ -26,74 +30,76 @@ if ($id=="random"){
SQLerror("Non Integer","Non integers are not allowed in the id field. <br /> <a href=\"index.php\">Back to home</a>");
}
$row = mysql_fetch_array($res) or SQLerrorFancy("Row Error","No results where found for a mod with the id $gen_num");
$page_title="View mod - {$row['name']}";
// Get the mod row
$row = mysql_fetch_array($res) or SQLerrorFancy("Unable to display extension","No results where found for an extension with the id $gen_num");
$id=$row['mod_id'];
$page_keywords=$row['tags'];
// Substitute owner ID with owner name (by Phitherek_):
// Get the owner's name
if (is_numeric($row['owner'])==true){
$r = mysql_query("SELECT name FROM users WHERE id=".$row['owner'],$handle) or SQLerror("MySQL Query Error","Error on getting owner name from users");
$ra = mysql_fetch_array($r);
$owner = $ra['name'];
$r = mysql_query("SELECT name FROM users WHERE id=".$row['owner'],$handle) or SQLerror("MySQL Query Error","Error on getting owner name from users");
$ra = mysql_fetch_array($r);
$owner = $ra['name'];
}else{
$owner = $row['owner'];
$owner = $row['owner'];
}
// End of Phitherek_' s code
// Get the page description
$page_description=$row['overview'];
// Set pageheader.php attributes
$page_title="View mod - {$row['name']}";
$dnw_content=true;
// Run pageheader.php
include "scripts/pageheader.php";
// Get control panel content
if (is_member_moderator($_SESSION['user'],$handle) || getUserId($_SESSION['user'],$handle)==$row['owner']){
$links="<li><a href=\"editentry.php?id=$id\">Edit</a></li>";
$links.="<li><a href=\"3mrelinc.php?id=$id\">Increase 3m Release</a></li>";
$links.="<li><a href=\"deleteentry.php?id=$id\">Delete</a></li>";
$links="<li><a href=\"editentry.php?id=$id\">Edit</a></li>";
$links.="<li><a href=\"3mrelinc.php?id=$id\">Increase 3m Release</a></li>";
$links.="<li><a href=\"deleteentry.php?id=$id\">Delete</a></li>";
}else{
$links="";
$links="";
}
// Extension banner
echo "<div width=\"900\" style=\"background-color:#E8E8E8;text-align:center;padding:20px;\">";
echo "<h1 style=\"margin: 0;padding:0;text-align:center;\">{$row['name']} - by <a href=\"user.php?id={$row['owner']}\">{$owner}</a></h1></th></tr>\n"; // Title and User Link
echo "</div>";
if ($row['mod_id']==38){
echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.<hr>";
}
?>
<div id="content">
<div class="constrain" style="max-width:1000px;width:975px;">
<div style="clear: both;"></div>
<?php
// Write the mod bar
echo "\n<div id='mod_bar'>\n";
// Download section
echo "<div id='bar_download'>\n";
echo "<a href='".getDownload($row)."'>Download</a>\n";
echo "</div>\n";
$like_ext="";
if (is_logged_in()==true){
$like_ext="";
if (likeMod($id,$_SESSION['user'],$handle,false)==true)
$like_ext="_high";
echo "<p><a href=\"viewmod.php?id=$id&action=like\"><img src=\"images/like_mod$like_ext.png\" alt=\"like\" /></a></p>";
echo "<p class='bar_p'><div class=\"like_button\" style=\"background-image:url('images/like{$like_ext}.png');\"><a class=\"big_link\" href=\"viewmod.php?id={$row['mod_id']}&action=like\">{$row['likes']}</a></div></p>";
}else{
echo "<p class='bar_p'><div class=\"like_button\" style=\"background-image:url('images/like_high.png');\"><span class=\"big_link\">{$row['likes']}</span></div></p>";
}
echo "<p class='bar_p'>{$row['overview']}</p>";
echo "<p class='bar_p'>{$row['overview']}</p>";
function tabCol($title,$msg){
echo "<tr><td><b>".$title.":</b></td><td>$msg</td></tr>\n";
}
// Details section
echo "<div class='bar_title'>\n";
echo "Details\n";
echo "</div>\n";
@ -112,7 +118,7 @@ echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.
progressBar($row['progress'],260,$row['progress']."% completed");
echo "</div>";
// Control panel section
if ($links!=""){
echo "<div class='bar_title'>\n";
echo "Control Panel\n";
@ -120,6 +126,8 @@ echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.
echo "<div class='bar_p'><ul>$links</ul></div>\n";
}
// Admin section
if (is_member_moderator($_SESSION['user'],$handle)){
echo "<div class='bar_title'>\n";
echo "Admin Scripts\n";
@ -131,12 +139,12 @@ echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.
echo "</ul></div>\n";
}
// Recommended section
echo "<p>";
include_once "scripts/recommend.php";
echo "</p>";
// Reviews section
echo "<div class='bar_title'>\n";
echo "<a name='reviews'>Reviews</a>\n";
echo "</div>\n";
@ -145,16 +153,18 @@ echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.
include "scripts/show_reviews.php";
echo "</p>";
// End of the mod bar
echo "</div>\n\n";
?>
<div id="mod_main">
<?php
// Parse the bbcode in the description
require_once('scripts/formatcode.php');
$parser = new parser;
$parsed = $parser->p($row['description'],1);
require_once('scripts/formatcode.php');
$parser = new parser;
$parsed = $parser->p($row['description'],1);
// Write the description
echo "<p>$parsed</p>";
?>
@ -165,5 +175,6 @@ echo "<h1>Similar Code Part of 0.4.4</h1>Only use this for versions before this.
<?php
// Write the footer
include "scripts/pagefooter.php";
?>