00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00029 $_init_prefix = dirname(__FILE__);
00030
00031 session_start();
00032
00033
00034 if (isset($_REQUEST['signout']))
00035 {
00036
00037 session_destroy();
00038 }
00039
00040
00041 require_once "$_init_prefix/helper/functions.php";
00042 require_once "$_init_prefix/classes/Settings.php";
00043 require_once "$_init_prefix/classes/Configuration.php";
00044 require_once "$_init_prefix/classes/ThemeEngine.php";
00045 require_once "$_init_prefix/classes/Document.php";
00046 require_once "$_init_prefix/classes/Userdata.php";
00047 require_once "$_init_prefix/classes/Comments.php";
00048
00049
00050 loadSettingsFile();
00051
00052
00053 $config = new Configuration();
00054 $config->loadData();
00055
00056
00057 $themeEngine = new ThemeEngine();
00058
00059
00060 $document = new Document();
00061
00062 if ($_SESSION['logged'])
00063 {
00064
00065 $user = new UserData();
00066 $user->loadData($_SESSION['logged'], $_SESSION['password']);
00067 }
00068
00069
00070
00071
00072 if (isset($_REQUEST['dosignin']))
00073 {
00074 $user = new UserData();
00075 $user->loadData($_REQUEST['username'], $_REQUEST['password']);
00076
00077 if ($user->allOK())
00078 {
00079 session_register("logged");
00080 $_SESSION['logged'] = $_REQUEST['username'];
00081 $_SESSION['password'] = $user->password;
00082 }
00083 }
00084
00085
00086 if (isset($_REQUEST['addcomment']) && $config->option('addcomments'))
00087 {
00088 global $albumdata, $comments;
00089 $album = getAlbum();
00090 $albumdata = get_albumdata($album);
00091 $comments_source = $albumdata->attribute('comments');
00092 $comments = new Comments($comments_source);
00093
00094
00095
00096 if (basename($_SERVER['PHP_SELF'], ".php") == "index")
00097 {
00098 $for = "-album-";
00099 }
00100 else
00101 {
00102 $for = ($_REQUEST['image'] == "") ? "-album-" : $albumdata->photos[$_REQUEST['image']];
00103 }
00104 $data = array(
00105 "for" => $for,
00106 "sender" => ($_SESSION['username'] == null) ? "anonymous" : $_SESSION['username'],
00107 "from" => $_SERVER['REMOTE_ADDR'],
00108 "time" => time(),
00109 "message" => stripslashes($_REQUEST['newcomment']));
00110 $comments->addComment($data);
00111 }
00112
00113 theme($config->option('theme'));
00114 ?>