Skip to content

Instantly share code, notes, and snippets.

@3l3ktr0n
Created February 22, 2021 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3l3ktr0n/f95dde9965078f7b77709b66d503fa13 to your computer and use it in GitHub Desktop.
Save 3l3ktr0n/f95dde9965078f7b77709b66d503fa13 to your computer and use it in GitHub Desktop.
<?php
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
}
class reviews_front
{
public function run()
{
$sql = e107::getDb();
$tp = e107::getParser();
$ns = e107::getRender();
$reviewID = $_GET["id"];
if($reviewID != "")
{
$sql->select("games_reviews", "*", "ID='{$reviewID}'");
while($row = $sql->fetch())
{
echo $row['Title'];
echo "<BR>";
if($row['Image'] != "")
{
$imagePath = str_replace("{e_MEDIA_IMAGE}","",$row['Image']);
$imageURL = SITEURL.e_MEDIA_IMAGE.$imagePath;
?>
<img src="<?php echo $imageURL; ?>" alt="" class="single_image">
<?php
}
echo "<BR>";
$Content = str_replace("[html]","",$row['Content']);
$Content = str_replace("[/html]","",$Content);
//$tp->toHtml(string, bbcodes, type);
echo $tp->toHtml($Content, true, 'BODY');
$thisRatingBG = SITEURL."/e107_plugins/games/images/rating_star.png";
$thisRating = $row['Rating'];
if($thisRating > 7)
{
$thisRatingValue = "Great";
}
else if($thisRating > 5)
{
$thisRatingValue = "Good";
}
else if($thisRating < 5)
{
$thisRatingValue = "Bad";
}
echo $thisRating;
echo $thisRatingValue;
echo "<BR>";
if($row['TheBad'] == "")
{
echo "No anything written by user for this.";
}
else
{
$TheBad = str_replace("[html]","",$row['TheBad']);
$TheBad = str_replace("[/html]","",$TheBad);
//$tp->toHtml(string, bbcodes, type);
echo $tp->toHtml($TheBad, true, 'BODY');
}
echo "<BR><BR>";
if($row['TheGood'] == "")
{
echo "No anything written by user for this.";
}
else
{
$TheGood = str_replace("[html]","",$row['TheGood']);
$TheGood = str_replace("[/html]","",$TheGood);
//$tp->toHtml(string, bbcodes, type);
echo $tp->toHtml($TheGood, true, 'BODY');
}
}
}
}
private function renderComments()
{
/**
* Returns a rendered commenting area. (html) v2.x
* This is the only method a plugin developer should require in order to include user comments.
* @param string $plugin - directory of the plugin that will own these comments.
* @param int $id - unique id for this page/item. Usually the primary ID of your plugin's database table.
* @param string $subject
* @param bool|false $rate true = will rendered rating buttons, false will not.
* @return null|string
*/
$plugin = 'game_reviews';
$id = 1;
$subject = 'My games item subject';
$rate = true;
$ret = e107::getComment()->render($plugin, $id, $subject, $rate);
$ns->tablerender($ret['caption'],$ret['comment_form']. $ret['comment']);
}
}
$reviewsFront = new reviews_front;
require_once(HEADERF); // render the header (everything before the main content area)
$reviewsFront->run();
require_once(FOOTERF); // render the footer (everything after the main content area)
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment