[Astrospaces-commits] SF.net SVN: astrospaces: [86] trunk
Brought to you by:
p3net
|
From: <p3...@us...> - 2007-08-01 23:32:09
|
Revision: 86
http://astrospaces.svn.sourceforge.net/astrospaces/?rev=86&view=rev
Author: p3net
Date: 2007-08-01 16:32:07 -0700 (Wed, 01 Aug 2007)
Log Message:
-----------
Forgot to commit these
Modified Paths:
--------------
trunk/gallery.php
trunk/globals.php
Modified: trunk/gallery.php
===================================================================
--- trunk/gallery.php 2007-08-01 22:35:29 UTC (rev 85)
+++ trunk/gallery.php 2007-08-01 23:32:07 UTC (rev 86)
@@ -1,142 +1,142 @@
-<?php
-/*******************************************************
- * Copyright (C) 2007 http://p3net.net
-
- 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.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- @id: $Id$
-*********************************************************/
-
-class gallery
-{
- /*
- Function Name: view
- Arguments: (int) id -- ID of user
- Purpose: View gallery of user
- */
- function view($id)
- {
- if($id == 0)
- {
- $error->general('Must be logged in!', 'Tried to access gallery as owner while unauthenticated');
- }
- else
- {
- if($session->is_friend($id))
- {
- $_query = 'SELECT img_id FROM '.AS_TBL_IMG.' WHERE owner_id = '.$db->qstr($id,get_magic_quotes_gpc());
- $_query = $db->Execute($_query);
- $_query = $db->GetArray($_query);
- $gallery = new template(AS_DIR_TPL.'gallery.tpl');
- $gallery->set_var('gallery', $_query);
- }
- }
- }
- /*
- Function Name: drill
- Arguments: (int) img_id -- ID of image to view; (int) owner -- ID of image uploader
- Purpose: View fullsize image/comments of specific image
- */
- function drill( $img_id, $owner )
- {
- if( empty( $img_id ) )
- {
- $error->general('An image must be specified', 'Tried to access drill without specifying image id');
- }
- else
- {
- if( $session->is_friend($owner) )
- {
- $_query = 'SELECT * FROM '.AS_TBL_IMG.' WHERE img_id = '.$db->qstr($img_id,get_magic_quotes_gpc());
- $img = $db->Execute( $_query );
-
- $_query = 'SELECT * FROM '.AS_TBL_IMG_CMT.' WHERE image_id = '.$db->qstr($img_id,get_magic_quotes_gpc());
- $img_com = $db->Execute( $_query );
-
- $count = $img_com->RecordCount();
- $array = $img_com->GetArray();
- foreach($array[0] as $key_name => $key_value)
- {
- if (!is_numeric($key_name))
- {
- if ($key_value == 'author')
- {
- $key_value = $session->get_username($key_value);
- }
- $com[$key_name] = $key_value;
- }
- }
- $img_com->Close();
- $img = $img->GetArray();
-
- if ( isset($user->data['user_id']) and $user->data['user_id'] != $img['owner'] )
- {
- $img['views']++;
- $_query = 'UPDATE '.AS_TBL_IMG." SET views = '" . $views . "' WHERE img_id = '" . $img_id . "'";
- $db->query($_query);
- }
- $drill = new template(AS_TPL.'drill.tpl');
- $drill->set_var('id', $img_id);
- $drill->set_var('comments', $com);
- $drill->set_var('views', $img['views']);
- $drill->set_var('desc', $img['desc']);
- $drill->set_var('name', $img['name']);
- }
- }
- }
- /*
- Function Name: comment
- Arguments: (int) id -- Image ID; (int) owner -- Image owner ID
- Purpose: Display comment form
- */
- function comment($id, $owner)
- {
- if($session->is_friend($owner))
- {
- $form = new template(AS_TPL.'forms/gallery_comment.tpl');
- }
- }
- /*
- Function Name: comment_process
- Arguments: none
- Purpose: Insert image comment into database
- */
- function comment_process()
- {
- $img_id = $_POST['id'];
- $session->add_image_comment($img_id);
- }
-}
-
-include('globals.php');
-$gallery =& new gallery();
-$mode = empty($_GET["mode"]) ? 'view' : $_GET["mode"];
-$id = empty($_GET["id"]) ? ($session->logged_in() ? $user->data['user_id'] : 0) : mysql_real_escape_string($_GET["id"]);
-switch ($mode)
-{
- case 'view':
- $gallery->view($id);
- break;
- case 'drill':
- $gallery->drill(mysql_real_escape_string($_GET["img"]), $id);
- break;
- case 'comment':
- $gallery->comment($id, $owner_id);
- break;
- case 'process':
- $gallery->comment_process();
- break;
-}
+<?php
+/*******************************************************
+ * Copyright (C) 2007 http://p3net.net
+
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ @id: $Id$
+*********************************************************/
+
+class gallery
+{
+ /*
+ Function Name: view
+ Arguments: (int) id -- ID of user
+ Purpose: View gallery of user
+ */
+ function view($id)
+ {
+ if($id == 0)
+ {
+ $error->general('Must be logged in!', 'Tried to access gallery as owner while unauthenticated');
+ }
+ else
+ {
+ if($user->is_friend($id))
+ {
+ $_query = 'SELECT img_id FROM '.AS_TBL_IMG.' WHERE owner_id = '.$db->qstr($id,get_magic_quotes_gpc());
+ $_query = $db->Execute($_query);
+ $_query = $db->GetArray($_query);
+ $gallery = new template(AS_DIR_TPL.'gallery.tpl');
+ $gallery->set_var('gallery', $_query);
+ }
+ }
+ }
+ /*
+ Function Name: drill
+ Arguments: (int) img_id -- ID of image to view; (int) owner -- ID of image uploader
+ Purpose: View fullsize image/comments of specific image
+ */
+ function drill( $img_id, $owner )
+ {
+ if( empty( $img_id ) )
+ {
+ $error->general('An image must be specified', 'Tried to access drill without specifying image id');
+ }
+ else
+ {
+ if( $user->is_friend($owner) )
+ {
+ $_query = 'SELECT * FROM '.AS_TBL_IMG.' WHERE img_id = '.$db->qstr($img_id,get_magic_quotes_gpc());
+ $img = $db->Execute( $_query );
+
+ $_query = 'SELECT * FROM '.AS_TBL_IMG_CMT.' WHERE image_id = '.$db->qstr($img_id,get_magic_quotes_gpc());
+ $img_com = $db->Execute( $_query );
+
+ $count = $img_com->RecordCount();
+ $array = $img_com->GetArray();
+ foreach($array[0] as $key_name => $key_value)
+ {
+ if (!is_numeric($key_name))
+ {
+ if ($key_value == 'author')
+ {
+ $key_value = $user->get_username($key_value);
+ }
+ $com[$key_name] = $key_value;
+ }
+ }
+ $img_com->Close();
+ $img = $img->GetArray();
+
+ if ( isset($user->data['user_id']) and $user->data['user_id'] != $img['owner'] )
+ {
+ $img['views']++;
+ $_query = 'UPDATE '.AS_TBL_IMG." SET views = '" . $views . "' WHERE img_id = '" . $img_id . "'";
+ $db->query($_query);
+ }
+ $drill = new template(AS_TPL.'drill.tpl');
+ $drill->set_var('id', $img_id);
+ $drill->set_var('comments', $com);
+ $drill->set_var('views', $img['views']);
+ $drill->set_var('desc', $img['desc']);
+ $drill->set_var('name', $img['name']);
+ }
+ }
+ }
+ /*
+ Function Name: comment
+ Arguments: (int) id -- Image ID; (int) owner -- Image owner ID
+ Purpose: Display comment form
+ */
+ function comment($id, $owner)
+ {
+ if($user->is_friend($owner))
+ {
+ $form = new template(AS_TPL.'forms/gallery_comment.tpl');
+ }
+ }
+ /*
+ Function Name: comment_process
+ Arguments: none
+ Purpose: Insert image comment into database
+ */
+ function comment_process()
+ {
+ $img_id = $_POST['id'];
+ $user->add_image_comment($img_id);
+ }
+}
+
+include('globals.php');
+$gallery =& new gallery();
+$mode = empty($_GET["mode"]) ? 'view' : $_GET["mode"];
+$id = empty($_GET["id"]) ? ($user->logged_in() ? $user->data['user_id'] : 0) : mysql_real_escape_string($_GET["id"]);
+switch ($mode)
+{
+ case 'view':
+ $gallery->view($id);
+ break;
+ case 'drill':
+ $gallery->drill(mysql_real_escape_string($_GET["img"]), $id);
+ break;
+ case 'comment':
+ $gallery->comment($id, $owner_id);
+ break;
+ case 'process':
+ $gallery->comment_process();
+ break;
+}
?>
\ No newline at end of file
Modified: trunk/globals.php
===================================================================
--- trunk/globals.php 2007-08-01 22:35:29 UTC (rev 85)
+++ trunk/globals.php 2007-08-01 23:32:07 UTC (rev 86)
@@ -1,79 +1,79 @@
-<?php
-/*******************************************************
- * Copyright (C) 2007 http://p3net.net
-
- 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.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- @id: $Id$
-*********************************************************/
-/* Include our larger functions */
-require('./config.php'); //We can't include using a constant defined in the file we're including
-require(AS_LOC_DIRECT.'functions/template.php');
-$template =& new template();
-require(AS_LOC_DIRECT.'functions/session.php');
-$user =& new session();
-require(AS_LOC_DIRECT.'functions/adodb/adodb.inc.php');
-
-/*The smaller ones*/
-class error
-{
- /*
- Function Name: general
- Arguments: (string) err -- Error to be printed; (string) verbose -- Error to be written to error log
- Purpose: Display error message and write record of error to log
- */
- function general($err, $verbose)
- {
- $error =& new template(AS_TPL.'messages/error.tpl');
- $error->set('err', $err);
- $handle = fopen('logs/errors.txt', 'w');
- if($handle)
- {
- $entry = "[" . date('d M Y H:i:s') . "][" . $REMOTE_ADDR . "] " . $err . " - " . $verbose;
- if(!fwrite($handle, $entry))
- {
- continue;
- }
- }
- fclose($handle);
- exit();
- }
-}
-class message
-{
- /*
- Function Name: thank
- Arguments: (string) message -- Thank you message; (string) go1 -- Page to proceed to; (string) res1 -- Desc of page;
- (string) (optional) go2 -- Second option to proceed to; (string) (optional) res2 -- Desc of second page
- Purpose:
- */
- function thank($message, $go1, $res1, $go2="", $res2="")
- {
- $message =& new template(AS_TPL.'message/thank.tpl');
- $message->set_var('go1', $go1);
- $message->set_var('go2', $go2);
- $message->set_var('res1', $res1);
- $message->set_var('res2', $res2);
- $message->set_var('message', $message);
- }
-}
-
-/* Our functions living in globals.php */
-$error =& new error;
-$message =& new message();
-
-$db =& new ADOConnection(AS_DB_TYPE);
-$db->Connect(AS_DB_HOST, AS_DB_USER, AS_DB_PASS, AS_DB_SCHEMA);
+<?php
+/*******************************************************
+ * Copyright (C) 2007 http://p3net.net
+
+ 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ @id: $Id$
+*********************************************************/
+/* Include our larger functions */
+require('./config.php'); //We can't include using a constant defined in the file we're including
+require(AS_LOC_DIRECT.'functions/template.php');
+$template =& new template();
+require(AS_LOC_DIRECT.'functions/user.php');
+$user =& new user();
+require(AS_LOC_DIRECT.'functions/adodb/adodb.inc.php');
+
+/*The smaller ones*/
+class error
+{
+ /*
+ Function Name: general
+ Arguments: (string) err -- Error to be printed; (string) verbose -- Error to be written to error log
+ Purpose: Display error message and write record of error to log
+ */
+ function general($err, $verbose)
+ {
+ $error =& new template(AS_TPL.'messages/error.tpl');
+ $error->set('err', $err);
+ $handle = fopen('logs/errors.txt', 'w');
+ if($handle)
+ {
+ $entry = "[" . date('d M Y H:i:s') . "][" . $REMOTE_ADDR . "] " . $err . " - " . $verbose;
+ if(!fwrite($handle, $entry))
+ {
+ continue;
+ }
+ }
+ fclose($handle);
+ exit();
+ }
+}
+class message
+{
+ /*
+ Function Name: thank
+ Arguments: (string) message -- Thank you message; (string) go1 -- Page to proceed to; (string) res1 -- Desc of page;
+ (string) (optional) go2 -- Second option to proceed to; (string) (optional) res2 -- Desc of second page
+ Purpose:
+ */
+ function thank($message, $go1, $res1, $go2="", $res2="")
+ {
+ $message =& new template(AS_TPL.'message/thank.tpl');
+ $message->set_var('go1', $go1);
+ $message->set_var('go2', $go2);
+ $message->set_var('res1', $res1);
+ $message->set_var('res2', $res2);
+ $message->set_var('message', $message);
+ }
+}
+
+/* Our functions living in globals.php */
+$error =& new error;
+$message =& new message();
+
+$db =& new ADOConnection(AS_DB_TYPE);
+$db->Connect(AS_DB_HOST, AS_DB_USER, AS_DB_PASS, AS_DB_SCHEMA);
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|