diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/admin_events.php | 85 | ||||
-rw-r--r-- | utils/admin_gallery.php | 108 | ||||
-rw-r--r-- | utils/admin_guestbook.php | 2 | ||||
-rw-r--r-- | utils/admin_newsletter.php | 55 | ||||
-rw-r--r-- | utils/admin_pressrelease.php | 55 | ||||
-rw-r--r-- | utils/album.php | 139 |
6 files changed, 0 insertions, 444 deletions
diff --git a/utils/admin_events.php b/utils/admin_events.php deleted file mode 100644 index 058b9de..0000000 --- a/utils/admin_events.php +++ /dev/null @@ -1,85 +0,0 @@ -<h2>Events</h2> -<?php -include_once($UTIL_DIR."/events.php"); -include_once($UTIL_DIR."/convert.php"); - -if($task == "confirmevent") { - $time = strtotime($month."/" .$day . "/" . $year);// . " " . $hour . ":" . $minute); - - $title = convert($title); - $description = convert($description); - - $event = new Event($title, $time, $description); - $event->show(); -?> -Is this correct?<br/> -<form method="post" action="?page=admin&module=events&task=postevent"> - <input name="title" type="hidden" value="<?php echo $title ?>"/> - <input name="day" type="hidden" value="<?php echo $day ?>"/> - <input name="month" type="hidden" value="<?php echo $month ?>"/> - <input name="year" type="hidden" value="<?php echo $year ?>"/> - <input name="description" type="hidden" value="<?php echo $description ?>"/> - <button type="submit">Yes</button> -</form> -<form method="post" action="?page=admin&module=events"> - <input name="title" type="hidden" value="<?php echo $title ?>"/> - <input name="day" type="hidden" value="<?php echo $day ?>"/> - <input name="month" type="hidden" value="<?php echo $month ?>"/> - <input name="year" type="hidden" value="<?php echo $year ?>"/> - <input name="description" type="hidden" value="<?php echo $description ?>"/> - <button type="submit">No</button> -</form> -<?php - $title = ""; - $day = ""; - $month = ""; - $year = ""; - $hour = ""; - $minute = ""; - $description = ""; -} -?> - -<?php -if($task == "postevent") { - $time = strtotime($month."/" .$day . "/" . $year . " 23:59:00");// . " " . $hour . ":" . $minute); - - $title = convert($title); - $description = convert($description); - - $events = new Events($DATA_DIR."/events.xml"); - $event = new Event($title, $time, $description); - $events->add($event); - $events->write(); - - echo "<p>Event posted successfully.</p>"; - $title = ""; - $day = ""; - $month = ""; - $year = ""; - $description = ""; -} -?> - -<?php -$now = time(); -if($day == "") $day = date("j", $now); -if($month =="") $month = date("n", $now); -if($year == "") $year = date("Y", $now); -?> -<div class="small_header">Post event</div> -<form method="post" action="?page=admin&module=events&task=confirmevent"> - <p> - Title: <input name="title" value="<?php echo convert($title) ?>"/> - </p> - <p> - Date: <input name="day" style="width: 20px;" value="<?php echo $day ?>"/>/ - <input name="month" style="width: 20px;" value="<?php echo $month ?>"/>- - <input name="year" style="width: 40px;" value="<?php echo $year ?>"/> - </p> - <p> - Description:<br/> - <textarea name="description"><?php echo convert($description) ?></textarea> - </p> - <button type="submit">Post event</button> -</form> diff --git a/utils/admin_gallery.php b/utils/admin_gallery.php deleted file mode 100644 index b584229..0000000 --- a/utils/admin_gallery.php +++ /dev/null @@ -1,108 +0,0 @@ -<h2>Gallery</h2> - -<?php include_once($UTIL_DIR."/album.php"); ?> - -<?php -if($task == "newalbum") { - $albumdir = $ALBUMS_DIR . "/" . time(); - echo "New album " . $albumname . "<br/>"; - echo $albumcopyright . "<br/>"; - echo $albumdir . "<br/>"; - mkdir($albumdir); - $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - $xml .= "<album title=\"". $albumname . "\" icon=\"\" copyright=\"" . $albumcopyright . "\">\n"; - $xml .= "</album>\n"; - $fp = fopen($albumdir . "/album.xml", "w"); - fprintf($fp, $xml); - fclose($fp); -} -?> - -<?php -if($task == "uploadimage") { - - echo $album . "<br/>"; - echo $description . "<br/>"; - echo $_FILES['userfile']['tmp_name'] . "<br/>"; - - if($_FILES['userfile']['tmp_name'] != "") { - echo "Filename [". $_FILES['userfile']['tmp_name'] . "]"; - if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { - echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n"; - - $outputfile = time() . ".jpg"; - - $image = imagecreatefromjpeg($_FILES["userfile"]["tmp_name"]); - list($w, $h) = getimagesize($_FILES["userfile"]["tmp_name"]); - - // output size and quality - $quality = 80; - - $max = 530; - - $width = 530;; - $height = 380; - - if($w > $h) { - $width = 530; - $height = 530 / $w * $h; - } else { - $height = 530; - $width = 530 / $h * $w; - } - $image_p = imagecreatetruecolor($width, $height); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $w, $h); - imagejpeg($image_p, $ALBUMS_DIR ."/" .$album ."/" .$outputfile, $quality); - - $photo = new Photo($outputfile, $description); - $album = new Album($album); - $album->add($photo); - $album->write(); - - } else { - echo "Possible file upload attack: "; - echo "filename '". $_FILES['userfile']['tmp_name'] . "'."; - } - } -} -?> - -<div class="small_header">New album</div> -<form method="post" action="?page=admin&module=gallery&task=newalbum"> - <p> - Title: <input name="albumname" value="<?php echo $albumname ?>"/> - </p> - <p> - Copyright: <input name="albumcopyright" value="<?php echo $albumcopyright ?>"/> - </p> - <p> - <button type="submit">Create album</button> - </p> -</form> - -<div class="small_header">Upload image</div> -<form enctype="multipart/form-data" action="?page=admin&module=gallery&task=uploadimage" method="post"> - <p> - Album: - <select name="album"> -<?php -$albums = getAllAlbums(); -foreach($albums as $album) -{ - echo " <option value=\"" . $album->album . "\">" . $album->title . "</option>\n"; -} -?> - </select> - </p> - <p> - Description: - <input name="description" value="<?php echo $description ?>"/> - </p> - <p> - Upload this image: - <input name="userfile" type="file"> - </p> - <p> - <button type="submit">Add Image</button> - </p> -</form> diff --git a/utils/admin_guestbook.php b/utils/admin_guestbook.php deleted file mode 100644 index ebdefbf..0000000 --- a/utils/admin_guestbook.php +++ /dev/null @@ -1,2 +0,0 @@ -<h2>Guestbook</h2> -... nothing to see here ... yet!
\ No newline at end of file diff --git a/utils/admin_newsletter.php b/utils/admin_newsletter.php deleted file mode 100644 index 29275ab..0000000 --- a/utils/admin_newsletter.php +++ /dev/null @@ -1,55 +0,0 @@ -<h2>Newsletter</h2> -<?php -include_once($UTIL_DIR . "/newsletter.php"); -include_once($UTIL_DIR . "/convert.php"); - -if($task == "confirm") { - $testmail = new Email($testaddr, time()); - $testmail->send(utf8_decode(stripslashes($subject)), utf8_decode(stripslashes($message))); - echo "A testmail has been sent to " . $testaddr . ". Check this email to berify the correctness of the contents."; - -?> -Is the newsmail correct?<br/> -<form method="post" action="?page=admin&module=newsletter&task=send"> - <input name="testaddr" type="hidden" value="<?php echo convert($testaddr) ?>"/> - <input name="subject" type="hidden" value="<?php echo convert($subject) ?>"/> - <input name="message" type="hidden" value="<?php echo convert($message) ?>"/> - <button type="submit">Yes</button> -</form> -<form method="post" action="?page=admin&module=newsletter"> - <input name="testaddr" type="hidden" value="<?php echo convert($testaddr) ?>"/> - <input name="subject" type="hidden" value="<?php echo convert($subject) ?>"/> - <input name="message" type="hidden" value="<?php echo convert($message) ?>"/> - <button type="submit">No</button> -</form> -<?php - $subject = ""; - $message = ""; -} -?> - -<?php -if($task == "send") { - $list = new Mailinglist($DATA_DIR . "/mailinglist.xml"); - $list->post(utf8_decode(stripslashes($subject)), utf8_decode(stripslashes($message))); -} -?> - -<div class="small_header">Post newsletter</div> -<form method="post" action="?page=admin&module=newsletter&task=confirm"> - <p> - Test address: - <input name="testaddr" value="<?php echo convert($testaddr) ?>"/> - </p> - <p> - Subject: - <input name="subject" value="<?php echo convert($subject) ?>"/> - </p> - <p> - Message:<br/> - <textarea name="message"><?php echo convert($message) ?></textarea> - </p> - <p> - <button type="submit">Post news</button> - </p> -</form> diff --git a/utils/admin_pressrelease.php b/utils/admin_pressrelease.php deleted file mode 100644 index 65ba35a..0000000 --- a/utils/admin_pressrelease.php +++ /dev/null @@ -1,55 +0,0 @@ -<h2>Pressrelease</h2> -<?php -include_once($UTIL_DIR . "/pressrelease.php"); -include_once($UTIL_DIR . "/convert.php"); - -if($task == "confirm") { - $testmail = new Email("Testname", "http://www.example.com", $testaddr); - $testmail->send(utf8_decode(stripslashes($subject)), utf8_decode(stripslashes($message))); - echo "A testmail has been sent to " . $testaddr . ". Check this email to berify the correctness of the contents."; - -?> -Is the press mail correct?<br/> -<form method="post" action="?page=admin&module=pressrelease&task=send"> - <input name="testaddr" type="hidden" value="<?php echo convert($testaddr) ?>"/> - <input name="subject" type="hidden" value="<?php echo convert($subject) ?>"/> - <input name="message" type="hidden" value="<?php echo convert($message) ?>"/> - <button type="submit">Yes</button> -</form> -<form method="post" action="?page=admin&module=pressrelease"> - <input name="testaddr" type="hidden" value="<?php echo convert($testaddr) ?>"/> - <input name="subject" type="hidden" value="<?php echo convert($subject) ?>"/> - <input name="message" type="hidden" value="<?php echo convert($message) ?>"/> - <button type="submit">No</button> -</form> -<?php - $subject = ""; - $message = ""; -} -?> - -<?php -if($task == "send") { - $list = new PressRelease($DATA_DIR . "/pressrelease.xml"); - $list->post(utf8_decode(stripslashes($subject)), utf8_decode(stripslashes($message))); -} -?> - -<div class="small_header">Post pressrelease</div> -<form method="post" action="?page=admin&module=pressrelease&task=confirm"> - <p> - Test address: - <input name="testaddr" value="<?php echo convert($testaddr) ?>"/> - </p> - <p> - Subject: - <input name="subject" value="<?php echo convert($subject) ?>"/> - </p> - <p> - Message:<br/> - <textarea name="message"><?php echo convert($message) ?></textarea> - </p> - <p> - <button type="submit">Post news</button> - </p> -</form> diff --git a/utils/album.php b/utils/album.php deleted file mode 100644 index 696e75e..0000000 --- a/utils/album.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php -include_once("thumbnail.php"); - -class Photo { - public $file; - public $text; - - function Photo($file, $text) { - $this->file = $file; - $this->text = $text; - } -} - -class Album { - // Album directory (and identifier) - public $album; - - // Photo array - public $photos; - - // Album data - public $title; - public $icon; - public $copyright; - - public function add($photo) { - // First added image is automatically made album icon. - if($this->icon == "") $this->icon = $photo->file; - - $key = $photo->file; - $this->photos[$key] = $photo; - } - - public function write() - { - $fp = fopen($this->file, "w"); - fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); - - fwrite($fp, "<album title=\"". $this->title . "\" icon=\"".$this->icon."\" copyright=\"" . $this->copyright . "\">\n"); - foreach($this->photos as $photo) { - fwrite($fp, " <photo file=\"" . $photo->file . "\"\n"); - fwrite($fp, " text=\"" . $photo->text . "\">\n"); - fwrite($fp, " </photo>\n"); - } - fwrite($fp, "</album>\n"); - - fclose($fp); - } - - private function read() - { - - $dom = new DomDocument; - $dom->preserveWhiteSpace = FALSE; - $dom->load($this->file); - - $params = $dom->getElementsByTagName('album'); - foreach ($params as $param) { - $this->title = $param->getAttribute('title'); - $this->icon = $param->getAttribute('icon'); - $this->copyright = $param->getAttribute('copyright'); - } - - $params = $dom->getElementsByTagName('photo'); - foreach ($params as $param) { - $photo = new Photo($param->getAttribute('file'), $param->getAttribute('text')); - $this->add($photo); - } - - // Key sort - if(sizeof($this->photos) > 0) ksort($this->photos); - } - - public function Album($album) - { - global $ALBUMS_DIR; - $this->album = $album; - $this->file = $ALBUMS_DIR ."/". $album . "/album.xml"; - $this->read(); - } - -} - - -function getAllAlbums() -{ - global $ALBUMS_DIR; - $albums = array(); - - $handle = opendir($ALBUMS_DIR . "/"); - $albumdirs = array(); - while($albumdir = readdir($handle)) { - array_push($albumdirs, $albumdir); - } - - rsort($albumdirs); - - foreach($albumdirs as $albumdir) { - if(!strstr($albumdir, ".") && !strstr($albumdir, "..")) { - $album = new Album($albumdir); - array_push($albums, $album); - } - } - - return $albums; -} - -function getRandomPhoto() -{ - $album; - $photo; - - $albums = getAllAlbums(); - - $numalbums = sizeof($albums); - $ralbum = rand(0, sizeof($albums)-1); - foreach($albums as $a) { - $album = $a; - $ralbum--; - if(!$ralbum) break; - } - - $numphotos = sizeof($album->photos); - $rphoto = rand(0, $numphotos-1); - if($album->photos) { - foreach($album->photos as $p) { - $photo = $p; - $rphoto--; - if(!$rphoto) break; - } - } - - // echo "<p>".$numalbums . " " .$ralbum . " ".$numphotos . " ".$rphoto . "</p>"; - - return array($album, $photo); -} - - -?>
\ No newline at end of file |