[Astrospaces-commits] SF.net SVN: astrospaces: [72] trunk
Brought to you by:
p3net
|
From: <p3...@us...> - 2007-07-31 03:05:26
|
Revision: 72
http://astrospaces.svn.sourceforge.net/astrospaces/?rev=72&view=rev
Author: p3net
Date: 2007-07-30 20:05:24 -0700 (Mon, 30 Jul 2007)
Log Message:
-----------
Viewspace added in it's plainest form. Expand, children, expand for the motherscript!
Modified Paths:
--------------
trunk/viewspace.php
Added Paths:
-----------
trunk/template/default/viewspace.tpl
Added: trunk/template/default/viewspace.tpl
===================================================================
Modified: trunk/viewspace.php
===================================================================
--- trunk/viewspace.php 2007-07-31 02:34:33 UTC (rev 71)
+++ trunk/viewspace.php 2007-07-31 03:05:24 UTC (rev 72)
@@ -18,6 +18,78 @@
@id: $Id$
*********************************************************/
-/* Todo: If no id is set or id is yours, show you owner view instead
- Alternatively, actual view will be shown if &view=real is appended*/
+include('./globals.php');
+class space
+{
+ /* Function Name: view
+ Arguments: (int) id -- Space ID to view
+ Description: View a Space
+ */
+ function view($id)
+ {
+ if($session->can_view($id))
+ {
+ $_query = "SELECT * FROM " . AS_TBL_USER . " WHERE `id`='" . $id . "'";
+ $db->Execute($_query);
+ $arr = $db->FetchArray();
+
+ if(isset($db->user['user_id']) && $db->user['user_id'] == $id)
+ {
+ $_query = "SELECT * FROM " . AS_TBL_CMT . " WHERE `recipient_id`='" . $id . "'";
+ $db->Execute($_query);
+ $comments = $db->FetchArray();
+
+ /* We need to rewrite this to JOIN with the friends table so we can get all
+ non-specific notifications from our friends */
+ $_query = "SELECT * FROM " . AS_TBL_ACTION . " WHERE `for`='" . $id . "'";
+ $db->Execute($_query);
+ $notifications = $db->FetchArray();
+ }
+ else
+ {
+ /* Stop -- comment count! */
+ $_query="SELECT COUNT(*) FROM " . AS_TBL_CMT . " WHERE `recipient_id`='" . $id . "'";
+ $db->Execute($_query);
+ $comm_count = $db->FetchArray();
+ $comm_count = $comm_count['COUNT(*)'];
+ }
+ $viewspace =& new template('viewspace.tpl');
+ $viewspace->set('user_info', $arr);
+ /* These two are only displayed if you are the space owner */
+ $viewspace->set('owner_comments', (isset($comments) ? $comments : '')); //If empty, do NOT reference comments
+ $viewspace->set('notifications', (isset($notifications) ? $notications : '')); //If empty, do NOT reference notifications.
+ /* This one is not displayed if you are the space owner */
+ $viewspace->set('comm_count', (isset($comm_count) ? $comm_count : '')); //Display only if comment array is empty
+ }
+ else
+ {
+ /* Show limited page (username, default picture for user, and add as friend button if logged in */
+ }
+ }
+}
+
+$mode = empty($_GET["mode"]) ? 'view' : $_GET["mode"];
+/* Since I can't get this to work as a ternary */
+if(empty($_GET["id"]))
+{
+ if($user->logged_in())
+ {
+ $id = $user->data['id'];
+ }
+ else
+ {
+ $error->general('No ID specified', 'Empty');
+}
+else
+{
+ $id = $_GET["id"];
+}
+/* Okay, now that that is over with... */
+}
+switch($mode)
+{
+ case 'view':
+ $space->view($id);
+ break;
+}
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|