2012-09-07 10:20:39 -07:00
< ? php
include " scripts/setup.php " ;
2012-10-06 10:30:21 -07:00
2012-09-14 12:15:39 -07:00
include " scripts/voters.php " ;
2012-09-07 10:20:39 -07:00
2013-04-08 07:49:07 -07:00
// Get commands
2012-09-07 10:20:39 -07:00
$id = $_GET [ 'id' ];
2012-09-14 12:15:39 -07:00
$act = $_GET [ 'action' ];
2013-04-08 07:49:07 -07:00
// Check action
2012-09-14 12:15:39 -07:00
if ( $act == " like " ){
2012-10-06 10:30:21 -07:00
echo " Liking " ;
2013-03-05 10:04:29 -08:00
likeMod ( $id , $_SESSION [ 'user' ], $handle , true );
} else if ( $act == " update " ){
updateLikes ( $id , $handle );
header ( " location: viewmod.php?id= $id " );
2012-09-14 12:15:39 -07:00
}
2012-09-07 10:20:39 -07:00
2013-04-08 07:49:07 -07:00
// Mod handlers
2012-12-08 06:23:54 -08:00
$res = 0 ;
2013-02-02 09:37:11 -08:00
$gen_num = $id ;
2012-12-08 06:23:54 -08:00
2013-04-08 07:49:07 -07:00
// Get the mod query
2012-12-08 06:23:54 -08:00
if ( $id == " random " ){
$gen_num = rand ( 0 , getNoTopics ( " " , $handle ));
$res = mysql_query ( " SELECT * FROM mods LIMIT $gen_num , 1 " , $handle );
} else if ( is_numeric ( $id )){
2013-02-02 09:37:11 -08:00
$res = mysql_query ( " SELECT * FROM mods WHERE mod_id= $id " , $handle ) or SQLerrorFancy ( " MySQL Query Error " , " Error on searching database.mods.mod_id for ' $id ' " );
2012-12-08 06:23:54 -08:00
} else {
SQLerror ( " Non Integer " , " Non integers are not allowed in the id field. <br /> <a href= \" index.php \" >Back to home</a> " );
2012-09-07 10:20:39 -07:00
}
2013-04-08 07:49:07 -07:00
// 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 " );
2013-02-02 09:37:11 -08:00
$id = $row [ 'mod_id' ];
2013-02-05 10:07:33 -08:00
$page_keywords = $row [ 'tags' ];
2012-10-06 10:30:21 -07:00
2013-04-08 07:49:07 -07:00
// Get the owner's name
2013-02-02 09:37:11 -08:00
if ( is_numeric ( $row [ 'owner' ]) == true ){
2013-04-08 07:49:07 -07:00
$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' ];
2012-09-16 06:32:07 -07:00
} else {
2013-04-08 07:49:07 -07:00
$owner = $row [ 'owner' ];
2012-09-16 06:32:07 -07:00
}
2012-12-17 12:17:04 -08:00
2013-04-08 07:49:07 -07:00
// Get the page description
2013-02-02 09:37:11 -08:00
$page_description = $row [ 'overview' ];
2013-04-08 07:49:07 -07:00
// Set pageheader.php attributes
$page_title = " View mod - { $row [ 'name' ] } " ;
2013-02-02 09:37:11 -08:00
$dnw_content = true ;
2013-04-08 07:49:07 -07:00
// Run pageheader.php
2012-09-07 10:20:39 -07:00
include " scripts/pageheader.php " ;
2013-04-08 07:49:07 -07:00
// Get control panel content
2013-03-05 10:04:29 -08:00
if ( is_member_moderator ( $_SESSION [ 'user' ], $handle ) || getUserId ( $_SESSION [ 'user' ], $handle ) == $row [ 'owner' ]){
2013-04-08 07:49:07 -07:00
$links = " <li><a href= \" editentry.php?id= $id\ " > Edit </ a ></ li > " ;
$links .= " <li><a href= \" 3mrelinc.php?id= $id\ " > Increase 3 m Release </ a ></ li > " ;
$links .= " <li><a href= \" deleteentry.php?id= $id\ " > Delete </ a ></ li > " ;
2012-09-07 10:20:39 -07:00
} else {
2013-04-08 07:49:07 -07:00
$links = " " ;
2012-09-07 10:20:39 -07:00
}
2013-04-08 07:49:07 -07:00
// Extension banner
2013-02-02 09:37:11 -08:00
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> " ;
?>
< div id = " content " >
2013-02-05 10:07:33 -08:00
< div class = " constrain " style = " max-width:1000px;width:975px; " >
2013-02-02 09:37:11 -08:00
< div style = " clear: both; " ></ div >
< ? php
2012-12-19 11:10:59 -08:00
2013-04-08 07:49:07 -07:00
// Write the mod bar
2013-02-02 09:37:11 -08:00
echo " \n <div id='mod_bar'> \n " ;
2012-10-06 10:30:21 -07:00
2013-04-08 07:49:07 -07:00
// Download section
2013-02-02 09:37:11 -08:00
echo " <div id='bar_download'> \n " ;
echo " <a href=' " . getDownload ( $row ) . " '>Download</a> \n " ;
echo " </div> \n " ;
2012-10-06 10:30:21 -07:00
2013-04-08 07:49:07 -07:00
$like_ext = " " ;
2013-02-02 09:37:11 -08:00
if ( is_logged_in () == true ){
2013-03-05 10:04:29 -08:00
if ( likeMod ( $id , $_SESSION [ 'user' ], $handle , false ) == true )
2013-02-02 09:37:11 -08:00
$like_ext = " _high " ;
2012-10-06 10:30:21 -07:00
2013-04-08 07:49:07 -07:00
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> " ;
2013-02-02 09:37:11 -08:00
}
2012-12-28 08:31:03 -08:00
2013-04-08 07:49:07 -07:00
echo " <p class='bar_p'> { $row [ 'overview' ] } </p> " ;
2012-12-28 08:31:03 -08:00
2013-02-02 09:37:11 -08:00
function tabCol ( $title , $msg ){
echo " <tr><td><b> " . $title . " :</b></td><td> $msg </td></tr> \n " ;
}
2012-12-28 08:31:03 -08:00
2013-04-08 07:49:07 -07:00
// Details section
2013-02-02 09:37:11 -08:00
echo " <div class='bar_title'> \n " ;
echo " Details \n " ;
echo " </div> \n " ;
2012-10-06 10:30:21 -07:00
2013-02-02 09:37:11 -08:00
echo " <p><table id='bar_stat'><tbody> \n " ;
tabCol ( " Name " , $row [ 'basename' ]);
tabCol ( " Version " , $row [ 'version' ]); // Version
tabCol ( " Release " , $row [ '3m_rele' ]);
tabCol ( " License " , $row [ 'license' ]);
tabCol ( " Method " , $row [ 'repotype' ]);
tabCol ( " Depends " , $row [ 'depend' ]);
tabCol ( " Tags " , tagLinks ( $row [ 'tags' ]));
echo " </tbody></table></p> \n " ;
2012-12-19 11:10:59 -08:00
2013-02-20 11:05:59 -08:00
echo " <div style= \" margin-left:20px;margin-bottom:20px; \" > " ;
progressBar ( $row [ 'progress' ], 260 , $row [ 'progress' ] . " % completed " );
echo " </div> " ;
2013-04-08 07:49:07 -07:00
// Control panel section
2013-02-02 09:37:11 -08:00
if ( $links != " " ){
echo " <div class='bar_title'> \n " ;
echo " Control Panel \n " ;
echo " </div> \n " ;
2012-12-19 11:10:59 -08:00
2013-02-10 06:27:56 -08:00
echo " <div class='bar_p'><ul> $links </ul></div> \n " ;
2013-02-02 09:37:11 -08:00
}
2013-04-08 07:49:07 -07:00
// Admin section
2013-03-05 10:04:29 -08:00
if ( is_member_moderator ( $_SESSION [ 'user' ], $handle )){
echo " <div class='bar_title'> \n " ;
echo " Admin Scripts \n " ;
echo " </div> \n " ;
echo " <div class='bar_p'><ul> " ;
echo " <li><a href= \" admin.php?mode=owner&id= $id\ " > Change Owner </ a ></ li > " ;
echo " <li><a href= \" viewmod.php?id= $id &action=update \" >Update Like</a></li> " ;
echo " </ul></div> \n " ;
}
2012-12-13 12:12:38 -08:00
2013-04-08 07:49:07 -07:00
// Recommended section
2013-02-02 09:37:11 -08:00
echo " <p> " ;
include_once " scripts/recommend.php " ;
echo " </p> " ;
2012-09-17 12:03:20 -07:00
2013-04-08 07:49:07 -07:00
// Reviews section
2013-02-02 09:37:11 -08:00
echo " <div class='bar_title'> \n " ;
2013-02-05 10:07:33 -08:00
echo " <a name='reviews'>Reviews</a> \n " ;
2013-02-02 09:37:11 -08:00
echo " </div> \n " ;
2012-10-10 11:38:11 -07:00
2013-02-02 09:37:11 -08:00
echo " <p> " ;
include " scripts/show_reviews.php " ;
echo " </p> " ;
2012-10-30 13:00:22 -07:00
2013-04-08 07:49:07 -07:00
// End of the mod bar
2013-02-02 09:37:11 -08:00
echo " </div> \n \n " ;
2013-02-05 10:07:33 -08:00
?>
< div id = " mod_main " >
2012-10-30 13:00:22 -07:00
2013-02-05 10:07:33 -08:00
< ? php
2013-04-08 07:49:07 -07:00
// Parse the bbcode in the description
require_once ( 'scripts/formatcode.php' );
$parser = new parser ;
$parsed = $parser -> p ( $row [ 'description' ], 1 );
2012-12-28 08:31:03 -08:00
2013-04-08 07:49:07 -07:00
// Write the description
2013-02-02 09:37:11 -08:00
echo " <p> $parsed </p> " ;
2012-09-07 10:20:39 -07:00
2013-02-05 10:07:33 -08:00
?>
< script src = " http://code.jquery.com/jquery-1.8.3.min.js " ></ script >
< script src = " slider.js " ></ script >
2013-02-20 07:42:56 -08:00
</ div >
2013-02-05 10:07:33 -08:00
< ? php
2013-04-08 07:49:07 -07:00
// Write the footer
2012-09-07 10:20:39 -07:00
include " scripts/pagefooter.php " ;
2012-10-06 10:30:21 -07:00
?>