View of /trunk/profile.php
Parent Directory
|
Revision Log
Revision 14 -
(download)
(annotate)
Thu Jan 22 21:54:43 2009 UTC (4 years, 4 months ago) by pith7
File size: 3218 byte(s)
Thu Jan 22 21:54:43 2009 UTC (4 years, 4 months ago) by pith7
File size: 3218 byte(s)
[Added] Users can now have avatars. (Profile page) [Added] Profile page for users [Added] Comments system for profiles [Added] Avatar support for news [Added] Function to output name with link to profile [Fixed] Minor news page CSS tweaks [Fixed] Indented CSS
<?php
include('config.php');
session_set_cookie_params(time()+3600 ,'/',COOKIE_DOMAIN);
session_start();
include('adodb/adodb.inc.php');
include('Savant3.php');
require_once(LIBD.'domxmlfix.php');
require_once(LIBD.'llsd.php');
require_once(LIBD.'input.php');
require_once(LIBD.'output.php');
require_once(LIBD.'user.php');
require_once(LIBD.'db.php');
require_once(LIBD.'grid.php');
require_once(LIBD.'captcha.php');
DB::Connect();
User::Init();
$username = REST::GetEString(0);
$validvpds=array('age','sex','location','contact');
switch (REST::FetchIndex(1))
{
case 'home':
default:
$rs=DB::Execute("SELECT usrID FROM {P}Users WHERE usrName='$username'");
if($rs->RecordCount()>0)
{
Output::$cpage='profile/home';
} else {
Output::HardError("That user doesn't exist.");
}
Output::Flush();
break;
case 'hide':
$rs=DB::Execute("SELECT usrID FROM {P}Users WHERE usrName='$username'");
if($rs->RecordCount()>0)
{
Output::$cpage='profile/home';
} else {
Output::HardError("That user doesn't exist.");
}
$v=REST::GetEString(2);
if(!strlen($v) or !in_array($v,$validvpds)) Output::Redirect(THISURL.'profile.php/'.$username.'/');
User::$Data->SetVPDState($v,false);
Output::Flush();
break;
case 'show':
$rs=DB::Execute("SELECT usrID FROM {P}Users WHERE usrName='$username'");
if($rs->RecordCount()>0)
{
Output::$cpage='profile/home';
} else {
Output::HardError("That user doesn't exist.");
}
$v=REST::GetEString(2);
if(!strlen($v) or !in_array($v,$validvpds)) Output::Redirect(THISURL.'profile.php/'.$username.'/');
User::$Data->SetVPDState($v,true);
Output::Flush();
break;
}
class ProfileComment
{
public $ID = 0;
public $Commenter; // UserImpl
public $Commentee; // UserImpl
public $Body = '';
public $Title = '';
public $Time = 0;
public function ProfileComment($row=array())
{
if(count($row)>0)
{
$this->ID = intval($row['comID']);
$this->Commenter= User::Find(intval($row['commenterID']));
$this->Commentee= User::Find(intval($row['commenteeID']));
$this->Body = $row['comBody'];
$this->Title = $row['comTitle'];
$this->Time = intval($row['comTime']);
}
}
public function Update()
{
require_once (LIBD.'3rdparty/HTMLPurifier.standalone.php');
$config = HTMLPurifier_Config::createDefault();
$config->set( 'HTML', 'Allowed', 'p,b,u,i,ul,ol,li,s,strong,em,strike');
@$config->set( 'Core', 'DefinitionCache', null); // Warning about DefinitionCache being an alias
$purifier = new HTMLPurifier($config);
$a['comID']=$this->ID;
$a['commenterID']=$this->Commenter->ID;
$a['commenteeID']=$this->Commentee->ID;
$a['comBody']=$purifier->purify($this->Body);
$a['comTitle']=$this->Title;
$a['comTime']=time();
DB::EasyInsert('{P}ProfileComments',$a,true);
}
public static function GetComments($forID)
{
$rs=DB::Execute('SELECT * FROM {P}ProfileComments WHERE commenteeID='.$forID.' ORDER BY comTime DESC LIMIT 10');
$com=array();
foreach($rs as $row)
{
$com[]=new ProfileComment($row);
}
return $com;
}
}| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

