@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler{ |
|
16 | 16 | // Single variable for a log entry |
17 | 17 | var $entry = array(); |
18 | 18 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
20 | 20 | global $modx; |
21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
23 | 23 | |
24 | 24 | // User Credentials |
25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 27 | |
28 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
28 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | + if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
30 | 30 | |
31 | - $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
31 | + $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | + if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
33 | 33 | |
34 | 34 | $this->writeToLog(); |
35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | // function to write to the log |
39 | 39 | // collects all required info, and |
40 | 40 | // writes it to the logging table |
41 | - function writeToLog() { |
|
41 | + function writeToLog(){ |
|
42 | 42 | global $modx; |
43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 44 | |
45 | - if($this->entry['internalKey'] == "") { |
|
45 | + if ($this->entry['internalKey'] == "") { |
|
46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
47 | 47 | } |
48 | - if(empty($this->entry['action'])) { |
|
48 | + if (empty($this->entry['action'])) { |
|
49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
50 | 50 | } |
51 | - if($this->entry['msg'] == "") { |
|
51 | + if ($this->entry['msg'] == "") { |
|
52 | 52 | include_once "actionlist.inc.php"; |
53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
54 | - if($this->entry['msg'] == "") { |
|
54 | + if ($this->entry['msg'] == "") { |
|
55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
56 | 56 | } |
57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
67 | - if(!$insert_id) { |
|
66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
67 | + if (!$insert_id) { |
|
68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
69 | 69 | } else { |
70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | - if(($insert_id % $trim) === 0) { |
|
73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | + if (($insert_id % $trim) === 0) { |
|
73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | $countChild++; |
66 | 66 | $id = $value[0]; |
67 | 67 | $ph['id'] = $id; |
68 | - $ph['li_class'] = $this->get_li_class($id) . $value[10]; |
|
68 | + $ph['li_class'] = $this->get_li_class($id).$value[10]; |
|
69 | 69 | $ph['href'] = $value[3]; |
70 | 70 | $ph['alt'] = $value[4]; |
71 | 71 | $ph['target'] = $value[7]; |
72 | 72 | $ph['onclick'] = $value[5]; |
73 | 73 | $ph['a_class'] = $this->get_a_class($id); |
74 | 74 | $ph['LinkAttr'] = $this->getLinkAttr($id); |
75 | - $ph['itemName'] = $value[2] . $this->getItemName($id); |
|
75 | + $ph['itemName'] = $value[2].$this->getItemName($id); |
|
76 | 76 | |
77 | 77 | $ph['DrawSub'] = ''; |
78 | 78 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | function get_li_class($id) |
112 | 112 | { |
113 | 113 | if (isset($this->menu[$id])) { |
114 | - return $this->defaults['parentClass'] . ' '; |
|
114 | + return $this->defaults['parentClass'].' '; |
|
115 | 115 | } else { |
116 | 116 | return ''; |
117 | 117 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | function get_a_class($id) |
121 | 121 | { |
122 | 122 | if (isset($this->menu[$id])) { |
123 | - return ' class="' . $this->defaults['parentLinkClass'] . '"'; |
|
123 | + return ' class="'.$this->defaults['parentLinkClass'].'"'; |
|
124 | 124 | } else { |
125 | 125 | return ''; |
126 | 126 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | - function __construct() { |
|
12 | + function __construct(){ |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -17,46 +17,46 @@ discard block |
||
17 | 17 | * @param array $data |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
20 | + public function output($config = array(), $data = array()){ |
|
21 | 21 | global $modx; |
22 | 22 | |
23 | 23 | $output = ''; |
24 | 24 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
26 | 26 | |
27 | - if($action) { |
|
27 | + if ($action) { |
|
28 | 28 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
30 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
31 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
29 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
30 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
31 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
34 | + if ($modx->db->getRecordCount($sql)) { |
|
35 | 35 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
36 | + while ($row = $modx->db->getRow($sql)) { |
|
37 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 38 | $row['value'] = $data[$row['name']]; |
39 | 39 | } |
40 | 40 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 41 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 42 | } |
43 | 43 | |
44 | - if(!empty($config['toArray'])) { |
|
44 | + if (!empty($config['toArray'])) { |
|
45 | 45 | $output = $tabs; |
46 | 46 | } else { |
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
47 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
48 | 48 | $output .= ' |
49 | 49 | <script type="text/javascript"> |
50 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
50 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
53 | + foreach ($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
55 | 55 | $output .= ' |
56 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
57 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
56 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
57 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
58 | 58 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
59 | + foreach ($tab as $item) { |
|
60 | 60 | $output .= $item; |
61 | 61 | } |
62 | 62 | $output .= '</div>'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return $output; |
70 | 70 | } |
71 | 71 | |
72 | - private function render($data) { |
|
72 | + private function render($data){ |
|
73 | 73 | global $modx, $_lang, $_country_lang; |
74 | 74 | |
75 | 75 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $output = ''; |
80 | 80 | $output .= '<div class="form-group row">'; |
81 | 81 | |
82 | - switch($data['type']) { |
|
82 | + switch ($data['type']) { |
|
83 | 83 | |
84 | 84 | case 'text': |
85 | 85 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 114 | $output .= '<div class="col-sm-7">'; |
115 | 115 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
116 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 117 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
118 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
119 | + foreach ($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
121 | 121 | } |
122 | 122 | } else { |
123 | - if($data['elements']) { |
|
123 | + if ($data['elements']) { |
|
124 | 124 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
125 | + foreach ($elements as $key => $value) { |
|
126 | 126 | $value = explode('==', $value); |
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
127 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 139 | $output .= '<div class="col-sm-7">'; |
140 | 140 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
141 | + if ($data['elements']) { |
|
142 | 142 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
143 | + foreach ($elements as $key => $value) { |
|
144 | 144 | $value = explode('==', $value); |
145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
145 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | $output .= $data['content']; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 155 | $output .= '<div class="col-sm-7">'; |
156 | 156 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
157 | + if ($data['elements']) { |
|
158 | 158 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
159 | + foreach ($elements as $key => $value) { |
|
160 | 160 | $value = explode('==', $value); |
161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | $output .= $data['content']; |
@@ -3,59 +3,59 @@ |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu{ |
|
7 | 7 | var $id; |
8 | 8 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
9 | + function __construct($id = '', $width = 120, $visible = false){ |
|
10 | 10 | global $ContextMenuCnt; |
11 | 11 | $ContextMenuCnt++; |
12 | 12 | $this->html = ""; |
13 | 13 | $this->visible = $visible ? $visible : false; |
14 | 14 | $this->width = is_numeric($width) ? intval($width) : 120; |
15 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
15 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
16 | 16 | } |
17 | 17 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
18 | + function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
19 | 19 | global $base_url, $_style; |
20 | - if($disabled) { |
|
20 | + if ($disabled) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | - if(!$img) { |
|
24 | - $img = $base_url . $_style['tx']; |
|
23 | + if (!$img) { |
|
24 | + $img = $base_url.$_style['tx']; |
|
25 | 25 | } |
26 | - if(substr($action, 0, 3) == "js:") { |
|
26 | + if (substr($action, 0, 3) == "js:") { |
|
27 | 27 | $action = substr($action, 3); |
28 | - } else if(substr($action, 0, 3) == "hl:") { |
|
29 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
28 | + } else if (substr($action, 0, 3) == "hl:") { |
|
29 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
30 | 30 | } else { |
31 | - $action = "window.location.href='" . $action . "'"; |
|
31 | + $action = "window.location.href='".$action."'"; |
|
32 | 32 | } |
33 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
35 | - if(substr($img, 0, 5) == 'fa fa') { |
|
36 | - $img = '<i class="' . $img . '"></i>'; |
|
37 | - } else if(substr($img, 0, 1) != '<') { |
|
38 | - $img = '<img src="' . $img . '" />'; |
|
33 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
34 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
35 | + if (substr($img, 0, 5) == 'fa fa') { |
|
36 | + $img = '<i class="'.$img.'"></i>'; |
|
37 | + } else if (substr($img, 0, 1) != '<') { |
|
38 | + $img = '<img src="'.$img.'" />'; |
|
39 | 39 | } |
40 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
40 | + $this->html .= $img.' '.$text.'</div>'; |
|
41 | 41 | } |
42 | 42 | |
43 | - function addSeparator() { |
|
43 | + function addSeparator(){ |
|
44 | 44 | $this->html .= " |
45 | 45 | <div class='cntxMnuSeparator'></div> |
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | - function render() { |
|
49 | + function render(){ |
|
50 | 50 | global $ContextMenuScript; |
51 | 51 | |
52 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
52 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
53 | 53 | $ContextMenuScript = ""; // reset css |
54 | 54 | return $html; |
55 | 55 | } |
56 | 56 | |
57 | - function getClientScriptObject() { |
|
58 | - return "getCntxMenu('" . $this->id . "')"; |
|
57 | + function getClientScriptObject(){ |
|
58 | + return "getCntxMenu('".$this->id."')"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | |
11 | 11 | $__DataGridCnt = 0; |
12 | 12 | |
13 | -class DataGrid { |
|
13 | +class DataGrid{ |
|
14 | 14 | |
15 | 15 | var $ds; // datasource |
16 | 16 | var $id; |
17 | - var $pageSize; // pager settings |
|
17 | + var $pageSize; // pager settings |
|
18 | 18 | var $pageNumber; |
19 | 19 | var $pager; |
20 | - var $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
20 | + var $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
21 | 21 | |
22 | 22 | var $cssStyle; |
23 | 23 | var $cssClass; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | var $colAligns; |
36 | 36 | var $colWraps; |
37 | 37 | var $colColors; |
38 | - var $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
38 | + var $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
39 | 39 | // data type: integer,float,currency,date |
40 | 40 | |
41 | 41 | var $header; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | var $cellPadding; |
44 | 44 | var $cellSpacing; |
45 | 45 | |
46 | - var $rowAlign; // vertical alignment: top, middle, bottom |
|
46 | + var $rowAlign; // vertical alignment: top, middle, bottom |
|
47 | 47 | var $rowIdField; |
48 | 48 | |
49 | 49 | var $pagerStyle; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | var $selPageClass; |
53 | 53 | var $noRecordMsg = "No records found."; |
54 | 54 | |
55 | - function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
55 | + function __construct($id, $ds, $pageSize = 20, $pageNumber = -1){ |
|
56 | 56 | global $__DataGridCnt; |
57 | 57 | |
58 | 58 | // set id |
59 | 59 | $__DataGridCnt++; |
60 | - $this->id = $this->id ? $id : "dg" . $__DataGridCnt; |
|
60 | + $this->id = $this->id ? $id : "dg".$__DataGridCnt; |
|
61 | 61 | |
62 | 62 | // set datasource |
63 | 63 | $this->ds = $ds; |
@@ -68,50 +68,50 @@ discard block |
||
68 | 68 | $this->pagerLocation = 'top-right'; |
69 | 69 | } |
70 | 70 | |
71 | - function setDataSource($ds) { |
|
71 | + function setDataSource($ds){ |
|
72 | 72 | $this->ds = $ds; |
73 | 73 | } |
74 | 74 | |
75 | - function render() { |
|
75 | + function render(){ |
|
76 | 76 | global $modx; |
77 | - $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
|
78 | - $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
|
79 | - $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : ''; |
|
80 | - $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : ''; |
|
77 | + $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='".$this->columnHeaderStyle."'" : ''; |
|
78 | + $columnHeaderClass = ($this->columnHeaderClass) ? "class='".$this->columnHeaderClass."'" : ""; |
|
79 | + $cssStyle = ($this->cssStyle) ? "style='".$this->cssStyle."'" : ''; |
|
80 | + $cssClass = ($this->cssClass) ? "class='".$this->cssClass."'" : ''; |
|
81 | 81 | |
82 | - $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
83 | - $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
82 | + $pagerClass = ($this->pagerClass) ? "class='".$this->pagerClass."'" : ''; |
|
83 | + $pagerStyle = ($this->pagerStyle) ? "style='".$this->pagerStyle."'" : "style='background-color:#ffffff;'"; |
|
84 | 84 | |
85 | - $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : ''; |
|
86 | - $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : ''; |
|
87 | - $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : ''; |
|
88 | - $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : ''; |
|
85 | + $this->_itemStyle = ($this->itemStyle) ? "style='".$this->itemStyle."'" : ''; |
|
86 | + $this->_itemClass = ($this->itemClass) ? "class='".$this->itemClass."'" : ''; |
|
87 | + $this->_altItemStyle = ($this->altItemStyle) ? "style='".$this->altItemStyle."'" : ''; |
|
88 | + $this->_altItemClass = ($this->altItemClass) ? "class='".$this->altItemClass."'" : ''; |
|
89 | 89 | |
90 | 90 | $this->_alt = 0; |
91 | 91 | $this->_total = 0; |
92 | 92 | |
93 | 93 | $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
94 | 94 | |
95 | - if(!$cssStyle && !$cssClass) { |
|
95 | + if (!$cssStyle && !$cssClass) { |
|
96 | 96 | $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
97 | 97 | } |
98 | - if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
98 | + if (!$columnHeaderStyle && !$columnHeaderClass) { |
|
99 | 99 | $columnHeaderStyle = "style='color:black;background-color:silver'"; |
100 | 100 | } |
101 | - if(!$this->_itemStyle && !$this->_itemClass) { |
|
101 | + if (!$this->_itemStyle && !$this->_itemClass) { |
|
102 | 102 | $this->_itemStyle = "style='color:black;'"; |
103 | 103 | } |
104 | - if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
104 | + if (!$this->_altItemStyle && !$this->_altItemClass) { |
|
105 | 105 | $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
106 | 106 | } |
107 | 107 | |
108 | - if($this->_isDataset && !$this->columns) { |
|
108 | + if ($this->_isDataset && !$this->columns) { |
|
109 | 109 | $cols = $modx->db->numFields($this->ds); |
110 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
110 | + for ($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "").$modx->db->fieldName($this->ds, $i); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // start grid |
114 | - $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
114 | + $tblStart = "<table $cssClass $cssStyle cellpadding='".(isset($this->cellPadding) ? (int) $this->cellPadding : 1)."' cellspacing='".(isset($this->cellSpacing) ? (int) $this->cellSpacing : 1)."'>"; |
|
115 | 115 | $tblEnd = "</table>"; |
116 | 116 | |
117 | 117 | // build column header |
@@ -122,33 +122,33 @@ discard block |
||
122 | 122 | $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
123 | 123 | $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
124 | 124 | $this->_colcount = count($this->_colnames); |
125 | - if(!$this->_isDataset) { |
|
125 | + if (!$this->_isDataset) { |
|
126 | 126 | $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
127 | 127 | $this->ds = array_chunk($this->ds, $this->_colcount); |
128 | 128 | } |
129 | 129 | $tblColHdr = "<thead><tr>"; |
130 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
130 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
131 | 131 | $name = $this->_colnames[$c]; |
132 | 132 | $width = $this->_colwidths[$c]; |
133 | - $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
133 | + $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass".($width ? " width='$width'" : "").">$name</td>"; |
|
134 | 134 | } |
135 | 135 | $tblColHdr .= "</tr></thead>\n"; |
136 | 136 | |
137 | 137 | // build rows |
138 | 138 | $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
139 | 139 | $this->_fieldnames = explode(",", $this->fields); |
140 | - if($rowcount == 0) { |
|
141 | - $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n"; |
|
140 | + if ($rowcount == 0) { |
|
141 | + $tblRows .= "<tr><td ".$this->_itemStyle." ".$this->_itemClass." colspan='".$this->_colcount."'>".$this->noRecordMsg."</td></tr>\n"; |
|
142 | 142 | } else { |
143 | 143 | // render grid items |
144 | - if($this->pageSize <= 0) { |
|
145 | - for($r = 0; $r < $rowcount; $r++) { |
|
144 | + if ($this->pageSize <= 0) { |
|
145 | + for ($r = 0; $r < $rowcount; $r++) { |
|
146 | 146 | $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
147 | 147 | $tblRows .= $this->RenderRowFnc($r + 1, $row); |
148 | 148 | } |
149 | 149 | } else { |
150 | - if(!$this->pager) { |
|
151 | - include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
150 | + if (!$this->pager) { |
|
151 | + include_once dirname(__FILE__)."/datasetpager.class.php"; |
|
152 | 152 | $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
153 | 153 | $this->pager->setRenderRowFnc($this); // pass this object |
154 | 154 | $this->pager->cssStyle = $pagerStyle; |
@@ -168,18 +168,18 @@ discard block |
||
168 | 168 | $o = $tblStart; |
169 | 169 | $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
170 | 170 | $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both"); |
171 | - if($this->header) { |
|
172 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>"; |
|
171 | + if ($this->header) { |
|
172 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->header."</td></tr>"; |
|
173 | 173 | } |
174 | - if($tblPager && $ptop) { |
|
175 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
174 | + if ($tblPager && $ptop) { |
|
175 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
176 | 176 | } |
177 | - $o .= $tblColHdr . $tblRows; |
|
178 | - if($tblPager && $pbot) { |
|
179 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
177 | + $o .= $tblColHdr.$tblRows; |
|
178 | + if ($tblPager && $pbot) { |
|
179 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
180 | 180 | } |
181 | - if($this->footer) { |
|
182 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
181 | + if ($this->footer) { |
|
182 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->footer."</td></tr>"; |
|
183 | 183 | } |
184 | 184 | $o .= $tblEnd; |
185 | 185 | return $o; |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | |
188 | 188 | // format column values |
189 | 189 | |
190 | - function RenderRowFnc($n, $row) { |
|
191 | - if($this->_alt == 0) { |
|
190 | + function RenderRowFnc($n, $row){ |
|
191 | + if ($this->_alt == 0) { |
|
192 | 192 | $Style = $this->_itemStyle; |
193 | 193 | $Class = $this->_itemClass; |
194 | 194 | $this->_alt = 1; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $this->_alt = 0; |
199 | 199 | } |
200 | 200 | $o = "<tr>"; |
201 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
201 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
202 | 202 | $colStyle = $Style; |
203 | 203 | $fld = trim($this->_fieldnames[$c]); |
204 | 204 | $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
@@ -207,67 +207,67 @@ discard block |
||
207 | 207 | $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
208 | 208 | $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
209 | 209 | $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
210 | - if($color && $Style) { |
|
211 | - $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
210 | + if ($color && $Style) { |
|
211 | + $colStyle = substr($colStyle, 0, -1).";background-color:$color;'"; |
|
212 | 212 | } |
213 | 213 | $value = $this->formatColumnValue($row, $value, $type, $align); |
214 | - $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>"; |
|
214 | + $o .= "<td $colStyle $Class".($align ? " align='$align'" : "").($color ? " bgcolor='$color'" : "").($nowrap ? " nowrap='$nowrap'" : "").($width ? " width='$width'" : "").">$value</td>"; |
|
215 | 215 | } |
216 | 216 | $o .= "</tr>\n"; |
217 | 217 | return $o; |
218 | 218 | } |
219 | 219 | |
220 | - function formatColumnValue($row, $value, $type, &$align) { |
|
221 | - if(strpos($type, ":") !== false) { |
|
220 | + function formatColumnValue($row, $value, $type, &$align){ |
|
221 | + if (strpos($type, ":") !== false) { |
|
222 | 222 | list($type, $type_format) = explode(":", $type, 2); |
223 | 223 | } |
224 | - switch(strtolower($type)) { |
|
224 | + switch (strtolower($type)) { |
|
225 | 225 | case "integer": |
226 | - if($align == "") { |
|
226 | + if ($align == "") { |
|
227 | 227 | $align = "right"; |
228 | 228 | } |
229 | 229 | $value = number_format($value); |
230 | 230 | break; |
231 | 231 | |
232 | 232 | case "float": |
233 | - if($align == "") { |
|
233 | + if ($align == "") { |
|
234 | 234 | $align = "right"; |
235 | 235 | } |
236 | - if(!$type_format) { |
|
236 | + if (!$type_format) { |
|
237 | 237 | $type_format = 2; |
238 | 238 | } |
239 | 239 | $value = number_format($value, $type_format); |
240 | 240 | break; |
241 | 241 | |
242 | 242 | case "currency": |
243 | - if($align == "") { |
|
243 | + if ($align == "") { |
|
244 | 244 | $align = "right"; |
245 | 245 | } |
246 | - if(!$type_format) { |
|
246 | + if (!$type_format) { |
|
247 | 247 | $type_format = 2; |
248 | 248 | } |
249 | - $value = "$" . number_format($value, $type_format); |
|
249 | + $value = "$".number_format($value, $type_format); |
|
250 | 250 | break; |
251 | 251 | |
252 | 252 | case "date": |
253 | - if($align == "") { |
|
253 | + if ($align == "") { |
|
254 | 254 | $align = "right"; |
255 | 255 | } |
256 | - if(!is_numeric($value)) { |
|
256 | + if (!is_numeric($value)) { |
|
257 | 257 | $value = strtotime($value); |
258 | 258 | } |
259 | - if(!$type_format) { |
|
259 | + if (!$type_format) { |
|
260 | 260 | $type_format = "%A %d, %B %Y"; |
261 | 261 | } |
262 | 262 | $value = strftime($type_format, $value); |
263 | 263 | break; |
264 | 264 | |
265 | 265 | case "boolean": |
266 | - if($align == '') { |
|
266 | + if ($align == '') { |
|
267 | 267 | $align = "center"; |
268 | 268 | } |
269 | 269 | $value = number_format($value); |
270 | - if($value) { |
|
270 | + if ($value) { |
|
271 | 271 | $value = '•'; |
272 | 272 | } else { |
273 | 273 | $value = ' '; |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | // replace [+value+] first |
279 | 279 | $value = str_replace("[+value+]", $value, $type_format); |
280 | 280 | // replace other [+fields+] |
281 | - if(strpos($value, "[+") !== false) { |
|
282 | - foreach($row as $k => $v) { |
|
281 | + if (strpos($value, "[+") !== false) { |
|
282 | + foreach ($row as $k => $v) { |
|
283 | 283 | $value = str_replace("[+$k+]", $v, $value); |
284 | 284 | } |
285 | 285 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $username = '', |
150 | 150 | $password = '', |
151 | 151 | $debug_level = 0 |
152 | - ) { |
|
152 | + ){ |
|
153 | 153 | $pop = new self(); |
154 | 154 | |
155 | 155 | return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level); |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | // Send the Username |
291 | - $this->sendString("USER $username" . static::LE); |
|
291 | + $this->sendString("USER $username".static::LE); |
|
292 | 292 | $pop3_response = $this->getResponse(); |
293 | 293 | if ($this->checkResponse($pop3_response)) { |
294 | 294 | // Send the Password |
295 | - $this->sendString("PASS $password" . static::LE); |
|
295 | + $this->sendString("PASS $password".static::LE); |
|
296 | 296 | $pop3_response = $this->getResponse(); |
297 | 297 | if ($this->checkResponse($pop3_response)) { |
298 | 298 | return true; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | protected function catchWarning($errno, $errstr, $errfile, $errline) |
413 | 413 | { |
414 | 414 | $this->setError( |
415 | - 'Connecting to the POP3 server raised a PHP warning:' . |
|
415 | + 'Connecting to the POP3 server raised a PHP warning:'. |
|
416 | 416 | "errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline" |
417 | 417 | ); |
418 | 418 | } |
@@ -128,10 +128,10 @@ |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | return base64_encode( |
131 | - 'user=' . |
|
132 | - $this->oauthUserEmail . |
|
133 | - "\001auth=Bearer " . |
|
134 | - $this->oauthToken . |
|
131 | + 'user='. |
|
132 | + $this->oauthUserEmail. |
|
133 | + "\001auth=Bearer ". |
|
134 | + $this->oauthToken. |
|
135 | 135 | "\001\001" |
136 | 136 | ); |
137 | 137 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | // Connect to the SMTP server |
309 | 309 | $this->edebug( |
310 | - "Connection: opening to $host:$port, timeout=$timeout, options=" . |
|
310 | + "Connection: opening to $host:$port, timeout=$timeout, options=". |
|
311 | 311 | (count($options) > 0 ? var_export($options, true) : 'array()'), |
312 | 312 | self::DEBUG_CONNECTION |
313 | 313 | ); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $socket_context = stream_context_create($options); |
318 | 318 | set_error_handler([$this, 'errorHandler']); |
319 | 319 | $this->smtp_conn = stream_socket_client( |
320 | - $host . ':' . $port, |
|
320 | + $host.':'.$port, |
|
321 | 321 | $errno, |
322 | 322 | $errstr, |
323 | 323 | $timeout, |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | (string) $errstr |
351 | 351 | ); |
352 | 352 | $this->edebug( |
353 | - 'SMTP ERROR: ' . $this->error['error'] |
|
353 | + 'SMTP ERROR: '.$this->error['error'] |
|
354 | 354 | . ": $errstr ($errno)", |
355 | 355 | self::DEBUG_CLIENT |
356 | 356 | ); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | } |
371 | 371 | // Get any announcement |
372 | 372 | $announce = $this->get_lines(); |
373 | - $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER); |
|
373 | + $this->edebug('SERVER -> CLIENT: '.$announce, self::DEBUG_SERVER); |
|
374 | 374 | |
375 | 375 | return true; |
376 | 376 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $password, |
427 | 427 | $authtype = null, |
428 | 428 | $OAuth = null |
429 | - ) { |
|
429 | + ){ |
|
430 | 430 | if (!$this->server_caps) { |
431 | 431 | $this->setError('Authentication is not allowed before HELO/EHLO'); |
432 | 432 | |
@@ -443,15 +443,15 @@ discard block |
||
443 | 443 | return false; |
444 | 444 | } |
445 | 445 | |
446 | - $this->edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); |
|
446 | + $this->edebug('Auth method requested: '.($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL); |
|
447 | 447 | $this->edebug( |
448 | - 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']), |
|
448 | + 'Auth methods available on the server: '.implode(',', $this->server_caps['AUTH']), |
|
449 | 449 | self::DEBUG_LOWLEVEL |
450 | 450 | ); |
451 | 451 | |
452 | 452 | //If we have requested a specific auth type, check the server supports it before trying others |
453 | 453 | if (!in_array($authtype, $this->server_caps['AUTH'])) { |
454 | - $this->edebug('Requested auth method not available: ' . $authtype, self::DEBUG_LOWLEVEL); |
|
454 | + $this->edebug('Requested auth method not available: '.$authtype, self::DEBUG_LOWLEVEL); |
|
455 | 455 | $authtype = null; |
456 | 456 | } |
457 | 457 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | return false; |
471 | 471 | } |
472 | - self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL); |
|
472 | + self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | if (!in_array($authtype, $this->server_caps['AUTH'])) { |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | // Send encoded username and password |
490 | 490 | if (!$this->sendCommand( |
491 | 491 | 'User & Password', |
492 | - base64_encode("\0" . $username . "\0" . $password), |
|
492 | + base64_encode("\0".$username."\0".$password), |
|
493 | 493 | 235 |
494 | 494 | ) |
495 | 495 | ) { |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $challenge = base64_decode(substr($this->last_reply, 4)); |
518 | 518 | |
519 | 519 | // Build the response |
520 | - $response = $username . ' ' . $this->hmac($challenge, $password); |
|
520 | + $response = $username.' '.$this->hmac($challenge, $password); |
|
521 | 521 | |
522 | 522 | // send encoded credentials |
523 | 523 | return $this->sendCommand('Username', base64_encode($response), 235); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $oauth = $OAuth->getOauth64(); |
530 | 530 | |
531 | 531 | // Start authentication |
532 | - if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { |
|
532 | + if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 '.$oauth, 235)) { |
|
533 | 533 | return false; |
534 | 534 | } |
535 | 535 | break; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $k_ipad = $key ^ $ipad; |
577 | 577 | $k_opad = $key ^ $opad; |
578 | 578 | |
579 | - return md5($k_opad . pack('H*', md5($k_ipad . $data))); |
|
579 | + return md5($k_opad.pack('H*', md5($k_ipad.$data))); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | } |
692 | 692 | //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1 |
693 | 693 | if ($in_headers) { |
694 | - $line = "\t" . $line; |
|
694 | + $line = "\t".$line; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | $lines_out[] = $line; |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | foreach ($lines_out as $line_out) { |
701 | 701 | //RFC2821 section 4.5.2 |
702 | 702 | if (!empty($line_out) and $line_out[0] == '.') { |
703 | - $line_out = '.' . $line_out; |
|
703 | + $line_out = '.'.$line_out; |
|
704 | 704 | } |
705 | - $this->client_send($line_out . static::LE, 'DATA'); |
|
705 | + $this->client_send($line_out.static::LE, 'DATA'); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | */ |
749 | 749 | protected function sendHello($hello, $host) |
750 | 750 | { |
751 | - $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); |
|
751 | + $noerror = $this->sendCommand($hello, $hello.' '.$host, 250); |
|
752 | 752 | $this->helo_rply = $this->last_reply; |
753 | 753 | if ($noerror) { |
754 | 754 | $this->parseHelloFields($hello); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | |
820 | 820 | return $this->sendCommand( |
821 | 821 | 'MAIL FROM', |
822 | - 'MAIL FROM:<' . $from . '>' . $useVerp, |
|
822 | + 'MAIL FROM:<'.$from.'>'.$useVerp, |
|
823 | 823 | 250 |
824 | 824 | ); |
825 | 825 | } |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | { |
860 | 860 | return $this->sendCommand( |
861 | 861 | 'RCPT TO', |
862 | - 'RCPT TO:<' . $address . '>', |
|
862 | + 'RCPT TO:<'.$address.'>', |
|
863 | 863 | [250, 251] |
864 | 864 | ); |
865 | 865 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | |
899 | 899 | return false; |
900 | 900 | } |
901 | - $this->client_send($commandstring . static::LE, $command); |
|
901 | + $this->client_send($commandstring.static::LE, $command); |
|
902 | 902 | |
903 | 903 | $this->last_reply = $this->get_lines(); |
904 | 904 | // Fetch SMTP code and possible error code explanation |
@@ -908,8 +908,8 @@ discard block |
||
908 | 908 | $code_ex = (count($matches) > 2 ? $matches[2] : null); |
909 | 909 | // Cut off error code from each response line |
910 | 910 | $detail = preg_replace( |
911 | - "/{$code}[ -]" . |
|
912 | - ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m', |
|
911 | + "/{$code}[ -]". |
|
912 | + ($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '').'/m', |
|
913 | 913 | '', |
914 | 914 | $this->last_reply |
915 | 915 | ); |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $detail = substr($this->last_reply, 4); |
921 | 921 | } |
922 | 922 | |
923 | - $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER); |
|
923 | + $this->edebug('SERVER -> CLIENT: '.$this->last_reply, self::DEBUG_SERVER); |
|
924 | 924 | |
925 | 925 | if (!in_array($code, (array) $expect)) { |
926 | 926 | $this->setError( |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $code_ex |
931 | 931 | ); |
932 | 932 | $this->edebug( |
933 | - 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply, |
|
933 | + 'SMTP ERROR: '.$this->error['error'].': '.$this->last_reply, |
|
934 | 934 | self::DEBUG_CLIENT |
935 | 935 | ); |
936 | 936 | |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | public function turn() |
997 | 997 | { |
998 | 998 | $this->setError('The SMTP TURN command is not implemented'); |
999 | - $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT); |
|
999 | + $this->edebug('SMTP NOTICE: '.$this->error['error'], self::DEBUG_CLIENT); |
|
1000 | 1000 | |
1001 | 1001 | return false; |
1002 | 1002 | } |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | in_array($command, ['User & Password', 'Username', 'Password'], true)) { |
1018 | 1018 | $this->edebug('CLIENT -> SERVER: <credentials hidden>', self::DEBUG_CLIENT); |
1019 | 1019 | } else { |
1020 | - $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT); |
|
1020 | + $this->edebug('CLIENT -> SERVER: '.$data, self::DEBUG_CLIENT); |
|
1021 | 1021 | } |
1022 | 1022 | set_error_handler([$this, 'errorHandler']); |
1023 | 1023 | $result = fwrite($this->smtp_conn, $data); |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | //Must pass vars in here as params are by reference |
1124 | 1124 | if (!stream_select($selR, $selW, $selW, $this->Timelimit)) { |
1125 | 1125 | $this->edebug( |
1126 | - 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)', |
|
1126 | + 'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)', |
|
1127 | 1127 | self::DEBUG_LOWLEVEL |
1128 | 1128 | ); |
1129 | 1129 | break; |
1130 | 1130 | } |
1131 | 1131 | //Deliberate noise suppression - errors are handled afterwards |
1132 | 1132 | $str = @fgets($this->smtp_conn, 515); |
1133 | - $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL); |
|
1133 | + $this->edebug('SMTP INBOUND: "'.trim($str).'"', self::DEBUG_LOWLEVEL); |
|
1134 | 1134 | $data .= $str; |
1135 | 1135 | // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled), |
1136 | 1136 | // or 4th character is a space, we are done reading, break the loop, |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | $info = stream_get_meta_data($this->smtp_conn); |
1143 | 1143 | if ($info['timed_out']) { |
1144 | 1144 | $this->edebug( |
1145 | - 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)', |
|
1145 | + 'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)', |
|
1146 | 1146 | self::DEBUG_LOWLEVEL |
1147 | 1147 | ); |
1148 | 1148 | break; |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | // Now check if reads took too long |
1151 | 1151 | if ($endtime and time() > $endtime) { |
1152 | 1152 | $this->edebug( |
1153 | - 'SMTP -> get_lines(): timelimit reached (' . |
|
1154 | - $this->Timelimit . ' sec)', |
|
1153 | + 'SMTP -> get_lines(): timelimit reached ('. |
|
1154 | + $this->Timelimit.' sec)', |
|
1155 | 1155 | self::DEBUG_LOWLEVEL |
1156 | 1156 | ); |
1157 | 1157 | break; |
@@ -34,6 +34,6 @@ |
||
34 | 34 | */ |
35 | 35 | public function errorMessage() |
36 | 36 | { |
37 | - return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n"; |
|
37 | + return '<strong>'.htmlspecialchars($this->getMessage())."</strong><br />\n"; |
|
38 | 38 | } |
39 | 39 | } |