Jump to content


MKReviews Module without Image Uploads


  • You cannot reply to this topic
2 replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 31 October 2004 - 02:06 AM

To disable image uploads completely for reviews comment out all relevant references to images and uploads in 2 files.

/mkportal/modules/reviews/index.php
/mkportal/modules/reviews/tpl_reviews.php

Keep in mind that the category images and emoticons are images you don't want to edit out.

This modded file worked for me when I tested it although you use it at your own risk. I am not a programmer. I copied (and commented out) a couple of the file's sql queries so that I could delete the image queries and still retain the original code for reference. It would probably be better to use this file as a reference for making your own edits than to copy and paste it from this post...



[Code in next post...]


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#2 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 31 October 2004 - 02:22 AM

Important: this is not the whole /mkportal/modules/reviews/index.php file but I think all the necessary edits are included...

Quote

function entry_view() {
global $ibforums, $DB, $mklib, $Skin;
$iden = $ibforums->input['iden'];
$query = $DB->query( "SELECT id_cat, title, description, field1, field2, field3, field4, field5, field6, field7, review, author, idauth, click, rate, trate FROM mkp_reviews where id = '$iden'");
//$query = $DB->query( "SELECT id_cat, title, description, field1, field2, field3, field4, field5, field6, field7, image, review, author, idauth, click, rate, trate FROM mkp_reviews where id = '$iden'");
$row = $DB->fetch_row($query);

$click = $row['click'];
$idcategoria = $row['id_cat'];
$name = $row['title'];
$description = $row['description'];
$trate = $row['trate'];
$rate = $row['rate'];
$autore = $row['author'];
//$image = $row['image'];
$review = $row['review'];
$even = $this->retrieve_event($idcategoria);
$width = round(($rate*100)/4) - 6;
$width2 = $width - 4;

$query = $DB->query( "SELECT field1, field2, field3, field4, field5, field6, field7 FROM mkp_reviews_sections WHERE id = '$idcategoria'");
$rowt = $DB->fetch_row($query);

if ($rowt['field1']) {
$field1 = "

{$rowt['field1']}
{$row['field1']}

";
}
if ($rowt['field2']) {
$field2 = "

{$rowt['field2']}
{$row['field2']}

";
}
if ($rowt['field3']) {
$field3 = "

{$rowt['field3']}
{$row['field3']}

";
}
if ($rowt['field4']) {
$field4 = "

{$rowt['field4']}
{$row['field4']}

";
}
if ($rowt['field5']) {
$field5 = "

{$rowt['field5']}
{$row['field5']}

";
}
if ($rowt['field6']) {
$field6 = "

{$rowt['field6']}
{$row['field6']}

";
}
if ($rowt['field7']) {
$field7 = "

{$rowt['field7']}
{$row['field7']}

";
}


/* if ($image) {
$image = "

";
if($scambio) {
$icons = "";
}
$delete = "
<script language="Javascript">

function makesure() {
if (confirm('{$mklib->lang[re_delcommconf]}')) {
return true;
} else {
return false;
}
}

[ {$mklib->lang['re_delete']} ]
";

if(!$ibforums->member['g_access_cp'] && !$mklib->member['g_mod_reviews']) {
$delete = "";
}
$content .= "

base_url}showuser={$id_autore}" class='uno'>{$autorec}
{$data}
{$delete}
$icons
{$testo}

";
}
++$click;
$DB->query("UPDATE mkp_reviews SET click ='$click' where id = '$iden'");
$navbar = "{$mklib->lang['re_ptitle2']}->$even->$name";
$maintit = $name;
$submit = "<script language="Javascript">
function makesure2() {
if (confirm('{$mklib->lang[re_delfileconf]}')) {
return true;
} else {
return false;
}
}
[ {$mklib->lang['re_edit']} ] [ {$mklib->lang['re_delete']} ] ";

if(!$ibforums->member['g_access_cp'] && !$mklib->member['g_mod_reviews'] && $ibforums->member['name'] != $autore) {
$submit = "";
}
$stat = $this->retrieve_stat();
$toolbar = "";
$utonline = $this->retrieve_online();
$output = $this->tpl->review_show($navbar, $maintit, $content, $submit, $stat, $toolbar, $show_pages, $utonline);
$blocks = $Skin->view_block("{$mklib->lang['re_pagetitle']}", $output);
$mklib->printpage("1", "1", "{$mklib->lang['re_pagetitle']}", $blocks);
}

function submit_file() {
global $ibforums, $DB, $mklib, $Skin;

if(!$ibforums->member['g_access_cp'] && !$mklib->member['g_send_reviews']) {
$message = "{$mklib->lang['re_nosend']}";
$mklib->error_page($message);
exit;
}

$navbar = "{$mklib->lang['re_ptitle2']}->{$mklib->lang['re_send']}";
$maintit = "{$mklib->lang['re_ptitle']}";

$cselect = $this->row_select_event();
$content .= "













{$mklib->lang['re_send']}
{$mklib->lang['re_select']}
lang['"]}" id="bgselect">




";

$submit = " [ {$mklib->lang['re_send']} ] ";
$stat = $this->retrieve_stat();
$toolbar = "";
$utonline = $this->retrieve_online();
$output = $this->tpl->review_show($navbar, $maintit, $content, $submit, $stat, $toolbar, $show_pages, $utonline);
$blocks = $Skin->view_block("{$mklib->lang['re_ptitle']}", $output);
$mklib->printpage("1", "1", "{$mklib->lang['re_pagetitle']}", $blocks);
}

function submit_file1() {
global $ibforums, $DB, $mklib, $Skin;

if(!$ibforums->member['g_access_cp'] && !$mklib->member['g_send_reviews']) {
$message = "{$mklib->lang['re_nosend']}";
$mklib->error_page($message);
exit;
}
$idev = $ibforums->input['evento'];
$navbar = "{$mklib->lang['re_ptitle2']}->{$mklib->lang['re_send']}";
$maintit = "{$mklib->lang['re_ptitle']}";

$query = $DB->query( "SELECT field1, field2, field3, field4, field5, field6, field7 FROM mkp_reviews_sections WHERE id = '$idev'");
$row = $DB->fetch_row($query);

$lang = isset($mklib->lang['editor_lang'])?$mklib->lang['editor_lang']:"it";
define('HTML_EDITOR', "1");
$content .= "
<script type="text/javascript">


<script type="text/javascript" src="$mklib->mkurl/editor/htmlarea.js">
<script type="text/javascript">




 
{$mklib->lang['re_"]}
{$mklib->lang['re_descri"]}
"; if ($row['f"]) {
$content .= "
{$row['field1']}
"; } if ($row['f"]) {
$content .= "
{$row['field2']}
"; } if ($row['f"]) {
$content .= "
{$row['field3']}
"; } if ($row['f"]) {
$content .= "
{$row['field4']}
"; } if ($row['f"]) {
$content .= "
{$row['field5']}
"; } if ($row['f"]) {
$content .= "
{$row['field6']}
"; } if ($row['f"]) {
$content .= "
{$row['field7']}
"; } $content .= " {$mklib->lang['re_r"]}


lang['re_i"]}" id="bgselect">





";
$editor = "
<script type="text/javascript">


";
$submit = " [ {$mklib->lang['re_send']} ] ";
$stat = $this->retrieve_stat();
$toolbar = "";
$utonline = $this->retrieve_online();
$output = $this->tpl->review_show($navbar, $maintit, $content, $submit, $stat, $toolbar, $show_pages, $utonline);
$blocks = $Skin->view_block("{$mklib->lang['re_ptitle']}", $output);
$mklib->printpage("1", "1", "{$mklib->lang['re_pagetitle']}", $blocks, $editor);
}

function edit_file() {
global $ibforums, $DB, $mklib, $Skin;


$maintit = "{$mklib->lang['re_ptitle']}";
$iden = $ibforums->input['iden'];

$query = $DB->query( "SELECT id_cat, title, description, field1, field2, field3, field4, field5, field6, field7, review, author FROM mkp_reviews where id = '$iden'");
$row = $DB->fetch_row($query);
$idcategoria = $row['id_cat'];

$query1 = $DB->query( "SELECT id, title FROM mkp_reviews_sections ORDER BY `id` DESC");
while( $row2 = $DB->fetch_row($query1) ) {
$idevento = $row2['id'];
$evento = $row2['title'];
$selected = "";
if($idevento == $idcategoria) {
$selected = "selected";
}
$cselect.= "n";
}

$name = $row['title'];
$description = $row['description'];
$description = str_replace("
", "n", $description);
$review = $row['review'];
$review = str_replace("
", "n", $review);
$row7 = $row['field7'];
$row7 = str_replace("
", "n", $row7);
$autore = $row['author'];
$nav_ev = $this->retrieve_event($idcategoria);

$query1 = $DB->query( "SELECT field1, field2, field3, field4, field5, field6, field7 FROM mkp_reviews_sections WHERE id = '$idcategoria'");
$rowt = $DB->fetch_row($query1);

if(!$ibforums->member['g_access_cp'] && !$mklib->member['g_mod_reviews'] && $ibforums->member['name'] != $autore) {
$message = "{$mklib->lang['re_noedit']}";
$mklib->error_page($message);
exit;
}

$lang = isset($mklib->lang['editor_lang'])?$mklib->lang['editor_lang']:"it";
define('HTML_EDITOR', "1");
$content .= "
<script type="text/javascript">
_editor_url = "$mklib->mkurl/editor/";
_editor_lang = "$lang";

<script type="text/javascript" src="$mklib->mkurl/editor/htmlarea.js">
<script type="text/javascript">
HTMLArea.loadPlugin("TableOperations");
HTMLArea.loadPlugin("ContextMenu");
var editor = null;
function initEditor() {
editor = new HTMLArea("recensione");
editor.registerPlugin(TableOperations);
editor.registerPlugin(ContextMenu);
editor.generate();
}






{$mklib->lang['re_section']}
{$mklib->lang['re_"]}
{$mklib->lang['re_descri"]}
"; if ($rowt['f"]) {
$content .= "
{$rowt['field1']}
"; } if ($rowt['f"]) {
$content .= "
{$rowt['field2']}
"; } if ($rowt['f"]) {
$content .= "
{$rowt['field3']}
"; } if ($rowt['f"]) {
$content .= "
{$rowt['field4']}
"; } if ($rowt['f"]) {
$content .= "
{$rowt['field5']}
"; } if ($rowt['f"]) {
$content .= "
{$rowt['field6']}
"; } if ($rowt['f"]) {
$content .= "
{$rowt['field7']}
"; } $content .= " {$mklib->lang['re_r"]}


lang['re"]}" id="bgselect">





";
$editor = "
<script type="text/javascript">
initEditor();

";
//$submit = " [ Elimina ] ";
$navbar = "{$mklib->lang['re_ptitle2']}->$nav_ev->$name->{$mklib->lang['re_editf']}";
$stat = $this->retrieve_stat();
$toolbar = "";
$utonline = $this->retrieve_online();
$output = $this->tpl->review_show($navbar, $maintit, $content, $submit, $stat, $toolbar, $show_pages, $utonline);
$blocks = $Skin->view_block("{$mklib->lang['re_pagetitle']}", $output);
$mklib->printpage("1", "1", "{$mklib->lang['re_pagetitle']}", $blocks, $editor);
}


function add_file() {

global $ibforums, $DB, $_FILES, $mklib;
$evento = $ibforums->input['evento'];
$title = $ibforums->input['titolo'];
$description = addslashes($mklib->unconvert_html($ibforums->input['descrizione']));
$field1 = $ibforums->input['field1'];
$field2 = $ibforums->input['field2'];
$field3 = $ibforums->input['field3'];
$field4 = $ibforums->input['field4'];
$field5 = $ibforums->input['field5'];
$field6 = $ibforums->input['field6'];
$field7 = $ibforums->input['field7'];
$review = addslashes($mklib->unconvert_html($ibforums->input['recensione']));
/* $FILE_UPLOAD = $ibforums->input['FILE_UPLOAD'];
$file = $_FILES['FILE_UPLOAD']['tmp_name'];
$file_name = $_FILES['FILE_UPLOAD']['name'];
$file_type = $_FILES['FILE_UPLOAD']['type'];
$file_ext = preg_replace("`.*.(.*)`", "1", $file_name);
if (!mk_allowed_attach($file_type, $file_ext)) {
$message = "{$mklib->lang['error_filetype']}";
$mklib->error_page($message);
exit;
} */


$author = $ibforums->member['name'];
$idauth = $ibforums->member['id'];

if (!$evento || !$title || !$description) {
$message = "{$mklib->lang['re_reqtcd']}";
$mklib->error_page($message);
exit;
}

/* if ($mklib->config['upload_file_max'] > 0 && $peso > ($mklib->config['upload_file_max']*1024)) {
$message = "{$mklib->lang['re_toobig']}";
$mklib->error_page($message);
exit;
}

if ($file_name){
$file_ext = substr ($file_name, (strlen($file_name)-3), 3);
$file_ext = strtolower($file_ext);

switch($file_ext)
{
case 'gif':
$ext = 'gif';
break;
case 'jpg':
$ext = 'jpg';
break;
case 'png':
$ext = 'png';
break;
case 'tif':
$ext = 'tif';
break;
case 'bmp':
$ext = 'bmp';
break;
default:
$ext = 'not_supported';
break;
}

if ($ext == "not_supported") {
$message = "{$mklib->lang['re_notsup']}";
$mklib->error_page($message);
exit;
}
@copy("$file", "mkportal/modules/reviews/images/$file_name");
} */


//$query="INSERT INTO mkp_reviews(id_cat, title, description, field1, field2, field3, field4, field5, field6, field7, image, review, author, idauth, date)VALUES('$evento', '$title', '$description', '$field1', '$field2', '$field3', '$field4', '$field5', '$field6', '$field7', '$file_name', '$review', '$author', '$idauth', '".(time())."')";
$query="INSERT INTO mkp_reviews(id_cat, title, description, field1, field2, field3, field4, field5, field6, field7, review, author, idauth, date)VALUES('$evento', '$title', '$description', '$field1', '$field2', '$field3', '$field4', '$field5', '$field6', '$field7', '$review', '$author', '$idauth', '".(time())."')";
$DB->query($query);
$DB->close_db();
Header("Location: index.php?ind=reviews");
exit;
}
function update_file() {
global $ibforums, $_FILES, $DB, $mklib, $MK_PATH;

$iden= $ibforums->input['iden'];
$evento = $ibforums->input['evento'];
$title = $ibforums->input['titolo'];
$description = addslashes($mklib->unconvert_html($ibforums->input['descrizione']));
$field1 = $ibforums->input['field1'];
$field2 = $ibforums->input['field2'];
$field3 = $ibforums->input['field3'];
$field4 = $ibforums->input['field4'];
$field5 = $ibforums->input['field5'];
$field6 = $ibforums->input['field6'];
$field7 = $ibforums->input['field7'];
$review = addslashes($mklib->unconvert_html($ibforums->input['recensione']));
$sql_file = "";
/* if (!empty($_FILES['FILE_UPLOAD']['tmp_name'])) {
$file = $_FILES['FILE_UPLOAD']['tmp_name'];
$file_name = $_FILES['FILE_UPLOAD']['name'];
$file_type = $_FILES['FILE_UPLOAD']['type'];
$peso = $_FILES['FILE_UPLOAD']['size'];
$file_ext = preg_replace("`.*.(.*)`", "1", $file_name);
if (!mk_allowed_attach($file_type, $file_ext)) {
$message = "{$mklib->lang['error_filetype']}";
$mklib->error_page($message);
exit;
}

$file_ext = substr ($file_name, (strlen($file_name)-3), 3);
$file_ext = strtolower($file_ext);
switch($file_ext) {
case 'gif':
$ext = 'gif';
break;
case 'jpg':
$ext = 'jpg';
break;
case 'png':
$ext = 'png';
break;
case 'tif':
$ext = 'tif';
break;
case 'bmp':
$ext = 'bmp';
break;
default:
$ext = 'not_supported';
break;
}

if ($ext == "not_supported") {
$message = "{$mklib->lang['re_notsup']}";
$mklib->error_page($message);
exit;
} */

$time = time();
/* $new_file = "mkportal/modules/reviews/images/temp_".$time."_".$file_name;
@move_uploaded_file("$file", $new_file);
$DB->query("SELECT image FROM mkp_reviews where id = '$iden'");
if ($r = $DB->fetch_row()) {
$old_image = $MK_PATH."mkportal/modules/reviews/images/".$r['image'];
@unlink($old_image);
}
@rename($new_file, str_replace("temp_".$time."_", "", $new_file));
$sql_file = ", image='$file_name'";
} */

//$DB->query("UPDATE mkp_reviews SET id_cat ='$evento', title ='$title', description ='$description', field1='$field1', field2='$field2', field3='$field3', field4='$field4', field5='$field5', field6='$field6', field7='$field7', review='$review' $sql_file where id = '$iden'");
$DB->query("UPDATE mkp_reviews SET id_cat ='$evento', title ='$title', description ='$description', field1='$field1', field2='$field2', field3='$field3', field4='$field4', field5='$field5', field6='$field6', field7='$field7', review='$review' where id = '$iden'");
$DB->close_db();
Header("Location: index.php?ind=reviews&op=entry_view&iden=$iden");
exit;
}

function del_file() {
global $ibforums, $DB, $mklib;

$iden= $ibforums->input['iden'];
//$query = $DB->query( "SELECT image, author FROM mkp_reviews WHERE id = $iden");
$query = $DB->query( "SELECT author FROM mkp_reviews WHERE id = $iden");
$row = $DB->fetch_row($query);
//$file = $row['image'];
$autore = $row['author'];
if(!$ibforums->member['g_access_cp'] && !$mklib->member['g_mod_reviews'] && $ibforums->member['name'] != $autore) {
$message = "{$mklib->lang['re_nodel']}";
$mklib->error_page($message);
exit;
}
[color="#990000"] //@unlink("mkportal/modules/reviews/images/$file");

$DB->query("DELETE FROM mkp_reviews WHERE id = $iden");
$DB->query("DELETE FROM mkp_reviews_comments WHERE identry = $iden");
$DB->close_db();
Header("Location: index.php?ind=reviews");
exit;
}



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#3 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 31 October 2004 - 02:24 AM

FIND in /mkportal/modules/reviews/tpl_reviews.php:
function row_entry($id, $name, $description, $trate, $rate, $width2, $width, $autore, $image, $field1, $field2, $field3, $field4, $field5, $field6, $field7, $review) {

global $ibforums, $mklib;

return <<<EOF

                            {$image}



REPLACE WITH:
function row_entry($id, $name, $description, $trate, $rate, $width2, $width, $autore, $field1, $field2, $field3, $field4, $field5, $field6, $field7, $review) {

global $ibforums, $mklib;

return <<<EOF



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users