<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2002 Bharat Mediratta
 * 
 * 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
// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
		!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
		!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
	print "Security violation\n";
	exit;
}
?>
<?php require("./init.php"); ?>
<?php
// Hack check
if (!$gallery->user->canWriteToAlbum($gallery->album)) {
	exit;
}
?>

<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
  <title>フォトの回転</title>
   
</head>
<body>

<?php
if ($gallery->session->albumName && isset($index)) {
	if ($rotate) {
?>
	<center>
	 フォトの回転
	 <br>
	 (少々時間がかかります)
	</center>
<?php
		my_flush();
                set_time_limit($gallery->app->timeLimit);
		$gallery->album->rotatePhoto($index, $rotate);
		$gallery->album->save();
		dismissAndReload();
		return;
	} else {
?>

<center>
フォトの回転方法は？
<br>
<?php $args = array("albumName" => $gallery->album->fields["name"], "index" => $index); ?>
<?php $args["rotate"] = "90"; ?>
<a href=<?php echo makeGalleryUrl("rotate_photo.php", $args)?>>時計逆回り 90&ordm;</a>
/
<?php $args["rotate"] = "180"; ?>
<a href=<?php echo makeGalleryUrl("rotate_photo.php", $args)?>>上下 180&ordm;</a>
/
<?php $args["rotate"] = "-90"; ?>
<a href=<?php echo makeGalleryUrl("rotate_photo.php", $args)?>>時計回り 90&ordm;</a>
/
<a href="javascript:void(parent.close())">やめる</a>
<br>

<p>
<?php echo $gallery->album->getThumbnailTag($index) ?>

<?php
	}
} else {
	gallery_error("no album / index specified");
}
?>

</body>
</html>

