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.htmlWould 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==0 || (!$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 > 0 ) {
$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 > 0 && $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..