<?php
/*
* ***********************************************************************************************
* Project: yappa-ng (yet another php photo album - next generation)
* Filename: admin_module_rating.inc.php
* Type: Include File
* Module: Admin-Module
* Subcategory: Album/Image Rating
* Description: Configuration of album/image Rating
* ***********************************************************************************************
* Author: Fritz Berger <hide@address.com>
* Copyright: 2003, 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_rating.inc.php,v 1.5 2005/04/25 18:02:07 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_rform = $_POST['admin_rform'];
if($admin_rform["rate_album"] == "yes") {
$config_album['rate_album'] = TRUE;
} else {
$config_album['rate_album'] = FALSE;
}
if($admin_rform["rate_album_checkIP"] == "yes") {
$config_album['rate_album_checkIP'] = TRUE;
} else {
$config_album['rate_album_checkIP'] = FALSE;
}
if($admin_rform["rate_image"] == "yes") {
$config_album['rate_image'] = TRUE;
} else {
$config_album['rate_image'] = FALSE;
}
if($admin_rform["rate_image_checkIP"] == "yes") {
$config_album['rate_image_checkIP'] = TRUE;
} else {
$config_album['rate_image_checkIP'] = FALSE;
}
if($admin_rform["rate_show_thumbs"] == "yes") {
$config_album['rate_show_thumbs'] = TRUE;
} else {
$config_album['rate_show_thumbs'] = 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['BeenrSubmitted'])) {
$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_main_hrating"]; ?></td></tr>
<tr><td colspan="6"> </td></tr>
<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_rate_description"]; ?></td></tr>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_description2"]; ?></td></tr>
<tr><td colspan="6"> </td></tr>
<tr><td colspan="6" align="center" class="adminStatus">
<?php if(isset($_POST['BeenrSubmitted'])) {
switch($answer) {
case 1:
print $lang_akt["admin_main_status1"];
break;
case 2:
print $lang_akt["admin_main_status2"];
break;
case 3:
print $lang_akt["admin_main_status3"];
break;
default:
print "";
break;
}
} ?>
</td></tr>
<tr><td colspan="6"> </td></tr>
<!-- Rate Album -->
<?php
// check if rating of album is permitted global or not
if($config['rate_album']) { ?>
<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_rate_albumh"]; ?></td></tr>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_albumfull"]; ?></td></tr>
<tr>
<td> </td>
<?php if ($config_album['rate_album']) { ?>
<td><input type="radio" name="admin_rform[rate_album]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_album]" value="no"> <?php print $lang_akt["no"]; ?></td>
<?php } else { ?>
<td><input type="radio" name="admin_rform[rate_album]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_album]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
<?php } ?>
<td colspan="3"> </td>
</tr>
<?php } else { ?>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_albumstat"]; ?></td></tr>
<?php } ?>
<tr><td colspan="6"> </td></tr>
<!-- rate_album_checkIP -->
<?php
// check if rating of album is permitted global or not
// check if check of IP is permitted global or not
if($config['rate_album'] && $config['rate_album_checkIP']) { ?>
<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_rate_albumIPh"]; ?></td></tr>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_albumIPfull"]; ?></td></tr>
<tr>
<td> </td>
<?php if ($config_album['rate_album_checkIP']) { ?>
<td><input type="radio" name="admin_rform[rate_album_checkIP]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_album_checkIP]" value="no"> <?php print $lang_akt["no"]; ?></td>
<?php } else { ?>
<td><input type="radio" name="admin_rform[rate_album_checkIP]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_album_checkIP]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
<?php } ?>
<td colspan="3"> </td>
</tr>
<?php } elseif($config['rate_album'] && !$config['rate_album_checkIP']) { ?>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_albumIPstat"]; ?></td></tr>
<?php } ?>
<tr><td colspan="6"> </td></tr>
<!-- Rate Image -->
<?php
// check if rating of images is permitted global or not
if($config['rate_image']) { ?>
<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_rate_imageh"]; ?></td></tr>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_imagefull"]; ?></td></tr>
<tr>
<td> </td>
<?php if ($config_album['rate_image']) { ?>
<td><input type="radio" name="admin_rform[rate_image]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_image]" value="no"> <?php print $lang_akt["no"]; ?></td>
<?php } else { ?>
<td><input type="radio" name="admin_rform[rate_image]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_image]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
<?php } ?>
<td colspan="3"> </td>
</tr>
<?php } else { ?>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_imagestat"]; ?></td></tr>
<?php } ?>
<tr><td colspan="6"> </td></tr>
<!-- rate_image_checkIP -->
<?php
// check if rating of images is permitted global or not
// check if check of IP is permitted global or not
if($config['rate_image'] && $config['rate_image_checkIP']) { ?>
<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_rate_imageIPh"]; ?></td></tr>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_imageIPfull"]; ?></td></tr>
<tr>
<td> </td>
<?php if ($config_album["rate_image_checkIP"]) { ?>
<td><input type="radio" name="admin_rform[rate_image_checkIP]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_image_checkIP]" value="no"> <?php print $lang_akt["no"]; ?></td>
<?php } else { ?>
<td><input type="radio" name="admin_rform[rate_image_checkIP]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_image_checkIP]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
<?php } ?>
<td colspan="3"> </td>
</tr>
<?php } elseif($config['rate_image'] && !$config['rate_image_checkIP']) { ?>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_imageIPstat"]; ?></td></tr>
<?php } ?>
<tr><td colspan="6"> </td></tr>
<!-- rate_show_thumbs -->
<?php
// check if rating of images should be displayed in the thumbnailpage above the thumbnails too
// check if rating of images is permitted global or not
if($config['rate_image']) { ?>
<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_rate_thumbsh"]; ?></td></tr>
<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_rate_thumbsfull"]; ?></td></tr>
<tr>
<td> </td>
<?php if ($config_album['rate_show_thumbs']) { ?>
<td><input type="radio" name="admin_rform[rate_show_thumbs]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_show_thumbs]" value="no"> <?php print $lang_akt["no"]; ?></td>
<?php } else { ?>
<td><input type="radio" name="admin_rform[rate_show_thumbs]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
<td><input type="radio" name="admin_rform[rate_show_thumbs]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
<?php } ?>
<td colspan="3"> </td>
</tr>
<?php } ?>
<tr><td colspan="6"> </td></tr>
<tr><td colspan="6"> </td></tr>
<tr><td colspan="6"> </td></tr>
<tr><td colspan="6" align="center">
<input type="hidden" name="BeenrSubmitted" value="true">
<input type="submit" name="submit" value="<?php print $lang_akt['submit']; ?>">
</td></tr>
</table>
</td>
</tr>
</table>
</form>
<?php
?>