Location: PHPKode > projects > Yappa-ng > yappa-ng/admin_modules/admin_module_comments.inc.php
<?php
/*
 * ***********************************************************************************************
 * Project:      yappa-ng (yet another php photo album - next generation)
 * Filename:     admin_module_comments.inc.php
 * Type:         Include File
 * Module:       Admin-Module
 * Subcategory:  User Comments
 * Description:  Configuration of User Comments
 * ***********************************************************************************************
 * Author:       Fritz Berger <hide@address.com>
 * Copyright:    2004 Fritz Berger
 * Homepage:     http://www.zirkon.at/zirkon/scripts/yappa-ng/yappa-ng_main_eng.html
 * ***********************************************************************************************
 * $Header: /cvsroot/yappa-ng/yappa-ng/admin_modules/admin_module_comments.inc.php,v 1.4 2005/04/25 18:02:06 zirkon13 Exp $
 * ***********************************************************************************************
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

?>
<?php

/*
 * Standard Security Check
 */

if (!defined('SecCheck')) {
	die("You Cannot Access This Script Directly - Have a Nice Day.");
}


function HandleForm () {
	global $config_album;
	global $config;
	global $selected_album;

	$admin_form = $_POST['admin_form'];
	



	if ($admin_form["show_comments"] == "yes") {
		$config_album["show_comments"] = TRUE;
	} else {
		$config_album["show_comments"] = FALSE;
	}
	$config_album["comment_sort"] = $admin_form["comment_sort"];			// a/d
	$admin_form["comments_per_page"] = intval($admin_form["comments_per_page"]);
	/* check if value is 0 after converting the result to integer */
	if ($admin_form["comments_per_page"] == 0 ) {
		return "no_integer";
	} else {
		$config_album["comments_per_page"] = $admin_form["comments_per_page"];
	}
	$admin_form["show_new_com_days"] = intval($admin_form["show_new_com_days"]);
	/* check if value is 0 after converting the result to integer */
	if ($admin_form["show_new_com_days"] == 0 ) {
		return "no_integer";
	} else {
		$config_album["show_new_com_days"] = $admin_form["show_new_com_days"];
	}
	if ($admin_form["show_thumbs_comments"] == "yes") {
		$config_album["show_thumbs_comments"] = TRUE;
	} else {
		$config_album["show_thumbs_comments"] = FALSE;
	}
	if ($admin_form["comment_use_emoticons"] == "yes") {
		$config_album["comment_use_emoticons"] = TRUE;
	} else {
		$config_album["comment_use_emoticons"] = FALSE;
	}
	if ($admin_form["comment_use_mood"] == "yes") {
		$config_album["comment_use_mood"] = TRUE;
	} else {
		$config_album["comment_use_mood"] = FALSE;
	}
	if ($admin_form["show_thumbs_comments"] == "yes") {
		$config_album["show_thumbs_comments"] = TRUE;
	} else {
		$config_album["show_thumbs_comments"] = FALSE;
	}
	if ($admin_form["show_new_com"] == "yes") {
		$config_album["show_new_com"] = TRUE;
	} else {
		$config_album["show_new_com"] = FALSE;
	}
	if ($admin_form["suppress_zero_comments"] == "yes") {
		$config_album["suppress_zero_comments"] = TRUE;
	} else {
		$config_album["suppress_zero_comments"] = FALSE;
	}
	if ($admin_form["show_comm_preview"] == "yes") {
		$config_album["show_comm_preview"] = TRUE;
	} else {
		$config_album["show_comm_preview"] = FALSE;
	}

	$configfilename = singleslash($config["photo_root"] . "/" . rawurldecode($_GET["album"]));

	/* write the album-config to the harddisk */
	$l_value = write_albumconf($configfilename, $config_album);
	return $l_value;


}

/* read the config_album.inc.php new!
 * in some setups the settings will get automatically changed.
 * For instance:
 *   if the hits.log for this album is not read/writeable:
 *    - the hitcounter will get switched off
 *    - the TopX will get switched off
 *    - ....some more
 * HERE you want to see your REAL settings!!
 * Thats why you have to read the albumconfig new before editing it!! */
$config_filename = singleslash($config["photo_root"] . "/" . rawurldecode($_GET["album"]));

$config_album = read_albumconf($config_filename);

/* if this form has been submitted than react and set everything! */
if(isset($_POST['BeenSubmitted'])) {
	$answer = HandleForm();
}
?>

<form action="<?php print $global_var['self_url']; ?>" method="post">
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<tr valign="top">
<td class="thumbnailCell">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
	<tr><td colspan=6 align="center" class="adminHeading"><?php print $lang_akt["admin_comm_hmain"]; ?></td></tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<tr><td colspan="6" align="center" class="adminStatus">
	<?php if(isset($_POST['BeenSubmitted'])) {
		switch($answer) {
			case 1:
				print $lang_akt["admin_main_status1"];
				break;
			case 2:
				print $lang_akt["admin_main_status2"];
				break;
			case "no_integer":
				print $lang_akt["admin_main_status3"];
				break;
			case "not_mod2":
				print $lang_akt["admin_main_status4"];
				break;
			default:
				print "";
				break;
		}
	} ?>
	</td></tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Comments On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_enableh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_enablefull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["show_comments"]) { ?>
		<td width="20%"><input type="radio" name="admin_form[show_comments]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[show_comments]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[show_comments]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[show_comments]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Sort Comments -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_sorth"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_sortfull"]; ?></td></tr>
	<?php $l_help = 0; ?>
	<tr><td>&nbsp;</td>
	<?php if ($config_album["comment_sort"] == "d") { ?>
		<td><input type="radio" name="admin_form[comment_sort]" value="d" checked="checked"> <?php print $lang_akt["admin_main_sortadradio2"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[comment_sort]" value="a"> <?php print $lang_akt["admin_main_sortadradio1"]; ?></td>
	<?php } else { ?>
		<td><input type="radio" name="admin_form[comment_sort]" value="d"> <?php print $lang_akt["admin_main_sortadradio2"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[comment_sort]" value="a" checked="checked"> <?php print $lang_akt["admin_main_sortadradio1"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Number of Comments per page -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_pagesh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_pagesfull"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<td colspan="5"><input type="text" name="admin_form[comments_per_page]" size="5" value="<?php print $config_album['comments_per_page']; ?>"> <?php print $lang_akt["admin_comm_pagesh"]; ?> </td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Use Emoticons On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_smilyh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_smilyfull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["comment_use_emoticons"]) { ?>
		<td width="20%"><input type="radio" name="admin_form[comment_use_emoticons]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[comment_use_emoticons]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[comment_use_emoticons]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[comment_use_emoticons]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>


	<!-- Use Mood On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_moodh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_moodfull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["comment_use_mood"]) { ?>
		<td width="20%"><input type="radio" name="admin_form[comment_use_mood]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[comment_use_mood]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[comment_use_mood]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[comment_use_mood]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>


	<!-- Show Comment Preview On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_prevh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_prevfull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["show_comm_preview"]) { ?>
		<td width="20%"><input type="radio" name="admin_form[show_comm_preview]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[show_comm_preview]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[show_comm_preview]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[show_comm_preview]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>
	<tr><td colspan=6 align="center" class="adminHeading"><?php print $lang_akt["admin_comm_hmain"] . " " . $lang_akt["admin_main_hthumb"]; ?></td></tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Show commentcount in thumbnail page On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_thumbh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_thumbfull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["show_thumbs_comments"]) { ?>
		<td width="20%"><input type="radio" name="admin_form[show_thumbs_comments]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[show_thumbs_comments]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[show_thumbs_comments]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[show_thumbs_comments]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Show commentcount only if not zero On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_thumbnzh"] . " &quot;" . $lang_akt["com_number"] . " 0&quot;"; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_thumbnzfull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["suppress_zero_comments"]) { ?>
		<td width="20%"><input type="radio" name="admin_form[suppress_zero_comments]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[suppress_zero_comments]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[suppress_zero_comments]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[suppress_zero_comments]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_newh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_newfull"]; ?></td></tr>
	<td>&nbsp;</td>
	<?php if ($config_album['show_new_com']) { ?>
		<td><input type="radio" name="admin_form[show_new_com]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[show_new_com]" value="no" > <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td><input type="radio" name="admin_form[show_new_com]" value="yes" > <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[show_new_com]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_comm_newdaysh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_comm_newdaysfull"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<td colspan="5"><input type="text" name="admin_form[show_new_com_days]" size="5" value="<?php print $config_album['show_new_com_days']; ?>"> <?php print $lang_akt["admin_main_newdaystext"]; ?></td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<tr><td colspan="6">&nbsp;</td></tr>
	<tr><td colspan="6" align="center">
		<input type="hidden" name="BeenSubmitted" value="true">
		<input type="submit" name="submit" value="<?php print $lang_akt['submit']; ?>">
	</td></tr>



</table>
</td>
</tr>
</table>
</form>


<?php



?>
Return current item: Yappa-ng