@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * Search option to use in admin page |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - var $search_option = array('title','content','title_content','user_name',); // /< Search options |
|
| 20 | + var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options |
|
| 21 | 21 | /** |
| 22 | 22 | * Status list |
| 23 | 23 | * @var array |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | $oModuleController = getController('module'); |
| 35 | 35 | |
| 36 | 36 | $oDB = &DB::getInstance(); |
| 37 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 38 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 39 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 40 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 41 | - $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 42 | - $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 43 | - $oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count")); |
|
| 44 | - $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true); |
|
| 45 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 37 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 38 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 39 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 40 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 41 | + $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 42 | + $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 43 | + $oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count")); |
|
| 44 | + $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true); |
|
| 45 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 46 | 46 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 47 | 47 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 48 | 48 | |
| 49 | 49 | // 2009. 01. 29 Added a trigger for additional setup |
| 50 | 50 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 51 | 51 | |
| 52 | - if(!is_dir('./files/cache/tmp')) |
|
| 52 | + if (!is_dir('./files/cache/tmp')) |
|
| 53 | 53 | { |
| 54 | 54 | FileHandler::makeDir('./files/cache/tmp'); |
| 55 | 55 | } |
@@ -67,71 +67,71 @@ discard block |
||
| 67 | 67 | $oModuleModel = getModel('module'); |
| 68 | 68 | $oModuleController = getController('module'); |
| 69 | 69 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 70 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 70 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 71 | 71 | { |
| 72 | 72 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 73 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
| 73 | + if (!$oDB->isColumnExists("documents", "notify_message")) return true; |
|
| 74 | 74 | |
| 75 | 75 | // 2007. 8. 23: create a clustered index in the document table |
| 76 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
| 77 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
| 78 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
| 79 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
| 76 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true; |
|
| 77 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true; |
|
| 78 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true; |
|
| 79 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true; |
|
| 80 | 80 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 81 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 81 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 82 | 82 | // 2007. 10. 25 add parent_srl, expand to the document category |
| 83 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
| 84 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
| 83 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true; |
|
| 84 | + if (!$oDB->isColumnExists("document_categories", "expand")) return true; |
|
| 85 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) return true; |
|
| 86 | 86 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 87 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
| 87 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true; |
|
| 88 | 88 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 89 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
| 89 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true; |
|
| 90 | 90 | |
| 91 | 91 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 92 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
| 92 | + if (!$oDB->isColumnExists("documents", "extra_vars")) return true; |
|
| 93 | 93 | // 2008. 04. 23 Add a column(blamed_count) |
| 94 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 95 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
| 96 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 94 | + if (!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 95 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true; |
|
| 96 | + if (!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 97 | 97 | // 2008-12-15 Add a column(color) |
| 98 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 98 | + if (!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 102 | 102 | */ |
| 103 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
| 103 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true; |
|
| 104 | 104 | |
| 105 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 105 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 106 | 106 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 107 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
| 107 | + if (!$oDB->isColumnExists("documents", "lang_code")) return true; |
|
| 108 | 108 | // 2009. 03. 11 check the index in the document_extra_vars table |
| 109 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 109 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 110 | 110 | |
| 111 | 111 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
| 112 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
| 113 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
| 112 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true; |
|
| 113 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true; |
|
| 114 | 114 | |
| 115 | 115 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 116 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 116 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 117 | 117 | |
| 118 | 118 | //2011. 04. 07 adding description column to document categories |
| 119 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
| 119 | + if (!$oDB->isColumnExists("document_categories", "description")) return true; |
|
| 120 | 120 | |
| 121 | 121 | //2011. 05. 23 adding status column to document |
| 122 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 122 | + if (!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 123 | 123 | |
| 124 | 124 | //2011. 06. 07 check comment status update |
| 125 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 125 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 126 | 126 | |
| 127 | 127 | // 2011. 10. 25 status index check |
| 128 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 128 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 129 | 129 | |
| 130 | 130 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 131 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 131 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 132 | 132 | |
| 133 | 133 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 134 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 134 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 135 | 135 | |
| 136 | 136 | $oModuleController->insertUpdatedLog($version_update_id); |
| 137 | 137 | } |
@@ -149,101 +149,101 @@ discard block |
||
| 149 | 149 | $oModuleModel = getModel('module'); |
| 150 | 150 | $oModuleController = getController('module'); |
| 151 | 151 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 152 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 152 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 153 | 153 | { |
| 154 | 154 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 155 | - if(!$oDB->isColumnExists("documents","notify_message")) |
|
| 155 | + if (!$oDB->isColumnExists("documents", "notify_message")) |
|
| 156 | 156 | { |
| 157 | - $oDB->addColumn('documents',"notify_message","char",1); |
|
| 157 | + $oDB->addColumn('documents', "notify_message", "char", 1); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // 2007. 8. 23: create a clustered index in the document table |
| 161 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) |
|
| 161 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) |
|
| 162 | 162 | { |
| 163 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 163 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) |
|
| 166 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) |
|
| 167 | 167 | { |
| 168 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 168 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) |
|
| 171 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) |
|
| 172 | 172 | { |
| 173 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 173 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) |
|
| 176 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) |
|
| 177 | 177 | { |
| 178 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 178 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 179 | 179 | } |
| 180 | 180 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 181 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 181 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 182 | 182 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 183 | 183 | // 2007. 10. 25 add columns(parent_srl, expand) |
| 184 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 185 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 186 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 184 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0); |
|
| 185 | + if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N"); |
|
| 186 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text"); |
|
| 187 | 187 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 188 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 188 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 189 | 189 | |
| 190 | 190 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 191 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
| 191 | + if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text'); |
|
| 192 | 192 | |
| 193 | 193 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 194 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 194 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 195 | 195 | // 2008. 04. 23 Add a column(blamed count) |
| 196 | - if(!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 196 | + if (!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 197 | 197 | { |
| 198 | 198 | $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); |
| 199 | 199 | $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) |
|
| 202 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) |
|
| 203 | 203 | { |
| 204 | 204 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 207 | + if (!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 208 | 208 | $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
| 211 | + if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7); |
|
| 212 | 212 | |
| 213 | 213 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 214 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 214 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10); |
|
| 215 | 215 | |
| 216 | 216 | // 2009. 01. 29 Added a trigger for additional setup |
| 217 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 217 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 218 | 218 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 219 | 219 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 220 | - if(!$oDB->isColumnExists("documents","lang_code")) |
|
| 220 | + if (!$oDB->isColumnExists("documents", "lang_code")) |
|
| 221 | 221 | { |
| 222 | 222 | $db_info = Context::getDBInfo(); |
| 223 | - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); |
|
| 223 | + $oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code); |
|
| 224 | 224 | $obj->lang_code = $db_info->lang_type; |
| 225 | 225 | executeQuery('document.updateDocumentsLangCode', $obj); |
| 226 | 226 | } |
| 227 | 227 | // 2009. 03. 11 Check the index in the document_extra_vars table |
| 228 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 228 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 229 | 229 | { |
| 230 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 230 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 233 | + if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 234 | 234 | { |
| 235 | 235 | $oDB->dropIndex("document_extra_vars", "unique_module_vars", true); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // 2009. 03. 19: Add a column(eid) |
| 239 | 239 | // 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column |
| 240 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) |
|
| 240 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) |
|
| 241 | 241 | { |
| 242 | - $oDB->addColumn("document_extra_keys","eid","varchar",40); |
|
| 242 | + $oDB->addColumn("document_extra_keys", "eid", "varchar", 40); |
|
| 243 | 243 | |
| 244 | 244 | $output = executeQuery('document.getGroupsExtraKeys', $obj); |
| 245 | - if($output->toBool() && $output->data && count($output->data)) { |
|
| 246 | - foreach($output->data as $extra_keys) { |
|
| 245 | + if ($output->toBool() && $output->data && count($output->data)) { |
|
| 246 | + foreach ($output->data as $extra_keys) { |
|
| 247 | 247 | $args->module_srl = $extra_keys->module_srl; |
| 248 | 248 | $args->var_idx = $extra_keys->idx; |
| 249 | 249 | $args->new_eid = "extra_vars".$extra_keys->idx; |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) |
|
| 255 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) |
|
| 256 | 256 | { |
| 257 | - $oDB->addColumn("document_extra_vars","eid","varchar",40); |
|
| 257 | + $oDB->addColumn("document_extra_vars", "eid", "varchar", 40); |
|
| 258 | 258 | $obj->var_idx = '-1,-2'; |
| 259 | 259 | $output = executeQuery('document.getGroupsExtraVars', $obj); |
| 260 | - if($output->toBool() && $output->data && count($output->data)) |
|
| 260 | + if ($output->toBool() && $output->data && count($output->data)) |
|
| 261 | 261 | { |
| 262 | - foreach($output->data as $extra_vars) |
|
| 262 | + foreach ($output->data as $extra_vars) |
|
| 263 | 263 | { |
| 264 | 264 | $args->module_srl = $extra_vars->module_srl; |
| 265 | 265 | $args->var_idx = $extra_vars->idx; |
@@ -270,16 +270,16 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 273 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 273 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 274 | 274 | { |
| 275 | - $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false); |
|
| 275 | + $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | //2011. 04. 07 adding description column to document categories |
| 279 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 279 | + if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0); |
|
| 280 | 280 | |
| 281 | 281 | //2011. 05. 23 adding status column to document |
| 282 | - if(!$oDB->isColumnExists('documents', 'status')) |
|
| 282 | + if (!$oDB->isColumnExists('documents', 'status')) |
|
| 283 | 283 | { |
| 284 | 284 | $oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC'); |
| 285 | 285 | $args->is_secret = 'Y'; |
@@ -287,11 +287,11 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // 2011. 09. 08 drop column document is_secret |
| 290 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 290 | + if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 291 | 291 | $oDB->dropColumn('documents', 'is_secret'); |
| 292 | 292 | |
| 293 | 293 | //2011. 06. 07 merge column, allow_comment and lock_comment |
| 294 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 294 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 295 | 295 | { |
| 296 | 296 | $oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW'); |
| 297 | 297 | |
@@ -313,23 +313,23 @@ discard block |
||
| 313 | 313 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 316 | + if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 317 | 317 | $oDB->dropColumn('documents', 'allow_comment'); |
| 318 | 318 | |
| 319 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 319 | + if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 320 | 320 | $oDB->dropColumn('documents', 'lock_comment'); |
| 321 | 321 | |
| 322 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 323 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 322 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 323 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl", "status")); |
|
| 324 | 324 | |
| 325 | 325 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 326 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 326 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 327 | 327 | { |
| 328 | 328 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'); |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 332 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 332 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 333 | 333 | { |
| 334 | 334 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'); |
| 335 | 335 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $oModuleController->insertUpdatedLog($version_update_id); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - return new Object(0,'success_updated'); |
|
| 340 | + return new Object(0, 'success_updated'); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | function recompileCache() |
| 348 | 348 | { |
| 349 | - if(!is_dir('./files/cache/tmp')) |
|
| 349 | + if (!is_dir('./files/cache/tmp')) |
|
| 350 | 350 | { |
| 351 | 351 | FileHandler::makeDir('./files/cache/tmp'); |
| 352 | 352 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | function getConfigStatus($key) |
| 378 | 378 | { |
| 379 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 379 | + if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 380 | 380 | else $this->getDefaultStatus(); |
| 381 | 381 | } |
| 382 | 382 | } |
@@ -70,68 +70,126 @@ discard block |
||
| 70 | 70 | if($oModuleModel->needUpdate($version_update_id)) |
| 71 | 71 | { |
| 72 | 72 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 73 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
| 73 | + if(!$oDB->isColumnExists("documents","notify_message")) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | // 2007. 8. 23: create a clustered index in the document table |
| 76 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
| 77 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
| 78 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
| 79 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
| 78 | + if(!$oDB->isIndexExists("documents","idx_module_list_order")) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 81 | + if(!$oDB->isIndexExists("documents","idx_module_update_order")) { |
|
| 82 | + return true; |
|
| 83 | + } |
|
| 84 | + if(!$oDB->isIndexExists("documents","idx_module_readed_count")) { |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | + if(!$oDB->isIndexExists("documents","idx_module_voted_count")) { |
|
| 88 | + return true; |
|
| 89 | + } |
|
| 80 | 90 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 81 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 91 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
| 92 | + return true; |
|
| 93 | + } |
|
| 82 | 94 | // 2007. 10. 25 add parent_srl, expand to the document category |
| 83 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
| 84 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
| 95 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 98 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
| 99 | + return true; |
|
| 100 | + } |
|
| 101 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
| 102 | + return true; |
|
| 103 | + } |
|
| 86 | 104 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 87 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
| 105 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
| 106 | + return true; |
|
| 107 | + } |
|
| 88 | 108 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 89 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
| 109 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
| 110 | + return true; |
|
| 111 | + } |
|
| 90 | 112 | |
| 91 | 113 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 92 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
| 114 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
| 115 | + return true; |
|
| 116 | + } |
|
| 93 | 117 | // 2008. 04. 23 Add a column(blamed_count) |
| 94 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 95 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
| 96 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 118 | + if(!$oDB->isColumnExists("documents", "blamed_count")) { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 121 | + if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) { |
|
| 122 | + return true; |
|
| 123 | + } |
|
| 124 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
| 125 | + return true; |
|
| 126 | + } |
|
| 97 | 127 | // 2008-12-15 Add a column(color) |
| 98 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 128 | + if(!$oDB->isColumnExists("document_categories", "color")) { |
|
| 129 | + return true; |
|
| 130 | + } |
|
| 99 | 131 | |
| 100 | 132 | /** |
| 101 | 133 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 102 | 134 | */ |
| 103 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
| 135 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
| 136 | + return true; |
|
| 137 | + } |
|
| 104 | 138 | |
| 105 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 139 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
| 140 | + return true; |
|
| 141 | + } |
|
| 106 | 142 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 107 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
| 143 | + if(!$oDB->isColumnExists("documents","lang_code")) { |
|
| 144 | + return true; |
|
| 145 | + } |
|
| 108 | 146 | // 2009. 03. 11 check the index in the document_extra_vars table |
| 109 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 147 | + if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) { |
|
| 148 | + return true; |
|
| 149 | + } |
|
| 110 | 150 | |
| 111 | 151 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
| 112 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
| 113 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
| 152 | + if(!$oDB->isColumnExists("document_extra_keys","eid")) { |
|
| 153 | + return true; |
|
| 154 | + } |
|
| 155 | + if(!$oDB->isColumnExists("document_extra_vars","eid")) { |
|
| 156 | + return true; |
|
| 157 | + } |
|
| 114 | 158 | |
| 115 | 159 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 116 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 160 | + if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) { |
|
| 161 | + return true; |
|
| 162 | + } |
|
| 117 | 163 | |
| 118 | 164 | //2011. 04. 07 adding description column to document categories |
| 119 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
| 165 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
| 166 | + return true; |
|
| 167 | + } |
|
| 120 | 168 | |
| 121 | 169 | //2011. 05. 23 adding status column to document |
| 122 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 170 | + if(!$oDB->isColumnExists('documents', 'status')) { |
|
| 171 | + return true; |
|
| 172 | + } |
|
| 123 | 173 | |
| 124 | 174 | //2011. 06. 07 check comment status update |
| 125 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 175 | + if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) { |
|
| 176 | + return true; |
|
| 177 | + } |
|
| 126 | 178 | |
| 127 | 179 | // 2011. 10. 25 status index check |
| 128 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 180 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
| 181 | + return true; |
|
| 182 | + } |
|
| 129 | 183 | |
| 130 | 184 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 131 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 185 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) { |
|
| 186 | + return true; |
|
| 187 | + } |
|
| 132 | 188 | |
| 133 | 189 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 134 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 190 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) { |
|
| 191 | + return true; |
|
| 192 | + } |
|
| 135 | 193 | |
| 136 | 194 | $oModuleController->insertUpdatedLog($version_update_id); |
| 137 | 195 | } |
@@ -178,20 +236,33 @@ discard block |
||
| 178 | 236 | $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
| 179 | 237 | } |
| 180 | 238 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 181 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 182 | - $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
| 239 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
| 240 | + $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
| 241 | + } |
|
| 183 | 242 | // 2007. 10. 25 add columns(parent_srl, expand) |
| 184 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 185 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 186 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 243 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
| 244 | + $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 245 | + } |
|
| 246 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
| 247 | + $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 248 | + } |
|
| 249 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
| 250 | + $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 251 | + } |
|
| 187 | 252 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 188 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 253 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
| 254 | + $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 255 | + } |
|
| 189 | 256 | |
| 190 | 257 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 191 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
| 258 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
| 259 | + $oDB->addColumn('documents','extra_vars','text'); |
|
| 260 | + } |
|
| 192 | 261 | |
| 193 | 262 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 194 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 263 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
| 264 | + $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 265 | + } |
|
| 195 | 266 | // 2008. 04. 23 Add a column(blamed count) |
| 196 | 267 | if(!$oDB->isColumnExists("documents", "blamed_count")) |
| 197 | 268 | { |
@@ -204,18 +275,24 @@ discard block |
||
| 204 | 275 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
| 205 | 276 | } |
| 206 | 277 | |
| 207 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 208 | - $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
| 278 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
| 279 | + $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
| 280 | + } |
|
| 209 | 281 | |
| 210 | 282 | |
| 211 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
| 283 | + if(!$oDB->isColumnExists("document_categories","color")) { |
|
| 284 | + $oDB->addColumn('document_categories',"color","char",7); |
|
| 285 | + } |
|
| 212 | 286 | |
| 213 | 287 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 214 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 288 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
| 289 | + $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 290 | + } |
|
| 215 | 291 | |
| 216 | 292 | // 2009. 01. 29 Added a trigger for additional setup |
| 217 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 218 | - $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
| 293 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
| 294 | + $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
| 295 | + } |
|
| 219 | 296 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 220 | 297 | if(!$oDB->isColumnExists("documents","lang_code")) |
| 221 | 298 | { |
@@ -276,7 +353,9 @@ discard block |
||
| 276 | 353 | } |
| 277 | 354 | |
| 278 | 355 | //2011. 04. 07 adding description column to document categories |
| 279 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 356 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
| 357 | + $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 358 | + } |
|
| 280 | 359 | |
| 281 | 360 | //2011. 05. 23 adding status column to document |
| 282 | 361 | if(!$oDB->isColumnExists('documents', 'status')) |
@@ -287,8 +366,9 @@ discard block |
||
| 287 | 366 | } |
| 288 | 367 | |
| 289 | 368 | // 2011. 09. 08 drop column document is_secret |
| 290 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 291 | - $oDB->dropColumn('documents', 'is_secret'); |
|
| 369 | + if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) { |
|
| 370 | + $oDB->dropColumn('documents', 'is_secret'); |
|
| 371 | + } |
|
| 292 | 372 | |
| 293 | 373 | //2011. 06. 07 merge column, allow_comment and lock_comment |
| 294 | 374 | if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
@@ -313,14 +393,17 @@ discard block |
||
| 313 | 393 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
| 314 | 394 | } |
| 315 | 395 | |
| 316 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 317 | - $oDB->dropColumn('documents', 'allow_comment'); |
|
| 396 | + if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
| 397 | + $oDB->dropColumn('documents', 'allow_comment'); |
|
| 398 | + } |
|
| 318 | 399 | |
| 319 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 320 | - $oDB->dropColumn('documents', 'lock_comment'); |
|
| 400 | + if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
| 401 | + $oDB->dropColumn('documents', 'lock_comment'); |
|
| 402 | + } |
|
| 321 | 403 | |
| 322 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 323 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 404 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
| 405 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 406 | + } |
|
| 324 | 407 | |
| 325 | 408 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 326 | 409 | if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
@@ -376,8 +459,11 @@ discard block |
||
| 376 | 459 | */ |
| 377 | 460 | function getConfigStatus($key) |
| 378 | 461 | { |
| 379 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 380 | - else $this->getDefaultStatus(); |
|
| 462 | + if(array_key_exists(strtolower($key), $this->statusList)) { |
|
| 463 | + return $this->statusList[$key]; |
|
| 464 | + } else { |
|
| 465 | + $this->getDefaultStatus(); |
|
| 466 | + } |
|
| 381 | 467 | } |
| 382 | 468 | } |
| 383 | 469 | /* End of file document.class.php */ |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class board extends ModuleObject |
| 11 | 11 | { |
| 12 | - var $search_option = array('title_content','title','content','comment','user_name','nick_name','user_id','tag'); ///< 검색 옵션 |
|
| 12 | + var $search_option = array('title_content', 'title', 'content', 'comment', 'user_name', 'nick_name', 'user_id', 'tag'); ///< 검색 옵션 |
|
| 13 | 13 | |
| 14 | 14 | var $order_target = array('list_order', 'update_order', 'regdate', 'voted_count', 'blamed_count', 'readed_count', 'comment_count', 'title', 'nick_name', 'user_name', 'user_id'); // 정렬 옵션 |
| 15 | 15 | |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function board() |
| 27 | 27 | { |
| 28 | - if(!Context::isInstalled()) return; |
|
| 28 | + if (!Context::isInstalled()) return; |
|
| 29 | 29 | |
| 30 | - if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
|
| 30 | + if (!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
|
| 31 | 31 | { |
| 32 | 32 | $ssl_actions = array('dispBoardWrite', 'dispBoardWriteComment', 'dispBoardReplyComment', 'dispBoardModifyComment', 'dispBoardDelete', 'dispBoardDeleteComment', 'procBoardInsertDocument', 'procBoardDeleteDocument', 'procBoardInsertComment', 'procBoardDeleteComment', 'procBoardVerificationPassword'); |
| 33 | 33 | Context::addSSLActions($ssl_actions); |
| 34 | 34 | } |
| 35 | - if(!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional') |
|
| 35 | + if (!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional') |
|
| 36 | 36 | { |
| 37 | 37 | Context::addSSLAction('dispTempSavedList'); |
| 38 | 38 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $args = new stdClass; |
| 55 | 55 | $args->site_srl = 0; |
| 56 | 56 | $output = executeQuery('module.getSite', $args); |
| 57 | - if(!$output->data->index_module_srl) |
|
| 57 | + if (!$output->data->index_module_srl) |
|
| 58 | 58 | { |
| 59 | 59 | $args->mid = 'board'; |
| 60 | 60 | $args->module = 'board'; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $args->site_srl = 0; |
| 64 | 64 | $output = $oModuleController->insertModule($args); |
| 65 | 65 | |
| 66 | - if($output->toBool()) |
|
| 66 | + if ($output->toBool()) |
|
| 67 | 67 | { |
| 68 | 68 | $module_srl = $output->get('module_srl'); |
| 69 | 69 | |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | $oModuleController = getController('module'); |
| 89 | 89 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 90 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 90 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 91 | 91 | { |
| 92 | 92 | // 2007. 10. 17 get the member menu trigger |
| 93 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
| 93 | + if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
| 94 | 94 | |
| 95 | 95 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
| 96 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
| 96 | + if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
| 97 | 97 | |
| 98 | 98 | $oModuleController->insertUpdatedLog($version_update_id); |
| 99 | 99 | } |
@@ -109,16 +109,16 @@ discard block |
||
| 109 | 109 | $oModuleModel = getModel('module'); |
| 110 | 110 | $oModuleController = getController('module'); |
| 111 | 111 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 112 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 112 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 113 | 113 | { |
| 114 | 114 | // 2007. 10. 17 check the member menu trigger, if it is not existed then insert |
| 115 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) |
|
| 115 | + if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) |
|
| 116 | 116 | { |
| 117 | 117 | $oModuleController->insertTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
| 121 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) |
|
| 121 | + if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) |
|
| 122 | 122 | { |
| 123 | 123 | $oModuleController->insertTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after'); |
| 124 | 124 | } |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | function moduleUninstall() |
| 132 | 132 | { |
| 133 | 133 | $output = executeQueryArray("board.getAllBoard"); |
| 134 | - if(!$output->data) return new Object(); |
|
| 134 | + if (!$output->data) return new Object(); |
|
| 135 | 135 | @set_time_limit(0); |
| 136 | 136 | |
| 137 | 137 | $oModuleController = getController('module'); |
| 138 | 138 | |
| 139 | - foreach($output->data as $board) |
|
| 139 | + foreach ($output->data as $board) |
|
| 140 | 140 | { |
| 141 | 141 | $oModuleController->deleteModule($board->module_srl); |
| 142 | 142 | } |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function board() |
| 27 | 27 | { |
| 28 | - if(!Context::isInstalled()) return; |
|
| 28 | + if(!Context::isInstalled()) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
| 31 | 33 | { |
@@ -90,10 +92,14 @@ discard block |
||
| 90 | 92 | if($oModuleModel->needUpdate($version_update_id)) |
| 91 | 93 | { |
| 92 | 94 | // 2007. 10. 17 get the member menu trigger |
| 93 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
| 95 | + if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 94 | 98 | |
| 95 | 99 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
| 96 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
| 100 | + if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) { |
|
| 101 | + return true; |
|
| 102 | + } |
|
| 97 | 103 | |
| 98 | 104 | $oModuleController->insertUpdatedLog($version_update_id); |
| 99 | 105 | } |
@@ -131,7 +137,9 @@ discard block |
||
| 131 | 137 | function moduleUninstall() |
| 132 | 138 | { |
| 133 | 139 | $output = executeQueryArray("board.getAllBoard"); |
| 134 | - if(!$output->data) return new Object(); |
|
| 140 | + if(!$output->data) { |
|
| 141 | + return new Object(); |
|
| 142 | + } |
|
| 135 | 143 | @set_time_limit(0); |
| 136 | 144 | |
| 137 | 145 | $oModuleController = getController('module'); |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | $oModuleModel = getModel('module'); |
| 39 | 39 | $oModuleController = getController('module'); |
| 40 | 40 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 41 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 41 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 42 | 42 | { |
| 43 | - if(!$oDB->isColumnExists('counter_log', 'site_srl')) |
|
| 43 | + if (!$oDB->isColumnExists('counter_log', 'site_srl')) |
|
| 44 | 44 | { |
| 45 | 45 | return TRUE; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if(!$oDB->isIndexExists('counter_log', 'idx_site_counter_log')) |
|
| 48 | + if (!$oDB->isIndexExists('counter_log', 'idx_site_counter_log')) |
|
| 49 | 49 | { |
| 50 | 50 | return TRUE; |
| 51 | 51 | } |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | $oModuleModel = getModel('module'); |
| 70 | 70 | $oModuleController = getController('module'); |
| 71 | 71 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 72 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 72 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 73 | 73 | { |
| 74 | - if(!$oDB->isColumnExists('counter_log', 'site_srl')) |
|
| 74 | + if (!$oDB->isColumnExists('counter_log', 'site_srl')) |
|
| 75 | 75 | { |
| 76 | 76 | $oDB->addColumn('counter_log', 'site_srl', 'number', 11, 0, TRUE); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if(!$oDB->isIndexExists('counter_log', 'idx_site_counter_log')) |
|
| 79 | + if (!$oDB->isIndexExists('counter_log', 'idx_site_counter_log')) |
|
| 80 | 80 | { |
| 81 | 81 | $oDB->addIndex('counter_log', 'idx_site_counter_log', array('site_srl', 'ipaddress'), FALSE); |
| 82 | 82 | } |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | $oModuleModel = getModel('module'); |
| 27 | 27 | $oModuleController = getController('module'); |
| 28 | 28 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 29 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 29 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 30 | 30 | { |
| 31 | 31 | $output = executeQuery('page.pageTypeOpageCheck'); |
| 32 | - if($output->toBool() && $output->data) return true; |
|
| 32 | + if ($output->toBool() && $output->data) return true; |
|
| 33 | 33 | |
| 34 | 34 | $output = executeQuery('page.pageTypeNullCheck'); |
| 35 | - if($output->toBool() && $output->data) return true; |
|
| 35 | + if ($output->toBool() && $output->data) return true; |
|
| 36 | 36 | |
| 37 | 37 | $oModuleController->insertUpdatedLog($version_update_id); |
| 38 | 38 | } |
@@ -48,44 +48,44 @@ discard block |
||
| 48 | 48 | $oModuleModel = getModel('module'); |
| 49 | 49 | $oModuleController = getController('module'); |
| 50 | 50 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 51 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 51 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 52 | 52 | { |
| 53 | 53 | $args = new stdClass; |
| 54 | 54 | // opage module instance update |
| 55 | 55 | $output = executeQueryArray('page.pageTypeOpageCheck'); |
| 56 | - if($output->toBool() && count($output->data) > 0) |
|
| 56 | + if ($output->toBool() && count($output->data) > 0) |
|
| 57 | 57 | { |
| 58 | - foreach($output->data as $val) |
|
| 58 | + foreach ($output->data as $val) |
|
| 59 | 59 | { |
| 60 | 60 | $args->module_srl = $val->module_srl; |
| 61 | 61 | $args->name = 'page_type'; |
| 62 | - $args->value= 'OUTSIDE'; |
|
| 62 | + $args->value = 'OUTSIDE'; |
|
| 63 | 63 | $in_out = executeQuery('page.insertPageType', $args); |
| 64 | 64 | } |
| 65 | 65 | $output = executeQuery('page.updateAllOpage'); |
| 66 | - if(!$output->toBool()) return $output; |
|
| 66 | + if (!$output->toBool()) return $output; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // old page module instance update |
| 70 | 70 | $output = executeQueryArray('page.pageTypeNullCheck'); |
| 71 | 71 | $skin_update_srls = array(); |
| 72 | - if($output->toBool() && $output->data) |
|
| 72 | + if ($output->toBool() && $output->data) |
|
| 73 | 73 | { |
| 74 | - foreach($output->data as $val) |
|
| 74 | + foreach ($output->data as $val) |
|
| 75 | 75 | { |
| 76 | 76 | $args->module_srl = $val->module_srl; |
| 77 | 77 | $args->name = 'page_type'; |
| 78 | - $args->value= 'WIDGET'; |
|
| 78 | + $args->value = 'WIDGET'; |
|
| 79 | 79 | $in_out = executeQuery('page.insertPageType', $args); |
| 80 | 80 | |
| 81 | 81 | $skin_update_srls[] = $val->module_srl; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(count($skin_update_srls)>0) |
|
| 85 | + if (count($skin_update_srls) > 0) |
|
| 86 | 86 | { |
| 87 | 87 | $skin_args = new stdClass; |
| 88 | - $skin_args->module_srls = implode(',',$skin_update_srls); |
|
| 88 | + $skin_args->module_srls = implode(',', $skin_update_srls); |
|
| 89 | 89 | $skin_args->is_skin_fix = "Y"; |
| 90 | 90 | $ouput = executeQuery('page.updateSkinFix', $skin_args); |
| 91 | 91 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $oModuleController->insertUpdatedLog($version_update_id); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - return new Object(0,'success_updated'); |
|
| 96 | + return new Object(0, 'success_updated'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -29,10 +29,14 @@ discard block |
||
| 29 | 29 | if($oModuleModel->needUpdate($version_update_id)) |
| 30 | 30 | { |
| 31 | 31 | $output = executeQuery('page.pageTypeOpageCheck'); |
| 32 | - if($output->toBool() && $output->data) return true; |
|
| 32 | + if($output->toBool() && $output->data) { |
|
| 33 | + return true; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | $output = executeQuery('page.pageTypeNullCheck'); |
| 35 | - if($output->toBool() && $output->data) return true; |
|
| 37 | + if($output->toBool() && $output->data) { |
|
| 38 | + return true; |
|
| 39 | + } |
|
| 36 | 40 | |
| 37 | 41 | $oModuleController->insertUpdatedLog($version_update_id); |
| 38 | 42 | } |
@@ -63,7 +67,9 @@ discard block |
||
| 63 | 67 | $in_out = executeQuery('page.insertPageType', $args); |
| 64 | 68 | } |
| 65 | 69 | $output = executeQuery('page.updateAllOpage'); |
| 66 | - if(!$output->toBool()) return $output; |
|
| 70 | + if(!$output->toBool()) { |
|
| 71 | + return $output; |
|
| 72 | + } |
|
| 67 | 73 | } |
| 68 | 74 | |
| 69 | 75 | // old page module instance update |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $oModuleController = getController('module'); |
| 17 | 17 | |
| 18 | 18 | $oDB = &DB::getInstance(); |
| 19 | - $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true); |
|
| 20 | - $oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
| 19 | + $oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true); |
|
| 20 | + $oDB->addIndex('sites', 'unique_domain', array('domain'), true); |
|
| 21 | 21 | // Create a directory to use in the module module |
| 22 | 22 | FileHandler::makeDir('./files/cache/module_info'); |
| 23 | 23 | FileHandler::makeDir('./files/cache/triggers'); |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | $args = new stdClass; |
| 28 | 28 | $args->site_srl = 0; |
| 29 | 29 | $output = $oDB->executeQuery('module.getSite', $args); |
| 30 | - if(!$output->data || !$output->data->index_module_srl) |
|
| 30 | + if (!$output->data || !$output->data->index_module_srl) |
|
| 31 | 31 | { |
| 32 | 32 | $db_info = Context::getDBInfo(); |
| 33 | 33 | $domain = Context::getDefaultUrl(); |
| 34 | 34 | $url_info = parse_url($domain); |
| 35 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
| 35 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
| 36 | 36 | |
| 37 | 37 | $site_args = new stdClass; |
| 38 | 38 | $site_args->site_srl = 0; |
| 39 | - $site_args->index_module_srl = 0; |
|
| 39 | + $site_args->index_module_srl = 0; |
|
| 40 | 40 | $site_args->domain = $domain; |
| 41 | 41 | $site_args->default_language = $db_info->lang_type; |
| 42 | 42 | |
| 43 | 43 | $output = executeQuery('module.insertSite', $site_args); |
| 44 | - if(!$output->toBool()) return $output; |
|
| 44 | + if (!$output->toBool()) return $output; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return new Object(); |
@@ -56,66 +56,66 @@ discard block |
||
| 56 | 56 | $oModuleModel = getModel('module'); |
| 57 | 57 | $oModuleController = getController('module'); |
| 58 | 58 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 59 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 59 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 60 | 60 | { |
| 61 | 61 | // 2008. 10. 27 Add multi-index in the table, the module_part_config |
| 62 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
| 62 | + if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) return true; |
|
| 63 | 63 | // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
| 64 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
| 64 | + if (!$oDB->isIndexExists('modules', "idx_site_mid")) return true; |
|
| 65 | 65 | // Move permissions/skin information of all modules to the table, grants. |
| 66 | - if($oDB->isColumnExists('modules', 'grants')) return true; |
|
| 66 | + if ($oDB->isColumnExists('modules', 'grants')) return true; |
|
| 67 | 67 | // Move permissions/skin information of all modules to the table, grants. |
| 68 | - if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
| 68 | + if (!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
| 69 | 69 | // Delete extra_vars* column |
| 70 | - for($i=1;$i<=20;$i++) |
|
| 70 | + for ($i = 1; $i <= 20; $i++) |
|
| 71 | 71 | { |
| 72 | - if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
| 72 | + if ($oDB->isColumnExists("documents", "extra_vars".$i)) return true; |
|
| 73 | 73 | } |
| 74 | 74 | // Insert site information to the table, sites |
| 75 | 75 | $args = new stdClass(); |
| 76 | 76 | $args->site_srl = 0; |
| 77 | 77 | $output = $oDB->executeQuery('module.getSite', $args); |
| 78 | - if(!$output->data) return true; |
|
| 78 | + if (!$output->data) return true; |
|
| 79 | 79 | |
| 80 | 80 | // If domain index is defined on the table, sites |
| 81 | - if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
| 82 | - if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
| 81 | + if ($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
| 82 | + if (!$oDB->isIndexExists('sites', 'unique_domain')) return true; |
|
| 83 | 83 | |
| 84 | - if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
| 86 | - if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
| 87 | - if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
| 84 | + if (!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
| 85 | + if (!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
| 86 | + if (!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
| 87 | + if (!$oDB->isColumnExists("modules", "mskin")) return true; |
|
| 88 | 88 | |
| 89 | 89 | // check fix skin |
| 90 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
| 90 | + if (!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
| 91 | 91 | |
| 92 | - if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
| 92 | + if (!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
| 93 | 93 | |
| 94 | 94 | $args->skin = '.'; |
| 95 | 95 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
| 96 | - if($output->data && count($output->data) > 0) |
|
| 96 | + if ($output->data && count($output->data) > 0) |
|
| 97 | 97 | { |
| 98 | - foreach($output->data as $item) |
|
| 98 | + foreach ($output->data as $item) |
|
| 99 | 99 | { |
| 100 | 100 | $skin_path = explode('.', $item->skin); |
| 101 | - if(count($skin_path) != 2) continue; |
|
| 102 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
| 101 | + if (count($skin_path) != 2) continue; |
|
| 102 | + if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // XE 1.7 |
| 107 | 107 | |
| 108 | 108 | // check fix mskin |
| 109 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
| 109 | + if (!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
| 110 | 110 | |
| 111 | 111 | $oModuleModel = getModel('module'); |
| 112 | 112 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 113 | - if(!$moduleConfig->isUpdateFixedValue) return true; |
|
| 113 | + if (!$moduleConfig->isUpdateFixedValue) return true; |
|
| 114 | 114 | |
| 115 | 115 | $oModuleController->insertUpdatedLog($version_update_id); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if(!is_dir('./files/ruleset')) return true; |
|
| 118 | + if (!is_dir('./files/ruleset')) return true; |
|
| 119 | 119 | |
| 120 | 120 | return false; |
| 121 | 121 | } |
@@ -129,22 +129,22 @@ discard block |
||
| 129 | 129 | $oModuleModel = getModel('module'); |
| 130 | 130 | $oModuleController = getController('module'); |
| 131 | 131 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 132 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 132 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 133 | 133 | { |
| 134 | 134 | // 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg |
| 135 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) |
|
| 135 | + if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) |
|
| 136 | 136 | { |
| 137 | 137 | $oModuleModel = getModel('module'); |
| 138 | 138 | $oModuleController = getController('module'); |
| 139 | 139 | $modules = $oModuleModel->getModuleList(); |
| 140 | - foreach($modules as $key => $module_info) |
|
| 140 | + foreach ($modules as $key => $module_info) |
|
| 141 | 141 | { |
| 142 | 142 | $module = $module_info->module; |
| 143 | - if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
| 143 | + if (!in_array($module, array('point', 'trackback', 'layout', 'rss', 'file', 'comment', 'editor'))) continue; |
|
| 144 | 144 | $config = $oModuleModel->getModuleConfig($module); |
| 145 | 145 | |
| 146 | 146 | $module_config = null; |
| 147 | - switch($module) |
|
| 147 | + switch ($module) |
|
| 148 | 148 | { |
| 149 | 149 | case 'point' : |
| 150 | 150 | $module_config = $config->module_point; |
@@ -157,21 +157,21 @@ discard block |
||
| 157 | 157 | case 'editor' : |
| 158 | 158 | $module_config = $config->module_config; |
| 159 | 159 | unset($config->module_config); |
| 160 | - if(is_array($module_config) && count($module_config)) |
|
| 160 | + if (is_array($module_config) && count($module_config)) |
|
| 161 | 161 | { |
| 162 | - foreach($module_config as $key => $val) |
|
| 162 | + foreach ($module_config as $key => $val) |
|
| 163 | 163 | { |
| 164 | - if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
| 164 | + if (isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | break; |
| 168 | 168 | case 'layout' : |
| 169 | 169 | $tmp = $config->header_script; |
| 170 | - if(is_array($tmp) && count($tmp)) |
|
| 170 | + if (is_array($tmp) && count($tmp)) |
|
| 171 | 171 | { |
| 172 | - foreach($tmp as $k => $v) |
|
| 172 | + foreach ($tmp as $k => $v) |
|
| 173 | 173 | { |
| 174 | - if(!$v && !trim($v)) continue; |
|
| 174 | + if (!$v && !trim($v)) continue; |
|
| 175 | 175 | $module_config[$k]->header_script = $v; |
| 176 | 176 | } |
| 177 | 177 | } |
@@ -181,29 +181,29 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $oModuleController->insertModuleConfig($module, $config); |
| 183 | 183 | |
| 184 | - if(is_array($module_config) && count($module_config)) |
|
| 184 | + if (is_array($module_config) && count($module_config)) |
|
| 185 | 185 | { |
| 186 | - foreach($module_config as $module_srl => $module_part_config) |
|
| 186 | + foreach ($module_config as $module_srl => $module_part_config) |
|
| 187 | 187 | { |
| 188 | - $oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config); |
|
| 188 | + $oModuleController->insertModulePartConfig($module, $module_srl, $module_part_config); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | - $oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl")); |
|
| 192 | + $oDB->addIndex("module_part_config", "idx_module_part_config", array("module", "module_srl")); |
|
| 193 | 193 | } |
| 194 | 194 | // 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns |
| 195 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) |
|
| 195 | + if (!$oDB->isIndexExists('modules', "idx_site_mid")) |
|
| 196 | 196 | { |
| 197 | - $oDB->dropIndex("modules","unique_mid",true); |
|
| 198 | - $oDB->addColumn('modules','site_srl','number',11,0,true); |
|
| 199 | - $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
|
| 197 | + $oDB->dropIndex("modules", "unique_mid", true); |
|
| 198 | + $oDB->addColumn('modules', 'site_srl', 'number', 11, 0, true); |
|
| 199 | + $oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true); |
|
| 200 | 200 | } |
| 201 | 201 | // document extra vars |
| 202 | - if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 202 | + if (!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 203 | 203 | |
| 204 | - if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 204 | + if (!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 205 | 205 | // Move permission, skin info, extection info, admin ID of all modules to the table, grants |
| 206 | - if($oDB->isColumnExists('modules', 'grants')) |
|
| 206 | + if ($oDB->isColumnExists('modules', 'grants')) |
|
| 207 | 207 | { |
| 208 | 208 | $oModuleController = getController('module'); |
| 209 | 209 | $oDocumentController = getController('document'); |
@@ -211,26 +211,26 @@ discard block |
||
| 211 | 211 | $lang_code = Context::getLangType(); |
| 212 | 212 | // Get module_info of all modules |
| 213 | 213 | $output = executeQueryArray('module.getModuleInfos'); |
| 214 | - if(count($output->data)) |
|
| 214 | + if (count($output->data)) |
|
| 215 | 215 | { |
| 216 | - foreach($output->data as $module_info) |
|
| 216 | + foreach ($output->data as $module_info) |
|
| 217 | 217 | { |
| 218 | 218 | // Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority |
| 219 | 219 | $module_srl = trim($module_info->module_srl); |
| 220 | 220 | // grant an authority |
| 221 | 221 | $grants = unserialize($module_info->grants); |
| 222 | - if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 222 | + if ($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 223 | 223 | // Insert skin vars |
| 224 | 224 | $skin_vars = unserialize($module_info->skin_vars); |
| 225 | - if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 225 | + if ($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 226 | 226 | // Insert super admin's ID |
| 227 | 227 | $admin_id = trim($module_info->admin_id); |
| 228 | - if($admin_id && $admin_id != 'Array') |
|
| 228 | + if ($admin_id && $admin_id != 'Array') |
|
| 229 | 229 | { |
| 230 | - $admin_ids = explode(',',$admin_id); |
|
| 231 | - if(count($admin_id)) |
|
| 230 | + $admin_ids = explode(',', $admin_id); |
|
| 231 | + if (count($admin_id)) |
|
| 232 | 232 | { |
| 233 | - foreach($admin_ids as $admin_id) |
|
| 233 | + foreach ($admin_ids as $admin_id) |
|
| 234 | 234 | { |
| 235 | 235 | $oModuleController->insertAdminId($module_srl, $admin_id); |
| 236 | 236 | } |
@@ -239,20 +239,20 @@ discard block |
||
| 239 | 239 | // Save extra configurations for each module(column data which doesn't exist in the defaut modules) |
| 240 | 240 | $extra_vars = unserialize($module_info->extra_vars); |
| 241 | 241 | $document_extra_keys = null; |
| 242 | - if($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
| 242 | + if ($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
| 243 | 243 | { |
| 244 | 244 | $document_extra_keys = $extra_vars->extra_vars; |
| 245 | 245 | unset($extra_vars->extra_vars); |
| 246 | 246 | } |
| 247 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 247 | + if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
| 251 | 251 | */ |
| 252 | 252 | // Insert extra vars if planet module is |
| 253 | - if($module_info->module == 'planet') |
|
| 253 | + if ($module_info->module == 'planet') |
|
| 254 | 254 | { |
| 255 | - if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
| 255 | + if (!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
| 256 | 256 | $planet_extra_keys->name = 'postscript'; |
| 257 | 257 | $planet_extra_keys->type = 'text'; |
| 258 | 258 | $planet_extra_keys->is_required = 'N'; |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | $document_extra_keys[20] = $planet_extra_keys; |
| 263 | 263 | } |
| 264 | 264 | // Register keys for document extra vars |
| 265 | - if(count($document_extra_keys)) |
|
| 265 | + if (count($document_extra_keys)) |
|
| 266 | 266 | { |
| 267 | - foreach($document_extra_keys as $var_idx => $val) |
|
| 267 | + foreach ($document_extra_keys as $var_idx => $val) |
|
| 268 | 268 | { |
| 269 | 269 | $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx); |
| 270 | 270 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $oDocumentModel = getModel('document'); |
| 273 | 273 | $total_count = $oDocumentModel->getDocumentCount($module_srl); |
| 274 | 274 | |
| 275 | - if($total_count > 0) |
|
| 275 | + if ($total_count > 0) |
|
| 276 | 276 | { |
| 277 | 277 | $per_page = 100; |
| 278 | 278 | $total_pages = (int) (($total_count - 1) / $per_page) + 1; |
@@ -283,19 +283,19 @@ discard block |
||
| 283 | 283 | $doc_args->sort_index = 'list_order'; |
| 284 | 284 | $doc_args->order_type = 'asc'; |
| 285 | 285 | |
| 286 | - for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
| 286 | + for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
| 287 | 287 | { |
| 288 | 288 | $output = executeQueryArray('document.getDocumentList', $doc_args); |
| 289 | 289 | |
| 290 | - if($output->toBool() && $output->data && count($output->data)) |
|
| 290 | + if ($output->toBool() && $output->data && count($output->data)) |
|
| 291 | 291 | { |
| 292 | 292 | foreach ($output->data as $document) |
| 293 | 293 | { |
| 294 | - if(!$document) continue; |
|
| 294 | + if (!$document) continue; |
|
| 295 | 295 | foreach ($document as $key => $var) |
| 296 | 296 | { |
| 297 | 297 | if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
| 298 | - $var_idx = str_replace('extra_vars','',$key); |
|
| 298 | + $var_idx = str_replace('extra_vars', '', $key); |
|
| 299 | 299 | $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -311,96 +311,96 @@ discard block |
||
| 311 | 311 | executeQuery('module.updateModule', $module_info); |
| 312 | 312 | |
| 313 | 313 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 314 | - if($oCacheHandler->isSupport()) |
|
| 314 | + if ($oCacheHandler->isSupport()) |
|
| 315 | 315 | { |
| 316 | 316 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | // Various column drop |
| 321 | - $oDB->dropColumn('modules','grants'); |
|
| 322 | - $oDB->dropColumn('modules','admin_id'); |
|
| 323 | - $oDB->dropColumn('modules','skin_vars'); |
|
| 324 | - $oDB->dropColumn('modules','extra_vars'); |
|
| 321 | + $oDB->dropColumn('modules', 'grants'); |
|
| 322 | + $oDB->dropColumn('modules', 'admin_id'); |
|
| 323 | + $oDB->dropColumn('modules', 'skin_vars'); |
|
| 324 | + $oDB->dropColumn('modules', 'extra_vars'); |
|
| 325 | 325 | } |
| 326 | 326 | // Rights of all modules/skins transferring the information into a table Update grants |
| 327 | - if(!$oDB->isColumnExists('sites', 'default_language')) |
|
| 327 | + if (!$oDB->isColumnExists('sites', 'default_language')) |
|
| 328 | 328 | { |
| 329 | - $oDB->addColumn('sites','default_language','varchar',255,0,false); |
|
| 329 | + $oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false); |
|
| 330 | 330 | } |
| 331 | 331 | // extra_vars * Remove Column |
| 332 | - for($i=1;$i<=20;$i++) |
|
| 332 | + for ($i = 1; $i <= 20; $i++) |
|
| 333 | 333 | { |
| 334 | - if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
| 335 | - $oDB->dropColumn('documents','extra_vars'.$i); |
|
| 334 | + if (!$oDB->isColumnExists("documents", "extra_vars".$i)) continue; |
|
| 335 | + $oDB->dropColumn('documents', 'extra_vars'.$i); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | // Enter the main site information sites on the table |
| 339 | 339 | $args = new stdClass; |
| 340 | 340 | $args->site_srl = 0; |
| 341 | 341 | $output = $oDB->executeQuery('module.getSite', $args); |
| 342 | - if(!$output->data) |
|
| 342 | + if (!$output->data) |
|
| 343 | 343 | { |
| 344 | 344 | // Basic mid, language Wanted |
| 345 | 345 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
| 346 | 346 | $db_info = Context::getDBInfo(); |
| 347 | 347 | $domain = Context::getDefaultUrl(); |
| 348 | 348 | $url_info = parse_url($domain); |
| 349 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
| 349 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
| 350 | 350 | $site_args->site_srl = 0; |
| 351 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 351 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 352 | 352 | $site_args->domain = $domain; |
| 353 | 353 | $site_args->default_language = $db_info->lang_type; |
| 354 | 354 | |
| 355 | 355 | $output = executeQuery('module.insertSite', $site_args); |
| 356 | - if(!$output->toBool()) return $output; |
|
| 356 | + if (!$output->toBool()) return $output; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if($oDB->isIndexExists('sites','idx_domain')) |
|
| 359 | + if ($oDB->isIndexExists('sites', 'idx_domain')) |
|
| 360 | 360 | { |
| 361 | - $oDB->dropIndex('sites','idx_domain'); |
|
| 361 | + $oDB->dropIndex('sites', 'idx_domain'); |
|
| 362 | 362 | } |
| 363 | - if(!$oDB->isIndexExists('sites','unique_domain')) |
|
| 363 | + if (!$oDB->isIndexExists('sites', 'unique_domain')) |
|
| 364 | 364 | { |
| 365 | 365 | $this->updateForUniqueSiteDomain(); |
| 366 | - $oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
| 366 | + $oDB->addIndex('sites', 'unique_domain', array('domain'), true); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if(!$oDB->isColumnExists("modules", "use_mobile")) |
|
| 369 | + if (!$oDB->isColumnExists("modules", "use_mobile")) |
|
| 370 | 370 | { |
| 371 | - $oDB->addColumn('modules','use_mobile','char',1,'N'); |
|
| 371 | + $oDB->addColumn('modules', 'use_mobile', 'char', 1, 'N'); |
|
| 372 | 372 | } |
| 373 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
| 373 | + if (!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
| 374 | 374 | { |
| 375 | - $oDB->addColumn('modules','mlayout_srl','number',11, 0); |
|
| 375 | + $oDB->addColumn('modules', 'mlayout_srl', 'number', 11, 0); |
|
| 376 | 376 | } |
| 377 | - if(!$oDB->isColumnExists("modules", "mcontent")) |
|
| 377 | + if (!$oDB->isColumnExists("modules", "mcontent")) |
|
| 378 | 378 | { |
| 379 | - $oDB->addColumn('modules','mcontent','bigtext'); |
|
| 379 | + $oDB->addColumn('modules', 'mcontent', 'bigtext'); |
|
| 380 | 380 | } |
| 381 | - if(!$oDB->isColumnExists("modules", "mskin")) |
|
| 381 | + if (!$oDB->isColumnExists("modules", "mskin")) |
|
| 382 | 382 | { |
| 383 | - $oDB->addColumn('modules','mskin','varchar',250); |
|
| 383 | + $oDB->addColumn('modules', 'mskin', 'varchar', 250); |
|
| 384 | 384 | } |
| 385 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
| 385 | + if (!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
| 386 | 386 | { |
| 387 | 387 | $oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N'); |
| 388 | 388 | $output = executeQuery('module.updateSkinFixModules'); |
| 389 | 389 | } |
| 390 | - if(!$oDB->isColumnExists("module_config", "site_srl")) |
|
| 390 | + if (!$oDB->isColumnExists("module_config", "site_srl")) |
|
| 391 | 391 | { |
| 392 | 392 | $oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | $args->skin = '.'; |
| 396 | 396 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
| 397 | - if($output->data && count($output->data) > 0) |
|
| 397 | + if ($output->data && count($output->data) > 0) |
|
| 398 | 398 | { |
| 399 | - foreach($output->data as $item) |
|
| 399 | + foreach ($output->data as $item) |
|
| 400 | 400 | { |
| 401 | 401 | $skin_path = explode('.', $item->skin); |
| 402 | - if(count($skin_path) != 2) continue; |
|
| 403 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
| 402 | + if (count($skin_path) != 2) continue; |
|
| 403 | + if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
| 404 | 404 | { |
| 405 | 405 | unset($args); |
| 406 | 406 | $args->skin = $item->skin; |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | // XE 1.7 |
| 414 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
| 414 | + if (!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
| 415 | 415 | { |
| 416 | 416 | $oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N'); |
| 417 | 417 | $output = executeQuery('module.updateMobileSkinFixModules'); |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | $oModuleModel = getModel('module'); |
| 421 | 421 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 422 | - if(!$moduleConfig->isUpdateFixedValue) |
|
| 422 | + if (!$moduleConfig->isUpdateFixedValue) |
|
| 423 | 423 | { |
| 424 | 424 | $output = executeQuery('module.updateSkinFixModules'); |
| 425 | 425 | $output = executeQuery('module.updateMobileSkinFixModules'); |
| 426 | 426 | |
| 427 | 427 | $oModuleController = getController('module'); |
| 428 | - if(!$moduleConfig) $moduleConfig = new stdClass; |
|
| 428 | + if (!$moduleConfig) $moduleConfig = new stdClass; |
|
| 429 | 429 | $moduleConfig->isUpdateFixedValue = TRUE; |
| 430 | 430 | $output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
| 431 | 431 | } |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $oModuleController->insertUpdatedLog($version_update_id); |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset'); |
|
| 436 | + if (!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset'); |
|
| 437 | 437 | |
| 438 | 438 | return new Object(0, 'success_updated'); |
| 439 | 439 | } |
@@ -441,18 +441,18 @@ discard block |
||
| 441 | 441 | function updateForUniqueSiteDomain() |
| 442 | 442 | { |
| 443 | 443 | $output = executeQueryArray("module.getNonuniqueDomains"); |
| 444 | - if(!$output->data) return; |
|
| 445 | - foreach($output->data as $data) |
|
| 444 | + if (!$output->data) return; |
|
| 445 | + foreach ($output->data as $data) |
|
| 446 | 446 | { |
| 447 | - if($data->count == 1) continue; |
|
| 447 | + if ($data->count == 1) continue; |
|
| 448 | 448 | $domain = $data->domain; |
| 449 | 449 | $args = new stdClass; |
| 450 | 450 | $args->domain = $domain; |
| 451 | 451 | $output2 = executeQueryArray("module.getSiteByDomain", $args); |
| 452 | 452 | $bFirst = true; |
| 453 | - foreach($output2->data as $site) |
|
| 453 | + foreach ($output2->data as $site) |
|
| 454 | 454 | { |
| 455 | - if($bFirst) |
|
| 455 | + if ($bFirst) |
|
| 456 | 456 | { |
| 457 | 457 | $bFirst = false; |
| 458 | 458 | continue; |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | $site_args->default_language = $db_info->lang_type; |
| 42 | 42 | |
| 43 | 43 | $output = executeQuery('module.insertSite', $site_args); |
| 44 | - if(!$output->toBool()) return $output; |
|
| 44 | + if(!$output->toBool()) { |
|
| 45 | + return $output; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | return new Object(); |
@@ -59,37 +61,65 @@ discard block |
||
| 59 | 61 | if($oModuleModel->needUpdate($version_update_id)) |
| 60 | 62 | { |
| 61 | 63 | // 2008. 10. 27 Add multi-index in the table, the module_part_config |
| 62 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
| 64 | + if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) { |
|
| 65 | + return true; |
|
| 66 | + } |
|
| 63 | 67 | // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
| 64 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
| 68 | + if(!$oDB->isIndexExists('modules',"idx_site_mid")) { |
|
| 69 | + return true; |
|
| 70 | + } |
|
| 65 | 71 | // Move permissions/skin information of all modules to the table, grants. |
| 66 | - if($oDB->isColumnExists('modules', 'grants')) return true; |
|
| 72 | + if($oDB->isColumnExists('modules', 'grants')) { |
|
| 73 | + return true; |
|
| 74 | + } |
|
| 67 | 75 | // Move permissions/skin information of all modules to the table, grants. |
| 68 | - if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
| 76 | + if(!$oDB->isColumnExists('sites', 'default_language')) { |
|
| 77 | + return true; |
|
| 78 | + } |
|
| 69 | 79 | // Delete extra_vars* column |
| 70 | 80 | for($i=1;$i<=20;$i++) |
| 71 | 81 | { |
| 72 | - if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
| 82 | + if($oDB->isColumnExists("documents","extra_vars".$i)) { |
|
| 83 | + return true; |
|
| 84 | + } |
|
| 73 | 85 | } |
| 74 | 86 | // Insert site information to the table, sites |
| 75 | 87 | $args = new stdClass(); |
| 76 | 88 | $args->site_srl = 0; |
| 77 | 89 | $output = $oDB->executeQuery('module.getSite', $args); |
| 78 | - if(!$output->data) return true; |
|
| 90 | + if(!$output->data) { |
|
| 91 | + return true; |
|
| 92 | + } |
|
| 79 | 93 | |
| 80 | 94 | // If domain index is defined on the table, sites |
| 81 | - if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
| 82 | - if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
| 95 | + if($oDB->isIndexExists('sites', 'idx_domain')) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 98 | + if(!$oDB->isIndexExists('sites','unique_domain')) { |
|
| 99 | + return true; |
|
| 100 | + } |
|
| 83 | 101 | |
| 84 | - if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
| 86 | - if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
| 87 | - if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
| 102 | + if(!$oDB->isColumnExists("modules", "use_mobile")) { |
|
| 103 | + return true; |
|
| 104 | + } |
|
| 105 | + if(!$oDB->isColumnExists("modules", "mlayout_srl")) { |
|
| 106 | + return true; |
|
| 107 | + } |
|
| 108 | + if(!$oDB->isColumnExists("modules", "mcontent")) { |
|
| 109 | + return true; |
|
| 110 | + } |
|
| 111 | + if(!$oDB->isColumnExists("modules", "mskin")) { |
|
| 112 | + return true; |
|
| 113 | + } |
|
| 88 | 114 | |
| 89 | 115 | // check fix skin |
| 90 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
| 116 | + if(!$oDB->isColumnExists("modules", "is_skin_fix")) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 91 | 119 | |
| 92 | - if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
| 120 | + if(!$oDB->isColumnExists("module_config", "site_srl")) { |
|
| 121 | + return true; |
|
| 122 | + } |
|
| 93 | 123 | |
| 94 | 124 | $args->skin = '.'; |
| 95 | 125 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
@@ -98,24 +128,34 @@ discard block |
||
| 98 | 128 | foreach($output->data as $item) |
| 99 | 129 | { |
| 100 | 130 | $skin_path = explode('.', $item->skin); |
| 101 | - if(count($skin_path) != 2) continue; |
|
| 102 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
| 131 | + if(count($skin_path) != 2) { |
|
| 132 | + continue; |
|
| 133 | + } |
|
| 134 | + if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) { |
|
| 135 | + return true; |
|
| 136 | + } |
|
| 103 | 137 | } |
| 104 | 138 | } |
| 105 | 139 | |
| 106 | 140 | // XE 1.7 |
| 107 | 141 | |
| 108 | 142 | // check fix mskin |
| 109 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
| 143 | + if(!$oDB->isColumnExists("modules", "is_mskin_fix")) { |
|
| 144 | + return true; |
|
| 145 | + } |
|
| 110 | 146 | |
| 111 | 147 | $oModuleModel = getModel('module'); |
| 112 | 148 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 113 | - if(!$moduleConfig->isUpdateFixedValue) return true; |
|
| 149 | + if(!$moduleConfig->isUpdateFixedValue) { |
|
| 150 | + return true; |
|
| 151 | + } |
|
| 114 | 152 | |
| 115 | 153 | $oModuleController->insertUpdatedLog($version_update_id); |
| 116 | 154 | } |
| 117 | 155 | |
| 118 | - if(!is_dir('./files/ruleset')) return true; |
|
| 156 | + if(!is_dir('./files/ruleset')) { |
|
| 157 | + return true; |
|
| 158 | + } |
|
| 119 | 159 | |
| 120 | 160 | return false; |
| 121 | 161 | } |
@@ -140,7 +180,9 @@ discard block |
||
| 140 | 180 | foreach($modules as $key => $module_info) |
| 141 | 181 | { |
| 142 | 182 | $module = $module_info->module; |
| 143 | - if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
| 183 | + if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) { |
|
| 184 | + continue; |
|
| 185 | + } |
|
| 144 | 186 | $config = $oModuleModel->getModuleConfig($module); |
| 145 | 187 | |
| 146 | 188 | $module_config = null; |
@@ -161,7 +203,9 @@ discard block |
||
| 161 | 203 | { |
| 162 | 204 | foreach($module_config as $key => $val) |
| 163 | 205 | { |
| 164 | - if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
| 206 | + if(isset($module_config[$key]->module_srl)) { |
|
| 207 | + unset($module_config[$key]->module_srl); |
|
| 208 | + } |
|
| 165 | 209 | } |
| 166 | 210 | } |
| 167 | 211 | break; |
@@ -171,7 +215,9 @@ discard block |
||
| 171 | 215 | { |
| 172 | 216 | foreach($tmp as $k => $v) |
| 173 | 217 | { |
| 174 | - if(!$v && !trim($v)) continue; |
|
| 218 | + if(!$v && !trim($v)) { |
|
| 219 | + continue; |
|
| 220 | + } |
|
| 175 | 221 | $module_config[$k]->header_script = $v; |
| 176 | 222 | } |
| 177 | 223 | } |
@@ -199,9 +245,13 @@ discard block |
||
| 199 | 245 | $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
| 200 | 246 | } |
| 201 | 247 | // document extra vars |
| 202 | - if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 248 | + if(!$oDB->isTableExists('document_extra_vars')) { |
|
| 249 | + $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 250 | + } |
|
| 203 | 251 | |
| 204 | - if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 252 | + if(!$oDB->isTableExists('document_extra_keys')) { |
|
| 253 | + $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 254 | + } |
|
| 205 | 255 | // Move permission, skin info, extection info, admin ID of all modules to the table, grants |
| 206 | 256 | if($oDB->isColumnExists('modules', 'grants')) |
| 207 | 257 | { |
@@ -219,10 +269,14 @@ discard block |
||
| 219 | 269 | $module_srl = trim($module_info->module_srl); |
| 220 | 270 | // grant an authority |
| 221 | 271 | $grants = unserialize($module_info->grants); |
| 222 | - if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 272 | + if($grants) { |
|
| 273 | + $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 274 | + } |
|
| 223 | 275 | // Insert skin vars |
| 224 | 276 | $skin_vars = unserialize($module_info->skin_vars); |
| 225 | - if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 277 | + if($skin_vars) { |
|
| 278 | + $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 279 | + } |
|
| 226 | 280 | // Insert super admin's ID |
| 227 | 281 | $admin_id = trim($module_info->admin_id); |
| 228 | 282 | if($admin_id && $admin_id != 'Array') |
@@ -244,7 +298,9 @@ discard block |
||
| 244 | 298 | $document_extra_keys = $extra_vars->extra_vars; |
| 245 | 299 | unset($extra_vars->extra_vars); |
| 246 | 300 | } |
| 247 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 301 | + if($extra_vars) { |
|
| 302 | + $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 303 | + } |
|
| 248 | 304 | |
| 249 | 305 | /** |
| 250 | 306 | * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
@@ -252,7 +308,9 @@ discard block |
||
| 252 | 308 | // Insert extra vars if planet module is |
| 253 | 309 | if($module_info->module == 'planet') |
| 254 | 310 | { |
| 255 | - if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
| 311 | + if(!$document_extra_keys || !is_array($document_extra_keys)) { |
|
| 312 | + $document_extra_keys = array(); |
|
| 313 | + } |
|
| 256 | 314 | $planet_extra_keys->name = 'postscript'; |
| 257 | 315 | $planet_extra_keys->type = 'text'; |
| 258 | 316 | $planet_extra_keys->is_required = 'N'; |
@@ -291,10 +349,14 @@ discard block |
||
| 291 | 349 | { |
| 292 | 350 | foreach ($output->data as $document) |
| 293 | 351 | { |
| 294 | - if(!$document) continue; |
|
| 352 | + if(!$document) { |
|
| 353 | + continue; |
|
| 354 | + } |
|
| 295 | 355 | foreach ($document as $key => $var) |
| 296 | 356 | { |
| 297 | - if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
|
| 357 | + if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') { |
|
| 358 | + continue; |
|
| 359 | + } |
|
| 298 | 360 | $var_idx = str_replace('extra_vars','',$key); |
| 299 | 361 | $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
| 300 | 362 | } |
@@ -331,7 +393,9 @@ discard block |
||
| 331 | 393 | // extra_vars * Remove Column |
| 332 | 394 | for($i=1;$i<=20;$i++) |
| 333 | 395 | { |
| 334 | - if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
| 396 | + if(!$oDB->isColumnExists("documents","extra_vars".$i)) { |
|
| 397 | + continue; |
|
| 398 | + } |
|
| 335 | 399 | $oDB->dropColumn('documents','extra_vars'.$i); |
| 336 | 400 | } |
| 337 | 401 | |
@@ -353,7 +417,9 @@ discard block |
||
| 353 | 417 | $site_args->default_language = $db_info->lang_type; |
| 354 | 418 | |
| 355 | 419 | $output = executeQuery('module.insertSite', $site_args); |
| 356 | - if(!$output->toBool()) return $output; |
|
| 420 | + if(!$output->toBool()) { |
|
| 421 | + return $output; |
|
| 422 | + } |
|
| 357 | 423 | } |
| 358 | 424 | |
| 359 | 425 | if($oDB->isIndexExists('sites','idx_domain')) |
@@ -399,7 +465,9 @@ discard block |
||
| 399 | 465 | foreach($output->data as $item) |
| 400 | 466 | { |
| 401 | 467 | $skin_path = explode('.', $item->skin); |
| 402 | - if(count($skin_path) != 2) continue; |
|
| 468 | + if(count($skin_path) != 2) { |
|
| 469 | + continue; |
|
| 470 | + } |
|
| 403 | 471 | if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
| 404 | 472 | { |
| 405 | 473 | unset($args); |
@@ -425,7 +493,9 @@ discard block |
||
| 425 | 493 | $output = executeQuery('module.updateMobileSkinFixModules'); |
| 426 | 494 | |
| 427 | 495 | $oModuleController = getController('module'); |
| 428 | - if(!$moduleConfig) $moduleConfig = new stdClass; |
|
| 496 | + if(!$moduleConfig) { |
|
| 497 | + $moduleConfig = new stdClass; |
|
| 498 | + } |
|
| 429 | 499 | $moduleConfig->isUpdateFixedValue = TRUE; |
| 430 | 500 | $output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
| 431 | 501 | } |
@@ -433,7 +503,9 @@ discard block |
||
| 433 | 503 | $oModuleController->insertUpdatedLog($version_update_id); |
| 434 | 504 | } |
| 435 | 505 | |
| 436 | - if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset'); |
|
| 506 | + if(!is_dir('./files/ruleset')) { |
|
| 507 | + FileHandler::makeDir('./files/ruleset'); |
|
| 508 | + } |
|
| 437 | 509 | |
| 438 | 510 | return new Object(0, 'success_updated'); |
| 439 | 511 | } |
@@ -441,10 +513,14 @@ discard block |
||
| 441 | 513 | function updateForUniqueSiteDomain() |
| 442 | 514 | { |
| 443 | 515 | $output = executeQueryArray("module.getNonuniqueDomains"); |
| 444 | - if(!$output->data) return; |
|
| 516 | + if(!$output->data) { |
|
| 517 | + return; |
|
| 518 | + } |
|
| 445 | 519 | foreach($output->data as $data) |
| 446 | 520 | { |
| 447 | - if($data->count == 1) continue; |
|
| 521 | + if($data->count == 1) { |
|
| 522 | + continue; |
|
| 523 | + } |
|
| 448 | 524 | $domain = $data->domain; |
| 449 | 525 | $args = new stdClass; |
| 450 | 526 | $args->domain = $domain; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $output = executeQuery('module.insertActionForward', $args); |
| 30 | 30 | |
| 31 | 31 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 32 | - if($oCacheHandler->isSupport()) |
|
| 32 | + if ($oCacheHandler->isSupport()) |
|
| 33 | 33 | { |
| 34 | 34 | $cache_key = 'action_forward'; |
| 35 | 35 | $oCacheHandler->delete($cache_key); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $output = executeQuery('module.deleteActionForward', $args); |
| 52 | 52 | |
| 53 | 53 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 54 | - if($oCacheHandler->isSupport()) |
|
| 54 | + if ($oCacheHandler->isSupport()) |
|
| 55 | 55 | { |
| 56 | 56 | $cache_key = 'action_forward'; |
| 57 | 57 | $oCacheHandler->delete($cache_key); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | $args->called_position = $called_position; |
| 76 | 76 | |
| 77 | 77 | $output = executeQuery('module.insertTrigger', $args); |
| 78 | - if($output->toBool()) |
|
| 78 | + if ($output->toBool()) |
|
| 79 | 79 | { |
| 80 | 80 | //remove from cache |
| 81 | 81 | $GLOBALS['__triggers__'] = NULL; |
| 82 | 82 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 83 | - if($oCacheHandler->isSupport()) |
|
| 83 | + if ($oCacheHandler->isSupport()) |
|
| 84 | 84 | { |
| 85 | 85 | $cache_key = 'triggers'; |
| 86 | 86 | $oCacheHandler->delete($cache_key); |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | $args->called_position = $called_position; |
| 105 | 105 | |
| 106 | 106 | $output = executeQuery('module.deleteTrigger', $args); |
| 107 | - if($output->toBool()) |
|
| 107 | + if ($output->toBool()) |
|
| 108 | 108 | { |
| 109 | 109 | //remove from cache |
| 110 | 110 | $GLOBALS['__triggers__'] = NULL; |
| 111 | 111 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 112 | - if($oCacheHandler->isSupport()) |
|
| 112 | + if ($oCacheHandler->isSupport()) |
|
| 113 | 113 | { |
| 114 | 114 | $cache_key = 'triggers'; |
| 115 | 115 | $oCacheHandler->delete($cache_key); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $args->module = $module; |
| 130 | 130 | |
| 131 | 131 | $output = executeQuery('module.deleteModuleTriggers', $args); |
| 132 | - if($output->toBool()) |
|
| 132 | + if ($output->toBool()) |
|
| 133 | 133 | { |
| 134 | 134 | //remove from cache |
| 135 | 135 | $GLOBALS['__triggers__'] = NULL; |
| 136 | 136 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 137 | - if($oCacheHandler->isSupport()) |
|
| 137 | + if ($oCacheHandler->isSupport()) |
|
| 138 | 138 | { |
| 139 | 139 | $cache_key = 'triggers'; |
| 140 | 140 | $oCacheHandler->delete($cache_key); |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @brief Add module extend |
| 149 | 149 | * |
| 150 | 150 | */ |
| 151 | - function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
| 151 | + function insertModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
| 152 | 152 | { |
| 153 | - if($kind != 'admin') $kind = ''; |
|
| 154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
| 155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
| 153 | + if ($kind != 'admin') $kind = ''; |
|
| 154 | + if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false; |
|
| 155 | + if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false; |
|
| 156 | 156 | |
| 157 | 157 | $cache_file = './files/config/module_extend.php'; |
| 158 | 158 | FileHandler::removeFile($cache_file); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $args->kind = $kind; |
| 165 | 165 | |
| 166 | 166 | $output = executeQuery('module.getModuleExtendCount', $args); |
| 167 | - if($output->data->count>0) return false; |
|
| 167 | + if ($output->data->count > 0) return false; |
|
| 168 | 168 | |
| 169 | 169 | $output = executeQuery('module.insertModuleExtend', $args); |
| 170 | 170 | return $output; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @brief Delete module extend |
| 175 | 175 | * |
| 176 | 176 | */ |
| 177 | - function deleteModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
| 177 | + function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
| 178 | 178 | { |
| 179 | 179 | $cache_file = './files/config/module_extend.php'; |
| 180 | 180 | FileHandler::removeFile($cache_file); |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | $oModuleModel = getModel('module'); |
| 200 | 200 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
| 201 | 201 | |
| 202 | - if(!$origin_config) $origin_config = new stdClass; |
|
| 202 | + if (!$origin_config) $origin_config = new stdClass; |
|
| 203 | 203 | |
| 204 | - foreach($config as $key => $val) |
|
| 204 | + foreach ($config as $key => $val) |
|
| 205 | 205 | { |
| 206 | 206 | $origin_config->{$key} = $val; |
| 207 | 207 | } |
@@ -215,19 +215,19 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function insertModuleConfig($module, $config, $site_srl = 0) |
| 217 | 217 | { |
| 218 | - $args =new stdClass(); |
|
| 218 | + $args = new stdClass(); |
|
| 219 | 219 | $args->module = $module; |
| 220 | 220 | $args->config = serialize($config); |
| 221 | 221 | $args->site_srl = $site_srl; |
| 222 | 222 | |
| 223 | 223 | $output = executeQuery('module.deleteModuleConfig', $args); |
| 224 | - if(!$output->toBool()) return $output; |
|
| 224 | + if (!$output->toBool()) return $output; |
|
| 225 | 225 | |
| 226 | 226 | $output = executeQuery('module.insertModuleConfig', $args); |
| 227 | 227 | |
| 228 | 228 | //remove from cache |
| 229 | 229 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 230 | - if($oCacheHandler->isSupport()) |
|
| 230 | + if ($oCacheHandler->isSupport()) |
|
| 231 | 231 | { |
| 232 | 232 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 233 | 233 | } |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | $args->config = serialize($config); |
| 247 | 247 | |
| 248 | 248 | $output = executeQuery('module.deleteModulePartConfig', $args); |
| 249 | - if(!$output->toBool()) return $output; |
|
| 249 | + if (!$output->toBool()) return $output; |
|
| 250 | 250 | |
| 251 | 251 | $output = executeQuery('module.insertModulePartConfig', $args); |
| 252 | 252 | |
| 253 | 253 | //remove from cache |
| 254 | 254 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 255 | - if($oCacheHandler->isSupport()) |
|
| 255 | + if ($oCacheHandler->isSupport()) |
|
| 256 | 256 | { |
| 257 | 257 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 258 | 258 | } |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | function insertSite($domain, $index_module_srl) |
| 267 | 267 | { |
| 268 | - if(isSiteID($domain)) |
|
| 268 | + if (isSiteID($domain)) |
|
| 269 | 269 | { |
| 270 | 270 | $oModuleModel = getModel('module'); |
| 271 | - if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid'); |
|
| 271 | + if ($oModuleModel->isIDExists($domain, 0)) return new Object(-1, 'msg_already_registed_vid'); |
|
| 272 | 272 | } |
| 273 | 273 | else |
| 274 | 274 | { |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | $columnList = array('modules.site_srl'); |
| 285 | 285 | $oModuleModel = getModel('module'); |
| 286 | 286 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 287 | - if($output) return new Object(-1,'msg_already_registed_vid'); |
|
| 287 | + if ($output) return new Object(-1, 'msg_already_registed_vid'); |
|
| 288 | 288 | |
| 289 | 289 | $output = executeQuery('module.insertSite', $args); |
| 290 | - if(!$output->toBool()) return $output; |
|
| 290 | + if (!$output->toBool()) return $output; |
|
| 291 | 291 | |
| 292 | 292 | $output->add('site_srl', $args->site_srl); |
| 293 | 293 | return $output; |
@@ -302,32 +302,32 @@ discard block |
||
| 302 | 302 | $columnList = array('sites.site_srl', 'sites.domain'); |
| 303 | 303 | $site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList); |
| 304 | 304 | |
| 305 | - if(!$args->domain && $site_info->site_srl == $args->site_srl) |
|
| 305 | + if (!$args->domain && $site_info->site_srl == $args->site_srl) |
|
| 306 | 306 | { |
| 307 | 307 | $args->domain = $site_info->domain; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if($site_info->domain != $args->domain) |
|
| 310 | + if ($site_info->domain != $args->domain) |
|
| 311 | 311 | { |
| 312 | 312 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain'); |
|
| 314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid'); |
|
| 313 | + if ($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1, 'msg_already_registed_domain'); |
|
| 314 | + if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1, 'msg_already_registed_vid'); |
|
| 315 | 315 | |
| 316 | - if($args->domain && !isSiteID($args->domain)) |
|
| 316 | + if ($args->domain && !isSiteID($args->domain)) |
|
| 317 | 317 | { |
| 318 | 318 | $args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | $output = executeQuery('module.updateSite', $args); |
| 322 | 322 | //clear cache for default mid |
| 323 | - if($args->site_srl == 0) $vid=''; |
|
| 324 | - else $vid=$args->domain; |
|
| 323 | + if ($args->site_srl == 0) $vid = ''; |
|
| 324 | + else $vid = $args->domain; |
|
| 325 | 325 | |
| 326 | 326 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
| 327 | 327 | $mid = $module_info->mid; |
| 328 | 328 | |
| 329 | 329 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 330 | - if($oCacheHandler->isSupport()) |
|
| 330 | + if ($oCacheHandler->isSupport()) |
|
| 331 | 331 | { |
| 332 | 332 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 333 | 333 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | unset($args->act); |
| 346 | 346 | unset($args->page); |
| 347 | 347 | // Test mid value |
| 348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 348 | + if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 349 | 349 | // Test variables (separate basic vars and other vars in modules) |
| 350 | 350 | $extra_vars = clone($args); |
| 351 | 351 | unset($extra_vars->module_srl); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | function insertModule($args) |
| 381 | 381 | { |
| 382 | - if(isset($args->isMenuCreate)) |
|
| 382 | + if (isset($args->isMenuCreate)) |
|
| 383 | 383 | { |
| 384 | 384 | $isMenuCreate = $args->isMenuCreate; |
| 385 | 385 | } |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 392 | - if(!$output->toBool()) return $output; |
|
| 392 | + if (!$output->toBool()) return $output; |
|
| 393 | 393 | // Check whether the module name already exists |
| 394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 394 | + if (!$args->site_srl) $args->site_srl = 0; |
|
| 395 | 395 | $oModuleModel = getModel('module'); |
| 396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
| 396 | + if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
| 397 | 397 | |
| 398 | 398 | // begin transaction |
| 399 | 399 | $oDB = &DB::getInstance(); |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | $skin_vars = new stdClass(); |
| 405 | 405 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
| 406 | 406 | // Arrange variables and then execute a query |
| 407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 407 | + if (!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 408 | 408 | |
| 409 | 409 | // default value |
| 410 | - if($args->skin == '/USE_DEFAULT/') |
|
| 410 | + if ($args->skin == '/USE_DEFAULT/') |
|
| 411 | 411 | { |
| 412 | 412 | $args->is_skin_fix = 'N'; |
| 413 | 413 | } |
| 414 | 414 | else |
| 415 | 415 | { |
| 416 | - if(isset($args->is_skin_fix)) |
|
| 416 | + if (isset($args->is_skin_fix)) |
|
| 417 | 417 | { |
| 418 | 418 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 419 | 419 | } |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if($args->mskin == '/USE_DEFAULT/') |
|
| 426 | + if ($args->mskin == '/USE_DEFAULT/') |
|
| 427 | 427 | { |
| 428 | 428 | $args->is_mskin_fix = 'N'; |
| 429 | 429 | } |
| 430 | 430 | else |
| 431 | 431 | { |
| 432 | - if(isset($args->is_mskin_fix)) |
|
| 432 | + if (isset($args->is_mskin_fix)) |
|
| 433 | 433 | { |
| 434 | 434 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 435 | 435 | } |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $args->browser_title = strip_tags($args->browser_title); |
| 445 | 445 | |
| 446 | - if($isMenuCreate == TRUE) |
|
| 446 | + if ($isMenuCreate == TRUE) |
|
| 447 | 447 | { |
| 448 | 448 | $menuArgs = new stdClass; |
| 449 | 449 | $menuArgs->menu_srl = $args->menu_srl; |
| 450 | 450 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
| 451 | 451 | |
| 452 | 452 | // if menu is not created, create menu also. and does not supported that in virtual site. |
| 453 | - if(!$menuOutput->data && !$args->site_srl) |
|
| 453 | + if (!$menuOutput->data && !$args->site_srl) |
|
| 454 | 454 | { |
| 455 | 455 | $oMenuAdminModel = getAdminModel('menu'); |
| 456 | 456 | |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $menuArgs->listorder = $args->menu_item_srl * -1; |
| 469 | 469 | |
| 470 | 470 | $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); |
| 471 | - if(!$menuItemOutput->toBool()) |
|
| 471 | + if (!$menuItemOutput->toBool()) |
|
| 472 | 472 | { |
| 473 | 473 | $oDB->rollback(); |
| 474 | 474 | return $menuItemOutput; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // Insert a module |
| 482 | 482 | $args->menu_srl = $menuArgs->menu_srl; |
| 483 | 483 | $output = executeQuery('module.insertModule', $args); |
| 484 | - if(!$output->toBool()) |
|
| 484 | + if (!$output->toBool()) |
|
| 485 | 485 | { |
| 486 | 486 | $oDB->rollback(); |
| 487 | 487 | return $output; |
@@ -493,12 +493,12 @@ discard block |
||
| 493 | 493 | $oDB->commit(); |
| 494 | 494 | |
| 495 | 495 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 496 | - if($oCacheHandler->isSupport()) |
|
| 496 | + if ($oCacheHandler->isSupport()) |
|
| 497 | 497 | { |
| 498 | 498 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - $output->add('module_srl',$args->module_srl); |
|
| 501 | + $output->add('module_srl', $args->module_srl); |
|
| 502 | 502 | return $output; |
| 503 | 503 | } |
| 504 | 504 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | function updateModule($args) |
| 509 | 509 | { |
| 510 | 510 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 511 | - if(!$output->toBool()) return $output; |
|
| 511 | + if (!$output->toBool()) return $output; |
|
| 512 | 512 | // begin transaction |
| 513 | 513 | $oDB = &DB::getInstance(); |
| 514 | 514 | $oDB->begin(); |
@@ -517,29 +517,29 @@ discard block |
||
| 517 | 517 | $columnList = array('module_srl', 'site_srl', 'browser_title', 'mid'); |
| 518 | 518 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
| 519 | 519 | |
| 520 | - if(!$args->site_srl || !$args->browser_title) |
|
| 520 | + if (!$args->site_srl || !$args->browser_title) |
|
| 521 | 521 | { |
| 522 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
| 523 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 522 | + if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl; |
|
| 523 | + if (!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | $args->browser_title = strip_tags($args->browser_title); |
| 527 | 527 | |
| 528 | 528 | $output = executeQuery('module.isExistsModuleName', $args); |
| 529 | - if(!$output->toBool() || $output->data->count) |
|
| 529 | + if (!$output->toBool() || $output->data->count) |
|
| 530 | 530 | { |
| 531 | 531 | $oDB->rollback(); |
| 532 | 532 | return new Object(-1, 'msg_module_name_exists'); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | // default value |
| 536 | - if($args->skin == '/USE_DEFAULT/') |
|
| 536 | + if ($args->skin == '/USE_DEFAULT/') |
|
| 537 | 537 | { |
| 538 | 538 | $args->is_skin_fix = 'N'; |
| 539 | 539 | } |
| 540 | 540 | else |
| 541 | 541 | { |
| 542 | - if(isset($args->is_skin_fix)) |
|
| 542 | + if (isset($args->is_skin_fix)) |
|
| 543 | 543 | { |
| 544 | 544 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 545 | 545 | } |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if($args->mskin == '/USE_DEFAULT/') |
|
| 552 | + if ($args->mskin == '/USE_DEFAULT/') |
|
| 553 | 553 | { |
| 554 | 554 | $args->is_mskin_fix = 'N'; |
| 555 | 555 | } |
| 556 | 556 | else |
| 557 | 557 | { |
| 558 | - if(isset($args->is_mskin_fix)) |
|
| 558 | + if (isset($args->is_mskin_fix)) |
|
| 559 | 559 | { |
| 560 | 560 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 561 | 561 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | $output = executeQuery('module.updateModule', $args); |
| 568 | - if(!$output->toBool()) |
|
| 568 | + if (!$output->toBool()) |
|
| 569 | 569 | { |
| 570 | 570 | $oDB->rollback(); |
| 571 | 571 | return $output; |
@@ -575,15 +575,15 @@ discard block |
||
| 575 | 575 | $menuArgs->url = $module_info->mid; |
| 576 | 576 | $menuArgs->site_srl = $module_info->site_srl; |
| 577 | 577 | $menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs); |
| 578 | - if($menuOutput->data && count($menuOutput->data)) |
|
| 578 | + if ($menuOutput->data && count($menuOutput->data)) |
|
| 579 | 579 | { |
| 580 | 580 | $oMenuAdminController = getAdminController('menu'); |
| 581 | - foreach($menuOutput->data as $itemInfo) |
|
| 581 | + foreach ($menuOutput->data as $itemInfo) |
|
| 582 | 582 | { |
| 583 | 583 | $itemInfo->url = $args->mid; |
| 584 | 584 | |
| 585 | 585 | $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); |
| 586 | - if(!$updateMenuItemOutput->toBool()) |
|
| 586 | + if (!$updateMenuItemOutput->toBool()) |
|
| 587 | 587 | { |
| 588 | 588 | $oDB->rollback(); |
| 589 | 589 | return $updateMenuItemOutput; |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // if mid changed, change mid of success_return_url to new mid |
| 595 | - if($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
| 595 | + if ($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
| 596 | 596 | { |
| 597 | 597 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
| 598 | 598 | } |
@@ -602,11 +602,11 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | $oDB->commit(); |
| 604 | 604 | |
| 605 | - $output->add('module_srl',$args->module_srl); |
|
| 605 | + $output->add('module_srl', $args->module_srl); |
|
| 606 | 606 | |
| 607 | 607 | //remove from cache |
| 608 | 608 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 609 | - if($oCacheHandler->isSupport()) |
|
| 609 | + if ($oCacheHandler->isSupport()) |
|
| 610 | 610 | { |
| 611 | 611 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 612 | 612 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $args->update_id = $update_id; |
| 626 | 626 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
| 627 | 627 | |
| 628 | - if(!!$output->error) return false; |
|
| 628 | + if (!!$output->error) return false; |
|
| 629 | 629 | |
| 630 | 630 | return true; |
| 631 | 631 | } |
@@ -640,11 +640,11 @@ discard block |
||
| 640 | 640 | $args->site_srl = $site_srl; |
| 641 | 641 | $args->layout_srl = $layout_srl; |
| 642 | 642 | $output = executeQuery('module.updateModuleSite', $args); |
| 643 | - if(!$output->toBool()) return $output; |
|
| 643 | + if (!$output->toBool()) return $output; |
|
| 644 | 644 | |
| 645 | 645 | //remove from cache |
| 646 | 646 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 647 | - if($oCacheHandler->isSupport()) |
|
| 647 | + if ($oCacheHandler->isSupport()) |
|
| 648 | 648 | { |
| 649 | 649 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 650 | 650 | } |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | function deleteModule($module_srl, $site_srl = 0) |
| 661 | 661 | { |
| 662 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 662 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 663 | 663 | |
| 664 | 664 | $site_module_info = Context::get('site_module_info'); |
| 665 | 665 | |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $args = new stdClass(); |
| 670 | 670 | $args->url = $output->mid; |
| 671 | 671 | $args->is_shortcut = 'N'; |
| 672 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 672 | + if (!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 673 | 673 | else $args->site_srl = $site_srl; |
| 674 | 674 | |
| 675 | 675 | unset($output); |
@@ -678,9 +678,9 @@ discard block |
||
| 678 | 678 | $menuOutput = $oMenuAdminModel->getMenuList($args); |
| 679 | 679 | |
| 680 | 680 | // get menu_srl by site_srl |
| 681 | - if(is_array($menuOutput->data)) |
|
| 681 | + if (is_array($menuOutput->data)) |
|
| 682 | 682 | { |
| 683 | - foreach($menuOutput->data AS $key=>$value) |
|
| 683 | + foreach ($menuOutput->data AS $key=>$value) |
|
| 684 | 684 | { |
| 685 | 685 | $args->menu_srl = $value->menu_srl; |
| 686 | 686 | break; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
| 691 | 691 | // menu delete |
| 692 | - if($output->data) |
|
| 692 | + if ($output->data) |
|
| 693 | 693 | { |
| 694 | 694 | unset($args); |
| 695 | 695 | $args = new stdClass; |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | $oMenuAdminController = getAdminController('menu'); |
| 701 | 701 | $output = $oMenuAdminController->deleteItem($args); |
| 702 | 702 | |
| 703 | - if($output->isSuccess) |
|
| 703 | + if ($output->isSuccess) |
|
| 704 | 704 | { |
| 705 | 705 | return new Object(0, 'success_deleted'); |
| 706 | 706 | } |
@@ -722,19 +722,19 @@ discard block |
||
| 722 | 722 | */ |
| 723 | 723 | public function onlyDeleteModule($module_srl) |
| 724 | 724 | { |
| 725 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 725 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 726 | 726 | |
| 727 | 727 | // check start module |
| 728 | 728 | $oModuleModel = getModel('module'); |
| 729 | 729 | $columnList = array('sites.index_module_srl'); |
| 730 | 730 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 731 | - if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 731 | + if ($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 732 | 732 | |
| 733 | 733 | // Call a trigger (before) |
| 734 | 734 | $trigger_obj = new stdClass(); |
| 735 | 735 | $trigger_obj->module_srl = $module_srl; |
| 736 | 736 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
| 737 | - if(!$output->toBool()) return $output; |
|
| 737 | + if (!$output->toBool()) return $output; |
|
| 738 | 738 | |
| 739 | 739 | // begin transaction |
| 740 | 740 | $oDB = &DB::getInstance(); |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $args->module_srl = $module_srl; |
| 745 | 745 | // Delete module information from the DB |
| 746 | 746 | $output = executeQuery('module.deleteModule', $args); |
| 747 | - if(!$output->toBool()) |
|
| 747 | + if (!$output->toBool()) |
|
| 748 | 748 | { |
| 749 | 749 | $oDB->rollback(); |
| 750 | 750 | return $output; |
@@ -758,10 +758,10 @@ discard block |
||
| 758 | 758 | // Remove the module manager |
| 759 | 759 | $this->deleteAdminId($module_srl); |
| 760 | 760 | // Call a trigger (after) |
| 761 | - if($output->toBool()) |
|
| 761 | + if ($output->toBool()) |
|
| 762 | 762 | { |
| 763 | 763 | $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); |
| 764 | - if(!$trigger_output->toBool()) |
|
| 764 | + if (!$trigger_output->toBool()) |
|
| 765 | 765 | { |
| 766 | 766 | $oDB->rollback(); |
| 767 | 767 | return $trigger_output; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | //remove from cache |
| 775 | 775 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 776 | - if($oCacheHandler->isSupport()) |
|
| 776 | + if ($oCacheHandler->isSupport()) |
|
| 777 | 777 | { |
| 778 | 778 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 779 | 779 | } |
@@ -795,10 +795,10 @@ discard block |
||
| 795 | 795 | function clearDefaultModule() |
| 796 | 796 | { |
| 797 | 797 | $output = executeQuery('module.clearDefaultModule'); |
| 798 | - if(!$output->toBool()) return $output; |
|
| 798 | + if (!$output->toBool()) return $output; |
|
| 799 | 799 | |
| 800 | 800 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 801 | - if($oCacheHandler->isSupport()) |
|
| 801 | + if ($oCacheHandler->isSupport()) |
|
| 802 | 802 | { |
| 803 | 803 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 804 | 804 | } |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $output = executeQuery('module.updateModuleMenu', $args); |
| 815 | 815 | |
| 816 | 816 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 817 | - if($oCacheHandler->isSupport()) |
|
| 817 | + if ($oCacheHandler->isSupport()) |
|
| 818 | 818 | { |
| 819 | 819 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 820 | 820 | } |
@@ -827,15 +827,15 @@ discard block |
||
| 827 | 827 | */ |
| 828 | 828 | function updateModuleLayout($layout_srl, $menu_srl_list) |
| 829 | 829 | { |
| 830 | - if(!count($menu_srl_list)) return; |
|
| 830 | + if (!count($menu_srl_list)) return; |
|
| 831 | 831 | |
| 832 | 832 | $args = new stdClass; |
| 833 | 833 | $args->layout_srl = $layout_srl; |
| 834 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
| 834 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
| 835 | 835 | $output = executeQuery('module.updateModuleLayout', $args); |
| 836 | 836 | |
| 837 | 837 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 838 | - if($oCacheHandler->isSupport()) |
|
| 838 | + if ($oCacheHandler->isSupport()) |
|
| 839 | 839 | { |
| 840 | 840 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 841 | 841 | } |
@@ -854,37 +854,37 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | $output = executeQuery('module.deleteSiteAdmin', $args); |
| 856 | 856 | |
| 857 | - if(!$output->toBool()) return $output; |
|
| 857 | + if (!$output->toBool()) return $output; |
|
| 858 | 858 | // Get user id of an administrator |
| 859 | - if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
| 860 | - foreach($arr_admins as $key => $user_id) |
|
| 859 | + if (!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
| 860 | + foreach ($arr_admins as $key => $user_id) |
|
| 861 | 861 | { |
| 862 | - if(!trim($user_id)) continue; |
|
| 862 | + if (!trim($user_id)) continue; |
|
| 863 | 863 | $admins[] = trim($user_id); |
| 864 | 864 | } |
| 865 | - if(!count($admins)) return new Object(); |
|
| 865 | + if (!count($admins)) return new Object(); |
|
| 866 | 866 | |
| 867 | 867 | $oMemberModel = getModel('member'); |
| 868 | 868 | $member_config = $oMemberModel->getMemberConfig(); |
| 869 | - if($member_config->identifier == 'email_address') |
|
| 869 | + if ($member_config->identifier == 'email_address') |
|
| 870 | 870 | { |
| 871 | - $args->email_address = '\''.implode('\',\'',$admins).'\''; |
|
| 871 | + $args->email_address = '\''.implode('\',\'', $admins).'\''; |
|
| 872 | 872 | } |
| 873 | 873 | else |
| 874 | 874 | { |
| 875 | - $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
|
| 875 | + $args->user_ids = '\''.implode('\',\'', $admins).'\''; |
|
| 876 | 876 | } |
| 877 | 877 | $output = executeQueryArray('module.getAdminSrls', $args); |
| 878 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 878 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 879 | 879 | |
| 880 | - foreach($output->data as $key => $val) |
|
| 880 | + foreach ($output->data as $key => $val) |
|
| 881 | 881 | { |
| 882 | 882 | unset($args); |
| 883 | 883 | $args = new stdClass; |
| 884 | 884 | $args->site_srl = $site_srl; |
| 885 | 885 | $args->member_srl = $val->member_srl; |
| 886 | 886 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
| 887 | - if(!$output->toBool()) return $output; |
|
| 887 | + if (!$output->toBool()) return $output; |
|
| 888 | 888 | } |
| 889 | 889 | return new Object(); |
| 890 | 890 | } |
@@ -897,12 +897,12 @@ discard block |
||
| 897 | 897 | $oMemberModel = getModel('member'); |
| 898 | 898 | $member_config = $oMemberModel->getMemberConfig(); |
| 899 | 899 | |
| 900 | - if($member_config->identifier == 'email_address') |
|
| 900 | + if ($member_config->identifier == 'email_address') |
|
| 901 | 901 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
| 902 | 902 | else |
| 903 | 903 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 904 | 904 | |
| 905 | - if(!$member_info->member_srl) return; |
|
| 905 | + if (!$member_info->member_srl) return; |
|
| 906 | 906 | $args = new stdClass(); |
| 907 | 907 | $args->module_srl = $module_srl; |
| 908 | 908 | $args->member_srl = $member_info->member_srl; |
@@ -917,11 +917,11 @@ discard block |
||
| 917 | 917 | $args = new stdClass(); |
| 918 | 918 | $args->module_srl = $module_srl; |
| 919 | 919 | |
| 920 | - if($admin_id) |
|
| 920 | + if ($admin_id) |
|
| 921 | 921 | { |
| 922 | 922 | $oMemberModel = getModel('member'); |
| 923 | 923 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 924 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 924 | + if ($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 925 | 925 | } |
| 926 | 926 | return executeQuery('module.deleteAdminId', $args); |
| 927 | 927 | } |
@@ -958,18 +958,18 @@ discard block |
||
| 958 | 958 | $oDB->begin(); |
| 959 | 959 | |
| 960 | 960 | $output = $this->_deleteModuleSkinVars($module_srl, $mode); |
| 961 | - if(!$output->toBool()) |
|
| 961 | + if (!$output->toBool()) |
|
| 962 | 962 | { |
| 963 | 963 | $oDB->rollback(); |
| 964 | 964 | return $output; |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | getDestroyXeVars($obj); |
| 968 | - if(!$obj || !count($obj)) return new Object(); |
|
| 968 | + if (!$obj || !count($obj)) return new Object(); |
|
| 969 | 969 | |
| 970 | 970 | $args = new stdClass; |
| 971 | 971 | $args->module_srl = $module_srl; |
| 972 | - foreach($obj as $key => $val) |
|
| 972 | + foreach ($obj as $key => $val) |
|
| 973 | 973 | { |
| 974 | 974 | // #17927989 For an old board which used the old blog module |
| 975 | 975 | // it often saved menu item(stdClass) on the skin info column |
@@ -980,9 +980,9 @@ discard block |
||
| 980 | 980 | |
| 981 | 981 | $args->name = trim($key); |
| 982 | 982 | $args->value = trim($val); |
| 983 | - if(!$args->name || !$args->value) continue; |
|
| 983 | + if (!$args->name || !$args->value) continue; |
|
| 984 | 984 | |
| 985 | - if($mode === 'P') |
|
| 985 | + if ($mode === 'P') |
|
| 986 | 986 | { |
| 987 | 987 | $output = executeQuery('module.insertModuleSkinVars', $args); |
| 988 | 988 | } |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | { |
| 991 | 991 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
| 992 | 992 | } |
| 993 | - if(!$output->toBool()) |
|
| 993 | + if (!$output->toBool()) |
|
| 994 | 994 | { |
| 995 | 995 | return $output; |
| 996 | 996 | $oDB->rollback(); |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | $args->module_srl = $module_srl; |
| 1030 | 1030 | $mode = $mode === 'P' ? 'P' : 'M'; |
| 1031 | 1031 | |
| 1032 | - if($mode === 'P') |
|
| 1032 | + if ($mode === 'P') |
|
| 1033 | 1033 | { |
| 1034 | 1034 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1035 | 1035 | $query = 'module.deleteModuleSkinVars'; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | //remove from cache |
| 1044 | 1044 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1045 | 1045 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1046 | - if($oCacheHandler->isSupport()) |
|
| 1046 | + if ($oCacheHandler->isSupport()) |
|
| 1047 | 1047 | { |
| 1048 | 1048 | $oCacheHandler->delete($cache_key); |
| 1049 | 1049 | } |
@@ -1058,22 +1058,22 @@ discard block |
||
| 1058 | 1058 | { |
| 1059 | 1059 | $this->deleteModuleExtraVars($module_srl); |
| 1060 | 1060 | getDestroyXeVars($obj); |
| 1061 | - if(!$obj || !count($obj)) return; |
|
| 1061 | + if (!$obj || !count($obj)) return; |
|
| 1062 | 1062 | |
| 1063 | - foreach($obj as $key => $val) |
|
| 1063 | + foreach ($obj as $key => $val) |
|
| 1064 | 1064 | { |
| 1065 | - if(is_object($val) || is_array($val)) continue; |
|
| 1065 | + if (is_object($val) || is_array($val)) continue; |
|
| 1066 | 1066 | |
| 1067 | 1067 | $args = new stdClass(); |
| 1068 | 1068 | $args->module_srl = $module_srl; |
| 1069 | 1069 | $args->name = trim($key); |
| 1070 | 1070 | $args->value = trim($val); |
| 1071 | - if(!$args->name || !$args->value) continue; |
|
| 1071 | + if (!$args->name || !$args->value) continue; |
|
| 1072 | 1072 | $output = executeQuery('module.insertModuleExtraVars', $args); |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1076 | - if($oCacheHandler->isSupport()) |
|
| 1076 | + if ($oCacheHandler->isSupport()) |
|
| 1077 | 1077 | { |
| 1078 | 1078 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1079 | 1079 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | |
| 1093 | 1093 | //remove from cache |
| 1094 | 1094 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1095 | - if($oCacheHandler->isSupport()) |
|
| 1095 | + if ($oCacheHandler->isSupport()) |
|
| 1096 | 1096 | { |
| 1097 | 1097 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1098 | 1098 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1108,19 +1108,19 @@ discard block |
||
| 1108 | 1108 | function insertModuleGrants($module_srl, $obj) |
| 1109 | 1109 | { |
| 1110 | 1110 | $this->deleteModuleGrants($module_srl); |
| 1111 | - if(!$obj || !count($obj)) return; |
|
| 1111 | + if (!$obj || !count($obj)) return; |
|
| 1112 | 1112 | |
| 1113 | - foreach($obj as $name => $val) |
|
| 1113 | + foreach ($obj as $name => $val) |
|
| 1114 | 1114 | { |
| 1115 | - if(!$val || !count($val)) continue; |
|
| 1115 | + if (!$val || !count($val)) continue; |
|
| 1116 | 1116 | |
| 1117 | - foreach($val as $group_srl) |
|
| 1117 | + foreach ($val as $group_srl) |
|
| 1118 | 1118 | { |
| 1119 | 1119 | $args = new stdClass(); |
| 1120 | 1120 | $args->module_srl = $module_srl; |
| 1121 | 1121 | $args->name = $name; |
| 1122 | 1122 | $args->group_srl = trim($group_srl); |
| 1123 | - if(!$args->name || !$args->group_srl) continue; |
|
| 1123 | + if (!$args->name || !$args->group_srl) continue; |
|
| 1124 | 1124 | executeQuery('module.insertModuleGrant', $args); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
@@ -1141,9 +1141,9 @@ discard block |
||
| 1141 | 1141 | */ |
| 1142 | 1142 | function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) |
| 1143 | 1143 | { |
| 1144 | - if($isReplaceLangCode) |
|
| 1144 | + if ($isReplaceLangCode) |
|
| 1145 | 1145 | { |
| 1146 | - $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); |
|
| 1146 | + $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | } |
| 1149 | 1149 | |
@@ -1151,27 +1151,27 @@ discard block |
||
| 1151 | 1151 | { |
| 1152 | 1152 | static $lang = null; |
| 1153 | 1153 | |
| 1154 | - if(is_null($lang)) |
|
| 1154 | + if (is_null($lang)) |
|
| 1155 | 1155 | { |
| 1156 | 1156 | $site_module_info = Context::get('site_module_info'); |
| 1157 | - if(!$site_module_info) |
|
| 1157 | + if (!$site_module_info) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | $oModuleModel = getModel('module'); |
| 1160 | 1160 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 1161 | 1161 | Context::set('site_module_info', $site_module_info); |
| 1162 | 1162 | } |
| 1163 | 1163 | $cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType()); |
| 1164 | - if(!file_exists($cache_file)) |
|
| 1164 | + if (!file_exists($cache_file)) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $oModuleAdminController = getAdminController('module'); |
| 1167 | 1167 | $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | - if(file_exists($cache_file)) |
|
| 1170 | + if (file_exists($cache_file)) |
|
| 1171 | 1171 | { |
| 1172 | - $moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php'); |
|
| 1172 | + $moduleAdminControllerMtime = filemtime(_XE_PATH_.'modules/module/module.admin.controller.php'); |
|
| 1173 | 1173 | $cacheFileMtime = filemtime($cache_file); |
| 1174 | - if($cacheFileMtime < $moduleAdminControllerMtime) |
|
| 1174 | + if ($cacheFileMtime < $moduleAdminControllerMtime) |
|
| 1175 | 1175 | { |
| 1176 | 1176 | $oModuleAdminController = getAdminController('module'); |
| 1177 | 1177 | $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
@@ -1180,9 +1180,9 @@ discard block |
||
| 1180 | 1180 | require_once($cache_file); |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1183 | + if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1184 | 1184 | |
| 1185 | - return str_replace('$user_lang->','',$matches[0]); |
|
| 1185 | + return str_replace('$user_lang->', '', $matches[0]); |
|
| 1186 | 1186 | } |
| 1187 | 1187 | |
| 1188 | 1188 | |
@@ -1195,17 +1195,17 @@ discard block |
||
| 1195 | 1195 | if ($ajax) Context::setRequestMethod('JSON'); |
| 1196 | 1196 | |
| 1197 | 1197 | $logged_info = Context::get('logged_info'); |
| 1198 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1198 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1199 | 1199 | |
| 1200 | - $vars = Context::gets('addfile','filter'); |
|
| 1200 | + $vars = Context::gets('addfile', 'filter'); |
|
| 1201 | 1201 | $attributeNames = Context::get('attribute_name'); |
| 1202 | 1202 | $attributeValues = Context::get('attribute_value'); |
| 1203 | - if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
| 1203 | + if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | $attributes = array(); |
| 1206 | - foreach($attributeNames as $no => $name) |
|
| 1206 | + foreach ($attributeNames as $no => $name) |
|
| 1207 | 1207 | { |
| 1208 | - if(empty($name)) |
|
| 1208 | + if (empty($name)) |
|
| 1209 | 1209 | { |
| 1210 | 1210 | continue; |
| 1211 | 1211 | } |
@@ -1217,16 +1217,16 @@ discard block |
||
| 1217 | 1217 | $vars->comment = $attributes; |
| 1218 | 1218 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1219 | 1219 | |
| 1220 | - $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1220 | + $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1221 | 1221 | $vars->ext = $ext; |
| 1222 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
| 1223 | - else $filter = array('jpg','jpeg','gif','png'); |
|
| 1224 | - if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured'); |
|
| 1222 | + if ($vars->filter) $filter = explode(',', $vars->filter); |
|
| 1223 | + else $filter = array('jpg', 'jpeg', 'gif', 'png'); |
|
| 1224 | + if (!in_array($ext, $filter)) return new Object(-1, 'msg_error_occured'); |
|
| 1225 | 1225 | |
| 1226 | 1226 | $vars->member_srl = $logged_info->member_srl; |
| 1227 | 1227 | |
| 1228 | 1228 | // update |
| 1229 | - if($module_filebox_srl > 0) |
|
| 1229 | + if ($module_filebox_srl > 0) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1232 | 1232 | $output = $this->updateModuleFileBox($vars); |
@@ -1234,10 +1234,10 @@ discard block |
||
| 1234 | 1234 | // insert |
| 1235 | 1235 | else |
| 1236 | 1236 | { |
| 1237 | - if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
| 1237 | + if (!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
| 1238 | 1238 | $addfile = Context::get('addfile'); |
| 1239 | - if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
| 1240 | - if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
| 1239 | + if (!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
| 1240 | + if ($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
| 1241 | 1241 | $output = $this->insertModuleFileBox($vars); |
| 1242 | 1242 | } |
| 1243 | 1243 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | } |
| 1252 | 1252 | else |
| 1253 | 1253 | { |
| 1254 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1254 | + if ($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1255 | 1255 | else $this->add('save_filename', ''); |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | { |
| 1264 | 1264 | $args = new stdClass; |
| 1265 | 1265 | // have file |
| 1266 | - if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
| 1266 | + if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
| 1267 | 1267 | { |
| 1268 | 1268 | $oModuleModel = getModel('module'); |
| 1269 | 1269 | $output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl); |
@@ -1272,18 +1272,18 @@ discard block |
||
| 1272 | 1272 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
| 1273 | 1273 | FileHandler::makeDir($path); |
| 1274 | 1274 | |
| 1275 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext); |
|
| 1275 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext); |
|
| 1276 | 1276 | $tmp = $vars->addfile['tmp_name']; |
| 1277 | 1277 | |
| 1278 | 1278 | // Check uploaded file |
| 1279 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1279 | + if (!checkUploadedFile($tmp)) return false; |
|
| 1280 | 1280 | |
| 1281 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
| 1281 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
| 1282 | 1282 | { |
| 1283 | 1283 | return false; |
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1286 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1287 | 1287 | $args->filename = $save_filename; |
| 1288 | 1288 | $args->filesize = $vars->addfile['size']; |
| 1289 | 1289 | } |
@@ -1309,14 +1309,14 @@ discard block |
||
| 1309 | 1309 | $oModuleModel = getModel('module'); |
| 1310 | 1310 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
| 1311 | 1311 | FileHandler::makeDir($path); |
| 1312 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext); |
|
| 1312 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext); |
|
| 1313 | 1313 | $tmp = $vars->addfile['tmp_name']; |
| 1314 | 1314 | |
| 1315 | 1315 | // Check uploaded file |
| 1316 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1316 | + if (!checkUploadedFile($tmp)) return false; |
|
| 1317 | 1317 | |
| 1318 | 1318 | // upload |
| 1319 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
| 1319 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
| 1320 | 1320 | { |
| 1321 | 1321 | return false; |
| 1322 | 1322 | } |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | $args->member_srl = $vars->member_srl; |
| 1328 | 1328 | $args->comment = $vars->comment; |
| 1329 | 1329 | $args->filename = $save_filename; |
| 1330 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1330 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1331 | 1331 | $args->filesize = $vars->addfile['size']; |
| 1332 | 1332 | |
| 1333 | 1333 | $output = executeQuery('module.insertModuleFileBox', $args); |
@@ -1342,14 +1342,14 @@ discard block |
||
| 1342 | 1342 | function procModuleFileBoxDelete() |
| 1343 | 1343 | { |
| 1344 | 1344 | $logged_info = Context::get('logged_info'); |
| 1345 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1345 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1346 | 1346 | |
| 1347 | 1347 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1348 | - if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1348 | + if (!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1349 | 1349 | $vars = new stdClass(); |
| 1350 | 1350 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1351 | 1351 | $output = $this->deleteModuleFileBox($vars); |
| 1352 | - if(!$output->toBool()) return $output; |
|
| 1352 | + if (!$output->toBool()) return $output; |
|
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | function deleteModuleFileBox($vars) |
@@ -1372,11 +1372,11 @@ discard block |
||
| 1372 | 1372 | $this->unlockTimeoutPassed(); |
| 1373 | 1373 | $args = new stdClass; |
| 1374 | 1374 | $args->lock_name = $lock_name; |
| 1375 | - if(!$timeout) $timeout = 60; |
|
| 1375 | + if (!$timeout) $timeout = 60; |
|
| 1376 | 1376 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
| 1377 | - if($member_srl) $args->member_srl = $member_srl; |
|
| 1377 | + if ($member_srl) $args->member_srl = $member_srl; |
|
| 1378 | 1378 | $output = executeQuery('module.insertLock', $args); |
| 1379 | - if($output->toBool()) |
|
| 1379 | + if ($output->toBool()) |
|
| 1380 | 1380 | { |
| 1381 | 1381 | $output->add('lock_name', $lock_name); |
| 1382 | 1382 | $output->add('deadline', $args->deadline); |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | $output = executeQuery('module.updateModuleInSites', $args); |
| 1406 | 1406 | |
| 1407 | 1407 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1408 | - if($oCacheHandler->isSupport()) |
|
| 1408 | + if ($oCacheHandler->isSupport()) |
|
| 1409 | 1409 | { |
| 1410 | 1410 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 1411 | 1411 | } |
@@ -150,9 +150,15 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
| 152 | 152 | { |
| 153 | - if($kind != 'admin') $kind = ''; |
|
| 154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
| 155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
| 153 | + if($kind != 'admin') { |
|
| 154 | + $kind = ''; |
|
| 155 | + } |
|
| 156 | + if(!in_array($type,array('model','controller','view','api','mobile'))) { |
|
| 157 | + return false; |
|
| 158 | + } |
|
| 159 | + if(in_array($parent_module, array('module','addon','widget','layout'))) { |
|
| 160 | + return false; |
|
| 161 | + } |
|
| 156 | 162 | |
| 157 | 163 | $cache_file = './files/config/module_extend.php'; |
| 158 | 164 | FileHandler::removeFile($cache_file); |
@@ -164,7 +170,9 @@ discard block |
||
| 164 | 170 | $args->kind = $kind; |
| 165 | 171 | |
| 166 | 172 | $output = executeQuery('module.getModuleExtendCount', $args); |
| 167 | - if($output->data->count>0) return false; |
|
| 173 | + if($output->data->count>0) { |
|
| 174 | + return false; |
|
| 175 | + } |
|
| 168 | 176 | |
| 169 | 177 | $output = executeQuery('module.insertModuleExtend', $args); |
| 170 | 178 | return $output; |
@@ -199,7 +207,9 @@ discard block |
||
| 199 | 207 | $oModuleModel = getModel('module'); |
| 200 | 208 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
| 201 | 209 | |
| 202 | - if(!$origin_config) $origin_config = new stdClass; |
|
| 210 | + if(!$origin_config) { |
|
| 211 | + $origin_config = new stdClass; |
|
| 212 | + } |
|
| 203 | 213 | |
| 204 | 214 | foreach($config as $key => $val) |
| 205 | 215 | { |
@@ -221,7 +231,9 @@ discard block |
||
| 221 | 231 | $args->site_srl = $site_srl; |
| 222 | 232 | |
| 223 | 233 | $output = executeQuery('module.deleteModuleConfig', $args); |
| 224 | - if(!$output->toBool()) return $output; |
|
| 234 | + if(!$output->toBool()) { |
|
| 235 | + return $output; |
|
| 236 | + } |
|
| 225 | 237 | |
| 226 | 238 | $output = executeQuery('module.insertModuleConfig', $args); |
| 227 | 239 | |
@@ -246,7 +258,9 @@ discard block |
||
| 246 | 258 | $args->config = serialize($config); |
| 247 | 259 | |
| 248 | 260 | $output = executeQuery('module.deleteModulePartConfig', $args); |
| 249 | - if(!$output->toBool()) return $output; |
|
| 261 | + if(!$output->toBool()) { |
|
| 262 | + return $output; |
|
| 263 | + } |
|
| 250 | 264 | |
| 251 | 265 | $output = executeQuery('module.insertModulePartConfig', $args); |
| 252 | 266 | |
@@ -268,9 +282,10 @@ discard block |
||
| 268 | 282 | if(isSiteID($domain)) |
| 269 | 283 | { |
| 270 | 284 | $oModuleModel = getModel('module'); |
| 271 | - if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid'); |
|
| 272 | - } |
|
| 273 | - else |
|
| 285 | + if($oModuleModel->isIDExists($domain, 0)) { |
|
| 286 | + return new Object(-1,'msg_already_registed_vid'); |
|
| 287 | + } |
|
| 288 | + } else |
|
| 274 | 289 | { |
| 275 | 290 | $domain = strtolower($domain); |
| 276 | 291 | } |
@@ -284,10 +299,14 @@ discard block |
||
| 284 | 299 | $columnList = array('modules.site_srl'); |
| 285 | 300 | $oModuleModel = getModel('module'); |
| 286 | 301 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 287 | - if($output) return new Object(-1,'msg_already_registed_vid'); |
|
| 302 | + if($output) { |
|
| 303 | + return new Object(-1,'msg_already_registed_vid'); |
|
| 304 | + } |
|
| 288 | 305 | |
| 289 | 306 | $output = executeQuery('module.insertSite', $args); |
| 290 | - if(!$output->toBool()) return $output; |
|
| 307 | + if(!$output->toBool()) { |
|
| 308 | + return $output; |
|
| 309 | + } |
|
| 291 | 310 | |
| 292 | 311 | $output->add('site_srl', $args->site_srl); |
| 293 | 312 | return $output; |
@@ -310,8 +329,12 @@ discard block |
||
| 310 | 329 | if($site_info->domain != $args->domain) |
| 311 | 330 | { |
| 312 | 331 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain'); |
|
| 314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid'); |
|
| 332 | + if($info->site_srl && $info->site_srl != $args->site_srl) { |
|
| 333 | + return new Object(-1,'msg_already_registed_domain'); |
|
| 334 | + } |
|
| 335 | + if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) { |
|
| 336 | + return new Object(-1,'msg_already_registed_vid'); |
|
| 337 | + } |
|
| 315 | 338 | |
| 316 | 339 | if($args->domain && !isSiteID($args->domain)) |
| 317 | 340 | { |
@@ -320,8 +343,11 @@ discard block |
||
| 320 | 343 | } |
| 321 | 344 | $output = executeQuery('module.updateSite', $args); |
| 322 | 345 | //clear cache for default mid |
| 323 | - if($args->site_srl == 0) $vid=''; |
|
| 324 | - else $vid=$args->domain; |
|
| 346 | + if($args->site_srl == 0) { |
|
| 347 | + $vid=''; |
|
| 348 | + } else { |
|
| 349 | + $vid=$args->domain; |
|
| 350 | + } |
|
| 325 | 351 | |
| 326 | 352 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
| 327 | 353 | $mid = $module_info->mid; |
@@ -345,7 +371,9 @@ discard block |
||
| 345 | 371 | unset($args->act); |
| 346 | 372 | unset($args->page); |
| 347 | 373 | // Test mid value |
| 348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 374 | + if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) { |
|
| 375 | + return new Object(-1, 'msg_limit_mid'); |
|
| 376 | + } |
|
| 349 | 377 | // Test variables (separate basic vars and other vars in modules) |
| 350 | 378 | $extra_vars = clone($args); |
| 351 | 379 | unset($extra_vars->module_srl); |
@@ -382,18 +410,23 @@ discard block |
||
| 382 | 410 | if(isset($args->isMenuCreate)) |
| 383 | 411 | { |
| 384 | 412 | $isMenuCreate = $args->isMenuCreate; |
| 385 | - } |
|
| 386 | - else |
|
| 413 | + } else |
|
| 387 | 414 | { |
| 388 | 415 | $isMenuCreate = TRUE; |
| 389 | 416 | } |
| 390 | 417 | |
| 391 | 418 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 392 | - if(!$output->toBool()) return $output; |
|
| 419 | + if(!$output->toBool()) { |
|
| 420 | + return $output; |
|
| 421 | + } |
|
| 393 | 422 | // Check whether the module name already exists |
| 394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 423 | + if(!$args->site_srl) { |
|
| 424 | + $args->site_srl = 0; |
|
| 425 | + } |
|
| 395 | 426 | $oModuleModel = getModel('module'); |
| 396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
| 427 | + if($oModuleModel->isIDExists($args->mid, $args->site_srl)) { |
|
| 428 | + return new Object(-1, 'msg_module_name_exists'); |
|
| 429 | + } |
|
| 397 | 430 | |
| 398 | 431 | // begin transaction |
| 399 | 432 | $oDB = &DB::getInstance(); |
@@ -404,20 +437,20 @@ discard block |
||
| 404 | 437 | $skin_vars = new stdClass(); |
| 405 | 438 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
| 406 | 439 | // Arrange variables and then execute a query |
| 407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 440 | + if(!$args->module_srl) { |
|
| 441 | + $args->module_srl = getNextSequence(); |
|
| 442 | + } |
|
| 408 | 443 | |
| 409 | 444 | // default value |
| 410 | 445 | if($args->skin == '/USE_DEFAULT/') |
| 411 | 446 | { |
| 412 | 447 | $args->is_skin_fix = 'N'; |
| 413 | - } |
|
| 414 | - else |
|
| 448 | + } else |
|
| 415 | 449 | { |
| 416 | 450 | if(isset($args->is_skin_fix)) |
| 417 | 451 | { |
| 418 | 452 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 419 | - } |
|
| 420 | - else |
|
| 453 | + } else |
|
| 421 | 454 | { |
| 422 | 455 | $args->is_skin_fix = 'Y'; |
| 423 | 456 | } |
@@ -426,14 +459,12 @@ discard block |
||
| 426 | 459 | if($args->mskin == '/USE_DEFAULT/') |
| 427 | 460 | { |
| 428 | 461 | $args->is_mskin_fix = 'N'; |
| 429 | - } |
|
| 430 | - else |
|
| 462 | + } else |
|
| 431 | 463 | { |
| 432 | 464 | if(isset($args->is_mskin_fix)) |
| 433 | 465 | { |
| 434 | 466 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 435 | - } |
|
| 436 | - else |
|
| 467 | + } else |
|
| 437 | 468 | { |
| 438 | 469 | $args->is_mskin_fix = 'Y'; |
| 439 | 470 | } |
@@ -508,7 +539,9 @@ discard block |
||
| 508 | 539 | function updateModule($args) |
| 509 | 540 | { |
| 510 | 541 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 511 | - if(!$output->toBool()) return $output; |
|
| 542 | + if(!$output->toBool()) { |
|
| 543 | + return $output; |
|
| 544 | + } |
|
| 512 | 545 | // begin transaction |
| 513 | 546 | $oDB = &DB::getInstance(); |
| 514 | 547 | $oDB->begin(); |
@@ -519,8 +552,12 @@ discard block |
||
| 519 | 552 | |
| 520 | 553 | if(!$args->site_srl || !$args->browser_title) |
| 521 | 554 | { |
| 522 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
| 523 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 555 | + if(!$args->site_srl) { |
|
| 556 | + $args->site_srl = (int)$module_info->site_srl; |
|
| 557 | + } |
|
| 558 | + if(!$args->browser_title) { |
|
| 559 | + $args->browser_title = $module_info->browser_title; |
|
| 560 | + } |
|
| 524 | 561 | } |
| 525 | 562 | |
| 526 | 563 | $args->browser_title = strip_tags($args->browser_title); |
@@ -536,14 +573,12 @@ discard block |
||
| 536 | 573 | if($args->skin == '/USE_DEFAULT/') |
| 537 | 574 | { |
| 538 | 575 | $args->is_skin_fix = 'N'; |
| 539 | - } |
|
| 540 | - else |
|
| 576 | + } else |
|
| 541 | 577 | { |
| 542 | 578 | if(isset($args->is_skin_fix)) |
| 543 | 579 | { |
| 544 | 580 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 545 | - } |
|
| 546 | - else |
|
| 581 | + } else |
|
| 547 | 582 | { |
| 548 | 583 | $args->is_skin_fix = 'Y'; |
| 549 | 584 | } |
@@ -552,14 +587,12 @@ discard block |
||
| 552 | 587 | if($args->mskin == '/USE_DEFAULT/') |
| 553 | 588 | { |
| 554 | 589 | $args->is_mskin_fix = 'N'; |
| 555 | - } |
|
| 556 | - else |
|
| 590 | + } else |
|
| 557 | 591 | { |
| 558 | 592 | if(isset($args->is_mskin_fix)) |
| 559 | 593 | { |
| 560 | 594 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 561 | - } |
|
| 562 | - else |
|
| 595 | + } else |
|
| 563 | 596 | { |
| 564 | 597 | $args->is_mskin_fix = 'Y'; |
| 565 | 598 | } |
@@ -625,7 +658,9 @@ discard block |
||
| 625 | 658 | $args->update_id = $update_id; |
| 626 | 659 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
| 627 | 660 | |
| 628 | - if(!!$output->error) return false; |
|
| 661 | + if(!!$output->error) { |
|
| 662 | + return false; |
|
| 663 | + } |
|
| 629 | 664 | |
| 630 | 665 | return true; |
| 631 | 666 | } |
@@ -640,7 +675,9 @@ discard block |
||
| 640 | 675 | $args->site_srl = $site_srl; |
| 641 | 676 | $args->layout_srl = $layout_srl; |
| 642 | 677 | $output = executeQuery('module.updateModuleSite', $args); |
| 643 | - if(!$output->toBool()) return $output; |
|
| 678 | + if(!$output->toBool()) { |
|
| 679 | + return $output; |
|
| 680 | + } |
|
| 644 | 681 | |
| 645 | 682 | //remove from cache |
| 646 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -659,7 +696,9 @@ discard block |
||
| 659 | 696 | */ |
| 660 | 697 | function deleteModule($module_srl, $site_srl = 0) |
| 661 | 698 | { |
| 662 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 699 | + if(!$module_srl) { |
|
| 700 | + return new Object(-1,'msg_invalid_request'); |
|
| 701 | + } |
|
| 663 | 702 | |
| 664 | 703 | $site_module_info = Context::get('site_module_info'); |
| 665 | 704 | |
@@ -669,8 +708,11 @@ discard block |
||
| 669 | 708 | $args = new stdClass(); |
| 670 | 709 | $args->url = $output->mid; |
| 671 | 710 | $args->is_shortcut = 'N'; |
| 672 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 673 | - else $args->site_srl = $site_srl; |
|
| 711 | + if(!$site_srl) { |
|
| 712 | + $args->site_srl = $site_module_info->site_srl; |
|
| 713 | + } else { |
|
| 714 | + $args->site_srl = $site_srl; |
|
| 715 | + } |
|
| 674 | 716 | |
| 675 | 717 | unset($output); |
| 676 | 718 | |
@@ -703,8 +745,7 @@ discard block |
||
| 703 | 745 | if($output->isSuccess) |
| 704 | 746 | { |
| 705 | 747 | return new Object(0, 'success_deleted'); |
| 706 | - } |
|
| 707 | - else |
|
| 748 | + } else |
|
| 708 | 749 | { |
| 709 | 750 | return new Object($output->error, $output->message); |
| 710 | 751 | } |
@@ -722,19 +763,25 @@ discard block |
||
| 722 | 763 | */ |
| 723 | 764 | public function onlyDeleteModule($module_srl) |
| 724 | 765 | { |
| 725 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 766 | + if(!$module_srl) { |
|
| 767 | + return new Object(-1,'msg_invalid_request'); |
|
| 768 | + } |
|
| 726 | 769 | |
| 727 | 770 | // check start module |
| 728 | 771 | $oModuleModel = getModel('module'); |
| 729 | 772 | $columnList = array('sites.index_module_srl'); |
| 730 | 773 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 731 | - if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 774 | + if($module_srl == $start_module->index_module_srl) { |
|
| 775 | + return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 776 | + } |
|
| 732 | 777 | |
| 733 | 778 | // Call a trigger (before) |
| 734 | 779 | $trigger_obj = new stdClass(); |
| 735 | 780 | $trigger_obj->module_srl = $module_srl; |
| 736 | 781 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
| 737 | - if(!$output->toBool()) return $output; |
|
| 782 | + if(!$output->toBool()) { |
|
| 783 | + return $output; |
|
| 784 | + } |
|
| 738 | 785 | |
| 739 | 786 | // begin transaction |
| 740 | 787 | $oDB = &DB::getInstance(); |
@@ -795,7 +842,9 @@ discard block |
||
| 795 | 842 | function clearDefaultModule() |
| 796 | 843 | { |
| 797 | 844 | $output = executeQuery('module.clearDefaultModule'); |
| 798 | - if(!$output->toBool()) return $output; |
|
| 845 | + if(!$output->toBool()) { |
|
| 846 | + return $output; |
|
| 847 | + } |
|
| 799 | 848 | |
| 800 | 849 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 801 | 850 | if($oCacheHandler->isSupport()) |
@@ -827,7 +876,9 @@ discard block |
||
| 827 | 876 | */ |
| 828 | 877 | function updateModuleLayout($layout_srl, $menu_srl_list) |
| 829 | 878 | { |
| 830 | - if(!count($menu_srl_list)) return; |
|
| 879 | + if(!count($menu_srl_list)) { |
|
| 880 | + return; |
|
| 881 | + } |
|
| 831 | 882 | |
| 832 | 883 | $args = new stdClass; |
| 833 | 884 | $args->layout_srl = $layout_srl; |
@@ -854,28 +905,37 @@ discard block |
||
| 854 | 905 | |
| 855 | 906 | $output = executeQuery('module.deleteSiteAdmin', $args); |
| 856 | 907 | |
| 857 | - if(!$output->toBool()) return $output; |
|
| 908 | + if(!$output->toBool()) { |
|
| 909 | + return $output; |
|
| 910 | + } |
|
| 858 | 911 | // Get user id of an administrator |
| 859 | - if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
| 912 | + if(!is_array($arr_admins) || !count($arr_admins)) { |
|
| 913 | + return new Object(); |
|
| 914 | + } |
|
| 860 | 915 | foreach($arr_admins as $key => $user_id) |
| 861 | 916 | { |
| 862 | - if(!trim($user_id)) continue; |
|
| 917 | + if(!trim($user_id)) { |
|
| 918 | + continue; |
|
| 919 | + } |
|
| 863 | 920 | $admins[] = trim($user_id); |
| 864 | 921 | } |
| 865 | - if(!count($admins)) return new Object(); |
|
| 922 | + if(!count($admins)) { |
|
| 923 | + return new Object(); |
|
| 924 | + } |
|
| 866 | 925 | |
| 867 | 926 | $oMemberModel = getModel('member'); |
| 868 | 927 | $member_config = $oMemberModel->getMemberConfig(); |
| 869 | 928 | if($member_config->identifier == 'email_address') |
| 870 | 929 | { |
| 871 | 930 | $args->email_address = '\''.implode('\',\'',$admins).'\''; |
| 872 | - } |
|
| 873 | - else |
|
| 931 | + } else |
|
| 874 | 932 | { |
| 875 | 933 | $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
| 876 | 934 | } |
| 877 | 935 | $output = executeQueryArray('module.getAdminSrls', $args); |
| 878 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 936 | + if(!$output->toBool()||!$output->data) { |
|
| 937 | + return $output; |
|
| 938 | + } |
|
| 879 | 939 | |
| 880 | 940 | foreach($output->data as $key => $val) |
| 881 | 941 | { |
@@ -884,7 +944,9 @@ discard block |
||
| 884 | 944 | $args->site_srl = $site_srl; |
| 885 | 945 | $args->member_srl = $val->member_srl; |
| 886 | 946 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
| 887 | - if(!$output->toBool()) return $output; |
|
| 947 | + if(!$output->toBool()) { |
|
| 948 | + return $output; |
|
| 949 | + } |
|
| 888 | 950 | } |
| 889 | 951 | return new Object(); |
| 890 | 952 | } |
@@ -897,12 +959,15 @@ discard block |
||
| 897 | 959 | $oMemberModel = getModel('member'); |
| 898 | 960 | $member_config = $oMemberModel->getMemberConfig(); |
| 899 | 961 | |
| 900 | - if($member_config->identifier == 'email_address') |
|
| 901 | - $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
| 902 | - else |
|
| 903 | - $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
| 962 | + if($member_config->identifier == 'email_address') { |
|
| 963 | + $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
| 964 | + } else { |
|
| 965 | + $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
| 966 | + } |
|
| 904 | 967 | |
| 905 | - if(!$member_info->member_srl) return; |
|
| 968 | + if(!$member_info->member_srl) { |
|
| 969 | + return; |
|
| 970 | + } |
|
| 906 | 971 | $args = new stdClass(); |
| 907 | 972 | $args->module_srl = $module_srl; |
| 908 | 973 | $args->member_srl = $member_info->member_srl; |
@@ -921,7 +986,9 @@ discard block |
||
| 921 | 986 | { |
| 922 | 987 | $oMemberModel = getModel('member'); |
| 923 | 988 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 924 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 989 | + if($member_info->member_srl) { |
|
| 990 | + $args->member_srl = $member_info->member_srl; |
|
| 991 | + } |
|
| 925 | 992 | } |
| 926 | 993 | return executeQuery('module.deleteAdminId', $args); |
| 927 | 994 | } |
@@ -965,7 +1032,9 @@ discard block |
||
| 965 | 1032 | } |
| 966 | 1033 | |
| 967 | 1034 | getDestroyXeVars($obj); |
| 968 | - if(!$obj || !count($obj)) return new Object(); |
|
| 1035 | + if(!$obj || !count($obj)) { |
|
| 1036 | + return new Object(); |
|
| 1037 | + } |
|
| 969 | 1038 | |
| 970 | 1039 | $args = new stdClass; |
| 971 | 1040 | $args->module_srl = $module_srl; |
@@ -975,18 +1044,23 @@ discard block |
||
| 975 | 1044 | // it often saved menu item(stdClass) on the skin info column |
| 976 | 1045 | // When updating the module on XE core 1.2.0 later versions, it occurs an error |
| 977 | 1046 | // fixed the error |
| 978 | - if (is_object($val)) continue; |
|
| 979 | - if (is_array($val)) $val = serialize($val); |
|
| 1047 | + if (is_object($val)) { |
|
| 1048 | + continue; |
|
| 1049 | + } |
|
| 1050 | + if (is_array($val)) { |
|
| 1051 | + $val = serialize($val); |
|
| 1052 | + } |
|
| 980 | 1053 | |
| 981 | 1054 | $args->name = trim($key); |
| 982 | 1055 | $args->value = trim($val); |
| 983 | - if(!$args->name || !$args->value) continue; |
|
| 1056 | + if(!$args->name || !$args->value) { |
|
| 1057 | + continue; |
|
| 1058 | + } |
|
| 984 | 1059 | |
| 985 | 1060 | if($mode === 'P') |
| 986 | 1061 | { |
| 987 | 1062 | $output = executeQuery('module.insertModuleSkinVars', $args); |
| 988 | - } |
|
| 989 | - else |
|
| 1063 | + } else |
|
| 990 | 1064 | { |
| 991 | 1065 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
| 992 | 1066 | } |
@@ -1033,8 +1107,7 @@ discard block |
||
| 1033 | 1107 | { |
| 1034 | 1108 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1035 | 1109 | $query = 'module.deleteModuleSkinVars'; |
| 1036 | - } |
|
| 1037 | - else |
|
| 1110 | + } else |
|
| 1038 | 1111 | { |
| 1039 | 1112 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
| 1040 | 1113 | $query = 'module.deleteModuleMobileSkinVars'; |
@@ -1058,17 +1131,23 @@ discard block |
||
| 1058 | 1131 | { |
| 1059 | 1132 | $this->deleteModuleExtraVars($module_srl); |
| 1060 | 1133 | getDestroyXeVars($obj); |
| 1061 | - if(!$obj || !count($obj)) return; |
|
| 1134 | + if(!$obj || !count($obj)) { |
|
| 1135 | + return; |
|
| 1136 | + } |
|
| 1062 | 1137 | |
| 1063 | 1138 | foreach($obj as $key => $val) |
| 1064 | 1139 | { |
| 1065 | - if(is_object($val) || is_array($val)) continue; |
|
| 1140 | + if(is_object($val) || is_array($val)) { |
|
| 1141 | + continue; |
|
| 1142 | + } |
|
| 1066 | 1143 | |
| 1067 | 1144 | $args = new stdClass(); |
| 1068 | 1145 | $args->module_srl = $module_srl; |
| 1069 | 1146 | $args->name = trim($key); |
| 1070 | 1147 | $args->value = trim($val); |
| 1071 | - if(!$args->name || !$args->value) continue; |
|
| 1148 | + if(!$args->name || !$args->value) { |
|
| 1149 | + continue; |
|
| 1150 | + } |
|
| 1072 | 1151 | $output = executeQuery('module.insertModuleExtraVars', $args); |
| 1073 | 1152 | } |
| 1074 | 1153 | |
@@ -1108,11 +1187,15 @@ discard block |
||
| 1108 | 1187 | function insertModuleGrants($module_srl, $obj) |
| 1109 | 1188 | { |
| 1110 | 1189 | $this->deleteModuleGrants($module_srl); |
| 1111 | - if(!$obj || !count($obj)) return; |
|
| 1190 | + if(!$obj || !count($obj)) { |
|
| 1191 | + return; |
|
| 1192 | + } |
|
| 1112 | 1193 | |
| 1113 | 1194 | foreach($obj as $name => $val) |
| 1114 | 1195 | { |
| 1115 | - if(!$val || !count($val)) continue; |
|
| 1196 | + if(!$val || !count($val)) { |
|
| 1197 | + continue; |
|
| 1198 | + } |
|
| 1116 | 1199 | |
| 1117 | 1200 | foreach($val as $group_srl) |
| 1118 | 1201 | { |
@@ -1120,7 +1203,9 @@ discard block |
||
| 1120 | 1203 | $args->module_srl = $module_srl; |
| 1121 | 1204 | $args->name = $name; |
| 1122 | 1205 | $args->group_srl = trim($group_srl); |
| 1123 | - if(!$args->name || !$args->group_srl) continue; |
|
| 1206 | + if(!$args->name || !$args->group_srl) { |
|
| 1207 | + continue; |
|
| 1208 | + } |
|
| 1124 | 1209 | executeQuery('module.insertModuleGrant', $args); |
| 1125 | 1210 | } |
| 1126 | 1211 | } |
@@ -1180,7 +1265,9 @@ discard block |
||
| 1180 | 1265 | require_once($cache_file); |
| 1181 | 1266 | } |
| 1182 | 1267 | } |
| 1183 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1268 | + if(!Context::get($matches[1]) && $lang[$matches[1]]) { |
|
| 1269 | + return $lang[$matches[1]]; |
|
| 1270 | + } |
|
| 1184 | 1271 | |
| 1185 | 1272 | return str_replace('$user_lang->','',$matches[0]); |
| 1186 | 1273 | } |
@@ -1192,10 +1279,14 @@ discard block |
||
| 1192 | 1279 | function procModuleFileBoxAdd() |
| 1193 | 1280 | { |
| 1194 | 1281 | $ajax = Context::get('ajax'); |
| 1195 | - if ($ajax) Context::setRequestMethod('JSON'); |
|
| 1282 | + if ($ajax) { |
|
| 1283 | + Context::setRequestMethod('JSON'); |
|
| 1284 | + } |
|
| 1196 | 1285 | |
| 1197 | 1286 | $logged_info = Context::get('logged_info'); |
| 1198 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1287 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 1288 | + return new Object(-1, 'msg_not_permitted'); |
|
| 1289 | + } |
|
| 1199 | 1290 | |
| 1200 | 1291 | $vars = Context::gets('addfile','filter'); |
| 1201 | 1292 | $attributeNames = Context::get('attribute_name'); |
@@ -1219,9 +1310,14 @@ discard block |
||
| 1219 | 1310 | |
| 1220 | 1311 | $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
| 1221 | 1312 | $vars->ext = $ext; |
| 1222 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
| 1223 | - else $filter = array('jpg','jpeg','gif','png'); |
|
| 1224 | - if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured'); |
|
| 1313 | + if($vars->filter) { |
|
| 1314 | + $filter = explode(',',$vars->filter); |
|
| 1315 | + } else { |
|
| 1316 | + $filter = array('jpg','jpeg','gif','png'); |
|
| 1317 | + } |
|
| 1318 | + if(!in_array($ext,$filter)) { |
|
| 1319 | + return new Object(-1, 'msg_error_occured'); |
|
| 1320 | + } |
|
| 1225 | 1321 | |
| 1226 | 1322 | $vars->member_srl = $logged_info->member_srl; |
| 1227 | 1323 | |
@@ -1234,10 +1330,16 @@ discard block |
||
| 1234 | 1330 | // insert |
| 1235 | 1331 | else |
| 1236 | 1332 | { |
| 1237 | - if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
| 1333 | + if(!Context::isUploaded()) { |
|
| 1334 | + return new Object(-1, 'msg_error_occured'); |
|
| 1335 | + } |
|
| 1238 | 1336 | $addfile = Context::get('addfile'); |
| 1239 | - if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
| 1240 | - if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
| 1337 | + if(!is_uploaded_file($addfile['tmp_name'])) { |
|
| 1338 | + return new Object(-1, 'msg_error_occured'); |
|
| 1339 | + } |
|
| 1340 | + if($vars->addfile['error'] != 0) { |
|
| 1341 | + return new Object(-1, 'msg_error_occured'); |
|
| 1342 | + } |
|
| 1241 | 1343 | $output = $this->insertModuleFileBox($vars); |
| 1242 | 1344 | } |
| 1243 | 1345 | |
@@ -1248,11 +1350,13 @@ discard block |
||
| 1248 | 1350 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); |
| 1249 | 1351 | $this->setRedirectUrl($returnUrl); |
| 1250 | 1352 | return; |
| 1251 | - } |
|
| 1252 | - else |
|
| 1353 | + } else |
|
| 1253 | 1354 | { |
| 1254 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1255 | - else $this->add('save_filename', ''); |
|
| 1355 | + if($output) { |
|
| 1356 | + $this->add('save_filename', $output->get('save_filename')); |
|
| 1357 | + } else { |
|
| 1358 | + $this->add('save_filename', ''); |
|
| 1359 | + } |
|
| 1256 | 1360 | } |
| 1257 | 1361 | } |
| 1258 | 1362 | |
@@ -1276,7 +1380,9 @@ discard block |
||
| 1276 | 1380 | $tmp = $vars->addfile['tmp_name']; |
| 1277 | 1381 | |
| 1278 | 1382 | // Check uploaded file |
| 1279 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1383 | + if(!checkUploadedFile($tmp)) { |
|
| 1384 | + return false; |
|
| 1385 | + } |
|
| 1280 | 1386 | |
| 1281 | 1387 | if(!@move_uploaded_file($tmp, $save_filename)) |
| 1282 | 1388 | { |
@@ -1313,7 +1419,9 @@ discard block |
||
| 1313 | 1419 | $tmp = $vars->addfile['tmp_name']; |
| 1314 | 1420 | |
| 1315 | 1421 | // Check uploaded file |
| 1316 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1422 | + if(!checkUploadedFile($tmp)) { |
|
| 1423 | + return false; |
|
| 1424 | + } |
|
| 1317 | 1425 | |
| 1318 | 1426 | // upload |
| 1319 | 1427 | if(!@move_uploaded_file($tmp, $save_filename)) |
@@ -1342,14 +1450,20 @@ discard block |
||
| 1342 | 1450 | function procModuleFileBoxDelete() |
| 1343 | 1451 | { |
| 1344 | 1452 | $logged_info = Context::get('logged_info'); |
| 1345 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1453 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 1454 | + return new Object(-1, 'msg_not_permitted'); |
|
| 1455 | + } |
|
| 1346 | 1456 | |
| 1347 | 1457 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1348 | - if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1458 | + if(!$module_filebox_srl) { |
|
| 1459 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1460 | + } |
|
| 1349 | 1461 | $vars = new stdClass(); |
| 1350 | 1462 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1351 | 1463 | $output = $this->deleteModuleFileBox($vars); |
| 1352 | - if(!$output->toBool()) return $output; |
|
| 1464 | + if(!$output->toBool()) { |
|
| 1465 | + return $output; |
|
| 1466 | + } |
|
| 1353 | 1467 | } |
| 1354 | 1468 | |
| 1355 | 1469 | function deleteModuleFileBox($vars) |
@@ -1372,9 +1486,13 @@ discard block |
||
| 1372 | 1486 | $this->unlockTimeoutPassed(); |
| 1373 | 1487 | $args = new stdClass; |
| 1374 | 1488 | $args->lock_name = $lock_name; |
| 1375 | - if(!$timeout) $timeout = 60; |
|
| 1489 | + if(!$timeout) { |
|
| 1490 | + $timeout = 60; |
|
| 1491 | + } |
|
| 1376 | 1492 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
| 1377 | - if($member_srl) $args->member_srl = $member_srl; |
|
| 1493 | + if($member_srl) { |
|
| 1494 | + $args->member_srl = $member_srl; |
|
| 1495 | + } |
|
| 1378 | 1496 | $output = executeQuery('module.insertLock', $args); |
| 1379 | 1497 | if($output->toBool()) |
| 1380 | 1498 | { |
@@ -19,26 +19,26 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function isIDExists($id, $site_srl = 0) |
| 21 | 21 | { |
| 22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
| 22 | + if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true; |
|
| 23 | 23 | // directory and rss/atom/api reserved checking, etc. |
| 24 | 24 | $dirs = FileHandler::readDir(_XE_PATH_); |
| 25 | 25 | $dirs[] = 'rss'; |
| 26 | 26 | $dirs[] = 'atom'; |
| 27 | 27 | $dirs[] = 'api'; |
| 28 | - if(in_array($id, $dirs)) return true; |
|
| 28 | + if (in_array($id, $dirs)) return true; |
|
| 29 | 29 | // mid test |
| 30 | 30 | $args = new stdClass(); |
| 31 | 31 | $args->mid = $id; |
| 32 | 32 | $args->site_srl = $site_srl; |
| 33 | 33 | $output = executeQuery('module.isExistsModuleName', $args); |
| 34 | - if($output->data->count) return true; |
|
| 34 | + if ($output->data->count) return true; |
|
| 35 | 35 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
| 36 | - if(!$site_srl) |
|
| 36 | + if (!$site_srl) |
|
| 37 | 37 | { |
| 38 | 38 | $site_args = new stdClass(); |
| 39 | 39 | $site_args->domain = $id; |
| 40 | 40 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
| 41 | - if($output->data->count) return true; |
|
| 41 | + if ($output->data->count) return true; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | return false; |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | function getDefaultMid() |
| 83 | 83 | { |
| 84 | 84 | $default_url = Context::getDefaultUrl(); |
| 85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 85 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 86 | 86 | |
| 87 | 87 | $request_url = Context::getRequestUri(); |
| 88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 88 | + if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 89 | 89 | |
| 90 | 90 | $default_url_parse = parse_url($default_url); |
| 91 | 91 | $request_url_parse = parse_url($request_url); |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | // Set up |
| 96 | 96 | $domain = ''; |
| 97 | 97 | $site_info = NULL; |
| 98 | - if($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
| 98 | + if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
| 99 | 99 | { |
| 100 | 100 | $hostname = $request_url_parse['host']; |
| 101 | 101 | $path = $request_url_parse['path']; |
| 102 | 102 | $port = $request_url_parse['port']; |
| 103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 103 | + if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 104 | 104 | |
| 105 | - $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
|
| 105 | + $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if($domain === '') |
|
| 108 | + if ($domain === '') |
|
| 109 | 109 | { |
| 110 | - if(!$vid) $vid = $mid; |
|
| 111 | - if($vid) |
|
| 110 | + if (!$vid) $vid = $mid; |
|
| 111 | + if ($vid) |
|
| 112 | 112 | { |
| 113 | 113 | $domain = $vid; |
| 114 | 114 | } |
@@ -116,89 +116,89 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 118 | 118 | // If domain is set, look for subsite |
| 119 | - if($domain !== '') |
|
| 119 | + if ($domain !== '') |
|
| 120 | 120 | { |
| 121 | 121 | $site_info = false; |
| 122 | - if($oCacheHandler->isSupport()) |
|
| 122 | + if ($oCacheHandler->isSupport()) |
|
| 123 | 123 | { |
| 124 | - $object_key = 'site_info:' . md5($domain); |
|
| 124 | + $object_key = 'site_info:'.md5($domain); |
|
| 125 | 125 | $domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 126 | 126 | $site_info = $oCacheHandler->get($domain_cache_key); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if($site_info === false) |
|
| 129 | + if ($site_info === false) |
|
| 130 | 130 | { |
| 131 | 131 | $args = new stdClass(); |
| 132 | 132 | $args->domain = $domain; |
| 133 | 133 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
| 134 | 134 | $site_info = $output->data; |
| 135 | 135 | |
| 136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 136 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if($site_info && $vid) |
|
| 139 | + if ($site_info && $vid) |
|
| 140 | 140 | { |
| 141 | 141 | Context::set('vid', $site_info->domain, true); |
| 142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
| 142 | + if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true); |
|
| 143 | 143 | } |
| 144 | - if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
| 144 | + if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // If no virtual website was found, get default website |
| 148 | - if($domain === '') |
|
| 148 | + if ($domain === '') |
|
| 149 | 149 | { |
| 150 | 150 | $site_info = false; |
| 151 | - if($oCacheHandler->isSupport()) |
|
| 151 | + if ($oCacheHandler->isSupport()) |
|
| 152 | 152 | { |
| 153 | 153 | $object_key = 'default_site'; |
| 154 | 154 | $default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 155 | 155 | $site_info = $oCacheHandler->get($default_site_cache_key); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if($site_info === false) |
|
| 158 | + if ($site_info === false) |
|
| 159 | 159 | { |
| 160 | 160 | $args = new stdClass(); |
| 161 | 161 | $args->site_srl = 0; |
| 162 | 162 | $output = executeQuery('module.getSiteInfo', $args); |
| 163 | 163 | // Update the related informaion if there is no default site info |
| 164 | - if(!$output->data) |
|
| 164 | + if (!$output->data) |
|
| 165 | 165 | { |
| 166 | 166 | // Create a table if sites table doesn't exist |
| 167 | 167 | $oDB = &DB::getInstance(); |
| 168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | - if(!$oDB->isTableExists('sites')) return; |
|
| 168 | + if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | + if (!$oDB->isTableExists('sites')) return; |
|
| 170 | 170 | |
| 171 | 171 | // Get mid, language |
| 172 | 172 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
| 173 | 173 | $db_info = Context::getDBInfo(); |
| 174 | 174 | $domain = Context::getDefaultUrl(); |
| 175 | 175 | $url_info = parse_url($domain); |
| 176 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
| 176 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
| 177 | 177 | |
| 178 | 178 | $site_args = new stdClass; |
| 179 | 179 | $site_args->site_srl = 0; |
| 180 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 180 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 181 | 181 | $site_args->domain = $domain; |
| 182 | 182 | $site_args->default_language = $db_info->lang_type; |
| 183 | 183 | |
| 184 | - if($output->data && !$output->data->index_module_srl) |
|
| 184 | + if ($output->data && !$output->data->index_module_srl) |
|
| 185 | 185 | { |
| 186 | 186 | $output = executeQuery('module.updateSite', $site_args); |
| 187 | 187 | } |
| 188 | 188 | else |
| 189 | 189 | { |
| 190 | 190 | $output = executeQuery('module.insertSite', $site_args); |
| 191 | - if(!$output->toBool()) return $output; |
|
| 191 | + if (!$output->toBool()) return $output; |
|
| 192 | 192 | } |
| 193 | 193 | $output = executeQuery('module.getSiteInfo', $args); |
| 194 | 194 | } |
| 195 | 195 | $site_info = $output->data; |
| 196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 196 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if(!$site_info->module_srl) return $site_info; |
|
| 201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 200 | + if (!$site_info->module_srl) return $site_info; |
|
| 201 | + if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 202 | 202 | return $this->addModuleExtraVars($site_info); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -207,48 +207,48 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array()) |
| 209 | 209 | { |
| 210 | - if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
| 210 | + if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
| 211 | 211 | { |
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $args = new stdClass(); |
| 216 | 216 | $args->mid = $mid; |
| 217 | - $args->site_srl = (int)$site_srl; |
|
| 217 | + $args->site_srl = (int) $site_srl; |
|
| 218 | 218 | |
| 219 | 219 | $module_srl = false; |
| 220 | 220 | $module_info = false; |
| 221 | 221 | |
| 222 | 222 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 223 | - if($oCacheHandler->isSupport()) |
|
| 223 | + if ($oCacheHandler->isSupport()) |
|
| 224 | 224 | { |
| 225 | 225 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
| 226 | 226 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 227 | 227 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
| 228 | - if($module_srl) |
|
| 228 | + if ($module_srl) |
|
| 229 | 229 | { |
| 230 | - $object_key = 'mid_info:' . $module_srl; |
|
| 230 | + $object_key = 'mid_info:'.$module_srl; |
|
| 231 | 231 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 232 | 232 | $module_info = $oCacheHandler->get($module_info_cache_key); |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if($module_info === false) |
|
| 236 | + if ($module_info === false) |
|
| 237 | 237 | { |
| 238 | 238 | $output = executeQuery('module.getMidInfo', $args); |
| 239 | 239 | $module_info = $output->data; |
| 240 | - if($oCacheHandler->isSupport()) |
|
| 240 | + if ($oCacheHandler->isSupport()) |
|
| 241 | 241 | { |
| 242 | 242 | $oCacheHandler->put($module_srl_cache_key, $module_info->module_srl); |
| 243 | 243 | |
| 244 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
| 244 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
| 245 | 245 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 246 | 246 | $oCacheHandler->put($module_info_cache_key, $module_info); |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $this->applyDefaultSkin($module_info); |
| 251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 251 | + if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 252 | 252 | return $this->addModuleExtraVars($module_info); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $menuItemSrl = Context::get('menu_item_srl'); |
| 265 | 265 | $menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl; |
| 266 | 266 | |
| 267 | - if(!$menuItemSrl) |
|
| 267 | + if (!$menuItemSrl) |
|
| 268 | 268 | { |
| 269 | 269 | $this->stop(-1, 'msg_invalid_request'); |
| 270 | 270 | return; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $args = new stdClass(); |
| 274 | 274 | $args->menu_item_srl = $menuItemSrl; |
| 275 | 275 | $output = executeQuery('module.getModuleInfoByMenuItemSrl', $args); |
| 276 | - if(!$output->toBool()) |
|
| 276 | + if (!$output->toBool()) |
|
| 277 | 277 | { |
| 278 | 278 | return $output; |
| 279 | 279 | } |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | $layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL; |
| 298 | 298 | $skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc); |
| 299 | 299 | $skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins'); |
| 300 | - if(!$skinInfoPc) |
|
| 300 | + if (!$skinInfoPc) |
|
| 301 | 301 | { |
| 302 | 302 | $skinInfoPc = new stdClass(); |
| 303 | 303 | $skinInfoPc->title = $skinNamePc; |
| 304 | 304 | } |
| 305 | - if(!$skinInfoMobile) |
|
| 305 | + if (!$skinInfoMobile) |
|
| 306 | 306 | { |
| 307 | 307 | $skinInfoMobile = new stdClass(); |
| 308 | 308 | $skinInfoMobile->title = $skinNameMobile; |
@@ -321,23 +321,23 @@ discard block |
||
| 321 | 321 | $mid_info = false; |
| 322 | 322 | |
| 323 | 323 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 324 | - if($oCacheHandler->isSupport()) |
|
| 324 | + if ($oCacheHandler->isSupport()) |
|
| 325 | 325 | { |
| 326 | 326 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
| 327 | 327 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 328 | 328 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
| 329 | - if($module_srl) |
|
| 329 | + if ($module_srl) |
|
| 330 | 330 | { |
| 331 | - $object_key = 'mid_info:' . $module_srl; |
|
| 331 | + $object_key = 'mid_info:'.$module_srl; |
|
| 332 | 332 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 333 | 333 | $mid_info = $oCacheHandler->get($module_info_cache_key); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if($mid_info === false) |
|
| 336 | + if ($mid_info === false) |
|
| 337 | 337 | { |
| 338 | 338 | $oCacheHandler->put($module_srl_cache_key, $output->data->module_srl); |
| 339 | 339 | |
| 340 | - $object_key = 'mid_info:' . $output->data->module_srl; |
|
| 340 | + $object_key = 'mid_info:'.$output->data->module_srl; |
|
| 341 | 341 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 342 | 342 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
| 343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $moduleInfo = $this->addModuleExtraVars($moduleInfo); |
| 352 | 352 | |
| 353 | - if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
| 353 | + if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
| 354 | 354 | { |
| 355 | 355 | unset($moduleInfo->skin); |
| 356 | 356 | unset($moduleInfo->mskin); |
@@ -369,32 +369,32 @@ discard block |
||
| 369 | 369 | $mid_info = false; |
| 370 | 370 | |
| 371 | 371 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 372 | - if($oCacheHandler->isSupport()) |
|
| 372 | + if ($oCacheHandler->isSupport()) |
|
| 373 | 373 | { |
| 374 | - $object_key = 'mid_info:' . $module_srl; |
|
| 374 | + $object_key = 'mid_info:'.$module_srl; |
|
| 375 | 375 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 376 | 376 | $mid_info = $oCacheHandler->get($cache_key); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if($mid_info === false) |
|
| 379 | + if ($mid_info === false) |
|
| 380 | 380 | { |
| 381 | 381 | // Get data |
| 382 | 382 | $args = new stdClass(); |
| 383 | 383 | $args->module_srl = $module_srl; |
| 384 | 384 | $output = executeQuery('module.getMidInfo', $args); |
| 385 | - if(!$output->toBool()) return; |
|
| 385 | + if (!$output->toBool()) return; |
|
| 386 | 386 | |
| 387 | 387 | $mid_info = $output->data; |
| 388 | 388 | $this->applyDefaultSkin($mid_info); |
| 389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 389 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - if($mid_info && count($columnList)) |
|
| 392 | + if ($mid_info && count($columnList)) |
|
| 393 | 393 | { |
| 394 | 394 | $module_info = new stdClass(); |
| 395 | - foreach($mid_info as $key => $item) |
|
| 395 | + foreach ($mid_info as $key => $item) |
|
| 396 | 396 | { |
| 397 | - if(in_array($key, $columnList)) |
|
| 397 | + if (in_array($key, $columnList)) |
|
| 398 | 398 | { |
| 399 | 399 | $module_info->$key = $item; |
| 400 | 400 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | else $module_info = $mid_info; |
| 404 | 404 | |
| 405 | 405 | $oModuleController = getController('module'); |
| 406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 406 | + if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 407 | 407 | |
| 408 | 408 | $this->applyDefaultSkin($module_info); |
| 409 | 409 | return $this->addModuleExtraVars($module_info); |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | */ |
| 417 | 417 | private function applyDefaultSkin(&$moduleInfo) |
| 418 | 418 | { |
| 419 | - if($moduleInfo->is_skin_fix == 'N') |
|
| 419 | + if ($moduleInfo->is_skin_fix == 'N') |
|
| 420 | 420 | { |
| 421 | 421 | $moduleInfo->skin = '/USE_DEFAULT/'; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if($moduleInfo->is_mskin_fix == 'N') |
|
| 424 | + if ($moduleInfo->is_mskin_fix == 'N') |
|
| 425 | 425 | { |
| 426 | 426 | $moduleInfo->mskin = '/USE_DEFAULT/'; |
| 427 | 427 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $count = count($output->data); |
| 440 | 440 | |
| 441 | 441 | $modules = array(); |
| 442 | - for($i=0;$i<$count;$i++) |
|
| 442 | + for ($i = 0; $i < $count; $i++) |
|
| 443 | 443 | { |
| 444 | 444 | $modules[] = $output->data[$i]; |
| 445 | 445 | } |
@@ -451,11 +451,11 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | function getModulesInfo($module_srls, $columnList = array()) |
| 453 | 453 | { |
| 454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
| 454 | + if (is_array($module_srls)) $module_srls = implode(',', $module_srls); |
|
| 455 | 455 | $args = new stdClass(); |
| 456 | 456 | $args->module_srls = $module_srls; |
| 457 | 457 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
| 458 | - if(!$output->toBool()) return; |
|
| 458 | + if (!$output->toBool()) return; |
|
| 459 | 459 | return $this->addModuleExtraVars($output->data); |
| 460 | 460 | } |
| 461 | 461 | |
@@ -465,31 +465,31 @@ discard block |
||
| 465 | 465 | function addModuleExtraVars($module_info) |
| 466 | 466 | { |
| 467 | 467 | // Process although one or more module informaion is requested |
| 468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
| 468 | + if (!is_array($module_info)) $target_module_info = array($module_info); |
|
| 469 | 469 | else $target_module_info = $module_info; |
| 470 | 470 | // Get module_srl |
| 471 | 471 | $module_srls = array(); |
| 472 | - foreach($target_module_info as $key => $val) |
|
| 472 | + foreach ($target_module_info as $key => $val) |
|
| 473 | 473 | { |
| 474 | 474 | $module_srl = $val->module_srl; |
| 475 | - if(!$module_srl) continue; |
|
| 475 | + if (!$module_srl) continue; |
|
| 476 | 476 | $module_srls[] = $val->module_srl; |
| 477 | 477 | } |
| 478 | 478 | // Extract extra information of the module and skin |
| 479 | 479 | $extra_vars = $this->getModuleExtraVars($module_srls); |
| 480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 480 | + if (!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 481 | 481 | |
| 482 | - foreach($target_module_info as $key => $val) |
|
| 482 | + foreach ($target_module_info as $key => $val) |
|
| 483 | 483 | { |
| 484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 485 | - foreach($extra_vars[$val->module_srl] as $k => $v) |
|
| 484 | + if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 485 | + foreach ($extra_vars[$val->module_srl] as $k => $v) |
|
| 486 | 486 | { |
| 487 | - if($target_module_info[$key]->{$k}) continue; |
|
| 487 | + if ($target_module_info[$key]->{$k}) continue; |
|
| 488 | 488 | $target_module_info[$key]->{$k} = $v; |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(is_array($module_info)) return $target_module_info; |
|
| 492 | + if (is_array($module_info)) return $target_module_info; |
|
| 493 | 493 | return $target_module_info[0]; |
| 494 | 494 | } |
| 495 | 495 | |
@@ -500,37 +500,37 @@ discard block |
||
| 500 | 500 | { |
| 501 | 501 | $list = false; |
| 502 | 502 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 503 | - if($oCacheHandler->isSupport()) |
|
| 503 | + if ($oCacheHandler->isSupport()) |
|
| 504 | 504 | { |
| 505 | - if(count($args) === 1 && isset($args->site_srl)) |
|
| 505 | + if (count($args) === 1 && isset($args->site_srl)) |
|
| 506 | 506 | { |
| 507 | - $object_key = 'module:mid_list_' . $args->site_srl; |
|
| 507 | + $object_key = 'module:mid_list_'.$args->site_srl; |
|
| 508 | 508 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 509 | 509 | $list = $oCacheHandler->get($cache_key); |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if($list === false) |
|
| 513 | + if ($list === false) |
|
| 514 | 514 | { |
| 515 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 515 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 516 | 516 | { |
| 517 | 517 | $columnList = array(); |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | $output = executeQuery('module.getMidList', $args, $columnList); |
| 521 | - if(!$output->toBool()) return $output; |
|
| 521 | + if (!$output->toBool()) return $output; |
|
| 522 | 522 | $list = $output->data; |
| 523 | 523 | |
| 524 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 524 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 525 | 525 | { |
| 526 | 526 | $oCacheHandler->put($cache_key, $list); |
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | - if(!$list) return; |
|
| 529 | + if (!$list) return; |
|
| 530 | 530 | |
| 531 | - if(!is_array($list)) $list = array($list); |
|
| 531 | + if (!is_array($list)) $list = array($list); |
|
| 532 | 532 | |
| 533 | - foreach($list as $val) |
|
| 533 | + foreach ($list as $val) |
|
| 534 | 534 | { |
| 535 | 535 | $mid_list[$val->mid] = $val; |
| 536 | 536 | } |
@@ -544,10 +544,10 @@ discard block |
||
| 544 | 544 | function getModuleSrlList($args = null, $columnList = array()) |
| 545 | 545 | { |
| 546 | 546 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
| 547 | - if(!$output->toBool()) return $output; |
|
| 547 | + if (!$output->toBool()) return $output; |
|
| 548 | 548 | |
| 549 | 549 | $list = $output->data; |
| 550 | - if(!$list) return; |
|
| 550 | + if (!$list) return; |
|
| 551 | 551 | |
| 552 | 552 | return $list; |
| 553 | 553 | } |
@@ -557,22 +557,22 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | function getModuleSrlByMid($mid) |
| 559 | 559 | { |
| 560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
| 561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
| 560 | + if ($mid && !is_array($mid)) $mid = explode(',', $mid); |
|
| 561 | + if (is_array($mid)) $mid = "'".implode("','", $mid)."'"; |
|
| 562 | 562 | |
| 563 | 563 | $site_module_info = Context::get('site_module_info'); |
| 564 | 564 | |
| 565 | 565 | $args = new stdClass; |
| 566 | 566 | $args->mid = $mid; |
| 567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 567 | + if ($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 568 | 568 | $output = executeQuery('module.getModuleSrlByMid', $args); |
| 569 | - if(!$output->toBool()) return $output; |
|
| 569 | + if (!$output->toBool()) return $output; |
|
| 570 | 570 | |
| 571 | 571 | $list = $output->data; |
| 572 | - if(!$list) return; |
|
| 573 | - if(!is_array($list)) $list = array($list); |
|
| 572 | + if (!$list) return; |
|
| 573 | + if (!is_array($list)) $list = array($list); |
|
| 574 | 574 | |
| 575 | - foreach($list as $key => $val) |
|
| 575 | + foreach ($list as $key => $val) |
|
| 576 | 576 | { |
| 577 | 577 | $module_srl_list[] = $val->module_srl; |
| 578 | 578 | } |
@@ -588,33 +588,33 @@ discard block |
||
| 588 | 588 | $action_forward = false; |
| 589 | 589 | // cache controll |
| 590 | 590 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 591 | - if($oCacheHandler->isSupport()) |
|
| 591 | + if ($oCacheHandler->isSupport()) |
|
| 592 | 592 | { |
| 593 | 593 | $cache_key = 'action_forward'; |
| 594 | 594 | $action_forward = $oCacheHandler->get($cache_key); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | // retrieve and caching all registered action_forward |
| 598 | - if($action_forward === false) |
|
| 598 | + if ($action_forward === false) |
|
| 599 | 599 | { |
| 600 | 600 | $args = new stdClass(); |
| 601 | - $output = executeQueryArray('module.getActionForward',$args); |
|
| 602 | - if(!$output->toBool()) return new stdClass; |
|
| 603 | - if(!$output->data) $output->data = array(); |
|
| 601 | + $output = executeQueryArray('module.getActionForward', $args); |
|
| 602 | + if (!$output->toBool()) return new stdClass; |
|
| 603 | + if (!$output->data) $output->data = array(); |
|
| 604 | 604 | |
| 605 | 605 | $action_forward = array(); |
| 606 | - foreach($output->data as $item) |
|
| 606 | + foreach ($output->data as $item) |
|
| 607 | 607 | { |
| 608 | 608 | $action_forward[$item->act] = $item; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if($oCacheHandler->isSupport()) |
|
| 611 | + if ($oCacheHandler->isSupport()) |
|
| 612 | 612 | { |
| 613 | 613 | $oCacheHandler->put($cache_key, $action_forward); |
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - if($action_forward[$act]) |
|
| 617 | + if ($action_forward[$act]) |
|
| 618 | 618 | { |
| 619 | 619 | return $action_forward[$act]; |
| 620 | 620 | } |
@@ -629,25 +629,25 @@ discard block |
||
| 629 | 629 | */ |
| 630 | 630 | function getTriggers($trigger_name, $called_position) |
| 631 | 631 | { |
| 632 | - if(is_null($GLOBALS['__triggers__'])) |
|
| 632 | + if (is_null($GLOBALS['__triggers__'])) |
|
| 633 | 633 | { |
| 634 | 634 | $triggers = FALSE; |
| 635 | 635 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 636 | - if($oCacheHandler->isSupport()) |
|
| 636 | + if ($oCacheHandler->isSupport()) |
|
| 637 | 637 | { |
| 638 | 638 | $cache_key = 'triggers'; |
| 639 | 639 | $triggers = $oCacheHandler->get($cache_key); |
| 640 | 640 | } |
| 641 | - if($triggers === FALSE) |
|
| 641 | + if ($triggers === FALSE) |
|
| 642 | 642 | { |
| 643 | 643 | $output = executeQueryArray('module.getTriggers'); |
| 644 | 644 | $triggers = $output->data; |
| 645 | - if($output->toBool() && $oCacheHandler->isSupport()) |
|
| 645 | + if ($output->toBool() && $oCacheHandler->isSupport()) |
|
| 646 | 646 | { |
| 647 | 647 | $oCacheHandler->put($cache_key, $triggers); |
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | - foreach($triggers as $item) |
|
| 650 | + foreach ($triggers as $item) |
|
| 651 | 651 | { |
| 652 | 652 | $GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item; |
| 653 | 653 | } |
@@ -663,11 +663,11 @@ discard block |
||
| 663 | 663 | { |
| 664 | 664 | $triggers = $this->getTriggers($trigger_name, $called_position); |
| 665 | 665 | |
| 666 | - if($triggers && is_array($triggers)) |
|
| 666 | + if ($triggers && is_array($triggers)) |
|
| 667 | 667 | { |
| 668 | - foreach($triggers as $item) |
|
| 668 | + foreach ($triggers as $item) |
|
| 669 | 669 | { |
| 670 | - if($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
| 670 | + if ($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
| 671 | 671 | { |
| 672 | 672 | return $item; |
| 673 | 673 | } |
@@ -680,12 +680,12 @@ discard block |
||
| 680 | 680 | /** |
| 681 | 681 | * @brief Get module extend |
| 682 | 682 | */ |
| 683 | - function getModuleExtend($parent_module, $type, $kind='') |
|
| 683 | + function getModuleExtend($parent_module, $type, $kind = '') |
|
| 684 | 684 | { |
| 685 | 685 | $key = $parent_module.'.'.$kind.'.'.$type; |
| 686 | 686 | |
| 687 | 687 | $module_extend_info = $this->loadModuleExtends(); |
| 688 | - if(array_key_exists($key, $module_extend_info)) |
|
| 688 | + if (array_key_exists($key, $module_extend_info)) |
|
| 689 | 689 | { |
| 690 | 690 | return $module_extend_info[$key]; |
| 691 | 691 | } |
@@ -701,29 +701,29 @@ discard block |
||
| 701 | 701 | $cache_file = './files/config/module_extend.php'; |
| 702 | 702 | $cache_file = FileHandler::getRealPath($cache_file); |
| 703 | 703 | |
| 704 | - if(!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
| 704 | + if (!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
| 705 | 705 | { |
| 706 | 706 | // check pre install |
| 707 | - if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
| 707 | + if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
| 708 | 708 | { |
| 709 | 709 | $arr = array(); |
| 710 | 710 | $output = executeQueryArray('module.getModuleExtend'); |
| 711 | - if($output->data) |
|
| 711 | + if ($output->data) |
|
| 712 | 712 | { |
| 713 | - foreach($output->data as $v) |
|
| 713 | + foreach ($output->data as $v) |
|
| 714 | 714 | { |
| 715 | 715 | $arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module); |
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | $str = '<?PHP return array(%s); ?>'; |
| 720 | - $str = sprintf($str, join(',',$arr)); |
|
| 720 | + $str = sprintf($str, join(',', $arr)); |
|
| 721 | 721 | |
| 722 | 722 | FileHandler::writeFile($cache_file, $str); |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | |
| 726 | - if(file_exists($cache_file)) |
|
| 726 | + if (file_exists($cache_file)) |
|
| 727 | 727 | { |
| 728 | 728 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
| 729 | 729 | } |
@@ -743,20 +743,20 @@ discard block |
||
| 743 | 743 | { |
| 744 | 744 | // Get a path of the requested module. Return if not exists. |
| 745 | 745 | $module_path = ModuleHandler::getModulePath($module); |
| 746 | - if(!$module_path) return; |
|
| 746 | + if (!$module_path) return; |
|
| 747 | 747 | // Read the xml file for module skin information |
| 748 | 748 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
| 749 | - if(!file_exists($xml_file)) return; |
|
| 749 | + if (!file_exists($xml_file)) return; |
|
| 750 | 750 | |
| 751 | 751 | $oXmlParser = new XmlParser(); |
| 752 | 752 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 753 | 753 | $xml_obj = $tmp_xml_obj->module; |
| 754 | 754 | |
| 755 | - if(!$xml_obj) return; |
|
| 755 | + if (!$xml_obj) return; |
|
| 756 | 756 | |
| 757 | 757 | // Module Information |
| 758 | 758 | $module_info = new stdClass(); |
| 759 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 759 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 760 | 760 | { |
| 761 | 761 | // module format 0.2 |
| 762 | 762 | $module_info->title = $xml_obj->title->body; |
@@ -764,16 +764,16 @@ discard block |
||
| 764 | 764 | $module_info->version = $xml_obj->version->body; |
| 765 | 765 | $module_info->homepage = $xml_obj->link->body; |
| 766 | 766 | $module_info->category = $xml_obj->category->body; |
| 767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 767 | + if (!$module_info->category) $module_info->category = 'service'; |
|
| 768 | 768 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 769 | 769 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 770 | 770 | $module_info->license = $xml_obj->license->body; |
| 771 | 771 | $module_info->license_link = $xml_obj->license->attrs->link; |
| 772 | 772 | |
| 773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 773 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 774 | 774 | else $author_list = $xml_obj->author; |
| 775 | 775 | |
| 776 | - foreach($author_list as $author) |
|
| 776 | + foreach ($author_list as $author) |
|
| 777 | 777 | { |
| 778 | 778 | $author_obj = new stdClass(); |
| 779 | 779 | $author_obj->name = $author->name->body; |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | $module_info->description = $xml_obj->author->description->body; |
| 790 | 790 | $module_info->version = $xml_obj->attrs->version; |
| 791 | 791 | $module_info->category = $xml_obj->attrs->category; |
| 792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 792 | + if (!$module_info->category) $module_info->category = 'service'; |
|
| 793 | 793 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 794 | 794 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 795 | 795 | $author_obj = new stdClass(); |
@@ -818,17 +818,17 @@ discard block |
||
| 818 | 818 | { |
| 819 | 819 | // Get a path of the requested module. Return if not exists. |
| 820 | 820 | $class_path = ModuleHandler::getModulePath($module); |
| 821 | - if(!$class_path) return; |
|
| 821 | + if (!$class_path) return; |
|
| 822 | 822 | |
| 823 | 823 | // Check if module.xml exists in the path. Return if not exist |
| 824 | 824 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
| 825 | - if(!file_exists($xml_file)) return; |
|
| 825 | + if (!file_exists($xml_file)) return; |
|
| 826 | 826 | |
| 827 | 827 | // Check if cached file exists |
| 828 | - $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
| 828 | + $cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
| 829 | 829 | |
| 830 | 830 | // Update if no cache file exists or it is older than xml file |
| 831 | - if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
| 831 | + if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
| 832 | 832 | { |
| 833 | 833 | $info = new stdClass(); |
| 834 | 834 | $buff = array(); // /< Set buff variable to use in the cache file |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | |
| 842 | 842 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
| 843 | 843 | |
| 844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 844 | + if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 845 | 845 | |
| 846 | 846 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
| 847 | 847 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -851,17 +851,17 @@ discard block |
||
| 851 | 851 | $default_index = $admin_index = ''; |
| 852 | 852 | |
| 853 | 853 | // Arrange permission information |
| 854 | - if($grants) |
|
| 854 | + if ($grants) |
|
| 855 | 855 | { |
| 856 | - if(is_array($grants)) $grant_list = $grants; |
|
| 856 | + if (is_array($grants)) $grant_list = $grants; |
|
| 857 | 857 | else $grant_list[] = $grants; |
| 858 | 858 | |
| 859 | 859 | $info->grant = new stdClass(); |
| 860 | 860 | $buff[] = '$info->grant = new stdClass;'; |
| 861 | - foreach($grant_list as $grant) |
|
| 861 | + foreach ($grant_list as $grant) |
|
| 862 | 862 | { |
| 863 | 863 | $name = $grant->attrs->name; |
| 864 | - $default = $grant->attrs->default?$grant->attrs->default:'guest'; |
|
| 864 | + $default = $grant->attrs->default ? $grant->attrs->default : 'guest'; |
|
| 865 | 865 | $title = $grant->title->body; |
| 866 | 866 | |
| 867 | 867 | $info->grant->{$name} = new stdClass(); |
@@ -874,15 +874,15 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | // Permissions to grant |
| 877 | - if($permissions) |
|
| 877 | + if ($permissions) |
|
| 878 | 878 | { |
| 879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
| 879 | + if (is_array($permissions)) $permission_list = $permissions; |
|
| 880 | 880 | else $permission_list[] = $permissions; |
| 881 | 881 | |
| 882 | 882 | $buff[] = '$info->permission = new stdClass;'; |
| 883 | 883 | |
| 884 | 884 | $info->permission = new stdClass(); |
| 885 | - foreach($permission_list as $permission) |
|
| 885 | + foreach ($permission_list as $permission) |
|
| 886 | 886 | { |
| 887 | 887 | $action = $permission->attrs->action; |
| 888 | 888 | $target = $permission->attrs->target; |
@@ -893,14 +893,14 @@ discard block |
||
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | // for admin menus |
| 896 | - if($menus) |
|
| 896 | + if ($menus) |
|
| 897 | 897 | { |
| 898 | - if(is_array($menus)) $menu_list = $menus; |
|
| 898 | + if (is_array($menus)) $menu_list = $menus; |
|
| 899 | 899 | else $menu_list[] = $menus; |
| 900 | 900 | |
| 901 | 901 | $buff[] = '$info->menu = new stdClass;'; |
| 902 | 902 | $info->menu = new stdClass(); |
| 903 | - foreach($menu_list as $menu) |
|
| 903 | + foreach ($menu_list as $menu) |
|
| 904 | 904 | { |
| 905 | 905 | $menu_name = $menu->attrs->name; |
| 906 | 906 | $menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body; |
@@ -918,23 +918,23 @@ discard block |
||
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | // actions |
| 921 | - if($actions) |
|
| 921 | + if ($actions) |
|
| 922 | 922 | { |
| 923 | - if(is_array($actions)) $action_list = $actions; |
|
| 923 | + if (is_array($actions)) $action_list = $actions; |
|
| 924 | 924 | else $action_list[] = $actions; |
| 925 | 925 | |
| 926 | 926 | $buff[] = '$info->action = new stdClass;'; |
| 927 | 927 | $info->action = new stdClass(); |
| 928 | - foreach($action_list as $action) |
|
| 928 | + foreach ($action_list as $action) |
|
| 929 | 929 | { |
| 930 | 930 | $name = $action->attrs->name; |
| 931 | 931 | |
| 932 | 932 | $type = $action->attrs->type; |
| 933 | - $grant = $action->attrs->grant?$action->attrs->grant:'guest'; |
|
| 934 | - $standalone = $action->attrs->standalone=='false'?'false':'true'; |
|
| 935 | - $ruleset = $action->attrs->ruleset?$action->attrs->ruleset:''; |
|
| 936 | - $method = $action->attrs->method?$action->attrs->method:''; |
|
| 937 | - $check_csrf = $action->attrs->check_csrf=='false'?'false':'true'; |
|
| 933 | + $grant = $action->attrs->grant ? $action->attrs->grant : 'guest'; |
|
| 934 | + $standalone = $action->attrs->standalone == 'false' ? 'false' : 'true'; |
|
| 935 | + $ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : ''; |
|
| 936 | + $method = $action->attrs->method ? $action->attrs->method : ''; |
|
| 937 | + $check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true'; |
|
| 938 | 938 | |
| 939 | 939 | $index = $action->attrs->index; |
| 940 | 940 | $admin_index = $action->attrs->admin_index; |
@@ -949,14 +949,14 @@ discard block |
||
| 949 | 949 | $info->action->{$name}->ruleset = $ruleset; |
| 950 | 950 | $info->action->{$name}->method = $method; |
| 951 | 951 | $info->action->{$name}->check_csrf = $check_csrf; |
| 952 | - if($action->attrs->menu_name) |
|
| 952 | + if ($action->attrs->menu_name) |
|
| 953 | 953 | { |
| 954 | - if($menu_index == 'true') |
|
| 954 | + if ($menu_index == 'true') |
|
| 955 | 955 | { |
| 956 | 956 | $info->menu->{$action->attrs->menu_name}->index = $name; |
| 957 | 957 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
| 958 | 958 | } |
| 959 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
| 959 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
| 960 | 960 | { |
| 961 | 961 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
| 962 | 962 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -974,22 +974,22 @@ discard block |
||
| 974 | 974 | $buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method); |
| 975 | 975 | $buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf); |
| 976 | 976 | |
| 977 | - if($index=='true') |
|
| 977 | + if ($index == 'true') |
|
| 978 | 978 | { |
| 979 | 979 | $default_index_act = $name; |
| 980 | 980 | $info->default_index_act = $name; |
| 981 | 981 | } |
| 982 | - if($admin_index=='true') |
|
| 982 | + if ($admin_index == 'true') |
|
| 983 | 983 | { |
| 984 | 984 | $admin_index_act = $name; |
| 985 | 985 | $info->admin_index_act = $name; |
| 986 | 986 | } |
| 987 | - if($setup_index=='true') |
|
| 987 | + if ($setup_index == 'true') |
|
| 988 | 988 | { |
| 989 | 989 | $setup_index_act = $name; |
| 990 | 990 | $info->setup_index_act = $name; |
| 991 | 991 | } |
| 992 | - if($simple_setup_index=='true') |
|
| 992 | + if ($simple_setup_index == 'true') |
|
| 993 | 993 | { |
| 994 | 994 | $simple_setup_index_act = $name; |
| 995 | 995 | $info->simple_setup_index_act = $name; |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | return $info; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
| 1013 | + if (file_exists($cache_file)) return include($cache_file); |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | /** |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | { |
| 1022 | 1022 | $module = Context::get('module_type'); |
| 1023 | 1023 | |
| 1024 | - if($module == 'ARTICLE') |
|
| 1024 | + if ($module == 'ARTICLE') |
|
| 1025 | 1025 | { |
| 1026 | 1026 | $module = 'page'; |
| 1027 | 1027 | } |
@@ -1041,26 +1041,26 @@ discard block |
||
| 1041 | 1041 | */ |
| 1042 | 1042 | function getSkins($path, $dir = 'skins') |
| 1043 | 1043 | { |
| 1044 | - if(substr($path, -1) == '/') |
|
| 1044 | + if (substr($path, -1) == '/') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | $path = substr($path, 0, -1); |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | $skin_path = sprintf("%s/%s/", $path, $dir); |
| 1050 | 1050 | $list = FileHandler::readDir($skin_path); |
| 1051 | - if(!count($list)) return; |
|
| 1051 | + if (!count($list)) return; |
|
| 1052 | 1052 | |
| 1053 | 1053 | natcasesort($list); |
| 1054 | 1054 | |
| 1055 | - foreach($list as $skin_name) |
|
| 1055 | + foreach ($list as $skin_name) |
|
| 1056 | 1056 | { |
| 1057 | - if(!is_dir($skin_path . $skin_name)) |
|
| 1057 | + if (!is_dir($skin_path.$skin_name)) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | continue; |
| 1060 | 1060 | } |
| 1061 | 1061 | unset($skin_info); |
| 1062 | 1062 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
| 1063 | - if(!$skin_info) |
|
| 1063 | + if (!$skin_info) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | $skin_info = new stdClass(); |
| 1066 | 1066 | $skin_info->title = $skin_name; |
@@ -1073,15 +1073,15 @@ discard block |
||
| 1073 | 1073 | $tmpPath = trim($tmpPath); |
| 1074 | 1074 | $module = array_pop(explode(' ', $tmpPath)); |
| 1075 | 1075 | |
| 1076 | - if($dir == 'skins') |
|
| 1076 | + if ($dir == 'skins') |
|
| 1077 | 1077 | { |
| 1078 | 1078 | $oAdminModel = getAdminModel('admin'); |
| 1079 | 1079 | $themesInfo = $oAdminModel->getThemeList(); |
| 1080 | 1080 | |
| 1081 | - foreach($themesInfo as $themeName => $info) |
|
| 1081 | + foreach ($themesInfo as $themeName => $info) |
|
| 1082 | 1082 | { |
| 1083 | 1083 | $skinInfos = $info->skin_infos; |
| 1084 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
| 1084 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
| 1085 | 1085 | { |
| 1086 | 1086 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
| 1087 | 1087 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1093,13 +1093,13 @@ discard block |
||
| 1093 | 1093 | $oMenuAdminModel = getAdminModel('menu'); |
| 1094 | 1094 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
| 1095 | 1095 | $moduleName = $module; |
| 1096 | - if($moduleName === 'page') |
|
| 1096 | + if ($moduleName === 'page') |
|
| 1097 | 1097 | { |
| 1098 | 1098 | $moduleName = 'ARTICLE'; |
| 1099 | 1099 | } |
| 1100 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
| 1100 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
| 1101 | 1101 | { |
| 1102 | - if($dir == 'skins') |
|
| 1102 | + if ($dir == 'skins') |
|
| 1103 | 1103 | { |
| 1104 | 1104 | $type = 'P'; |
| 1105 | 1105 | } |
@@ -1109,12 +1109,12 @@ discard block |
||
| 1109 | 1109 | } |
| 1110 | 1110 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
| 1111 | 1111 | |
| 1112 | - if(isset($defaultSkinName)) |
|
| 1112 | + if (isset($defaultSkinName)) |
|
| 1113 | 1113 | { |
| 1114 | 1114 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
| 1115 | 1115 | |
| 1116 | 1116 | $useDefault = new stdClass(); |
| 1117 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
| 1117 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
| 1118 | 1118 | |
| 1119 | 1119 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
| 1120 | 1120 | |
@@ -1131,20 +1131,20 @@ discard block |
||
| 1131 | 1131 | function loadSkinInfo($path, $skin, $dir = 'skins') |
| 1132 | 1132 | { |
| 1133 | 1133 | // Read xml file having skin information |
| 1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
| 1134 | + if (substr($path, -1) != '/') $path .= '/'; |
|
| 1135 | 1135 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
| 1136 | - if(!file_exists($skin_xml_file)) return; |
|
| 1136 | + if (!file_exists($skin_xml_file)) return; |
|
| 1137 | 1137 | // Create XmlParser object |
| 1138 | 1138 | $oXmlParser = new XmlParser(); |
| 1139 | 1139 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
| 1140 | 1140 | // Return if no skin information is |
| 1141 | - if(!$_xml_obj->skin) return; |
|
| 1141 | + if (!$_xml_obj->skin) return; |
|
| 1142 | 1142 | $xml_obj = $_xml_obj->skin; |
| 1143 | 1143 | // Skin Name |
| 1144 | 1144 | $skin_info = new stdClass(); |
| 1145 | 1145 | $skin_info->title = $xml_obj->title->body; |
| 1146 | 1146 | // Author information |
| 1147 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 1147 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 1148 | 1148 | { |
| 1149 | 1149 | // skin format v0.2 |
| 1150 | 1150 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1155,10 +1155,10 @@ discard block |
||
| 1155 | 1155 | $skin_info->license_link = $xml_obj->license->attrs->link; |
| 1156 | 1156 | $skin_info->description = $xml_obj->description->body; |
| 1157 | 1157 | |
| 1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1158 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1159 | 1159 | else $author_list = $xml_obj->author; |
| 1160 | 1160 | |
| 1161 | - foreach($author_list as $author) |
|
| 1161 | + foreach ($author_list as $author) |
|
| 1162 | 1162 | { |
| 1163 | 1163 | $author_obj = new stdClass(); |
| 1164 | 1164 | $author_obj->name = $author->name->body; |
@@ -1167,25 +1167,25 @@ discard block |
||
| 1167 | 1167 | $skin_info->author[] = $author_obj; |
| 1168 | 1168 | } |
| 1169 | 1169 | // List extra vars |
| 1170 | - if($xml_obj->extra_vars) |
|
| 1170 | + if ($xml_obj->extra_vars) |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1173 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1175 | 1175 | |
| 1176 | - foreach($extra_var_groups as $group) |
|
| 1176 | + foreach ($extra_var_groups as $group) |
|
| 1177 | 1177 | { |
| 1178 | 1178 | $extra_vars = $group->var; |
| 1179 | - if(!$extra_vars) |
|
| 1179 | + if (!$extra_vars) |
|
| 1180 | 1180 | { |
| 1181 | 1181 | continue; |
| 1182 | 1182 | } |
| 1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1183 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1184 | 1184 | |
| 1185 | - foreach($extra_vars as $key => $val) |
|
| 1185 | + foreach ($extra_vars as $key => $val) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $obj = new stdClass(); |
| 1188 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
| 1188 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
| 1189 | 1189 | |
| 1190 | 1190 | $obj->group = $group->title->body; |
| 1191 | 1191 | $obj->name = $val->attrs->name; |
@@ -1194,14 +1194,14 @@ discard block |
||
| 1194 | 1194 | $obj->description = $val->description->body; |
| 1195 | 1195 | $obj->value = $extra_vals->{$obj->name}; |
| 1196 | 1196 | $obj->default = $val->attrs->default; |
| 1197 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
| 1198 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
| 1197 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
| 1198 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
| 1199 | 1199 | // Get an option list from 'select'type |
| 1200 | - if(is_array($val->options)) |
|
| 1200 | + if (is_array($val->options)) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | $option_count = count($val->options); |
| 1203 | 1203 | |
| 1204 | - for($i = 0; $i < $option_count; $i++) |
|
| 1204 | + for ($i = 0; $i < $option_count; $i++) |
|
| 1205 | 1205 | { |
| 1206 | 1206 | $obj->options[$i] = new stdClass(); |
| 1207 | 1207 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1238,18 +1238,18 @@ discard block |
||
| 1238 | 1238 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
| 1239 | 1239 | // Variables used in the skin |
| 1240 | 1240 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1241 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1243 | 1243 | |
| 1244 | - foreach($extra_var_groups as $group) |
|
| 1244 | + foreach ($extra_var_groups as $group) |
|
| 1245 | 1245 | { |
| 1246 | 1246 | $extra_vars = $group->var; |
| 1247 | 1247 | |
| 1248 | - if($extra_vars) |
|
| 1248 | + if ($extra_vars) |
|
| 1249 | 1249 | { |
| 1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1250 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1251 | 1251 | |
| 1252 | - foreach($extra_vars as $var) |
|
| 1252 | + foreach ($extra_vars as $var) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | unset($obj); |
| 1255 | 1255 | unset($options); |
@@ -1260,11 +1260,11 @@ discard block |
||
| 1260 | 1260 | $title = $var->title->body; |
| 1261 | 1261 | $description = $var->description->body; |
| 1262 | 1262 | // Get an option list from 'select'type. |
| 1263 | - if(is_array($var->default)) |
|
| 1263 | + if (is_array($var->default)) |
|
| 1264 | 1264 | { |
| 1265 | 1265 | $option_count = count($var->default); |
| 1266 | 1266 | |
| 1267 | - for($i = 0; $i < $option_count; $i++) |
|
| 1267 | + for ($i = 0; $i < $option_count; $i++) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $options[$i]->title = $var->default[$i]->body; |
| 1270 | 1270 | $options[$i]->value = $var->default[$i]->body; |
@@ -1298,19 +1298,19 @@ discard block |
||
| 1298 | 1298 | |
| 1299 | 1299 | // colorset |
| 1300 | 1300 | $colorset = $xml_obj->colorset->color; |
| 1301 | - if($colorset) |
|
| 1301 | + if ($colorset) |
|
| 1302 | 1302 | { |
| 1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
| 1303 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
| 1304 | 1304 | |
| 1305 | - foreach($colorset as $color) |
|
| 1305 | + foreach ($colorset as $color) |
|
| 1306 | 1306 | { |
| 1307 | 1307 | $name = $color->attrs->name; |
| 1308 | 1308 | $title = $color->title->body; |
| 1309 | 1309 | $screenshot = $color->attrs->src; |
| 1310 | - if($screenshot) |
|
| 1310 | + if ($screenshot) |
|
| 1311 | 1311 | { |
| 1312 | 1312 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
| 1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
| 1313 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
| 1314 | 1314 | } |
| 1315 | 1315 | else $screenshot = ""; |
| 1316 | 1316 | |
@@ -1322,19 +1322,19 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | 1324 | // Menu type (settings for layout) |
| 1325 | - if($xml_obj->menus->menu) |
|
| 1325 | + if ($xml_obj->menus->menu) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | $menus = $xml_obj->menus->menu; |
| 1328 | - if(!is_array($menus)) $menus = array($menus); |
|
| 1328 | + if (!is_array($menus)) $menus = array($menus); |
|
| 1329 | 1329 | |
| 1330 | 1330 | $menu_count = count($menus); |
| 1331 | 1331 | $skin_info->menu_count = $menu_count; |
| 1332 | - for($i=0;$i<$menu_count;$i++) |
|
| 1332 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | unset($obj); |
| 1335 | 1335 | |
| 1336 | 1336 | $obj->name = $menus[$i]->attrs->name; |
| 1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1337 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1338 | 1338 | $obj->title = $menus[$i]->title->body; |
| 1339 | 1339 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
| 1340 | 1340 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
| 1346 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
| 1346 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
| 1347 | 1347 | return $skin_info; |
| 1348 | 1348 | } |
| 1349 | 1349 | |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | { |
| 1355 | 1355 | $args = new stdClass; |
| 1356 | 1356 | $args->site_srl = $site_srl; |
| 1357 | - if(!is_null($module)) $args->module = $module; |
|
| 1357 | + if (!is_null($module)) $args->module = $module; |
|
| 1358 | 1358 | $output = executeQuery('module.getModuleCount', $args); |
| 1359 | 1359 | return $output->data->count; |
| 1360 | 1360 | } |
@@ -1368,26 +1368,26 @@ discard block |
||
| 1368 | 1368 | $config = false; |
| 1369 | 1369 | // cache controll |
| 1370 | 1370 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1371 | - if($oCacheHandler->isSupport()) |
|
| 1371 | + if ($oCacheHandler->isSupport()) |
|
| 1372 | 1372 | { |
| 1373 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
| 1373 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
| 1374 | 1374 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1375 | 1375 | $config = $oCacheHandler->get($cache_key); |
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | - if($config === false) |
|
| 1378 | + if ($config === false) |
|
| 1379 | 1379 | { |
| 1380 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
| 1380 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
| 1381 | 1381 | { |
| 1382 | 1382 | $args = new stdClass(); |
| 1383 | 1383 | $args->module = $module; |
| 1384 | 1384 | $args->site_srl = $site_srl; |
| 1385 | 1385 | $output = executeQuery('module.getModuleConfig', $args); |
| 1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1386 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
| 1387 | 1387 | else $config = null; |
| 1388 | 1388 | |
| 1389 | 1389 | //insert in cache |
| 1390 | - if($oCacheHandler->isSupport()) |
|
| 1390 | + if ($oCacheHandler->isSupport()) |
|
| 1391 | 1391 | { |
| 1392 | 1392 | $oCacheHandler->put($cache_key, $config); |
| 1393 | 1393 | } |
@@ -1408,26 +1408,26 @@ discard block |
||
| 1408 | 1408 | $config = false; |
| 1409 | 1409 | // cache controll |
| 1410 | 1410 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1411 | - if($oCacheHandler->isSupport()) |
|
| 1411 | + if ($oCacheHandler->isSupport()) |
|
| 1412 | 1412 | { |
| 1413 | 1413 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
| 1414 | 1414 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1415 | 1415 | $config = $oCacheHandler->get($cache_key); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | - if($config === false) |
|
| 1418 | + if ($config === false) |
|
| 1419 | 1419 | { |
| 1420 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
| 1420 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | $args = new stdClass(); |
| 1423 | 1423 | $args->module = $module; |
| 1424 | 1424 | $args->module_srl = $module_srl; |
| 1425 | 1425 | $output = executeQuery('module.getModulePartConfig', $args); |
| 1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1426 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
| 1427 | 1427 | else $config = null; |
| 1428 | 1428 | |
| 1429 | 1429 | //insert in cache |
| 1430 | - if($oCacheHandler->isSupport()) |
|
| 1430 | + if ($oCacheHandler->isSupport()) |
|
| 1431 | 1431 | { |
| 1432 | 1432 | $oCacheHandler->put($cache_key, $config); |
| 1433 | 1433 | } |
@@ -1446,11 +1446,11 @@ discard block |
||
| 1446 | 1446 | { |
| 1447 | 1447 | $args = new stdClass(); |
| 1448 | 1448 | $args->module = $module; |
| 1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1449 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1450 | 1450 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
| 1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
| 1451 | + if (!$output->toBool() || !$output->data) return array(); |
|
| 1452 | 1452 | |
| 1453 | - foreach($output->data as $key => $val) |
|
| 1453 | + foreach ($output->data as $key => $val) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | $result[$val->module_srl] = unserialize($val->config); |
| 1456 | 1456 | } |
@@ -1466,12 +1466,12 @@ discard block |
||
| 1466 | 1466 | $args->moduleCategorySrl = $moduleCategorySrl; |
| 1467 | 1467 | // Get data from the DB |
| 1468 | 1468 | $output = executeQuery('module.getModuleCategories', $args); |
| 1469 | - if(!$output->toBool()) return $output; |
|
| 1469 | + if (!$output->toBool()) return $output; |
|
| 1470 | 1470 | $list = $output->data; |
| 1471 | - if(!$list) return; |
|
| 1472 | - if(!is_array($list)) $list = array($list); |
|
| 1471 | + if (!$list) return; |
|
| 1472 | + if (!is_array($list)) $list = array($list); |
|
| 1473 | 1473 | |
| 1474 | - foreach($list as $val) |
|
| 1474 | + foreach ($list as $val) |
|
| 1475 | 1475 | { |
| 1476 | 1476 | $category_list[$val->module_category_srl] = $val; |
| 1477 | 1477 | } |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | $args = new stdClass; |
| 1488 | 1488 | $args->module_category_srl = $module_category_srl; |
| 1489 | 1489 | $output = executeQuery('module.getModuleCategory', $args); |
| 1490 | - if(!$output->toBool()) return $output; |
|
| 1490 | + if (!$output->toBool()) return $output; |
|
| 1491 | 1491 | return $output->data; |
| 1492 | 1492 | } |
| 1493 | 1493 | |
@@ -1499,10 +1499,10 @@ discard block |
||
| 1499 | 1499 | // Get a list of downloaded and installed modules |
| 1500 | 1500 | $searched_list = FileHandler::readDir('./modules'); |
| 1501 | 1501 | $searched_count = count($searched_list); |
| 1502 | - if(!$searched_count) return; |
|
| 1502 | + if (!$searched_count) return; |
|
| 1503 | 1503 | sort($searched_list); |
| 1504 | 1504 | |
| 1505 | - for($i=0;$i<$searched_count;$i++) |
|
| 1505 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 1506 | 1506 | { |
| 1507 | 1507 | // Module name |
| 1508 | 1508 | $module_name = $searched_list[$i]; |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | $info = $this->getModuleInfoXml($module_name); |
| 1513 | 1513 | unset($obj); |
| 1514 | 1514 | |
| 1515 | - if(!isset($info)) continue; |
|
| 1515 | + if (!isset($info)) continue; |
|
| 1516 | 1516 | $info->module = $module_name; |
| 1517 | 1517 | $info->created_table_count = $created_table_count; |
| 1518 | 1518 | $info->table_count = $table_count; |
@@ -1529,19 +1529,19 @@ discard block |
||
| 1529 | 1529 | $info = null; |
| 1530 | 1530 | |
| 1531 | 1531 | $moduledir = ModuleHandler::getModulePath($module_name); |
| 1532 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
| 1532 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
| 1533 | 1533 | { |
| 1534 | 1534 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
| 1535 | 1535 | $table_count = count($tmp_files); |
| 1536 | 1536 | // Check if the table is created |
| 1537 | 1537 | $created_table_count = 0; |
| 1538 | - for($j=0;$j<count($tmp_files);$j++) |
|
| 1538 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
| 1539 | 1539 | { |
| 1540 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
| 1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1540 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
| 1541 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | // Check if DB is installed |
| 1544 | - if($table_count > $created_table_count) return true; |
|
| 1544 | + if ($table_count > $created_table_count) return true; |
|
| 1545 | 1545 | else return false; |
| 1546 | 1546 | } |
| 1547 | 1547 | return false; |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | { |
| 1552 | 1552 | // Check if it is upgraded to module.class.php on each module |
| 1553 | 1553 | $oDummy = getModule($module_name, 'class'); |
| 1554 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1554 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1555 | 1555 | { |
| 1556 | 1556 | return $oDummy->checkUpdate(); |
| 1557 | 1557 | } |
@@ -1565,15 +1565,15 @@ discard block |
||
| 1565 | 1565 | */ |
| 1566 | 1566 | public function needUpdate($update_id) |
| 1567 | 1567 | { |
| 1568 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
| 1568 | + if (!is_array($update_id)) $update_id = array($update_id); |
|
| 1569 | 1569 | |
| 1570 | 1570 | $args = new stdClass(); |
| 1571 | 1571 | $args->update_id = implode(',', $update_id); |
| 1572 | 1572 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
| 1573 | 1573 | |
| 1574 | - if(!!$output->error) return false; |
|
| 1575 | - if(!$output->data) $output->data = array(); |
|
| 1576 | - if(count($update_id) === count($output->data)) return false; |
|
| 1574 | + if (!!$output->error) return false; |
|
| 1575 | + if (!$output->data) $output->data = array(); |
|
| 1576 | + if (count($update_id) === count($output->data)) return false; |
|
| 1577 | 1577 | |
| 1578 | 1578 | return true; |
| 1579 | 1579 | } |
@@ -1590,31 +1590,31 @@ discard block |
||
| 1590 | 1590 | sort($searched_list); |
| 1591 | 1591 | |
| 1592 | 1592 | $searched_count = count($searched_list); |
| 1593 | - if(!$searched_count) return; |
|
| 1593 | + if (!$searched_count) return; |
|
| 1594 | 1594 | |
| 1595 | - for($i=0;$i<$searched_count;$i++) |
|
| 1595 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 1596 | 1596 | { |
| 1597 | 1597 | // module name |
| 1598 | 1598 | $module_name = $searched_list[$i]; |
| 1599 | 1599 | |
| 1600 | 1600 | $path = ModuleHandler::getModulePath($module_name); |
| 1601 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1601 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1602 | 1602 | |
| 1603 | 1603 | // Get the number of xml files to create a table in schemas |
| 1604 | 1604 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
| 1605 | 1605 | $table_count = count($tmp_files); |
| 1606 | 1606 | // Check if the table is created |
| 1607 | 1607 | $created_table_count = 0; |
| 1608 | - for($j=0;$j<$table_count;$j++) |
|
| 1608 | + for ($j = 0; $j < $table_count; $j++) |
|
| 1609 | 1609 | { |
| 1610 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
| 1611 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1610 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
| 1611 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
| 1612 | 1612 | } |
| 1613 | 1613 | // Get information of the module |
| 1614 | 1614 | $info = NULL; |
| 1615 | 1615 | $info = $this->getModuleInfoXml($module_name); |
| 1616 | 1616 | |
| 1617 | - if(!$info) continue; |
|
| 1617 | + if (!$info) continue; |
|
| 1618 | 1618 | |
| 1619 | 1619 | $info->module = $module_name; |
| 1620 | 1620 | $info->category = $info->category; |
@@ -1623,12 +1623,12 @@ discard block |
||
| 1623 | 1623 | $info->path = $path; |
| 1624 | 1624 | $info->admin_index_act = $info->admin_index_act; |
| 1625 | 1625 | // Check if DB is installed |
| 1626 | - if($table_count > $created_table_count) $info->need_install = true; |
|
| 1626 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
| 1627 | 1627 | else $info->need_install = false; |
| 1628 | 1628 | // Check if it is upgraded to module.class.php on each module |
| 1629 | 1629 | $oDummy = null; |
| 1630 | 1630 | $oDummy = getModule($module_name, 'class'); |
| 1631 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1631 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1632 | 1632 | { |
| 1633 | 1633 | $info->need_update = $oDummy->checkUpdate(); |
| 1634 | 1634 | } |
@@ -1649,15 +1649,15 @@ discard block |
||
| 1649 | 1649 | */ |
| 1650 | 1650 | function syncModuleToSite(&$data) |
| 1651 | 1651 | { |
| 1652 | - if(!$data) return; |
|
| 1652 | + if (!$data) return; |
|
| 1653 | 1653 | |
| 1654 | - if(is_array($data)) |
|
| 1654 | + if (is_array($data)) |
|
| 1655 | 1655 | { |
| 1656 | - foreach($data as $key => $val) |
|
| 1656 | + foreach ($data as $key => $val) |
|
| 1657 | 1657 | { |
| 1658 | 1658 | $module_srls[] = $val->module_srl; |
| 1659 | 1659 | } |
| 1660 | - if(!count($module_srls)) return; |
|
| 1660 | + if (!count($module_srls)) return; |
|
| 1661 | 1661 | } |
| 1662 | 1662 | else |
| 1663 | 1663 | { |
@@ -1665,17 +1665,17 @@ discard block |
||
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | $args = new stdClass(); |
| 1668 | - $args->module_srls = implode(',',$module_srls); |
|
| 1668 | + $args->module_srls = implode(',', $module_srls); |
|
| 1669 | 1669 | $output = executeQueryArray('module.getModuleSites', $args); |
| 1670 | - if(!$output->data) return array(); |
|
| 1671 | - foreach($output->data as $key => $val) |
|
| 1670 | + if (!$output->data) return array(); |
|
| 1671 | + foreach ($output->data as $key => $val) |
|
| 1672 | 1672 | { |
| 1673 | 1673 | $modules[$val->module_srl] = $val; |
| 1674 | 1674 | } |
| 1675 | 1675 | |
| 1676 | - if(is_array($data)) |
|
| 1676 | + if (is_array($data)) |
|
| 1677 | 1677 | { |
| 1678 | - foreach($data as $key => $val) |
|
| 1678 | + foreach ($data as $key => $val) |
|
| 1679 | 1679 | { |
| 1680 | 1680 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
| 1681 | 1681 | } |
@@ -1691,14 +1691,14 @@ discard block |
||
| 1691 | 1691 | */ |
| 1692 | 1692 | function isSiteAdmin($member_info, $site_srl = null) |
| 1693 | 1693 | { |
| 1694 | - if(!$member_info->member_srl) return false; |
|
| 1695 | - if($member_info->is_admin == 'Y') return true; |
|
| 1694 | + if (!$member_info->member_srl) return false; |
|
| 1695 | + if ($member_info->is_admin == 'Y') return true; |
|
| 1696 | 1696 | |
| 1697 | 1697 | $args = new stdClass(); |
| 1698 | - if(!isset($site_srl)) |
|
| 1698 | + if (!isset($site_srl)) |
|
| 1699 | 1699 | { |
| 1700 | 1700 | $site_module_info = Context::get('site_module_info'); |
| 1701 | - if(!$site_module_info) return; |
|
| 1701 | + if (!$site_module_info) return; |
|
| 1702 | 1702 | $args->site_srl = $site_module_info->site_srl; |
| 1703 | 1703 | } |
| 1704 | 1704 | else |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | |
| 1709 | 1709 | $args->member_srl = $member_info->member_srl; |
| 1710 | 1710 | $output = executeQuery('module.isSiteAdmin', $args); |
| 1711 | - if($output->data->member_srl == $args->member_srl) return true; |
|
| 1711 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
| 1712 | 1712 | return false; |
| 1713 | 1713 | } |
| 1714 | 1714 | |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | $obj = new stdClass(); |
| 1732 | 1732 | $obj->module_srl = $module_srl; |
| 1733 | 1733 | $output = executeQueryArray('module.getAdminID', $obj); |
| 1734 | - if(!$output->toBool() || !$output->data) return; |
|
| 1734 | + if (!$output->toBool() || !$output->data) return; |
|
| 1735 | 1735 | |
| 1736 | 1736 | return $output->data; |
| 1737 | 1737 | } |
@@ -1744,20 +1744,20 @@ discard block |
||
| 1744 | 1744 | { |
| 1745 | 1745 | $extra_vars = array(); |
| 1746 | 1746 | $get_module_srls = array(); |
| 1747 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1747 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1748 | 1748 | |
| 1749 | 1749 | $vars = false; |
| 1750 | 1750 | // cache controll |
| 1751 | 1751 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1752 | - if($oCacheHandler->isSupport()) |
|
| 1752 | + if ($oCacheHandler->isSupport()) |
|
| 1753 | 1753 | { |
| 1754 | - foreach($list_module_srl as $module_srl) |
|
| 1754 | + foreach ($list_module_srl as $module_srl) |
|
| 1755 | 1755 | { |
| 1756 | 1756 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1757 | 1757 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1758 | 1758 | $vars = $oCacheHandler->get($cache_key); |
| 1759 | 1759 | |
| 1760 | - if($vars) |
|
| 1760 | + if ($vars) |
|
| 1761 | 1761 | { |
| 1762 | 1762 | $extra_vars[$module_srl] = $vars; |
| 1763 | 1763 | } |
@@ -1772,35 +1772,35 @@ discard block |
||
| 1772 | 1772 | $get_module_srls = $list_module_srl; |
| 1773 | 1773 | } |
| 1774 | 1774 | |
| 1775 | - if(count($get_module_srls) > 0) |
|
| 1775 | + if (count($get_module_srls) > 0) |
|
| 1776 | 1776 | { |
| 1777 | 1777 | $args = new stdClass(); |
| 1778 | 1778 | $args->module_srl = implode(',', $get_module_srls); |
| 1779 | 1779 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
| 1780 | 1780 | |
| 1781 | - if(!$output->toBool()) |
|
| 1781 | + if (!$output->toBool()) |
|
| 1782 | 1782 | { |
| 1783 | 1783 | return; |
| 1784 | 1784 | } |
| 1785 | 1785 | |
| 1786 | - if(!$output->data) |
|
| 1786 | + if (!$output->data) |
|
| 1787 | 1787 | { |
| 1788 | - foreach($get_module_srls as $module_srl) |
|
| 1788 | + foreach ($get_module_srls as $module_srl) |
|
| 1789 | 1789 | { |
| 1790 | 1790 | $extra_vars[$module_srl] = new stdClass; |
| 1791 | 1791 | } |
| 1792 | 1792 | } |
| 1793 | - foreach($output->data as $key => $val) |
|
| 1793 | + foreach ($output->data as $key => $val) |
|
| 1794 | 1794 | { |
| 1795 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
| 1795 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
| 1796 | 1796 | |
| 1797 | - if(!isset($extra_vars[$val->module_srl])) |
|
| 1797 | + if (!isset($extra_vars[$val->module_srl])) |
|
| 1798 | 1798 | { |
| 1799 | 1799 | $extra_vars[$val->module_srl] = new stdClass(); |
| 1800 | 1800 | } |
| 1801 | 1801 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
| 1802 | 1802 | |
| 1803 | - if($oCacheHandler->isSupport()) |
|
| 1803 | + if ($oCacheHandler->isSupport()) |
|
| 1804 | 1804 | { |
| 1805 | 1805 | $object_key = 'module_extra_vars:'.$val->module_srl; |
| 1806 | 1806 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1819,27 +1819,27 @@ discard block |
||
| 1819 | 1819 | { |
| 1820 | 1820 | $skin_vars = false; |
| 1821 | 1821 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1822 | - if($oCacheHandler->isSupport()) |
|
| 1822 | + if ($oCacheHandler->isSupport()) |
|
| 1823 | 1823 | { |
| 1824 | 1824 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1825 | 1825 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1826 | 1826 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | - if($skin_vars === false) |
|
| 1829 | + if ($skin_vars === false) |
|
| 1830 | 1830 | { |
| 1831 | 1831 | $args = new stdClass(); |
| 1832 | 1832 | $args->module_srl = $module_srl; |
| 1833 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
| 1834 | - if(!$output->toBool()) return; |
|
| 1833 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
| 1834 | + if (!$output->toBool()) return; |
|
| 1835 | 1835 | |
| 1836 | 1836 | $skin_vars = array(); |
| 1837 | - foreach($output->data as $vars) |
|
| 1837 | + foreach ($output->data as $vars) |
|
| 1838 | 1838 | { |
| 1839 | 1839 | $skin_vars[$vars->name] = $vars; |
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1842 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | 1845 | return $skin_vars; |
@@ -1851,32 +1851,32 @@ discard block |
||
| 1851 | 1851 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
| 1852 | 1852 | { |
| 1853 | 1853 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
| 1854 | - if(!$site_srl) $site_srl = 0; |
|
| 1854 | + if (!$site_srl) $site_srl = 0; |
|
| 1855 | 1855 | |
| 1856 | 1856 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
| 1857 | - if(is_readable($designInfoFile)) |
|
| 1857 | + if (is_readable($designInfoFile)) |
|
| 1858 | 1858 | { |
| 1859 | 1859 | include($designInfoFile); |
| 1860 | 1860 | |
| 1861 | 1861 | $skinName = $designInfo->module->{$module_name}->{$target}; |
| 1862 | 1862 | } |
| 1863 | - if(!$skinName) |
|
| 1863 | + if (!$skinName) |
|
| 1864 | 1864 | { |
| 1865 | 1865 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
| 1866 | 1866 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
| 1867 | 1867 | |
| 1868 | - if(is_dir($moduleSkinPath.'default')) |
|
| 1868 | + if (is_dir($moduleSkinPath.'default')) |
|
| 1869 | 1869 | { |
| 1870 | 1870 | $skinName = 'default'; |
| 1871 | 1871 | } |
| 1872 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 1872 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
| 1873 | 1873 | { |
| 1874 | 1874 | $skinName = 'xe_default'; |
| 1875 | 1875 | } |
| 1876 | 1876 | else |
| 1877 | 1877 | { |
| 1878 | 1878 | $skins = FileHandler::readDir($moduleSkinPath); |
| 1879 | - if(count($skins) > 0) |
|
| 1879 | + if (count($skins) > 0) |
|
| 1880 | 1880 | { |
| 1881 | 1881 | $skinName = $skins[0]; |
| 1882 | 1882 | } |
@@ -1886,9 +1886,9 @@ discard block |
||
| 1886 | 1886 | } |
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | - if($updateCache && $skinName) |
|
| 1889 | + if ($updateCache && $skinName) |
|
| 1890 | 1890 | { |
| 1891 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 1891 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 1892 | 1892 | $designInfo->module->{$module_name}->{$target} = $skinName; |
| 1893 | 1893 | |
| 1894 | 1894 | $oAdminController = getAdminController('admin'); |
@@ -1904,10 +1904,10 @@ discard block |
||
| 1904 | 1904 | */ |
| 1905 | 1905 | function syncSkinInfoToModuleInfo(&$module_info) |
| 1906 | 1906 | { |
| 1907 | - if(!$module_info->module_srl) return; |
|
| 1907 | + if (!$module_info->module_srl) return; |
|
| 1908 | 1908 | |
| 1909 | 1909 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1910 | - if(Mobile::isFromMobilePhone()) |
|
| 1910 | + if (Mobile::isFromMobilePhone()) |
|
| 1911 | 1911 | { |
| 1912 | 1912 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
| 1913 | 1913 | } |
@@ -1916,11 +1916,11 @@ discard block |
||
| 1916 | 1916 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | - if(!$skin_vars) return; |
|
| 1919 | + if (!$skin_vars) return; |
|
| 1920 | 1920 | |
| 1921 | - foreach($skin_vars as $name => $val) |
|
| 1921 | + foreach ($skin_vars as $name => $val) |
|
| 1922 | 1922 | { |
| 1923 | - if(isset($module_info->{$name})) continue; |
|
| 1923 | + if (isset($module_info->{$name})) continue; |
|
| 1924 | 1924 | $module_info->{$name} = $val->value; |
| 1925 | 1925 | } |
| 1926 | 1926 | } |
@@ -1934,27 +1934,27 @@ discard block |
||
| 1934 | 1934 | { |
| 1935 | 1935 | $skin_vars = false; |
| 1936 | 1936 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1937 | - if($oCacheHandler->isSupport()) |
|
| 1937 | + if ($oCacheHandler->isSupport()) |
|
| 1938 | 1938 | { |
| 1939 | 1939 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
| 1940 | 1940 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1941 | 1941 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1942 | 1942 | } |
| 1943 | 1943 | |
| 1944 | - if($skin_vars === false) |
|
| 1944 | + if ($skin_vars === false) |
|
| 1945 | 1945 | { |
| 1946 | 1946 | $args = new stdClass(); |
| 1947 | 1947 | $args->module_srl = $module_srl; |
| 1948 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
| 1949 | - if(!$output->toBool() || !$output->data) return; |
|
| 1948 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
| 1949 | + if (!$output->toBool() || !$output->data) return; |
|
| 1950 | 1950 | |
| 1951 | 1951 | $skin_vars = array(); |
| 1952 | - foreach($output->data as $vars) |
|
| 1952 | + foreach ($output->data as $vars) |
|
| 1953 | 1953 | { |
| 1954 | 1954 | $skin_vars[$vars->name] = $vars; |
| 1955 | 1955 | } |
| 1956 | 1956 | |
| 1957 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1957 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1958 | 1958 | } |
| 1959 | 1959 | |
| 1960 | 1960 | return $skin_vars; |
@@ -1966,32 +1966,32 @@ discard block |
||
| 1966 | 1966 | */ |
| 1967 | 1967 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
| 1968 | 1968 | { |
| 1969 | - if(!$module_info->module_srl) return; |
|
| 1969 | + if (!$module_info->module_srl) return; |
|
| 1970 | 1970 | $skin_vars = false; |
| 1971 | 1971 | // cache controll |
| 1972 | 1972 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1973 | - if($oCacheHandler->isSupport()) |
|
| 1973 | + if ($oCacheHandler->isSupport()) |
|
| 1974 | 1974 | { |
| 1975 | 1975 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
| 1976 | 1976 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1977 | 1977 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1978 | 1978 | } |
| 1979 | - if($skin_vars === false) |
|
| 1979 | + if ($skin_vars === false) |
|
| 1980 | 1980 | { |
| 1981 | 1981 | $args = new stdClass; |
| 1982 | 1982 | $args->module_srl = $module_info->module_srl; |
| 1983 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
| 1984 | - if(!$output->toBool()) return; |
|
| 1983 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
| 1984 | + if (!$output->toBool()) return; |
|
| 1985 | 1985 | $skin_vars = $output->data; |
| 1986 | 1986 | |
| 1987 | 1987 | //insert in cache |
| 1988 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1988 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1989 | 1989 | } |
| 1990 | - if(!$skin_vars) return; |
|
| 1990 | + if (!$skin_vars) return; |
|
| 1991 | 1991 | |
| 1992 | - foreach($output->data as $val) |
|
| 1992 | + foreach ($output->data as $val) |
|
| 1993 | 1993 | { |
| 1994 | - if(isset($module_info->{$val->name})) continue; |
|
| 1994 | + if (isset($module_info->{$val->name})) continue; |
|
| 1995 | 1995 | $module_info->{$val->name} = $val->value; |
| 1996 | 1996 | } |
| 1997 | 1997 | } |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | { |
| 2004 | 2004 | $grant = new stdClass(); |
| 2005 | 2005 | |
| 2006 | - if(!$xml_info) |
|
| 2006 | + if (!$xml_info) |
|
| 2007 | 2007 | { |
| 2008 | 2008 | $module = $module_info->module; |
| 2009 | 2009 | $xml_info = $this->getModuleActionXml($module); |
@@ -2011,9 +2011,9 @@ discard block |
||
| 2011 | 2011 | // Set variables to grant group permission |
| 2012 | 2012 | $module_srl = $module_info->module_srl; |
| 2013 | 2013 | $grant_info = $xml_info->grant; |
| 2014 | - if($member_info->member_srl) |
|
| 2014 | + if ($member_info->member_srl) |
|
| 2015 | 2015 | { |
| 2016 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 2016 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 2017 | 2017 | else $group_list = array(); |
| 2018 | 2018 | } |
| 2019 | 2019 | else |
@@ -2021,10 +2021,10 @@ discard block |
||
| 2021 | 2021 | $group_list = array(); |
| 2022 | 2022 | } |
| 2023 | 2023 | // If module_srl doesn't exist(if unable to set permissions) |
| 2024 | - if(!$module_srl) |
|
| 2024 | + if (!$module_srl) |
|
| 2025 | 2025 | { |
| 2026 | 2026 | $grant->access = true; |
| 2027 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
| 2027 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
| 2028 | 2028 | { |
| 2029 | 2029 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
| 2030 | 2030 | } |
@@ -2035,23 +2035,23 @@ discard block |
||
| 2035 | 2035 | { |
| 2036 | 2036 | // If module_srl exists |
| 2037 | 2037 | // Get a type of granted permission |
| 2038 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
| 2038 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false; |
|
| 2039 | 2039 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
| 2040 | 2040 | // If a just logged-in member is, check if the member is a module administrator |
| 2041 | - if(!$grant->manager && $member_info->member_srl) |
|
| 2041 | + if (!$grant->manager && $member_info->member_srl) |
|
| 2042 | 2042 | { |
| 2043 | 2043 | $args = new stdClass(); |
| 2044 | 2044 | $args->module_srl = $module_srl; |
| 2045 | 2045 | $args->member_srl = $member_info->member_srl; |
| 2046 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
| 2047 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2046 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
| 2047 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2048 | 2048 | } |
| 2049 | 2049 | // If not an administrator, get information from the DB and grant manager privilege. |
| 2050 | - if(!$grant->manager) |
|
| 2050 | + if (!$grant->manager) |
|
| 2051 | 2051 | { |
| 2052 | 2052 | $args = new stdClass(); |
| 2053 | 2053 | // If planet, get permission settings from the planet home |
| 2054 | - if($module_info->module == 'planet') |
|
| 2054 | + if ($module_info->module == 'planet') |
|
| 2055 | 2055 | { |
| 2056 | 2056 | $output = executeQueryArray('module.getPlanetGrants', $args); |
| 2057 | 2057 | } |
@@ -2064,42 +2064,42 @@ discard block |
||
| 2064 | 2064 | |
| 2065 | 2065 | $grant_exists = $granted = array(); |
| 2066 | 2066 | |
| 2067 | - if($output->data) |
|
| 2067 | + if ($output->data) |
|
| 2068 | 2068 | { |
| 2069 | 2069 | // Arrange names and groups who has privileges |
| 2070 | - foreach($output->data as $val) |
|
| 2070 | + foreach ($output->data as $val) |
|
| 2071 | 2071 | { |
| 2072 | 2072 | $grant_exists[$val->name] = true; |
| 2073 | - if($granted[$val->name]) continue; |
|
| 2073 | + if ($granted[$val->name]) continue; |
|
| 2074 | 2074 | // Log-in member only |
| 2075 | - if($val->group_srl == -1) |
|
| 2075 | + if ($val->group_srl == -1) |
|
| 2076 | 2076 | { |
| 2077 | 2077 | $granted[$val->name] = true; |
| 2078 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2078 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2079 | 2079 | // Site-joined member only |
| 2080 | 2080 | } |
| 2081 | - elseif($val->group_srl == -2) |
|
| 2081 | + elseif ($val->group_srl == -2) |
|
| 2082 | 2082 | { |
| 2083 | 2083 | $granted[$val->name] = true; |
| 2084 | 2084 | // Do not grant any permission for non-logged member |
| 2085 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2085 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2086 | 2086 | // Log-in member |
| 2087 | 2087 | else |
| 2088 | 2088 | { |
| 2089 | 2089 | $site_module_info = Context::get('site_module_info'); |
| 2090 | 2090 | // Permission granted if no information of the currently connected site exists |
| 2091 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2091 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2092 | 2092 | // Permission is not granted if information of the currently connected site exists |
| 2093 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
| 2093 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
| 2094 | 2094 | } |
| 2095 | 2095 | // All of non-logged members |
| 2096 | 2096 | } |
| 2097 | - elseif($val->group_srl == -3) |
|
| 2097 | + elseif ($val->group_srl == -3) |
|
| 2098 | 2098 | { |
| 2099 | 2099 | $granted[$val->name] = true; |
| 2100 | 2100 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
| 2101 | 2101 | } |
| 2102 | - elseif($val->group_srl == 0) |
|
| 2102 | + elseif ($val->group_srl == 0) |
|
| 2103 | 2103 | { |
| 2104 | 2104 | $granted[$val->name] = true; |
| 2105 | 2105 | $grant->{$val->name} = true; |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | } |
| 2108 | 2108 | else |
| 2109 | 2109 | { |
| 2110 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
| 2110 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
| 2111 | 2111 | { |
| 2112 | 2112 | $grant->{$val->name} = true; |
| 2113 | 2113 | $granted[$val->name] = true; |
@@ -2116,29 +2116,29 @@ discard block |
||
| 2116 | 2116 | } |
| 2117 | 2117 | } |
| 2118 | 2118 | // Separate processing for the virtual group access |
| 2119 | - if(!$grant_exists['access']) $grant->access = true; |
|
| 2120 | - if(count($grant_info)) |
|
| 2119 | + if (!$grant_exists['access']) $grant->access = true; |
|
| 2120 | + if (count($grant_info)) |
|
| 2121 | 2121 | { |
| 2122 | - foreach($grant_info as $grant_name => $grant_item) |
|
| 2122 | + foreach ($grant_info as $grant_name => $grant_item) |
|
| 2123 | 2123 | { |
| 2124 | - if($grant_exists[$grant_name]) continue; |
|
| 2125 | - switch($grant_item->default) |
|
| 2124 | + if ($grant_exists[$grant_name]) continue; |
|
| 2125 | + switch ($grant_item->default) |
|
| 2126 | 2126 | { |
| 2127 | 2127 | case 'guest' : |
| 2128 | 2128 | $grant->{$grant_name} = true; |
| 2129 | 2129 | break; |
| 2130 | 2130 | case 'member' : |
| 2131 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2131 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2132 | 2132 | else $grant->{$grant_name} = false; |
| 2133 | 2133 | break; |
| 2134 | 2134 | case 'site' : |
| 2135 | 2135 | $site_module_info = Context::get('site_module_info'); |
| 2136 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2136 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2137 | 2137 | else $grant->{$grant_name} = false; |
| 2138 | 2138 | break; |
| 2139 | 2139 | case 'manager' : |
| 2140 | 2140 | case 'root' : |
| 2141 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2141 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2142 | 2142 | else $grant->{$grant_name} = false; |
| 2143 | 2143 | break; |
| 2144 | 2144 | } |
@@ -2146,12 +2146,12 @@ discard block |
||
| 2146 | 2146 | } |
| 2147 | 2147 | } |
| 2148 | 2148 | // Set true to grant all privileges if an administrator is |
| 2149 | - if($grant->manager) |
|
| 2149 | + if ($grant->manager) |
|
| 2150 | 2150 | { |
| 2151 | 2151 | $grant->access = true; |
| 2152 | - if(count($grant_info)) |
|
| 2152 | + if (count($grant_info)) |
|
| 2153 | 2153 | { |
| 2154 | - foreach($grant_info as $key => $val) |
|
| 2154 | + foreach ($grant_info as $key => $val) |
|
| 2155 | 2155 | { |
| 2156 | 2156 | $grant->{$key} = true; |
| 2157 | 2157 | } |
@@ -2183,27 +2183,27 @@ discard block |
||
| 2183 | 2183 | |
| 2184 | 2184 | function unserializeAttributes($module_filebox_list) |
| 2185 | 2185 | { |
| 2186 | - if(is_array($module_filebox_list->data)) |
|
| 2186 | + if (is_array($module_filebox_list->data)) |
|
| 2187 | 2187 | { |
| 2188 | - foreach($module_filebox_list->data as &$item) |
|
| 2188 | + foreach ($module_filebox_list->data as &$item) |
|
| 2189 | 2189 | { |
| 2190 | - if(empty($item->comment)) |
|
| 2190 | + if (empty($item->comment)) |
|
| 2191 | 2191 | { |
| 2192 | 2192 | continue; |
| 2193 | 2193 | } |
| 2194 | 2194 | |
| 2195 | 2195 | $attributes = explode(';', $item->comment); |
| 2196 | - foreach($attributes as $attribute) |
|
| 2196 | + foreach ($attributes as $attribute) |
|
| 2197 | 2197 | { |
| 2198 | 2198 | $values = explode(':', $attribute); |
| 2199 | - if((count($values) % 2) ==1) |
|
| 2199 | + if ((count($values) % 2) == 1) |
|
| 2200 | 2200 | { |
| 2201 | - for($i=2;$i<count($values);$i++) |
|
| 2201 | + for ($i = 2; $i < count($values); $i++) |
|
| 2202 | 2202 | { |
| 2203 | - $values[1].=":".$values[$i]; |
|
| 2203 | + $values[1] .= ":".$values[$i]; |
|
| 2204 | 2204 | } |
| 2205 | 2205 | } |
| 2206 | - $atts[$values[0]]=$values[1]; |
|
| 2206 | + $atts[$values[0]] = $values[1]; |
|
| 2207 | 2207 | } |
| 2208 | 2208 | $item->attributes = $atts; |
| 2209 | 2209 | unset($atts); |
@@ -2215,16 +2215,16 @@ discard block |
||
| 2215 | 2215 | function getFileBoxListHtml() |
| 2216 | 2216 | { |
| 2217 | 2217 | $logged_info = Context::get('logged_info'); |
| 2218 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2218 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2219 | 2219 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
| 2220 | - $link_params = explode('&',$link['query']); |
|
| 2220 | + $link_params = explode('&', $link['query']); |
|
| 2221 | 2221 | foreach ($link_params as $param) |
| 2222 | 2222 | { |
| 2223 | - $param = explode("=",$param); |
|
| 2224 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2223 | + $param = explode("=", $param); |
|
| 2224 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2225 | 2225 | } |
| 2226 | 2226 | $oWidgetModel = getModel('widget'); |
| 2227 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2227 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2228 | 2228 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
| 2229 | 2229 | |
| 2230 | 2230 | $oModuleModel = getModel('module'); |
@@ -2240,24 +2240,24 @@ discard block |
||
| 2240 | 2240 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
| 2241 | 2241 | |
| 2242 | 2242 | $oTemplate = &TemplateHandler::getInstance(); |
| 2243 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
| 2243 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
| 2244 | 2244 | |
| 2245 | 2245 | $this->add('html', $html); |
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | 2248 | function getModuleFileBoxPath($module_filebox_srl) |
| 2249 | 2249 | { |
| 2250 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
| 2250 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
| 2251 | 2251 | } |
| 2252 | 2252 | |
| 2253 | 2253 | /** |
| 2254 | 2254 | * @brief Return ruleset cache file path |
| 2255 | 2255 | * @param module, act |
| 2256 | 2256 | */ |
| 2257 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
| 2257 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
| 2258 | 2258 | { |
| 2259 | 2259 | // load dynamic ruleset xml file |
| 2260 | - if(strpos($ruleset, '@') !== false) |
|
| 2260 | + if (strpos($ruleset, '@') !== false) |
|
| 2261 | 2261 | { |
| 2262 | 2262 | $rulsetFile = str_replace('@', '', $ruleset); |
| 2263 | 2263 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2267,20 +2267,20 @@ discard block |
||
| 2267 | 2267 | { |
| 2268 | 2268 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
| 2269 | 2269 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2270 | - if(is_readable($xml_file)) |
|
| 2270 | + if (is_readable($xml_file)) |
|
| 2271 | 2271 | return FileHandler::getRealPath($xml_file); |
| 2272 | - else{ |
|
| 2272 | + else { |
|
| 2273 | 2273 | $ruleset = str_replace('#', '', $ruleset); |
| 2274 | 2274 | } |
| 2275 | 2275 | |
| 2276 | 2276 | } |
| 2277 | 2277 | // Get a path of the requested module. Return if not exists. |
| 2278 | 2278 | $class_path = ModuleHandler::getModulePath($module); |
| 2279 | - if(!$class_path) return; |
|
| 2279 | + if (!$class_path) return; |
|
| 2280 | 2280 | |
| 2281 | 2281 | // Check if module.xml exists in the path. Return if not exist |
| 2282 | 2282 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
| 2283 | - if(!file_exists($xml_file)) return; |
|
| 2283 | + if (!file_exists($xml_file)) return; |
|
| 2284 | 2284 | |
| 2285 | 2285 | return $xml_file; |
| 2286 | 2286 | } |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | $requestVars = Context::getRequestVars(); |
| 2293 | 2293 | |
| 2294 | 2294 | $args = new stdClass; |
| 2295 | - $args->site_srl = (int)$requestVars->site_srl; |
|
| 2295 | + $args->site_srl = (int) $requestVars->site_srl; |
|
| 2296 | 2296 | $args->page = 1; // /< Page |
| 2297 | 2297 | $args->list_count = 100; // /< the number of posts to display on a single page |
| 2298 | 2298 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2304,9 +2304,9 @@ discard block |
||
| 2304 | 2304 | |
| 2305 | 2305 | $list = array(); |
| 2306 | 2306 | |
| 2307 | - if($output->toBool()) |
|
| 2307 | + if ($output->toBool()) |
|
| 2308 | 2308 | { |
| 2309 | - foreach((array)$output->data as $code_info) |
|
| 2309 | + foreach ((array) $output->data as $code_info) |
|
| 2310 | 2310 | { |
| 2311 | 2311 | unset($codeInfo); |
| 2312 | 2312 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -19,26 +19,34 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function isIDExists($id, $site_srl = 0) |
| 21 | 21 | { |
| 22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
| 22 | + if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 23 | 25 | // directory and rss/atom/api reserved checking, etc. |
| 24 | 26 | $dirs = FileHandler::readDir(_XE_PATH_); |
| 25 | 27 | $dirs[] = 'rss'; |
| 26 | 28 | $dirs[] = 'atom'; |
| 27 | 29 | $dirs[] = 'api'; |
| 28 | - if(in_array($id, $dirs)) return true; |
|
| 30 | + if(in_array($id, $dirs)) { |
|
| 31 | + return true; |
|
| 32 | + } |
|
| 29 | 33 | // mid test |
| 30 | 34 | $args = new stdClass(); |
| 31 | 35 | $args->mid = $id; |
| 32 | 36 | $args->site_srl = $site_srl; |
| 33 | 37 | $output = executeQuery('module.isExistsModuleName', $args); |
| 34 | - if($output->data->count) return true; |
|
| 38 | + if($output->data->count) { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 35 | 41 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
| 36 | 42 | if(!$site_srl) |
| 37 | 43 | { |
| 38 | 44 | $site_args = new stdClass(); |
| 39 | 45 | $site_args->domain = $id; |
| 40 | 46 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
| 41 | - if($output->data->count) return true; |
|
| 47 | + if($output->data->count) { |
|
| 48 | + return true; |
|
| 49 | + } |
|
| 42 | 50 | } |
| 43 | 51 | |
| 44 | 52 | return false; |
@@ -82,10 +90,14 @@ discard block |
||
| 82 | 90 | function getDefaultMid() |
| 83 | 91 | { |
| 84 | 92 | $default_url = Context::getDefaultUrl(); |
| 85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 93 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
| 94 | + $default_url = substr($default_url, 0, -1); |
|
| 95 | + } |
|
| 86 | 96 | |
| 87 | 97 | $request_url = Context::getRequestUri(); |
| 88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 98 | + if($request_url && substr_compare($request_url, '/', -1) === 0) { |
|
| 99 | + $request_url = substr($request_url, 0, -1); |
|
| 100 | + } |
|
| 89 | 101 | |
| 90 | 102 | $default_url_parse = parse_url($default_url); |
| 91 | 103 | $request_url_parse = parse_url($request_url); |
@@ -100,14 +112,18 @@ discard block |
||
| 100 | 112 | $hostname = $request_url_parse['host']; |
| 101 | 113 | $path = $request_url_parse['path']; |
| 102 | 114 | $port = $request_url_parse['port']; |
| 103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 115 | + if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) { |
|
| 116 | + $path = substr($path, 0, -1); |
|
| 117 | + } |
|
| 104 | 118 | |
| 105 | 119 | $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
| 106 | 120 | } |
| 107 | 121 | |
| 108 | 122 | if($domain === '') |
| 109 | 123 | { |
| 110 | - if(!$vid) $vid = $mid; |
|
| 124 | + if(!$vid) { |
|
| 125 | + $vid = $mid; |
|
| 126 | + } |
|
| 111 | 127 | if($vid) |
| 112 | 128 | { |
| 113 | 129 | $domain = $vid; |
@@ -133,13 +149,17 @@ discard block |
||
| 133 | 149 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
| 134 | 150 | $site_info = $output->data; |
| 135 | 151 | |
| 136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 152 | + if($oCacheHandler->isSupport()) { |
|
| 153 | + $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 154 | + } |
|
| 137 | 155 | } |
| 138 | 156 | |
| 139 | 157 | if($site_info && $vid) |
| 140 | 158 | { |
| 141 | 159 | Context::set('vid', $site_info->domain, true); |
| 142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
| 160 | + if(strtolower($mid)==strtolower($site_info->domain)) { |
|
| 161 | + Context::set('mid', $site_info->mid,true); |
|
| 162 | + } |
|
| 143 | 163 | } |
| 144 | 164 | if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
| 145 | 165 | } |
@@ -165,8 +185,12 @@ discard block |
||
| 165 | 185 | { |
| 166 | 186 | // Create a table if sites table doesn't exist |
| 167 | 187 | $oDB = &DB::getInstance(); |
| 168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | - if(!$oDB->isTableExists('sites')) return; |
|
| 188 | + if(!$oDB->isTableExists('sites')) { |
|
| 189 | + $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 190 | + } |
|
| 191 | + if(!$oDB->isTableExists('sites')) { |
|
| 192 | + return; |
|
| 193 | + } |
|
| 170 | 194 | |
| 171 | 195 | // Get mid, language |
| 172 | 196 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
@@ -184,21 +208,28 @@ discard block |
||
| 184 | 208 | if($output->data && !$output->data->index_module_srl) |
| 185 | 209 | { |
| 186 | 210 | $output = executeQuery('module.updateSite', $site_args); |
| 187 | - } |
|
| 188 | - else |
|
| 211 | + } else |
|
| 189 | 212 | { |
| 190 | 213 | $output = executeQuery('module.insertSite', $site_args); |
| 191 | - if(!$output->toBool()) return $output; |
|
| 214 | + if(!$output->toBool()) { |
|
| 215 | + return $output; |
|
| 216 | + } |
|
| 192 | 217 | } |
| 193 | 218 | $output = executeQuery('module.getSiteInfo', $args); |
| 194 | 219 | } |
| 195 | 220 | $site_info = $output->data; |
| 196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 221 | + if($oCacheHandler->isSupport()) { |
|
| 222 | + $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 223 | + } |
|
| 197 | 224 | } |
| 198 | 225 | } |
| 199 | 226 | |
| 200 | - if(!$site_info->module_srl) return $site_info; |
|
| 201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 227 | + if(!$site_info->module_srl) { |
|
| 228 | + return $site_info; |
|
| 229 | + } |
|
| 230 | + if(is_array($site_info) && $site_info->data[0]) { |
|
| 231 | + $site_info = $site_info[0]; |
|
| 232 | + } |
|
| 202 | 233 | return $this->addModuleExtraVars($site_info); |
| 203 | 234 | } |
| 204 | 235 | |
@@ -248,7 +279,9 @@ discard block |
||
| 248 | 279 | } |
| 249 | 280 | |
| 250 | 281 | $this->applyDefaultSkin($module_info); |
| 251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 282 | + if(!$module_info->module_srl && $module_info->data[0]) { |
|
| 283 | + $module_info = $module_info->data[0]; |
|
| 284 | + } |
|
| 252 | 285 | return $this->addModuleExtraVars($module_info); |
| 253 | 286 | } |
| 254 | 287 | |
@@ -340,8 +373,7 @@ discard block |
||
| 340 | 373 | $object_key = 'mid_info:' . $output->data->module_srl; |
| 341 | 374 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 342 | 375 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
| 343 | - } |
|
| 344 | - else |
|
| 376 | + } else |
|
| 345 | 377 | { |
| 346 | 378 | $mid_info->designSettings = $moduleInfo->designSettings; |
| 347 | 379 | $moduleInfo = $mid_info; |
@@ -382,11 +414,15 @@ discard block |
||
| 382 | 414 | $args = new stdClass(); |
| 383 | 415 | $args->module_srl = $module_srl; |
| 384 | 416 | $output = executeQuery('module.getMidInfo', $args); |
| 385 | - if(!$output->toBool()) return; |
|
| 417 | + if(!$output->toBool()) { |
|
| 418 | + return; |
|
| 419 | + } |
|
| 386 | 420 | |
| 387 | 421 | $mid_info = $output->data; |
| 388 | 422 | $this->applyDefaultSkin($mid_info); |
| 389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 423 | + if($oCacheHandler->isSupport()) { |
|
| 424 | + $oCacheHandler->put($cache_key, $mid_info); |
|
| 425 | + } |
|
| 390 | 426 | } |
| 391 | 427 | |
| 392 | 428 | if($mid_info && count($columnList)) |
@@ -399,11 +435,14 @@ discard block |
||
| 399 | 435 | $module_info->$key = $item; |
| 400 | 436 | } |
| 401 | 437 | } |
| 438 | + } else { |
|
| 439 | + $module_info = $mid_info; |
|
| 402 | 440 | } |
| 403 | - else $module_info = $mid_info; |
|
| 404 | 441 | |
| 405 | 442 | $oModuleController = getController('module'); |
| 406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 443 | + if(isset($module_info->browser_title)) { |
|
| 444 | + $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 445 | + } |
|
| 407 | 446 | |
| 408 | 447 | $this->applyDefaultSkin($module_info); |
| 409 | 448 | return $this->addModuleExtraVars($module_info); |
@@ -451,11 +490,15 @@ discard block |
||
| 451 | 490 | */ |
| 452 | 491 | function getModulesInfo($module_srls, $columnList = array()) |
| 453 | 492 | { |
| 454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
| 493 | + if(is_array($module_srls)) { |
|
| 494 | + $module_srls = implode(',',$module_srls); |
|
| 495 | + } |
|
| 455 | 496 | $args = new stdClass(); |
| 456 | 497 | $args->module_srls = $module_srls; |
| 457 | 498 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
| 458 | - if(!$output->toBool()) return; |
|
| 499 | + if(!$output->toBool()) { |
|
| 500 | + return; |
|
| 501 | + } |
|
| 459 | 502 | return $this->addModuleExtraVars($output->data); |
| 460 | 503 | } |
| 461 | 504 | |
@@ -465,31 +508,44 @@ discard block |
||
| 465 | 508 | function addModuleExtraVars($module_info) |
| 466 | 509 | { |
| 467 | 510 | // Process although one or more module informaion is requested |
| 468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
| 469 | - else $target_module_info = $module_info; |
|
| 511 | + if(!is_array($module_info)) { |
|
| 512 | + $target_module_info = array($module_info); |
|
| 513 | + } else { |
|
| 514 | + $target_module_info = $module_info; |
|
| 515 | + } |
|
| 470 | 516 | // Get module_srl |
| 471 | 517 | $module_srls = array(); |
| 472 | 518 | foreach($target_module_info as $key => $val) |
| 473 | 519 | { |
| 474 | 520 | $module_srl = $val->module_srl; |
| 475 | - if(!$module_srl) continue; |
|
| 521 | + if(!$module_srl) { |
|
| 522 | + continue; |
|
| 523 | + } |
|
| 476 | 524 | $module_srls[] = $val->module_srl; |
| 477 | 525 | } |
| 478 | 526 | // Extract extra information of the module and skin |
| 479 | 527 | $extra_vars = $this->getModuleExtraVars($module_srls); |
| 480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 528 | + if(!count($module_srls) || !count($extra_vars)) { |
|
| 529 | + return $module_info; |
|
| 530 | + } |
|
| 481 | 531 | |
| 482 | 532 | foreach($target_module_info as $key => $val) |
| 483 | 533 | { |
| 484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 534 | + if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) { |
|
| 535 | + continue; |
|
| 536 | + } |
|
| 485 | 537 | foreach($extra_vars[$val->module_srl] as $k => $v) |
| 486 | 538 | { |
| 487 | - if($target_module_info[$key]->{$k}) continue; |
|
| 539 | + if($target_module_info[$key]->{$k}) { |
|
| 540 | + continue; |
|
| 541 | + } |
|
| 488 | 542 | $target_module_info[$key]->{$k} = $v; |
| 489 | 543 | } |
| 490 | 544 | } |
| 491 | 545 | |
| 492 | - if(is_array($module_info)) return $target_module_info; |
|
| 546 | + if(is_array($module_info)) { |
|
| 547 | + return $target_module_info; |
|
| 548 | + } |
|
| 493 | 549 | return $target_module_info[0]; |
| 494 | 550 | } |
| 495 | 551 | |
@@ -518,7 +574,9 @@ discard block |
||
| 518 | 574 | } |
| 519 | 575 | |
| 520 | 576 | $output = executeQuery('module.getMidList', $args, $columnList); |
| 521 | - if(!$output->toBool()) return $output; |
|
| 577 | + if(!$output->toBool()) { |
|
| 578 | + return $output; |
|
| 579 | + } |
|
| 522 | 580 | $list = $output->data; |
| 523 | 581 | |
| 524 | 582 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -526,9 +584,13 @@ discard block |
||
| 526 | 584 | $oCacheHandler->put($cache_key, $list); |
| 527 | 585 | } |
| 528 | 586 | } |
| 529 | - if(!$list) return; |
|
| 587 | + if(!$list) { |
|
| 588 | + return; |
|
| 589 | + } |
|
| 530 | 590 | |
| 531 | - if(!is_array($list)) $list = array($list); |
|
| 591 | + if(!is_array($list)) { |
|
| 592 | + $list = array($list); |
|
| 593 | + } |
|
| 532 | 594 | |
| 533 | 595 | foreach($list as $val) |
| 534 | 596 | { |
@@ -544,10 +606,14 @@ discard block |
||
| 544 | 606 | function getModuleSrlList($args = null, $columnList = array()) |
| 545 | 607 | { |
| 546 | 608 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
| 547 | - if(!$output->toBool()) return $output; |
|
| 609 | + if(!$output->toBool()) { |
|
| 610 | + return $output; |
|
| 611 | + } |
|
| 548 | 612 | |
| 549 | 613 | $list = $output->data; |
| 550 | - if(!$list) return; |
|
| 614 | + if(!$list) { |
|
| 615 | + return; |
|
| 616 | + } |
|
| 551 | 617 | |
| 552 | 618 | return $list; |
| 553 | 619 | } |
@@ -557,20 +623,32 @@ discard block |
||
| 557 | 623 | */ |
| 558 | 624 | function getModuleSrlByMid($mid) |
| 559 | 625 | { |
| 560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
| 561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
| 626 | + if($mid && !is_array($mid)) { |
|
| 627 | + $mid = explode(',',$mid); |
|
| 628 | + } |
|
| 629 | + if(is_array($mid)) { |
|
| 630 | + $mid = "'".implode("','",$mid)."'"; |
|
| 631 | + } |
|
| 562 | 632 | |
| 563 | 633 | $site_module_info = Context::get('site_module_info'); |
| 564 | 634 | |
| 565 | 635 | $args = new stdClass; |
| 566 | 636 | $args->mid = $mid; |
| 567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 637 | + if($site_module_info) { |
|
| 638 | + $args->site_srl = $site_module_info->site_srl; |
|
| 639 | + } |
|
| 568 | 640 | $output = executeQuery('module.getModuleSrlByMid', $args); |
| 569 | - if(!$output->toBool()) return $output; |
|
| 641 | + if(!$output->toBool()) { |
|
| 642 | + return $output; |
|
| 643 | + } |
|
| 570 | 644 | |
| 571 | 645 | $list = $output->data; |
| 572 | - if(!$list) return; |
|
| 573 | - if(!is_array($list)) $list = array($list); |
|
| 646 | + if(!$list) { |
|
| 647 | + return; |
|
| 648 | + } |
|
| 649 | + if(!is_array($list)) { |
|
| 650 | + $list = array($list); |
|
| 651 | + } |
|
| 574 | 652 | |
| 575 | 653 | foreach($list as $key => $val) |
| 576 | 654 | { |
@@ -599,8 +677,12 @@ discard block |
||
| 599 | 677 | { |
| 600 | 678 | $args = new stdClass(); |
| 601 | 679 | $output = executeQueryArray('module.getActionForward',$args); |
| 602 | - if(!$output->toBool()) return new stdClass; |
|
| 603 | - if(!$output->data) $output->data = array(); |
|
| 680 | + if(!$output->toBool()) { |
|
| 681 | + return new stdClass; |
|
| 682 | + } |
|
| 683 | + if(!$output->data) { |
|
| 684 | + $output->data = array(); |
|
| 685 | + } |
|
| 604 | 686 | |
| 605 | 687 | $action_forward = array(); |
| 606 | 688 | foreach($output->data as $item) |
@@ -617,8 +699,7 @@ discard block |
||
| 617 | 699 | if($action_forward[$act]) |
| 618 | 700 | { |
| 619 | 701 | return $action_forward[$act]; |
| 620 | - } |
|
| 621 | - else |
|
| 702 | + } else |
|
| 622 | 703 | { |
| 623 | 704 | return new stdClass(); |
| 624 | 705 | } |
@@ -726,8 +807,7 @@ discard block |
||
| 726 | 807 | if(file_exists($cache_file)) |
| 727 | 808 | { |
| 728 | 809 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
| 729 | - } |
|
| 730 | - else |
|
| 810 | + } else |
|
| 731 | 811 | { |
| 732 | 812 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
| 733 | 813 | } |
@@ -743,16 +823,22 @@ discard block |
||
| 743 | 823 | { |
| 744 | 824 | // Get a path of the requested module. Return if not exists. |
| 745 | 825 | $module_path = ModuleHandler::getModulePath($module); |
| 746 | - if(!$module_path) return; |
|
| 826 | + if(!$module_path) { |
|
| 827 | + return; |
|
| 828 | + } |
|
| 747 | 829 | // Read the xml file for module skin information |
| 748 | 830 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
| 749 | - if(!file_exists($xml_file)) return; |
|
| 831 | + if(!file_exists($xml_file)) { |
|
| 832 | + return; |
|
| 833 | + } |
|
| 750 | 834 | |
| 751 | 835 | $oXmlParser = new XmlParser(); |
| 752 | 836 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 753 | 837 | $xml_obj = $tmp_xml_obj->module; |
| 754 | 838 | |
| 755 | - if(!$xml_obj) return; |
|
| 839 | + if(!$xml_obj) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 756 | 842 | |
| 757 | 843 | // Module Information |
| 758 | 844 | $module_info = new stdClass(); |
@@ -764,14 +850,19 @@ discard block |
||
| 764 | 850 | $module_info->version = $xml_obj->version->body; |
| 765 | 851 | $module_info->homepage = $xml_obj->link->body; |
| 766 | 852 | $module_info->category = $xml_obj->category->body; |
| 767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 853 | + if(!$module_info->category) { |
|
| 854 | + $module_info->category = 'service'; |
|
| 855 | + } |
|
| 768 | 856 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 769 | 857 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 770 | 858 | $module_info->license = $xml_obj->license->body; |
| 771 | 859 | $module_info->license_link = $xml_obj->license->attrs->link; |
| 772 | 860 | |
| 773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 774 | - else $author_list = $xml_obj->author; |
|
| 861 | + if(!is_array($xml_obj->author)) { |
|
| 862 | + $author_list[] = $xml_obj->author; |
|
| 863 | + } else { |
|
| 864 | + $author_list = $xml_obj->author; |
|
| 865 | + } |
|
| 775 | 866 | |
| 776 | 867 | foreach($author_list as $author) |
| 777 | 868 | { |
@@ -781,15 +872,16 @@ discard block |
||
| 781 | 872 | $author_obj->homepage = $author->attrs->link; |
| 782 | 873 | $module_info->author[] = $author_obj; |
| 783 | 874 | } |
| 784 | - } |
|
| 785 | - else |
|
| 875 | + } else |
|
| 786 | 876 | { |
| 787 | 877 | // module format 0.1 |
| 788 | 878 | $module_info->title = $xml_obj->title->body; |
| 789 | 879 | $module_info->description = $xml_obj->author->description->body; |
| 790 | 880 | $module_info->version = $xml_obj->attrs->version; |
| 791 | 881 | $module_info->category = $xml_obj->attrs->category; |
| 792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 882 | + if(!$module_info->category) { |
|
| 883 | + $module_info->category = 'service'; |
|
| 884 | + } |
|
| 793 | 885 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 794 | 886 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 795 | 887 | $author_obj = new stdClass(); |
@@ -818,11 +910,15 @@ discard block |
||
| 818 | 910 | { |
| 819 | 911 | // Get a path of the requested module. Return if not exists. |
| 820 | 912 | $class_path = ModuleHandler::getModulePath($module); |
| 821 | - if(!$class_path) return; |
|
| 913 | + if(!$class_path) { |
|
| 914 | + return; |
|
| 915 | + } |
|
| 822 | 916 | |
| 823 | 917 | // Check if module.xml exists in the path. Return if not exist |
| 824 | 918 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
| 825 | - if(!file_exists($xml_file)) return; |
|
| 919 | + if(!file_exists($xml_file)) { |
|
| 920 | + return; |
|
| 921 | + } |
|
| 826 | 922 | |
| 827 | 923 | // Check if cached file exists |
| 828 | 924 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -841,7 +937,10 @@ discard block |
||
| 841 | 937 | |
| 842 | 938 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
| 843 | 939 | |
| 844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 940 | + if(!count($xml_obj->module)) { |
|
| 941 | + return; |
|
| 942 | + } |
|
| 943 | + // /< Error occurs if module tag doesn't included in the xml |
|
| 845 | 944 | |
| 846 | 945 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
| 847 | 946 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -853,8 +952,11 @@ discard block |
||
| 853 | 952 | // Arrange permission information |
| 854 | 953 | if($grants) |
| 855 | 954 | { |
| 856 | - if(is_array($grants)) $grant_list = $grants; |
|
| 857 | - else $grant_list[] = $grants; |
|
| 955 | + if(is_array($grants)) { |
|
| 956 | + $grant_list = $grants; |
|
| 957 | + } else { |
|
| 958 | + $grant_list[] = $grants; |
|
| 959 | + } |
|
| 858 | 960 | |
| 859 | 961 | $info->grant = new stdClass(); |
| 860 | 962 | $buff[] = '$info->grant = new stdClass;'; |
@@ -876,8 +978,11 @@ discard block |
||
| 876 | 978 | // Permissions to grant |
| 877 | 979 | if($permissions) |
| 878 | 980 | { |
| 879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
| 880 | - else $permission_list[] = $permissions; |
|
| 981 | + if(is_array($permissions)) { |
|
| 982 | + $permission_list = $permissions; |
|
| 983 | + } else { |
|
| 984 | + $permission_list[] = $permissions; |
|
| 985 | + } |
|
| 881 | 986 | |
| 882 | 987 | $buff[] = '$info->permission = new stdClass;'; |
| 883 | 988 | |
@@ -895,8 +1000,11 @@ discard block |
||
| 895 | 1000 | // for admin menus |
| 896 | 1001 | if($menus) |
| 897 | 1002 | { |
| 898 | - if(is_array($menus)) $menu_list = $menus; |
|
| 899 | - else $menu_list[] = $menus; |
|
| 1003 | + if(is_array($menus)) { |
|
| 1004 | + $menu_list = $menus; |
|
| 1005 | + } else { |
|
| 1006 | + $menu_list[] = $menus; |
|
| 1007 | + } |
|
| 900 | 1008 | |
| 901 | 1009 | $buff[] = '$info->menu = new stdClass;'; |
| 902 | 1010 | $info->menu = new stdClass(); |
@@ -920,8 +1028,11 @@ discard block |
||
| 920 | 1028 | // actions |
| 921 | 1029 | if($actions) |
| 922 | 1030 | { |
| 923 | - if(is_array($actions)) $action_list = $actions; |
|
| 924 | - else $action_list[] = $actions; |
|
| 1031 | + if(is_array($actions)) { |
|
| 1032 | + $action_list = $actions; |
|
| 1033 | + } else { |
|
| 1034 | + $action_list[] = $actions; |
|
| 1035 | + } |
|
| 925 | 1036 | |
| 926 | 1037 | $buff[] = '$info->action = new stdClass;'; |
| 927 | 1038 | $info->action = new stdClass(); |
@@ -1010,7 +1121,9 @@ discard block |
||
| 1010 | 1121 | return $info; |
| 1011 | 1122 | } |
| 1012 | 1123 | |
| 1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
| 1124 | + if(file_exists($cache_file)) { |
|
| 1125 | + return include($cache_file); |
|
| 1126 | + } |
|
| 1014 | 1127 | } |
| 1015 | 1128 | |
| 1016 | 1129 | /** |
@@ -1048,7 +1161,9 @@ discard block |
||
| 1048 | 1161 | |
| 1049 | 1162 | $skin_path = sprintf("%s/%s/", $path, $dir); |
| 1050 | 1163 | $list = FileHandler::readDir($skin_path); |
| 1051 | - if(!count($list)) return; |
|
| 1164 | + if(!count($list)) { |
|
| 1165 | + return; |
|
| 1166 | + } |
|
| 1052 | 1167 | |
| 1053 | 1168 | natcasesort($list); |
| 1054 | 1169 | |
@@ -1102,8 +1217,7 @@ discard block |
||
| 1102 | 1217 | if($dir == 'skins') |
| 1103 | 1218 | { |
| 1104 | 1219 | $type = 'P'; |
| 1105 | - } |
|
| 1106 | - else |
|
| 1220 | + } else |
|
| 1107 | 1221 | { |
| 1108 | 1222 | $type = 'M'; |
| 1109 | 1223 | } |
@@ -1131,14 +1245,20 @@ discard block |
||
| 1131 | 1245 | function loadSkinInfo($path, $skin, $dir = 'skins') |
| 1132 | 1246 | { |
| 1133 | 1247 | // Read xml file having skin information |
| 1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
| 1248 | + if(substr($path,-1)!='/') { |
|
| 1249 | + $path .= '/'; |
|
| 1250 | + } |
|
| 1135 | 1251 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
| 1136 | - if(!file_exists($skin_xml_file)) return; |
|
| 1252 | + if(!file_exists($skin_xml_file)) { |
|
| 1253 | + return; |
|
| 1254 | + } |
|
| 1137 | 1255 | // Create XmlParser object |
| 1138 | 1256 | $oXmlParser = new XmlParser(); |
| 1139 | 1257 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
| 1140 | 1258 | // Return if no skin information is |
| 1141 | - if(!$_xml_obj->skin) return; |
|
| 1259 | + if(!$_xml_obj->skin) { |
|
| 1260 | + return; |
|
| 1261 | + } |
|
| 1142 | 1262 | $xml_obj = $_xml_obj->skin; |
| 1143 | 1263 | // Skin Name |
| 1144 | 1264 | $skin_info = new stdClass(); |
@@ -1155,8 +1275,11 @@ discard block |
||
| 1155 | 1275 | $skin_info->license_link = $xml_obj->license->attrs->link; |
| 1156 | 1276 | $skin_info->description = $xml_obj->description->body; |
| 1157 | 1277 | |
| 1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1159 | - else $author_list = $xml_obj->author; |
|
| 1278 | + if(!is_array($xml_obj->author)) { |
|
| 1279 | + $author_list[] = $xml_obj->author; |
|
| 1280 | + } else { |
|
| 1281 | + $author_list = $xml_obj->author; |
|
| 1282 | + } |
|
| 1160 | 1283 | |
| 1161 | 1284 | foreach($author_list as $author) |
| 1162 | 1285 | { |
@@ -1170,8 +1293,12 @@ discard block |
||
| 1170 | 1293 | if($xml_obj->extra_vars) |
| 1171 | 1294 | { |
| 1172 | 1295 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1296 | + if(!$extra_var_groups) { |
|
| 1297 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 1298 | + } |
|
| 1299 | + if(!is_array($extra_var_groups)) { |
|
| 1300 | + $extra_var_groups = array($extra_var_groups); |
|
| 1301 | + } |
|
| 1175 | 1302 | |
| 1176 | 1303 | foreach($extra_var_groups as $group) |
| 1177 | 1304 | { |
@@ -1180,7 +1307,9 @@ discard block |
||
| 1180 | 1307 | { |
| 1181 | 1308 | continue; |
| 1182 | 1309 | } |
| 1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1310 | + if(!is_array($group->var)) { |
|
| 1311 | + $extra_vars = array($group->var); |
|
| 1312 | + } |
|
| 1184 | 1313 | |
| 1185 | 1314 | foreach($extra_vars as $key => $val) |
| 1186 | 1315 | { |
@@ -1207,8 +1336,7 @@ discard block |
||
| 1207 | 1336 | $obj->options[$i]->title = $val->options[$i]->title->body; |
| 1208 | 1337 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
| 1209 | 1338 | } |
| 1210 | - } |
|
| 1211 | - else |
|
| 1339 | + } else |
|
| 1212 | 1340 | { |
| 1213 | 1341 | $obj->options[0] = new stdClass(); |
| 1214 | 1342 | $obj->options[0]->title = $val->options->title->body; |
@@ -1219,8 +1347,7 @@ discard block |
||
| 1219 | 1347 | } |
| 1220 | 1348 | } |
| 1221 | 1349 | } |
| 1222 | - } |
|
| 1223 | - else |
|
| 1350 | + } else |
|
| 1224 | 1351 | { |
| 1225 | 1352 | // skin format v0.1 |
| 1226 | 1353 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1238,8 +1365,12 @@ discard block |
||
| 1238 | 1365 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
| 1239 | 1366 | // Variables used in the skin |
| 1240 | 1367 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1368 | + if(!$extra_var_groups) { |
|
| 1369 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 1370 | + } |
|
| 1371 | + if(!is_array($extra_var_groups)) { |
|
| 1372 | + $extra_var_groups = array($extra_var_groups); |
|
| 1373 | + } |
|
| 1243 | 1374 | |
| 1244 | 1375 | foreach($extra_var_groups as $group) |
| 1245 | 1376 | { |
@@ -1247,7 +1378,9 @@ discard block |
||
| 1247 | 1378 | |
| 1248 | 1379 | if($extra_vars) |
| 1249 | 1380 | { |
| 1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1381 | + if(!is_array($extra_vars)) { |
|
| 1382 | + $extra_vars = array($extra_vars); |
|
| 1383 | + } |
|
| 1251 | 1384 | |
| 1252 | 1385 | foreach($extra_vars as $var) |
| 1253 | 1386 | { |
@@ -1269,8 +1402,7 @@ discard block |
||
| 1269 | 1402 | $options[$i]->title = $var->default[$i]->body; |
| 1270 | 1403 | $options[$i]->value = $var->default[$i]->body; |
| 1271 | 1404 | } |
| 1272 | - } |
|
| 1273 | - else |
|
| 1405 | + } else |
|
| 1274 | 1406 | { |
| 1275 | 1407 | $options[0]->title = $var->default->body; |
| 1276 | 1408 | $options[0]->value = $var->default->body; |
@@ -1300,7 +1432,9 @@ discard block |
||
| 1300 | 1432 | $colorset = $xml_obj->colorset->color; |
| 1301 | 1433 | if($colorset) |
| 1302 | 1434 | { |
| 1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
| 1435 | + if(!is_array($colorset)) { |
|
| 1436 | + $colorset = array($colorset); |
|
| 1437 | + } |
|
| 1304 | 1438 | |
| 1305 | 1439 | foreach($colorset as $color) |
| 1306 | 1440 | { |
@@ -1310,9 +1444,12 @@ discard block |
||
| 1310 | 1444 | if($screenshot) |
| 1311 | 1445 | { |
| 1312 | 1446 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
| 1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
| 1447 | + if(!file_exists($screenshot)) { |
|
| 1448 | + $screenshot = ""; |
|
| 1449 | + } |
|
| 1450 | + } else { |
|
| 1451 | + $screenshot = ""; |
|
| 1314 | 1452 | } |
| 1315 | - else $screenshot = ""; |
|
| 1316 | 1453 | |
| 1317 | 1454 | $obj = new stdClass(); |
| 1318 | 1455 | $obj->name = $name; |
@@ -1325,7 +1462,9 @@ discard block |
||
| 1325 | 1462 | if($xml_obj->menus->menu) |
| 1326 | 1463 | { |
| 1327 | 1464 | $menus = $xml_obj->menus->menu; |
| 1328 | - if(!is_array($menus)) $menus = array($menus); |
|
| 1465 | + if(!is_array($menus)) { |
|
| 1466 | + $menus = array($menus); |
|
| 1467 | + } |
|
| 1329 | 1468 | |
| 1330 | 1469 | $menu_count = count($menus); |
| 1331 | 1470 | $skin_info->menu_count = $menu_count; |
@@ -1334,7 +1473,9 @@ discard block |
||
| 1334 | 1473 | unset($obj); |
| 1335 | 1474 | |
| 1336 | 1475 | $obj->name = $menus[$i]->attrs->name; |
| 1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1476 | + if($menus[$i]->attrs->default == "true") { |
|
| 1477 | + $obj->default = true; |
|
| 1478 | + } |
|
| 1338 | 1479 | $obj->title = $menus[$i]->title->body; |
| 1339 | 1480 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
| 1340 | 1481 | |
@@ -1354,7 +1495,9 @@ discard block |
||
| 1354 | 1495 | { |
| 1355 | 1496 | $args = new stdClass; |
| 1356 | 1497 | $args->site_srl = $site_srl; |
| 1357 | - if(!is_null($module)) $args->module = $module; |
|
| 1498 | + if(!is_null($module)) { |
|
| 1499 | + $args->module = $module; |
|
| 1500 | + } |
|
| 1358 | 1501 | $output = executeQuery('module.getModuleCount', $args); |
| 1359 | 1502 | return $output->data->count; |
| 1360 | 1503 | } |
@@ -1383,8 +1526,11 @@ discard block |
||
| 1383 | 1526 | $args->module = $module; |
| 1384 | 1527 | $args->site_srl = $site_srl; |
| 1385 | 1528 | $output = executeQuery('module.getModuleConfig', $args); |
| 1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1387 | - else $config = null; |
|
| 1529 | + if($output->data->config) { |
|
| 1530 | + $config = unserialize($output->data->config); |
|
| 1531 | + } else { |
|
| 1532 | + $config = null; |
|
| 1533 | + } |
|
| 1388 | 1534 | |
| 1389 | 1535 | //insert in cache |
| 1390 | 1536 | if($oCacheHandler->isSupport()) |
@@ -1423,8 +1569,11 @@ discard block |
||
| 1423 | 1569 | $args->module = $module; |
| 1424 | 1570 | $args->module_srl = $module_srl; |
| 1425 | 1571 | $output = executeQuery('module.getModulePartConfig', $args); |
| 1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1427 | - else $config = null; |
|
| 1572 | + if($output->data->config) { |
|
| 1573 | + $config = unserialize($output->data->config); |
|
| 1574 | + } else { |
|
| 1575 | + $config = null; |
|
| 1576 | + } |
|
| 1428 | 1577 | |
| 1429 | 1578 | //insert in cache |
| 1430 | 1579 | if($oCacheHandler->isSupport()) |
@@ -1446,9 +1595,13 @@ discard block |
||
| 1446 | 1595 | { |
| 1447 | 1596 | $args = new stdClass(); |
| 1448 | 1597 | $args->module = $module; |
| 1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1598 | + if($site_srl) { |
|
| 1599 | + $args->site_srl = $site_srl; |
|
| 1600 | + } |
|
| 1450 | 1601 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
| 1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
| 1602 | + if(!$output->toBool() || !$output->data) { |
|
| 1603 | + return array(); |
|
| 1604 | + } |
|
| 1452 | 1605 | |
| 1453 | 1606 | foreach($output->data as $key => $val) |
| 1454 | 1607 | { |
@@ -1466,10 +1619,16 @@ discard block |
||
| 1466 | 1619 | $args->moduleCategorySrl = $moduleCategorySrl; |
| 1467 | 1620 | // Get data from the DB |
| 1468 | 1621 | $output = executeQuery('module.getModuleCategories', $args); |
| 1469 | - if(!$output->toBool()) return $output; |
|
| 1622 | + if(!$output->toBool()) { |
|
| 1623 | + return $output; |
|
| 1624 | + } |
|
| 1470 | 1625 | $list = $output->data; |
| 1471 | - if(!$list) return; |
|
| 1472 | - if(!is_array($list)) $list = array($list); |
|
| 1626 | + if(!$list) { |
|
| 1627 | + return; |
|
| 1628 | + } |
|
| 1629 | + if(!is_array($list)) { |
|
| 1630 | + $list = array($list); |
|
| 1631 | + } |
|
| 1473 | 1632 | |
| 1474 | 1633 | foreach($list as $val) |
| 1475 | 1634 | { |
@@ -1487,7 +1646,9 @@ discard block |
||
| 1487 | 1646 | $args = new stdClass; |
| 1488 | 1647 | $args->module_category_srl = $module_category_srl; |
| 1489 | 1648 | $output = executeQuery('module.getModuleCategory', $args); |
| 1490 | - if(!$output->toBool()) return $output; |
|
| 1649 | + if(!$output->toBool()) { |
|
| 1650 | + return $output; |
|
| 1651 | + } |
|
| 1491 | 1652 | return $output->data; |
| 1492 | 1653 | } |
| 1493 | 1654 | |
@@ -1499,7 +1660,9 @@ discard block |
||
| 1499 | 1660 | // Get a list of downloaded and installed modules |
| 1500 | 1661 | $searched_list = FileHandler::readDir('./modules'); |
| 1501 | 1662 | $searched_count = count($searched_list); |
| 1502 | - if(!$searched_count) return; |
|
| 1663 | + if(!$searched_count) { |
|
| 1664 | + return; |
|
| 1665 | + } |
|
| 1503 | 1666 | sort($searched_list); |
| 1504 | 1667 | |
| 1505 | 1668 | for($i=0;$i<$searched_count;$i++) |
@@ -1512,7 +1675,9 @@ discard block |
||
| 1512 | 1675 | $info = $this->getModuleInfoXml($module_name); |
| 1513 | 1676 | unset($obj); |
| 1514 | 1677 | |
| 1515 | - if(!isset($info)) continue; |
|
| 1678 | + if(!isset($info)) { |
|
| 1679 | + continue; |
|
| 1680 | + } |
|
| 1516 | 1681 | $info->module = $module_name; |
| 1517 | 1682 | $info->created_table_count = $created_table_count; |
| 1518 | 1683 | $info->table_count = $table_count; |
@@ -1538,11 +1703,16 @@ discard block |
||
| 1538 | 1703 | for($j=0;$j<count($tmp_files);$j++) |
| 1539 | 1704 | { |
| 1540 | 1705 | list($table_name) = explode(".",$tmp_files[$j]); |
| 1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1706 | + if($oDB->isTableExists($table_name)) { |
|
| 1707 | + $created_table_count ++; |
|
| 1708 | + } |
|
| 1542 | 1709 | } |
| 1543 | 1710 | // Check if DB is installed |
| 1544 | - if($table_count > $created_table_count) return true; |
|
| 1545 | - else return false; |
|
| 1711 | + if($table_count > $created_table_count) { |
|
| 1712 | + return true; |
|
| 1713 | + } else { |
|
| 1714 | + return false; |
|
| 1715 | + } |
|
| 1546 | 1716 | } |
| 1547 | 1717 | return false; |
| 1548 | 1718 | } |
@@ -1565,15 +1735,23 @@ discard block |
||
| 1565 | 1735 | */ |
| 1566 | 1736 | public function needUpdate($update_id) |
| 1567 | 1737 | { |
| 1568 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
| 1738 | + if(!is_array($update_id)) { |
|
| 1739 | + $update_id = array($update_id); |
|
| 1740 | + } |
|
| 1569 | 1741 | |
| 1570 | 1742 | $args = new stdClass(); |
| 1571 | 1743 | $args->update_id = implode(',', $update_id); |
| 1572 | 1744 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
| 1573 | 1745 | |
| 1574 | - if(!!$output->error) return false; |
|
| 1575 | - if(!$output->data) $output->data = array(); |
|
| 1576 | - if(count($update_id) === count($output->data)) return false; |
|
| 1746 | + if(!!$output->error) { |
|
| 1747 | + return false; |
|
| 1748 | + } |
|
| 1749 | + if(!$output->data) { |
|
| 1750 | + $output->data = array(); |
|
| 1751 | + } |
|
| 1752 | + if(count($update_id) === count($output->data)) { |
|
| 1753 | + return false; |
|
| 1754 | + } |
|
| 1577 | 1755 | |
| 1578 | 1756 | return true; |
| 1579 | 1757 | } |
@@ -1590,7 +1768,9 @@ discard block |
||
| 1590 | 1768 | sort($searched_list); |
| 1591 | 1769 | |
| 1592 | 1770 | $searched_count = count($searched_list); |
| 1593 | - if(!$searched_count) return; |
|
| 1771 | + if(!$searched_count) { |
|
| 1772 | + return; |
|
| 1773 | + } |
|
| 1594 | 1774 | |
| 1595 | 1775 | for($i=0;$i<$searched_count;$i++) |
| 1596 | 1776 | { |
@@ -1598,7 +1778,9 @@ discard block |
||
| 1598 | 1778 | $module_name = $searched_list[$i]; |
| 1599 | 1779 | |
| 1600 | 1780 | $path = ModuleHandler::getModulePath($module_name); |
| 1601 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1781 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
| 1782 | + continue; |
|
| 1783 | + } |
|
| 1602 | 1784 | |
| 1603 | 1785 | // Get the number of xml files to create a table in schemas |
| 1604 | 1786 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1608,13 +1790,17 @@ discard block |
||
| 1608 | 1790 | for($j=0;$j<$table_count;$j++) |
| 1609 | 1791 | { |
| 1610 | 1792 | list($table_name) = explode('.',$tmp_files[$j]); |
| 1611 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1793 | + if($oDB->isTableExists($table_name)) { |
|
| 1794 | + $created_table_count ++; |
|
| 1795 | + } |
|
| 1612 | 1796 | } |
| 1613 | 1797 | // Get information of the module |
| 1614 | 1798 | $info = NULL; |
| 1615 | 1799 | $info = $this->getModuleInfoXml($module_name); |
| 1616 | 1800 | |
| 1617 | - if(!$info) continue; |
|
| 1801 | + if(!$info) { |
|
| 1802 | + continue; |
|
| 1803 | + } |
|
| 1618 | 1804 | |
| 1619 | 1805 | $info->module = $module_name; |
| 1620 | 1806 | $info->category = $info->category; |
@@ -1623,16 +1809,18 @@ discard block |
||
| 1623 | 1809 | $info->path = $path; |
| 1624 | 1810 | $info->admin_index_act = $info->admin_index_act; |
| 1625 | 1811 | // Check if DB is installed |
| 1626 | - if($table_count > $created_table_count) $info->need_install = true; |
|
| 1627 | - else $info->need_install = false; |
|
| 1812 | + if($table_count > $created_table_count) { |
|
| 1813 | + $info->need_install = true; |
|
| 1814 | + } else { |
|
| 1815 | + $info->need_install = false; |
|
| 1816 | + } |
|
| 1628 | 1817 | // Check if it is upgraded to module.class.php on each module |
| 1629 | 1818 | $oDummy = null; |
| 1630 | 1819 | $oDummy = getModule($module_name, 'class'); |
| 1631 | 1820 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
| 1632 | 1821 | { |
| 1633 | 1822 | $info->need_update = $oDummy->checkUpdate(); |
| 1634 | - } |
|
| 1635 | - else |
|
| 1823 | + } else |
|
| 1636 | 1824 | { |
| 1637 | 1825 | continue; |
| 1638 | 1826 | } |
@@ -1649,7 +1837,9 @@ discard block |
||
| 1649 | 1837 | */ |
| 1650 | 1838 | function syncModuleToSite(&$data) |
| 1651 | 1839 | { |
| 1652 | - if(!$data) return; |
|
| 1840 | + if(!$data) { |
|
| 1841 | + return; |
|
| 1842 | + } |
|
| 1653 | 1843 | |
| 1654 | 1844 | if(is_array($data)) |
| 1655 | 1845 | { |
@@ -1657,9 +1847,10 @@ discard block |
||
| 1657 | 1847 | { |
| 1658 | 1848 | $module_srls[] = $val->module_srl; |
| 1659 | 1849 | } |
| 1660 | - if(!count($module_srls)) return; |
|
| 1661 | - } |
|
| 1662 | - else |
|
| 1850 | + if(!count($module_srls)) { |
|
| 1851 | + return; |
|
| 1852 | + } |
|
| 1853 | + } else |
|
| 1663 | 1854 | { |
| 1664 | 1855 | $module_srls[] = $data->module_srl; |
| 1665 | 1856 | } |
@@ -1667,7 +1858,9 @@ discard block |
||
| 1667 | 1858 | $args = new stdClass(); |
| 1668 | 1859 | $args->module_srls = implode(',',$module_srls); |
| 1669 | 1860 | $output = executeQueryArray('module.getModuleSites', $args); |
| 1670 | - if(!$output->data) return array(); |
|
| 1861 | + if(!$output->data) { |
|
| 1862 | + return array(); |
|
| 1863 | + } |
|
| 1671 | 1864 | foreach($output->data as $key => $val) |
| 1672 | 1865 | { |
| 1673 | 1866 | $modules[$val->module_srl] = $val; |
@@ -1679,8 +1872,7 @@ discard block |
||
| 1679 | 1872 | { |
| 1680 | 1873 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
| 1681 | 1874 | } |
| 1682 | - } |
|
| 1683 | - else |
|
| 1875 | + } else |
|
| 1684 | 1876 | { |
| 1685 | 1877 | $data->domain = $modules[$data->module_srl]->domain; |
| 1686 | 1878 | } |
@@ -1691,24 +1883,31 @@ discard block |
||
| 1691 | 1883 | */ |
| 1692 | 1884 | function isSiteAdmin($member_info, $site_srl = null) |
| 1693 | 1885 | { |
| 1694 | - if(!$member_info->member_srl) return false; |
|
| 1695 | - if($member_info->is_admin == 'Y') return true; |
|
| 1886 | + if(!$member_info->member_srl) { |
|
| 1887 | + return false; |
|
| 1888 | + } |
|
| 1889 | + if($member_info->is_admin == 'Y') { |
|
| 1890 | + return true; |
|
| 1891 | + } |
|
| 1696 | 1892 | |
| 1697 | 1893 | $args = new stdClass(); |
| 1698 | 1894 | if(!isset($site_srl)) |
| 1699 | 1895 | { |
| 1700 | 1896 | $site_module_info = Context::get('site_module_info'); |
| 1701 | - if(!$site_module_info) return; |
|
| 1897 | + if(!$site_module_info) { |
|
| 1898 | + return; |
|
| 1899 | + } |
|
| 1702 | 1900 | $args->site_srl = $site_module_info->site_srl; |
| 1703 | - } |
|
| 1704 | - else |
|
| 1901 | + } else |
|
| 1705 | 1902 | { |
| 1706 | 1903 | $args->site_srl = $site_srl; |
| 1707 | 1904 | } |
| 1708 | 1905 | |
| 1709 | 1906 | $args->member_srl = $member_info->member_srl; |
| 1710 | 1907 | $output = executeQuery('module.isSiteAdmin', $args); |
| 1711 | - if($output->data->member_srl == $args->member_srl) return true; |
|
| 1908 | + if($output->data->member_srl == $args->member_srl) { |
|
| 1909 | + return true; |
|
| 1910 | + } |
|
| 1712 | 1911 | return false; |
| 1713 | 1912 | } |
| 1714 | 1913 | |
@@ -1731,7 +1930,9 @@ discard block |
||
| 1731 | 1930 | $obj = new stdClass(); |
| 1732 | 1931 | $obj->module_srl = $module_srl; |
| 1733 | 1932 | $output = executeQueryArray('module.getAdminID', $obj); |
| 1734 | - if(!$output->toBool() || !$output->data) return; |
|
| 1933 | + if(!$output->toBool() || !$output->data) { |
|
| 1934 | + return; |
|
| 1935 | + } |
|
| 1735 | 1936 | |
| 1736 | 1937 | return $output->data; |
| 1737 | 1938 | } |
@@ -1744,7 +1945,9 @@ discard block |
||
| 1744 | 1945 | { |
| 1745 | 1946 | $extra_vars = array(); |
| 1746 | 1947 | $get_module_srls = array(); |
| 1747 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1948 | + if(!is_array($list_module_srl)) { |
|
| 1949 | + $list_module_srl = array($list_module_srl); |
|
| 1950 | + } |
|
| 1748 | 1951 | |
| 1749 | 1952 | $vars = false; |
| 1750 | 1953 | // cache controll |
@@ -1760,14 +1963,12 @@ discard block |
||
| 1760 | 1963 | if($vars) |
| 1761 | 1964 | { |
| 1762 | 1965 | $extra_vars[$module_srl] = $vars; |
| 1763 | - } |
|
| 1764 | - else |
|
| 1966 | + } else |
|
| 1765 | 1967 | { |
| 1766 | 1968 | $get_module_srls[] = $module_srl; |
| 1767 | 1969 | } |
| 1768 | 1970 | } |
| 1769 | - } |
|
| 1770 | - else |
|
| 1971 | + } else |
|
| 1771 | 1972 | { |
| 1772 | 1973 | $get_module_srls = $list_module_srl; |
| 1773 | 1974 | } |
@@ -1792,7 +1993,9 @@ discard block |
||
| 1792 | 1993 | } |
| 1793 | 1994 | foreach($output->data as $key => $val) |
| 1794 | 1995 | { |
| 1795 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
| 1996 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
| 1997 | + continue; |
|
| 1998 | + } |
|
| 1796 | 1999 | |
| 1797 | 2000 | if(!isset($extra_vars[$val->module_srl])) |
| 1798 | 2001 | { |
@@ -1831,7 +2034,9 @@ discard block |
||
| 1831 | 2034 | $args = new stdClass(); |
| 1832 | 2035 | $args->module_srl = $module_srl; |
| 1833 | 2036 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
| 1834 | - if(!$output->toBool()) return; |
|
| 2037 | + if(!$output->toBool()) { |
|
| 2038 | + return; |
|
| 2039 | + } |
|
| 1835 | 2040 | |
| 1836 | 2041 | $skin_vars = array(); |
| 1837 | 2042 | foreach($output->data as $vars) |
@@ -1839,7 +2044,9 @@ discard block |
||
| 1839 | 2044 | $skin_vars[$vars->name] = $vars; |
| 1840 | 2045 | } |
| 1841 | 2046 | |
| 1842 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2047 | + if($oCacheHandler->isSupport()) { |
|
| 2048 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2049 | + } |
|
| 1843 | 2050 | } |
| 1844 | 2051 | |
| 1845 | 2052 | return $skin_vars; |
@@ -1851,7 +2058,9 @@ discard block |
||
| 1851 | 2058 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
| 1852 | 2059 | { |
| 1853 | 2060 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
| 1854 | - if(!$site_srl) $site_srl = 0; |
|
| 2061 | + if(!$site_srl) { |
|
| 2062 | + $site_srl = 0; |
|
| 2063 | + } |
|
| 1855 | 2064 | |
| 1856 | 2065 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
| 1857 | 2066 | if(is_readable($designInfoFile)) |
@@ -1868,19 +2077,16 @@ discard block |
||
| 1868 | 2077 | if(is_dir($moduleSkinPath.'default')) |
| 1869 | 2078 | { |
| 1870 | 2079 | $skinName = 'default'; |
| 1871 | - } |
|
| 1872 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 2080 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 1873 | 2081 | { |
| 1874 | 2082 | $skinName = 'xe_default'; |
| 1875 | - } |
|
| 1876 | - else |
|
| 2083 | + } else |
|
| 1877 | 2084 | { |
| 1878 | 2085 | $skins = FileHandler::readDir($moduleSkinPath); |
| 1879 | 2086 | if(count($skins) > 0) |
| 1880 | 2087 | { |
| 1881 | 2088 | $skinName = $skins[0]; |
| 1882 | - } |
|
| 1883 | - else |
|
| 2089 | + } else |
|
| 1884 | 2090 | { |
| 1885 | 2091 | $skinName = NULL; |
| 1886 | 2092 | } |
@@ -1888,7 +2094,9 @@ discard block |
||
| 1888 | 2094 | |
| 1889 | 2095 | if($updateCache && $skinName) |
| 1890 | 2096 | { |
| 1891 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 2097 | + if(!isset($designInfo->module->{$module_name})) { |
|
| 2098 | + $designInfo->module->{$module_name} = new stdClass(); |
|
| 2099 | + } |
|
| 1892 | 2100 | $designInfo->module->{$module_name}->{$target} = $skinName; |
| 1893 | 2101 | |
| 1894 | 2102 | $oAdminController = getAdminController('admin'); |
@@ -1904,23 +2112,28 @@ discard block |
||
| 1904 | 2112 | */ |
| 1905 | 2113 | function syncSkinInfoToModuleInfo(&$module_info) |
| 1906 | 2114 | { |
| 1907 | - if(!$module_info->module_srl) return; |
|
| 2115 | + if(!$module_info->module_srl) { |
|
| 2116 | + return; |
|
| 2117 | + } |
|
| 1908 | 2118 | |
| 1909 | 2119 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1910 | 2120 | if(Mobile::isFromMobilePhone()) |
| 1911 | 2121 | { |
| 1912 | 2122 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
| 1913 | - } |
|
| 1914 | - else |
|
| 2123 | + } else |
|
| 1915 | 2124 | { |
| 1916 | 2125 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
| 1917 | 2126 | } |
| 1918 | 2127 | |
| 1919 | - if(!$skin_vars) return; |
|
| 2128 | + if(!$skin_vars) { |
|
| 2129 | + return; |
|
| 2130 | + } |
|
| 1920 | 2131 | |
| 1921 | 2132 | foreach($skin_vars as $name => $val) |
| 1922 | 2133 | { |
| 1923 | - if(isset($module_info->{$name})) continue; |
|
| 2134 | + if(isset($module_info->{$name})) { |
|
| 2135 | + continue; |
|
| 2136 | + } |
|
| 1924 | 2137 | $module_info->{$name} = $val->value; |
| 1925 | 2138 | } |
| 1926 | 2139 | } |
@@ -1946,7 +2159,9 @@ discard block |
||
| 1946 | 2159 | $args = new stdClass(); |
| 1947 | 2160 | $args->module_srl = $module_srl; |
| 1948 | 2161 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
| 1949 | - if(!$output->toBool() || !$output->data) return; |
|
| 2162 | + if(!$output->toBool() || !$output->data) { |
|
| 2163 | + return; |
|
| 2164 | + } |
|
| 1950 | 2165 | |
| 1951 | 2166 | $skin_vars = array(); |
| 1952 | 2167 | foreach($output->data as $vars) |
@@ -1954,7 +2169,9 @@ discard block |
||
| 1954 | 2169 | $skin_vars[$vars->name] = $vars; |
| 1955 | 2170 | } |
| 1956 | 2171 | |
| 1957 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2172 | + if($oCacheHandler->isSupport()) { |
|
| 2173 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2174 | + } |
|
| 1958 | 2175 | } |
| 1959 | 2176 | |
| 1960 | 2177 | return $skin_vars; |
@@ -1966,7 +2183,9 @@ discard block |
||
| 1966 | 2183 | */ |
| 1967 | 2184 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
| 1968 | 2185 | { |
| 1969 | - if(!$module_info->module_srl) return; |
|
| 2186 | + if(!$module_info->module_srl) { |
|
| 2187 | + return; |
|
| 2188 | + } |
|
| 1970 | 2189 | $skin_vars = false; |
| 1971 | 2190 | // cache controll |
| 1972 | 2191 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1981,17 +2200,25 @@ discard block |
||
| 1981 | 2200 | $args = new stdClass; |
| 1982 | 2201 | $args->module_srl = $module_info->module_srl; |
| 1983 | 2202 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
| 1984 | - if(!$output->toBool()) return; |
|
| 2203 | + if(!$output->toBool()) { |
|
| 2204 | + return; |
|
| 2205 | + } |
|
| 1985 | 2206 | $skin_vars = $output->data; |
| 1986 | 2207 | |
| 1987 | 2208 | //insert in cache |
| 1988 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2209 | + if($oCacheHandler->isSupport()) { |
|
| 2210 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2211 | + } |
|
| 2212 | + } |
|
| 2213 | + if(!$skin_vars) { |
|
| 2214 | + return; |
|
| 1989 | 2215 | } |
| 1990 | - if(!$skin_vars) return; |
|
| 1991 | 2216 | |
| 1992 | 2217 | foreach($output->data as $val) |
| 1993 | 2218 | { |
| 1994 | - if(isset($module_info->{$val->name})) continue; |
|
| 2219 | + if(isset($module_info->{$val->name})) { |
|
| 2220 | + continue; |
|
| 2221 | + } |
|
| 1995 | 2222 | $module_info->{$val->name} = $val->value; |
| 1996 | 2223 | } |
| 1997 | 2224 | } |
@@ -2013,10 +2240,12 @@ discard block |
||
| 2013 | 2240 | $grant_info = $xml_info->grant; |
| 2014 | 2241 | if($member_info->member_srl) |
| 2015 | 2242 | { |
| 2016 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 2017 | - else $group_list = array(); |
|
| 2018 | - } |
|
| 2019 | - else |
|
| 2243 | + if(is_array($member_info->group_list)) { |
|
| 2244 | + $group_list = array_keys($member_info->group_list); |
|
| 2245 | + } else { |
|
| 2246 | + $group_list = array(); |
|
| 2247 | + } |
|
| 2248 | + } else |
|
| 2020 | 2249 | { |
| 2021 | 2250 | $group_list = array(); |
| 2022 | 2251 | } |
@@ -2030,8 +2259,7 @@ discard block |
||
| 2030 | 2259 | } |
| 2031 | 2260 | |
| 2032 | 2261 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
| 2033 | - } |
|
| 2034 | - else |
|
| 2262 | + } else |
|
| 2035 | 2263 | { |
| 2036 | 2264 | // If module_srl exists |
| 2037 | 2265 | // Get a type of granted permission |
@@ -2044,7 +2272,9 @@ discard block |
||
| 2044 | 2272 | $args->module_srl = $module_srl; |
| 2045 | 2273 | $args->member_srl = $member_info->member_srl; |
| 2046 | 2274 | $output = executeQuery('module.getModuleAdmin',$args); |
| 2047 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2275 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
| 2276 | + $grant->manager = true; |
|
| 2277 | + } |
|
| 2048 | 2278 | } |
| 2049 | 2279 | // If not an administrator, get information from the DB and grant manager privilege. |
| 2050 | 2280 | if(!$grant->manager) |
@@ -2054,8 +2284,7 @@ discard block |
||
| 2054 | 2284 | if($module_info->module == 'planet') |
| 2055 | 2285 | { |
| 2056 | 2286 | $output = executeQueryArray('module.getPlanetGrants', $args); |
| 2057 | - } |
|
| 2058 | - else |
|
| 2287 | + } else |
|
| 2059 | 2288 | { |
| 2060 | 2289 | $args = new stdClass; |
| 2061 | 2290 | $args->module_srl = $module_srl; |
@@ -2070,42 +2299,48 @@ discard block |
||
| 2070 | 2299 | foreach($output->data as $val) |
| 2071 | 2300 | { |
| 2072 | 2301 | $grant_exists[$val->name] = true; |
| 2073 | - if($granted[$val->name]) continue; |
|
| 2302 | + if($granted[$val->name]) { |
|
| 2303 | + continue; |
|
| 2304 | + } |
|
| 2074 | 2305 | // Log-in member only |
| 2075 | 2306 | if($val->group_srl == -1) |
| 2076 | 2307 | { |
| 2077 | 2308 | $granted[$val->name] = true; |
| 2078 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2309 | + if($member_info->member_srl) { |
|
| 2310 | + $grant->{$val->name} = true; |
|
| 2311 | + } |
|
| 2079 | 2312 | // Site-joined member only |
| 2080 | - } |
|
| 2081 | - elseif($val->group_srl == -2) |
|
| 2313 | + } elseif($val->group_srl == -2) |
|
| 2082 | 2314 | { |
| 2083 | 2315 | $granted[$val->name] = true; |
| 2084 | 2316 | // Do not grant any permission for non-logged member |
| 2085 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2317 | + if(!$member_info->member_srl) { |
|
| 2318 | + $grant->{$val->name} = false; |
|
| 2319 | + } |
|
| 2086 | 2320 | // Log-in member |
| 2087 | 2321 | else |
| 2088 | 2322 | { |
| 2089 | 2323 | $site_module_info = Context::get('site_module_info'); |
| 2090 | 2324 | // Permission granted if no information of the currently connected site exists |
| 2091 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2325 | + if(!$site_module_info->site_srl) { |
|
| 2326 | + $grant->{$val->name} = true; |
|
| 2327 | + } |
|
| 2092 | 2328 | // Permission is not granted if information of the currently connected site exists |
| 2093 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
| 2329 | + elseif(count($group_list)) { |
|
| 2330 | + $grant->{$val->name} = true; |
|
| 2331 | + } |
|
| 2094 | 2332 | } |
| 2095 | 2333 | // All of non-logged members |
| 2096 | - } |
|
| 2097 | - elseif($val->group_srl == -3) |
|
| 2334 | + } elseif($val->group_srl == -3) |
|
| 2098 | 2335 | { |
| 2099 | 2336 | $granted[$val->name] = true; |
| 2100 | 2337 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
| 2101 | - } |
|
| 2102 | - elseif($val->group_srl == 0) |
|
| 2338 | + } elseif($val->group_srl == 0) |
|
| 2103 | 2339 | { |
| 2104 | 2340 | $granted[$val->name] = true; |
| 2105 | 2341 | $grant->{$val->name} = true; |
| 2106 | 2342 | // If a target is a group |
| 2107 | - } |
|
| 2108 | - else |
|
| 2343 | + } else |
|
| 2109 | 2344 | { |
| 2110 | 2345 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
| 2111 | 2346 | { |
@@ -2116,30 +2351,43 @@ discard block |
||
| 2116 | 2351 | } |
| 2117 | 2352 | } |
| 2118 | 2353 | // Separate processing for the virtual group access |
| 2119 | - if(!$grant_exists['access']) $grant->access = true; |
|
| 2354 | + if(!$grant_exists['access']) { |
|
| 2355 | + $grant->access = true; |
|
| 2356 | + } |
|
| 2120 | 2357 | if(count($grant_info)) |
| 2121 | 2358 | { |
| 2122 | 2359 | foreach($grant_info as $grant_name => $grant_item) |
| 2123 | 2360 | { |
| 2124 | - if($grant_exists[$grant_name]) continue; |
|
| 2361 | + if($grant_exists[$grant_name]) { |
|
| 2362 | + continue; |
|
| 2363 | + } |
|
| 2125 | 2364 | switch($grant_item->default) |
| 2126 | 2365 | { |
| 2127 | 2366 | case 'guest' : |
| 2128 | 2367 | $grant->{$grant_name} = true; |
| 2129 | 2368 | break; |
| 2130 | 2369 | case 'member' : |
| 2131 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2132 | - else $grant->{$grant_name} = false; |
|
| 2370 | + if($member_info->member_srl) { |
|
| 2371 | + $grant->{$grant_name} = true; |
|
| 2372 | + } else { |
|
| 2373 | + $grant->{$grant_name} = false; |
|
| 2374 | + } |
|
| 2133 | 2375 | break; |
| 2134 | 2376 | case 'site' : |
| 2135 | 2377 | $site_module_info = Context::get('site_module_info'); |
| 2136 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2137 | - else $grant->{$grant_name} = false; |
|
| 2378 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
| 2379 | + $grant->{$grant_name} = true; |
|
| 2380 | + } else { |
|
| 2381 | + $grant->{$grant_name} = false; |
|
| 2382 | + } |
|
| 2138 | 2383 | break; |
| 2139 | 2384 | case 'manager' : |
| 2140 | 2385 | case 'root' : |
| 2141 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2142 | - else $grant->{$grant_name} = false; |
|
| 2386 | + if($member_info->is_admin == 'Y') { |
|
| 2387 | + $grant->{$grant_name} = true; |
|
| 2388 | + } else { |
|
| 2389 | + $grant->{$grant_name} = false; |
|
| 2390 | + } |
|
| 2143 | 2391 | break; |
| 2144 | 2392 | } |
| 2145 | 2393 | } |
@@ -2215,16 +2463,22 @@ discard block |
||
| 2215 | 2463 | function getFileBoxListHtml() |
| 2216 | 2464 | { |
| 2217 | 2465 | $logged_info = Context::get('logged_info'); |
| 2218 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2466 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 2467 | + return new Object(-1, 'msg_not_permitted'); |
|
| 2468 | + } |
|
| 2219 | 2469 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
| 2220 | 2470 | $link_params = explode('&',$link['query']); |
| 2221 | 2471 | foreach ($link_params as $param) |
| 2222 | 2472 | { |
| 2223 | 2473 | $param = explode("=",$param); |
| 2224 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2474 | + if($param[0] == 'selected_widget') { |
|
| 2475 | + $selected_widget = $param[1]; |
|
| 2476 | + } |
|
| 2225 | 2477 | } |
| 2226 | 2478 | $oWidgetModel = getModel('widget'); |
| 2227 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2479 | + if($selected_widget) { |
|
| 2480 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2481 | + } |
|
| 2228 | 2482 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
| 2229 | 2483 | |
| 2230 | 2484 | $oModuleModel = getModel('module'); |
@@ -2232,7 +2486,9 @@ discard block |
||
| 2232 | 2486 | Context::set('filebox_list', $output->data); |
| 2233 | 2487 | |
| 2234 | 2488 | $page = Context::get('page'); |
| 2235 | - if (!$page) $page = 1; |
|
| 2489 | + if (!$page) { |
|
| 2490 | + $page = 1; |
|
| 2491 | + } |
|
| 2236 | 2492 | Context::set('page', $page); |
| 2237 | 2493 | Context::set('page_navigation', $output->page_navigation); |
| 2238 | 2494 | |
@@ -2262,25 +2518,28 @@ discard block |
||
| 2262 | 2518 | $rulsetFile = str_replace('@', '', $ruleset); |
| 2263 | 2519 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2264 | 2520 | return FileHandler::getRealPath($xml_file); |
| 2265 | - } |
|
| 2266 | - else if (strpos($ruleset, '#') !== false) |
|
| 2521 | + } else if (strpos($ruleset, '#') !== false) |
|
| 2267 | 2522 | { |
| 2268 | 2523 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
| 2269 | 2524 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2270 | - if(is_readable($xml_file)) |
|
| 2271 | - return FileHandler::getRealPath($xml_file); |
|
| 2272 | - else{ |
|
| 2525 | + if(is_readable($xml_file)) { |
|
| 2526 | + return FileHandler::getRealPath($xml_file); |
|
| 2527 | + } else{ |
|
| 2273 | 2528 | $ruleset = str_replace('#', '', $ruleset); |
| 2274 | 2529 | } |
| 2275 | 2530 | |
| 2276 | 2531 | } |
| 2277 | 2532 | // Get a path of the requested module. Return if not exists. |
| 2278 | 2533 | $class_path = ModuleHandler::getModulePath($module); |
| 2279 | - if(!$class_path) return; |
|
| 2534 | + if(!$class_path) { |
|
| 2535 | + return; |
|
| 2536 | + } |
|
| 2280 | 2537 | |
| 2281 | 2538 | // Check if module.xml exists in the path. Return if not exist |
| 2282 | 2539 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
| 2283 | - if(!file_exists($xml_file)) return; |
|
| 2540 | + if(!file_exists($xml_file)) { |
|
| 2541 | + return; |
|
| 2542 | + } |
|
| 2284 | 2543 | |
| 2285 | 2544 | return $xml_file; |
| 2286 | 2545 | } |
@@ -2330,7 +2589,9 @@ discard block |
||
| 2330 | 2589 | function getLangByLangcode() |
| 2331 | 2590 | { |
| 2332 | 2591 | $langCode = Context::get('langCode'); |
| 2333 | - if (!$langCode) return; |
|
| 2592 | + if (!$langCode) { |
|
| 2593 | + return; |
|
| 2594 | + } |
|
| 2334 | 2595 | |
| 2335 | 2596 | $oModuleController = getController('module'); |
| 2336 | 2597 | $oModuleController->replaceDefinedLangCode($langCode); |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | $oModuleModel = getModel('module'); |
| 33 | 33 | $oModuleController = getController('module'); |
| 34 | 34 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 35 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 35 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 36 | 36 | { |
| 37 | 37 | // 2009. 02. 11 menu added to the table site_srl |
| 38 | - if(!$oDB->isColumnExists('menu', 'site_srl')) return true; |
|
| 38 | + if (!$oDB->isColumnExists('menu', 'site_srl')) return true; |
|
| 39 | 39 | |
| 40 | 40 | // 2012. 02. 01 title index check |
| 41 | - if(!$oDB->isIndexExists("menu", "idx_title")) return true; |
|
| 41 | + if (!$oDB->isIndexExists("menu", "idx_title")) return true; |
|
| 42 | 42 | |
| 43 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 43 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 44 | 44 | { |
| 45 | 45 | return TRUE; |
| 46 | 46 | } |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | $args = new stdClass(); |
| 50 | 50 | $args->title = array("Temporary menu"); |
| 51 | 51 | $temp_menus = executeQueryArray('menu.getMenuByTitle', $args); |
| 52 | - if($temp_menus->toBool() && count($temp_menus->data)) return true; |
|
| 52 | + if ($temp_menus->toBool() && count($temp_menus->data)) return true; |
|
| 53 | 53 | |
| 54 | 54 | // 2015. 06. 15 add column desc |
| 55 | - if(!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 55 | + if (!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 56 | 56 | { |
| 57 | 57 | return true; |
| 58 | 58 | } |
@@ -72,28 +72,28 @@ discard block |
||
| 72 | 72 | $oModuleModel = getModel('module'); |
| 73 | 73 | $oModuleController = getController('module'); |
| 74 | 74 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 75 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 75 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 76 | 76 | { |
| 77 | 77 | // 2009. 02. 11 menu added to the table site_srl |
| 78 | - if(!$oDB->isColumnExists('menu', 'site_srl')) |
|
| 78 | + if (!$oDB->isColumnExists('menu', 'site_srl')) |
|
| 79 | 79 | { |
| 80 | - $oDB->addColumn('menu','site_srl','number',11,0,true); |
|
| 80 | + $oDB->addColumn('menu', 'site_srl', 'number', 11, 0, true); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // 2012. 02. 01 title index check |
| 84 | - if(!$oDB->isIndexExists("menu","idx_title")) |
|
| 84 | + if (!$oDB->isIndexExists("menu", "idx_title")) |
|
| 85 | 85 | { |
| 86 | 86 | $oDB->addIndex('menu', 'idx_title', array('title')); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // 2015. 06. 15 add column desc |
| 90 | - if(!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 90 | + if (!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 91 | 91 | { |
| 92 | - $oDB->addColumn('menu_item', 'desc','varchar',250,"",true); |
|
| 92 | + $oDB->addColumn('menu_item', 'desc', 'varchar', 250, "", true); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // 1.7(maserati) shortcut column add and mirgration |
| 96 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 96 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 97 | 97 | { |
| 98 | 98 | $oDB->addColumn('menu_item', 'is_shortcut', 'char', 1, 'N'); |
| 99 | 99 | |
@@ -101,27 +101,27 @@ discard block |
||
| 101 | 101 | $oMenuAdminModel = getAdminModel('menu'); |
| 102 | 102 | $output = $oMenuAdminModel->getMenus(); |
| 103 | 103 | |
| 104 | - if(is_array($output)) |
|
| 104 | + if (is_array($output)) |
|
| 105 | 105 | { |
| 106 | 106 | $menuItemUniqueList = array(); |
| 107 | 107 | $menuItemAllList = array(); |
| 108 | - foreach($output AS $key=>$value) |
|
| 108 | + foreach ($output AS $key=>$value) |
|
| 109 | 109 | { |
| 110 | 110 | unset($args); |
| 111 | 111 | $args->menu_srl = $value->menu_srl; |
| 112 | 112 | $output2 = executeQueryArray('menu.getMenuItems', $args); |
| 113 | - if(is_array($output2->data)) |
|
| 113 | + if (is_array($output2->data)) |
|
| 114 | 114 | { |
| 115 | - foreach($output2->data AS $key2=>$value2) |
|
| 115 | + foreach ($output2->data AS $key2=>$value2) |
|
| 116 | 116 | { |
| 117 | 117 | $menuItemAllList[$value2->menu_item_srl] = $value2->url; |
| 118 | - if(!in_array($value2->url, $menuItemUniqueList)) |
|
| 118 | + if (!in_array($value2->url, $menuItemUniqueList)) |
|
| 119 | 119 | { |
| 120 | 120 | $menuItemUniqueList[$value2->menu_item_srl] = $value2->url; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // if url is empty, change type to shortcurt |
| 124 | - if($value2->is_shortcut == 'N' && (!$value2->url || strncasecmp('http', $value2->url, 4) === 0)) |
|
| 124 | + if ($value2->is_shortcut == 'N' && (!$value2->url || strncasecmp('http', $value2->url, 4) === 0)) |
|
| 125 | 125 | { |
| 126 | 126 | $value2->is_shortcut = 'Y'; |
| 127 | 127 | $output3 = executeQuery('menu.updateMenuItem', $value2); |
@@ -133,29 +133,29 @@ discard block |
||
| 133 | 133 | $oModuleModel = getModel('module'); |
| 134 | 134 | // if duplicate reference, change type to shortcut |
| 135 | 135 | $shortcutItemList = array_diff_assoc($menuItemAllList, $menuItemUniqueList); |
| 136 | - foreach($output AS $key=>$value) |
|
| 136 | + foreach ($output AS $key=>$value) |
|
| 137 | 137 | { |
| 138 | 138 | unset($args); |
| 139 | 139 | $args->menu_srl = $value->menu_srl; |
| 140 | 140 | $output2 = executeQueryArray('menu.getMenuItems', $args); |
| 141 | - if(is_array($output2->data)) |
|
| 141 | + if (is_array($output2->data)) |
|
| 142 | 142 | { |
| 143 | - foreach($output2->data AS $key2=>$value2) |
|
| 143 | + foreach ($output2->data AS $key2=>$value2) |
|
| 144 | 144 | { |
| 145 | - if(!empty($value2->url) && strncasecmp('http', $value2->url, 4) !== 0) |
|
| 145 | + if (!empty($value2->url) && strncasecmp('http', $value2->url, 4) !== 0) |
|
| 146 | 146 | { |
| 147 | 147 | $moduleInfo = $oModuleModel->getModuleInfoByMid($value2->url); |
| 148 | - if(!$moduleInfo->module_srl) |
|
| 148 | + if (!$moduleInfo->module_srl) |
|
| 149 | 149 | { |
| 150 | 150 | $value2->url = Context::getDefaultUrl(); |
| 151 | - if(!$value2->url) $value2->url = '#'; |
|
| 151 | + if (!$value2->url) $value2->url = '#'; |
|
| 152 | 152 | $value2->is_shortcut = 'Y'; |
| 153 | 153 | |
| 154 | 154 | $updateOutput = executeQuery('menu.updateMenuItem', $value2); |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if($shortcutItemList[$value2->menu_item_srl]) |
|
| 158 | + if ($shortcutItemList[$value2->menu_item_srl]) |
|
| 159 | 159 | { |
| 160 | 160 | $value2->is_shortcut = 'Y'; |
| 161 | 161 | $output3 = executeQuery('menu.updateMenuItem', $value2); |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | $temp_menus = executeQueryArray('menu.getMenuByTitle', $args); |
| 176 | 176 | |
| 177 | 177 | $args = new stdClass(); |
| 178 | - if($temp_menus->toBool() && count($temp_menus->data)) |
|
| 178 | + if ($temp_menus->toBool() && count($temp_menus->data)) |
|
| 179 | 179 | { |
| 180 | 180 | $oMenuAdminController = getAdminController('menu'); |
| 181 | - foreach($temp_menus->data as $menu) |
|
| 181 | + foreach ($temp_menus->data as $menu) |
|
| 182 | 182 | { |
| 183 | 183 | $args->current_menu_srl = $menu->menu_srl; |
| 184 | 184 | $args->menu_srl = $oMenuAdminController->getUnlinkedMenu(); |
| 185 | 185 | $output3 = executeQuery('menu.updateMenuItems', $args); |
| 186 | 186 | |
| 187 | - if($output3->toBool()) |
|
| 187 | + if ($output3->toBool()) |
|
| 188 | 188 | { |
| 189 | 189 | // delete |
| 190 | 190 | $oMenuAdminController->deleteMenu($menu->menu_srl); |
@@ -219,23 +219,23 @@ discard block |
||
| 219 | 219 | // Wanted list of all the blog module |
| 220 | 220 | $output = executeQueryArray("menu.getMenus"); |
| 221 | 221 | $list = $output->data; |
| 222 | - if(!count($list)) return; |
|
| 222 | + if (!count($list)) return; |
|
| 223 | 223 | // The menu module is used in the re-create all the menu list |
| 224 | - foreach($list as $menu_item) |
|
| 224 | + foreach ($list as $menu_item) |
|
| 225 | 225 | { |
| 226 | 226 | $menu_srl = $menu_item->menu_srl; |
| 227 | 227 | $oMenuAdminController->makeXmlFile($menu_srl); |
| 228 | 228 | |
| 229 | 229 | // for homeSitemap.php regenrate |
| 230 | - if(!$homeMenuSrl) |
|
| 230 | + if (!$homeMenuSrl) |
|
| 231 | 231 | { |
| 232 | 232 | $menuItemList = $oMenuAdminModel->getMenuItems($menu_srl); |
| 233 | 233 | |
| 234 | - if(is_array($menuItemList->data)) |
|
| 234 | + if (is_array($menuItemList->data)) |
|
| 235 | 235 | { |
| 236 | - foreach($menuItemList->data AS $key=>$value) |
|
| 236 | + foreach ($menuItemList->data AS $key=>$value) |
|
| 237 | 237 | { |
| 238 | - if($homeModuleMid == $value->url) |
|
| 238 | + if ($homeModuleMid == $value->url) |
|
| 239 | 239 | { |
| 240 | 240 | $homeMenuSrl = $menu_srl; |
| 241 | 241 | break; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if($homeMenuSrl) |
|
| 248 | + if ($homeMenuSrl) |
|
| 249 | 249 | { |
| 250 | 250 | $oMenuAdminController->makeHomemenuCacheFile($homeMenuSrl); |
| 251 | 251 | } |
@@ -35,10 +35,14 @@ discard block |
||
| 35 | 35 | if($oModuleModel->needUpdate($version_update_id)) |
| 36 | 36 | { |
| 37 | 37 | // 2009. 02. 11 menu added to the table site_srl |
| 38 | - if(!$oDB->isColumnExists('menu', 'site_srl')) return true; |
|
| 38 | + if(!$oDB->isColumnExists('menu', 'site_srl')) { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | // 2012. 02. 01 title index check |
| 41 | - if(!$oDB->isIndexExists("menu", "idx_title")) return true; |
|
| 43 | + if(!$oDB->isIndexExists("menu", "idx_title")) { |
|
| 44 | + return true; |
|
| 45 | + } |
|
| 42 | 46 | |
| 43 | 47 | if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
| 44 | 48 | { |
@@ -49,7 +53,9 @@ discard block |
||
| 49 | 53 | $args = new stdClass(); |
| 50 | 54 | $args->title = array("Temporary menu"); |
| 51 | 55 | $temp_menus = executeQueryArray('menu.getMenuByTitle', $args); |
| 52 | - if($temp_menus->toBool() && count($temp_menus->data)) return true; |
|
| 56 | + if($temp_menus->toBool() && count($temp_menus->data)) { |
|
| 57 | + return true; |
|
| 58 | + } |
|
| 53 | 59 | |
| 54 | 60 | // 2015. 06. 15 add column desc |
| 55 | 61 | if(!$oDB->isColumnExists('menu_item', 'desc')) |
@@ -148,7 +154,9 @@ discard block |
||
| 148 | 154 | if(!$moduleInfo->module_srl) |
| 149 | 155 | { |
| 150 | 156 | $value2->url = Context::getDefaultUrl(); |
| 151 | - if(!$value2->url) $value2->url = '#'; |
|
| 157 | + if(!$value2->url) { |
|
| 158 | + $value2->url = '#'; |
|
| 159 | + } |
|
| 152 | 160 | $value2->is_shortcut = 'Y'; |
| 153 | 161 | |
| 154 | 162 | $updateOutput = executeQuery('menu.updateMenuItem', $value2); |
@@ -219,7 +227,9 @@ discard block |
||
| 219 | 227 | // Wanted list of all the blog module |
| 220 | 228 | $output = executeQueryArray("menu.getMenus"); |
| 221 | 229 | $list = $output->data; |
| 222 | - if(!count($list)) return; |
|
| 230 | + if(!count($list)) { |
|
| 231 | + return; |
|
| 232 | + } |
|
| 223 | 233 | // The menu module is used in the re-create all the menu list |
| 224 | 234 | foreach($list as $menu_item) |
| 225 | 235 | { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | function session() |
| 17 | 17 | { |
| 18 | - if(Context::isInstalled()) $this->session_started= true; |
|
| 18 | + if (Context::isInstalled()) $this->session_started = true; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | function moduleInstall() |
| 25 | 25 | { |
| 26 | 26 | $oDB = &DB::getInstance(); |
| 27 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
| 27 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
| 28 | 28 | |
| 29 | 29 | return new Object(); |
| 30 | 30 | } |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $oModuleModel = getModel('module'); |
| 39 | 39 | $oModuleController = getController('module'); |
| 40 | 40 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 41 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 41 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 42 | 42 | { |
| 43 | - if(!$oDB->isTableExists('session')) return true; |
|
| 44 | - if(!$oDB->isColumnExists("session","cur_mid")) return true; |
|
| 45 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true; |
|
| 43 | + if (!$oDB->isTableExists('session')) return true; |
|
| 44 | + if (!$oDB->isColumnExists("session", "cur_mid")) return true; |
|
| 45 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) return true; |
|
| 46 | 46 | |
| 47 | 47 | $oModuleController->insertUpdatedLog($version_update_id); |
| 48 | 48 | } |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | $oModuleModel = getModel('module'); |
| 60 | 60 | $oModuleController = getController('module'); |
| 61 | 61 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 62 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 62 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 63 | 63 | { |
| 64 | - if(!$oDB->isTableExists('session')) |
|
| 64 | + if (!$oDB->isTableExists('session')) |
|
| 65 | 65 | { |
| 66 | 66 | $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml'); |
| 67 | 67 | } |
| 68 | - if(!$oDB->isColumnExists("session","cur_mid")) |
|
| 68 | + if (!$oDB->isColumnExists("session", "cur_mid")) |
|
| 69 | 69 | { |
| 70 | - $oDB->addColumn('session',"cur_mid","varchar",128); |
|
| 70 | + $oDB->addColumn('session', "cur_mid", "varchar", 128); |
|
| 71 | 71 | } |
| 72 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) |
|
| 72 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) |
|
| 73 | 73 | { |
| 74 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
| 74 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $oModuleController->insertUpdatedLog($version_update_id); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function unSerializeSession($val) |
| 87 | 87 | { |
| 88 | - $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
| 89 | - for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 88 | + $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
| 89 | + for ($i = 0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 90 | 90 | return $result; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | function serializeSession($data) |
| 97 | 97 | { |
| 98 | - if(!count($data)) return; |
|
| 98 | + if (!count($data)) return; |
|
| 99 | 99 | |
| 100 | 100 | $str = ''; |
| 101 | - foreach($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
| 102 | - return substr($str, 0, strlen($str)-1).'}'; |
|
| 101 | + foreach ($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
| 102 | + return substr($str, 0, strlen($str) - 1).'}'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | function session() |
| 17 | 17 | { |
| 18 | - if(Context::isInstalled()) $this->session_started= true; |
|
| 18 | + if(Context::isInstalled()) { |
|
| 19 | + $this->session_started= true; |
|
| 20 | + } |
|
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | /** |
@@ -40,9 +42,15 @@ discard block |
||
| 40 | 42 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 41 | 43 | if($oModuleModel->needUpdate($version_update_id)) |
| 42 | 44 | { |
| 43 | - if(!$oDB->isTableExists('session')) return true; |
|
| 44 | - if(!$oDB->isColumnExists("session","cur_mid")) return true; |
|
| 45 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true; |
|
| 45 | + if(!$oDB->isTableExists('session')) { |
|
| 46 | + return true; |
|
| 47 | + } |
|
| 48 | + if(!$oDB->isColumnExists("session","cur_mid")) { |
|
| 49 | + return true; |
|
| 50 | + } |
|
| 51 | + if(!$oDB->isIndexExists("session","idx_session_update_mid")) { |
|
| 52 | + return true; |
|
| 53 | + } |
|
| 46 | 54 | |
| 47 | 55 | $oModuleController->insertUpdatedLog($version_update_id); |
| 48 | 56 | } |
@@ -86,7 +94,9 @@ discard block |
||
| 86 | 94 | function unSerializeSession($val) |
| 87 | 95 | { |
| 88 | 96 | $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
| 89 | - for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 97 | + for($i=0; $vars[$i]; $i++) { |
|
| 98 | + $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 99 | + } |
|
| 90 | 100 | return $result; |
| 91 | 101 | } |
| 92 | 102 | |
@@ -95,10 +105,14 @@ discard block |
||
| 95 | 105 | */ |
| 96 | 106 | function serializeSession($data) |
| 97 | 107 | { |
| 98 | - if(!count($data)) return; |
|
| 108 | + if(!count($data)) { |
|
| 109 | + return; |
|
| 110 | + } |
|
| 99 | 111 | |
| 100 | 112 | $str = ''; |
| 101 | - foreach($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
| 113 | + foreach($data as $key => $val) { |
|
| 114 | + $str .= $key.'|'.serialize($val); |
|
| 115 | + } |
|
| 102 | 116 | return substr($str, 0, strlen($str)-1).'}'; |
| 103 | 117 | } |
| 104 | 118 | |