Commit fe48c8a7 authored by lphuberdeau's avatar lphuberdeau

[MOD] Bulk loading for forums and removing legacy checks

parent 1d749854
......@@ -239,16 +239,14 @@ class HistLib extends TikiLib {
left join `tiki_history` th on ta.`object`=th.`pageName` and ta.`lastModif`=th.`lastModif`
left join `tiki_pages` tp on ta.`object`=tp.`pageName` and ta.`lastModif`=tp.`lastModif` " . $where;
$result = $this->query($query,$bindvars,$limit,$offset);
$result = $this->fetchAll($query,$bindvars,$limit,$offset);
$result = Perms::filter( array( 'type' => 'wiki page' ), 'object', $result, 'object' );
$cant = $this->getOne($query_cant,$bindvars);
$ret = array();
$retval = array();
while ($res = $result->fetchRow()) {
//WYSIWYCA hack: the $limit will not be respected
if($this->user_has_perm_on_object($user,$res['object'],'wiki page','tiki_p_view')) {
foreach( $result as $res ) {
$res['pageName'] = $res['object'];
$ret[] = $res;
}
}
$retval["data"] = $ret;
$retval["cant"] = $cant;
......
......@@ -21,7 +21,9 @@ if ($tiki_p_read_article != 'y') {
die;
}
if (isset($_REQUEST["remove"])) {
if ($tiki_p_remove_article != 'y') {
$artperms = Perms::get( array( 'type' => 'article', 'object' => $_REQUEST['remove'] ) );
if ($artperms->remove_article != 'y') {
$smarty->assign('errortype', 401);
$smarty->assign('msg', tra("Permission denied you cannot remove articles"));
$smarty->display("error.tpl");
......
......@@ -68,29 +68,13 @@ if (isset($_REQUEST["find"])) {
$smarty->assign('find', $find);
// Get a list of last changes to the Wiki database
$listpages = $tikilib->list_blogs($offset, $maxRecords, $sort_mode, $find);
Perms::bulk( array( 'type' => 'blog' ), 'object', $listpages['data'], 'blogId' );
$temp_max = count($listpages["data"]);
for ($i = 0; $i < $temp_max; $i++) {
if ($userlib->object_has_one_permission($listpages["data"][$i]["blogId"], 'blog')) {
$listpages["data"][$i]["individual"] = 'y';
// blogs that user cannot read are not displayed at all
$listpages["data"][$i]["individual_tiki_p_read_blog"] = 'y';
if ($userlib->object_has_permission($user, $listpages["data"][$i]["blogId"], 'blog', 'tiki_p_blog_post')) {
$listpages["data"][$i]["individual_tiki_p_blog_post"] = 'y';
} else {
$listpages["data"][$i]["individual_tiki_p_blog_post"] = 'n';
}
if ($userlib->object_has_permission($user, $listpages["data"][$i]["blogId"], 'blog', 'tiki_p_create_blogs')) {
$listpages["data"][$i]["individual_tiki_p_create_blogs"] = 'y';
} else {
$listpages["data"][$i]["individual_tiki_p_create_blogs"] = 'n';
}
if ($tiki_p_admin == 'y' || $userlib->object_has_permission($user, $listpages["data"][$i]["blogId"], 'blog', 'tiki_p_blog_admin')) {
$listpages["data"][$i]["individual_tiki_p_create_blogs"] = 'y';
$listpages["data"][$i]["individual_tiki_p_blog_post"] = 'y';
}
} else {
$listpages["data"][$i]["individual"] = 'n';
}
$blogperms = Perms::get( array( 'type' => 'blog', 'object' => $listpages['data'][$i]['blogId'] ) );
$listpages["data"][$i]["individual_tiki_p_read_blog"] = $blogperms->read_blog ? 'y' : 'n';
$listpages["data"][$i]["individual_tiki_p_blog_post"] = $blogperms->blog_post ? 'y' : 'n';
$listpages["data"][$i]["individual_tiki_p_create_blogs"] = $blogperms->create_blogs ? 'y' : 'n';
}
$smarty->assign_by_ref('listpages', $listpages["data"]);
$smarty->assign_by_ref('cant', $listpages["cant"]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment