Re: [psa-devel]Next Steps
Brought to you by:
koivi
From: Albert L. <al...@pl...> - 2003-05-30 12:54:06
|
> > OK, so now I have in config.php: > > $PSA_SCR=array( > 'Type' => 'mysql', > 'Host' => 'localhost', > 'User' => 'user', > 'Password' => 'pass', > 'Database' => 'psa_db', > 'Language' => 'en', > 'SiteName' => 'www.your_domain.com', > 'SitePath' => $_SERVER['DOCUMENT_ROOT'], > 'IncludePath' => dirname(__FILE__).'/../../metabase', > 'MbSchemaDir' => dirname(__FILE__).'/..' > ); > > in the constructor: > > if(isset($PSA_SCR['SitePath'])){ > $this->SITE_PATH=$PSA_SCR['SitePath']; > }else{ > $this->SITE_PATH=$_SERVER['DOCUMENT_ROOT']; > } > > and the hasRights method: > > function hasRights($url,$url2=''){ > $this->ERROR=array(); > // Make sure that the database will contain the full URI for > the page > > $url=preg_replace('/(\?|&)'.session_name().'=[A-Z0-9]{32}/i','',$url); > > $url2=preg_replace('/(\?|&)'.session_name().'=[A-Z0-9]{32}/i','',$url2); > $url3=$this->scr['SitePath'].$url; > $url4=$this->scr['SitePath'].$url2; > $query="SELECT groups FROM psa_users WHERE > id=".$this->db->GetTextFieldValue($_SESSION['PSA_psaun']); > $result=$this->db->Query($query); > if(!$result){ > $this->ERROR[]=$this->db->Error(); > return FALSE; > } > $groups=explode(',',$this->db->FetchResult($result,0,0,0)); > > $query='SELECT id FROM psa_pages WHERE > page='.$this->db->GetTextFieldValue($url). > ' OR page='.$this->db->GetTextFieldValue($url2). > ' OR page='.$this->db->GetTextFieldValue($url3). > ' OR page='.$this->db->GetTextFieldValue($url4); > > $tmp=explode('/',$url2); > $running=''; > $running2=$this->SITE_PATH; > foreach($tmp as $part){ > $running.=$part.'/'; > $running2.=$part.'/'; > $query.=' OR page='.$this->db->GetTextFieldValue($running.'*'). > ' OR page='.$this->db->GetTextFieldValue($running2.'*'); > } > $result=$this->db->Query($query); > if(!$result){ > $this->ERROR[]=$this->db->Error(); > return FALSE; > } > for($i=0;$i<$this->db->NumberOfRows($result);++$i){ > $pageid=$this->db->FetchResult($result,$i,0); > reset($groups); > while(list($k,$gid)=@each($groups)){ > $rightsar=$this->getProfile($gid); > $page_rights=unserialize($rightsar['rights']); > if(isset($page_rights[$pageid])) > return TRUE; > } > } > // no match in the database > $this->ERROR[]=_("You do not have access rights to this content"); > return FALSE; > } > > I haven't tested these yet, but I will sometime today That's the right idea. I updated some of the documentation a little today, just to get started. Has the GetText for translations been implemented? I've been testing out the problem I had with manual password change and it appears to have been fixed. I've prepended all the variables in user_passwordreset with psa_. Have you thought any more about the idea of replacing the site structure with an xml document? Albert |