File modules/cms/action/profile/ProfileAvailableAction.class.php
Last commit: Sun Dec 8 20:56:47 2024 +0100 Jan Dankert New: Users are now able to store bookmarks.
1 <?php 2 namespace cms\action\profile; 3 use cms\action\Action; 4 use cms\action\BaseAction; 5 use cms\action\Method; 6 use cms\action\ProfileAction; 7 use logger\Logger; 8 use util\ClassName; 9 use util\exception\SecurityException; 10 11 class ProfileAvailableAction extends ProfileAction implements Method { 12 13 public function view() { 14 15 $action = $this->request->getText('queryaction'); 16 17 $viewMethods = array_filter( [ 18 // All UI-related methods (reachable via dropdown menus) 19 'pub', 20 'info', 21 'prop', 22 'history', 23 'rights', 24 'add', 25 'pw', 26 'memberships', 27 'advanced', 28 'switch', 29 'changetemplate', 30 'src', 31 'size', 32 'settings', 33 'rights', 34 'remove', 35 'preview', 36 'order', 37 'bookmark', 38 ], 39 function ($methodName) use ($action) { 40 41 // Filter existent methods 42 while( true ) { 43 $actionClassName = new ClassName( ucfirst($action) . ucfirst($methodName) . 'Action'); 44 $actionClassName->addNamespace( ['cms','action',$action] ); 45 46 Logger::trace("Trying ".$actionClassName->getName() ); 47 if ( $actionClassName->exists() ) { 48 $n = $actionClassName->getName(); 49 /** 50 * @var BaseAction 51 */ 52 $actionMethod = new $n(); 53 $actionMethod->request = $this->request; 54 try { 55 $actionMethod->init(); 56 $actionMethod->checkAccess(); 57 } catch( SecurityException $e ) { 58 Logger::trace("Not allowed to call ".$n); 59 return false; // do not throw anything here. 60 } 61 return true; 62 } 63 64 $baseActionClassName = new ClassName( ucfirst($action) . 'Action' ); 65 $baseActionClassName->addNamespace( ['cms','action'] ); 66 67 if ( ! $baseActionClassName->exists() ) 68 return false; 69 70 if ( ! $baseActionClassName->getParent()->exists() ) 71 return false; 72 73 $action = strtolower( $baseActionClassName->dropNamespace()->dropSuffix('Action')->get() ); 74 } 75 }); 76 77 $this->setTemplateVar('views', $viewMethods); 78 } 79 80 81 public function post() { 82 } 83 84 85 public function checkAccess() { 86 return true; 87 } 88 }
Downloadmodules/cms/action/profile/ProfileAvailableAction.class.php
History Sun, 8 Dec 2024 20:56:47 +0100 Jan Dankert New: Users are now able to store bookmarks. Thu, 16 Feb 2023 22:57:35 +0100 Jan Dankert New: More functions (adding, deleting) for tags. Sat, 4 Dec 2021 00:18:39 +0100 dankert Some security enhancements. Fri, 3 Dec 2021 23:27:44 +0100 dankert New: Only allowed methods are shown in the dropdown menu; Some security enhancements. Sun, 14 Mar 2021 22:29:56 +0100 Jan Dankert Refactoring: Clearer access check. Thu, 4 Mar 2021 00:27:41 +0100 Jan Dankert Removed menu entry for 'archive' (it was not used) Wed, 3 Mar 2021 23:48:49 +0100 Jan Dankert Removed menu entry for 'maintenance'. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Tue, 9 Feb 2021 19:37:04 +0100 Jan Dankert Removing sidebar buttons (all related actions are available via a shortcut icon in the title bar) Wed, 18 Nov 2020 20:42:57 +0100 Jan Dankert Getting/Setting cookies with constants, this is more safe. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.