@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | function procWAP(&$oMobile) |
16 | 16 | { |
17 | 17 | // check grant |
18 | - if(!$this->grant->list || $this->module_info->consultation == 'Y') |
|
18 | + if (!$this->grant->list || $this->module_info->consultation == 'Y') |
|
19 | 19 | { |
20 | 20 | return $oMobile->setContent(Context::getLang('msg_not_permitted')); |
21 | 21 | } |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | |
26 | 26 | // if the doument is existed |
27 | 27 | $document_srl = Context::get('document_srl'); |
28 | - if($document_srl) |
|
28 | + if ($document_srl) |
|
29 | 29 | { |
30 | 30 | $oDocument = $oDocumentModel->getDocument($document_srl); |
31 | - if($oDocument->isExists()) |
|
31 | + if ($oDocument->isExists()) |
|
32 | 32 | { |
33 | 33 | // check the grant |
34 | - if(!$this->grant->view) |
|
34 | + if (!$this->grant->view) |
|
35 | 35 | { |
36 | 36 | return $oMobile->setContent(Context::getLang('msg_not_permitted')); |
37 | 37 | } |
@@ -40,48 +40,48 @@ discard block |
||
40 | 40 | Context::setBrowserTitle($oDocument->getTitleText()); |
41 | 41 | |
42 | 42 | // if the act is display comment list |
43 | - if($this->act=='dispBoardContentCommentList') |
|
43 | + if ($this->act == 'dispBoardContentCommentList') |
|
44 | 44 | { |
45 | 45 | |
46 | 46 | $oCommentModel = getModel('comment'); |
47 | 47 | $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount()); |
48 | 48 | |
49 | 49 | $content = ''; |
50 | - if(count($output->data)) |
|
50 | + if (count($output->data)) |
|
51 | 51 | { |
52 | - foreach($output->data as $key => $val) |
|
52 | + foreach ($output->data as $key => $val) |
|
53 | 53 | { |
54 | 54 | $oComment = new commentItem(); |
55 | 55 | $oComment->setAttribute($val); |
56 | 56 | |
57 | - if(!$oComment->isAccessible()) continue; |
|
57 | + if (!$oComment->isAccessible()) continue; |
|
58 | 58 | |
59 | - $content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n"; |
|
59 | + $content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false, false)."<br>\r\n"; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | // setup mobile contents |
64 | - $oMobile->setContent( $content ); |
|
64 | + $oMobile->setContent($content); |
|
65 | 65 | |
66 | 66 | // setup upper URL |
67 | - $oMobile->setUpperUrl( getUrl('act',''), Context::getLang('cmd_go_upper') ); |
|
67 | + $oMobile->setUpperUrl(getUrl('act', ''), Context::getLang('cmd_go_upper')); |
|
68 | 68 | |
69 | 69 | // display the document if the act is not display the comment list |
70 | 70 | } else { |
71 | 71 | |
72 | 72 | // setup contents (strip all html tags) |
73 | - $content = strip_tags(str_replace('<p>','<br> ',$oDocument->getContent(false,false,false)),'<br><b><i><u><em><small><strong><big>'); |
|
73 | + $content = strip_tags(str_replace('<p>', '<br> ', $oDocument->getContent(false, false, false)), '<br><b><i><u><em><small><strong><big>'); |
|
74 | 74 | |
75 | 75 | |
76 | 76 | // setup content information(include the comments link) |
77 | - $content = Context::getLang('replies').' : <a href="'.getUrl('act','dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content; |
|
77 | + $content = Context::getLang('replies').' : <a href="'.getUrl('act', 'dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content; |
|
78 | 78 | $content = '<b>'.$oDocument->getNickName().'</b> ('.$oDocument->getRegdate("Y-m-d").")<br>\r\n".$content; |
79 | 79 | |
80 | 80 | // setup mobile contents |
81 | - $oMobile->setContent( $content ); |
|
81 | + $oMobile->setContent($content); |
|
82 | 82 | |
83 | 83 | // setup upper URL |
84 | - $oMobile->setUpperUrl( getUrl('document_srl',''), Context::getLang('cmd_list') ); |
|
84 | + $oMobile->setUpperUrl(getUrl('document_srl', ''), Context::getLang('cmd_list')); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | // board index |
93 | 93 | $args = new stdClass; |
94 | 94 | $args->module_srl = $this->module_srl; |
95 | - $args->page = Context::get('page');; |
|
95 | + $args->page = Context::get('page'); ; |
|
96 | 96 | $args->list_count = 9; |
97 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
98 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
97 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
98 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
99 | 99 | $output = $oDocumentModel->getDocumentList($args, $this->except_notice); |
100 | 100 | $document_list = $output->data; |
101 | 101 | $page_navigation = $output->page_navigation; |
102 | 102 | |
103 | 103 | $childs = array(); |
104 | - if($document_list && count($document_list)) |
|
104 | + if ($document_list && count($document_list)) |
|
105 | 105 | { |
106 | - foreach($document_list as $key => $val) |
|
106 | + foreach ($document_list as $key => $val) |
|
107 | 107 | { |
108 | - $href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl); |
|
108 | + $href = getUrl('mid', $_GET['mid'], 'document_srl', $val->document_srl); |
|
109 | 109 | $obj = null; |
110 | 110 | $obj['href'] = $val->getPermanentUrl(); |
111 | 111 | |
112 | 112 | $title = htmlspecialchars($val->getTitleText()); |
113 | - if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']'; |
|
113 | + if ($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']'; |
|
114 | 114 | $obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title; |
115 | 115 | $childs[] = $obj; |
116 | 116 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | $totalPage = $page_navigation->last_page; |
121 | - $page = (int)Context::get('page'); |
|
122 | - if(!$page) $page = 1; |
|
121 | + $page = (int) Context::get('page'); |
|
122 | + if (!$page) $page = 1; |
|
123 | 123 | |
124 | 124 | // next/prevUrl specification |
125 | - if($page > 1) |
|
125 | + if ($page > 1) |
|
126 | 126 | { |
127 | - $oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page-1, $totalPage)); |
|
127 | + $oMobile->setPrevUrl(getUrl('mid', $_GET['mid'], 'page', $page - 1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page - 1, $totalPage)); |
|
128 | 128 | } |
129 | 129 | |
130 | - if($page < $totalPage) |
|
130 | + if ($page < $totalPage) |
|
131 | 131 | { |
132 | - $oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page+1, $totalPage)); |
|
132 | + $oMobile->setNextUrl(getUrl('mid', $_GET['mid'], 'page', $page + 1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page + 1, $totalPage)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $oMobile->mobilePage = $page; |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | $oComment = new commentItem(); |
55 | 55 | $oComment->setAttribute($val); |
56 | 56 | |
57 | - if(!$oComment->isAccessible()) continue; |
|
57 | + if(!$oComment->isAccessible()) { |
|
58 | + continue; |
|
59 | + } |
|
58 | 60 | |
59 | 61 | $content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n"; |
60 | 62 | } |
@@ -110,7 +112,9 @@ discard block |
||
110 | 112 | $obj['href'] = $val->getPermanentUrl(); |
111 | 113 | |
112 | 114 | $title = htmlspecialchars($val->getTitleText()); |
113 | - if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']'; |
|
115 | + if($val->getCommentCount()) { |
|
116 | + $title .= ' ['.$val->getCommentCount().']'; |
|
117 | + } |
|
114 | 118 | $obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title; |
115 | 119 | $childs[] = $obj; |
116 | 120 | } |
@@ -119,7 +123,9 @@ discard block |
||
119 | 123 | |
120 | 124 | $totalPage = $page_navigation->last_page; |
121 | 125 | $page = (int)Context::get('page'); |
122 | - if(!$page) $page = 1; |
|
126 | + if(!$page) { |
|
127 | + $page = 1; |
|
128 | + } |
|
123 | 129 | |
124 | 130 | // next/prevUrl specification |
125 | 131 | if($page > 1) |
@@ -10,32 +10,32 @@ discard block |
||
10 | 10 | $oSecurity = new Security(); |
11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); |
12 | 12 | |
13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
13 | + if ($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | + if ($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | + if ($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | + if ($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | + if ($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | + if ($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
19 | 19 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
20 | 20 | |
21 | 21 | // $this->_getStatusNameListecret option backward compatibility |
22 | 22 | $oDocumentModel = getModel('document'); |
23 | 23 | |
24 | 24 | $statusList = $this->_getStatusNameList($oDocumentModel); |
25 | - if(isset($statusList['SECRET'])) |
|
25 | + if (isset($statusList['SECRET'])) |
|
26 | 26 | { |
27 | 27 | $this->module_info->secret = 'Y'; |
28 | 28 | } |
29 | 29 | |
30 | 30 | // use_category <=1.5.x, hide_category >=1.7.x |
31 | 31 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
32 | - if($count_category) |
|
32 | + if ($count_category) |
|
33 | 33 | { |
34 | - if($this->module_info->hide_category) |
|
34 | + if ($this->module_info->hide_category) |
|
35 | 35 | { |
36 | 36 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
37 | 37 | } |
38 | - else if($this->module_info->use_category) |
|
38 | + else if ($this->module_info->use_category) |
|
39 | 39 | { |
40 | 40 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
41 | 41 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * check the consultation function, if the user is admin then swich off consultation function |
56 | 56 | * if the user is not logged, then disppear write document/write comment./ view document |
57 | 57 | **/ |
58 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
58 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
59 | 59 | { |
60 | 60 | $this->consultation = true; |
61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
61 | + if (!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
62 | 62 | } else { |
63 | 63 | $this->consultation = false; |
64 | 64 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); |
68 | 68 | Context::set('extra_keys', $extra_keys); |
69 | 69 | |
70 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); |
|
71 | - if(!is_dir($template_path)||!$this->module_info->mskin) |
|
70 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); |
|
71 | + if (!is_dir($template_path) || !$this->module_info->mskin) |
|
72 | 72 | { |
73 | 73 | $this->module_info->mskin = 'default'; |
74 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin); |
|
74 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin); |
|
75 | 75 | } |
76 | 76 | $this->setTemplatePath($template_path); |
77 | 77 | Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | function getBoardCommentPage() |
88 | 88 | { |
89 | 89 | $document_srl = Context::get('document_srl'); |
90 | - $oDocumentModel =& getModel('document'); |
|
91 | - if(!$document_srl) |
|
90 | + $oDocumentModel = & getModel('document'); |
|
91 | + if (!$document_srl) |
|
92 | 92 | { |
93 | 93 | return new BaseObject(-1, "msg_invalid_request"); |
94 | 94 | } |
95 | 95 | |
96 | - if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
96 | + if ($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
97 | 97 | { |
98 | 98 | return new BaseObject(-1, "msg_not_permitted"); |
99 | 99 | } |
100 | 100 | |
101 | 101 | $oDocument = $oDocumentModel->getDocument($document_srl); |
102 | - if(!$oDocument->isExists()) |
|
102 | + if (!$oDocument->isExists()) |
|
103 | 103 | { |
104 | 104 | return new BaseObject(-1, "msg_invalid_request"); |
105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | function dispBoardMessage($msg_code) |
113 | 113 | { |
114 | 114 | $msg = Context::getLang($msg_code); |
115 | - $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile'); |
|
115 | + $oMessageObject = &ModuleHandler::getModuleInstance('message', 'mobile'); |
|
116 | 116 | $oMessageObject->setError(-1); |
117 | 117 | $oMessageObject->setMessage($msg); |
118 | 118 | $oMessageObject->dispMessage(); |
@@ -10,12 +10,24 @@ discard block |
||
10 | 10 | $oSecurity = new Security(); |
11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); |
12 | 12 | |
13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
13 | + if($this->module_info->list_count) { |
|
14 | + $this->list_count = $this->module_info->list_count; |
|
15 | + } |
|
16 | + if($this->module_info->mobile_list_count) { |
|
17 | + $this->list_count = $this->module_info->mobile_list_count; |
|
18 | + } |
|
19 | + if($this->module_info->search_list_count) { |
|
20 | + $this->search_list_count = $this->module_info->search_list_count; |
|
21 | + } |
|
22 | + if($this->module_info->mobile_search_list_count) { |
|
23 | + $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
24 | + } |
|
25 | + if($this->module_info->page_count) { |
|
26 | + $this->page_count = $this->module_info->page_count; |
|
27 | + } |
|
28 | + if($this->module_info->mobile_page_count) { |
|
29 | + $this->page_count = $this->module_info->mobile_page_count; |
|
30 | + } |
|
19 | 31 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
20 | 32 | |
21 | 33 | // $this->_getStatusNameListecret option backward compatibility |
@@ -34,18 +46,15 @@ discard block |
||
34 | 46 | if($this->module_info->hide_category) |
35 | 47 | { |
36 | 48 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
37 | - } |
|
38 | - else if($this->module_info->use_category) |
|
49 | + } else if($this->module_info->use_category) |
|
39 | 50 | { |
40 | 51 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
41 | - } |
|
42 | - else |
|
52 | + } else |
|
43 | 53 | { |
44 | 54 | $this->module_info->hide_category = 'N'; |
45 | 55 | $this->module_info->use_category = 'Y'; |
46 | 56 | } |
47 | - } |
|
48 | - else |
|
57 | + } else |
|
49 | 58 | { |
50 | 59 | $this->module_info->hide_category = 'Y'; |
51 | 60 | $this->module_info->use_category = 'N'; |
@@ -58,7 +67,9 @@ discard block |
||
58 | 67 | if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
59 | 68 | { |
60 | 69 | $this->consultation = true; |
61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
70 | + if(!Context::get('is_logged')) { |
|
71 | + $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
72 | + } |
|
62 | 73 | } else { |
63 | 74 | $this->consultation = false; |
64 | 75 | } |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | |
26 | 26 | // get the list config value, if it is not exitsted then setup the default value |
27 | 27 | $list_config = $oModuleModel->getModulePartConfig('board', $module_srl); |
28 | - if(!$list_config || count($list_config) <= 0) |
|
28 | + if (!$list_config || count($list_config) <= 0) |
|
29 | 29 | { |
30 | - $list_config = array( 'no', 'title', 'nick_name','regdate','readed_count'); |
|
30 | + $list_config = array('no', 'title', 'nick_name', 'regdate', 'readed_count'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | // get the extra variables |
34 | 34 | $inserted_extra_vars = $oDocumentModel->getExtraKeys($module_srl); |
35 | 35 | |
36 | - foreach($list_config as $key) |
|
36 | + foreach ($list_config as $key) |
|
37 | 37 | { |
38 | - if(preg_match('/^([0-9]+)$/',$key)) |
|
38 | + if (preg_match('/^([0-9]+)$/', $key)) |
|
39 | 39 | { |
40 | - if($inserted_extra_vars[$key]) |
|
40 | + if ($inserted_extra_vars[$key]) |
|
41 | 41 | { |
42 | 42 | $output['extra_vars'.$key] = $inserted_extra_vars[$key]; |
43 | 43 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | function getDefaultListConfig($module_srl) |
61 | 61 | { |
62 | 62 | // add virtual srl, title, registered date, update date, nickname, ID, name, readed count, voted count etc. |
63 | - $virtual_vars = array( 'no', 'title', 'regdate', 'last_update', 'last_post', 'nick_name', |
|
63 | + $virtual_vars = array('no', 'title', 'regdate', 'last_update', 'last_post', 'nick_name', |
|
64 | 64 | 'user_id', 'user_name', 'readed_count', 'voted_count', 'blamed_count', 'thumbnail', 'summary', 'comment_status'); |
65 | - foreach($virtual_vars as $key) |
|
65 | + foreach ($virtual_vars as $key) |
|
66 | 66 | { |
67 | 67 | $extra_vars[$key] = new ExtraItem($module_srl, -1, Context::getLang($key), $key, 'N', 'N', 'N', null); |
68 | 68 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | $oDocumentModel = getModel('document'); |
72 | 72 | $inserted_extra_vars = $oDocumentModel->getExtraKeys($module_srl); |
73 | 73 | |
74 | - if(count($inserted_extra_vars)) |
|
74 | + if (count($inserted_extra_vars)) |
|
75 | 75 | { |
76 | - foreach($inserted_extra_vars as $obj) |
|
76 | + foreach ($inserted_extra_vars as $obj) |
|
77 | 77 | { |
78 | 78 | $extra_vars['extra_vars'.$obj->idx] = $obj; |
79 | 79 | } |
@@ -40,13 +40,11 @@ |
||
40 | 40 | if($inserted_extra_vars[$key]) |
41 | 41 | { |
42 | 42 | $output['extra_vars'.$key] = $inserted_extra_vars[$key]; |
43 | - } |
|
44 | - else |
|
43 | + } else |
|
45 | 44 | { |
46 | 45 | continue; |
47 | 46 | } |
48 | - } |
|
49 | - else |
|
47 | + } else |
|
50 | 48 | { |
51 | 49 | $output[$key] = new ExtraItem($module_srl, -1, Context::getLang($key), $key, 'N', 'N', 'N', null); |
52 | 50 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -include _XE_PATH_ . 'classes/security/phphtmlparser/src/htmlparser.inc'; |
|
4 | +include _XE_PATH_.'classes/security/phphtmlparser/src/htmlparser.inc'; |
|
5 | 5 | |
6 | 6 | class EmbedFilter |
7 | 7 | { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | function getInstance() |
278 | 278 | { |
279 | - if(!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) |
|
279 | + if (!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) |
|
280 | 280 | { |
281 | 281 | $GLOBALS['__EMBEDFILTER_INSTANCE__'] = new EmbedFilter(); |
282 | 282 | } |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | { |
317 | 317 | preg_match_all('/<\s*object\s*[^>]+(?:\/?>?)/is', $content, $m); |
318 | 318 | $objectTagList = $m[0]; |
319 | - if($objectTagList) |
|
319 | + if ($objectTagList) |
|
320 | 320 | { |
321 | - foreach($objectTagList AS $key => $objectTag) |
|
321 | + foreach ($objectTagList AS $key => $objectTag) |
|
322 | 322 | { |
323 | 323 | $isWhiteDomain = true; |
324 | 324 | $isWhiteMimetype = true; |
@@ -326,21 +326,21 @@ discard block |
||
326 | 326 | $ext = ''; |
327 | 327 | |
328 | 328 | $parser = new HtmlParser($objectTag); |
329 | - while($parser->parse()) |
|
329 | + while ($parser->parse()) |
|
330 | 330 | { |
331 | - if(is_array($parser->iNodeAttributes)) |
|
331 | + if (is_array($parser->iNodeAttributes)) |
|
332 | 332 | { |
333 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
333 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
334 | 334 | { |
335 | 335 | // data url check |
336 | - if($attrValue && strtolower($attrName) == 'data') |
|
336 | + if ($attrValue && strtolower($attrName) == 'data') |
|
337 | 337 | { |
338 | 338 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
339 | 339 | $isWhiteDomain = $this->isWhiteDomain($attrValue); |
340 | 340 | } |
341 | 341 | |
342 | 342 | // mime type check |
343 | - if(strtolower($attrName) == 'type' && $attrValue) |
|
343 | + if (strtolower($attrName) == 'type' && $attrValue) |
|
344 | 344 | { |
345 | 345 | $isWhiteMimetype = $this->isWhiteMimetype($attrValue); |
346 | 346 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - if(!$isWhiteDomain || !$isWhiteMimetype) |
|
351 | + if (!$isWhiteDomain || !$isWhiteMimetype) |
|
352 | 352 | { |
353 | 353 | $content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
354 | 354 | } |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | { |
365 | 365 | preg_match_all('/<\s*embed\s*[^>]+(?:\/?>?)/is', $content, $m); |
366 | 366 | $embedTagList = $m[0]; |
367 | - if($embedTagList) |
|
367 | + if ($embedTagList) |
|
368 | 368 | { |
369 | - foreach($embedTagList AS $key => $embedTag) |
|
369 | + foreach ($embedTagList AS $key => $embedTag) |
|
370 | 370 | { |
371 | 371 | $isWhiteDomain = TRUE; |
372 | 372 | $isWhiteMimetype = TRUE; |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | $ext = ''; |
375 | 375 | |
376 | 376 | $parser = new HtmlParser($embedTag); |
377 | - while($parser->parse()) |
|
377 | + while ($parser->parse()) |
|
378 | 378 | { |
379 | - if(is_array($parser->iNodeAttributes)) |
|
379 | + if (is_array($parser->iNodeAttributes)) |
|
380 | 380 | { |
381 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
381 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
382 | 382 | { |
383 | 383 | // src url check |
384 | - if($attrValue && strtolower($attrName) == 'src') |
|
384 | + if ($attrValue && strtolower($attrName) == 'src') |
|
385 | 385 | { |
386 | 386 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
387 | 387 | $isWhiteDomain = $this->isWhiteDomain($attrValue); |
388 | 388 | } |
389 | 389 | |
390 | 390 | // mime type check |
391 | - if(strtolower($attrName) == 'type' && $attrValue) |
|
391 | + if (strtolower($attrName) == 'type' && $attrValue) |
|
392 | 392 | { |
393 | 393 | $isWhiteMimetype = $this->isWhiteMimetype($attrValue); |
394 | 394 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | - if(!$isWhiteDomain || !$isWhiteMimetype) |
|
399 | + if (!$isWhiteDomain || !$isWhiteMimetype) |
|
400 | 400 | { |
401 | 401 | $content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
402 | 402 | } |
@@ -415,22 +415,22 @@ discard block |
||
415 | 415 | |
416 | 416 | preg_match_all('/<\s*iframe\s*[^>]+(?:\/?>?)/is', $content, $m); |
417 | 417 | $iframeTagList = $m[0]; |
418 | - if($iframeTagList) |
|
418 | + if ($iframeTagList) |
|
419 | 419 | { |
420 | - foreach($iframeTagList AS $key => $iframeTag) |
|
420 | + foreach ($iframeTagList AS $key => $iframeTag) |
|
421 | 421 | { |
422 | 422 | $isWhiteDomain = TRUE; |
423 | 423 | $ext = ''; |
424 | 424 | |
425 | 425 | $parser = new HtmlParser($iframeTag); |
426 | - while($parser->parse()) |
|
426 | + while ($parser->parse()) |
|
427 | 427 | { |
428 | - if(is_array($parser->iNodeAttributes)) |
|
428 | + if (is_array($parser->iNodeAttributes)) |
|
429 | 429 | { |
430 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
430 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
431 | 431 | { |
432 | 432 | // src url check |
433 | - if(strtolower($attrName) == 'src' && $attrValue) |
|
433 | + if (strtolower($attrName) == 'src' && $attrValue) |
|
434 | 434 | { |
435 | 435 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
436 | 436 | $isWhiteDomain = $this->isWhiteIframeDomain($attrValue); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | - if(!$isWhiteDomain) |
|
442 | + if (!$isWhiteDomain) |
|
443 | 443 | { |
444 | 444 | $content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
445 | 445 | } |
@@ -455,26 +455,26 @@ discard block |
||
455 | 455 | { |
456 | 456 | preg_match_all('/<\s*param\s*[^>]+(?:\/?>?)/is', $content, $m); |
457 | 457 | $paramTagList = $m[0]; |
458 | - if($paramTagList) |
|
458 | + if ($paramTagList) |
|
459 | 459 | { |
460 | - foreach($paramTagList AS $key => $paramTag) |
|
460 | + foreach ($paramTagList AS $key => $paramTag) |
|
461 | 461 | { |
462 | 462 | $isWhiteDomain = TRUE; |
463 | 463 | $isWhiteExt = TRUE; |
464 | 464 | $ext = ''; |
465 | 465 | |
466 | 466 | $parser = new HtmlParser($paramTag); |
467 | - while($parser->parse()) |
|
467 | + while ($parser->parse()) |
|
468 | 468 | { |
469 | - if($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value']) |
|
469 | + if ($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value']) |
|
470 | 470 | { |
471 | 471 | $name = strtolower($parser->iNodeAttributes['name']); |
472 | - if($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source') |
|
472 | + if ($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source') |
|
473 | 473 | { |
474 | 474 | $ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1)); |
475 | 475 | $isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']); |
476 | 476 | |
477 | - if(!$isWhiteDomain) |
|
477 | + if (!$isWhiteDomain) |
|
478 | 478 | { |
479 | 479 | $content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
480 | 480 | } |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | */ |
492 | 492 | function isWhiteDomain($urlAttribute) |
493 | 493 | { |
494 | - if(is_array($this->whiteUrlList)) |
|
494 | + if (is_array($this->whiteUrlList)) |
|
495 | 495 | { |
496 | - foreach($this->whiteUrlList AS $key => $value) |
|
496 | + foreach ($this->whiteUrlList AS $key => $value) |
|
497 | 497 | { |
498 | - if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
498 | + if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute)) |
|
499 | 499 | { |
500 | 500 | return TRUE; |
501 | 501 | } |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | */ |
511 | 511 | function isWhiteIframeDomain($urlAttribute) |
512 | 512 | { |
513 | - if(is_array($this->whiteIframeUrlList)) |
|
513 | + if (is_array($this->whiteIframeUrlList)) |
|
514 | 514 | { |
515 | - foreach($this->whiteIframeUrlList AS $key => $value) |
|
515 | + foreach ($this->whiteIframeUrlList AS $key => $value) |
|
516 | 516 | { |
517 | - if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
517 | + if (preg_match('@^'.preg_quote($value).'@i', $urlAttribute)) |
|
518 | 518 | { |
519 | 519 | return TRUE; |
520 | 520 | } |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | */ |
530 | 530 | function isWhiteMimetype($mimeType) |
531 | 531 | { |
532 | - if(isset($this->mimeTypeList[$mimeType])) |
|
532 | + if (isset($this->mimeTypeList[$mimeType])) |
|
533 | 533 | { |
534 | 534 | return TRUE; |
535 | 535 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | |
539 | 539 | function isWhiteExt($ext) |
540 | 540 | { |
541 | - if(isset($this->extList[$ext])) |
|
541 | + if (isset($this->extList[$ext])) |
|
542 | 542 | { |
543 | 543 | return TRUE; |
544 | 544 | } |
@@ -547,26 +547,26 @@ discard block |
||
547 | 547 | |
548 | 548 | function _checkAllowScriptAccess($m) |
549 | 549 | { |
550 | - if($m[1] == 'object') |
|
550 | + if ($m[1] == 'object') |
|
551 | 551 | { |
552 | 552 | $this->allowscriptaccessList[] = 1; |
553 | 553 | } |
554 | 554 | |
555 | - if($m[1] == 'param') |
|
555 | + if ($m[1] == 'param') |
|
556 | 556 | { |
557 | - if(stripos($m[0], 'allowscriptaccess')) |
|
557 | + if (stripos($m[0], 'allowscriptaccess')) |
|
558 | 558 | { |
559 | 559 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
560 | - if(substr($m[0], -1) == '/') |
|
560 | + if (substr($m[0], -1) == '/') |
|
561 | 561 | { |
562 | 562 | $m[0] .= '/'; |
563 | 563 | } |
564 | 564 | $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
565 | 565 | } |
566 | 566 | } |
567 | - else if($m[1] == 'embed') |
|
567 | + else if ($m[1] == 'embed') |
|
568 | 568 | { |
569 | - if(stripos($m[0], 'allowscriptaccess')) |
|
569 | + if (stripos($m[0], 'allowscriptaccess')) |
|
570 | 570 | { |
571 | 571 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
572 | 572 | } |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | |
581 | 581 | function _addAllowScriptAccess($m) |
582 | 582 | { |
583 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
583 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
584 | 584 | { |
585 | - $m[0] = $m[0] . '<param name="allowscriptaccess" value="never"></param>'; |
|
585 | + $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
|
586 | 586 | } |
587 | 587 | $this->allowscriptaccessKey++; |
588 | 588 | return $m[0]; |
@@ -599,31 +599,31 @@ discard block |
||
599 | 599 | $whiteUrlCacheFile = FileHandler::getRealPath($this->whiteUrlCacheFile); |
600 | 600 | |
601 | 601 | $isMake = FALSE; |
602 | - if(!file_exists($whiteUrlCacheFile)) |
|
602 | + if (!file_exists($whiteUrlCacheFile)) |
|
603 | 603 | { |
604 | 604 | $isMake = TRUE; |
605 | 605 | } |
606 | - if(file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile)) |
|
606 | + if (file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile)) |
|
607 | 607 | { |
608 | 608 | $isMake = TRUE; |
609 | 609 | } |
610 | 610 | |
611 | - if(gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array') |
|
611 | + if (gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array') |
|
612 | 612 | { |
613 | 613 | $isMake = FALSE; |
614 | 614 | } |
615 | 615 | |
616 | - if(isset($whitelist) && gettype($whitelist) == 'object') |
|
616 | + if (isset($whitelist) && gettype($whitelist) == 'object') |
|
617 | 617 | { |
618 | 618 | $isMake = TRUE; |
619 | 619 | } |
620 | 620 | |
621 | - if($isMake) |
|
621 | + if ($isMake) |
|
622 | 622 | { |
623 | 623 | $whiteUrlList = array(); |
624 | 624 | $whiteIframeUrlList = array(); |
625 | 625 | |
626 | - if(gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array') |
|
626 | + if (gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array') |
|
627 | 627 | { |
628 | 628 | $whiteUrlList = $whitelist->object; |
629 | 629 | $whiteIframeUrlList = $whitelist->iframe; |
@@ -636,15 +636,15 @@ discard block |
||
636 | 636 | $domainListObj = $xmlParser->parse($xmlBuff); |
637 | 637 | $embedDomainList = $domainListObj->whiteurl->embed->domain; |
638 | 638 | $iframeDomainList = $domainListObj->whiteurl->iframe->domain; |
639 | - if(!is_array($embedDomainList)) $embedDomainList = array(); |
|
640 | - if(!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
639 | + if (!is_array($embedDomainList)) $embedDomainList = array(); |
|
640 | + if (!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
641 | 641 | |
642 | - foreach($embedDomainList AS $key => $value) |
|
642 | + foreach ($embedDomainList AS $key => $value) |
|
643 | 643 | { |
644 | 644 | $patternList = $value->pattern; |
645 | - if(is_array($patternList)) |
|
645 | + if (is_array($patternList)) |
|
646 | 646 | { |
647 | - foreach($patternList AS $key => $value) |
|
647 | + foreach ($patternList AS $key => $value) |
|
648 | 648 | { |
649 | 649 | $whiteUrlList[] = $value->body; |
650 | 650 | } |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
658 | - foreach($iframeDomainList AS $key => $value) |
|
658 | + foreach ($iframeDomainList AS $key => $value) |
|
659 | 659 | { |
660 | 660 | $patternList = $value->pattern; |
661 | - if(is_array($patternList)) |
|
661 | + if (is_array($patternList)) |
|
662 | 662 | { |
663 | - foreach($patternList AS $key => $value) |
|
663 | + foreach ($patternList AS $key => $value) |
|
664 | 664 | { |
665 | 665 | $whiteIframeUrlList[] = $value->body; |
666 | 666 | } |
@@ -674,12 +674,12 @@ discard block |
||
674 | 674 | |
675 | 675 | $db_info = Context::getDBInfo(); |
676 | 676 | |
677 | - if($db_info->embed_white_object) |
|
677 | + if ($db_info->embed_white_object) |
|
678 | 678 | { |
679 | 679 | $whiteUrlList = array_merge($whiteUrlList, $db_info->embed_white_object); |
680 | 680 | } |
681 | 681 | |
682 | - if($db_info->embed_white_iframe) |
|
682 | + if ($db_info->embed_white_iframe) |
|
683 | 683 | { |
684 | 684 | $whiteIframeUrlList = array_merge($whiteIframeUrlList, $db_info->embed_white_iframe); |
685 | 685 | } |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | |
692 | 692 | $buff = array(); |
693 | 693 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
694 | - $buff[] = '$whiteUrlList = ' . var_export($whiteUrlList, TRUE) . ';'; |
|
695 | - $buff[] = '$whiteIframeUrlList = ' . var_export($whiteIframeUrlList, TRUE) . ';'; |
|
694 | + $buff[] = '$whiteUrlList = '.var_export($whiteUrlList, TRUE).';'; |
|
695 | + $buff[] = '$whiteIframeUrlList = '.var_export($whiteIframeUrlList, TRUE).';'; |
|
696 | 696 | |
697 | 697 | FileHandler::writeFile($this->whiteUrlCacheFile, implode(PHP_EOL, $buff)); |
698 | 698 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php"; |
|
4 | +require_once _XE_PATH_."libs/phpmailer/phpmailer.php"; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Mailing class for XpressEngine |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | $this->SMTPSecure = "tls"; |
149 | 149 | $this->Host = 'smtp.gmail.com'; |
150 | 150 | $this->Port = '587'; |
151 | - if($this->isVaildMailAddress($account_name)) |
|
151 | + if ($this->isVaildMailAddress($account_name)) |
|
152 | 152 | { |
153 | 153 | $this->Username = $account_name; |
154 | 154 | } |
155 | 155 | else |
156 | 156 | { |
157 | - $this->Username = $account_name . '@gmail.com'; |
|
157 | + $this->Username = $account_name.'@gmail.com'; |
|
158 | 158 | } |
159 | 159 | $this->Password = $account_passwd; |
160 | 160 | $this->IsSMTP(); |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | $this->Password = $pass; |
181 | 181 | $this->Port = $port; |
182 | 182 | |
183 | - if($secure == 'ssl' || $secure == 'tls') |
|
183 | + if ($secure == 'ssl' || $secure == 'tls') |
|
184 | 184 | { |
185 | 185 | $this->SMTPSecure = $secure; |
186 | 186 | } |
187 | 187 | |
188 | - if(($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL)) |
|
188 | + if (($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL)) |
|
189 | 189 | { |
190 | 190 | $this->IsSMTP(); |
191 | 191 | $this->AltBody = "To view the message, please use an HTML compatible email viewer!"; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function setSender($name, $email) |
244 | 244 | { |
245 | - if($this->Mailer == "mail") |
|
245 | + if ($this->Mailer == "mail") |
|
246 | 246 | { |
247 | 247 | $this->sender_name = $name; |
248 | 248 | $this->sender_email = $email; |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | */ |
261 | 261 | function getSender() |
262 | 262 | { |
263 | - if(!stristr(PHP_OS, 'win') && $this->sender_name) |
|
263 | + if (!stristr(PHP_OS, 'win') && $this->sender_name) |
|
264 | 264 | { |
265 | - return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->sender_name) . '?=', $this->sender_email); |
|
265 | + return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->sender_name).'?=', $this->sender_email); |
|
266 | 266 | } |
267 | 267 | return $this->sender_email; |
268 | 268 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | function setReceiptor($name, $email) |
278 | 278 | { |
279 | - if($this->Mailer == "mail") |
|
279 | + if ($this->Mailer == "mail") |
|
280 | 280 | { |
281 | 281 | $this->receiptor_name = $name; |
282 | 282 | $this->receiptor_email = $email; |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | */ |
295 | 295 | function getReceiptor() |
296 | 296 | { |
297 | - if(!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email) |
|
297 | + if (!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email) |
|
298 | 298 | { |
299 | - return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->receiptor_name) . '?=', $this->receiptor_email); |
|
299 | + return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->receiptor_name).'?=', $this->receiptor_email); |
|
300 | 300 | } |
301 | 301 | return $this->receiptor_email; |
302 | 302 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function setTitle($title) |
311 | 311 | { |
312 | - if($this->Mailer == "mail") |
|
312 | + if ($this->Mailer == "mail") |
|
313 | 313 | { |
314 | 314 | $this->title = $title; |
315 | 315 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | function getTitle() |
328 | 328 | { |
329 | - return '=?utf-8?b?' . base64_encode($this->title) . '?='; |
|
329 | + return '=?utf-8?b?'.base64_encode($this->title).'?='; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | function setBCC($bcc) |
339 | 339 | { |
340 | - if($this->Mailer == "mail") |
|
340 | + if ($this->Mailer == "mail") |
|
341 | 341 | { |
342 | 342 | $this->bcc = $bcc; |
343 | 343 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function setReplyTo($replyTo) |
379 | 379 | { |
380 | - if($this->Mailer == "mail") |
|
380 | + if ($this->Mailer == "mail") |
|
381 | 381 | { |
382 | 382 | $this->replyTo = $replyTo; |
383 | 383 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | function setContent($content) |
397 | 397 | { |
398 | 398 | $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
399 | - if($this->Mailer == "mail") |
|
399 | + if ($this->Mailer == "mail") |
|
400 | 400 | { |
401 | 401 | $this->content = $content; |
402 | 402 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | function replaceResourceRealPath($matches) |
417 | 417 | { |
418 | - return preg_replace('/src=(["\']?)files/i', 'src=$1' . Context::getRequestUri() . 'files', $matches[0]); |
|
418 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -456,42 +456,42 @@ discard block |
||
456 | 456 | */ |
457 | 457 | function procAttachments() |
458 | 458 | { |
459 | - if($this->Mailer == "mail") |
|
459 | + if ($this->Mailer == "mail") |
|
460 | 460 | { |
461 | - if(count($this->attachments) > 0) |
|
461 | + if (count($this->attachments) > 0) |
|
462 | 462 | { |
463 | - $this->body = $this->header . $this->body; |
|
464 | - $boundary = '----==' . uniqid(rand(), TRUE); |
|
465 | - $this->header = "Content-Type: multipart/mixed;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol; |
|
466 | - $this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol; |
|
463 | + $this->body = $this->header.$this->body; |
|
464 | + $boundary = '----=='.uniqid(rand(), TRUE); |
|
465 | + $this->header = "Content-Type: multipart/mixed;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol; |
|
466 | + $this->body = "--".$boundary.$this->eol.$this->body.$this->eol.$this->eol; |
|
467 | 467 | $res = array(); |
468 | 468 | $res[] = $this->body; |
469 | - foreach($this->attachments as $filename => $attachment) |
|
469 | + foreach ($this->attachments as $filename => $attachment) |
|
470 | 470 | { |
471 | 471 | $type = $this->returnMIMEType($filename); |
472 | 472 | $file_handler = new FileHandler(); |
473 | 473 | $file_str = $file_handler->readFile($attachment); |
474 | 474 | $chunks = chunk_split(base64_encode($file_str)); |
475 | 475 | $tempBody = sprintf( |
476 | - "--" . $boundary . $this->eol . |
|
477 | - "Content-Type: %s;" . $this->eol . |
|
478 | - "\tname=\"%s\"" . $this->eol . |
|
479 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
480 | - "Content-Description: %s" . $this->eol . |
|
481 | - "Content-Disposition: attachment;" . $this->eol . |
|
482 | - "\tfilename=\"%s\"" . $this->eol . $this->eol . |
|
483 | - "%s" . $this->eol . $this->eol, $type, $filename, $filename, $filename, $chunks); |
|
476 | + "--".$boundary.$this->eol. |
|
477 | + "Content-Type: %s;".$this->eol. |
|
478 | + "\tname=\"%s\"".$this->eol. |
|
479 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
480 | + "Content-Description: %s".$this->eol. |
|
481 | + "Content-Disposition: attachment;".$this->eol. |
|
482 | + "\tfilename=\"%s\"".$this->eol.$this->eol. |
|
483 | + "%s".$this->eol.$this->eol, $type, $filename, $filename, $filename, $chunks); |
|
484 | 484 | $res[] = $tempBody; |
485 | 485 | } |
486 | 486 | $this->body = implode("", $res); |
487 | - $this->body .= "--" . $boundary . "--"; |
|
487 | + $this->body .= "--".$boundary."--"; |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | else |
491 | 491 | { |
492 | - if(count($this->attachments) > 0) |
|
492 | + if (count($this->attachments) > 0) |
|
493 | 493 | { |
494 | - foreach($this->attachments as $filename => $attachment) |
|
494 | + foreach ($this->attachments as $filename => $attachment) |
|
495 | 495 | { |
496 | 496 | parent::AddAttachment($attachment); |
497 | 497 | } |
@@ -506,33 +506,33 @@ discard block |
||
506 | 506 | */ |
507 | 507 | function procCidAttachments() |
508 | 508 | { |
509 | - if(count($this->cidAttachments) > 0) |
|
509 | + if (count($this->cidAttachments) > 0) |
|
510 | 510 | { |
511 | - $this->body = $this->header . $this->body; |
|
512 | - $boundary = '----==' . uniqid(rand(), TRUE); |
|
513 | - $this->header = "Content-Type: multipart/relative;" . $this->eol . "\ttype=\"multipart/alternative\";" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol; |
|
514 | - $this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol; |
|
511 | + $this->body = $this->header.$this->body; |
|
512 | + $boundary = '----=='.uniqid(rand(), TRUE); |
|
513 | + $this->header = "Content-Type: multipart/relative;".$this->eol."\ttype=\"multipart/alternative\";".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol; |
|
514 | + $this->body = "--".$boundary.$this->eol.$this->body.$this->eol.$this->eol; |
|
515 | 515 | $res = array(); |
516 | 516 | $res[] = $this->body; |
517 | - foreach($this->cidAttachments as $cid => $attachment) |
|
517 | + foreach ($this->cidAttachments as $cid => $attachment) |
|
518 | 518 | { |
519 | 519 | $filename = basename($attachment); |
520 | 520 | $type = $this->returnMIMEType(FileHandler::getRealPath($attachment)); |
521 | 521 | $file_str = FileHandler::readFile($attachment); |
522 | 522 | $chunks = chunk_split(base64_encode($file_str)); |
523 | 523 | $tempBody = sprintf( |
524 | - "--" . $boundary . $this->eol . |
|
525 | - "Content-Type: %s;" . $this->eol . |
|
526 | - "\tname=\"%s\"" . $this->eol . |
|
527 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
528 | - "Content-ID: <%s>" . $this->eol . |
|
529 | - "Content-Description: %s" . $this->eol . |
|
530 | - "Content-Location: %s" . $this->eol . $this->eol . |
|
531 | - "%s" . $this->eol . $this->eol, $type, $filename, $cid, $filename, $filename, $chunks); |
|
524 | + "--".$boundary.$this->eol. |
|
525 | + "Content-Type: %s;".$this->eol. |
|
526 | + "\tname=\"%s\"".$this->eol. |
|
527 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
528 | + "Content-ID: <%s>".$this->eol. |
|
529 | + "Content-Description: %s".$this->eol. |
|
530 | + "Content-Location: %s".$this->eol.$this->eol. |
|
531 | + "%s".$this->eol.$this->eol, $type, $filename, $cid, $filename, $filename, $chunks); |
|
532 | 532 | $res[] = $tempBody; |
533 | 533 | } |
534 | 534 | $this->body = implode("", $res); |
535 | - $this->body .= "--" . $boundary . "--"; |
|
535 | + $this->body .= "--".$boundary."--"; |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
@@ -543,37 +543,37 @@ discard block |
||
543 | 543 | */ |
544 | 544 | function send() |
545 | 545 | { |
546 | - if($this->Mailer == "mail") |
|
546 | + if ($this->Mailer == "mail") |
|
547 | 547 | { |
548 | - $boundary = '----==' . uniqid(rand(), TRUE); |
|
548 | + $boundary = '----=='.uniqid(rand(), TRUE); |
|
549 | 549 | $this->eol = $GLOBALS['_qmail_compatibility'] == "Y" ? "\n" : "\r\n"; |
550 | - $this->header = "Content-Type: multipart/alternative;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol; |
|
550 | + $this->header = "Content-Type: multipart/alternative;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol; |
|
551 | 551 | $this->body = sprintf( |
552 | - "--%s" . $this->eol . |
|
553 | - "Content-Type: text/plain; charset=utf-8; format=flowed" . $this->eol . |
|
554 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
555 | - "Content-Disposition: inline" . $this->eol . $this->eol . |
|
556 | - "%s" . |
|
557 | - "--%s" . $this->eol . |
|
558 | - "Content-Type: text/html; charset=utf-8" . $this->eol . |
|
559 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
560 | - "Content-Disposition: inline" . $this->eol . $this->eol . |
|
561 | - "%s" . |
|
562 | - "--%s--" . |
|
552 | + "--%s".$this->eol. |
|
553 | + "Content-Type: text/plain; charset=utf-8; format=flowed".$this->eol. |
|
554 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
555 | + "Content-Disposition: inline".$this->eol.$this->eol. |
|
556 | + "%s". |
|
557 | + "--%s".$this->eol. |
|
558 | + "Content-Type: text/html; charset=utf-8".$this->eol. |
|
559 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
560 | + "Content-Disposition: inline".$this->eol.$this->eol. |
|
561 | + "%s". |
|
562 | + "--%s--". |
|
563 | 563 | "", $boundary, $this->getPlainContent(), $boundary, $this->getHTMLContent(), $boundary |
564 | 564 | ); |
565 | 565 | $this->procCidAttachments(); |
566 | 566 | $this->procAttachments(); |
567 | 567 | $headers = sprintf( |
568 | - "From: %s" . $this->eol . |
|
569 | - "%s" . |
|
570 | - "%s" . |
|
571 | - "%s" . |
|
572 | - "%s" . |
|
573 | - "MIME-Version: 1.0" . $this->eol . "", $this->getSender(), $this->messageId ? ("Message-ID: <" . $this->messageId . ">" . $this->eol) : "", $this->replyTo ? ("Reply-To: <" . $this->replyTo . ">" . $this->eol) : "", $this->bcc ? ("Bcc: " . $this->bcc . $this->eol) : "", $this->references ? ("References: <" . $this->references . ">" . $this->eol . "In-Reply-To: <" . $this->references . ">" . $this->eol) : "" |
|
568 | + "From: %s".$this->eol. |
|
569 | + "%s". |
|
570 | + "%s". |
|
571 | + "%s". |
|
572 | + "%s". |
|
573 | + "MIME-Version: 1.0".$this->eol."", $this->getSender(), $this->messageId ? ("Message-ID: <".$this->messageId.">".$this->eol) : "", $this->replyTo ? ("Reply-To: <".$this->replyTo.">".$this->eol) : "", $this->bcc ? ("Bcc: ".$this->bcc.$this->eol) : "", $this->references ? ("References: <".$this->references.">".$this->eol."In-Reply-To: <".$this->references.">".$this->eol) : "" |
|
574 | 574 | ); |
575 | 575 | $headers .= $this->header; |
576 | - if($this->additional_params) |
|
576 | + if ($this->additional_params) |
|
577 | 577 | { |
578 | 578 | return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers, $this->additional_params); |
579 | 579 | } |
@@ -594,14 +594,14 @@ discard block |
||
594 | 594 | */ |
595 | 595 | function checkMailMX($email_address) |
596 | 596 | { |
597 | - if(!Mail::isVaildMailAddress($email_address)) |
|
597 | + if (!Mail::isVaildMailAddress($email_address)) |
|
598 | 598 | { |
599 | 599 | return FALSE; |
600 | 600 | } |
601 | 601 | list($user, $host) = explode("@", $email_address); |
602 | - if(function_exists('checkdnsrr')) |
|
602 | + if (function_exists('checkdnsrr')) |
|
603 | 603 | { |
604 | - if(checkdnsrr($host, "MX") || checkdnsrr($host, "A")) |
|
604 | + if (checkdnsrr($host, "MX") || checkdnsrr($host, "A")) |
|
605 | 605 | { |
606 | 606 | return TRUE; |
607 | 607 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | function isVaildMailAddress($email_address) |
623 | 623 | { |
624 | - if(preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address)) |
|
624 | + if (preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address)) |
|
625 | 625 | { |
626 | 626 | return $email_address; |
627 | 627 | } |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | function returnMIMEType($filename) |
641 | 641 | { |
642 | 642 | preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix); |
643 | - switch(strtolower($fileSuffix[1])) |
|
643 | + switch (strtolower($fileSuffix[1])) |
|
644 | 644 | { |
645 | 645 | case "js" : |
646 | 646 | return "application/x-javascript"; |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | case "gif" : |
655 | 655 | case "bmp" : |
656 | 656 | case "tiff" : |
657 | - return "image/" . strtolower($fileSuffix[1]); |
|
657 | + return "image/".strtolower($fileSuffix[1]); |
|
658 | 658 | case "css" : |
659 | 659 | return "text/css"; |
660 | 660 | case "xml" : |
@@ -708,11 +708,11 @@ discard block |
||
708 | 708 | case "swf" : |
709 | 709 | return "application/x-shockwave-flash"; |
710 | 710 | default : |
711 | - if(function_exists("mime_content_type")) |
|
711 | + if (function_exists("mime_content_type")) |
|
712 | 712 | { |
713 | 713 | $fileSuffix = mime_content_type($filename); |
714 | 714 | } |
715 | - return "unknown/" . trim($fileSuffix[0], "."); |
|
715 | + return "unknown/".trim($fileSuffix[0], "."); |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @brief admin log |
11 | 11 | */ |
12 | 12 | $logged_info = Context::get('logged_info'); |
13 | -if($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
13 | +if ($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') |
|
14 | 14 | { |
15 | 15 | $oAdminloggingController = getController('adminlogging'); |
16 | 16 | $oAdminloggingController->insertLog($this->module, $this->act); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file adminlogging.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if (!defined("__XE__")) exit(); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @file captcha.addon.php |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @brief Captcha for a particular action |
10 | 10 | * English alphabets and voice verification added |
11 | 11 | * */ |
12 | -if(!class_exists('AddonMemberCaptcha', false)) |
|
12 | +if (!class_exists('AddonMemberCaptcha', false)) |
|
13 | 13 | { |
14 | 14 | class AddonMemberCaptcha |
15 | 15 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function before_module_init(&$ModuleHandler) |
33 | 33 | { |
34 | 34 | $logged_info = Context::get('logged_info'); |
35 | - if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
35 | + if ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) |
|
36 | 36 | { |
37 | 37 | return false; |
38 | 38 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | // { |
41 | 41 | // return false; |
42 | 42 | // } |
43 | - if($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
43 | + if ($_SESSION['XE_VALIDATOR_ERROR'] == -1) |
|
44 | 44 | { |
45 | 45 | $_SESSION['member_captcha_authed'] = false; |
46 | 46 | } |
47 | - if($_SESSION['member_captcha_authed']) |
|
47 | + if ($_SESSION['member_captcha_authed']) |
|
48 | 48 | { |
49 | 49 | return false; |
50 | 50 | } |
@@ -52,26 +52,26 @@ discard block |
||
52 | 52 | $type = Context::get('captchaType'); |
53 | 53 | |
54 | 54 | $this->target_acts = array(); |
55 | - if($this->addon_info->apply_find_account == 'apply') |
|
55 | + if ($this->addon_info->apply_find_account == 'apply') |
|
56 | 56 | { |
57 | 57 | $this->target_acts[] = 'procMemberFindAccount'; |
58 | 58 | } |
59 | - if($this->addon_info->apply_resend_auth_mail == 'apply') |
|
59 | + if ($this->addon_info->apply_resend_auth_mail == 'apply') |
|
60 | 60 | { |
61 | 61 | $this->target_acts[] = 'procMemberResendAuthMail'; |
62 | 62 | } |
63 | - if($this->addon_info->apply_signup == 'apply') |
|
63 | + if ($this->addon_info->apply_signup == 'apply') |
|
64 | 64 | { |
65 | 65 | $this->target_acts[] = 'procMemberInsert'; |
66 | 66 | } |
67 | 67 | |
68 | - if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
68 | + if (Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON') |
|
69 | 69 | { |
70 | - if($type == 'inline') |
|
70 | + if ($type == 'inline') |
|
71 | 71 | { |
72 | - if(!$this->compareCaptcha()) |
|
72 | + if (!$this->compareCaptcha()) |
|
73 | 73 | { |
74 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
74 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
75 | 75 | $_SESSION['XE_VALIDATOR_ERROR'] = -1; |
76 | 76 | $_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied'); |
77 | 77 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error'; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | { |
84 | 84 | Context::addHtmlHeader('<script> |
85 | 85 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
86 | - captchaTargetAct.push("' . implode('","', $this->target_acts) . '"); |
|
86 | + captchaTargetAct.push("' . implode('","', $this->target_acts).'"); |
|
87 | 87 | </script>'); |
88 | 88 | Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | // compare session when calling actions such as writing a post or a comment on the board/issue tracker module |
93 | - if(!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
93 | + if (!$_SESSION['member_captcha_authed'] && in_array(Context::get('act'), $this->target_acts)) |
|
94 | 94 | { |
95 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
95 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
96 | 96 | $ModuleHandler->error = "captcha_denied"; |
97 | 97 | } |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | function createKeyword() |
103 | 103 | { |
104 | 104 | $type = Context::get('captchaType'); |
105 | - if($type == 'inline' && $_SESSION['captcha_keyword']) |
|
105 | + if ($type == 'inline' && $_SESSION['captcha_keyword']) |
|
106 | 106 | { |
107 | 107 | return; |
108 | 108 | } |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | |
116 | 116 | function before_module_init_setCaptchaSession() |
117 | 117 | { |
118 | - if($_SESSION['member_captcha_authed']) |
|
118 | + if ($_SESSION['member_captcha_authed']) |
|
119 | 119 | { |
120 | 120 | return false; |
121 | 121 | } |
122 | 122 | // Load language files |
123 | - Context::loadLang(_XE_PATH_ . 'addons/captcha_member/lang'); |
|
123 | + Context::loadLang(_XE_PATH_.'addons/captcha_member/lang'); |
|
124 | 124 | // Generate keywords |
125 | 125 | $this->createKeyword(); |
126 | 126 | |
127 | 127 | $target = Context::getLang('target_captcha'); |
128 | 128 | header("Content-Type: text/xml; charset=UTF-8"); |
129 | 129 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
130 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
130 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
131 | 131 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
132 | 132 | header("Cache-Control: post-check=0, pre-check=0", false); |
133 | 133 | header("Pragma: no-cache"); |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | |
145 | 145 | function before_module_init_captchaImage() |
146 | 146 | { |
147 | - if($_SESSION['member_captcha_authed']) |
|
147 | + if ($_SESSION['member_captcha_authed']) |
|
148 | 148 | { |
149 | 149 | return false; |
150 | 150 | } |
151 | - if(Context::get('renew')) |
|
151 | + if (Context::get('renew')) |
|
152 | 152 | { |
153 | 153 | $this->createKeyword(); |
154 | 154 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | function createCaptchaImage($string) |
171 | 171 | { |
172 | 172 | $arr = array(); |
173 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
173 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
174 | 174 | { |
175 | 175 | $arr[] = $string{$i}; |
176 | 176 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | shuffle($deg); |
193 | 193 | |
194 | 194 | // Create an image for each letter |
195 | - foreach($arr as $i => $str) |
|
195 | + foreach ($arr as $i => $str) |
|
196 | 196 | { |
197 | 197 | $im[$i + 1] = @imagecreate($w, $h); |
198 | 198 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $ran = range(1, 20); |
203 | 203 | shuffle($ran); |
204 | 204 | |
205 | - if(function_exists('imagerotate')) |
|
205 | + if (function_exists('imagerotate')) |
|
206 | 206 | { |
207 | 207 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color); |
208 | 208 | $im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | // Combine images of each character |
220 | - for($i = 1; $i < count($im); $i++) |
|
220 | + for ($i = 1; $i < count($im); $i++) |
|
221 | 221 | { |
222 | 222 | imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h); |
223 | 223 | imagedestroy($im[$i]); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h); |
230 | 230 | imagedestroy($im[0]); |
231 | 231 | |
232 | - if(function_exists('imageantialias')) |
|
232 | + if (function_exists('imageantialias')) |
|
233 | 233 | { |
234 | 234 | imageantialias($big, true); |
235 | 235 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $h = $h * $big_count; |
242 | 242 | $d = array_pop($deg); |
243 | 243 | |
244 | - for($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
244 | + for ($i = -abs($d); $i < $h + abs($d); $i = $i + 7) |
|
245 | 245 | { |
246 | 246 | imageline($big, 0, $i + $d, $w, $i, $line_color); |
247 | 247 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $x = range(0, ($w - 10)); |
250 | 250 | shuffle($x); |
251 | 251 | |
252 | - for($i = 0; $i < 200; $i++) |
|
252 | + for ($i = 0; $i < 200; $i++) |
|
253 | 253 | { |
254 | 254 | imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color); |
255 | 255 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | |
260 | 260 | function before_module_init_captchaAudio() |
261 | 261 | { |
262 | - if($_SESSION['member_captcha_authed']) |
|
262 | + if ($_SESSION['member_captcha_authed']) |
|
263 | 263 | { |
264 | 264 | return false; |
265 | 265 | } |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | header("Content-Disposition: attachment; filename=\"captcha_audio.mp3\""); |
272 | 272 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
273 | 273 | header('Expires: Sun, 1 Jan 2000 12:00:00 GMT'); |
274 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); |
|
275 | - header('Content-Length: ' . strlen($data)); |
|
274 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT'); |
|
275 | + header('Content-Length: '.strlen($data)); |
|
276 | 276 | |
277 | 277 | echo $data; |
278 | 278 | Context::close(); |
@@ -283,17 +283,17 @@ discard block |
||
283 | 283 | { |
284 | 284 | $data = ''; |
285 | 285 | $_audio = './addons/captcha/audio/F_%s.mp3'; |
286 | - for($i = 0, $c = strlen($string); $i < $c; $i++) |
|
286 | + for ($i = 0, $c = strlen($string); $i < $c; $i++) |
|
287 | 287 | { |
288 | 288 | $_data = FileHandler::readFile(sprintf($_audio, $string{$i})); |
289 | 289 | |
290 | 290 | $start = rand(5, 68); // Random start in 4-byte header and 64 byte data |
291 | 291 | $datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes |
292 | 292 | |
293 | - for($j = $start; $j < $datalen; $j+=64) |
|
293 | + for ($j = $start; $j < $datalen; $j += 64) |
|
294 | 294 | { |
295 | 295 | $ch = ord($_data{$j}); |
296 | - if($ch < 9 || $ch > 119) |
|
296 | + if ($ch < 9 || $ch > 119) |
|
297 | 297 | { |
298 | 298 | continue; |
299 | 299 | } |
@@ -308,14 +308,14 @@ discard block |
||
308 | 308 | |
309 | 309 | function compareCaptcha() |
310 | 310 | { |
311 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
311 | + if (!in_array(Context::get('act'), $this->target_acts)) return true; |
|
312 | 312 | |
313 | - if($_SESSION['member_captcha_authed']) |
|
313 | + if ($_SESSION['member_captcha_authed']) |
|
314 | 314 | { |
315 | 315 | return true; |
316 | 316 | } |
317 | 317 | |
318 | - if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
318 | + if (strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) |
|
319 | 319 | { |
320 | 320 | $_SESSION['member_captcha_authed'] = true; |
321 | 321 | return true; |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | |
329 | 329 | function before_module_init_captchaCompare() |
330 | 330 | { |
331 | - if(!$this->compareCaptcha()) |
|
331 | + if (!$this->compareCaptcha()) |
|
332 | 332 | { |
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | |
336 | 336 | header("Content-Type: text/xml; charset=UTF-8"); |
337 | 337 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
338 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
338 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
339 | 339 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
340 | 340 | header("Cache-Control: post-check=0, pre-check=0", false); |
341 | 341 | header("Pragma: no-cache"); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | unset($_SESSION['member_captcha_authed']); |
351 | 351 | $this->createKeyword(); |
352 | 352 | |
353 | - $swfURL = getUrl() . 'addons/captcha/swf/play.swf'; |
|
353 | + $swfURL = getUrl().'addons/captcha/swf/play.swf'; |
|
354 | 354 | Context::unloadFile('./addons/captcha/captcha.min.js'); |
355 | 355 | Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body')); |
356 | 356 | |
@@ -388,18 +388,18 @@ discard block |
||
388 | 388 | |
389 | 389 | $oAddonMemberCaptcha = &$GLOBALS['__AddonMemberCaptcha__']; |
390 | 390 | |
391 | -if(method_exists($oAddonMemberCaptcha, $called_position)) |
|
391 | +if (method_exists($oAddonMemberCaptcha, $called_position)) |
|
392 | 392 | { |
393 | - if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this))) |
|
393 | + if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position), array(&$this))) |
|
394 | 394 | { |
395 | 395 | return false; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | 399 | $addon_act = Context::get('captcha_action'); |
400 | -if($addon_act && method_exists($oAddonMemberCaptcha, $called_position . '_' . $addon_act)) |
|
400 | +if ($addon_act && method_exists($oAddonMemberCaptcha, $called_position.'_'.$addon_act)) |
|
401 | 401 | { |
402 | - if(!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position . '_' . $addon_act), array(&$this))) |
|
402 | + if (!call_user_func_array(array(&$oAddonMemberCaptcha, $called_position.'_'.$addon_act), array(&$this))) |
|
403 | 403 | { |
404 | 404 | return false; |
405 | 405 | } |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined("__XE__")) exit(); |
|
4 | +if(!defined("__XE__")) { |
|
5 | + exit(); |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * @file captcha.addon.php |
@@ -78,8 +80,7 @@ discard block |
||
78 | 80 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); |
79 | 81 | $ModuleHandler->_setInputValueToSession(); |
80 | 82 | } |
81 | - } |
|
82 | - else |
|
83 | + } else |
|
83 | 84 | { |
84 | 85 | Context::addHtmlHeader('<script> |
85 | 86 | if(!captchaTargetAct) {var captchaTargetAct = [];} |
@@ -209,8 +210,7 @@ discard block |
||
209 | 210 | |
210 | 211 | $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); |
211 | 212 | imagecolortransparent($im[$i + 1], $background_color); |
212 | - } |
|
213 | - else |
|
213 | + } else |
|
214 | 214 | { |
215 | 215 | imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color); |
216 | 216 | } |
@@ -308,7 +308,9 @@ discard block |
||
308 | 308 | |
309 | 309 | function compareCaptcha() |
310 | 310 | { |
311 | - if(!in_array(Context::get('act'), $this->target_acts)) return true; |
|
311 | + if(!in_array(Context::get('act'), $this->target_acts)) { |
|
312 | + return true; |
|
313 | + } |
|
312 | 314 | |
313 | 315 | if($_SESSION['member_captcha_authed']) |
314 | 316 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * Display point level icon before user name when point system is enabled. |
13 | 13 | * */ |
14 | 14 | // return unless before_display_content |
15 | -if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
15 | +if ($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify' || Context::getResponseMethod() != 'HTML' || isCrawler()) |
|
16 | 16 | { |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | -require_once(_XE_PATH_ . 'addons/point_level_icon/point_level_icon.lib.php'); |
|
20 | +require_once(_XE_PATH_.'addons/point_level_icon/point_level_icon.lib.php'); |
|
21 | 21 | |
22 | 22 | $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output); |
23 | -if($temp_output) |
|
23 | +if ($temp_output) |
|
24 | 24 | { |
25 | 25 | $output = $temp_output; |
26 | 26 | } |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file point.addon.php |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if (!defined('__XE__')) |
|
5 | 5 | exit(); |
6 | 6 | |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @brief Counter add-on |
11 | 11 | */ |
12 | 12 | // Execute if called_position is before_display_content |
13 | -if($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler()) |
|
13 | +if ($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler()) |
|
14 | 14 | { |
15 | 15 | $oCounterController = getController('counter'); |
16 | 16 | $oCounterController->counterExecute(); |
@@ -1,8 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) XEHub <https://www.xpressengine.com> */ |
3 | 3 | |
4 | -if(!defined('__XE__')) |
|
4 | +if(!defined('__XE__')) { |
|
5 | 5 | exit(); |
6 | +} |
|
6 | 7 | |
7 | 8 | /** |
8 | 9 | * @file counter.addon.php |