Location: PHPKode > projects > Yappa-ng > yappa-ng/admin_modules/admin_module_main.inc.php
<?php

/*
 * ***********************************************************************************************
 * Filename:     admin_module_main.inc.php
 * Module:       Admin-Module
 * Subcategory:  General Album Settings
 * Description:  Sets and changes the album behavior
 * ***********************************************************************************************
 *
 *
 * Project:     yappa-ng : yet another php photo album - next generation
 * Author:      Fritz Berger <hide@address.com>
 * Copyright:   2003 Fritz Berger
 * $Header: /cvsroot/yappa-ng/yappa-ng/admin_modules/admin_module_main.inc.php,v 1.23 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
 *
 * You may contact the author of yappa-ng by e-mail at:
 *    hide@address.com
 *
 * The latest version of yappa-ng can be obtained from:
 *    http://www.zirkon.at/zirkon/scripts/yappa-ng/yappa-ng_main_ger.html (german)
 *    http://www.zirkon.at/zirkon/scripts/yappa-ng/yappa-ng_main_eng.html (english)
 *
 * ***********************************************************************************************
 * ***********************************************************************************************
 * ***                                                                                         ***
 * ***   yappa-ng is based on "YAPPA v1.7 devel - 22.April 2002"                               ***
 * ***                         released on http://sourceforge.net/projects/yappa/              ***
 * ***   YAPPA is Copyright Federico 'pix' Feroldi (hide@address.com)                           ***
 * ***   YAPPA is released under the GNU GPL                                                   ***
 * ***                                                                                         ***
 * ***********************************************************************************************
 * ***********************************************************************************************
 */


?>
<?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'];
	
	$admin_form["number_top10"] = intval($admin_form["number_top10"]);
	/* check if value is 0 after converting the result to integer */
	if ($admin_form["number_top10"] == 0 ) {
		return "no_integer";
	}
	$admin_form["navlink_pages"] = intval($admin_form["navlink_pages"]);
	/* check if value is 0 after converting the result to integer */
	if ($admin_form["navlink_pages"] == 0 ) {
		return "no_integer";
	}
	/* check if variable is really a multiple of 2 */
	$l_stype = gettype($admin_form["navlink_pages"]/2); //returns the type of the result.
	if(!($l_stype == "integer")) {
		return "not_mod2";
	}
	$config_album["use_hitlog"] = $admin_form["use_hitlog"];
	$config_album["use_albumInfo"] = $admin_form["use_albumInfo"];
	$config_album["slideshow"] = $admin_form["slideshow"];
	$config_album["use_top10"] = $admin_form["use_top10"];
	$config_album["number_top10"] = $admin_form["number_top10"];
	$config_album["mark_top10"] = $admin_form["mark_top10"];
	$config_album["sort_by"] = $admin_form["sort_by"];
	$config_album["sort_order"] = $admin_form["sort_order"];
	/*
	if ($admin_form["permit_movie"] == "yes") {
		$config_album["permit_movie"] = true;
	} else {
		$config_album["permit_movie"] = false;
	}
	*/
	$config_album["show_album_desc_prev"] = $admin_form["show_album_desc_prev"];
	$config_album["email"] = $admin_form["email"];
	$config_album["navlink_pages"] = intval($admin_form["navlink_pages"]);

	$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_main_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>

	<!-- Hits Log On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_hitlogh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_hitlogfull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["use_hitlog"] == "yes") { ?>
		<td width="20%"><input type="radio" name="admin_form[use_hitlog]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[use_hitlog]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[use_hitlog]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[use_hitlog]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>
<?php
/*
	<!-- Comments On/Off -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_comh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_comfull"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<?php if ($config_album["use_comments"] == "yes") { ?>
		<td><input type="radio" name="admin_form[use_comments]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[use_comments]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td><input type="radio" name="admin_form[use_comments]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[use_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 Images -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_isorth"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_isortfull"]; ?></td></tr>
	<?php $l_help = 0; ?>
	<tr><td>&nbsp;</td>
	<td><input type="radio" name="admin_form[sort_by]" value="filename" <?php if($config_album["sort_by"] == "filename") { $lhelp = 1; print "checked='checked' "; } ?> > <?php print $lang_akt["admin_main_isortradio1"]; ?></td>
	<td>&nbsp;</td>
	<td><input type="radio" name="admin_form[sort_by]" value="mtime" <?php if($config_album["sort_by"] == "mtime") { $lhelp = 1; print "checked='checked' "; } ?> > <?php print $lang_akt["admin_main_isortradio2"]; ?></td>
	<td>&nbsp;</td>
	<td><input type="radio" name="admin_form[sort_by]" value="hits" <?php if($config_album["sort_by"] == "hits") { $lhelp = 1; print "checked='checked' "; } ?> > <?php print $lang_akt["admin_main_isortradio4"]; ?></td></tr>
	</tr>
	<tr>
	<td>&nbsp;</td>
	<td><input type="radio" name="admin_form[sort_by]" value="captions" <?php if($config_album["sort_by"] == "captions") { $lhelp = 1; print "checked='checked' "; } ?> > <?php print $lang_akt["admin_main_isortradio5"]; ?></td>
	<td>&nbsp;</td>
	<td><input type="radio" name="admin_form[sort_by]" value="rating" <?php if($config_album["sort_by"] == "rating") { $lhelp = 1; print "checked='checked' "; } ?> > <?php print $lang_akt["admin_main_isortradio6"]; ?></td>
	<td>&nbsp;</td>
	<td><input type="radio" name="admin_form[sort_by]" value="none" <?php if($lhelp == 0) { print "checked='checked' "; } ?> > <?php print $lang_akt["admin_main_isortradio3"]; ?></td>
	</tr>
	<tr><td class="adminComments2"><?php print $lang_akt["admin_main_isortimportant"]; ?></td><td colspan=5 class="adminComments"><?php print $lang_akt["admin_main_isortimp2"]; ?></td></tr>
	<tr><td colspan="6">&nbsp;</td></tr>


	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_sortadh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_sortadfull"]; ?></td></tr>
	<td>&nbsp;</td>
	<?php if ($config_album["sort_order"] == "a") { ?>
		<td><input type="radio" name="admin_form[sort_order]" value="a" checked="checked"> <?php print $lang_akt["admin_main_sortadradio1"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[sort_order]" value="d"> <?php print $lang_akt["admin_main_sortadradio2"]; ?></td>
	<?php } else { ?>
		<td><input type="radio" name="admin_form[sort_order]" value="a"> <?php print $lang_akt["admin_main_sortadradio1"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[sort_order]" value="d" checked="checked"> <?php print $lang_akt["admin_main_sortadradio2"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<?php
	/*
	if($config['permit_video_global']) { ?>
		<!-- Permit Video -->
		<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_videoh"]; ?></td></tr>
		<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_videofull"]; ?></td></tr>
		<td>&nbsp;</td>
		<?php if ($config_album["permit_movie"]) { ?>
			<td><input type="radio" name="admin_form[permit_movie]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
			<td>&nbsp;</td>
			<td><input type="radio" name="admin_form[permit_movie]" value="no"> <?php print $lang_akt["no"]; ?></td>
		<?php } else { ?>
			<td><input type="radio" name="admin_form[permit_movie]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
			<td>&nbsp;</td>
			<td><input type="radio" name="admin_form[permit_movie]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
		<?php } ?>
		<td colspan="2">&nbsp;</td>
		</tr>
		<tr><td colspan="6">&nbsp;</td></tr>
	<?php }
	*/
	if($config['show_album_desc_prev'] == "yes") { ?>
		<!-- Display Album Description Preview -->
		<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_albumdescrh"]; ?></td></tr>
		<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_albumdescrfull1"] . $lang_akt["no_comment_available"] . $lang_akt["admin_main_albumdescrfull2"] . $lang_akt["commentpreview_disabled"] . $lang_akt["admin_main_albumdescrfull3"]; ?></td></tr>
		<td>&nbsp;</td>
		<?php if ($config_album["show_album_desc_prev"] == "yes") { ?>
			<td><input type="radio" name="admin_form[show_album_desc_prev]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
			<td>&nbsp;</td>
			<td><input type="radio" name="admin_form[show_album_desc_prev]" value="no"> <?php print $lang_akt["no"]; ?></td>
		<?php } else { ?>
			<td><input type="radio" name="admin_form[show_album_desc_prev]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
			<td>&nbsp;</td>
			<td><input type="radio" name="admin_form[show_album_desc_prev]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
		<?php } ?>
		<td colspan="2">&nbsp;</td>
		</tr>
		<tr><td colspan="6">&nbsp;</td></tr>
	<?php } ?>

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

	<!-- Album-Info On/Off-->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_albuminfoh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_albuminfofull"]; ?></td></tr>
	<tr>
	<td width="5%">&nbsp;</td>
	<?php if ($config_album["use_albumInfo"] == "yes") { ?>
		<td width="20%"><input type="radio" name="admin_form[use_albumInfo]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[use_albumInfo]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td width="20%"><input type="radio" name="admin_form[use_albumInfo]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td width="5%">&nbsp;</td>
		<td width="20%"><input type="radio" name="admin_form[use_albumInfo]" 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_main_emailh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_emailfull"]; ?></td></tr>
	<td>&nbsp;</td>
	<tr>
	<td>&nbsp;</td>
	<td colspan="5"><input type="text" name="admin_form[email]" size="40" value="<?php print $config_album["email"]; ?>"> <?php print $lang_akt["admin_main_emailtext"]; ?> </td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Size of Navlink Pages -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_navlink_pagesh"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_navlink_pagesfull"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<td colspan="5"><input type="text" name="admin_form[navlink_pages]" size="5" value="<?php print $config_album["navlink_pages"]; ?>"> <?php print $lang_akt["admin_main_navlink_pagestext"]; ?> </td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>



	<!-- Top 10 START -->
	<tr><td colspan=6 align="center" class="adminHeading"><?php print $lang_akt["admin_main_htop10"]; ?></td></tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Use Top 10 -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_top10h"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_top10full"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<?php if ($config_album["use_top10"] == "yes") { ?>
		<td><input type="radio" name="admin_form[use_top10]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[use_top10]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td><input type="radio" name="admin_form[use_top10]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[use_top10]" value="no" checked="checked"> <?php print $lang_akt["no"]; ?></td>
	<?php } ?>
	<td colspan="2">&nbsp;</td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>

	<!-- Number of Top 10 -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_numbertop10h"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_numbertop10full"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<td colspan="5"><input type="text" name="admin_form[number_top10]" size="5" value="<?php print $config_album["number_top10"]; ?>"> <?php print $lang_akt["admin_main_numbertop10text"]; ?> </td>
	</tr>
	<tr><td colspan="6">&nbsp;</td></tr>


	<!-- Mark Top 10 -->
	<tr><td colspan=6 class="adminDescription"><?php print $lang_akt["admin_main_marktop10h"]; ?></td></tr>
	<tr><td colspan=6 class="adminComments"><?php print $lang_akt["admin_main_marktop10full"]; ?></td></tr>
	<tr>
	<td>&nbsp;</td>
	<?php if ($config_album["mark_top10"] == "yes") { ?>
		<td><input type="radio" name="admin_form[mark_top10]" value="yes" checked="checked"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[mark_top10]" value="no"> <?php print $lang_akt["no"]; ?></td>
	<?php } else { ?>
		<td><input type="radio" name="admin_form[mark_top10]" value="yes"> <?php print $lang_akt["yes"]; ?></td>
		<td>&nbsp;</td>
		<td><input type="radio" name="admin_form[mark_top10]" 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">
		<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