From ce6e81c68221a9f462af886626dc02fdfc26f8aa Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 3 Oct 2016 21:48:53 -0700 Subject: more backticks --- Zotlabs/Web/SessionHandler.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Web') diff --git a/Zotlabs/Web/SessionHandler.php b/Zotlabs/Web/SessionHandler.php index 93b27a7e8..04c5cb5b5 100644 --- a/Zotlabs/Web/SessionHandler.php +++ b/Zotlabs/Web/SessionHandler.php @@ -18,13 +18,13 @@ class SessionHandler implements \SessionHandlerInterface { function read ($id) { if($id) { - $r = q("SELECT `sess_data` FROM `session` WHERE `sid`= '%s'", dbesc($id)); + $r = q("SELECT sess_data FROM session WHERE sid= '%s'", dbesc($id)); if($r) { return $r[0]['sess_data']; } else { - q("INSERT INTO `session` (sess_data, sid, expire) values ('%s', '%s', '%s')", + q("INSERT INTO session (sess_data, sid, expire) values ('%s', '%s', '%s')", dbesc(''), dbesc($id), dbesc(time() + 300) @@ -59,8 +59,8 @@ class SessionHandler implements \SessionHandlerInterface { $expire = time() + (60 * 60 * 24 * 1); } - q("UPDATE `session` - SET `sess_data` = '%s', `expire` = '%s' WHERE `sid` = '%s'", + q("UPDATE session + SET sess_data = '%s', expire = '%s' WHERE sid = '%s'", dbesc($data), dbesc($expire), dbesc($id) @@ -76,7 +76,7 @@ class SessionHandler implements \SessionHandlerInterface { function destroy ($id) { - q("DELETE FROM `session` WHERE `sid` = '%s'", dbesc($id)); + q("DELETE FROM session WHERE sid = '%s'", dbesc($id)); return true; } -- cgit v1.2.3 From 7b41839ea8f2aad020444c42f2cba89040ca28b8 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 2 Oct 2016 00:41:25 +0200 Subject: [TASK] Update Doxyfile and fix Doxygen errors. Updated Doxyfile to include new folders. Add a list for @hooks tags. Fixed some parsing problems for Doxygen. --- Zotlabs/Web/Router.php | 98 +++++++++++++++++++++++++---------------------- Zotlabs/Web/SubModule.php | 24 +++++++++--- 2 files changed, 70 insertions(+), 52 deletions(-) (limited to 'Zotlabs/Web') diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php index 4ba2a450d..a3bad29ae 100644 --- a/Zotlabs/Web/Router.php +++ b/Zotlabs/Web/Router.php @@ -2,51 +2,53 @@ namespace Zotlabs\Web; - +/** + * + * We have already parsed the server path into App::$argc and App::$argv + * + * App::$argv[0] is our module name. Let's call it 'foo'. We will load the + * Zotlabs/Module/Foo.php (object) or file mod/foo.php (procedural) + * and use it for handling our URL request to 'https://ourgreatwebsite.something/foo' . + * The module file contains a few functions that we call in various circumstances + * and in the following order: + * @code{.php} + * Object: + * class Foo extends \Zotlabs\Web\Controller { + * function init() { init function } + * function post() { post function } + * function get() { normal page function } + * } + * + * Procedual interface: + * foo_init() + * foo_post() (only called if there are $_POST variables) + * foo_content() - the string return of this function contains our page body + * @endcode + * Modules which emit other serialisations besides HTML (XML,JSON, etc.) should do + * so within the module init and/or post functions and then invoke killme() to terminate + * further processing. + */ class Router { private $modname = ''; private $controller = null; + /** + * @brief Router constructor + * + * @param[in,out] App &$a + * @throws Exception module not found + */ function __construct(&$a) { - /** - * - * We have already parsed the server path into App::$argc and App::$argv - * - * App::$argv[0] is our module name. Let's call it 'foo'. We will load the - * Zotlabs/Module/Foo.php (object) or file mod/foo.php (procedural) - * and use it for handling our URL request to 'https://ourgreatwebsite.something/foo' . - * The module file contains a few functions that we call in various circumstances - * and in the following order: - * - * Object: - * class Foo extends Zotlabs\Web\Controller { - * function init() { init function } - * function post() { post function } - * function get() { normal page function } - * } - * - * Procedual interface: - * foo_init() - * foo_post() (only called if there are $_POST variables) - * foo_content() - the string return of this function contains our page body - * - * Modules which emit other serialisations besides HTML (XML,JSON, etc.) should do - * so within the module init and/or post functions and then invoke killme() to terminate - * further processing. - */ - $module = \App::$module; $modname = "Zotlabs\\Module\\" . ucfirst($module); if(strlen($module)) { - /** - * + /* * We will always have a module name. * First see if we have a plugin which is masquerading as a module. - * */ if(is_array(\App::$plugins) && in_array($module,\App::$plugins) && file_exists("addon/{$module}/{$module}.php")) { @@ -66,7 +68,7 @@ class Router { goaway(z_root()); } - /** + /* * If the site has a custom module to over-ride the standard module, use it. * Otherwise, look for the standard program module */ @@ -101,13 +103,13 @@ class Router { } } } - - /** - * This provides a place for plugins to register module handlers which don't otherwise exist - * on the system, or to completely over-ride an existing module. + + /* + * This provides a place for plugins to register module handlers which don't otherwise exist + * on the system, or to completely over-ride an existing module. * If the plugin sets 'installed' to true we won't throw a 404 error for the specified module even if * there is no specific module file or matching plugin name. - * The plugin should catch at least one of the module hooks for this URL. + * The plugin should catch at least one of the module hooks for this URL. */ $x = array('module' => $module, 'installed' => \App::$module_loaded, 'controller' => $this->controller); @@ -117,7 +119,7 @@ class Router { $this->controller = $x['controller']; } - /** + /* * The URL provided does not resolve to a valid module. * * On Dreamhost sites, quite often things go wrong for no apparent reason and they send us to '/internal_error.html'. @@ -157,7 +159,11 @@ class Router { } } - + /** + * @brief + * + * @param[in,out] App &$a + */ function Dispatch(&$a) { /** @@ -168,14 +174,14 @@ class Router { \App::$page['page_title'] = \App::$module; $placeholder = ''; - /** + /* * No theme has been specified when calling the module_init functions * For this reason, please restrict the use of templates to those which * do not provide any presentation details - as themes will not be able * to over-ride them. */ - $arr = array('init' => true, 'replace' => false); + $arr = array('init' => true, 'replace' => false); call_hooks(\App::$module . '_mod_init', $arr); if(! $arr['replace']) { if($this->controller && method_exists($this->controller,'init')) { @@ -187,7 +193,7 @@ class Router { } } - /** + /* * Do all theme initialisation here before calling any additional module functions. * The module_init function may have changed the theme. * Additionally any page with a Comanche template may alter the theme. @@ -195,7 +201,7 @@ class Router { */ - /** + /* * In case a page has overloaded a module, see if we already have a layout defined * otherwise, if a PDL file exists for this module, use it * The member may have also created a customised PDL that's stored in the config @@ -203,7 +209,7 @@ class Router { load_pdl($a); - /** + /* * load current theme info */ @@ -226,7 +232,7 @@ class Router { } } - if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! \App::$error) && (! x($_POST, 'auth-params'))) { + if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! \App::$error) && (! x($_POST, 'auth-params'))) { call_hooks(\App::$module . '_mod_post', $_POST); if($this->controller && method_exists($this->controller,'post')) { @@ -238,7 +244,7 @@ class Router { } } - if(! \App::$error) { + if(! \App::$error) { $arr = array('content' => \App::$page['content'], 'replace' => false); call_hooks(\App::$module . '_mod_content', $arr); \App::$page['content'] = $arr['content']; diff --git a/Zotlabs/Web/SubModule.php b/Zotlabs/Web/SubModule.php index 5f49b9292..7c8404201 100644 --- a/Zotlabs/Web/SubModule.php +++ b/Zotlabs/Web/SubModule.php @@ -2,23 +2,28 @@ namespace Zotlabs\Web; - +/* + * @brief + * + */ class SubModule { private $controller = false; /** + * @brief Submodule constructor. + * * Initiate sub-modules. By default the submodule name is in argv(1), though this is configurable. * Example: Given a URL path such as /admin/plugins, and the Admin module initiates sub-modules. * This means we'll look for a class Plugins in Zotlabs/Module/Admin/Plugins.php - * The specific methods and calling parameters are up to the top level module controller logic. + * The specific methods and calling parameters are up to the top level module controller logic. * * **If** you were to provide sub-module support on the photos module, you would probably use * $whicharg = 2, as photos are typically called with a URL path of /photos/channel_address/submodule_name * where submodule_name might be something like album or image. + * + * @param int $whicharg */ - - function __construct($whicharg = 1) { if(argc() < ($whicharg + 1)) @@ -31,13 +36,20 @@ class SubModule { } } + /** + * @brief + * + * @param string $method + * @return boolean|mixed + */ function call($method) { if(! $this->controller) return false; - if(method_exists($this->controller,$method)) + + if(method_exists($this->controller, $method)) return $this->controller->$method(); + return false; } } - -- cgit v1.2.3 From 8029f56d1c19d2906ed7b867721586db7c53c2b5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 9 Dec 2016 12:38:53 -0800 Subject: router error reporting --- Zotlabs/Web/Router.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Web') diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php index a3bad29ae..271836ba9 100644 --- a/Zotlabs/Web/Router.php +++ b/Zotlabs/Web/Router.php @@ -137,15 +137,21 @@ class Router { killme(); } - logger("Module {$module} not found.", LOGGER_DEBUG, LOG_WARNING); - - if((x($_SERVER, 'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && \App::$config['system']['dreamhost_error_hack']) { - logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']); + if((x($_SERVER, 'QUERY_STRING')) + && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') + && \App::$config['system']['dreamhost_error_hack']) { + logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI'],LOGGER_DEBUG); goaway(z_root() . $_SERVER['REQUEST_URI']); } - logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG); - header($_SERVER['SERVER_PROTOCOL'] . ' 404 ' . t('Not Found')); + if(get_config('system','log_404',true)) { + logger("Module {$module} not found.", LOGGER_DEBUG, LOG_WARNING); + logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] + . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' + . $_SERVER['QUERY_STRING'], LOGGER_DEBUG); + } + + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); $tpl = get_markup_template('404.tpl'); \App::$page['content'] = replace_macros($tpl, array( '$message' => t('Page not found.') -- cgit v1.2.3