1
fredgsanford
weblog (problem adding group permissions)

In "Member BLogs Configuration »» Privileges" .. I can not add groups. Just refreshes the page but does not allow me to add registered users, or other grouos.

I am using XOOPS 2.0.16

2
mboyden
Re: weblog (problem adding group permissions)
  • 2008/1/10 5:19

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


The latest version is 2.0.18. Try upgrading to a later version of XOOPS. Of course, don't forget to backup before hand.

BTW, you don't say whether or not this is a new module, or such. It's always best to follow the Troubleshooting/Debug FAQ and posting results from that. Always look to the last change you've made to the application or system.

More info will help us to narrow down to the problem for you. NOte, I haven't used this particular modue.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

3
fredgsanford
Re: weblog (problem adding group permissions)

I am running XOOPS 2.0.16 & weBLog 1.41

I think it's probably just some file permissions, but I don't know which ones? ..could also be that I have PHP version 5.2.4 ..and just found out that this module's developer was using php 4 so it might not support php5?


Are there any other good blog modules that will work for me?
Thanks

4
leeb180
Re: weblog (problem adding group permissions)
  • 2008/1/22 11:51

  • leeb180

  • Just popping in

  • Posts: 1

  • Since: 2008/1/22


This was working for me till my site was updated to PHP 5.

Since then I cannot add categories or post. I found that there is a column in the table called reads which is a reserved word, since PHP 5.0, so changed it to readcnt everywhere, and there are two ints defined in mysql.sql with '' as the value which i changed to '0'.

I can still see all old entries, but cannot add/modify categories or post new entries.

If anyone has any ideas please let me know!

5
xgarb
Re: weblog (problem adding group permissions)
  • 2008/2/26 11:18

  • xgarb

  • Not too shy to talk

  • Posts: 154

  • Since: 2003/3/30


same here.. updated to PHP5 weblog stopped working.

I think it's something to do with the group permissions. The error on posting is 'Sorry, Only permitted users can post weBLog entries...'

Also the change group permissions in the module admin isn't working so I'm guessing something to do with permissions.

I couldn't see 'reads' in the reserved list, not sure a column name would matter anyway.
Reserved Lists:
http://blog.fullvalence.com/2008/01/04/upgrading-to-php5-part-1-new-reserved-keywords/
http://devzone.zend.com/manual/reserved.html

Would be good to get this going as it still seems the best blog module for xoops, the alternatives seem to be bolting other blog software onto XOOPS which IMO is inviting problems.

Maybe this code has something wrong (from admin/privmanager.php)
function addGroup($post) {
    if (isset(
$post['gid'])) {
        
$group_handler =& xoops_getmodulehandler('priv');
        foreach (
$post['gid'] as $gid) {
            
$group =& $group_handler->create();
            
$group->setVar('priv_gid'$gid);
            
$group_handler->insert($group);
        }
    }
    
redirect_header('privmanager.php'2_AM_WEBLOG_DBUPDATED);
}


and or this (from post.php)
$priv =& xoops_getmodulehandler('priv');
if (
$currentuid==|| (!$isAdmin && ($xoopsModuleConfig['adminonly'] || !$priv->hasPrivilege($currentUser)))) {
    
redirect_header(sprintf('%s/modules/%s/index.php'XOOPS_URL$xoopsModule->dirname()),
                    
5_BL_ANON_CANNOT_POST_SORRY);
    exit();
}


or maybe the class below? Bit beyond me!
class WeblogPrivHandler extends XoopsObjectHandler {

    function &
create() {
        return new 
WeblogPriv();
    }
    
    function &
get($id) {
        
$id intval($id);
        if (
$id ) {
            
$sql sprintf('SELECT p.priv_id, p.priv_gid, g.name FROM %s as p, %s as g WHERE p.priv_gid=%d AND p.priv_gid=g.groupid',
                           
$this->db->prefix(WEBLOG_DB_PREFIX_PRIV),
                           
$this->db->prefix(WEBLOG_DB_PREFIX_GROUPS),
                           
$id);
            if (
$result $this->db->query($sql)) {
                if (
$this->db->getRowsNum($result)==1) {
                    
$entry $this->create();
                    
$entry->assignVars($this->db->fetchArray($result));
                    return 
$entry;
                }
            }
        }
        return 
false;
    }

    function 
insert(&$entry) {
        if (
get_class($entry) != 'weblogpriv') {  // must be lowercase only
            
return false;
        }
        if (!
$entry->isDirty()) {
            return 
true;
        }
        if (!
$entry->cleanVars()) {
            return 
false;
        }

        foreach (
$entry->cleanVars as $k => $v) {
            ${
$k} = $v;
        }

        
$count $this->getCount(new Criteria('priv_id'$priv_id));
        if (
$priv_id && $count 0) {
            
$sql sprintf('UPDATE %s SET priv_gid=%d WHERE priv_id=%d',
                           
$this->db->prefix(WEBLOG_DB_PREFIX_PRIV),
                           
$priv_gid,
                           
$priv_id);
        } else {
            
$sql sprintf('INSERT INTO %s (priv_gid) VALUES (%d)',
                           
$this->db->prefix(WEBLOG_DB_PREFIX_PRIV),
                           
$priv_gid);
        }
        
$result $this->db->queryF($sql) or die($this->db->error());
        if (!
$result) {  // must be queryF()
            
return false;
        }

        if (empty(
$priv_id)) {
            
$entry->setVar('priv_id'$this->db->getInsertId());
        }

        return 
true;
    }

    function 
delete(&$entry) {
        if (
get_class($entry) != 'weblogpriv') {
            return 
false;
        }

        
$sql sprintf('DELETE FROM %s WHERE priv_id=%d LIMIT 1',
                       
$this->db->prefix(WEBLOG_DB_PREFIX_PRIV), $entry->getVar('priv_id'));
        if (!
$result $this->db->queryF($sql)) {  // must be queryF()
            
return false;
        }
        return 
true;
    }

    function 
getCount($criteria=null) {
        
$sql sprintf('SELECT count(*) as count FROM %s'$this->db->prefix(WEBLOG_DB_PREFIX_PRIV));
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= sprintf(' %s'$criteria->renderWhere());
        }
        if (!
$result $this->db->query($sql)) {
            return 
0;
        }
        
$count $this->db->fetchArray($result);
        return 
$count['count'];
    }

    function &
getObjects($criteria=null$id_as_key=false) {
        
$ret = array();
        
$limit $start 0;

        
$sql sprintf('SELECT p.priv_id, p.priv_gid, g.name FROM %s as p, %s as g',
                       
$this->db->prefix(WEBLOG_DB_PREFIX_PRIV),
                       
$this->db->prefix(WEBLOG_DB_PREFIX_GROUPS));
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= sprintf(' %s %s'$criteria->renderWhere(), 'AND p.priv_gid=g.groupid');
            
//$groupby = trim(str_replace('GROUP BY', "", $criteria->getGroupby()));
            //$sql .= ($groupby=='')?'':sprintf(' %s', $criteria->getGroupby());
            
$sort = ($criteria->getSort()!='') ? $criteria->getSort() : 'priv_id';
            
$sql .= sprintf(' ORDER BY %s %s'$sort$criteria->getOrder());
            
$limit $criteria->getLimit();
            
$start $criteria->getStart();
        } else {
            
$sql .= sprintf(' %s''WHERE p.priv_gid=g.groupid');
        }
        if (!
$result $this->db->query($sql$limit$start)) {
            return 
$ret;
        }
        while (
$myrow $this->db->fetchArray($result)) {
            
$entry $this->create();
            
$entry->assignVars($myrow);
            if (
$id_as_key) {
                
$ret[$myrow['priv_id']] =& $entry;
            } else {
                
$ret[] =& $entry;
            }
            unset(
$entry);
        }
        return 
$ret;
    }

    function 
hasPrivilege($user) {
        
$gids =& $user->getGroups();
        
$criteria =& new criteriaCompo();
        foreach(
$gids as $gid) {
            
$criteria->add(new criteria('priv_gid'$gid), 'OR');
        }
        
$result =& $this->getObjects($criteria);
        if (
count($result)>0) {
            return 
true;
        } else {
            return 
false;
        }
    }
}


Thanks for any help..

6
xgarb
Re: weblog (problem adding group permissions)
  • 2008/3/1 11:46

  • xgarb

  • Not too shy to talk

  • Posts: 154

  • Since: 2003/3/30


oh.. 'reads' is a reserved word in MySQL 5...

http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-0.html

Maybe this is it.. will have a look later.

7
xgarb
Re: weblog (problem adding group permissions)
  • 2008/3/1 17:15

  • xgarb

  • Not too shy to talk

  • Posts: 154

  • Since: 2003/3/30


found the answer on this page..http://janschneider.de/news/35/183

PHP5 has a different way of handling case for get_class(). The fix is to add strtolower() around any get_class() code ie..

get_class(somecode)

to

strtolower(get_class(somecode))


After doing this throughout Weblog it now works. It might not need doing everywhere (possibly just the add category, entry etc) but I did everywhere to make sure.

This is a great module, someone should take it over and maintain it.

8
waleedpak
Re: weblog (problem adding group permissions)
  • 2008/3/2 7:03

  • waleedpak

  • Just popping in

  • Posts: 45

  • Since: 2007/11/25


thanks a lot but can you please tell me where to edit the codes... i mean tell me the file names....

9
xgarb
Re: weblog (problem adding group permissions)
  • 2008/3/2 10:37

  • xgarb

  • Not too shy to talk

  • Posts: 154

  • Since: 2003/3/30


Quote:

waleedpak wrote:
i mean tell me the file names....



sorry, didn't keep a record of the files I changed. Just used dreamweaver's find code feature on the whole folder.

10
Kumar
Re: weblog (problem adding group permissions)
  • 2008/3/3 10:26

  • Kumar

  • Just popping in

  • Posts: 61

  • Since: 2005/8/8 1


i have installed weblog successfully on 2.0.18.1. My contents are in Unicode (utf-8) and it displays correct characters whi viewing and entering content.

But when i tried to edit a post, the content dhtml area displays the html value of unicode character. (蘩 etc..)

Is there any solution for this. Please help.

Thanks in advance.

Login

Who's Online

171 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 171


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits