Loading...
 
Skip to main content

Development


Proposal: func_tiki_p_denied()

Inspecting various Tiki base PHP scripts, I found that many have similar logic which eventually determine whether page access is permitted. The code for denying page access should be consisent. Assuming that it is, it can still be annoying to do multi-file search and replace, if it is ever needed.

For instance, IMO, if Anonymous access is not permitted to a particular page, rather than being shown the message 'Permission denied you cannot view this page,' the person should be redirected to a Log In page.

I propose incorporating a global function 'func_tiki_p_denied()':

Image
Copy to clipboard
<?php function func_tiki_p_denied() { // Insufficient permissions to view if (isset($user)) {// If logged in, deny page access $smarty->assign('msg',tra('Permission denied you cannot view this page')); } else {// If not logged in, redirect to log in $smarty->assign('msg',$smarty->fetch('modules/mod-login_box.tpl')); $smarty->assign('errortitle',tra("Please login")); } $smarty->display("error.tpl"); die; } ?>


-Tagg

The best fix is not to see the page name if you can't read it. PLease report all the places you see the problem.
The only time you can see a page link you can't read is inside a wiki text. But I suppose that in this case, the site organization is bad.

FYI: in tiki1.10 error.tpl redirects to the login box what it is pertinent.
FYI: you cant't test on $user, you can only test on $tiki_p_read
sylvie