[Astrospaces-commits] SF.net SVN: astrospaces: [103] trunk
Brought to you by:
p3net
From: <del...@us...> - 2007-09-04 00:40:20
|
Revision: 103 http://astrospaces.svn.sourceforge.net/astrospaces/?rev=103&view=rev Author: deltalabs Date: 2007-09-03 17:40:20 -0700 (Mon, 03 Sep 2007) Log Message: ----------- Modified Paths: -------------- trunk/config.php trunk/viewspace.php Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore + viewspace-backup.php Modified: trunk/config.php =================================================================== --- trunk/config.php 2007-09-03 04:56:22 UTC (rev 102) +++ trunk/config.php 2007-09-04 00:40:20 UTC (rev 103) @@ -23,24 +23,26 @@ be altered. Doing so will prevent AstroSPACES from functioning. */ -define('AS_TBL_USERS', AS_DB_PREFIX.'users'); -define('AS_TBL_SETTINGS', AS_DB_PREFIX.'settings'); -define('AS_TBL_STATPROF', AS_DB_PREFIX.'static_profile_fields'); -define('AS_TBL_BLOG', AS_DB_PREFIX.'blog'); -define('AS_TBL_BLOG_CMT', AS_DB_PREFIX.'blog_comment'); -define('AS_TBL_COMMENTS', AS_DB_PREFIX.'comments'); -define('AS_TBL_FRIEND', AS_DB_PREFIX.'friends'); -define('AS_TBL_IMG', AS_DB_PREFIX.'images'); -define('AS_TBL_IMG_CMT', AS_DB_PREFIX.'image_comments'); -define('AS_TBL_ACTION', AS_DB_PREFIX.'actions'); -define('AS_TBL_CMT', AS_DB_PREFIX.'comments'); -define('AS_TBL_SESSION', AS_DB_PREFIX.'sessions'); -define('AS_TBL_PM', AS_DB_PREFIX.'private_messages'); -define('AS_TBL_GRPRES', AS_DB_PREFIX.'group_resolver'); -define('AS_TBL_GRPS', AS_DB_PREFIX.'groups'); -define('AS_TBL_SPROFLDS', AS_DB_PREFIX.'static_profile_fields'); -define('AS_TBL_DPROFLDS', AS_DB_PREFIX.'dynamic_profile_fields'); -define('AS_TBL_DPROVAL', AS_DB_PREFIX.'dynamic_profile_values'); +define('AS_TBL_USERS', AS_DB_PREFIX.'users'); +define('AS_TBL_SETTINGS', AS_DB_PREFIX.'settings'); +define('AS_TBL_STATPROF', AS_DB_PREFIX.'static_profile_fields'); +define('AS_TBL_DYNPROFFIELD', AS_DB_PREFIX.'dynamic_profile_fields'); +define('AS_TBL_DYNPROFVAL', AS_DB_PREFIX.'dynamic_profile_values'); +define('AS_TBL_BLOG', AS_DB_PREFIX.'blog'); +define('AS_TBL_BLOG_CMT', AS_DB_PREFIX.'blog_comment'); +define('AS_TBL_COMMENTS', AS_DB_PREFIX.'comments'); +define('AS_TBL_FRIEND', AS_DB_PREFIX.'friends'); +define('AS_TBL_IMG', AS_DB_PREFIX.'images'); +define('AS_TBL_IMG_CMT', AS_DB_PREFIX.'image_comments'); +define('AS_TBL_ACTION', AS_DB_PREFIX.'actions'); +define('AS_TBL_CMT', AS_DB_PREFIX.'comments'); +define('AS_TBL_SESSION', AS_DB_PREFIX.'sessions'); +define('AS_TBL_PM', AS_DB_PREFIX.'private_messages'); +define('AS_TBL_GRPRES', AS_DB_PREFIX.'group_resolver'); +define('AS_TBL_GRPS', AS_DB_PREFIX.'groups'); +define('AS_TBL_SPROFLDS', AS_DB_PREFIX.'static_profile_fields'); +define('AS_TBL_DPROFLDS', AS_DB_PREFIX.'dynamic_profile_fields'); +define('AS_TBL_DPROVAL', AS_DB_PREFIX.'dynamic_profile_values'); define('AS_DIR_TPL', 'template/'); define('AS_TPL', AS_LOC_URL.AS_DIR_TPL.'default/'); Modified: trunk/viewspace.php =================================================================== --- trunk/viewspace.php 2007-09-03 04:56:22 UTC (rev 102) +++ trunk/viewspace.php 2007-09-04 00:40:20 UTC (rev 103) @@ -18,78 +18,57 @@ @id: $Id$ *********************************************************/ +/* I'm completely rewriting this. I do have a backup of the old version if it's needed, but I'm not committing it. */ include('./globals.php'); -class space -{ - /* Function Name: view - Arguments: (int) id -- Space ID to view - Description: View a Space - */ - function view($id) - { - if($user->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 +if (isset($_GET["uid"])) { + if (!$user->logged_in() || $user->can_view($user->data['id'])) { + $_query = 'SELECT display_name,user_image,blurb FROM '.AS_TBL_STATIC_PROFILE_FIELDS.' WHERE static_profile_field_id = ' . $_GET["uid"]; + $_query = $db->Execute($_query); + $res = $db->GetArray($_query); + + $static_user_details = $_query->FetchRow(); + + $viewspace = template(AS_TPL.'viewspace.tpl'); + + $viewspace->define_var('display_name', $static_user_details['display_name']); + $viewspace->define_var('user_image', $static_user_details['user_image']); + $viewspace->define_var('blurb', $static_user_details['blurb']); + + $viewspace->parse_slice_to_parent('public_details'); + + $viewspace->pparse(); + } + else + { + $_query = 'SELECT display_name,user_image,blurb,aim,yim,jabber,irc,icq,msn FROM '. + AS_TBL_STATIC_PROFILE_FIELDS.' WHERE user_id = ' . $_GET["uid"]; + $_query = $db->Execute($_query); + $static_user_details = $db->FetchRow($_query); + + $static_user_details = $_query->FetchRow(); + + $viewspace = template(AS_TPL.'viewspace.tpl'); + + $viewspace->define_var('display_name', $static_user_details['display_name']); + $viewspace->define_var('user_image', $static_user_details['user_image']); + $viewspace->define_var('blurb', $static_user_details['blurb']); + + $viewspace->parse_slice_to_parent('public_details'); + + $viewspace->define_var('aim', $static_user_details['aim']); + $viewspace->define_var('yim', $static_user_details['yim']); + $viewspace->define_var('jabber', $static_user_details['jabber']); + $viewspace->define_var('irc', $static_user_details['irc']); + $viewspace->define_var('icq', $static_user_details['icq']); + $viewspace->define_var('msn', $static_user_details['msn']); + + $viewspace->parse_slice_to_parent('static_private_details'); + + // Output all dynamic fields/values + + $viewspace->parse_slice_to_parent('dynamic_private_details'); + + $viewspace->pparse(); + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |