[Mediawiki-l] Help needed re:db access problems for UserRightsListextension
Grabovský Matěj
65s.mg at atlas.cz
Fri Mar 28 12:44:16 UTC 2008
Hello.
Perhaps there is problem with that "$wgDBprefix.x". I think it should be "{$wgDBprefix}{$wgDBname}.x".
-Matěj Grabovský
>---------------------------------------------------------
>Od: Jim Hu
>Přijato: 27.3.2008 15:24:34
>Předmět: [Mediawiki-l] Help needed re:db access problems for UserRightsListextension
>
>[...]
>
> function findMyUsers(){
>
> global $wgUser, $wgDBprefix;
>
> $dbr =& wfGetDB( DB_SLAVE );
>
> if(in_array('userrights',$wgUser->getRights())){
>
> $sql = "SELECT u.user_id, u.user_name, u.user_registration FROM
>
>$wgDBprefix.user u WHERE 1";
>
>
>
> }else{
>
> $sql = "SELECT u.user_id, u.user_name, u.user_registration FROM
>
>$wgDBprefix.logging l, $wgDBprefix.user u WHERE
>
> l.log_title = u.user_name AND
>
> log_type = 'newusers' AND
>
> log_user = '".$wgUser->getID()."'
>
> ";
>
> }
>
> if (isset($this->group) && $this->group !=''){
>
> $sql = str_replace("FROM","FROM $wgDBprefix.user_groups, ", $sql);
>
> $sql .= " AND ug_user = u.user_id AND ug_group = '".$this->group."'
>
>";
>
> }
>
> if (isset($this->username) && !is_null($this->username) && $this-
>
> >username != ''){
>
> $sql .= " AND u.user_name LIKE'".mysql_real_escape_string($this-
>
> >username)."' ";
>
> }
>
> if (isset($this->yearfrom) && !is_null($this->yearfrom) && $this-
>
> >yearfrom != ''){
>
> $month = '00';
>
> if (!is_null($this->monthfrom ) ) $month = $this->monthfrom;
>
> $fromdate = str_pad($this->yearfrom.$month, 14, '0', STR_PAD_RIGHT);
>
> $sql .= " AND STRCMP(u.user_registration,'$fromdate') = 1 ";
>
> }
>
> if (isset($this->yearto) && !is_null($this->yearto) && $this-
>
> >yearto != ''){
>
> $year = $this->yearto;
>
> $month = '99';
>
> if (!is_null($this->monthto ) ) $month = $this->monthto;
>
> $todate = str_pad($year.$month, 14, '9', STR_PAD_RIGHT);
>
> $sql .= " AND STRCMP(u.user_registration,'$todate') = -1 ";
>
> }
>
> $sql .= " ORDER BY u.user_name";
>
> $sql = $dbr->limitResult($sql, $this->limit, $this->offset);
>
> #echo $sql;
>
> $results = $dbr->query($sql);
>
> $this->num = $dbr->numRows($results);
>
>
>
> if (!$results) return array();
>
> while( $x = $dbr->fetchObject ( $results ) ) {
>
> $arr[] = get_object_vars($x);
>
> }
>
> return $arr;
>
> }
>
> [...]
------------------------------------------
http://mujblog.atlas.cz/
More information about the MediaWiki-l
mailing list