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("
'.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.= '
',print_r($menu),''; - -if($nav['display_title'] == 1) { - echo "
%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 @@