@@ -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,15 +34,15 @@ 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 | |
@@ -61,68 +61,68 @@ discard block |
||
| 61 | 61 | $oModuleModel = getModel('module'); |
| 62 | 62 | |
| 63 | 63 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 64 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
| 64 | + if (!$oDB->isColumnExists("documents", "notify_message")) return true; |
|
| 65 | 65 | |
| 66 | 66 | // 2007. 8. 23: create a clustered index in the document table |
| 67 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
| 68 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
| 69 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
| 70 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
| 67 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true; |
|
| 68 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true; |
|
| 69 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true; |
|
| 70 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true; |
|
| 71 | 71 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 72 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 72 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 73 | 73 | // 2007. 10. 25 add parent_srl, expand to the document category |
| 74 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
| 75 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
| 76 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
| 74 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true; |
|
| 75 | + if (!$oDB->isColumnExists("document_categories", "expand")) return true; |
|
| 76 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) return true; |
|
| 77 | 77 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 78 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
| 78 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true; |
|
| 79 | 79 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 80 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
| 80 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true; |
|
| 81 | 81 | |
| 82 | 82 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 83 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
| 83 | + if (!$oDB->isColumnExists("documents", "extra_vars")) return true; |
|
| 84 | 84 | // 2008. 04. 23 Add a column(blamed_count) |
| 85 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 86 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
| 87 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 85 | + if (!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 86 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true; |
|
| 87 | + if (!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 88 | 88 | // 2008-12-15 Add a column(color) |
| 89 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 89 | + if (!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 93 | 93 | */ |
| 94 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
| 94 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true; |
|
| 95 | 95 | |
| 96 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 96 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 97 | 97 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 98 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
| 98 | + if (!$oDB->isColumnExists("documents", "lang_code")) return true; |
|
| 99 | 99 | // 2009. 03. 11 check the index in the document_extra_vars table |
| 100 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 100 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 101 | 101 | |
| 102 | 102 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
| 103 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
| 104 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
| 103 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true; |
|
| 104 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true; |
|
| 105 | 105 | |
| 106 | 106 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 107 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 107 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 108 | 108 | |
| 109 | 109 | //2011. 04. 07 adding description column to document categories |
| 110 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
| 110 | + if (!$oDB->isColumnExists("document_categories", "description")) return true; |
|
| 111 | 111 | |
| 112 | 112 | //2011. 05. 23 adding status column to document |
| 113 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 113 | + if (!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 114 | 114 | |
| 115 | 115 | //2011. 06. 07 check comment status update |
| 116 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 116 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 117 | 117 | |
| 118 | 118 | // 2011. 10. 25 status index check |
| 119 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 119 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 120 | 120 | |
| 121 | 121 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 122 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 122 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 123 | 123 | |
| 124 | 124 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 125 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 125 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 126 | 126 | |
| 127 | 127 | return false; |
| 128 | 128 | } |
@@ -138,98 +138,98 @@ discard block |
||
| 138 | 138 | $oModuleController = getController('module'); |
| 139 | 139 | |
| 140 | 140 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 141 | - if(!$oDB->isColumnExists("documents","notify_message")) |
|
| 141 | + if (!$oDB->isColumnExists("documents", "notify_message")) |
|
| 142 | 142 | { |
| 143 | - $oDB->addColumn('documents',"notify_message","char",1); |
|
| 143 | + $oDB->addColumn('documents', "notify_message", "char", 1); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // 2007. 8. 23: create a clustered index in the document table |
| 147 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) |
|
| 147 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) |
|
| 148 | 148 | { |
| 149 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 149 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) |
|
| 152 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) |
|
| 153 | 153 | { |
| 154 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 154 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) |
|
| 157 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) |
|
| 158 | 158 | { |
| 159 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 159 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) |
|
| 162 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) |
|
| 163 | 163 | { |
| 164 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 164 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 165 | 165 | } |
| 166 | 166 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 167 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 167 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 168 | 168 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 169 | 169 | // 2007. 10. 25 add columns(parent_srl, expand) |
| 170 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 171 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 172 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 170 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0); |
|
| 171 | + if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N"); |
|
| 172 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text"); |
|
| 173 | 173 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 174 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 174 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 175 | 175 | |
| 176 | 176 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 177 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
| 177 | + if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text'); |
|
| 178 | 178 | |
| 179 | 179 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 180 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 180 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 181 | 181 | // 2008. 04. 23 Add a column(blamed count) |
| 182 | - if(!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 182 | + if (!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 183 | 183 | { |
| 184 | 184 | $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); |
| 185 | 185 | $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) |
|
| 188 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) |
|
| 189 | 189 | { |
| 190 | 190 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 193 | + if (!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 194 | 194 | $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
| 195 | 195 | |
| 196 | 196 | |
| 197 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
| 197 | + if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7); |
|
| 198 | 198 | |
| 199 | 199 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 200 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 200 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10); |
|
| 201 | 201 | |
| 202 | 202 | // 2009. 01. 29 Added a trigger for additional setup |
| 203 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 203 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 204 | 204 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 205 | 205 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 206 | - if(!$oDB->isColumnExists("documents","lang_code")) |
|
| 206 | + if (!$oDB->isColumnExists("documents", "lang_code")) |
|
| 207 | 207 | { |
| 208 | 208 | $db_info = Context::getDBInfo(); |
| 209 | - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); |
|
| 209 | + $oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code); |
|
| 210 | 210 | $obj->lang_code = $db_info->lang_type; |
| 211 | 211 | executeQuery('document.updateDocumentsLangCode', $obj); |
| 212 | 212 | } |
| 213 | 213 | // 2009. 03. 11 Check the index in the document_extra_vars table |
| 214 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 214 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 215 | 215 | { |
| 216 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 216 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 219 | + if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 220 | 220 | { |
| 221 | 221 | $oDB->dropIndex("document_extra_vars", "unique_module_vars", true); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // 2009. 03. 19: Add a column(eid) |
| 225 | 225 | // 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column |
| 226 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) |
|
| 226 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) |
|
| 227 | 227 | { |
| 228 | - $oDB->addColumn("document_extra_keys","eid","varchar",40); |
|
| 228 | + $oDB->addColumn("document_extra_keys", "eid", "varchar", 40); |
|
| 229 | 229 | |
| 230 | 230 | $output = executeQuery('document.getGroupsExtraKeys', $obj); |
| 231 | - if($output->toBool() && $output->data && count($output->data)) { |
|
| 232 | - foreach($output->data as $extra_keys) { |
|
| 231 | + if ($output->toBool() && $output->data && count($output->data)) { |
|
| 232 | + foreach ($output->data as $extra_keys) { |
|
| 233 | 233 | $args->module_srl = $extra_keys->module_srl; |
| 234 | 234 | $args->var_idx = $extra_keys->idx; |
| 235 | 235 | $args->new_eid = "extra_vars".$extra_keys->idx; |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) |
|
| 241 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) |
|
| 242 | 242 | { |
| 243 | - $oDB->addColumn("document_extra_vars","eid","varchar",40); |
|
| 243 | + $oDB->addColumn("document_extra_vars", "eid", "varchar", 40); |
|
| 244 | 244 | $obj->var_idx = '-1,-2'; |
| 245 | 245 | $output = executeQuery('document.getGroupsExtraVars', $obj); |
| 246 | - if($output->toBool() && $output->data && count($output->data)) |
|
| 246 | + if ($output->toBool() && $output->data && count($output->data)) |
|
| 247 | 247 | { |
| 248 | - foreach($output->data as $extra_vars) |
|
| 248 | + foreach ($output->data as $extra_vars) |
|
| 249 | 249 | { |
| 250 | 250 | $args->module_srl = $extra_vars->module_srl; |
| 251 | 251 | $args->var_idx = $extra_vars->idx; |
@@ -256,16 +256,16 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 259 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 259 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 260 | 260 | { |
| 261 | - $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false); |
|
| 261 | + $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | //2011. 04. 07 adding description column to document categories |
| 265 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 265 | + if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0); |
|
| 266 | 266 | |
| 267 | 267 | //2011. 05. 23 adding status column to document |
| 268 | - if(!$oDB->isColumnExists('documents', 'status')) |
|
| 268 | + if (!$oDB->isColumnExists('documents', 'status')) |
|
| 269 | 269 | { |
| 270 | 270 | $oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC'); |
| 271 | 271 | $args->is_secret = 'Y'; |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | // 2011. 09. 08 drop column document is_secret |
| 276 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 276 | + if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 277 | 277 | $oDB->dropColumn('documents', 'is_secret'); |
| 278 | 278 | |
| 279 | 279 | //2011. 06. 07 merge column, allow_comment and lock_comment |
| 280 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 280 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 281 | 281 | { |
| 282 | 282 | $oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW'); |
| 283 | 283 | |
@@ -299,28 +299,28 @@ discard block |
||
| 299 | 299 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 302 | + if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 303 | 303 | $oDB->dropColumn('documents', 'allow_comment'); |
| 304 | 304 | |
| 305 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 305 | + if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 306 | 306 | $oDB->dropColumn('documents', 'lock_comment'); |
| 307 | 307 | |
| 308 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 309 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 308 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 309 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl", "status")); |
|
| 310 | 310 | |
| 311 | 311 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 312 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 312 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 313 | 313 | { |
| 314 | 314 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 318 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 318 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 319 | 319 | { |
| 320 | 320 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - return new Object(0,'success_updated'); |
|
| 323 | + return new Object(0, 'success_updated'); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | function recompileCache() |
| 331 | 331 | { |
| 332 | - if(!is_dir('./files/cache/tmp')) |
|
| 332 | + if (!is_dir('./files/cache/tmp')) |
|
| 333 | 333 | { |
| 334 | 334 | FileHandler::makeDir('./files/cache/tmp'); |
| 335 | 335 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | function getConfigStatus($key) |
| 361 | 361 | { |
| 362 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 362 | + if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 363 | 363 | else $this->getDefaultStatus(); |
| 364 | 364 | } |
| 365 | 365 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function _loadFromDB($load_extra_vars = true) |
| 76 | 76 | { |
| 77 | - if(!$this->document_srl) return; |
|
| 77 | + if (!$this->document_srl) return; |
|
| 78 | 78 | |
| 79 | 79 | $document_item = false; |
| 80 | 80 | $cache_put = false; |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | // cache controll |
| 85 | 85 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 86 | - if($oCacheHandler->isSupport()) |
|
| 86 | + if ($oCacheHandler->isSupport()) |
|
| 87 | 87 | { |
| 88 | - $cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl; |
|
| 88 | + $cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl; |
|
| 89 | 89 | $document_item = $oCacheHandler->get($cache_key); |
| 90 | - if($document_item !== false) |
|
| 90 | + if ($document_item !== false) |
|
| 91 | 91 | { |
| 92 | 92 | $columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count'); |
| 93 | 93 | } |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | $args->document_srl = $this->document_srl; |
| 98 | 98 | $output = executeQuery('document.getDocument', $args, $columnList); |
| 99 | 99 | |
| 100 | - if($document_item === false) |
|
| 100 | + if ($document_item === false) |
|
| 101 | 101 | { |
| 102 | 102 | $document_item = $output->data; |
| 103 | 103 | |
| 104 | 104 | //insert in cache |
| 105 | - if($document_item && $oCacheHandler->isSupport()) |
|
| 105 | + if ($document_item && $oCacheHandler->isSupport()) |
|
| 106 | 106 | { |
| 107 | 107 | $oCacheHandler->put($cache_key, $document_item); |
| 108 | 108 | } |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $this->setAttribute($document_item, $load_extra_vars); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - function setAttribute($attribute, $load_extra_vars=true) |
|
| 122 | + function setAttribute($attribute, $load_extra_vars = true) |
|
| 123 | 123 | { |
| 124 | - if(!$attribute->document_srl) |
|
| 124 | + if (!$attribute->document_srl) |
|
| 125 | 125 | { |
| 126 | 126 | $this->document_srl = null; |
| 127 | 127 | return; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $this->adds($attribute); |
| 132 | 132 | |
| 133 | 133 | // Tags |
| 134 | - if($this->get('tags')) |
|
| 134 | + if ($this->get('tags')) |
|
| 135 | 135 | { |
| 136 | 136 | $tag_list = explode(',', $this->get('tags')); |
| 137 | 137 | $tag_list = array_map('trim', $tag_list); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $oDocumentModel = getModel('document'); |
| 142 | - if($load_extra_vars) |
|
| 142 | + if ($load_extra_vars) |
|
| 143 | 143 | { |
| 144 | 144 | $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this; |
| 145 | 145 | $oDocumentModel->setToAllDocumentExtraVars(); |
@@ -154,18 +154,18 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | function isGranted() |
| 156 | 156 | { |
| 157 | - if($_SESSION['own_document'][$this->document_srl]) return true; |
|
| 157 | + if ($_SESSION['own_document'][$this->document_srl]) return true; |
|
| 158 | 158 | |
| 159 | - if(!Context::get('is_logged')) return false; |
|
| 159 | + if (!Context::get('is_logged')) return false; |
|
| 160 | 160 | |
| 161 | 161 | $logged_info = Context::get('logged_info'); |
| 162 | - if($logged_info->is_admin == 'Y') return true; |
|
| 162 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 163 | 163 | |
| 164 | 164 | $oModuleModel = getModel('module'); |
| 165 | 165 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
| 166 | - if($grant->manager) return true; |
|
| 166 | + if ($grant->manager) return true; |
|
| 167 | 167 | |
| 168 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true; |
|
| 168 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return true; |
|
| 169 | 169 | |
| 170 | 170 | return false; |
| 171 | 171 | } |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | function isAccessible() |
| 179 | 179 | { |
| 180 | - return $_SESSION['accessible'][$this->document_srl]==true?true:false; |
|
| 180 | + return $_SESSION['accessible'][$this->document_srl] == true ? true : false; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | function allowComment() |
| 184 | 184 | { |
| 185 | 185 | // init write, document is not exists. so allow comment status is true |
| 186 | - if(!$this->isExists()) return true; |
|
| 186 | + if (!$this->isExists()) return true; |
|
| 187 | 187 | |
| 188 | 188 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 189 | 189 | } |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | function allowTrackback() |
| 192 | 192 | { |
| 193 | 193 | static $allow_trackback_status = null; |
| 194 | - if(is_null($allow_trackback_status)) |
|
| 194 | + if (is_null($allow_trackback_status)) |
|
| 195 | 195 | { |
| 196 | 196 | |
| 197 | 197 | // Check the tarckback module exist |
| 198 | - if(!getClass('trackback')) |
|
| 198 | + if (!getClass('trackback')) |
|
| 199 | 199 | { |
| 200 | 200 | $allow_trackback_status = false; |
| 201 | 201 | } |
@@ -205,20 +205,20 @@ discard block |
||
| 205 | 205 | $oModuleModel = getModel('module'); |
| 206 | 206 | $trackback_config = $oModuleModel->getModuleConfig('trackback'); |
| 207 | 207 | |
| 208 | - if(!$trackback_config) |
|
| 208 | + if (!$trackback_config) |
|
| 209 | 209 | { |
| 210 | 210 | $trackback_config = new stdClass(); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 214 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 213 | + if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 214 | + if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 215 | 215 | else |
| 216 | 216 | { |
| 217 | 217 | $module_srl = $this->get('module_srl'); |
| 218 | 218 | // Check settings of each module |
| 219 | 219 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 220 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 221 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 220 | + if ($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 221 | + else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | function isLocked() |
| 229 | 229 | { |
| 230 | - if(!$this->isExists()) return false; |
|
| 230 | + if (!$this->isExists()) return false; |
|
| 231 | 231 | |
| 232 | 232 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | function isEditable() |
| 236 | 236 | { |
| 237 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 237 | + if ($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 238 | 238 | return false; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | function useNotify() |
| 253 | 253 | { |
| 254 | - return $this->get('notify_message')=='Y' ? true : false; |
|
| 254 | + return $this->get('notify_message') == 'Y' ? true : false; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | function doCart() |
| 258 | 258 | { |
| 259 | - if(!$this->document_srl) return false; |
|
| 260 | - if($this->isCarted()) $this->removeCart(); |
|
| 259 | + if (!$this->document_srl) return false; |
|
| 260 | + if ($this->isCarted()) $this->removeCart(); |
|
| 261 | 261 | else $this->addCart(); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -284,18 +284,18 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | function notify($type, $content) |
| 286 | 286 | { |
| 287 | - if(!$this->document_srl) return; |
|
| 287 | + if (!$this->document_srl) return; |
|
| 288 | 288 | // return if it is not useNotify |
| 289 | - if(!$this->useNotify()) return; |
|
| 289 | + if (!$this->useNotify()) return; |
|
| 290 | 290 | // Pass if an author is not a logged-in user |
| 291 | - if(!$this->get('member_srl')) return; |
|
| 291 | + if (!$this->get('member_srl')) return; |
|
| 292 | 292 | // Return if the currently logged-in user is an author |
| 293 | 293 | $logged_info = Context::get('logged_info'); |
| 294 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 294 | + if ($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 295 | 295 | // List variables |
| 296 | - if($type) $title = "[".$type."] "; |
|
| 296 | + if ($type) $title = "[".$type."] "; |
|
| 297 | 297 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 298 | - $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
|
| 298 | + $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl)); |
|
| 299 | 299 | $receiver_srl = $this->get('member_srl'); |
| 300 | 300 | $sender_member_srl = $logged_info->member_srl; |
| 301 | 301 | // Send a message |
@@ -310,26 +310,26 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | function getIpAddress() |
| 312 | 312 | { |
| 313 | - if($this->isGranted()) |
|
| 313 | + if ($this->isGranted()) |
|
| 314 | 314 | { |
| 315 | 315 | return $this->get('ipaddress'); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
| 318 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | function isExistsHomepage() |
| 322 | 322 | { |
| 323 | - if(trim($this->get('homepage'))) return true; |
|
| 323 | + if (trim($this->get('homepage'))) return true; |
|
| 324 | 324 | return false; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | function getHomepageUrl() |
| 328 | 328 | { |
| 329 | 329 | $url = trim($this->get('homepage')); |
| 330 | - if(!$url) return; |
|
| 330 | + if (!$url) return; |
|
| 331 | 331 | |
| 332 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 332 | + if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://'.$url; |
|
| 333 | 333 | |
| 334 | 334 | return $url; |
| 335 | 335 | } |
@@ -359,52 +359,52 @@ discard block |
||
| 359 | 359 | return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - function getTitleText($cut_size = 0, $tail='...') |
|
| 362 | + function getTitleText($cut_size = 0, $tail = '...') |
|
| 363 | 363 | { |
| 364 | - if(!$this->document_srl) return; |
|
| 364 | + if (!$this->document_srl) return; |
|
| 365 | 365 | |
| 366 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 366 | + if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 367 | 367 | else $title = $this->get('title'); |
| 368 | 368 | |
| 369 | 369 | return $title; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - function getTitle($cut_size = 0, $tail='...') |
|
| 372 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 373 | 373 | { |
| 374 | - if(!$this->document_srl) return; |
|
| 374 | + if (!$this->document_srl) return; |
|
| 375 | 375 | |
| 376 | 376 | $title = $this->getTitleText($cut_size, $tail); |
| 377 | 377 | |
| 378 | 378 | $attrs = array(); |
| 379 | 379 | $this->add('title_color', trim($this->get('title_color'))); |
| 380 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 381 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 380 | + if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;"; |
|
| 381 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 382 | 382 | |
| 383 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 383 | + if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 384 | 384 | else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | function getContentText($strlen = 0) |
| 388 | 388 | { |
| 389 | - if(!$this->document_srl) return; |
|
| 389 | + if (!$this->document_srl) return; |
|
| 390 | 390 | |
| 391 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 391 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 392 | 392 | |
| 393 | 393 | $result = $this->_checkAccessibleFromStatus(); |
| 394 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 394 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 395 | 395 | |
| 396 | 396 | $content = $this->get('content'); |
| 397 | 397 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 398 | 398 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 399 | 399 | |
| 400 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 400 | + if ($strlen) return cut_str(strip_tags($content), $strlen, '...'); |
|
| 401 | 401 | |
| 402 | 402 | return htmlspecialchars($content); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | function _addAllowScriptAccess($m) |
| 406 | 406 | { |
| 407 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 407 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 408 | 408 | { |
| 409 | 409 | $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
| 410 | 410 | } |
@@ -414,26 +414,26 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | function _checkAllowScriptAccess($m) |
| 416 | 416 | { |
| 417 | - if($m[1] == 'object') |
|
| 417 | + if ($m[1] == 'object') |
|
| 418 | 418 | { |
| 419 | 419 | $this->allowscriptaccessList[] = 1; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - if($m[1] == 'param') |
|
| 422 | + if ($m[1] == 'param') |
|
| 423 | 423 | { |
| 424 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 424 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 425 | 425 | { |
| 426 | 426 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
| 427 | - if(substr($m[0], -1) == '/') |
|
| 427 | + if (substr($m[0], -1) == '/') |
|
| 428 | 428 | { |
| 429 | 429 | $m[0] .= '/'; |
| 430 | 430 | } |
| 431 | - $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
|
| 431 | + $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | - else if($m[1] == 'embed') |
|
| 434 | + else if ($m[1] == 'embed') |
|
| 435 | 435 | { |
| 436 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 436 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 437 | 437 | { |
| 438 | 438 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 439 | 439 | } |
@@ -447,24 +447,24 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 449 | 449 | { |
| 450 | - if(!$this->document_srl) return; |
|
| 450 | + if (!$this->document_srl) return; |
|
| 451 | 451 | |
| 452 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 452 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 453 | 453 | |
| 454 | 454 | $result = $this->_checkAccessibleFromStatus(); |
| 455 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 455 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 456 | 456 | |
| 457 | 457 | $content = $this->get('content'); |
| 458 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 458 | + if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 459 | 459 | |
| 460 | 460 | // Define a link if using a rewrite module |
| 461 | 461 | $oContext = &Context::getInstance(); |
| 462 | - if($oContext->allow_rewrite) |
|
| 462 | + if ($oContext->allow_rewrite) |
|
| 463 | 463 | { |
| 464 | - $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content); |
|
| 464 | + $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content); |
|
| 465 | 465 | } |
| 466 | 466 | // To display a pop-up menu |
| 467 | - if($add_popup_menu) |
|
| 467 | + if ($add_popup_menu) |
|
| 468 | 468 | { |
| 469 | 469 | $content = sprintf( |
| 470 | 470 | '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>', |
@@ -473,10 +473,10 @@ discard block |
||
| 473 | 473 | ); |
| 474 | 474 | } |
| 475 | 475 | // If additional content information is set |
| 476 | - if($add_content_info) |
|
| 476 | + if ($add_content_info) |
|
| 477 | 477 | { |
| 478 | 478 | $memberSrl = $this->get('member_srl'); |
| 479 | - if($memberSrl < 0) |
|
| 479 | + if ($memberSrl < 0) |
|
| 480 | 480 | { |
| 481 | 481 | $memberSrl = 0; |
| 482 | 482 | } |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | } |
| 493 | 493 | else |
| 494 | 494 | { |
| 495 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 495 | + if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 496 | 496 | } |
| 497 | 497 | // Change the image path to a valid absolute path if resource_realpath is true |
| 498 | - if($resource_realpath) |
|
| 498 | + if ($resource_realpath) |
|
| 499 | 499 | { |
| 500 | - $content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content); |
|
| 500 | + $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | return $content; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $content = trim(cut_str($content, $str_size, $tail)); |
| 547 | 547 | |
| 548 | 548 | // Replace back < , <, " |
| 549 | - $content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content); |
|
| 549 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 550 | 550 | |
| 551 | 551 | return $content; |
| 552 | 552 | } |
@@ -559,13 +559,13 @@ discard block |
||
| 559 | 559 | function getRegdateTime() |
| 560 | 560 | { |
| 561 | 561 | $regdate = $this->get('regdate'); |
| 562 | - $year = substr($regdate,0,4); |
|
| 563 | - $month = substr($regdate,4,2); |
|
| 564 | - $day = substr($regdate,6,2); |
|
| 565 | - $hour = substr($regdate,8,2); |
|
| 566 | - $min = substr($regdate,10,2); |
|
| 567 | - $sec = substr($regdate,12,2); |
|
| 568 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 562 | + $year = substr($regdate, 0, 4); |
|
| 563 | + $month = substr($regdate, 4, 2); |
|
| 564 | + $day = substr($regdate, 6, 2); |
|
| 565 | + $hour = substr($regdate, 8, 2); |
|
| 566 | + $min = substr($regdate, 10, 2); |
|
| 567 | + $sec = substr($regdate, 12, 2); |
|
| 568 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | function getRegdateGM() |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | function getRegdateDT() |
| 577 | 577 | { |
| 578 | - return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 578 | + return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -585,13 +585,13 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | function getUpdateTime() |
| 587 | 587 | { |
| 588 | - $year = substr($this->get('last_update'),0,4); |
|
| 589 | - $month = substr($this->get('last_update'),4,2); |
|
| 590 | - $day = substr($this->get('last_update'),6,2); |
|
| 591 | - $hour = substr($this->get('last_update'),8,2); |
|
| 592 | - $min = substr($this->get('last_update'),10,2); |
|
| 593 | - $sec = substr($this->get('last_update'),12,2); |
|
| 594 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 588 | + $year = substr($this->get('last_update'), 0, 4); |
|
| 589 | + $month = substr($this->get('last_update'), 4, 2); |
|
| 590 | + $day = substr($this->get('last_update'), 6, 2); |
|
| 591 | + $hour = substr($this->get('last_update'), 8, 2); |
|
| 592 | + $min = substr($this->get('last_update'), 10, 2); |
|
| 593 | + $sec = substr($this->get('last_update'), 12, 2); |
|
| 594 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | function getUpdateGM() |
@@ -601,21 +601,21 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | function getUpdateDT() |
| 603 | 603 | { |
| 604 | - return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 604 | + return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | function getPermanentUrl() |
| 608 | 608 | { |
| 609 | - return getFullUrl('','document_srl',$this->get('document_srl')); |
|
| 609 | + return getFullUrl('', 'document_srl', $this->get('document_srl')); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | function getTrackbackUrl() |
| 613 | 613 | { |
| 614 | - if(!$this->document_srl) return; |
|
| 614 | + if (!$this->document_srl) return; |
|
| 615 | 615 | |
| 616 | 616 | // Generate a key to prevent spams |
| 617 | 617 | $oTrackbackModel = getModel('trackback'); |
| 618 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 618 | + if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
@@ -625,24 +625,24 @@ discard block |
||
| 625 | 625 | function updateReadedCount() |
| 626 | 626 | { |
| 627 | 627 | $oDocumentController = getController('document'); |
| 628 | - if($oDocumentController->updateReadedCount($this)) |
|
| 628 | + if ($oDocumentController->updateReadedCount($this)) |
|
| 629 | 629 | { |
| 630 | 630 | $readed_count = $this->get('readed_count'); |
| 631 | - $this->add('readed_count', $readed_count+1); |
|
| 631 | + $this->add('readed_count', $readed_count + 1); |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | function isExtraVarsExists() |
| 636 | 636 | { |
| 637 | - if(!$this->get('module_srl')) return false; |
|
| 637 | + if (!$this->get('module_srl')) return false; |
|
| 638 | 638 | $oDocumentModel = getModel('document'); |
| 639 | 639 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 640 | - return count($extra_keys)?true:false; |
|
| 640 | + return count($extra_keys) ? true : false; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | function getExtraVars() |
| 644 | 644 | { |
| 645 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 645 | + if (!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 646 | 646 | |
| 647 | 647 | $oDocumentModel = getModel('document'); |
| 648 | 648 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | function getExtraValue($idx) |
| 652 | 652 | { |
| 653 | 653 | $extra_vars = $this->getExtraVars(); |
| 654 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 654 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 655 | 655 | { |
| 656 | 656 | return $extra_vars[$idx]->getValue(); |
| 657 | 657 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | function getExtraValueHTML($idx) |
| 665 | 665 | { |
| 666 | 666 | $extra_vars = $this->getExtraVars(); |
| 667 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 667 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 668 | 668 | { |
| 669 | 669 | return $extra_vars[$idx]->getValueHTML(); |
| 670 | 670 | } |
@@ -678,16 +678,16 @@ discard block |
||
| 678 | 678 | { |
| 679 | 679 | $extra_vars = $this->getExtraVars(); |
| 680 | 680 | |
| 681 | - if($extra_vars) |
|
| 681 | + if ($extra_vars) |
|
| 682 | 682 | { |
| 683 | 683 | // Handle extra variable(eid) |
| 684 | - foreach($extra_vars as $idx => $key) |
|
| 684 | + foreach ($extra_vars as $idx => $key) |
|
| 685 | 685 | { |
| 686 | 686 | $extra_eid[$key->eid] = $key; |
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 690 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 691 | 691 | { |
| 692 | 692 | return $extra_eid[$eid]->getValue(); |
| 693 | 693 | } |
@@ -701,12 +701,12 @@ discard block |
||
| 701 | 701 | { |
| 702 | 702 | $extra_vars = $this->getExtraVars(); |
| 703 | 703 | // Handle extra variable(eid) |
| 704 | - foreach($extra_vars as $idx => $key) |
|
| 704 | + foreach ($extra_vars as $idx => $key) |
|
| 705 | 705 | { |
| 706 | 706 | $extra_eid[$key->eid] = $key; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 709 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 710 | 710 | { |
| 711 | 711 | return $extra_eid[$eid]->getValueHTML(); |
| 712 | 712 | } |
@@ -730,13 +730,13 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | function getComments() |
| 732 | 732 | { |
| 733 | - if(!$this->getCommentCount()) return; |
|
| 734 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 733 | + if (!$this->getCommentCount()) return; |
|
| 734 | + if (!$this->isGranted() && $this->isSecret()) return; |
|
| 735 | 735 | // cpage is a number of comment pages |
| 736 | 736 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 737 | 737 | $cpage = Context::get($cpageStr); |
| 738 | 738 | |
| 739 | - if(!$cpage) |
|
| 739 | + if (!$cpage) |
|
| 740 | 740 | { |
| 741 | 741 | $cpage = Context::get('cpage'); |
| 742 | 742 | } |
@@ -744,19 +744,19 @@ discard block |
||
| 744 | 744 | // Get a list of comments |
| 745 | 745 | $oCommentModel = getModel('comment'); |
| 746 | 746 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 747 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 747 | + if (!$output->toBool() || !count($output->data)) return; |
|
| 748 | 748 | // Create commentItem object from a comment list |
| 749 | 749 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 750 | 750 | $accessible = array(); |
| 751 | 751 | $comment_list = array(); |
| 752 | - foreach($output->data as $key => $val) |
|
| 752 | + foreach ($output->data as $key => $val) |
|
| 753 | 753 | { |
| 754 | 754 | $oCommentItem = new commentItem(); |
| 755 | 755 | $oCommentItem->setAttribute($val); |
| 756 | 756 | // If permission is granted to the post, you can access it temporarily |
| 757 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 757 | + if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 758 | 758 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 759 | - if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
|
| 759 | + if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) |
|
| 760 | 760 | { |
| 761 | 761 | $oCommentItem->setAccessible(); |
| 762 | 762 | } |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | // Variable setting to be displayed on the skin |
| 766 | 766 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 767 | 767 | Context::set('cpage', $output->page_navigation->cur_page); |
| 768 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 768 | + if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation; |
|
| 769 | 769 | |
| 770 | 770 | return $comment_list; |
| 771 | 771 | } |
@@ -777,9 +777,9 @@ discard block |
||
| 777 | 777 | |
| 778 | 778 | function getTrackbacks() |
| 779 | 779 | { |
| 780 | - if(!$this->document_srl) return; |
|
| 780 | + if (!$this->document_srl) return; |
|
| 781 | 781 | |
| 782 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 782 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 783 | 783 | |
| 784 | 784 | $oTrackbackModel = getModel('trackback'); |
| 785 | 785 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -787,30 +787,30 @@ discard block |
||
| 787 | 787 | |
| 788 | 788 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 789 | 789 | { |
| 790 | - if(!$this->document_srl) return false; |
|
| 791 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 790 | + if (!$this->document_srl) return false; |
|
| 791 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
| 792 | 792 | return true; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 796 | 796 | { |
| 797 | 797 | // Return false if the document doesn't exist |
| 798 | - if(!$this->document_srl) return; |
|
| 798 | + if (!$this->document_srl) return; |
|
| 799 | 799 | |
| 800 | - if($this->isSecret() && !$this->isGranted()) |
|
| 800 | + if ($this->isSecret() && !$this->isGranted()) |
|
| 801 | 801 | { |
| 802 | 802 | return; |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | // If not specify its height, create a square |
| 806 | - if(!$height) $height = $width; |
|
| 806 | + if (!$height) $height = $width; |
|
| 807 | 807 | // Return false if neither attachement nor image files in the document |
| 808 | - if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return; |
|
| 808 | + if (!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return; |
|
| 809 | 809 | // Get thumbnai_type information from document module's configuration |
| 810 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
| 810 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 811 | 811 | { |
| 812 | 812 | $config = $GLOBALS['__document_config__']; |
| 813 | - if(!$config) |
|
| 813 | + if (!$config) |
|
| 814 | 814 | { |
| 815 | 815 | $oDocumentModel = getModel('document'); |
| 816 | 816 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -819,13 +819,13 @@ discard block |
||
| 819 | 819 | $thumbnail_type = $config->thumbnail_type; |
| 820 | 820 | } |
| 821 | 821 | // Define thumbnail information |
| 822 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
| 822 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
| 823 | 823 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
| 824 | 824 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
| 825 | 825 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 826 | - if(file_exists($thumbnail_file)) |
|
| 826 | + if (file_exists($thumbnail_file)) |
|
| 827 | 827 | { |
| 828 | - if(filesize($thumbnail_file)<1) return false; |
|
| 828 | + if (filesize($thumbnail_file) < 1) return false; |
|
| 829 | 829 | else return $thumbnail_url; |
| 830 | 830 | } |
| 831 | 831 | |
@@ -834,63 +834,63 @@ discard block |
||
| 834 | 834 | $is_tmp_file = false; |
| 835 | 835 | |
| 836 | 836 | // Find an iamge file among attached files if exists |
| 837 | - if($this->hasUploadedFiles()) |
|
| 837 | + if ($this->hasUploadedFiles()) |
|
| 838 | 838 | { |
| 839 | 839 | $file_list = $this->getUploadedFiles(); |
| 840 | 840 | |
| 841 | 841 | $first_image = null; |
| 842 | - foreach($file_list as $file) |
|
| 842 | + foreach ($file_list as $file) |
|
| 843 | 843 | { |
| 844 | - if($file->direct_download !== 'Y') continue; |
|
| 844 | + if ($file->direct_download !== 'Y') continue; |
|
| 845 | 845 | |
| 846 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 846 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 847 | 847 | { |
| 848 | 848 | $source_file = $file->uploaded_filename; |
| 849 | 849 | break; |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - if($first_image) continue; |
|
| 852 | + if ($first_image) continue; |
|
| 853 | 853 | |
| 854 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 854 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 855 | 855 | { |
| 856 | - if(file_exists($file->uploaded_filename)) |
|
| 856 | + if (file_exists($file->uploaded_filename)) |
|
| 857 | 857 | { |
| 858 | 858 | $first_image = $file->uploaded_filename; |
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | - if(!$source_file && $first_image) |
|
| 863 | + if (!$source_file && $first_image) |
|
| 864 | 864 | { |
| 865 | 865 | $source_file = $first_image; |
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | // If not exists, file an image file from the content |
| 870 | - if(!$source_file) |
|
| 870 | + if (!$source_file) |
|
| 871 | 871 | { |
| 872 | 872 | $content = $this->get('content'); |
| 873 | 873 | $target_src = null; |
| 874 | 874 | preg_match_all("!src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER); |
| 875 | 875 | $cnt = count($matches); |
| 876 | 876 | |
| 877 | - for($i=0;$i<$cnt;$i++) |
|
| 877 | + for ($i = 0; $i < $cnt; $i++) |
|
| 878 | 878 | { |
| 879 | 879 | $target_src = trim($matches[$i][2]); |
| 880 | - if(!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i",$target_src)) continue; |
|
| 881 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 880 | + if (!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i", $target_src)) continue; |
|
| 881 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 882 | 882 | |
| 883 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
| 883 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
| 884 | 884 | { |
| 885 | 885 | $target_src = Context::getRequestUri().$target_src; |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | - $tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111,999999).$this->document_srl)); |
|
| 888 | + $tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111, 999999).$this->document_srl)); |
|
| 889 | 889 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 890 | - if(!file_exists($tmp_file)) continue; |
|
| 890 | + if (!file_exists($tmp_file)) continue; |
|
| 891 | 891 | |
| 892 | 892 | list($_w, $_h, $_t, $_a) = getimagesize($tmp_file); |
| 893 | - if($_w < ($width * 0.3) && $_h < ($height * 0.3)) continue; |
|
| 893 | + if ($_w < ($width * 0.3) && $_h < ($height * 0.3)) continue; |
|
| 894 | 894 | |
| 895 | 895 | $source_file = $tmp_file; |
| 896 | 896 | $is_tmp_file = true; |
@@ -898,15 +898,15 @@ discard block |
||
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - if($source_file) |
|
| 901 | + if ($source_file) |
|
| 902 | 902 | { |
| 903 | 903 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 904 | 904 | } |
| 905 | - if($is_tmp_file) FileHandler::removeFile($source_file); |
|
| 905 | + if ($is_tmp_file) FileHandler::removeFile($source_file); |
|
| 906 | 906 | // Return its path if a thumbnail is successfully genetated |
| 907 | - if($output) return $thumbnail_url; |
|
| 907 | + if ($output) return $thumbnail_url; |
|
| 908 | 908 | // Create an empty file not to re-generate the thumbnail |
| 909 | - else FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 909 | + else FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 910 | 910 | |
| 911 | 911 | return; |
| 912 | 912 | } |
@@ -919,21 +919,21 @@ discard block |
||
| 919 | 919 | */ |
| 920 | 920 | function getExtraImages($time_interval = 43200) |
| 921 | 921 | { |
| 922 | - if(!$this->document_srl) return; |
|
| 922 | + if (!$this->document_srl) return; |
|
| 923 | 923 | // variables for icon list |
| 924 | 924 | $buffs = array(); |
| 925 | 925 | |
| 926 | 926 | $check_files = false; |
| 927 | 927 | |
| 928 | 928 | // Check if secret post is |
| 929 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 929 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
| 930 | 930 | |
| 931 | 931 | // Set the latest time |
| 932 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
| 932 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
| 933 | 933 | |
| 934 | 934 | // Check new post |
| 935 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 936 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 935 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
| 936 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
| 937 | 937 | |
| 938 | 938 | /* |
| 939 | 939 | $content = $this->get('content'); |
@@ -956,14 +956,14 @@ discard block |
||
| 956 | 956 | */ |
| 957 | 957 | |
| 958 | 958 | // Check the attachment |
| 959 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 959 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 960 | 960 | |
| 961 | 961 | return $buffs; |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | function getStatus() |
| 965 | 965 | { |
| 966 | - if(!$this->get('status')) return $this->getDefaultStatus(); |
|
| 966 | + if (!$this->get('status')) return $this->getDefaultStatus(); |
|
| 967 | 967 | return $this->get('status'); |
| 968 | 968 | } |
| 969 | 969 | |
@@ -974,15 +974,15 @@ discard block |
||
| 974 | 974 | */ |
| 975 | 975 | function printExtraImages($time_check = 43200) |
| 976 | 976 | { |
| 977 | - if(!$this->document_srl) return; |
|
| 977 | + if (!$this->document_srl) return; |
|
| 978 | 978 | // Get the icon directory |
| 979 | - $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); |
|
| 979 | + $path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/'); |
|
| 980 | 980 | |
| 981 | 981 | $buffs = $this->getExtraImages($time_check); |
| 982 | - if(!count($buffs)) return; |
|
| 982 | + if (!count($buffs)) return; |
|
| 983 | 983 | |
| 984 | 984 | $buff = array(); |
| 985 | - foreach($buffs as $key => $val) |
|
| 985 | + foreach ($buffs as $key => $val) |
|
| 986 | 986 | { |
| 987 | 987 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
| 988 | 988 | } |
@@ -991,20 +991,20 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | function hasUploadedFiles() |
| 993 | 993 | { |
| 994 | - if(!$this->document_srl) return; |
|
| 994 | + if (!$this->document_srl) return; |
|
| 995 | 995 | |
| 996 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 997 | - return $this->get('uploaded_count')? true : false; |
|
| 996 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
| 997 | + return $this->get('uploaded_count') ? true : false; |
|
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1001 | 1001 | { |
| 1002 | - if(!$this->document_srl) return; |
|
| 1002 | + if (!$this->document_srl) return; |
|
| 1003 | 1003 | |
| 1004 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1005 | - if(!$this->get('uploaded_count')) return; |
|
| 1004 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
| 1005 | + if (!$this->get('uploaded_count')) return; |
|
| 1006 | 1006 | |
| 1007 | - if(!$this->uploadedFiles[$sortIndex]) |
|
| 1007 | + if (!$this->uploadedFiles[$sortIndex]) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | $oFileModel = getModel('file'); |
| 1010 | 1010 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | function getEditor() |
| 1021 | 1021 | { |
| 1022 | 1022 | $module_srl = $this->get('module_srl'); |
| 1023 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1023 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1024 | 1024 | |
| 1025 | 1025 | $oEditorModel = getModel('editor'); |
| 1026 | 1026 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | { |
| 1036 | 1036 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1037 | 1037 | if (!$this->allowComment()) return false; |
| 1038 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1038 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
| 1039 | 1039 | |
| 1040 | 1040 | return true; |
| 1041 | 1041 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | */ |
| 1047 | 1047 | function getCommentEditor() |
| 1048 | 1048 | { |
| 1049 | - if(!$this->isEnableComment()) return; |
|
| 1049 | + if (!$this->isEnableComment()) return; |
|
| 1050 | 1050 | |
| 1051 | 1051 | $oEditorModel = getModel('editor'); |
| 1052 | 1052 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1058,10 +1058,10 @@ discard block |
||
| 1058 | 1058 | */ |
| 1059 | 1059 | function getProfileImage() |
| 1060 | 1060 | { |
| 1061 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1061 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1062 | 1062 | $oMemberModel = getModel('member'); |
| 1063 | 1063 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1064 | - if(!$profile_info) return; |
|
| 1064 | + if (!$profile_info) return; |
|
| 1065 | 1065 | |
| 1066 | 1066 | return $profile_info->src; |
| 1067 | 1067 | } |
@@ -1073,21 +1073,21 @@ discard block |
||
| 1073 | 1073 | function getSignature() |
| 1074 | 1074 | { |
| 1075 | 1075 | // Pass if a document doesn't exist |
| 1076 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1076 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1077 | 1077 | // Get signature information |
| 1078 | 1078 | $oMemberModel = getModel('member'); |
| 1079 | 1079 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 1080 | 1080 | // Check if a maximum height of signiture is set in the member module |
| 1081 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1081 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1082 | 1082 | { |
| 1083 | 1083 | $oModuleModel = getModel('module'); |
| 1084 | 1084 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1085 | 1085 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
| 1086 | 1086 | } |
| 1087 | - if($signature) |
|
| 1087 | + if ($signature) |
|
| 1088 | 1088 | { |
| 1089 | 1089 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1090 | - if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1090 | + if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | return $signature; |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | */ |
| 1101 | 1101 | function replaceResourceRealPath($matches) |
| 1102 | 1102 | { |
| 1103 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1103 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | /** |
@@ -1111,19 +1111,19 @@ discard block |
||
| 1111 | 1111 | function _checkAccessibleFromStatus() |
| 1112 | 1112 | { |
| 1113 | 1113 | $logged_info = Context::get('logged_info'); |
| 1114 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1114 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1115 | 1115 | |
| 1116 | 1116 | $status = $this->get('status'); |
| 1117 | - if(empty($status)) return false; |
|
| 1117 | + if (empty($status)) return false; |
|
| 1118 | 1118 | |
| 1119 | 1119 | $oDocumentModel = getModel('document'); |
| 1120 | 1120 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1121 | 1121 | |
| 1122 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1122 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1123 | 1123 | return true; |
| 1124 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1124 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1125 | 1125 | { |
| 1126 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1126 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
| 1127 | 1127 | return true; |
| 1128 | 1128 | } |
| 1129 | 1129 | return false; |
@@ -74,7 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function _loadFromDB($load_extra_vars = true) |
| 76 | 76 | { |
| 77 | - if(!$this->document_srl) return; |
|
| 77 | + if(!$this->document_srl) { |
|
| 78 | + return; |
|
| 79 | + } |
|
| 78 | 80 | |
| 79 | 81 | $document_item = false; |
| 80 | 82 | $cache_put = false; |
@@ -106,8 +108,7 @@ discard block |
||
| 106 | 108 | { |
| 107 | 109 | $oCacheHandler->put($cache_key, $document_item); |
| 108 | 110 | } |
| 109 | - } |
|
| 110 | - else |
|
| 111 | + } else |
|
| 111 | 112 | { |
| 112 | 113 | $document_item->readed_count = $output->data->readed_count; |
| 113 | 114 | $document_item->voted_count = $output->data->voted_count; |
@@ -154,18 +155,28 @@ discard block |
||
| 154 | 155 | |
| 155 | 156 | function isGranted() |
| 156 | 157 | { |
| 157 | - if($_SESSION['own_document'][$this->document_srl]) return true; |
|
| 158 | + if($_SESSION['own_document'][$this->document_srl]) { |
|
| 159 | + return true; |
|
| 160 | + } |
|
| 158 | 161 | |
| 159 | - if(!Context::get('is_logged')) return false; |
|
| 162 | + if(!Context::get('is_logged')) { |
|
| 163 | + return false; |
|
| 164 | + } |
|
| 160 | 165 | |
| 161 | 166 | $logged_info = Context::get('logged_info'); |
| 162 | - if($logged_info->is_admin == 'Y') return true; |
|
| 167 | + if($logged_info->is_admin == 'Y') { |
|
| 168 | + return true; |
|
| 169 | + } |
|
| 163 | 170 | |
| 164 | 171 | $oModuleModel = getModel('module'); |
| 165 | 172 | $grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info); |
| 166 | - if($grant->manager) return true; |
|
| 173 | + if($grant->manager) { |
|
| 174 | + return true; |
|
| 175 | + } |
|
| 167 | 176 | |
| 168 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true; |
|
| 177 | + if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) { |
|
| 178 | + return true; |
|
| 179 | + } |
|
| 169 | 180 | |
| 170 | 181 | return false; |
| 171 | 182 | } |
@@ -183,7 +194,9 @@ discard block |
||
| 183 | 194 | function allowComment() |
| 184 | 195 | { |
| 185 | 196 | // init write, document is not exists. so allow comment status is true |
| 186 | - if(!$this->isExists()) return true; |
|
| 197 | + if(!$this->isExists()) { |
|
| 198 | + return true; |
|
| 199 | + } |
|
| 187 | 200 | |
| 188 | 201 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 189 | 202 | } |
@@ -198,8 +211,7 @@ discard block |
||
| 198 | 211 | if(!getClass('trackback')) |
| 199 | 212 | { |
| 200 | 213 | $allow_trackback_status = false; |
| 201 | - } |
|
| 202 | - else |
|
| 214 | + } else |
|
| 203 | 215 | { |
| 204 | 216 | // If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module. |
| 205 | 217 | $oModuleModel = getModel('module'); |
@@ -210,15 +222,21 @@ discard block |
||
| 210 | 222 | $trackback_config = new stdClass(); |
| 211 | 223 | } |
| 212 | 224 | |
| 213 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 214 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 215 | - else |
|
| 225 | + if(!isset($trackback_config->enable_trackback)) { |
|
| 226 | + $trackback_config->enable_trackback = 'Y'; |
|
| 227 | + } |
|
| 228 | + if($trackback_config->enable_trackback != 'Y') { |
|
| 229 | + $allow_trackback_status = false; |
|
| 230 | + } else |
|
| 216 | 231 | { |
| 217 | 232 | $module_srl = $this->get('module_srl'); |
| 218 | 233 | // Check settings of each module |
| 219 | 234 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 220 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 221 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 235 | + if($module_config->enable_trackback == 'N') { |
|
| 236 | + $allow_trackback_status = false; |
|
| 237 | + } else if($this->get('allow_trackback')=='Y' || !$this->isExists()) { |
|
| 238 | + $allow_trackback_status = true; |
|
| 239 | + } |
|
| 222 | 240 | } |
| 223 | 241 | } |
| 224 | 242 | } |
@@ -227,14 +245,18 @@ discard block |
||
| 227 | 245 | |
| 228 | 246 | function isLocked() |
| 229 | 247 | { |
| 230 | - if(!$this->isExists()) return false; |
|
| 248 | + if(!$this->isExists()) { |
|
| 249 | + return false; |
|
| 250 | + } |
|
| 231 | 251 | |
| 232 | 252 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 233 | 253 | } |
| 234 | 254 | |
| 235 | 255 | function isEditable() |
| 236 | 256 | { |
| 237 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 257 | + if($this->isGranted() || !$this->get('member_srl')) { |
|
| 258 | + return true; |
|
| 259 | + } |
|
| 238 | 260 | return false; |
| 239 | 261 | } |
| 240 | 262 | |
@@ -256,9 +278,14 @@ discard block |
||
| 256 | 278 | |
| 257 | 279 | function doCart() |
| 258 | 280 | { |
| 259 | - if(!$this->document_srl) return false; |
|
| 260 | - if($this->isCarted()) $this->removeCart(); |
|
| 261 | - else $this->addCart(); |
|
| 281 | + if(!$this->document_srl) { |
|
| 282 | + return false; |
|
| 283 | + } |
|
| 284 | + if($this->isCarted()) { |
|
| 285 | + $this->removeCart(); |
|
| 286 | + } else { |
|
| 287 | + $this->addCart(); |
|
| 288 | + } |
|
| 262 | 289 | } |
| 263 | 290 | |
| 264 | 291 | function addCart() |
@@ -284,16 +311,26 @@ discard block |
||
| 284 | 311 | */ |
| 285 | 312 | function notify($type, $content) |
| 286 | 313 | { |
| 287 | - if(!$this->document_srl) return; |
|
| 314 | + if(!$this->document_srl) { |
|
| 315 | + return; |
|
| 316 | + } |
|
| 288 | 317 | // return if it is not useNotify |
| 289 | - if(!$this->useNotify()) return; |
|
| 318 | + if(!$this->useNotify()) { |
|
| 319 | + return; |
|
| 320 | + } |
|
| 290 | 321 | // Pass if an author is not a logged-in user |
| 291 | - if(!$this->get('member_srl')) return; |
|
| 322 | + if(!$this->get('member_srl')) { |
|
| 323 | + return; |
|
| 324 | + } |
|
| 292 | 325 | // Return if the currently logged-in user is an author |
| 293 | 326 | $logged_info = Context::get('logged_info'); |
| 294 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 327 | + if($logged_info->member_srl == $this->get('member_srl')) { |
|
| 328 | + return; |
|
| 329 | + } |
|
| 295 | 330 | // List variables |
| 296 | - if($type) $title = "[".$type."] "; |
|
| 331 | + if($type) { |
|
| 332 | + $title = "[".$type."] "; |
|
| 333 | + } |
|
| 297 | 334 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 298 | 335 | $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
| 299 | 336 | $receiver_srl = $this->get('member_srl'); |
@@ -320,16 +357,22 @@ discard block |
||
| 320 | 357 | |
| 321 | 358 | function isExistsHomepage() |
| 322 | 359 | { |
| 323 | - if(trim($this->get('homepage'))) return true; |
|
| 360 | + if(trim($this->get('homepage'))) { |
|
| 361 | + return true; |
|
| 362 | + } |
|
| 324 | 363 | return false; |
| 325 | 364 | } |
| 326 | 365 | |
| 327 | 366 | function getHomepageUrl() |
| 328 | 367 | { |
| 329 | 368 | $url = trim($this->get('homepage')); |
| 330 | - if(!$url) return; |
|
| 369 | + if(!$url) { |
|
| 370 | + return; |
|
| 371 | + } |
|
| 331 | 372 | |
| 332 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 373 | + if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) { |
|
| 374 | + $url = 'http://' . $url; |
|
| 375 | + } |
|
| 333 | 376 | |
| 334 | 377 | return $url; |
| 335 | 378 | } |
@@ -361,43 +404,65 @@ discard block |
||
| 361 | 404 | |
| 362 | 405 | function getTitleText($cut_size = 0, $tail='...') |
| 363 | 406 | { |
| 364 | - if(!$this->document_srl) return; |
|
| 407 | + if(!$this->document_srl) { |
|
| 408 | + return; |
|
| 409 | + } |
|
| 365 | 410 | |
| 366 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 367 | - else $title = $this->get('title'); |
|
| 411 | + if($cut_size) { |
|
| 412 | + $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 413 | + } else { |
|
| 414 | + $title = $this->get('title'); |
|
| 415 | + } |
|
| 368 | 416 | |
| 369 | 417 | return $title; |
| 370 | 418 | } |
| 371 | 419 | |
| 372 | 420 | function getTitle($cut_size = 0, $tail='...') |
| 373 | 421 | { |
| 374 | - if(!$this->document_srl) return; |
|
| 422 | + if(!$this->document_srl) { |
|
| 423 | + return; |
|
| 424 | + } |
|
| 375 | 425 | |
| 376 | 426 | $title = $this->getTitleText($cut_size, $tail); |
| 377 | 427 | |
| 378 | 428 | $attrs = array(); |
| 379 | 429 | $this->add('title_color', trim($this->get('title_color'))); |
| 380 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 381 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 430 | + if($this->get('title_bold')=='Y') { |
|
| 431 | + $attrs[] = "font-weight:bold;"; |
|
| 432 | + } |
|
| 433 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
| 434 | + $attrs[] = "color:#".$this->get('title_color'); |
|
| 435 | + } |
|
| 382 | 436 | |
| 383 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 384 | - else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 437 | + if(count($attrs)) { |
|
| 438 | + return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 439 | + } else { |
|
| 440 | + return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 441 | + } |
|
| 385 | 442 | } |
| 386 | 443 | |
| 387 | 444 | function getContentText($strlen = 0) |
| 388 | 445 | { |
| 389 | - if(!$this->document_srl) return; |
|
| 446 | + if(!$this->document_srl) { |
|
| 447 | + return; |
|
| 448 | + } |
|
| 390 | 449 | |
| 391 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 450 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
| 451 | + return Context::getLang('msg_is_secret'); |
|
| 452 | + } |
|
| 392 | 453 | |
| 393 | 454 | $result = $this->_checkAccessibleFromStatus(); |
| 394 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 455 | + if($result) { |
|
| 456 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
| 457 | + } |
|
| 395 | 458 | |
| 396 | 459 | $content = $this->get('content'); |
| 397 | 460 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 398 | 461 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 399 | 462 | |
| 400 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 463 | + if($strlen) { |
|
| 464 | + return cut_str(strip_tags($content),$strlen,'...'); |
|
| 465 | + } |
|
| 401 | 466 | |
| 402 | 467 | return htmlspecialchars($content); |
| 403 | 468 | } |
@@ -430,14 +495,12 @@ discard block |
||
| 430 | 495 | } |
| 431 | 496 | $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
| 432 | 497 | } |
| 433 | - } |
|
| 434 | - else if($m[1] == 'embed') |
|
| 498 | + } else if($m[1] == 'embed') |
|
| 435 | 499 | { |
| 436 | 500 | if(stripos($m[0], 'allowscriptaccess')) |
| 437 | 501 | { |
| 438 | 502 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 439 | - } |
|
| 440 | - else |
|
| 503 | + } else |
|
| 441 | 504 | { |
| 442 | 505 | $m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]); |
| 443 | 506 | } |
@@ -447,15 +510,23 @@ discard block |
||
| 447 | 510 | |
| 448 | 511 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 449 | 512 | { |
| 450 | - if(!$this->document_srl) return; |
|
| 513 | + if(!$this->document_srl) { |
|
| 514 | + return; |
|
| 515 | + } |
|
| 451 | 516 | |
| 452 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 517 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
| 518 | + return Context::getLang('msg_is_secret'); |
|
| 519 | + } |
|
| 453 | 520 | |
| 454 | 521 | $result = $this->_checkAccessibleFromStatus(); |
| 455 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 522 | + if($result) { |
|
| 523 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
| 524 | + } |
|
| 456 | 525 | |
| 457 | 526 | $content = $this->get('content'); |
| 458 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 527 | + if(!$stripEmbedTagException) { |
|
| 528 | + stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 529 | + } |
|
| 459 | 530 | |
| 460 | 531 | // Define a link if using a rewrite module |
| 461 | 532 | $oContext = &Context::getInstance(); |
@@ -489,10 +560,11 @@ discard block |
||
| 489 | 560 | $this->document_srl, $memberSrl |
| 490 | 561 | ); |
| 491 | 562 | // Add xe_content class although accessing content is not required |
| 492 | - } |
|
| 493 | - else |
|
| 563 | + } else |
|
| 494 | 564 | { |
| 495 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 565 | + if($add_xe_content_class) { |
|
| 566 | + $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 567 | + } |
|
| 496 | 568 | } |
| 497 | 569 | // Change the image path to a valid absolute path if resource_realpath is true |
| 498 | 570 | if($resource_realpath) |
@@ -611,11 +683,15 @@ discard block |
||
| 611 | 683 | |
| 612 | 684 | function getTrackbackUrl() |
| 613 | 685 | { |
| 614 | - if(!$this->document_srl) return; |
|
| 686 | + if(!$this->document_srl) { |
|
| 687 | + return; |
|
| 688 | + } |
|
| 615 | 689 | |
| 616 | 690 | // Generate a key to prevent spams |
| 617 | 691 | $oTrackbackModel = getModel('trackback'); |
| 618 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 692 | + if($oTrackbackModel) { |
|
| 693 | + return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 694 | + } |
|
| 619 | 695 | } |
| 620 | 696 | |
| 621 | 697 | /** |
@@ -634,7 +710,9 @@ discard block |
||
| 634 | 710 | |
| 635 | 711 | function isExtraVarsExists() |
| 636 | 712 | { |
| 637 | - if(!$this->get('module_srl')) return false; |
|
| 713 | + if(!$this->get('module_srl')) { |
|
| 714 | + return false; |
|
| 715 | + } |
|
| 638 | 716 | $oDocumentModel = getModel('document'); |
| 639 | 717 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 640 | 718 | return count($extra_keys)?true:false; |
@@ -642,7 +720,9 @@ discard block |
||
| 642 | 720 | |
| 643 | 721 | function getExtraVars() |
| 644 | 722 | { |
| 645 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 723 | + if(!$this->get('module_srl') || !$this->document_srl) { |
|
| 724 | + return null; |
|
| 725 | + } |
|
| 646 | 726 | |
| 647 | 727 | $oDocumentModel = getModel('document'); |
| 648 | 728 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -654,8 +734,7 @@ discard block |
||
| 654 | 734 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
| 655 | 735 | { |
| 656 | 736 | return $extra_vars[$idx]->getValue(); |
| 657 | - } |
|
| 658 | - else |
|
| 737 | + } else |
|
| 659 | 738 | { |
| 660 | 739 | return ''; |
| 661 | 740 | } |
@@ -667,8 +746,7 @@ discard block |
||
| 667 | 746 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
| 668 | 747 | { |
| 669 | 748 | return $extra_vars[$idx]->getValueHTML(); |
| 670 | - } |
|
| 671 | - else |
|
| 749 | + } else |
|
| 672 | 750 | { |
| 673 | 751 | return ''; |
| 674 | 752 | } |
@@ -690,8 +768,7 @@ discard block |
||
| 690 | 768 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
| 691 | 769 | { |
| 692 | 770 | return $extra_eid[$eid]->getValue(); |
| 693 | - } |
|
| 694 | - else |
|
| 771 | + } else |
|
| 695 | 772 | { |
| 696 | 773 | return ''; |
| 697 | 774 | } |
@@ -709,8 +786,7 @@ discard block |
||
| 709 | 786 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
| 710 | 787 | { |
| 711 | 788 | return $extra_eid[$eid]->getValueHTML(); |
| 712 | - } |
|
| 713 | - else |
|
| 789 | + } else |
|
| 714 | 790 | { |
| 715 | 791 | return ''; |
| 716 | 792 | } |
@@ -730,8 +806,12 @@ discard block |
||
| 730 | 806 | |
| 731 | 807 | function getComments() |
| 732 | 808 | { |
| 733 | - if(!$this->getCommentCount()) return; |
|
| 734 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 809 | + if(!$this->getCommentCount()) { |
|
| 810 | + return; |
|
| 811 | + } |
|
| 812 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 813 | + return; |
|
| 814 | + } |
|
| 735 | 815 | // cpage is a number of comment pages |
| 736 | 816 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 737 | 817 | $cpage = Context::get($cpageStr); |
@@ -744,7 +824,9 @@ discard block |
||
| 744 | 824 | // Get a list of comments |
| 745 | 825 | $oCommentModel = getModel('comment'); |
| 746 | 826 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 747 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 827 | + if(!$output->toBool() || !count($output->data)) { |
|
| 828 | + return; |
|
| 829 | + } |
|
| 748 | 830 | // Create commentItem object from a comment list |
| 749 | 831 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 750 | 832 | $accessible = array(); |
@@ -754,7 +836,9 @@ discard block |
||
| 754 | 836 | $oCommentItem = new commentItem(); |
| 755 | 837 | $oCommentItem->setAttribute($val); |
| 756 | 838 | // If permission is granted to the post, you can access it temporarily |
| 757 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 839 | + if($oCommentItem->isGranted()) { |
|
| 840 | + $accessible[$val->comment_srl] = true; |
|
| 841 | + } |
|
| 758 | 842 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 759 | 843 | if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
| 760 | 844 | { |
@@ -765,7 +849,9 @@ discard block |
||
| 765 | 849 | // Variable setting to be displayed on the skin |
| 766 | 850 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 767 | 851 | Context::set('cpage', $output->page_navigation->cur_page); |
| 768 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 852 | + if($output->total_page>1) { |
|
| 853 | + $this->comment_page_navigation = $output->page_navigation; |
|
| 854 | + } |
|
| 769 | 855 | |
| 770 | 856 | return $comment_list; |
| 771 | 857 | } |
@@ -777,9 +863,13 @@ discard block |
||
| 777 | 863 | |
| 778 | 864 | function getTrackbacks() |
| 779 | 865 | { |
| 780 | - if(!$this->document_srl) return; |
|
| 866 | + if(!$this->document_srl) { |
|
| 867 | + return; |
|
| 868 | + } |
|
| 781 | 869 | |
| 782 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 870 | + if(!$this->allowTrackback() || !$this->get('trackback_count')) { |
|
| 871 | + return; |
|
| 872 | + } |
|
| 783 | 873 | |
| 784 | 874 | $oTrackbackModel = getModel('trackback'); |
| 785 | 875 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -787,15 +877,21 @@ discard block |
||
| 787 | 877 | |
| 788 | 878 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 789 | 879 | { |
| 790 | - if(!$this->document_srl) return false; |
|
| 791 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 880 | + if(!$this->document_srl) { |
|
| 881 | + return false; |
|
| 882 | + } |
|
| 883 | + if(!$this->getThumbnail($width, $height, $type)) { |
|
| 884 | + return false; |
|
| 885 | + } |
|
| 792 | 886 | return true; |
| 793 | 887 | } |
| 794 | 888 | |
| 795 | 889 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 796 | 890 | { |
| 797 | 891 | // Return false if the document doesn't exist |
| 798 | - if(!$this->document_srl) return; |
|
| 892 | + if(!$this->document_srl) { |
|
| 893 | + return; |
|
| 894 | + } |
|
| 799 | 895 | |
| 800 | 896 | if($this->isSecret() && !$this->isGranted()) |
| 801 | 897 | { |
@@ -803,9 +899,13 @@ discard block |
||
| 803 | 899 | } |
| 804 | 900 | |
| 805 | 901 | // If not specify its height, create a square |
| 806 | - if(!$height) $height = $width; |
|
| 902 | + if(!$height) { |
|
| 903 | + $height = $width; |
|
| 904 | + } |
|
| 807 | 905 | // Return false if neither attachement nor image files in the document |
| 808 | - if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return; |
|
| 906 | + if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) { |
|
| 907 | + return; |
|
| 908 | + } |
|
| 809 | 909 | // Get thumbnai_type information from document module's configuration |
| 810 | 910 | if(!in_array($thumbnail_type, array('crop','ratio'))) |
| 811 | 911 | { |
@@ -825,8 +925,11 @@ discard block |
||
| 825 | 925 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 826 | 926 | if(file_exists($thumbnail_file)) |
| 827 | 927 | { |
| 828 | - if(filesize($thumbnail_file)<1) return false; |
|
| 829 | - else return $thumbnail_url; |
|
| 928 | + if(filesize($thumbnail_file)<1) { |
|
| 929 | + return false; |
|
| 930 | + } else { |
|
| 931 | + return $thumbnail_url; |
|
| 932 | + } |
|
| 830 | 933 | } |
| 831 | 934 | |
| 832 | 935 | // Target File |
@@ -841,7 +944,9 @@ discard block |
||
| 841 | 944 | $first_image = null; |
| 842 | 945 | foreach($file_list as $file) |
| 843 | 946 | { |
| 844 | - if($file->direct_download !== 'Y') continue; |
|
| 947 | + if($file->direct_download !== 'Y') { |
|
| 948 | + continue; |
|
| 949 | + } |
|
| 845 | 950 | |
| 846 | 951 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
| 847 | 952 | { |
@@ -849,7 +954,9 @@ discard block |
||
| 849 | 954 | break; |
| 850 | 955 | } |
| 851 | 956 | |
| 852 | - if($first_image) continue; |
|
| 957 | + if($first_image) { |
|
| 958 | + continue; |
|
| 959 | + } |
|
| 853 | 960 | |
| 854 | 961 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
| 855 | 962 | { |
@@ -877,8 +984,12 @@ discard block |
||
| 877 | 984 | for($i=0;$i<$cnt;$i++) |
| 878 | 985 | { |
| 879 | 986 | $target_src = trim($matches[$i][2]); |
| 880 | - if(!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i",$target_src)) continue; |
|
| 881 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 987 | + if(!preg_match("/\.(jpg|png|jpeg|gif|bmp)$/i",$target_src)) { |
|
| 988 | + continue; |
|
| 989 | + } |
|
| 990 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
| 991 | + continue; |
|
| 992 | + } |
|
| 882 | 993 | |
| 883 | 994 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
| 884 | 995 | { |
@@ -887,10 +998,14 @@ discard block |
||
| 887 | 998 | |
| 888 | 999 | $tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111,999999).$this->document_srl)); |
| 889 | 1000 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 890 | - if(!file_exists($tmp_file)) continue; |
|
| 1001 | + if(!file_exists($tmp_file)) { |
|
| 1002 | + continue; |
|
| 1003 | + } |
|
| 891 | 1004 | |
| 892 | 1005 | list($_w, $_h, $_t, $_a) = getimagesize($tmp_file); |
| 893 | - if($_w < ($width * 0.3) && $_h < ($height * 0.3)) continue; |
|
| 1006 | + if($_w < ($width * 0.3) && $_h < ($height * 0.3)) { |
|
| 1007 | + continue; |
|
| 1008 | + } |
|
| 894 | 1009 | |
| 895 | 1010 | $source_file = $tmp_file; |
| 896 | 1011 | $is_tmp_file = true; |
@@ -902,11 +1017,17 @@ discard block |
||
| 902 | 1017 | { |
| 903 | 1018 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 904 | 1019 | } |
| 905 | - if($is_tmp_file) FileHandler::removeFile($source_file); |
|
| 1020 | + if($is_tmp_file) { |
|
| 1021 | + FileHandler::removeFile($source_file); |
|
| 1022 | + } |
|
| 906 | 1023 | // Return its path if a thumbnail is successfully genetated |
| 907 | - if($output) return $thumbnail_url; |
|
| 1024 | + if($output) { |
|
| 1025 | + return $thumbnail_url; |
|
| 1026 | + } |
|
| 908 | 1027 | // Create an empty file not to re-generate the thumbnail |
| 909 | - else FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 1028 | + else { |
|
| 1029 | + FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 1030 | + } |
|
| 910 | 1031 | |
| 911 | 1032 | return; |
| 912 | 1033 | } |
@@ -919,21 +1040,28 @@ discard block |
||
| 919 | 1040 | */ |
| 920 | 1041 | function getExtraImages($time_interval = 43200) |
| 921 | 1042 | { |
| 922 | - if(!$this->document_srl) return; |
|
| 1043 | + if(!$this->document_srl) { |
|
| 1044 | + return; |
|
| 1045 | + } |
|
| 923 | 1046 | // variables for icon list |
| 924 | 1047 | $buffs = array(); |
| 925 | 1048 | |
| 926 | 1049 | $check_files = false; |
| 927 | 1050 | |
| 928 | 1051 | // Check if secret post is |
| 929 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 1052 | + if($this->isSecret()) { |
|
| 1053 | + $buffs[] = "secret"; |
|
| 1054 | + } |
|
| 930 | 1055 | |
| 931 | 1056 | // Set the latest time |
| 932 | 1057 | $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
| 933 | 1058 | |
| 934 | 1059 | // Check new post |
| 935 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 936 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 1060 | + if($this->get('regdate')>$time_check) { |
|
| 1061 | + $buffs[] = "new"; |
|
| 1062 | + } else if($this->get('last_update')>$time_check) { |
|
| 1063 | + $buffs[] = "update"; |
|
| 1064 | + } |
|
| 937 | 1065 | |
| 938 | 1066 | /* |
| 939 | 1067 | $content = $this->get('content'); |
@@ -956,14 +1084,18 @@ discard block |
||
| 956 | 1084 | */ |
| 957 | 1085 | |
| 958 | 1086 | // Check the attachment |
| 959 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1087 | + if($this->hasUploadedFiles()) { |
|
| 1088 | + $buffs[] = "file"; |
|
| 1089 | + } |
|
| 960 | 1090 | |
| 961 | 1091 | return $buffs; |
| 962 | 1092 | } |
| 963 | 1093 | |
| 964 | 1094 | function getStatus() |
| 965 | 1095 | { |
| 966 | - if(!$this->get('status')) return $this->getDefaultStatus(); |
|
| 1096 | + if(!$this->get('status')) { |
|
| 1097 | + return $this->getDefaultStatus(); |
|
| 1098 | + } |
|
| 967 | 1099 | return $this->get('status'); |
| 968 | 1100 | } |
| 969 | 1101 | |
@@ -974,12 +1106,16 @@ discard block |
||
| 974 | 1106 | */ |
| 975 | 1107 | function printExtraImages($time_check = 43200) |
| 976 | 1108 | { |
| 977 | - if(!$this->document_srl) return; |
|
| 1109 | + if(!$this->document_srl) { |
|
| 1110 | + return; |
|
| 1111 | + } |
|
| 978 | 1112 | // Get the icon directory |
| 979 | 1113 | $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); |
| 980 | 1114 | |
| 981 | 1115 | $buffs = $this->getExtraImages($time_check); |
| 982 | - if(!count($buffs)) return; |
|
| 1116 | + if(!count($buffs)) { |
|
| 1117 | + return; |
|
| 1118 | + } |
|
| 983 | 1119 | |
| 984 | 1120 | $buff = array(); |
| 985 | 1121 | foreach($buffs as $key => $val) |
@@ -991,18 +1127,28 @@ discard block |
||
| 991 | 1127 | |
| 992 | 1128 | function hasUploadedFiles() |
| 993 | 1129 | { |
| 994 | - if(!$this->document_srl) return; |
|
| 1130 | + if(!$this->document_srl) { |
|
| 1131 | + return; |
|
| 1132 | + } |
|
| 995 | 1133 | |
| 996 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1134 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1135 | + return false; |
|
| 1136 | + } |
|
| 997 | 1137 | return $this->get('uploaded_count')? true : false; |
| 998 | 1138 | } |
| 999 | 1139 | |
| 1000 | 1140 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1001 | 1141 | { |
| 1002 | - if(!$this->document_srl) return; |
|
| 1142 | + if(!$this->document_srl) { |
|
| 1143 | + return; |
|
| 1144 | + } |
|
| 1003 | 1145 | |
| 1004 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1005 | - if(!$this->get('uploaded_count')) return; |
|
| 1146 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1147 | + return; |
|
| 1148 | + } |
|
| 1149 | + if(!$this->get('uploaded_count')) { |
|
| 1150 | + return; |
|
| 1151 | + } |
|
| 1006 | 1152 | |
| 1007 | 1153 | if(!$this->uploadedFiles[$sortIndex]) |
| 1008 | 1154 | { |
@@ -1020,7 +1166,9 @@ discard block |
||
| 1020 | 1166 | function getEditor() |
| 1021 | 1167 | { |
| 1022 | 1168 | $module_srl = $this->get('module_srl'); |
| 1023 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1169 | + if(!$module_srl) { |
|
| 1170 | + $module_srl = Context::get('module_srl'); |
|
| 1171 | + } |
|
| 1024 | 1172 | |
| 1025 | 1173 | $oEditorModel = getModel('editor'); |
| 1026 | 1174 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1034,8 +1182,12 @@ discard block |
||
| 1034 | 1182 | function isEnableComment() |
| 1035 | 1183 | { |
| 1036 | 1184 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1037 | - if (!$this->allowComment()) return false; |
|
| 1038 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1185 | + if (!$this->allowComment()) { |
|
| 1186 | + return false; |
|
| 1187 | + } |
|
| 1188 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 1189 | + return false; |
|
| 1190 | + } |
|
| 1039 | 1191 | |
| 1040 | 1192 | return true; |
| 1041 | 1193 | } |
@@ -1046,7 +1198,9 @@ discard block |
||
| 1046 | 1198 | */ |
| 1047 | 1199 | function getCommentEditor() |
| 1048 | 1200 | { |
| 1049 | - if(!$this->isEnableComment()) return; |
|
| 1201 | + if(!$this->isEnableComment()) { |
|
| 1202 | + return; |
|
| 1203 | + } |
|
| 1050 | 1204 | |
| 1051 | 1205 | $oEditorModel = getModel('editor'); |
| 1052 | 1206 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1058,10 +1212,14 @@ discard block |
||
| 1058 | 1212 | */ |
| 1059 | 1213 | function getProfileImage() |
| 1060 | 1214 | { |
| 1061 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1215 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1216 | + return; |
|
| 1217 | + } |
|
| 1062 | 1218 | $oMemberModel = getModel('member'); |
| 1063 | 1219 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1064 | - if(!$profile_info) return; |
|
| 1220 | + if(!$profile_info) { |
|
| 1221 | + return; |
|
| 1222 | + } |
|
| 1065 | 1223 | |
| 1066 | 1224 | return $profile_info->src; |
| 1067 | 1225 | } |
@@ -1073,7 +1231,9 @@ discard block |
||
| 1073 | 1231 | function getSignature() |
| 1074 | 1232 | { |
| 1075 | 1233 | // Pass if a document doesn't exist |
| 1076 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1234 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1235 | + return; |
|
| 1236 | + } |
|
| 1077 | 1237 | // Get signature information |
| 1078 | 1238 | $oMemberModel = getModel('member'); |
| 1079 | 1239 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
@@ -1087,7 +1247,9 @@ discard block |
||
| 1087 | 1247 | if($signature) |
| 1088 | 1248 | { |
| 1089 | 1249 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1090 | - if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1250 | + if($max_signature_height) { |
|
| 1251 | + $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1252 | + } |
|
| 1091 | 1253 | } |
| 1092 | 1254 | |
| 1093 | 1255 | return $signature; |
@@ -1111,20 +1273,25 @@ discard block |
||
| 1111 | 1273 | function _checkAccessibleFromStatus() |
| 1112 | 1274 | { |
| 1113 | 1275 | $logged_info = Context::get('logged_info'); |
| 1114 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1276 | + if($logged_info->is_admin == 'Y') { |
|
| 1277 | + return true; |
|
| 1278 | + } |
|
| 1115 | 1279 | |
| 1116 | 1280 | $status = $this->get('status'); |
| 1117 | - if(empty($status)) return false; |
|
| 1281 | + if(empty($status)) { |
|
| 1282 | + return false; |
|
| 1283 | + } |
|
| 1118 | 1284 | |
| 1119 | 1285 | $oDocumentModel = getModel('document'); |
| 1120 | 1286 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1121 | 1287 | |
| 1122 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1123 | - return true; |
|
| 1124 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1288 | + if($status == $configStatusList['public'] || $status == $configStatusList['publish']) { |
|
| 1289 | + return true; |
|
| 1290 | + } else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1125 | 1291 | { |
| 1126 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1127 | - return true; |
|
| 1292 | + if($this->get('member_srl') == $logged_info->member_srl) { |
|
| 1293 | + return true; |
|
| 1294 | + } |
|
| 1128 | 1295 | } |
| 1129 | 1296 | return false; |
| 1130 | 1297 | } |