From 3c072c02ad34051253703d7dd60ed9623c8377f3 Mon Sep 17 00:00:00 2001 From: Todd Zmijewski Date: Fri, 11 Oct 2024 21:17:04 -0400 Subject: [PATCH] [tz-1] Resolve discrepencies between remote master and local version. --- .gitignore | 37 + README | 0 mcp_config/MainExample.xml | 0 mcp_root/App/Config/Config.xml | 0 mcp_root/App/Config/Modules.xml | 0 mcp_root/App/Core/DAO.php | 0 mcp_root/App/Core/DB.php | 0 mcp_root/App/Core/Exception/Permission.php | 0 mcp_root/App/Core/MCP.php | 173 +-- mcp_root/App/Core/Resource.php | 0 mcp_root/App/Core/VDItem.php | 8 - mcp_root/App/Lib/Console/Console.php | 0 mcp_root/App/Lib/Email/Emailer.php | 0 mcp_root/App/Lib/Import/Import.php | 0 mcp_root/App/Lib/Request/Request.php | 0 .../App/Lib/UI/Element/Common/Form/Form.php | 4 +- .../App/Lib/UI/Element/Common/Form/Video.php | 20 +- mcp_root/App/Lib/Validation/Validator.php | 0 mcp_root/App/Resource/Cache/CacheHandler.php | 0 .../App/Resource/Cache/DAO/DAODataCache.php | 0 .../App/Resource/Cache/DAO/DAOImageCache.php | 0 mcp_root/App/Resource/Config/Config.php | 0 .../App/Resource/Cookie/CookieManager.php | 0 mcp_root/App/Resource/DB/MySQL/MySQL.php | 0 mcp_root/App/Resource/DB/MySQLi/MySQLi.php | 0 mcp_root/App/Resource/DB/PDO/PDO.php | 0 mcp_root/App/Resource/Event/EventHandler.php | 0 mcp_root/App/Resource/File/DAO/DAOImage.php | 0 mcp_root/App/Resource/Module/Module.php | 0 .../Resource/Permission/PermissionBase.php | 703 ----------- .../App/Resource/Permission/Plugin/Admin.php | 5 - .../Session/DAO/DAOSessionHandler.php | 0 .../App/Resource/Session/SessionHandler.php | 0 mcp_root/App/Resource/Site/DAO/DAOSite.php | 0 mcp_root/App/Resource/Site/Site.php | 0 mcp_root/App/Resource/Template/Template.php | 4 +- mcp_root/App/Resource/User/User.php | 0 mcp_root/Component/Config/DAO/DAOConfig.php | 0 .../Component/Config/Module/Form/Form.php | 0 .../Component/Config/Template/Form/Form.php | 0 mcp_root/Component/Field/DAO/DAOField.php | 25 +- mcp_root/Component/Field/Module/Form/Form.php | 0 mcp_root/Component/Field/Module/List/List.php | 0 .../Component/Field/Template/Form/Form.php | 0 .../Component/Field/Template/List/List.php | 0 .../Field/Template/List/Redirect.php | 0 mcp_root/Component/Menu/Theme/Menu.php | 7 - .../Navigation/DAO/DAONavigation.php | 1079 ----------------- .../Navigation/Module/Form/Link/Link.php | 629 ---------- .../Navigation/Module/Form/Menu/Menu.php | 357 ------ .../Navigation/Module/List/Link/Link.php | 313 ----- .../Navigation/Module/List/Menu/Menu.php | 344 ------ .../Navigation/Module/Menu/Admin/Admin.php | 9 - .../Component/Navigation/Module/Menu/Menu.php | 88 -- .../Navigation/Module/Router/Router.php | 327 ----- .../Navigation/Template/Form/Link/Layout.php | 8 - .../Navigation/Template/Form/Link/Link.php | 176 --- .../Navigation/Template/Form/Link/LinkNew.php | 15 - .../Template/Form/Link/ModuleConfig.php | 76 -- .../Navigation/Template/Form/Menu/Menu.php | 9 - .../Navigation/Template/List/Link/Edit.php | 2 - .../Navigation/Template/List/Link/Link.php | 67 - .../Navigation/Template/List/Menu/Menu.php | 26 - .../Template/List/Menu/Redirect.php | 14 - .../Navigation/Template/Menu/Admin/Admin.php | 13 - .../Navigation/Template/Menu/Menu.php | 18 - .../Template/Router/PageNotFound.php | 1 - .../Template/Router/PermissionDenied.php | 1 - .../Navigation/Template/Router/Redirect.php | 37 - mcp_root/Component/Node/DAO/DAONode.php | 0 .../Node/Module/Form/Comment/Comment.php | 0 .../Node/Module/Form/Entry/Entry.php | 4 +- .../Component/Node/Module/Form/Type/Type.php | 0 .../Node/Module/List/Comment/Comment.php | 0 .../Node/Module/List/Entry/Entry.php | 0 .../Component/Node/Module/List/Type/Type.php | 0 .../Node/Module/View/Entry/Entry.php | 0 .../Node/Template/Form/Comment/Comment.php | 0 .../Node/Template/Form/Entry/Entry.php | 0 .../Node/Template/Form/Type/Type.php | 0 .../Node/Template/List/Comment/Comment.php | 0 .../Node/Template/List/Entry/Entry.php | 0 .../Node/Template/List/Entry/Redirect.php | 0 .../Node/Template/List/Entry/View.php | 0 .../Node/Template/List/Type/Redirect.php | 0 .../Node/Template/List/Type/Type.php | 0 .../Node/Template/View/Entry/Edit.php | 0 .../Node/Template/View/Entry/Entry.php | 0 mcp_root/Component/Site/DAO/DAOSite.php | 0 mcp_root/Component/Site/Module/List/List.php | 0 .../Component/Site/Template/List/List.php | 0 .../Component/Taxonomy/DAO/DAOTaxonomy.php | 0 .../Taxonomy/Module/Form/Term/Term.php | 0 .../Module/Form/Vocabulary/Vocabulary.php | 0 .../Module/List/Vocabulary/Vocabulary.php | 0 .../Taxonomy/Module/Tree/Term/Term.php | 0 .../Taxonomy/Template/Form/Term/Term.php | 0 .../Template/Form/Vocabulary/Vocabulary.php | 0 .../Template/List/Vocabulary/Redirect.php | 0 .../Template/List/Vocabulary/Vocabulary.php | 0 .../Taxonomy/Template/Tree/Term/Redirect.php | 0 .../Taxonomy/Template/Tree/Term/Term.php | 0 mcp_root/Component/User/DAO/DAOUser.php | 0 mcp_root/Component/User/Module/List/List.php | 0 .../Component/User/Module/Login/Login.php | 0 .../Component/User/Module/Logout/Logout.php | 0 .../User/Module/Registration/Form/Form.php | 0 .../Component/User/Template/List/List.php | 0 .../Component/User/Template/List/Redirect.php | 0 .../Component/User/Template/Login/Login.php | 0 .../Component/User/Template/Logout/Logout.php | 0 .../User/Template/Registration/Form/Form.php | 0 mcp_root/Component/Util/DAO/DAOUtil.php | 0 .../Component/Util/Module/Admin/Admin.php | 0 .../Util/Module/Breadcrumb/Breadcrumb.php | 0 .../Component/Util/Module/Display/CSS/CSS.php | 0 .../Component/Util/Module/Display/JS/JS.php | 0 .../Util/Module/Display/Meta/Meta.php | 0 .../Component/Util/Module/Footer/Footer.php | 0 .../Component/Util/Module/Header/Header.php | 0 .../Component/Util/Module/Index/Index.php | 0 .../Util/Module/Master/Email/Email.php | 0 .../Component/Util/Module/Master/Master.php | 16 + .../Util/Module/Pagination/Alphabetize.php | 0 .../Util/Module/Pagination/Pagination.php | 0 .../Module/SystemMessage/SystemMessage.php | 20 - .../Component/Util/Template/Admin/Admin.php | 0 .../Util/Template/Breadcrumb/Breadcrumb.php | 0 .../Util/Template/Display/CSS/CSS.php | 0 .../Component/Util/Template/Display/JS/JS.php | 0 .../Util/Template/Display/Meta/Meta.php | 0 .../Component/Util/Template/Footer/Footer.php | 0 .../Component/Util/Template/Header/Header.php | 0 .../Component/Util/Template/Index/Index.php | 0 .../Component/Util/Template/Master/Blank.php | 0 .../Util/Template/Master/CSS/CSS.php | 0 .../Util/Template/Master/DAO/DAO.php | 0 .../Util/Template/Master/Email/HTML.php | 0 .../Util/Template/Master/Email/PlainText.php | 0 .../Util/Template/Master/File/File.php | 0 .../Util/Template/Master/Image/Image.php | 0 .../Component/Util/Template/Master/JS/JS.php | 0 .../Component/Util/Template/Master/Master.php | 0 .../Util/Template/Master/Public/Public.php | 0 .../Util/Template/Pagination/Alphabetize.php | 0 .../Util/Template/Pagination/Pagination.php | 0 .../Template/SystemMessage/SystemMessage.php | 20 - www/base-airsoft-app.xml | 0 www/base.xml | 1 + www/css.php | 0 www/dao.php | 0 www/file.php | 0 www/img.php | 0 www/index.php | 5 + www/js.php | 0 www/mod.php | 0 www/public.php | 0 www/theme/admin/default/js/form.js | 2 + 158 files changed, 199 insertions(+), 4464 deletions(-) create mode 100644 .gitignore mode change 100755 => 100644 README mode change 100755 => 100644 mcp_config/MainExample.xml mode change 100755 => 100644 mcp_root/App/Config/Config.xml mode change 100755 => 100644 mcp_root/App/Config/Modules.xml mode change 100755 => 100644 mcp_root/App/Core/DAO.php mode change 100755 => 100644 mcp_root/App/Core/DB.php mode change 100755 => 100644 mcp_root/App/Core/Exception/Permission.php mode change 100755 => 100644 mcp_root/App/Core/MCP.php mode change 100755 => 100644 mcp_root/App/Core/Resource.php delete mode 100644 mcp_root/App/Core/VDItem.php mode change 100755 => 100644 mcp_root/App/Lib/Console/Console.php mode change 100755 => 100644 mcp_root/App/Lib/Email/Emailer.php mode change 100755 => 100644 mcp_root/App/Lib/Import/Import.php mode change 100755 => 100644 mcp_root/App/Lib/Request/Request.php mode change 100755 => 100644 mcp_root/App/Lib/Validation/Validator.php mode change 100755 => 100644 mcp_root/App/Resource/Cache/CacheHandler.php mode change 100755 => 100644 mcp_root/App/Resource/Cache/DAO/DAODataCache.php mode change 100755 => 100644 mcp_root/App/Resource/Cache/DAO/DAOImageCache.php mode change 100755 => 100644 mcp_root/App/Resource/Config/Config.php mode change 100755 => 100644 mcp_root/App/Resource/Cookie/CookieManager.php mode change 100755 => 100644 mcp_root/App/Resource/DB/MySQL/MySQL.php mode change 100755 => 100644 mcp_root/App/Resource/DB/MySQLi/MySQLi.php mode change 100755 => 100644 mcp_root/App/Resource/DB/PDO/PDO.php mode change 100755 => 100644 mcp_root/App/Resource/Event/EventHandler.php mode change 100755 => 100644 mcp_root/App/Resource/File/DAO/DAOImage.php mode change 100755 => 100644 mcp_root/App/Resource/Module/Module.php delete mode 100644 mcp_root/App/Resource/Permission/PermissionBase.php delete mode 100644 mcp_root/App/Resource/Permission/Plugin/Admin.php mode change 100755 => 100644 mcp_root/App/Resource/Session/DAO/DAOSessionHandler.php mode change 100755 => 100644 mcp_root/App/Resource/Session/SessionHandler.php mode change 100755 => 100644 mcp_root/App/Resource/Site/DAO/DAOSite.php mode change 100755 => 100644 mcp_root/App/Resource/Site/Site.php mode change 100755 => 100644 mcp_root/App/Resource/Template/Template.php mode change 100755 => 100644 mcp_root/App/Resource/User/User.php mode change 100755 => 100644 mcp_root/Component/Config/DAO/DAOConfig.php mode change 100755 => 100644 mcp_root/Component/Config/Module/Form/Form.php mode change 100755 => 100644 mcp_root/Component/Config/Template/Form/Form.php mode change 100755 => 100644 mcp_root/Component/Field/DAO/DAOField.php mode change 100755 => 100644 mcp_root/Component/Field/Module/Form/Form.php mode change 100755 => 100644 mcp_root/Component/Field/Module/List/List.php mode change 100755 => 100644 mcp_root/Component/Field/Template/Form/Form.php mode change 100755 => 100644 mcp_root/Component/Field/Template/List/List.php mode change 100755 => 100644 mcp_root/Component/Field/Template/List/Redirect.php delete mode 100644 mcp_root/Component/Menu/Theme/Menu.php delete mode 100755 mcp_root/Component/Navigation/DAO/DAONavigation.php delete mode 100755 mcp_root/Component/Navigation/Module/Form/Link/Link.php delete mode 100755 mcp_root/Component/Navigation/Module/Form/Menu/Menu.php delete mode 100755 mcp_root/Component/Navigation/Module/List/Link/Link.php delete mode 100755 mcp_root/Component/Navigation/Module/List/Menu/Menu.php delete mode 100644 mcp_root/Component/Navigation/Module/Menu/Admin/Admin.php delete mode 100755 mcp_root/Component/Navigation/Module/Menu/Menu.php delete mode 100755 mcp_root/Component/Navigation/Module/Router/Router.php delete mode 100644 mcp_root/Component/Navigation/Template/Form/Link/Layout.php delete mode 100755 mcp_root/Component/Navigation/Template/Form/Link/Link.php delete mode 100644 mcp_root/Component/Navigation/Template/Form/Link/LinkNew.php delete mode 100755 mcp_root/Component/Navigation/Template/Form/Link/ModuleConfig.php delete mode 100755 mcp_root/Component/Navigation/Template/Form/Menu/Menu.php delete mode 100755 mcp_root/Component/Navigation/Template/List/Link/Edit.php delete mode 100755 mcp_root/Component/Navigation/Template/List/Link/Link.php delete mode 100644 mcp_root/Component/Navigation/Template/List/Menu/Menu.php delete mode 100644 mcp_root/Component/Navigation/Template/List/Menu/Redirect.php delete mode 100644 mcp_root/Component/Navigation/Template/Menu/Admin/Admin.php delete mode 100755 mcp_root/Component/Navigation/Template/Menu/Menu.php delete mode 100755 mcp_root/Component/Navigation/Template/Router/PageNotFound.php delete mode 100755 mcp_root/Component/Navigation/Template/Router/PermissionDenied.php delete mode 100755 mcp_root/Component/Navigation/Template/Router/Redirect.php mode change 100755 => 100644 mcp_root/Component/Node/DAO/DAONode.php mode change 100755 => 100644 mcp_root/Component/Node/Module/Form/Comment/Comment.php mode change 100755 => 100644 mcp_root/Component/Node/Module/Form/Entry/Entry.php mode change 100755 => 100644 mcp_root/Component/Node/Module/Form/Type/Type.php mode change 100755 => 100644 mcp_root/Component/Node/Module/List/Comment/Comment.php mode change 100755 => 100644 mcp_root/Component/Node/Module/List/Entry/Entry.php mode change 100755 => 100644 mcp_root/Component/Node/Module/List/Type/Type.php mode change 100755 => 100644 mcp_root/Component/Node/Module/View/Entry/Entry.php mode change 100755 => 100644 mcp_root/Component/Node/Template/Form/Comment/Comment.php mode change 100755 => 100644 mcp_root/Component/Node/Template/Form/Entry/Entry.php mode change 100755 => 100644 mcp_root/Component/Node/Template/Form/Type/Type.php mode change 100755 => 100644 mcp_root/Component/Node/Template/List/Comment/Comment.php mode change 100755 => 100644 mcp_root/Component/Node/Template/List/Entry/Entry.php mode change 100755 => 100644 mcp_root/Component/Node/Template/List/Entry/Redirect.php mode change 100755 => 100644 mcp_root/Component/Node/Template/List/Entry/View.php mode change 100755 => 100644 mcp_root/Component/Node/Template/List/Type/Redirect.php mode change 100755 => 100644 mcp_root/Component/Node/Template/List/Type/Type.php mode change 100755 => 100644 mcp_root/Component/Node/Template/View/Entry/Edit.php mode change 100755 => 100644 mcp_root/Component/Node/Template/View/Entry/Entry.php mode change 100755 => 100644 mcp_root/Component/Site/DAO/DAOSite.php mode change 100755 => 100644 mcp_root/Component/Site/Module/List/List.php mode change 100755 => 100644 mcp_root/Component/Site/Template/List/List.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/DAO/DAOTaxonomy.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Module/Form/Term/Term.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Module/Form/Vocabulary/Vocabulary.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Module/List/Vocabulary/Vocabulary.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Module/Tree/Term/Term.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Template/Form/Term/Term.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Template/Form/Vocabulary/Vocabulary.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Template/List/Vocabulary/Redirect.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Template/List/Vocabulary/Vocabulary.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Template/Tree/Term/Redirect.php mode change 100755 => 100644 mcp_root/Component/Taxonomy/Template/Tree/Term/Term.php mode change 100755 => 100644 mcp_root/Component/User/DAO/DAOUser.php mode change 100755 => 100644 mcp_root/Component/User/Module/List/List.php mode change 100755 => 100644 mcp_root/Component/User/Module/Login/Login.php mode change 100755 => 100644 mcp_root/Component/User/Module/Logout/Logout.php mode change 100755 => 100644 mcp_root/Component/User/Module/Registration/Form/Form.php mode change 100755 => 100644 mcp_root/Component/User/Template/List/List.php mode change 100755 => 100644 mcp_root/Component/User/Template/List/Redirect.php mode change 100755 => 100644 mcp_root/Component/User/Template/Login/Login.php mode change 100755 => 100644 mcp_root/Component/User/Template/Logout/Logout.php mode change 100755 => 100644 mcp_root/Component/User/Template/Registration/Form/Form.php mode change 100755 => 100644 mcp_root/Component/Util/DAO/DAOUtil.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Admin/Admin.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Breadcrumb/Breadcrumb.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Display/CSS/CSS.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Display/JS/JS.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Display/Meta/Meta.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Footer/Footer.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Header/Header.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Index/Index.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Master/Email/Email.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Master/Master.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Pagination/Alphabetize.php mode change 100755 => 100644 mcp_root/Component/Util/Module/Pagination/Pagination.php delete mode 100644 mcp_root/Component/Util/Module/SystemMessage/SystemMessage.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Admin/Admin.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Breadcrumb/Breadcrumb.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Display/CSS/CSS.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Display/JS/JS.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Display/Meta/Meta.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Footer/Footer.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Header/Header.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Index/Index.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/Blank.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/CSS/CSS.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/DAO/DAO.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/Email/HTML.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/Email/PlainText.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/File/File.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/Image/Image.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/JS/JS.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/Master.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Master/Public/Public.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Pagination/Alphabetize.php mode change 100755 => 100644 mcp_root/Component/Util/Template/Pagination/Pagination.php delete mode 100644 mcp_root/Component/Util/Template/SystemMessage/SystemMessage.php mode change 100755 => 100644 www/base-airsoft-app.xml mode change 100755 => 100644 www/base.xml mode change 100755 => 100644 www/css.php mode change 100755 => 100644 www/dao.php mode change 100755 => 100644 www/file.php mode change 100755 => 100644 www/img.php mode change 100755 => 100644 www/index.php mode change 100755 => 100644 www/js.php mode change 100755 => 100644 www/mod.php mode change 100755 => 100644 www/public.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..caabccb --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +# ignore all cached items # +mcp_cache/images/* + +# ignore main config # +mcp_config/Main.xml + +# ignore all platforms # +mcp_root/PlatForm/* + +# ignore all sites # +mcp_root/Site/* + +# ignore all files # +mcp_files/images/* +mcp_files/files +mcp_files/audio +mcp_files/video + +# ignore remote and reserve # +remote +reserve + +# ignore lib, jason_fugh and other # +www/jason_fugh +www/lib +www/other + +#ignore ghost . files +**/*.php +**/*.txt +**/._* + +# IDE files +org.eclipse.* +.jsdtscope +.project +.buildpath \ No newline at end of file diff --git a/README b/README old mode 100755 new mode 100644 diff --git a/mcp_config/MainExample.xml b/mcp_config/MainExample.xml old mode 100755 new mode 100644 diff --git a/mcp_root/App/Config/Config.xml b/mcp_root/App/Config/Config.xml old mode 100755 new mode 100644 diff --git a/mcp_root/App/Config/Modules.xml b/mcp_root/App/Config/Modules.xml old mode 100755 new mode 100644 diff --git a/mcp_root/App/Core/DAO.php b/mcp_root/App/Core/DAO.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Core/DB.php b/mcp_root/App/Core/DB.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Core/Exception/Permission.php b/mcp_root/App/Core/Exception/Permission.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Core/MCP.php b/mcp_root/App/Core/MCP.php old mode 100755 new mode 100644 index 4a83a84..4573801 --- a/mcp_root/App/Core/MCP.php +++ b/mcp_root/App/Core/MCP.php @@ -263,81 +263,91 @@ private function _init() { */ $objDBConfig = array_pop($this->_objXMLMain->xpath("//site[@id='{$this->getSitesId()}']/db")); - /* - * Create database object and connect - * - * Different adapters may be used by changing the adapter XML config value. The value - * should reflect the full path to the adpater. The adapter is required to implement - * MCPDB and extend MCPResource. This is required so all the adapters can be interchanged. - * Default adapters are stored inside App.Resource.DB. Custom adapters should not be placed - * here. Instead you should dedicate a pkg or site directory to them so they aren't lost - * when updating to new versions of MCP. - */ - $this->_objDB = $this->getInstance((string) $objDBConfig->adapter,array($this)); - $this->_objDB->connect( - (string) $objDBConfig->host - ,(string) $objDBConfig->user - ,(string) $objDBConfig->pass - ,(string) $objDBConfig->db - ); + if(INSTALLED) { + + /* + * Create database object and connect + * + * Different adapters may be used by changing the adapter XML config value. The value + * should reflect the full path to the adpater. The adapter is required to implement + * MCPDB and extend MCPResource. This is required so all the adapters can be interchanged. + * Default adapters are stored inside App.Resource.DB. Custom adapters should not be placed + * here. Instead you should dedicate a pkg or site directory to them so they aren't lost + * when updating to new versions of MCP. + */ + $this->_objDB = $this->getInstance((string) $objDBConfig->adapter,array($this)); + $this->_objDB->connect( + (string) $objDBConfig->host + ,(string) $objDBConfig->user + ,(string) $objDBConfig->pass + ,(string) $objDBConfig->db + ); + + } /* * Create MCP event handler */ $this->_objEventHandler = $this->getInstance('App.Resource.Event.EventHandler',array($this)); - /* - * Set the current site - */ - $this->_objSite = MCPSite::createInstance($this); + if(INSTALLED) { + /* + * Set the current site + */ + $this->_objSite = MCPSite::createInstance($this); + } /* * Initiate cookie manager - required for proper session handling */ $this->_objCookieManager = $this->getInstance('App.Resource.Cookie.CookieManager',array($this)); - - /* - * Initiate cache handler - */ - $this->import('App.Resource.Cache.CacheHandler'); - $this->_objCacheHandler = MCPCacheHandler::createInstance($this); - - /* - * Initiate session handler - */ - $this->import('App.Resource.Session.SessionHandler'); - $this->_objSessionHandler = MCPSessionHandler::createInstance($this); - - /* - * Required for garbage collector to function appropriatly - */ - ini_set('session.gc_probability', 100); - ini_set('session.gc_divisor', 100); + + if(INSTALLED) { + /* + * Initiate cache handler + */ + $this->import('App.Resource.Cache.CacheHandler'); + $this->_objCacheHandler = MCPCacheHandler::createInstance($this); + + /* + * Initiate session handler + */ + $this->import('App.Resource.Session.SessionHandler'); + $this->_objSessionHandler = MCPSessionHandler::createInstance($this); + + /* + * Required for garbage collector to function appropriatly + */ + ini_set('session.gc_probability', 100); + ini_set('session.gc_divisor', 100); + } /* * Begin session once session handler has been created */ session_start(); - /* - * Create config instance - */ - $this->_objConfig = MCPConfig::createInstance($this); + if(INSTALLED) { + /* + * Create config instance + */ + $this->_objConfig = MCPConfig::createInstance($this); - /* - * Create user instance - */ - $this->_objUser = MCPUser::createInstance($this); - - /* - * Create permission handler - */ - $this->_objPermissionHandler = $this->getInstance('App.Resource.Permission.PermissionManager',array($this)); - - /* - * Create Template singleton - */ - $this->_objTemplate = MCPTemplate::createInstance($this); + /* + * Create user instance + */ + $this->_objUser = MCPUser::createInstance($this); + + /* + * Create permission handler + */ + $this->_objPermissionHandler = $this->getInstance('App.Resource.Permission.PermissionManager',array($this)); + } + + /* + * Create Template singleton + */ + $this->_objTemplate = MCPTemplate::createInstance($this); /* * Instatiate UI drawing library @@ -352,26 +362,30 @@ private function _init() { */ $this->_objUI->registerPath(ROOT.'/Component/Node/Theme'); - /* - * Assign default master template path - */ - //$this->_strMasterTemplatePath = 'Site'.DS.'*'.DS/*.'Template'.DS*/.'master.php'; - $this->_strMasterTemplatePath = $this->getConfigValue('site_master_template'); - - /* - * Assign default email master template path - */ - $this->_strEmailHTMLMasterTemplatePath = $this->getConfigValue('site_email_html_master_template'); - - /* - * Assign default email plain text master template path - */ - $this->_strEmailPlainTextMasterTemplatePath = $this->getConfigValue('site_email_plain_text_master_template'); - + if(INSTALLED) { + /* + * Assign default master template path + */ + //$this->_strMasterTemplatePath = 'Site'.DS.'*'.DS/*.'Template'.DS*/.'master.php'; + $this->_strMasterTemplatePath = $this->getConfigValue('site_master_template'); + + /* + * Assign default email master template path + */ + $this->_strEmailHTMLMasterTemplatePath = $this->getConfigValue('site_email_html_master_template'); + + /* + * Assign default email plain text master template path + */ + $this->_strEmailPlainTextMasterTemplatePath = $this->getConfigValue('site_email_plain_text_master_template'); + } + /* * Execute login */ - $this->executeLogin(); + if(INSTALLED) { + $this->executeLogin(); + } } @@ -1242,7 +1256,16 @@ public function getFrmConfig($strPkg,$strType='frm',$boolMixin=true,$arrDynamic= if(strcmp('default',$objConfig->getName()) == 0) { $mixValue = str_replace(array('SITES_ID','USERS_ID'),array($this->getSitesId(),$this->getUsersId()),(string) $objConfig); - } else { + + + // nested children + } else if(strcmp('children',$objConfig->getName()) === 0) { + + $objNestedXml = simplexml_load_string("{$objConfig->asXml()}"); + $mixValue = $this->getFrmConfig($objNestedXml,'children'); + + + } else { $mixValue = (string) $objConfig; } diff --git a/mcp_root/App/Core/Resource.php b/mcp_root/App/Core/Resource.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Core/VDItem.php b/mcp_root/App/Core/VDItem.php deleted file mode 100644 index e4eb04c..0000000 --- a/mcp_root/App/Core/VDItem.php +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/mcp_root/App/Lib/Console/Console.php b/mcp_root/App/Lib/Console/Console.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Lib/Email/Emailer.php b/mcp_root/App/Lib/Email/Emailer.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Lib/Import/Import.php b/mcp_root/App/Lib/Import/Import.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Lib/Request/Request.php b/mcp_root/App/Lib/Request/Request.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Lib/UI/Element/Common/Form/Form.php b/mcp_root/App/Lib/UI/Element/Common/Form/Form.php index 5d4c50f..de1e41e 100644 --- a/mcp_root/App/Lib/UI/Element/Common/Form/Form.php +++ b/mcp_root/App/Lib/UI/Element/Common/Form/Form.php @@ -380,7 +380,9 @@ public function html($settings,\UI\Manager $ui) { $element.= $ui->draw('Common.Form.Video',array( - 'base_name'=>sprintf('%s[%s]%s',$name,$field,(isset($data['multi'])?"[$i]":'')) + 'base_name'=>sprintf('%s[%s]%s',$name,$field,(isset($data['multi'])?"[$i][0]":'[0]')), + 'codec'=> $data['children']['codec'], + 'container'=> $data['children']['container'] )); } else { diff --git a/mcp_root/App/Lib/UI/Element/Common/Form/Video.php b/mcp_root/App/Lib/UI/Element/Common/Form/Video.php index 6ed29a0..b69ade3 100644 --- a/mcp_root/App/Lib/UI/Element/Common/Form/Video.php +++ b/mcp_root/App/Lib/UI/Element/Common/Form/Video.php @@ -7,6 +7,12 @@ public function settings() { return array( 'base_name'=>array( 'required'=>true + ), + 'codec'=> array( + 'required'=> true + ), + 'container'=> array( + 'required'=> true ) ); } @@ -57,12 +63,7 @@ protected function _getCodecsElement($ui,$settings) { 'name'=>$base_name.'[codec]' ,'id'=>'xxx' ,'data'=>array( - 'values'=>array( - array('values'=>'','label'=>'Pick Codec') - ,array('value'=>'1','label'=>'One') - ,array('value'=>'2','label'=>'Two') - ,array('value'=>'3','label'=>'Three') - ) + 'values'=> $codec['values'] ) ,'value'=>'' )); @@ -82,12 +83,7 @@ protected function _getContainersElement($ui,$settings) { 'name'=>$base_name.'[container]' ,'id'=>'xxxccc' ,'data'=>array( - 'values'=>array( - array('values'=>'','label'=>'Pick Format') - ,array('value'=>'1','label'=>'One') - ,array('value'=>'2','label'=>'Two') - ,array('value'=>'3','label'=>'Three') - ) + 'values'=> $container['values'] ) ,'value'=>'' )); diff --git a/mcp_root/App/Lib/Validation/Validator.php b/mcp_root/App/Lib/Validation/Validator.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Cache/CacheHandler.php b/mcp_root/App/Resource/Cache/CacheHandler.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Cache/DAO/DAODataCache.php b/mcp_root/App/Resource/Cache/DAO/DAODataCache.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Cache/DAO/DAOImageCache.php b/mcp_root/App/Resource/Cache/DAO/DAOImageCache.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Config/Config.php b/mcp_root/App/Resource/Config/Config.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Cookie/CookieManager.php b/mcp_root/App/Resource/Cookie/CookieManager.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/DB/MySQL/MySQL.php b/mcp_root/App/Resource/DB/MySQL/MySQL.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/DB/MySQLi/MySQLi.php b/mcp_root/App/Resource/DB/MySQLi/MySQLi.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/DB/PDO/PDO.php b/mcp_root/App/Resource/DB/PDO/PDO.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Event/EventHandler.php b/mcp_root/App/Resource/Event/EventHandler.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/File/DAO/DAOImage.php b/mcp_root/App/Resource/File/DAO/DAOImage.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Module/Module.php b/mcp_root/App/Resource/Module/Module.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Permission/PermissionBase.php b/mcp_root/App/Resource/Permission/PermissionBase.php deleted file mode 100644 index d521930..0000000 --- a/mcp_root/App/Resource/Permission/PermissionBase.php +++ /dev/null @@ -1,703 +0,0 @@ -import('App.Core.DAO'); -$this->import('App.Core.Permission'); - -/* -* Template permission. Extend this class when creating permissions. This -* class provides several "helper" methods to build the SQL "commonly" associated -* with permissions for different entity levels. The normal entity permissions -* are represented as a three level tree. -* -*/ -abstract class MCPPermissionBase extends MCPDAO implements MCPPermission { - - - /* - * To level items are things like: vocabulary, Navigation, Node Type, Role, etc - anything - * that does not have a virtual parent. For example, Terms have a virtual parent of a Vocabulary - * so terms will not use this method to create a SQL permission statement. The same is true with - * navigation links and nodes. Nodes have a virtual parent of node type and navigation links - * have a virtual parent of navigation. - * - * This method exists because most if not all top level items use the same logic to - * derive permissions. I am getting wick of copying and pasting the same SQL so - * this method can now be used to create the statement for any entity were it is needed - * without essentially replicating the same SQL statement and tweaking a few things. - * - * - note this uses variable binding. YOU MUST PASS :users_id and :entity_type from the callee - * when executing the query. This method does not execute a query just provides a template - * to do so. Template in this sense means a SQL statement ready to be executed w/ provided - * placeholders for dynamic pieces such as users ID, entity type and messages. - * - * @return str SQL template - * - * placeholders: - * - :users_id - * - :entity_type - * - :deny_add_msg_dev - * - :deny_add_msg_user - * - */ - protected function _getTopLevelEntityCreateSQLTemplate() { - - return - "SELECT - CASE - - WHEN pu.add IS NOT NULL - THEN pu.add - - WHEN MAX(pr.add) IS NOT NULL - THEN MAX(pr.add) - - ELSE 0 - END allow_add - - ,:deny_add_msg_dev deny_add_msg_dev - ,:deny_add_msg_user deny_add_msg_user - - FROM - MCP_USERS u - - #user permission resolution# - LEFT OUTER - JOIN - MCP_PERMISSIONS_USERS pu - ON - pu.item_type = :entity_type - AND - pu.item_id = 0 - AND - u.users_id = pu.users_id - - # role management resolution# - LEFT OUTER - JOIN - MCP_USERS_ROLES u2r - ON - u.users_id = u2r.users_id - LEFT OUTER - JOIN - MCP_ROLES r - ON - u2r.roles_id = r.roles_id - AND - r.deleted = 0 - LEFT OUTER - JOIN - MCP_PERMISSIONS_ROLES pr #role permissions# - ON - pr.item_type = :entity_type - AND - pr.item_id = 0 - AND - r.roles_id = pr.roles_id - WHERE - u.users_id = :users_id - GROUP - BY - u.users_id"; - - } - - /* - * @param str base table name - * @param str base table primary key column - * @param int[] items ids - * [@param] str base table creator column name - * @return str SQL template - * - * palceholders: - * - * - :users_id - * - :default_allow_delete - * - :default_allow_edit - * - :default_allow_read - * - :item_type - */ - protected function _getTopLevelEntityEditSQLTemplate($strBaseTable,$strPrimaryKey,$arrIds,$strCreator='creators_id') { - - return - "SELECT - b.{$this->_objMCP->escapeString($strPrimaryKey)} item_id #base item unique id# - - #can user delete role# - ,CASE - - #user permission resolution (priority)# - WHEN upe.`delete` IS NOT NULL - THEN upe.`delete` - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = upe.users_id AND upe.`delete_own` IS NOT NULL - THEN upe.`delete_own` - - WHEN upp.`delete` IS NOT NULL - THEN upp.delete - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = upp.users_id AND upp.`delete_own` IS NOT NULL - THEN upp.`delete_own` - - #role permission resolution# - WHEN MAX(rpe.`delete`) IS NOT NULL - THEN MAX(rpe.`delete`) - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id AND MAX(rpe.`delete_own`) IS NOT NULL - THEN MAX(rpe.`delete_own`) - - WHEN MAX(rpp.`delete`) IS NOT NULL - THEN MAX(rpp.`delete`) - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id AND MAX(rpp.`delete_own`) IS NOT NULL - THEN MAX(rpp.`delete_own`) - - #by default the creator of the node is allowed to delete it# - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id - THEN 1 - - #by default if user has no permissions to delete deny# - ELSE - :default_allow_delete - - END allow_delete - - #can the user edit role# - ,CASE - - #user permission resolution (priority)# - WHEN upe.`edit` IS NOT NULL - THEN upe.`edit` - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = upe.users_id AND upe.`edit_own` IS NOT NULL - THEN upe.`edit_own` - - WHEN upp.`edit` IS NOT NULL - THEN upp.`edit` - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = upp.users_id AND upp.`edit_own` IS NOT NULL - THEN upp.`edit_own` - - #role permission resolution# - WHEN MAX(rpe.`edit`) IS NOT NULL - THEN MAX(rpe.`edit`) - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id AND MAX(rpe.`edit_own`) IS NOT NULL - THEN MAX(rpe.`edit_own`) - - WHEN MAX(rpp.`edit`) IS NOT NULL - THEN MAX(rpp.`edit`) - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id AND MAX(rpp.`edit_own`) IS NOT NULL - THEN MAX(rpp.`edit_own`) - - #by default creator of role is allowed to edit it# - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id - THEN 1 - - #deny edit for everyone else# - ELSE - :default_allow_edit - - END allow_edit - - #can the user read role# - ,CASE - - #user permission resolution (priority)# - WHEN upe.`read` IS NOT NULL - THEN upe.`read` - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = upe.users_id AND upe.`read_own` IS NOT NULL - THEN upe.`read_own` - - WHEN upp.`read` IS NOT NULL - THEN upp.`read` - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = upp.users_id AND upp.`read_own` IS NOT NULL - THEN upp.`read_own` - - #role permission resolution# - WHEN MAX(rpe.`read`) IS NOT NULL - THEN MAX(rpe.`read`) - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id AND MAX(rpe.`read_own`) IS NOT NULL - THEN MAX(rpe.`read_own`) - - WHEN MAX(rpp.`read`) IS NOT NULL - THEN MAX(rpp.`read`) - - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id AND MAX(rpp.`read_own`) IS NOT NULL - THEN MAX(rpp.`read_own`) - - #by default author may read role# - WHEN b.`{$this->_objMCP->escapeString($strCreator)}` = :users_id - THEN 1 - - #by default restrict read# - ELSE - :default_allow_read - - END allow_read - FROM - {$this->_objMCP->escapeString($strBaseTable)} b #base entity table# - LEFT OUTER - JOIN - MCP_PERMISSIONS_USERS upe #user permission entity# - ON - b.{$this->_objMCP->escapeString($strPrimaryKey)} = upe.item_id - AND - upe.users_id = :users_id - AND - upe.item_type = :item_type - LEFT OUTER - JOIN - MCP_PERMISSIONS_USERS upp #user parent permission entity# - ON - upp.item_id = 0 - AND - upp.users_id = :users_id - AND - upp.item_type = :item_type - LEFT OUTER - JOIN - MCP_USERS_ROLES u2r #roles user is assigned to# - ON - u2r.users_id = :users_id - LEFT OUTER - JOIN - MCP_ROLES r #roles# - ON - u2r.roles_id = r.roles_id - AND - r.deleted = 0 - LEFT OUTER - JOIN - MCP_PERMISSIONS_ROLES rpe #role permission entity# - ON - b.{$this->_objMCP->escapeString($strPrimaryKey)} = rpe.item_id - AND - rpe.item_type = :item_type - AND - r.roles_id = rpe.roles_id - LEFT OUTER - JOIN - MCP_USERS_ROLES u2r2 #parent role permission# - ON - u2r2.users_id = :users_id - LEFT OUTER - JOIN - MCP_ROLES r2 #roles - resolving parent relationship# - ON - u2r2.roles_id = r2.roles_id - AND - r2.deleted = 0 - LEFT OUTER - JOIN - MCP_PERMISSIONS_ROLES rpp #role permission parent# - ON - rpp.item_type = :item_type - AND - rpp.item_id = 0 - AND - r2.roles_id = rpp.roles_id - WHERE - b.{$this->_objMCP->escapeString($strPrimaryKey)} IN ({$this->_objMCP->escapeString(implode(',',$arrIds))}) - GROUP - BY - b.{$this->_objMCP->escapeString($strPrimaryKey)}"; - - } - - /* - * Child level create permissions will be granted based on the childs - * context or parent. For example, a node may be created based on - * its context. This makes it possible to allow creation of a "project" - * and restrict creation of "blog" or anything. This allows a very granular - * level of control over who can create what. - * - * - * @param str base table - * @param str base table primary key column name - * @param array contextual ids - * @param base table creators column - * @return str SQL statement - * - * query placeholders: - * - * - :item_type - * - :users_id - * - :default_allow_add - * - :deny_add_msg_dev - * - :deny_add_msg_user - */ - protected function _getChildLevelEntityCreateSQLTemplate($strBaseTable,$strPrimaryKey,$arrIds,$strCreator='creators_id') { - - return - "SELECT - b.{$this->_objMCP->escapeString($strPrimaryKey)} item_id #the generic entity id# - ,CASE - - #user permissions have precedence over roles. Determoine whether user has explicit setting to create a node of the type# - WHEN pu.add_child IS NOT NULL - THEN pu.add_child - - #user permissions have precedence over roles. Determine whether user has explicit setting to create node of a type they created# - WHEN b.{$this->_objMCP->escapeString($strCreator)} = pu.users_id AND pu.add_own_child IS NOT NULL - THEN pu.add_own_child - - #determines whether user is assigned to role that has settings for creating node of type# - WHEN MAX(pr.add_child) IS NOT NULL - THEN MAX(pr.add_child) - - #Determines whether user is assigned to role that has settings for creating node of a type that they created# - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(pr.add_own_child) IS NOT NULL - THEN MAX(pr.add_own_child) - - #by default creator of node type can create nodes of that type# - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id - THEN 1 - - #When nothing has been matched deny creation of node of specified type# - ELSE - :default_allow_add - - END allow_add - - ,:deny_add_msg_dev deny_add_msg_dev - ,:deny_add_msg_user deny_add_msg_user - - FROM - {$this->_objMCP->escapeString($strBaseTable)} b #base table entity# - LEFT OUTER - JOIN - MCP_PERMISSIONS_USERS pu #current logged-in users explicit permission settings# - ON - pu.item_type = :item_type #base entity type# - AND - b.{$this->_objMCP->escapeString($strPrimaryKey)} = pu.item_id #base entity primary key# - AND - pu.users_id = :users_id - LEFT OUTER - JOIN - MCP_USERS_ROLES u2r #roles that the current user is assigned to. This is the look-up table that assigns a role to a user# - ON - u2r.users_id = :users_id - LEFT OUTER - JOIN - MCP_ROLES r - ON - u2r.roles_id = r.roles_id - AND - r.deleted = 0 #ignore roles that have been deleted ie. when deleted is null the role has beeen deleted# - LEFT OUTER - JOIN - MCP_PERMISSIONS_ROLES pr #permission settings for the roles that the current user has been assigned to# - ON - pr.item_type = :item_type #base entity type# - AND - b.{$this->_objMCP->escapeString($strPrimaryKey)} = pr.item_id #base entity primary key# - AND - r.roles_id = pr.roles_id #role# - WHERE - b.{$this->_objMCP->escapeString($strPrimaryKey)} IN ({$this->_objMCP->escapeString(implode(',',$arrIds))}) - GROUP - BY - b.{$this->_objMCP->escapeString($strPrimaryKey)}"; - - } - - /* - * @param str base table - * @param str base table primary key column - * @param str parent table primary key column - * @param array entity ids - * @param str creators column name for base table - * @return str SQL statement - * - * palceholders: - * - * - :users_id - * - :default_allow_delete - * - :default_allow_edit - * - :default_allow_read - * - :item_type - * - :item_type_parent - */ - protected function _getChildLevelEntityEditSQLTemplate($strBaseTable,$strPrimaryKey,$strParentPrimaryKey,$arrIds,$strCreator='creators_id') { - - return - "SELECT - b.{$this->_objMCP->escapeString($strPrimaryKey)} item_id #base item unique id# - - #can user delete node# - ,CASE - - #user permission resolution (priority)# - WHEN upe.`delete` IS NOT NULL - THEN upe.`delete` - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = upe.users_id AND upe.`delete_own` IS NOT NULL - THEN upe.`delete_own` - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = upp.users_id AND upp.`delete_own_child` IS NOT NULL - THEN upp.`delete_own_child` - - WHEN upp.`delete_child` IS NOT NULL - THEN upp.`delete_child` - - #role permission resolution# - WHEN MAX(rpe.`delete`) IS NOT NULL - THEN MAX(rpe.`delete`) - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(rpe.`delete_own`) IS NOT NULL - THEN MAX(rpe.`delete_own`) - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(rpp.`delete_own_child`) IS NOT NULL - THEN MAX(rpp.`delete_own_child`) - - WHEN MAX(rpp.`delete_child`) IS NOT NULL - THEN MAX(rpp.`delete_child`) - - #by default the creator of the node is allowed to delete it# - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id - THEN 1 - - #by default if user has no permissions to delete deny# - ELSE - :default_allow_delete - - END allow_delete - - #can the user edit node# - ,CASE - - #user permission resolution (priority)# - WHEN upe.`edit` IS NOT NULL - THEN upe.`edit` - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = upe.users_id AND upe.`edit_own` IS NOT NULL - THEN upe.`edit_own` - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = upp.users_id AND upp.`edit_own_child` IS NOT NULL - THEN upp.`edit_own_child` - - WHEN upp.`edit_child` IS NOT NULL - THEN upp.`edit_child` - - #role permission resolution# - WHEN MAX(rpe.`edit`) IS NOT NULL - THEN MAX(rpe.`edit`) - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(rpe.`edit_own`) IS NOT NULL - THEN MAX(rpe.`edit_own`) - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(rpp.`edit_own_child`) IS NOT NULL - THEN MAX(rpp.`edit_own_child`) - - WHEN MAX(rpp.`edit_child`) IS NOT NULL - THEN MAX(rpp.`edit_child`) - - #by default creator of node is allowed to edit it# - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id - THEN 1 - - #deny edit for everyone else# - ELSE - :default_allow_edit - - END allow_edit - - #can the user read node# - ,CASE - - #user permission resolution (priority)# - WHEN upe.`read` IS NOT NULL - THEN upe.`read` - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = upe.users_id AND upe.`read_own` IS NOT NULL - THEN upe.`read_own` - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = upp.users_id AND upp.`read_own_child` IS NOT NULL - THEN upp.`read_own_child` - - WHEN upp.`read_child` IS NOT NULL - THEN upp.`read_child` - - #role permission resolution# - WHEN MAX(rpe.`read`) IS NOT NULL - THEN MAX(rpe.`read`) - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(rpe.`read_own`) IS NOT NULL - THEN MAX(rpe.`read_own`) - - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id AND MAX(rpp.`read_own_child`) IS NOT NULL - THEN MAX(rpp.`read_own_child`) - - WHEN MAX(rpp.`read_child`) IS NOT NULL - THEN MAX(rpp.`read_child`) - - #by default author may read node# - WHEN b.{$this->_objMCP->escapeString($strCreator)} = :users_id - THEN 1 - - #by default everyone may read the node# - ELSE - :default_allow_read - - END allow_read - - FROM - {$this->_objMCP->escapeString($strBaseTable)} b #base entity table# - - # user entity permission# - LEFT OUTER - JOIN - MCP_PERMISSIONS_USERS upe #explicit user node permissions(highest precedence) - user(u) permission(p) entity(e)# - ON - b.{$this->_objMCP->escapeString($strPrimaryKey)} = upe.item_id - AND - upe.users_id = :users_id - AND - upe.item_type = :item_type - - #user entity parent permission# - LEFT OUTER - JOIN - MCP_PERMISSIONS_USERS upp #explicit user node type permissions (parent permission) - user(u) permission(p) parent(p)# - ON - b.{$this->_objMCP->escapeString($strParentPrimaryKey)} = upp.item_id - AND - upp.users_id = :users_id - AND - upp.item_type = :item_type_parent - - # entity role permission# - LEFT OUTER - JOIN - MCP_USERS_ROLES u2r #roles user has been assigned to - for entity role permission resolution# - ON - u2r.users_id = :users_id - LEFT OUTER - JOIN - MCP_ROLES r #roles - resolving entity role permission# - ON - u2r.roles_id = r.roles_id - AND - r.deleted = 0 - LEFT OUTER - JOIN - MCP_PERMISSIONS_ROLES rpe #role(r) permission(p) entity(e)# - ON - rpe.item_type = :item_type - AND - b.{$this->_objMCP->escapeString($strPrimaryKey)} = rpe.item_id - AND - r.roles_id = rpe.roles_id - - # parent role permission# - LEFT OUTER - JOIN - MCP_USERS_ROLES u2r2 #roles users has been assigned to - for parent role permission resolution# - ON - u2r2.users_id = :users_id - LEFT OUTER - JOIN - MCP_ROLES r2 #roles - resolving parent entity role permission# - ON - u2r2.roles_id = r2.roles_id - AND - r2.deleted = 0 - LEFT OUTER - JOIN - MCP_PERMISSIONS_ROLES rpp #role(r) permission(p) parent(p)# - ON - rpp.item_type = :item_type_parent - AND - b.{$this->_objMCP->escapeString($strParentPrimaryKey)} = rpp.item_id - AND - r2.roles_id = rpp.roles_id - - WHERE - b.{$this->_objMCP->escapeString($strPrimaryKey)} IN ({$this->_objMCP->escapeString(implode(',',$arrIds))}) - GROUP - BY - b.{$this->_objMCP->escapeString($strPrimaryKey)}"; - - } - - public function read($ids) { - - $permissions = $this->_rud($ids,$this->_objMCP->getUsersId()); - - $return = array(); - foreach($permissions as $permission) { - $return[$permission['item_id']] = array( - 'allow'=>(bool) $permission['allow_read'] - ,'msg_dev'=>$permission['deny_read_msg_dev'] - ,'msg_user'=>'You may not see %s.' - ); - } - - foreach(array_diff($ids,array_keys($return)) as $id) { - $return[$id] = array( - 'allow'=>false - ,'msg_dev'=>'You are not allowed to see specified %s' - ,'msg_user'=>'You may not see %s.' - ); - } - - return $return; - - } - - public function delete($ids) { - - $permissions = $this->_rud($ids,$this->_objMCP->getUsersId()); - - $return = array(); - foreach($permissions as $permission) { - $return[$permission['item_id']] = array( - 'allow'=>(bool) $permission['allow_delete'] - ,'msg_dev'=>$permission['deny_delete_msg_dev'] - ,'msg_user'=>'You may not delete %s.' - ); - } - - foreach(array_diff($ids,array_keys($return)) as $id) { - $return[$id] = array( - 'allow'=>false - ,'msg_dev'=>'You are not allowed to delete specified %s' - ,'msg_user'=>'You may not delete %s.' - ); - } - - return $return; - - } - - public function edit($ids) { - - $permissions = $this->_rud($ids,$this->_objMCP->getUsersId()); - - $return = array(); - foreach($permissions as $permission) { - $return[$permission['item_id']] = array( - 'allow'=>(bool) $permission['allow_edit'] - ,'msg_dev'=>$permission['deny_edit_msg_dev'] - ,'msg_user'=>'You may not edit %s.' - ); - } - - foreach(array_diff($ids,array_keys($return)) as $id) { - $return[$id] = array( - 'allow'=>false - ,'msg_dev'=>'You are not allowed to edit specified %s' - ,'msg_user'=>'You may not edit %s.' - ); - } - - return $return; - - } - -} -?> \ No newline at end of file diff --git a/mcp_root/App/Resource/Permission/Plugin/Admin.php b/mcp_root/App/Resource/Permission/Plugin/Admin.php deleted file mode 100644 index 59af83d..0000000 --- a/mcp_root/App/Resource/Permission/Plugin/Admin.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/mcp_root/App/Resource/Session/DAO/DAOSessionHandler.php b/mcp_root/App/Resource/Session/DAO/DAOSessionHandler.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Session/SessionHandler.php b/mcp_root/App/Resource/Session/SessionHandler.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Site/DAO/DAOSite.php b/mcp_root/App/Resource/Site/DAO/DAOSite.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Site/Site.php b/mcp_root/App/Resource/Site/Site.php old mode 100755 new mode 100644 diff --git a/mcp_root/App/Resource/Template/Template.php b/mcp_root/App/Resource/Template/Template.php old mode 100755 new mode 100644 index 3c8b85e..4a2ad82 --- a/mcp_root/App/Resource/Template/Template.php +++ b/mcp_root/App/Resource/Template/Template.php @@ -51,7 +51,9 @@ private function _init() { /* * Maybe not the best place but it will work. */ - $this->_doctype = $this->_objMCP->getConfigValue('site_doctype'); + if(INSTALLED) { + $this->_doctype = $this->_objMCP->getConfigValue('site_doctype'); + } } /* diff --git a/mcp_root/App/Resource/User/User.php b/mcp_root/App/Resource/User/User.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Config/DAO/DAOConfig.php b/mcp_root/Component/Config/DAO/DAOConfig.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Config/Module/Form/Form.php b/mcp_root/Component/Config/Module/Form/Form.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Config/Template/Form/Form.php b/mcp_root/Component/Config/Template/Form/Form.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Field/DAO/DAOField.php b/mcp_root/Component/Field/DAO/DAOField.php old mode 100755 new mode 100644 index 05324ad..8619b57 --- a/mcp_root/Component/Field/DAO/DAOField.php +++ b/mcp_root/Component/Field/DAO/DAOField.php @@ -474,6 +474,27 @@ public function getFrmConfig($strEntityType,$intEntitiesId=null,$intSitesId=null $values.= ''.$field['cfg_widget'].''; } + + /** + * Add meta data for video fields + */ + if(strcasecmp($field['cfg_media'],'video') === 0) { + $values.= + ' + + select + + select + SELECT codecs_id value, codecs_id label FROM MCP_ENUM_VIDEO_CODECS + + + select + + select + SELECT containers_id value, ext label FROM MCP_ENUM_VIDEO_CONTAINERS + + '; + } /* * --------------------------------------------------------------------------------------- @@ -558,7 +579,7 @@ public function getFrmConfig($strEntityType,$intEntitiesId=null,$intSitesId=null username ASC '; - break; + break; default: } @@ -658,7 +679,7 @@ public function getFrmConfig($strEntityType,$intEntitiesId=null,$intSitesId=null /*$cfg = $this->_objMCP->getFrmConfig($xml,'frm'); echo '
'.print_r($cfg,true).'
'; - exit;*/ + exit; /* * Convert to config diff --git a/mcp_root/Component/Field/Module/Form/Form.php b/mcp_root/Component/Field/Module/Form/Form.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Field/Module/List/List.php b/mcp_root/Component/Field/Module/List/List.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Field/Template/Form/Form.php b/mcp_root/Component/Field/Template/Form/Form.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Field/Template/List/List.php b/mcp_root/Component/Field/Template/List/List.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Field/Template/List/Redirect.php b/mcp_root/Component/Field/Template/List/Redirect.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Menu/Theme/Menu.php b/mcp_root/Component/Menu/Theme/Menu.php deleted file mode 100644 index 3e558ca..0000000 --- a/mcp_root/Component/Menu/Theme/Menu.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/mcp_root/Component/Navigation/DAO/DAONavigation.php b/mcp_root/Component/Navigation/DAO/DAONavigation.php deleted file mode 100755 index 578575f..0000000 --- a/mcp_root/Component/Navigation/DAO/DAONavigation.php +++ /dev/null @@ -1,1079 +0,0 @@ -_objMCP->query($strSQL); - - if($strLimit === null) { - return $arrRows; - } else { - return array( - $arrRows - ,array_pop(array_pop($this->_objMCP->query('SELECT FOUND_ROWS()'))) - ); - } - } - - /* - * Fetch menu by id - * - * @param int navigation id - * @return arr navigation data - */ - public function fetchNavById($intId) { - - /*$strSQL = sprintf( - 'SELECT %s FROM MCP_NAVIGATION WHERE navigation_id = %s' - ,$strSelect - ,$this->_objMCP->escapeString($intId) - );*/ - - $strSQL = 'SELECT * FROM MCP_NAVIGATION WHERE navigation_id = :navigation_id'; - - return array_pop($this->_objMCP->query( - $strSQL - ,array( - ':navigation_id'=>(int) $intId - ) - )); - } - - /* - * Fetch navigation link by id - * - * @param int links id - * @param str columns to select - */ - public function fetchLinkById($intId,$strSelect='*') { - - /*$strSQL = sprintf( - 'SELECT %s FROM MCP_NAVIGATION_LINKS WHERE navigation_links_id = %s' - ,$strSelect - ,$this->_objMCP->escapeString($intId) - );*/ - - $strSQL = 'SELECT * FROM MCP_NAVIGATION_LINKS WHERE navigation_links_id = :navigation_links_id'; - - return array_pop($this->_objMCP->query( - $strSQL - ,array( - ':navigation_links_id'=>(int) $intId - ) - )); - } - - /* - * Get navigation link by route - * - * @param str module name - * @param int sites id - * @return array route data - */ - public function fetchRoute($strSitesInternalUrl,$intSitesId) { - - /*$strSQL = sprintf( - "SELECT * FROM MCP_NAVIGATION_LINKS WHERE sites_internal_url = '%s' AND sites_id = %s AND deleted = 0" - ,$this->_objMCP->escapeString($strSitesInternalUrl) - ,$this->_objMCP->escapeString($intSitesId) - );*/ - - $strSQL = 'SELECT * FROM MCP_NAVIGATION_LINKS WHERE sites_internal_url = :sites_internal_url AND sites_id = :sites_id AND deleted = 0'; - - return array_pop($this->_objMCP->query( - $strSQL - ,array( - ':sites_internal_url'=>(string) $strSitesInternalUrl - ,':sites_id'=>(int) $intSitesId - ) - )); - } - - /* - * Fetch menus by site and location - * - * @param str valid menu location [top,left,bottom,right] - * @param int sites id - null identifies master - * @return array navigation menu data - */ - public function fetchNavBySiteLocation($strLocation,$intSitesId=null) { - - $strSQL = sprintf( - "SELECT * FROM MCP_NAVIGATION WHERE menu_location = :menu_location AND sites_id %s :sites_id AND deleted = 0" - ,$intSitesId === null?'IS':'=' - ); - - return array_pop($this->_objMCP->query( - $strSQL - ,array( - ':sites_id'=>$intSitesId === null?null:intval($intSitesId) - ,':menu_location'=>$strLocation - ) - )); - } - - /* - * Build navigation menu - * - * @param int parent id - * @param str parent type [nav,link] - * @param bool recursive? - * @param bool accept cached version of COMPLETE menu? - * @return array menu - */ - public function fetchMenu($intParentId,$strParentType='nav',$boolR=true,$boolCache=true) { - - /* - * Cache option is active for a complete menu build - */ - if( strcmp('nav',$strParentType) === 0 && $boolR === true && $boolCache === true) { - $arrCachedNav = $this->_getCachedNav($intParentId); - if( $arrCachedNav !== null ) { - return $arrCachedNav; - } - } - - /* - * Locate all real navigation links - */ - /*$strSQL = sprintf( - "SELECT * FROM MCP_NAVIGATION_LINKS WHERE parent_type = '%s' AND parent_id = %s AND deleted = 0 ORDER BY sort_order ASC" - ,$this->_objMCP->escapeString($strParentType) - ,$this->_objMCP->escapeString($intParentId) - );*/ - - $strSQL = "SELECT - * - FROM - MCP_NAVIGATION_LINKS - WHERE - parent_type = :parent_type - AND - parent_id = :parent_id - AND - datasource_dao IS NULL - AND - datasource_query IS NULL - AND - datasources_row_id IS NULL - AND - deleted = 0 - ORDER - BY - sort_order ASC"; - - $arrNavigationLinks = $this->_objMCP->query( - $strSQL - ,array( - ':parent_type'=>(string) $strParentType - ,':parent_id'=>(int) $intParentId - ) - ); - - /* - * Data source capabilities are not worth the trouble right now. Will be revisited at a later date. - */ - if( 1 == 2 ) { - - $arrParentLink = strpos($strParentType,'link') === 0?$this->fetchLinkById($intParentId):null; - $arrDynamicLinks = array(); - $arrDataSources = array(); - $arrPlaceholders = array(); - - /* - * Locate all dynamic links for parent link - */ - if($arrParentLink !== null && $arrParentLink['datasources_row_id'] !== null) { - $arrDynamicLinks = $this->fetchDynamicLinkById($arrParentLink['datasources_id'],$arrParentLink['datasources_row_id']); - $arrDynamicLinks = $arrDynamicLinks?$arrDynamicLinks['navigation_links']:array(); - } - - /* - * Replace all real navigation links placeholders with real-time data - */ - foreach($arrNavigationLinks as &$arrLink) { - if($arrLink['datasources_row_id'] !== null) { - $arrLink = $this->fetchDynamicLinkById($arrLink['datasources_id'],$arrLink['datasources_row_id']); - $arrPlaceholders["{$arrLink['datasources_id']}-{$arrLink['datasources_row_id']}"] = $arrLink; - } - } - - /* - * Parse out datasource links - */ - foreach($arrNavigationLinks as $intIndex=>&$arrLink) { - if(isset($arrLink['datasource_dao']) || isset($arrLink['datasource_query'])) { - $arrDynamicLinks = array_merge($arrDynamicLinks,$this->fetchDynamicLinks($arrLink['navigation_links_id'])); - array_unshift($arrDataSources,$intIndex); - } - } - - /* - * Add dynamic links without hard link reference to end of navigation link array - */ - foreach($arrDynamicLinks as $arrDynamicLink) { - - $strId = "{$arrDynamicLink['datasources_id']}-{$arrDynamicLink['datasources_row_id']}"; - $boolDataSource = $arrParentLink && (isset($arrParentLink['datasource_dao']) || isset($arrParentLink['datasource_query']))?true:false; - - /* - * Support moving dynamic navigation links to new parent - */ - if(!isset($arrPlaceholders[$strId]) && - ($arrParentLink === null || ($boolDataSource === false && $arrDynamicLink['parent_id'] == $arrParentLink['navigation_links_id']) || ($boolDataSource === false && $arrDynamicLink['parent_id'] == $arrParentLink['parent_id'])) - ) { - $arrNavigationLinks[] = $arrDynamicLink; - } - } - - /* - * Remove all datasource links - */ - foreach($arrDataSources as $intIndex) { - array_splice($arrNavigationLinks,$intIndex,1); - } - - } - - // when not recursive return links without parsing children - if($boolR === false) return $arrNavigationLinks; - - if(!empty($arrNavigationLinks)) { - foreach($arrNavigationLinks as &$arrNavigationLink) { - $arrNavigationLink['navigation_links'] = !is_numeric($arrNavigationLink['navigation_links_id'])?$arrNavigationLink['navigation_links']:$this->fetchMenu($arrNavigationLink['navigation_links_id'],'link',true); - } - } - - return $arrNavigationLinks; - - } - - /* - * Fetch links ancestory - * - * @param int navigation links id - * @return array navigation links - */ - public function fetchAncestory($intLinksId) { - - $arrLinks = array(); - while($arrLink = $this->fetchLinkById($intLinksId)) { - - /*if($arrLink['datasources_row_id'] !== null) { - $arrLink = $this->fetchDynamicLinkById($arrLink['datasources_id'],$arrLink['datasources_row_id']); - }*/ - - array_unshift($arrLinks,$arrLink); - $intLinksId = strcmp($arrLink['parent_type'],'link') == 0?$arrLink['parent_id']:0; - - } - - return $arrLinks; - - } - - /* - * Get menu data that link belongs to, regardless of links depth - * - * @param int links id - * @return array menu data - */ - public function fetchNavByLinkId($intLinkId) { - - /* - * Get links ancestory - */ - $arrAncestory = $this->fetchAncestory($intLinkId); - - /* - * Get the top link - */ - $arrTopLink = array_shift($arrAncestory); - - /* - * Get menu for top link - */ - return $this->fetchNavById($arrTopLink['parent_id']); - - } - - /* - * Get list of all available navigation menu locations - * - * @return array navigation menu locations - */ - public function fetchNavLocations() { - $arrResult = $this->_objMCP->query('DESCRIBE MCP_NAVIGATION'); - $arrLocations = array(); - - foreach($arrResult as $arrColumn) { - if(strcmp('menu_location',$arrColumn['Field']) == 0) { - foreach(explode(',',str_replace("'",'',trim(trim($arrColumn['Type'],'enum('),')'))) as $strLocation) { - $arrLocations[] = array('value'=>$strLocation,'label'=>$strLocation); - } - } - } - - return $arrLocations; - } - - /* - * Get list of all available navigation links window targets - * - * @return array navigation links targets - */ - public function fetchLinksTargetWindows() { - - $targets = array(); - - $arrResult = $this->_objMCP->query('DESCRIBE MCP_NAVIGATION_LINKS'); - - foreach($arrResult as $arrColumn) { - if(strcmp('target_window',$arrColumn['Field']) == 0) { - foreach( explode(',',str_replace("'",'',trim(trim($arrColumn['Type'],'enum('),')'))) as $target ) { - $targets[] = array( - 'value'=>$target - ,'label'=>$target - ); - } - } - } - - return $targets; - } - - /* - * Fetch available content types for links - * - * @param str content link field - * @return array content types - */ - public function fetchLinksContentTypes($strField) { - - $types = array(); - - $arrResult = $this->_objMCP->query('DESCRIBE MCP_NAVIGATION_LINKS'); - - foreach($arrResult as $arrColumn) { - if(strcmp($strField,$arrColumn['Field']) == 0) { - foreach( explode(',',str_replace("'",'',trim(trim($arrColumn['Type'],'enum('),')'))) as $type) { - $types[] = array( - 'value'=>$type - ,'label'=>$type - ); - } - } - } - - return $types; - } - - /* - * Insert or update navigation menu - */ - public function saveNav($arrNav) { - return $this->_save( - $arrNav - ,'MCP_NAVIGATION' - ,'navigation_id' - ,array('menu_title','menu_location','system_name') - ,'created_on_timestamp' - ); - } - - /* - * Insert or update navigation link - */ - public function saveLink($arrLink) { - - $intId = $this->_save( - $arrLink - ,'MCP_NAVIGATION_LINKS' - ,'navigation_links_id' - ,array('parent_type','link_title','browser_title','page_heading','link_url','sites_internal_url','target_module','target_template','target_window','new_window_name','header_content','body_content','footer_content','header_content_type','body_content_type','footer_content_type','datasource_query','datasource_dao','datasource_dao_method') - ,'created_on_timestamp' - ,array('target_module_args','target_module_config','links_data','datasource_dao_args') - ,array('link_title') - ); - - // ---- Update the nvaigation menu cache ----------------------------------------- - - /* - * Get the links id - */ - $intLinkId = isset($arrLink['navigation_links_id'])?$arrLink['navigation_links_id']:$intId; - - /* - * Get the navigation menu associated with the link - */ - $arrNav = $this->fetchNavByLinkId($intLinkId); - - /* - * Set the cache value for the links associated navigation menu - */ - $this->_setCachedNav($arrNav['navigation_id']); - - } - - /* - * Moves link down one - * - * @param int navigation links id - * @return affected rows - */ - public function moveLinkDown($intLinksId) { - - /* - * Get links data - */ - $arrTarget = $this->fetchLinkById($intLinksId); - - /* - * Get all links - */ - $arrLinks = $this->fetchMenu($arrTarget['parent_id'],$arrTarget['parent_type'],false); - $arrIds = array(); - - /* - * collect all link ids - */ - $boolMove = false; - foreach($arrLinks as $intIndex=>$arrLink) { - - if($arrLink['navigation_links_id'] == $arrTarget['navigation_links_id'] && $intIndex != (count($arrLinks)-1)) { - $boolMove = true; - continue; - } - - $arrIds[] = $arrLink['navigation_links_id']; - - if($boolMove === true) { - $boolMove = false; - $arrIds[] = $arrTarget['navigation_links_id']; - } - } - - $arrUpdate = array(); - foreach($arrIds as $intSort=>$intId) { - $arrUpdate[] = sprintf('(%u,%u)',$intId,$intSort); - } - - $strSQL = sprintf( - 'INSERT IGNORE INTO MCP_NAVIGATION_LINKS (navigation_links_id,sort_order) VALUES %s ON DUPLICATE KEY UPDATE sort_order = VALUES(sort_order)' - ,implode(',',$arrUpdate) - ); - - $this->_objMCP->query($strSQL); - - /* - * Update the nav cache - */ - $arrNav = $this->fetchNavByLinkId($intLinksId); - $this->_setCachedNav($arrNav['navigation_id']); - - return 1; - - } - - /* - * Moves link up one - * - * @param int navigation links id - * @return affected rows - */ - public function moveLinkUp($mixLinksId) { - - /* - * Get links data - */ - $arrTarget = $this->fetchLinkById($mixLinksId); - - /* - * Get all links - */ - $arrLinks = $this->fetchMenu($arrTarget['parent_id'],$arrTarget['parent_type'],false); - $arrIds = array(); - - /* - * collect all link ids - */ - $boolSkip = false; - foreach($arrLinks as $intIndex=>$arrLink) { - - if($boolSkip === true) { - $boolSkip = false; - continue; - } - - if(isset($arrLinks[($intIndex+1)]) && $arrLinks[($intIndex+1)]['navigation_links_id'] == $arrTarget['navigation_links_id']) { - $boolSkip = true; - $arrIds[] = $arrTarget['navigation_links_id']; - } - - $arrIds[] = $arrLink['navigation_links_id']; - - } - - $arrUpdate = array(); - foreach($arrIds as $intSort=>$intId) { - $arrUpdate[] = sprintf('(%u,%u)',$intId,$intSort); - } - - $strSQL = sprintf( - 'INSERT IGNORE INTO MCP_NAVIGATION_LINKS (navigation_links_id,sort_order) VALUES %s ON DUPLICATE KEY UPDATE sort_order = VALUES(sort_order)' - ,implode(',',$arrUpdate) - ); - - $this->_objMCP->query($strSQL); - - /* - * Update the nav cache - */ - $arrNav = $this->fetchNavByLinkId($mixLinksId); - $this->_setCachedNav($arrNav['navigation_id']); - - return 1; - - } - - /* - * Delete a link - * - * @param int navigation links id - * @return int affected rows - */ - public function deleteLink($intLinksId) { - - /* - * Get all links - */ - $arrLinks = $this->fetchMenu($arrTarget['navigation_links_id'],'link'); - $objIds = new ArrayObject(array($arrTarget['navigation_links_id'])); - - /* - * recursive function to collect all child link ids - */ - $func = create_function('$value,$index,$ids','if(strcmp(\'navigation_links_id\',$index) == 0) $ids[] = $value;'); - - /* - * Collect all child ids - */ - array_walk_recursive($arrLinks,$func,$objIds); - - /* - * Collect ids into normal array to use implode - */ - $arrIds = array(); - foreach($objIds as $intId) { - $arrIds[] = $intId; - } - - /* - * Create SQL - */ - $strSQL = sprintf( - //'DELETE FROM MCP_NAVIGATION_LINKS WHERE navigation_links_id IN (%s)' - 'UPDATE - MCP_NAVIGATION_LINKS - SET - MCP_NAVIGATION_LINKS.deleted = NULL - WHERE - MCP_NAVIGATION_LINKS.navigation_links_id IN (%s)' - ,$this->_objMCP->escapeString(implode(',',$arrIds)) - ); - - /* - * Update the nav cache - */ - $arrNav = $this->fetchNavByLinkId($intLinksId); - $this->_setCachedNav($arrNav['navigation_id']); - - return $this->_objMCP->query($strSQL); - - } - - /* - * Remove navigation link - * - * @param int navigation links id - * @return int affected rows - */ - public function removeLink($intLinksId) { - - /* - * Get links data - */ - $arrTarget = $this->fetchLinkById($intLinksId); - - /* - * Get targets children - */ - $arrChildren = $this->fetchMenu($arrTarget['navigation_links_id'],'link',false); - - /* - * Get targets siblings - */ - $arrLinks = $this->fetchMenu($arrTarget['parent_id'],$arrTarget['parent_type'],false); - - /* - * reorder array - */ - $arrIds = array(); - - foreach($arrLinks as $arrLink) { - - /* - * Replace links position with children - */ - if($arrLink['navigation_links_id'] == $arrTarget['navigation_links_id']) { - foreach($arrChildren as $arrChild) { - $arrIds[] = $arrChild['navigation_links_id']; - } - continue; - } - - $arrIds[] = $arrLink['navigation_links_id']; - } - - /* - * Build update - */ - $arrUpdate = array(); - foreach($arrIds as $intIndex=>$intId) { - $arrUpdate[] = sprintf( - "(%s,%s,'%s',%s)" - ,$this->_objMCP->escapeString($intId) - ,$this->_objMCP->escapeString($arrTarget['parent_id']) - ,$this->_objMCP->escapeString($arrTarget['parent_type']) - ,$this->_objMCP->escapeString($intIndex) - ); - } - - /* - * Build update query - */ - $strSQL = sprintf( - 'INSERT IGNORE INTO MCP_NAVIGATION_LINKS (navigation_links_id,parent_id,parent_type,sort_order) VALUES %s ON DUPLICATE KEY UPDATE parent_id=VALUES(parent_id),parent_type=VALUES(parent_type),sort_order=VALUES(sort_order)' - ,implode(',',$arrUpdate) - ); - - /* - * Create delete query (soft-delete) - */ - $strSQLDelete = sprintf( - //'DELETE FROM MCP_NAVIGATION_LINKS WHERE navigation_links_id = %s' - 'UPDATE - MCP_NAVIGATION_LINKS - SET - MCP_NAVIGATION_LINKS.deleted = NULL - WHERE - MCP_NAVIGATION_LINKS.navigation_links_id = %s' - ,$this->_objMCP->escapeString($arrTarget['navigation_links_id']) - ); - - /* - * Delete link and update children - */ - $this->_objMCP->query($strSQLDelete); - $this->_objMCP->query($strSQL); - - /* - * Update the nav cache - */ - $arrNav = $this->fetchNavByLinkId($intLinksId); - $this->_setCachedNav($arrNav['navigation_id']); - - return 1; - - - } - - /* - * Delete navigation menu(s) - * - * @param mix single integer value or array of integers ( MCP_NAVIGATION primary key ) - */ - public function deleteNavs($mixNavigationId) { - - $strSQL = sprintf( - 'UPDATE - MCP_NAVIGATION - SET - MCP_NAVIGATION.deleted = NULL - WHERE - MCP_NAVIGATION.navigation_id IN (%s)' - - ,is_array($mixNavigationId) ? $this->_objMCP->escapeString(implode(',',$mixNavigationId)) : $this->_objMCP->escapeString($mixNavigationId) - ); - - echo "

$strSQL

"; - - } - - /* - * Get cached navigation menu - * - * @param int navigation id - * @return array complete navigation menu - */ - private function _getCachedNav($intId) { - return $this->_objMCP->getCacheDataValue("nav_{$intId}",$this->getPkg()); - } - - /* - * Update the navigation menu cache with a new value - * - * @param int navigation id - * @param array navigation menu - * @return bool - */ - private function _setCachedNav($intId) { - - /* - * Bypass caching and build complete menu from current state - */ - $arrMenu = $this->fetchMenu($intId,'nav',true,false); - - /* - * Cache the menu - */ - return $this->_objMCP->setCacheDataValue("nav_{$intId}",$arrMenu,$this->getPkg()); - } - - - - - - - /* - * ----------------------------------------------------------------------------------------------------------- - * Everything below this line is part of the "dynamic link" feature. The dynamic link feature - * should not be used. It is not deprecated byut buggy and not really worth looking into right now. It - * just raises more questions than what it is worth. So for now I am removing it entirely. - */ - - - - /* - * Get datasources dynamic link data - * - * @param int navigation links id - * @return array dynamic link data - */ - public function fetchDynamicLinks($intNavigationLinksId) { - - /* - * Get navigation link datasource info - */ - $arrLink = $this->fetchLinkById($intNavigationLinksId); - - /* - * Get all dynamic hard links - */ - /*$arrRows = $this->_objMCP->query(sprintf( - 'SELECT * FROM MCP_NAVIGATION_LINKS WHERE datasources_id = %s' - ,$this->_objMCP->escapeString($arrLink['navigation_links_id']) - ));*/ - - $arrRows = $this->_objMCP->query( - 'SELECT * FROM MCP_NAVIGATION_LINKS WHERE datasources_id = :datasources_id' - ,array( - ':datasources_id'=>(int) $arrLink['navigation_links_id'] - ) - ); - - $arrData = array(); - foreach($arrRows as $arrRow) { - $arrData["{$arrRow['datasources_id']}-{$arrRow['datasources_row_id']}"] = $arrRow; - } - - if(!empty($arrLink['datasource_query'])) { - - /* - * Run raw SQL query for data - */ - $arrDynamicLinks = $this->_objMCP->query(str_replace(array('SITES_ID'),array($this->_objMCP->escapeString($this->_objMCP->getSitesId())),$arrLink['datasource_query'])); - - } else { - - /* - * Replace argument magical constants such as; SITES_ID and transform empty string to null - */ - $args = $arrLink['datasource_dao_args'] === null?array():unserialize(base64_decode($arrLink['datasource_dao_args'])); - array_walk( - $args - ,create_function('&$item,$key,$mcp','if($item == \'\') { $item=null; return; } $item = str_replace(array(\'SITES_ID\'),array($mcp->escapeString($mcp->getSitesId())),$item);') - ,$this->_objMCP - ); - - /* - * Get DAO instance and call binding - */ - $arrDynamicLinks = call_user_func_array( - array( - $this->_objMCP->getInstance($arrLink['datasource_dao'],array($this->_objMCP)) - ,$arrLink['datasource_dao_method'] - ) - ,$args - ); - - } - - /* - * Convert links - */ - return empty($arrDynamicLinks)?array():$this->_convertDataSourceOutputToLinks($arrDynamicLinks,$arrLink,$arrData,($arrLink['parent_type'] == 'link'?$this->fetchLinkById($arrLink['parent_id']):null),$arrLink); - } - - /* - * Get dynamic link by id [datasource,datasource row id] - * - * @param int datasources id - * @param int datasources row id - * @return array dynamic link data - */ - public function fetchDynamicLinkById($intDataSourcesId,$intDataSourcesRowId) { - - /* - * Fetch all dynamic links for data source - */ - $arrData = $this->fetchDynamicLinks($intDataSourcesId); - - /* - * Locate link - */ - $arrFound = $this->_locateDynamicLink($arrData,$intDataSourcesRowId); - return $arrFound; - - } - - /* - * Create hard link to represent dynamic link - * - * @param int datasources id - * @param int datasources row id - */ - public function createHardLinkFromDynamic($intDatasourcesId,$intDatasourcesRowId) { - - /* - * Get dynamic link info - */ - $arrDataSource = $this->fetchDynamicLinkById($intDatasourcesId,$intDatasourcesRowId);//$this->fetchLinkById($intDatasourcesId); - - /* - * Copy datasources information - */ - $arrSave = $arrDataSource; - - /* - * Set datasources id and row id for dynamic link - */ - //$arrSave['datasources_id'] = $arrDataSource['navigation_links_id']; - //$arrSave['datasources_row_id'] = $intDatasourcesRowId; - $arrSave['link_title'] = ''; - - //echo '
',var_dump($arrDataSource),'
'; - //exit; - - /* - * This info will be resolved dynamically for null values at menu request time - */ - unset( - $arrSave['navigation_links_id'] - ,$arrSave['browser_heading'] - ,$arrSave['page_heading'] - ,$arrSave['link_url'] - ,$arrSave['sites_internal_url'] - ,$arrSave['target_module'] - ,$arrSave['target_module_template'] - ,$arrSave['target_module_args'] - ,$arrSave['target_module_config'] - ,$arrSave['header_content'] - ,$arrSave['body_content'] - ,$arrSave['footer_content'] - ,$arrSave['header_content_type'] - ,$arrSave['body_content_type'] - ,$arrSave['footer_content_type'] - ,$arrSave['target_window'] - ,$arrSave['new_window_name'] - ,$arrSave['links_data'] - ,$arrSave['datasource_query'] - ,$arrSave['datasource_dao'] - ,$arrSave['datasource_dao_method'] - ,$arrSave['datasource_dao_args'] - ,$arrSave['updated_on_timestamp'] - ,$arrSave['created_on_timestamp'] - ,$arrSave['navigation_links'] - ,$arrSave['dynamic_vars'] - ); - - /* - * Create new link - */ - try { - return $this->saveLink($arrSave); - } catch(MCPDBException $e) { - echo "

{$e->getMessage()}

"; - exit; - } - - } - - /* - * Converts data source data to dynamic links recursive - * - * @param array data - * @param array datasource link - * @param array datasource parent - * @param array - * @return array links - */ - private function _convertDataSourceOutputToLinks($arrData,$arrLink,$arrDataSourcesData,$arrParentLink=null,$arrTrueParent,$i=0) { - - $arrReturn = array(); - - foreach($arrData as $arrDynamicLink) { - - $link = array( - - 'navigation_links_id'=>"{$arrLink['navigation_links_id']}-{$arrDynamicLink['id']}" - - ,'link_title'=>$arrDynamicLink['label'] - ,'datasources_row_id'=>$arrDynamicLink['id'] - - ,'sites_id'=>$arrLink['sites_id'] - ,'creators_id'=>$arrLink['creators_id'] - ,'parent_type'=>$arrLink['parent_type'] - ,'parent_id'=>$i==0?$arrLink['parent_id']:$arrTrueParent['navigation_links_id'] - ,'parent_type'=>$i==0?$arrLink['parent_type']:$arrTrueParent['parent_type'] - ,'datasources_id'=>$arrLink['navigation_links_id'] - - ,'sites_internal_url'=>$arrParentLink !== null?$arrParentLink['sites_internal_url']:$arrLink['sites_internal_url'] - ,'link_url'=>$arrParentLink !== null?$arrParentLink['link_url']:$arrLink['link_url'] - ,'page_heading'=>$arrParentLink !== null?$arrParentLink['page_heading']:$arrLink['page_heading'] - ,'target_window'=>$arrParentLink !== null?$arrParentLink['target_window']:$arrLink['target_window'] - ,'browser_title'=>$arrParentLink !== null?$arrParentLink['browser_title']:$arrLink['browser_title'] - ,'target_module'=>$arrParentLink !== null?$arrParentLink['target_module']:$arrLink['target_module'] - ,'target_template'=>$arrParentLink !== null?$arrParentLink['target_template']:$arrLink['target_template'] - ,'target_module_args'=>$arrParentLink !== null?$arrParentLink['target_module_args']:$arrLink['target_module_args'] - ,'target_module_config'=>$arrParentLink !== null?$arrParentLink['target_module_config']:$arrLink['target_module_config'] - - ,'header_content_type'=>$arrLink['header_content_type'] - ,'footer_content_type'=>$arrLink['footer_content_type'] - ,'body_content_type'=>$arrLink['body_content_type'] - ,'header_content'=>$arrLink['header_content'] - ,'footer_content'=>$arrLink['footer_content'] - ,'body_content'=>$arrLink['body_content'] - - ,'datasource_query'=>null - ,'datasource_dao'=>null - ,'datasource_dao_method'=>null - ,'datasource_dao_args'=>null - - ,'sort_order'=>0 - ,'dynamic_vars'=>isset($arrDynamicLink['vars'])?explode(',',$arrDynamicLink['vars']):array($arrDynamicLink['id']) - ); - - /* - * Override default link data with hard link data - */ - if(isset($arrDataSourcesData["{$arrLink['navigation_links_id']}-{$arrDynamicLink['id']}"])) { - - $arrHardLink = $arrDataSourcesData["{$arrLink['navigation_links_id']}-{$arrDynamicLink['id']}"]; - - foreach($link as $strField=>&$mixValue) { - switch($strField) { - case 'navigation_links_id': - $mixValue = $arrHardLink[$strField]; - break; - - case 'parent_id': - $mixValue = $arrHardLink[$strField]; - break; - - case 'parent_type': - $mixValue = $arrHardLink[$strField]; - break; - - case 'sort_order': - $mixValue = $arrHardLink[$strField]; - break; - - default: - } - } - } - - $link['navigation_links'] = isset($arrDynamicLink['children'])?$this->_convertDataSourceOutputToLinks($arrDynamicLink['children'],$arrLink,$arrDataSourcesData,$arrParentLink,$link,($i+1)):array(); - $arrReturn[] = $link; - - } - - return $arrReturn; - - } - - /* - * Locate link - */ - private function _locateDynamicLink($arrData,$intDataSourcesRowId) { - - $arrFound = null; - - foreach($arrData as $arrDynamicLink) { - if($arrDynamicLink['datasources_row_id'] == $intDataSourcesRowId) { - $arrFound = $arrDynamicLink; - break; - } - } - - if($arrFound !== null) return $arrFound; - - foreach($arrData as $arrDynamicLink) { - $arrFound = $this->_locateDynamicLink($arrDynamicLink['navigation_links'],$intDataSourcesRowId); - if($arrFound !== null) return $arrFound; - } - - return $arrFound; - - } - - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Module/Form/Link/Link.php b/mcp_root/Component/Navigation/Module/Form/Link/Link.php deleted file mode 100755 index 7a2652f..0000000 --- a/mcp_root/Component/Navigation/Module/Form/Link/Link.php +++ /dev/null @@ -1,629 +0,0 @@ -_init(); - } - - private function _init() { - - // Get navigation DAO - $this->_objDAONavigation = $this->_objMCP->getInstance('Component.Navigation.DAO.DAONavigation',array($this->_objMCP)); - - // Get validator - $this->_objValidator = $this->_objMCP->getInstance('App.Lib.Validation.Validator',array()); - - // Reset form errors and values - $this->_arrFrmValues = array(); - $this->_arrFrmErrors = array(); - - // Get form POST data - $this->_arrFrmPost = $this->_objMCP->getPost($this->_getFrmName()); - - } - - /* - * Begin form processing - */ - private function _handleForm() { - - /* - * Set form values - */ - $this->_setFrmValues(); - - /* - * Validatate form values - */ - if($this->_arrFrmPost !== null) { - $this->_arrFrmErrors = $this->_objValidator->validate($this->_getFrmConfig(),$this->_arrFrmValues); - } - - /* - * Save form data to database - */ - if($this->_arrFrmPost !== null && empty($this->_arrFrmErrors)) { - $this->_frmSave(); - } - - } - - /* - * Set form ravlues as new link, editing or submitted link - */ - private function _setFrmValues() { - - if($this->_arrFrmPost !== null) { - $this->_setFrmSaved(); - } else if($this->_getLink() !== null) { - $this->_setFrmEdit(); - } else { - $this->_setFrmCreate(); - } - - } - - /* - * Set form values as submitted - */ - private function _setFrmSaved() { - - /* - * Set form values - */ - foreach($this->_getFrmFields() as $strField) { - $this->_arrFrmValues[$strField] = isset($this->_arrFrmPost[$strField])?$this->_arrFrmPost[$strField]:''; - } - - /* - * Set DAO datasource arguments - */ - // $this->_arrFrmValues['datasource_dao_args'] = isset($this->_arrFrmPost['datasource_dao_args'])?$this->_arrFrmPost['datasource_dao_args']:null; - - /* - * Set modules config values -------------------------------------------------------------------------- - */ - $arrModuleConfig = !empty($this->_arrFrmValues['target_module'])?$this->_objMCP->getModConfig($this->_arrFrmValues['target_module']):null; - - /* - * transfer config values to form values - */ - if($arrModuleConfig !== null) { - foreach(array_keys($arrModuleConfig) as $strField) { - // $this->_arrFrmValues['module_config'][$strField] = !isset($this->_arrFrmPost['module_config'],$this->_arrFrmPost['module_config'][$strField])?isset($arrModuleConfig[$strField]['default'])?$arrModuleConfig[$strField]['default']:'':$this->_arrFrmPost['module_config'][$strField]; - $this->_arrFrmValues["module_config_$strField"] = !isset($this->_arrFrmPost["module_config_$strField"])?isset($arrModuleConfig[$strField]['default'])?$arrModuleConfig[$strField]['default']:'':$this->_arrFrmPost["module_config_$strField"]; - } - } - - /* - * Add module args - */ - /*$arrModArgs = isset($this->_arrFrmPost['target_module_args'])?$this->_arrFrmPost['target_module_args']:array(''); - - foreach($arrModArgs as $strArg) { - $this->_arrFrmValues['target_module_args'][] = $strArg; - if(strlen($strArg) == 0) break; - }*/ - - } - - /* - * Set form values from current link - */ - private function _setFrmEdit() { - - /* - * Get current link data - */ - $arrLink = $this->_getLink(); - - /* - * Set form values - */ - foreach($this->_getFrmFields() as $strField) { - switch($strField) { - - case 'target_module_args': - $arrModuleArgs = $arrLink['target_module_args'] === null?array(''):unserialize(base64_decode($arrLink['target_module_args'])); - - foreach($arrModuleArgs as $strArg) { - $this->_arrFrmValues['target_module_args'][] = $strArg; - if(strlen($strArg) === 0) break; - } - - break; - - case 'parent_id': - $this->_arrFrmValues[$strField] = "{$arrLink['parent_type']}-{$arrLink['parent_id']}"; - break; - - default: - $this->_arrFrmValues[$strField] = $arrLink[$strField]; - } - } - - /* - * Set modules config values -------------------------------------------------------------------------- - */ - $arrModuleConfig = !empty($this->_arrFrmValues['target_module'])?$this->_objMCP->getModConfig($this->_arrFrmValues['target_module']):null; - - /* - * Unserialize links module configuration - * Unserialize links dao module arguments - */ - $arrLinkConfig = $arrLink['target_module_config']?unserialize(base64_decode($arrLink['target_module_config'])):array(); - // $arrDAOArgs = $arrLink['datasource_dao_args']?unserialize(base64_decode($arrLink['datasource_dao_args'])):array('','','','',''); - - /* - * transfer config values to form values - */ - if($arrModuleConfig !== null) { - foreach(array_keys($arrModuleConfig) as $strField) { - //$this->_arrFrmValues['module_config'][$strField] = !isset($arrLinkConfig[$strField])?isset($arrModuleConfig[$strField]['default'])?$arrModuleConfig[$strField]['default']:'':$arrLinkConfig[$strField]; - $this->_arrFrmValues["module_config_$strField"] = !isset($arrLinkConfig[$strField])?isset($arrModuleConfig[$strField]['default'])?$arrModuleConfig[$strField]['default']:'':$arrLinkConfig[$strField]; - } - } - - /* - * Transfer datasource dao arguments - */ - // $this->_arrFrmValues['datasource_dao_args'] = $arrDAOArgs; - - /* - * Add module arguments - */ - $arrModuleArgs = $arrLink['target_module_args'] === null?array(''):unserialize(base64_decode($arrLink['target_module_args'])); - - foreach($arrModuleArgs as $strArg) { - $this->_arrFrmValues['target_module_args'][] = $strArg; - if(strlen($strArg) == 0) break; - } - - } - - /* - * Set form values as create new link - */ - private function _setFrmCreate() { - - $arrConfig = $this->_getFrmConfig(); - - /* - * Set form values - */ - foreach($this->_getFrmFields() as $strField) { - switch($strField) { - - case 'parent_id': - $this->_arrFrmValues[$strField] = $this->_intParentId !== null?"{$this->_strParentType}-{$this->_intParentId}":''; - break; - - default: - $this->_arrFrmValues[$strField] = isset($arrConfig[$strField]['default'])?$arrConfig[$strField]['default']:''; - } - } - - /* - * Add inputs for five DAO arguments and three module arguments - */ - //$this->_arrFrmValues['datasource_dao_args'] = array('','','','',''); - // $this->_arrFrmValues['target_module_args'] = array(''); - - } - - /* - * Save form data to database - */ - private function _frmSave() { - - $arrSave = array(); - - /* - * Set empty values as null - */ - foreach($this->_arrFrmValues as $strField=>$strValue) { - /* - * Module config assigned directly and remaped to true db column - */ - if( strpos($strField,'module_config_') === 0 ) { - - $arrSave['target_module_config'][substr($strField,14)] = $strValue; - - /*} else if(strcmp('datasource_dao_args',$strField) == 0) { removed concept - $arrSave[$strField] = $strValue;*/ - - } else if(strcmp('target_module_args',$strField) == 0) { - - foreach($strValue as $strArg) { - if(strlen($strArg) == 0) break; - $arrSave[$strField][] = $strArg; - } - - if(!isset($arrSave[$strField])) $arrSave[$strField] = null; - - } else { - $arrSave[$strField] = strlen($strValue) == 0?null:$strValue; - } - } - - /* - * Get current link - */ - $arrLink = $this->_getLink(); - - /* - * Split parent id into parent id (left) and parent type (right) - */ - list($arrSave['parent_type'],$arrSave['parent_id']) = explode('-',$arrSave['parent_id'],2); - - /* - * Format data for dubalicate key update or insert - concept removed - */ - /*if($arrLink !== null && $this->_intDataSourcesRowId !== null) { - $arrSave['datasources_id'] = $arrLink['navigation_links_id']; - $arrSave['datasources_row_id'] = $this->_intDataSourcesRowId; - - // unset datasource identifier - unset($arrSave['datasource_query'],$arrSave['datasource_dao'],$arrSave['datasource_dao_method'],$arrSave['datasource_dao_args']); - } else*/ - if($arrLink !== null) { - $arrSave['navigation_links_id'] = $arrLink['navigation_links_id']; - } else { - $arrSave['creators_id'] = $this->_objMCP->getUsersId(); - $arrSave['sites_id'] = $this->_objMCP->getSitesId()?$this->_objMCP->getSitesId():null; - } - - // Add sort order for new link or link that changed parent - if($arrLink === null || strcmp("{$arrLink['parent_type']}-{$arrLink['parent_id']}","{$arrSave['parent_type']}-{$arrSave['parent_id']}") != 0) { - $arrSave['sort_order'] = count($this->_objDAONavigation->fetchMenu($arrSave['parent_id'],$arrSave['parent_type'])); - } - - /* - * Save link to database - */ - //echo '
',print_r($arrSave),'
'; - try { - - $this->_objDAONavigation->saveLink($arrSave); - - } catch( MCPDBException $e) { - - echo '
',print_r($arrSave),'
'; - - } - - /* - * fire navigation link update - */ - $this->_objMCP->fire($this,'NAVIGATION_LINK_UPDATE'); - - } - - /* - * Get form name - * - * @return str form name - */ - private function _getFrmName() { - return 'frmNavigationLink'; - } - - /* - * Get form configuration - * - * @return array form config - */ - private function _getFrmConfig() { - - if( $this->_arrCachedFrmConfig !== null ) { - return $this->_arrCachedFrmConfig; - } - - /* - * Get base form configuration from MCP - */ - $config = $this->_objMCP->getFrmConfig($this->getPkg()); - - /* - * Ad target module configuration - */ - $arrLink = $this->_getLink(); - if( $arrLink !== null && $arrLink['target_module'] ) { - - $mod = $this->_objMCP->getModConfig($arrLink['target_module']); - - if($mod) { - foreach($mod as $name=>$mix) { - $config["module_config_$name"] = $mix; - } - } - - } - - /* - * Build parent menu list - */ - - $this->_arrCachedFrmConfig = $config; - return $config; - - } - - /* - * Get form fields - * - * @return array form fields - */ - private function _getFrmFields() { - return array_keys($this->_getFrmConfig()); - } - - /* - * Get current navigation item link data - * - * @return array current navigation item link data - */ - private function _getLink() { - return $this->_arrLink; - } - - /* - * Set current navigation item link - * - * @param array navigation item link data - */ - private function _setLink($arrLink) { - $this->_arrLink = $arrLink; - } - - public function execute($arrArgs) { - - // link to edit - $intLinkId = !empty($arrArgs) && is_numeric($arrArgs[0])?array_shift($arrArgs):null; - - // dynamic link without placholder yet - /*if(!empty($arrArgs) && strpos($arrArgs[0],'-') !== false) { removed concept for now - $arrPieces = explode('-',array_shift($arrArgs)); - $intLinkId = $arrPieces[0]; - $this->_intDataSourcesRowId = $arrPieces[1]; - }*/ - - // parent of new link either nav or link - $this->_strParentType = !empty($arrArgs) && in_array($arrArgs[0],array('Link','Nav'))?strtolower(array_shift($arrArgs)):null; - - // parent id of new link - $this->_intParentId = $this->_strParentType !== null && !empty($arrArgs) && is_numeric($arrArgs[0])?array_shift($arrArgs):null; - - // set curret link or parent - if($intLinkId !== null) { - - // fetch current link data - $arrLink = $this->_objDAONavigation->fetchLinkById($intLinkId); - - /*if($arrLink['datasources_row_id'] !== null) { removed concept for now - $arrLink = $this->_objDAONavigation->fetchDynamicLinkById($arrLink['datasources_id'],$arrLink['datasources_row_id']); - }*/ - - // set the current link - if($arrLink !== null) { - $this->_setLink($arrLink); - } - - } - - /* - * Check permissions - * Can user add/ edit navigation link - based on menu? - * - Users may be resricted to editing or adding links belonging to specific menu - */ - $perm = $this->_objMCP->getPermission( ($intLinkId===null?MCP::ADD:MCP::EDIT) ,'NavigationLink', ($intLinkId===null?$this->_intParentId:$intLinkId) ); - if(!$perm['allow']) { - throw new MCPPermissionException($perm); - } - - /* - * Handle form data - */ - $this->_handleForm(); - - /*if($this->_arrFrmValues['target_module']) { - echo '
',print_r($this->_objMCP->getModConfig($this->_arrFrmValues['target_module'])),'
'; - }*/ - - /* - * Assign template data - */ - $this->_arrTemplateData['action'] = $this->getBasePath(); - $this->_arrTemplateData['method'] = 'POST'; - $this->_arrTemplateData['name'] = $this->_getFrmName(); - $this->_arrTemplateData['config'] = $this->_getFrmConfig(); - $this->_arrTemplateData['values'] = $this->_arrFrmValues; - $this->_arrTemplateData['errors'] = $this->_arrFrmErrors; - //$this->_arrTemplateData['layout'] = ROOT.'/Component/Navigation/Template/Form/Link/Layout.php'; - - return 'Link/LinkNew.php'; - } - - /* - * Override base path to append link reference for edit - * - * @return str base path - */ - public function getBasePath() { - - $strPath = parent::getBasePath(); - $arrLink = $this->_getLink(); - - if($arrLink !== null /*&& !($this->_objParentModule instanceof RouteRouter)*/) { - $strPath.= "/{$arrLink['navigation_links_id']}"; - - // add datasource row identifier - if($this->_intDataSourcesRowId !== null) { - $strPath.= "-{$this->_intDataSourcesRowId}"; - } - - } - - return $strPath; - } - - /* - * get all menus for site. - * - * @return array sites menus - */ - private function _getMenus() { - - $arrMenus = array(); - - // get all navs for site - $strWhere = sprintf('n.sites_id = %s',$this->_objMCP->escapeString($this->_objMCP->getSitesId())); - - // fetch all navs - $arrNavs = $this->_objDAONavigation->listAllNavs('n.*',$strWhere); - - // fetch link hierarchy for nav - foreach($arrNavs as $arrNav) { - $arrMenus[] = array( - 'nav'=>$arrNav - ,'children'=>$this->_objDAONavigation->fetchMenu($arrNav['navigation_id']) - ); - } - - return $arrMenus; - - } - - /* - * Due to recursive nature of menu this method - * is called from within the template to print - * the menu. - * - * @param str parent id [nav-2,link-2] used to check parent - * @return str parent fieldset - */ - public function printParentFieldset($strParentId) { - - $strOut = ''; - - // get all menus for site - $arrMenus = $this->_getMenus(); - - // for every menu print link hierarchy - $strOut.= ''; - - return $strOut; - - } - - /* - * Print menu hierarchy as undorderd list - * - * @param array navigation link - * @param str parent id [link-1,nav-3] used to select parent - * @param int runner specifying depth level - * @param bool used to disable current link and its children - * @return str HTML ordered list or printed children - */ - private function _printMenu($arrLinks,$strParentId,$intRunner=0,$boolDisable=false) { - - /* - * Get current link - */ - $arrCurrent = $this->_getLink(); - - $strReturn = ''; - return $strReturn; - - } - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Module/Form/Menu/Menu.php b/mcp_root/Component/Navigation/Module/Form/Menu/Menu.php deleted file mode 100755 index 2cc129c..0000000 --- a/mcp_root/Component/Navigation/Module/Form/Menu/Menu.php +++ /dev/null @@ -1,357 +0,0 @@ -_init(); - } - - private function _init() { - // Get Navigation DAO - $this->_objDAONavigation = $this->_objMCP->getInstance('Component.Navigation.DAO.DAONavigation',array($this->_objMCP)); - - // Get form validator - $this->_objValidator = $this->_objMCP->getInstance('App.Lib.Validation.Validator',array()); - - // reset form errors and values - $this->_arrFrmValues = array(); - $this->_arrFrmErrors = array(); - - // fetch form post data - $this->_arrFrmPost = $this->_objMCP->getPost($this->_getFrmName()); - - // Add custom validation routines to validator - $this->_addCustomValidationRules(); - } - - /* - * Add custom validation callbacks to validator - * - */ - private function _addCustomValidationRules() { - - $mcp = $this->_objMCP; - $dao = $this->_objDAONavigation; - $menu =& $this->_arrMenu; - - $this->_objValidator->addRule('navigation_system_name',function($value,$label) use (&$menu,$mcp,$dao) { - - /* - * Check system name conforms to standard convention - */ - if(!preg_match('/^[a-z0-9_]*?$/',$value)) { - return "$label may only contain numbers, underscores and lower alphabetic characters."; - } - - /* - * Build filter to see if navigation menu already exists - */ - $strFilter = sprintf( - "n.deleted = 0 AND n.sites_id = %s AND n.system_name = '%s' %s" - - ,$mcp->escapeString( $mcp->getSitesId() ) - ,$mcp->escapeString( $value ) - - // edit edge case - ,$menu !== null ? " AND n.system_name <> '{$mcp->escapeString($menu['system_name'])}'": '' - ); - - /* - * Check to see if another menu exists with given name within site - */ - if(array_pop($dao->listAllNavs('n.navigation_id',$strFilter)) !== null) { - return "$label $value already exists please use another name"; - } - - return ''; - }); - - } - - /* - * Handle form data - */ - private function _handleForm() { - - /* - * Set form values - */ - $this->_setFrmValues(); - - /* - * validate form values - */ - if($this->_arrFrmPost !== null) { - $this->_arrFrmErrors = $this->_objValidator->validate($this->_getFrmConfig(),$this->_arrFrmValues); - } - - /* - * Save menu data to database - */ - if($this->_arrFrmPost !== null && empty($this->_arrFrmErrors)) { - $this->_frmSave(); - } - - } - - /* - * Set form values - */ - private function _setFrmValues() { - if($this->_arrFrmPost !== null) { - $this->_setFrmSaved(); - } else if($this->_getMenu() !== null) { - $this->_setFrmEdit(); - } else { - $this->_setFrmCreate(); - } - } - - /* - * Set form values from submited post - */ - private function _setFrmSaved() { - - /* - * Set values from post array - */ - foreach($this->_getFrmFields() as $strField) { - switch($strField) { - - default: - $this->_arrFrmValues[$strField] = isset($this->_arrFrmPost[$strField])?$this->_arrFrmPost[$strField]:''; - } - } - - } - - /* - * Set form values from current menu - */ - private function _setFrmEdit() { - - /* - * Get current menu - */ - $arrMenu = $this->_getMenu(); - - /* - * Set values from current menu - */ - foreach($this->_getFrmFields() as $strField) { - $this->_arrFrmValues[$strField] = $arrMenu[$strField]; - } - - } - - /* - * Set new menu form defaults - */ - private function _setFrmCreate() { - - /* - * Set empty and/or default values for creating new menu - */ - foreach($this->_getFrmFields() as $strField) { - switch($strField) { - - case 'display_title': - $this->_arrFrmValues[$strField] = 1; - break; - - default: - $this->_arrFrmValues[$strField] = ''; - } - } - - } - - /* - * Save form menu data to database - */ - private function _frmSave() { - - /* - * Copy values array - */ - $arrValues = $this->_arrFrmValues; - - /* - * Get current menu - */ - $arrMenu = $this->_getMenu(); - - if($arrMenu !== null) { - $arrValues['navigation_id'] = $arrMenu['navigation_id']; - } else { - $arrValues['sites_id'] = $this->_objMCP->getSitesId(); - $arrValues['users_id'] = $this->_objMCP->getUsersId(); - } - - /* - * Save menu to database - */ - $this->_objDAONavigation->saveNav($arrValues); - - /* - * Fire update event using this as the target - */ - $this->_objMCP->fire($this,'NAVIGATION_MENU_UPDATE'); - - } - - /* - * Get form definition - * - * @return array form definition - */ - private function _getFrmConfig() { - /* - * Gte form configuration from MCP - */ - return $this->_objMCP->getFrmConfig($this->getPkg()); - } - - /* - * Get forms name - * - * @return str form name - */ - private function _getFrmName() { - return 'frmNavigationMenu'; - } - - /* - * Get form fields - * - * @return array fields - */ - private function _getFrmFields() { - return array_keys( $this->_getFrmConfig() ); - } - - /* - * Get current menu data - * - * @return array current menu data - */ - private function _getMenu() { - return $this->_arrMenu; - } - - /* - * Set current menu data - * - * @param array current menu - */ - private function _setMenu($arrMenu) { - $this->_arrMenu = $arrMenu; - } - - public function execute($arrArgs) { - - /* - * Extract menu to edits id if exists - */ - $intMenuId = !empty($arrArgs) && is_numeric($arrArgs[0])?array_shift($arrArgs):null; - - /* - * Attempt to fetch requested menu data and set for edit - */ - if($intMenuId !== null) { - /* - * Get menu data form database - */ - $arrMenu = $this->_objDAONavigation->fetchNavById($intMenuId); - - /* - * Set menu as menu to edit - */ - if($arrMenu !== null) { - $this->_setMenu($arrMenu); - } - - } - - /* - * Check permissions - * Can user add/ edit menu? - */ - $perm = $this->_objMCP->getPermission(($intMenuId===null?MCP::ADD:MCP::EDIT),'Navigation',$intMenuId); - if(!$perm['allow']) { - throw new MCPPermissionException($perm); - } - - /* - * Handle form data - */ - $this->_handleForm(); - - /* - * Assign template data - */ - $this->_arrTemplateData['action'] = $this->getBasePath(); - $this->_arrTemplateData['method'] = 'POST'; - $this->_arrTemplateData['name'] = $this->_getFrmName(); - $this->_arrTemplateData['config'] = $this->_getFrmConfig(); - $this->_arrTemplateData['values'] = $this->_arrFrmValues; - $this->_arrTemplateData['errors'] = $this->_arrFrmErrors; - $this->_arrTemplateData['legend'] = 'Navigation Menu'; - - return 'Menu/Menu.php'; - } - - /* - * Override base path to append navigation menu reference for edit - * - * @return str base path - */ - public function getBasePath() { - - $strPath = parent::getBasePath(); - $arrMenu = $this->_getMenu(); - - if($arrMenu !== null) { - $strPath.= "/{$arrMenu['navigation_id']}"; - } - - return $strPath; - } - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Module/List/Link/Link.php b/mcp_root/Component/Navigation/Module/List/Link/Link.php deleted file mode 100755 index a0a5621..0000000 --- a/mcp_root/Component/Navigation/Module/List/Link/Link.php +++ /dev/null @@ -1,313 +0,0 @@ -_init(); - } - - private function _init() { - // Get Navigation DAO - $this->_objDAONavigation = $this->_objMCP->getInstance('Component.Navigation.DAO.DAONavigation',array($this->_objMCP)); - - // set-up event handlers - $this->_objMCP->subscribe($this,'NAVIGATION_LINK_UP',array($this,'onUp')); - $this->_objMCP->subscribe($this,'NAVIGATION_LINK_DOWN',array($this,'onDown')); - $this->_objMCP->subscribe($this,'NAVIGATION_LINK_DELETE',array($this,'onDelete')); - $this->_objMCP->subscribe($this,'NAVIGATION_LINK_REMOVE',array($this,'onRemove')); - - } - - /* - * Move navigation link up - */ - public function onUp() { - $this->_objDAONavigation->moveLinkUp($this->_intActionsId); - } - - /* - * Move navigation link down - */ - public function onDown() { - $this->_objDAONavigation->moveLinkDown($this->_intActionsId); - } - - /* - * Delete navigation link - */ - public function onDelete() { - $this->_objDAONavigation->deleteLink($this->_intActionsId); - } - - /* - * Remove navigation link - */ - public function onRemove() { - $this->_objDAONavigation->removeLink($this->_intActionsId); - } - - /* - * Handle form submit - */ - private function _handleFrm() { - - /* - * Get posted form data - */ - $arrPost = $this->_objMCP->getPost($this->_getFrmName()); - - /* - * Route action - */ - if($arrPost && isset($arrPost['action']) && !empty($arrPost['action'])) { - - /* - * Get action - */ - $strAction = array_pop(array_keys($arrPost['action'])); - - /* - * Get links id - */ - $this->_intActionsId = array_pop(array_keys(array_pop($arrPost['action']))); - - /* - * Create hard link for dynamic link action - * - * - Remove dynamic link functionality for now - not worth the trouble at this time - */ - /*if(!is_numeric($this->_intActionsId) && strpos($this->_intActionsId,'-') !== false) { - $this->_intActionsId = call_user_func_array(array($this->_objDAONavigation,'createHardLinkFromDynamic'),explode('-',$this->_intActionsId)); - }*/ - - /* - * Fire event - */ - $this->_objMCP->fire($this,"NAVIGATION_LINK_".strtoupper($strAction)); - } - - } - - /* - * Get ancestory select menu - * - * @param array ancestory menu - */ - private function _getAncestory() { - - /* - * Get link ancestory - */ - $arrLinks = strcmp('nav',$this->_strParentType) == 0?array():$this->_objDAONavigation->fetchAncestory($this->_intParentId); - - /* - * Get menu - */ - $arrNav = $this->_objDAONavigation->fetchNavById(isset($arrLinks[0])?$arrLinks[0]['parent_id']:$this->_intParentId); - - /* - * Push menu onto beginning of array - */ - array_unshift($arrLinks,$arrNav); - - $arrAncestory = array('values'=>array(''),'output'=>array('--'),'selected'=>''); - - foreach($arrLinks as $intIndex=>$arrLink) { - $boolNav = $intIndex == 0?true:false; - - $arrAncestory['values'][] = $boolNav === true?"nav-{$arrLink['navigation_id']}":$arrLink['navigation_links_id']; - $arrAncestory['output'][] = $boolNav === true?'Root':$arrLink['link_title']; - } - - return $arrAncestory; - - } - - /* - * Get forms name - * - * @return str form name - */ - private function _getFrmName() { - return 'frmNavigationList'; - } - - public function execute($arrArgs) { - - /* - * Get parent id - */ - $this->_intParentId = !empty($arrArgs) && is_numeric($arrArgs[0])?array_shift($arrArgs):null; - - /* - * Get parent type. The parent type will either be nav or link - */ - $this->_strParentType = !empty($arrArgs) && strcmp($arrArgs[0],'Nav') == 0 && array_shift($arrArgs)?'nav':'link'; - - /* - * Editor - */ - $this->_boolEdit = !empty($arrArgs) && strcmp($arrArgs[0],'Edit-Link') == 0 && array_shift($arrArgs)?true:false; - - /* - * Handle form submit - */ - $this->_handleFrm(); - - /* - * inline edit and list switch - */ - if($this->_boolEdit === false) { - if($this->_intParentId !== null) { - $this->_arrTemplateData['links'] = $this->_objDAONavigation->fetchMenu($this->_intParentId,$this->_strParentType,false); - - // Get permissions for first level of links - $ids = array(); - $add = array(); - foreach($this->_arrTemplateData['links'] as &$link) { - $ids[] = $link['navigation_links_id']; - } - - if(!empty($ids)) { - $addPerms = $this->_objMCP->getPermission(MCP::ADD,'NavigationLink',$ids); - $editPerms = $this->_objMCP->getPermission(MCP::EDIT,'NavigationLink',$ids); - } - - foreach($this->_arrTemplateData['links'] as &$link) { - $link['allow_edit'] = $editPerms[$link['navigation_links_id']]['allow']; - - // @TODO: resolve this properly - $link['allow_add'] = true; //$addPerms[$link['navigation_links_id']]['allow']; - } - - } else { - $this->_arrTemplateData['links'] = array(); - } - } else { - $this->_arrTemplateData['EDIT_TPL'] = $this->_objMCP->executeComponent('Component.Navigation.Module.Form.Link',$arrArgs,null,array($this)); - } - - /* - * Load other template data - */ - $this->_arrTemplateData['legend'] = 'Menu'; - $this->_arrTemplateData['name'] = $this->_getFrmName(); - $this->_arrTemplateData['action'] = $this->getBasePath(); - $this->_arrTemplateData['method'] = 'POST'; - $this->_arrTemplateData['edit_path'] = parent::getBasePath(); - $this->_arrTemplateData['ancestory'] = $this->_getAncestory(); - $this->_arrTemplateData['BREADCRUMB_TPL'] = $this->_objMCP->executeComponent('Component.Util.Module.Breadcrumb',array(),null,array($this)); - - if($this->_boolEdit === true) { - return 'Link/Edit.php'; - } else { - return 'Link/Link.php'; - } - } - - /* - * Gte base path to current modules state - */ - public function getBasePath() { - $strBasePath = parent::getBasePath(); - - /* - * Add parent id passed through URL to maintain state - */ - if($this->_intParentId !== null) { - $strBasePath.= "/{$this->_intParentId}"; - } - - /* - * Add parent type if at top of nav tree - */ - if(strcmp(($this->_strParentType?$this->_strParentType:''),'nav') == 0) { - $strBasePath.= "/Nav"; - } - - /* - * Add editing flag - */ - if($this->_boolEdit === true) { - $strBasePath.= "/Edit-Link"; - } - - return $strBasePath; - } - - /* - * Override base breadcrumb method to provide breadcrumb data to breadcrumb utility - * - * @return array breadcrumb data - */ - public function getBreadcrumbData() { - - /* - * Get link ancestory - */ - $arrLinks = strcmp('nav',$this->_strParentType) == 0?array():$this->_objDAONavigation->fetchAncestory($this->_intParentId); - - /* - * Get menu - */ - $arrNav = $this->_objDAONavigation->fetchNavById(isset($arrLinks[0])?$arrLinks[0]['parent_id']:$this->_intParentId); - - /* - * Push menu onto beginning of array - */ - array_unshift($arrLinks,$arrNav); - - $arrBreadcrumbs = array(); - foreach($arrLinks as $intIndex=>$arrLink) { - - $boolNav = $intIndex == 0?true:false; - - $arrBreadcrumbs[] = array( - 'label'=>$boolNav === true?$arrLink['menu_title']:$arrLink['link_title'] - ,'href'=>parent::getBasePath().'/'.($boolNav === true?"{$arrLink['navigation_id']}/Nav":$arrLink['navigation_links_id']) - ); - } - - if($this->_objParentModule instanceof NavigationListMenu) { - array_unshift($arrBreadcrumbs,array( - 'label'=>'Menus' - ,'href'=>$this->_objParentModule->getBasePath(false) - )); - } - - return $arrBreadcrumbs; - - } - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Module/List/Menu/Menu.php b/mcp_root/Component/Navigation/Module/List/Menu/Menu.php deleted file mode 100755 index f7cb5b3..0000000 --- a/mcp_root/Component/Navigation/Module/List/Menu/Menu.php +++ /dev/null @@ -1,344 +0,0 @@ -_init(); - } - - private function _init() { - // Get navigation DAO - $this->_objDAONavigation = $this->_objMCP->getInstance('Component.Navigation.DAO.DAONavigation',array($this->_objMCP)); - - // set-up delete event handler - $id =& $this->_intActionsId; - $dao = $this->_objDAONavigation; - - $this->_objMCP->subscribe($this,'NAVIGATION_MENU_DELETE',function() use(&$id,$dao) { - // delete the menu - $dao->deleteNavs($id); - }); - - } - - /* - * Handle form submit - */ - private function _handleFrm() { - - /* - * Get posted form data - */ - $arrPost = $this->_objMCP->getPost('frmNavigationMenuList'); - - /* - * Route action - */ - if($arrPost && isset($arrPost['action']) && !empty($arrPost['action'])) { - - /* - * Get action - */ - $strAction = array_pop(array_keys($arrPost['action'])); - - /* - * Get node types id - */ - $this->_intActionsId = array_pop(array_keys(array_pop($arrPost['action']))); - - /* - * Fire event - */ - $this->_objMCP->fire($this,"NAVIGATION_MENU_".strtoupper($strAction)); - } - - } - - /* - * Get menu data - * - * @return array menu data - */ - private function _getMenus() { - - /* - * Don't do this when internal redirect is being used - */ - if($this->_strRedirect !== null) { - return array(); - } - - $arrRows = $this->_objDAONavigation->listAllNavs('n.*,u.username creator,s.site_name',"n.deleted = 0 AND n.sites_id = {$this->_objMCP->escapeString($this->_objMCP->getSitesId())}",null); - $arrMenus = array(); - - /* - * Collect menu ids - */ - $ids = array(); - foreach($arrRows as $arrMenu) { - $ids[] = $arrMenu['navigation_id']; - } - - /* - * Get menu edit and add link permissions - */ - if( !empty($arrRows) ) { - $perms = $this->_objMCP->getPermission(MCP::EDIT,'Navigation',$ids); - $addPerms = $this->_objMCP->getPermission(MCP::ADD,'NavigationLink',$ids); - $deletePerms = $this->_objMCP->getPermission(MCP::DELETE,'Navigation',$ids); - } - - /* - * Add edit permission flag - */ - foreach($arrRows as &$arrRow) { - $arrRow['allow_edit'] = $perms[$arrRow['navigation_id']]['allow']; - $arrRow['allow_add'] = $addPerms[$arrRow['navigation_id']]['allow']; - $arrRow['allow_delete'] = $deletePerms[$arrRow['navigation_id']]['allow']; - } - - /* - * Group each locations menus - */ - foreach($arrRows as $arrRow) { - $arrMenus[$arrRow['menu_location']]['site_name'] = ucwords($arrRow['menu_location']).' Menus'; - $arrMenus[$arrRow['menu_location']]['menus'][] = $arrRow; - } - - return $arrMenus; - - } - - /* - * Get table headers - * - * @return array table headers - */ - private function _getHeaders() { - - $mod = $this; - $mcp = $this->_objMCP; - - return array( - array( - 'label'=>'Title' - ,'column'=>'menu_title' - ,'mutation'=>function($value,$row) use ($mod,$mcp) { - - return $mcp->ui('Common.Field.Link',array( - 'url'=>"{$mod->getBasePath(false)}/Links/{$row['navigation_id']}/Nav" - ,'label'=>$value - )); - - } - ) - - ,array( - 'label'=>'Creator' - ,'column'=>'creator' - ,'mutation'=>null - ) - - ,array( - 'label'=>'Display Title' - ,'column'=>'display_title' - ,'mutation'=>function($value,$row) { - return $value == 1?'Y':'N'; - } - ) - - ,array( - 'label'=>'Position' - ,'column'=>'menu_location' - ,'mutation'=>function($value,$row) { - return sprintf( - '%s' - ,$value - ,ucwords($value) - ); - } - ) - - ,array( - 'label'=>'Created' - ,'column'=>'created_on_timestamp' - ,'mutation'=>function($value,$row) use ($mcp) { - return $mcp->ui('Common.Field.Date',array( - 'date'=>$value - ,'type'=>'timestamp' - )); - } - ) - - ,array( - 'label'=>'Last Modified' - ,'column'=>'updated_on_timestamp' - ,'mutation'=>function($value,$row) use($mcp) { - return $mcp->ui('Common.Field.Date',array( - 'date'=>$value - ,'type'=>'timestamp' - )); - } - ) - - ,array( - 'label'=>' ' - ,'column'=>'navigation_id' - ,'mutation'=>function($value,$row) use ($mod,$mcp) { - - if(!$row['allow_edit']) { - return 'Edit'; - } - - return $mcp->ui('Common.Field.Link',array( - 'url'=>"{$mod->getBasePath(false)}/Edit/{$value}" - ,'label'=>'Edit' - )); - - } - ) - - ,array( - 'label'=>' ' - ,'column'=>'navigation_id' - ,'mutation'=>function($value,$row) use ($mod,$mcp) { - - if(!$row['allow_add']) { - return '+'; - } - - return $mcp->ui('Common.Field.Link',array( - 'url'=>"{$mod->getBasePath(false)}/Links/{$value}/Nav/Edit-Link/Nav/{$value}/" - ,'label'=>'+' - )); - - } - ) - - ,array( - 'label'=>' ' - ,'column'=>'navigation_id' - ,'mutation'=>function($value,$row) use ($mcp) { - return $mcp->ui('Common.Form.Submit',array( - 'label'=>'Delete' - ,'name'=>"frmNavigationMenuList[action][delete][$value]" - ,'disabled'=>!$row['allow_delete'] - )); - } - ) - - ); - - } - - public function execute($arrArgs) { - - // Set internal redirect trigger when present - $this->_strRedirect = !empty($arrArgs) && in_array($arrArgs[0],array('Edit','Links','Create'))?array_shift($arrArgs):null; - - // Get path to go back when internal redirect is triggered - $this->_arrTemplateData['back_link'] = $this->getBasePath(false); - - // Get url path to create new menu - $this->_arrTemplateData['create_link'] = "{$this->getBasePath(false)}/Create"; - - // Get menu data - $this->_arrTemplateData['menus'] = $this->_getMenus(); - - // load menu table headers - $this->_arrTemplateData['headers'] = $this->_getHeaders(); - - // Internal redirect hndling - $strTpl = 'Menu'; - $this->_arrTemplateData['REDIRECT_TPL'] = ''; - - // Edit or create a menu - if(strcmp('Edit',$this->_strRedirect) === 0 || strcmp('Create',$this->_strRedirect) === 0) { - $this->_arrTemplateData['REDIRECT_TPL'] = $this->_objMCP->executeComponent( - 'Component.Navigation.Module.Form.Menu' - ,$arrArgs - ,null - ,array($this) - ); - - // change the template - $strTpl = 'Redirect'; - - // View menus links - } else if(strcmp('Links',$this->_strRedirect) === 0) { - - $this->_arrTemplateData['REDIRECT_TPL'] = $this->_objMCP->executeComponent( - 'Component.Navigation.Module.List.Link' - ,$arrArgs - ,null - ,array($this) - ); - - // change the template - $strTpl = 'Redirect'; - - } - - /* - * Handle form submit - */ - $this->_handleFrm(); - - /* - * Form action - */ - $this->_arrTemplateData['frm_action'] = $this->getBasePath(); - - /* - * Form name - */ - $this->_arrTemplateData['frm_name'] = 'frmNavigationMenuList'; - - /* - * Form method - */ - $this->_arrTemplateData['frm_method'] = 'POST'; - - return "Menu/$strTpl.php"; - - } - - /* - * Base path to modules capturable state - * - * @param bool redirect flag - * @return str base path to module state - */ - public function getBasePath($redirect=true) { - $strBasePath = parent::getBasePath(); - - // Append redirect flag - if($redirect === true && $this->_strRedirect !== null) { - $strBasePath.= "/{$this->_strRedirect}"; - } - - return $strBasePath; - } - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Module/Menu/Admin/Admin.php b/mcp_root/Component/Navigation/Module/Menu/Admin/Admin.php deleted file mode 100644 index 4f94546..0000000 --- a/mcp_root/Component/Navigation/Module/Menu/Admin/Admin.php +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Module/Menu/Menu.php b/mcp_root/Component/Navigation/Module/Menu/Menu.php deleted file mode 100755 index 33d87b8..0000000 --- a/mcp_root/Component/Navigation/Module/Menu/Menu.php +++ /dev/null @@ -1,88 +0,0 @@ -_init(); - } - - private function _init() { - // Fetch Navigation DAO - $this->_objDAONavigation = $this->_objMCP->getInstance('Component.Navigation.DAO.DAONavigation',array($this->_objMCP)); - } - - public function execute($arrArgs) { - - $intMenuId = !empty($arrArgs)?array_shift($arrArgs):null; - - /* - * Switch to fetch by id or location for current site - */ - if($intMenuId !== null) { - if(in_array($intMenuId,array('top','left','right','bottom'))) { - $this->_arrMenu = $this->_objDAONavigation->fetchNavBySiteLocation($intMenuId,$this->_objMCP->getSitesId()); - } else { - $this->_arrMenu = $this->_objDAONavigation->fetchNavById($intMenuId); - } - } - - if($this->_arrMenu !== null) { - $this->_arrTemplateData['menu'] = $this->_objDAONavigation->fetchMenu($this->_arrMenu['navigation_id'],'nav',true,true); - } else { - $this->_arrTemplateData['menu'] = array(); - } - - $this->_arrTemplateData['nav'] = $this->_arrMenu; - return 'Menu/Menu.php'; - } - - /* - * Paint menu recersive - */ - public function paintMenu($arrLinks,$intRunner=0) { - - if( $intRunner === 0 ) { - $strReturn = ''); - } else { - print('

No config available for target module

'); - } - ?> - - \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/Form/Menu/Menu.php b/mcp_root/Component/Navigation/Template/Form/Menu/Menu.php deleted file mode 100755 index e2ade7e..0000000 --- a/mcp_root/Component/Navigation/Template/Form/Menu/Menu.php +++ /dev/null @@ -1,9 +0,0 @@ -ui('Common.Form.Form',array( - 'name'=>$name - ,'action'=>$action - ,'config'=>$config - ,'values'=>$values - ,'errors'=>$errors - ,'legend'=>$legend - ,'idbase'=>'navigation-menu-' -)); ?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/List/Link/Edit.php b/mcp_root/Component/Navigation/Template/List/Link/Edit.php deleted file mode 100755 index 84cba9c..0000000 --- a/mcp_root/Component/Navigation/Template/List/Link/Edit.php +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/List/Link/Link.php b/mcp_root/Component/Navigation/Template/List/Link/Link.php deleted file mode 100755 index 4b8bc81..0000000 --- a/mcp_root/Component/Navigation/Template/List/Link/Link.php +++ /dev/null @@ -1,67 +0,0 @@ - -
" method=""> -
- Links - - - - - - - - - - - - - $link) { - printf( - ' - - - - - - - - - - - - - - - - - - - ' - ,$cycle =! $cycle?' class="odd"':'' - ,($index+1) - ,$edit_path - ,$this->out($link['link_title']) - ,$link['browser_title'] === null?'--':$this->out($link['browser_title']) - ,$link['page_heading'] === null?'--':$this->out($link['page_heading']) - ,$this->out($link['target_window']) - ,$name - ,$this->out($link['navigation_links_id']) - ,$action - ,$this->html_options($ancestory) - ,strcmp('nav',$link['parent_type']) == 0?' disabled="disabled"':'' - ); - } - } else { ?> - - - - - -
 TitleBrowserPageWindow 
%u%s%s%s%s - - '.($link['allow_edit']?'Edit':'%10$s%9$sEdit').''.($link['allow_add']?'+':'%10$s%9$s+').'
No Links Available
-
-
\ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/List/Menu/Menu.php b/mcp_root/Component/Navigation/Template/List/Menu/Menu.php deleted file mode 100644 index 8cb522a..0000000 --- a/mcp_root/Component/Navigation/Template/List/Menu/Menu.php +++ /dev/null @@ -1,26 +0,0 @@ -ui('Common.Field.Link',array( - 'url'=>$create_link - ,'label'=>'Create Menu' -)); - -/* -* Build out table of vocabs -*/ -foreach($menus as $site) { - - echo $this->ui('Common.Listing.Table',array( - 'data'=>$site['menus'] - ,'headers'=>$headers - ,'form'=>true - ,'form_legend'=>$site['site_name'] - ,'form_action'=>$frm_action - ,'form_method'=>$frm_method - ,'form_name'=>$frm_name - )); - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/List/Menu/Redirect.php b/mcp_root/Component/Navigation/Template/List/Menu/Redirect.php deleted file mode 100644 index 61ee84c..0000000 --- a/mcp_root/Component/Navigation/Template/List/Menu/Redirect.php +++ /dev/null @@ -1,14 +0,0 @@ -ui('Common.Field.Link',array( - 'url'=>$back_link - ,'label'=>'Back To Menus' -)); - -/* -* Use terms template -*/ -echo $REDIRECT_TPL; -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/Menu/Admin/Admin.php b/mcp_root/Component/Navigation/Template/Menu/Admin/Admin.php deleted file mode 100644 index 2cdf076..0000000 --- a/mcp_root/Component/Navigation/Template/Menu/Admin/Admin.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/Menu/Menu.php b/mcp_root/Component/Navigation/Template/Menu/Menu.php deleted file mode 100755 index 1b8a4bb..0000000 --- a/mcp_root/Component/Navigation/Template/Menu/Menu.php +++ /dev/null @@ -1,18 +0,0 @@ -Menu Failed

'; - return; -} - -//echo '
',print_r($menu),'
'; - -if($nav['display_title'] == 1) { - echo "

{$this->out($nav['menu_title'])}

"; -} - -if(!empty($menu)) { - echo $objModule->paintMenu($menu); -} else { - printf('

%s Menu Empty

',$this->out($nav['menu_title'])); -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/Router/PageNotFound.php b/mcp_root/Component/Navigation/Template/Router/PageNotFound.php deleted file mode 100755 index 942e61a..0000000 --- a/mcp_root/Component/Navigation/Template/Router/PageNotFound.php +++ /dev/null @@ -1 +0,0 @@ -

Page Not Found

\ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/Router/PermissionDenied.php b/mcp_root/Component/Navigation/Template/Router/PermissionDenied.php deleted file mode 100755 index ddb7f27..0000000 --- a/mcp_root/Component/Navigation/Template/Router/PermissionDenied.php +++ /dev/null @@ -1 +0,0 @@ -

\ No newline at end of file diff --git a/mcp_root/Component/Navigation/Template/Router/Redirect.php b/mcp_root/Component/Navigation/Template/Router/Redirect.php deleted file mode 100755 index 62f0d33..0000000 --- a/mcp_root/Component/Navigation/Template/Router/Redirect.php +++ /dev/null @@ -1,37 +0,0 @@ -%s' - ,$link_path - ,$edit_link?'Back To Link':'Edit Link'); - } - - /* - * Navigation link header - */ - if($nav_link['header_content'] && !$edit_link) { - $this->display_block($nav_link['header_content'],$nav_link['header_content_type']); - } -} - -/* -* Route content -*/ -if($content_type) { - $this->display_block($ROUTE_CONTENT,$content_type); -} else { - echo $ROUTE_CONTENT; -} - -/* -* Navigation link footer -*/ -if($nav_link !== null && $nav_link['footer_content'] && !$edit_link) { - $this->display_block($nav_link['footer_content'],$nav_link['footer_content_type']); -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Node/DAO/DAONode.php b/mcp_root/Component/Node/DAO/DAONode.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Module/Form/Comment/Comment.php b/mcp_root/Component/Node/Module/Form/Comment/Comment.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Module/Form/Entry/Entry.php b/mcp_root/Component/Node/Module/Form/Entry/Entry.php old mode 100755 new mode 100644 index 4284a1d..78f7844 --- a/mcp_root/Component/Node/Module/Form/Entry/Entry.php +++ b/mcp_root/Component/Node/Module/Form/Entry/Entry.php @@ -270,6 +270,8 @@ protected function _getFrmConfig() { if( $this->_arrCachedFrmConfig !== null ) { return $this->_arrCachedFrmConfig; } + + /* * get current node @@ -333,7 +335,7 @@ protected function _getFrmConfig() { */ $this->_arrCachedFrmConfig = $config; - // $this->_objMCP->debug($config); + $this->_objMCP->debug($config); // $this->debug($this->_arrCachedFrmConfig); exit; diff --git a/mcp_root/Component/Node/Module/Form/Type/Type.php b/mcp_root/Component/Node/Module/Form/Type/Type.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Module/List/Comment/Comment.php b/mcp_root/Component/Node/Module/List/Comment/Comment.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Module/List/Entry/Entry.php b/mcp_root/Component/Node/Module/List/Entry/Entry.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Module/List/Type/Type.php b/mcp_root/Component/Node/Module/List/Type/Type.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Module/View/Entry/Entry.php b/mcp_root/Component/Node/Module/View/Entry/Entry.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/Form/Comment/Comment.php b/mcp_root/Component/Node/Template/Form/Comment/Comment.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/Form/Entry/Entry.php b/mcp_root/Component/Node/Template/Form/Entry/Entry.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/Form/Type/Type.php b/mcp_root/Component/Node/Template/Form/Type/Type.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/List/Comment/Comment.php b/mcp_root/Component/Node/Template/List/Comment/Comment.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/List/Entry/Entry.php b/mcp_root/Component/Node/Template/List/Entry/Entry.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/List/Entry/Redirect.php b/mcp_root/Component/Node/Template/List/Entry/Redirect.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/List/Entry/View.php b/mcp_root/Component/Node/Template/List/Entry/View.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/List/Type/Redirect.php b/mcp_root/Component/Node/Template/List/Type/Redirect.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/List/Type/Type.php b/mcp_root/Component/Node/Template/List/Type/Type.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/View/Entry/Edit.php b/mcp_root/Component/Node/Template/View/Entry/Edit.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Node/Template/View/Entry/Entry.php b/mcp_root/Component/Node/Template/View/Entry/Entry.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Site/DAO/DAOSite.php b/mcp_root/Component/Site/DAO/DAOSite.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Site/Module/List/List.php b/mcp_root/Component/Site/Module/List/List.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Site/Template/List/List.php b/mcp_root/Component/Site/Template/List/List.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/DAO/DAOTaxonomy.php b/mcp_root/Component/Taxonomy/DAO/DAOTaxonomy.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Module/Form/Term/Term.php b/mcp_root/Component/Taxonomy/Module/Form/Term/Term.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Module/Form/Vocabulary/Vocabulary.php b/mcp_root/Component/Taxonomy/Module/Form/Vocabulary/Vocabulary.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Module/List/Vocabulary/Vocabulary.php b/mcp_root/Component/Taxonomy/Module/List/Vocabulary/Vocabulary.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Module/Tree/Term/Term.php b/mcp_root/Component/Taxonomy/Module/Tree/Term/Term.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Template/Form/Term/Term.php b/mcp_root/Component/Taxonomy/Template/Form/Term/Term.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Template/Form/Vocabulary/Vocabulary.php b/mcp_root/Component/Taxonomy/Template/Form/Vocabulary/Vocabulary.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Template/List/Vocabulary/Redirect.php b/mcp_root/Component/Taxonomy/Template/List/Vocabulary/Redirect.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Template/List/Vocabulary/Vocabulary.php b/mcp_root/Component/Taxonomy/Template/List/Vocabulary/Vocabulary.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Template/Tree/Term/Redirect.php b/mcp_root/Component/Taxonomy/Template/Tree/Term/Redirect.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Taxonomy/Template/Tree/Term/Term.php b/mcp_root/Component/Taxonomy/Template/Tree/Term/Term.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/DAO/DAOUser.php b/mcp_root/Component/User/DAO/DAOUser.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Module/List/List.php b/mcp_root/Component/User/Module/List/List.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Module/Login/Login.php b/mcp_root/Component/User/Module/Login/Login.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Module/Logout/Logout.php b/mcp_root/Component/User/Module/Logout/Logout.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Module/Registration/Form/Form.php b/mcp_root/Component/User/Module/Registration/Form/Form.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Template/List/List.php b/mcp_root/Component/User/Template/List/List.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Template/List/Redirect.php b/mcp_root/Component/User/Template/List/Redirect.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Template/Login/Login.php b/mcp_root/Component/User/Template/Login/Login.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Template/Logout/Logout.php b/mcp_root/Component/User/Template/Logout/Logout.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/User/Template/Registration/Form/Form.php b/mcp_root/Component/User/Template/Registration/Form/Form.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/DAO/DAOUtil.php b/mcp_root/Component/Util/DAO/DAOUtil.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Admin/Admin.php b/mcp_root/Component/Util/Module/Admin/Admin.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Breadcrumb/Breadcrumb.php b/mcp_root/Component/Util/Module/Breadcrumb/Breadcrumb.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Display/CSS/CSS.php b/mcp_root/Component/Util/Module/Display/CSS/CSS.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Display/JS/JS.php b/mcp_root/Component/Util/Module/Display/JS/JS.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Display/Meta/Meta.php b/mcp_root/Component/Util/Module/Display/Meta/Meta.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Footer/Footer.php b/mcp_root/Component/Util/Module/Footer/Footer.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Header/Header.php b/mcp_root/Component/Util/Module/Header/Header.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Index/Index.php b/mcp_root/Component/Util/Module/Index/Index.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Master/Email/Email.php b/mcp_root/Component/Util/Module/Master/Email/Email.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Master/Master.php b/mcp_root/Component/Util/Module/Master/Master.php old mode 100755 new mode 100644 index aefa15f..a4b1962 --- a/mcp_root/Component/Util/Module/Master/Master.php +++ b/mcp_root/Component/Util/Module/Master/Master.php @@ -35,6 +35,9 @@ public function execute($arrArgs) { case 'public.php': return $this->_executePublicRequest(); + + case 'install.php': + return $this->_executeInstallRequest(); default: return $this->_executeIndex(); @@ -676,6 +679,19 @@ public function _executePublicRequest() { return str_replace(ROOT,'',$this->getTemplatePath()).'/Public/Public.php'; } + + /** + * Install cms. + */ + protected function _executeInstallRequest() { + + //echo 'hi'; exit; + + //$this->_objMCP->assign('REQUEST_CONTENT',$this->_objMCP->executeComponent("Component.Util.Module.Install")); + + return '/Component/Util/Template/Master/Install/Install.php'; + + } } ?> \ No newline at end of file diff --git a/mcp_root/Component/Util/Module/Pagination/Alphabetize.php b/mcp_root/Component/Util/Module/Pagination/Alphabetize.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/Pagination/Pagination.php b/mcp_root/Component/Util/Module/Pagination/Pagination.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Module/SystemMessage/SystemMessage.php b/mcp_root/Component/Util/Module/SystemMessage/SystemMessage.php deleted file mode 100644 index f933f9f..0000000 --- a/mcp_root/Component/Util/Module/SystemMessage/SystemMessage.php +++ /dev/null @@ -1,20 +0,0 @@ -_arrTemplateData['messages'] = $this->_objMCP->getSystemMessages(); - - return 'SystemMessage/SystemMessage.php'; - } - -} -?> \ No newline at end of file diff --git a/mcp_root/Component/Util/Template/Admin/Admin.php b/mcp_root/Component/Util/Template/Admin/Admin.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Breadcrumb/Breadcrumb.php b/mcp_root/Component/Util/Template/Breadcrumb/Breadcrumb.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Display/CSS/CSS.php b/mcp_root/Component/Util/Template/Display/CSS/CSS.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Display/JS/JS.php b/mcp_root/Component/Util/Template/Display/JS/JS.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Display/Meta/Meta.php b/mcp_root/Component/Util/Template/Display/Meta/Meta.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Footer/Footer.php b/mcp_root/Component/Util/Template/Footer/Footer.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Header/Header.php b/mcp_root/Component/Util/Template/Header/Header.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Index/Index.php b/mcp_root/Component/Util/Template/Index/Index.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/Blank.php b/mcp_root/Component/Util/Template/Master/Blank.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/CSS/CSS.php b/mcp_root/Component/Util/Template/Master/CSS/CSS.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/DAO/DAO.php b/mcp_root/Component/Util/Template/Master/DAO/DAO.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/Email/HTML.php b/mcp_root/Component/Util/Template/Master/Email/HTML.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/Email/PlainText.php b/mcp_root/Component/Util/Template/Master/Email/PlainText.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/File/File.php b/mcp_root/Component/Util/Template/Master/File/File.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/Image/Image.php b/mcp_root/Component/Util/Template/Master/Image/Image.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/JS/JS.php b/mcp_root/Component/Util/Template/Master/JS/JS.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/Master.php b/mcp_root/Component/Util/Template/Master/Master.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Master/Public/Public.php b/mcp_root/Component/Util/Template/Master/Public/Public.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Pagination/Alphabetize.php b/mcp_root/Component/Util/Template/Pagination/Alphabetize.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/Pagination/Pagination.php b/mcp_root/Component/Util/Template/Pagination/Pagination.php old mode 100755 new mode 100644 diff --git a/mcp_root/Component/Util/Template/SystemMessage/SystemMessage.php b/mcp_root/Component/Util/Template/SystemMessage/SystemMessage.php deleted file mode 100644 index 970570e..0000000 --- a/mcp_root/Component/Util/Template/SystemMessage/SystemMessage.php +++ /dev/null @@ -1,20 +0,0 @@ - &$msgs) { - - if( empty($msgs) ) continue; - - echo ''; - -} - -?> \ No newline at end of file diff --git a/www/base-airsoft-app.xml b/www/base-airsoft-app.xml old mode 100755 new mode 100644 diff --git a/www/base.xml b/www/base.xml old mode 100755 new mode 100644 index 5841bac..420b4d0 --- a/www/base.xml +++ b/www/base.xml @@ -7,4 +7,5 @@ ../mcp_files . / + 1 \ No newline at end of file diff --git a/www/css.php b/www/css.php old mode 100755 new mode 100644 diff --git a/www/dao.php b/www/dao.php old mode 100755 new mode 100644 diff --git a/www/file.php b/www/file.php old mode 100755 new mode 100644 diff --git a/www/img.php b/www/img.php old mode 100755 new mode 100644 diff --git a/www/index.php b/www/index.php old mode 100755 new mode 100644 index 2ee7e6f..7e7349a --- a/www/index.php +++ b/www/index.php @@ -1,4 +1,6 @@ files); +// install flag +define('INSTALLED',(bool) ((string) $objBaseXML->installed)); + require_once(ROOT.DS.'App'.DS.'Lib'.DS.'Console'.DS.'Console.php'); require_once(ROOT.DS.'App'.DS.'Lib'.DS.'Import'.DS.'Import.php'); require_once(ROOT.DS.'App'.DS.'Lib'.DS.'Request'.DS.'Request.php'); diff --git a/www/js.php b/www/js.php old mode 100755 new mode 100644 diff --git a/www/mod.php b/www/mod.php old mode 100755 new mode 100644 diff --git a/www/public.php b/www/public.php old mode 100755 new mode 100644 diff --git a/www/theme/admin/default/js/form.js b/www/theme/admin/default/js/form.js index b5ec11e..503be7d 100644 --- a/www/theme/admin/default/js/form.js +++ b/www/theme/admin/default/js/form.js @@ -82,6 +82,8 @@ $(function() { var input = $('input[name*="[action][delete]"]',clone).get(0); input.name = input.name.replace(/\[[0-9]*\]/,'[' + count + ']'); input.id = input.id.replace(/-[0-9]*-/,'-' + (count + 1) + '-'); + + alert('add'); $('input:not([type="submit"]):not([type="hidden"]):not(option),select,textarea',clone).each(function() {