@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | if (!defined('XOOPS_MAINFILE_INCLUDED')) { |
27 | - include_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
27 | + include_once dirname(dirname(__DIR__)).'/mainfile.php'; |
|
28 | 28 | } else { |
29 | - chdir(\XoopsBaseConfig::get('root-path') . '/modules/pm/'); |
|
29 | + chdir(\XoopsBaseConfig::get('root-path').'/modules/pm/'); |
|
30 | 30 | } |
31 | 31 | $xoops = Xoops::getInstance(); |
32 | 32 | $xoops->loadLanguage('main', 'pm'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $msg_id = isset($_GET['msg_id']) ? (int)($_GET['msg_id']) : 0; |
40 | 40 | |
41 | 41 | if (empty($_GET['refresh']) && isset($_POST['op']) && $_POST['op'] !== "submit") { |
42 | - $jump = "pmlite.php?refresh=" . time(); |
|
42 | + $jump = "pmlite.php?refresh=".time(); |
|
43 | 43 | if ($send == 1) { |
44 | 44 | $jump .= "&send={$send}"; |
45 | 45 | } else { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | } |
55 | - header('location: ' . $jump); |
|
55 | + header('location: '.$jump); |
|
56 | 56 | exit(); |
57 | 57 | } |
58 | 58 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $tpl = new XoopsTpl(); |
70 | 70 | if ($count != 1) { |
71 | 71 | $error_message = _PM_USERNOEXIST; |
72 | - $error_message .= "<br />" . _PM_PLZTRYAGAIN; |
|
73 | - $error_message .= "<br />[ <a href='javascript:history.go(-1)'>" . _PM_GOBACK . "</a> ]"; |
|
72 | + $error_message .= "<br />"._PM_PLZTRYAGAIN; |
|
73 | + $error_message .= "<br />[ <a href='javascript:history.go(-1)'>"._PM_GOBACK."</a> ]"; |
|
74 | 74 | $tpl->assign('error_message', $error_message); |
75 | 75 | } else { |
76 | 76 | if ($xoops->security()->check()) { |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | } |
91 | 91 | if (!$pm_handler->insert($pm)) { |
92 | 92 | $error_message = $pm->getHtmlErrors(); |
93 | - $error_message .= "<br /><a href='javascript:history.go(-1)'>" . _PM_GOBACK . "</a>"; |
|
93 | + $error_message .= "<br /><a href='javascript:history.go(-1)'>"._PM_GOBACK."</a>"; |
|
94 | 94 | $tpl->assign('error_message', $error_message); |
95 | 95 | } else { |
96 | 96 | // @todo: Send notification email if user has selected this in the profile |
97 | 97 | $info_message = _PM_MESSAGEPOSTED; |
98 | 98 | $info_message .= "<br />"; |
99 | - $info_message .= "<br /><a href=\"javascript:window.opener.location='" . \XoopsBaseConfig::get('url') . "/viewpmsg.php';window.close();\">" . _PM_CLICKHERE . "</a>"; |
|
100 | - $info_message .= "<br /><br /><a href=\"javascript:window.close();\">" . _PM_ORCLOSEWINDOW . "</a>"; |
|
99 | + $info_message .= "<br /><a href=\"javascript:window.opener.location='".\XoopsBaseConfig::get('url')."/viewpmsg.php';window.close();\">"._PM_CLICKHERE."</a>"; |
|
100 | + $info_message .= "<br /><br /><a href=\"javascript:window.close();\">"._PM_ORCLOSEWINDOW."</a>"; |
|
101 | 101 | $tpl->assign('info_message', $info_message); |
102 | 102 | } |
103 | 103 | } else { |
104 | 104 | $error_message = implode('<br />', $xoops->security()->getErrors()); |
105 | - $error_message .= "<br /><a href=\"javascript:window.close();\">" . _PM_ORCLOSEWINDOW . "</a>"; |
|
105 | + $error_message .= "<br /><a href=\"javascript:window.close();\">"._PM_ORCLOSEWINDOW."</a>"; |
|
106 | 106 | $tpl->assign('error_message', $error_message); |
107 | 107 | } |
108 | 108 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $pm_uname = XoopsUser::getUnameFromId($pm->getVar("from_userid")); |
120 | 120 | $message = "[quote]\n"; |
121 | 121 | $message .= sprintf(_PM_USERWROTE, $pm_uname); |
122 | - $message .= "\n" . $pm->getVar("msg_text", "E") . "\n[/quote]"; |
|
122 | + $message .= "\n".$pm->getVar("msg_text", "E")."\n[/quote]"; |
|
123 | 123 | } else { |
124 | 124 | unset($pm); |
125 | 125 | $reply = $send2 = 0; |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | if ($reply == 1) { |
133 | 133 | $subject = $pm->getVar('subject', 'E'); |
134 | - if (!preg_match("/^" . XoopsLocale::C_RE . "/i", $subject)) { |
|
135 | - $subject = XoopsLocale::C_RE . ' ' . $subject; |
|
134 | + if (!preg_match("/^".XoopsLocale::C_RE."/i", $subject)) { |
|
135 | + $subject = XoopsLocale::C_RE.' '.$subject; |
|
136 | 136 | } |
137 | 137 | $form->addElement(new Xoops\Form\Label(_PM_TO, $pm_uname)); |
138 | 138 | $form->addElement(new Xoops\Form\Hidden('to_userid', $pm->getVar("from_userid"))); |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | } else { |
52 | 52 | if (empty($_REQUEST['ok'])) { |
53 | 53 | echo $xoops->confirm(array( |
54 | - 'ok' => 1, 'delete_messages' => 1, 'op' => $op, |
|
55 | - 'msg_ids' => json_encode(array_map("intval", $_POST['msg_id'])) |
|
54 | + 'ok' => 1, 'delete_messages' => 1, 'op' => $op, |
|
55 | + 'msg_ids' => json_encode(array_map("intval", $_POST['msg_id'])) |
|
56 | 56 | ), $_SERVER['REQUEST_URI'], XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_MESSAGES); |
57 | 57 | $xoops->footer(); |
58 | 58 | } else { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } else { |
130 | 130 | if (empty($_REQUEST['ok'])) { |
131 | 131 | echo $xoops->confirm(array( |
132 | - 'ok' => 1, 'empty_messages' => 1, 'op' => $op |
|
132 | + 'ok' => 1, 'empty_messages' => 1, 'op' => $op |
|
133 | 133 | ), $_SERVER['REQUEST_URI'], _PM_RUSUREEMPTY); |
134 | 134 | $xoops->footer(); |
135 | 135 | } else { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @author Taiwen Jiang <[email protected]> |
27 | 27 | */ |
28 | 28 | |
29 | -include_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
29 | +include_once dirname(dirname(__DIR__)).'/mainfile.php'; |
|
30 | 30 | |
31 | 31 | $xoops = Xoops::getInstance(); |
32 | 32 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $clean_msg_id = array_map("intval", $clean_msg_id); |
62 | 62 | } |
63 | 63 | $size = count($clean_msg_id); |
64 | - $msg =& $clean_msg_id; |
|
64 | + $msg = & $clean_msg_id; |
|
65 | 65 | for ($i = 0; $i < $size; ++$i) { |
66 | 66 | $pm = $pm_handler->get($msg[$i]); |
67 | 67 | if ($pm->getVar('to_userid') == $xoops->user->getVar('uid')) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $xoops->tpl()->assign('op', $op); |
219 | 219 | |
220 | 220 | if ($total_messages > $xoops->getModuleConfig('perpage')) { |
221 | - $nav = new XoopsPageNav($total_messages, $xoops->getModuleConfig('perpage'), $start, "start", 'op=' . $op); |
|
221 | + $nav = new XoopsPageNav($total_messages, $xoops->getModuleConfig('perpage'), $start, "start", 'op='.$op); |
|
222 | 222 | $xoops->tpl()->assign('pagenav', $nav->renderNav(4)); |
223 | 223 | } |
224 | 224 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | $member_handler = $xoops->getHandlerMember(); |
236 | - $senders = $member_handler->getUserList(new Criteria('uid', "(" . implode(", ", array_unique($uids)) . ")", "IN")); |
|
236 | + $senders = $member_handler->getUserList(new Criteria('uid', "(".implode(", ", array_unique($uids)).")", "IN")); |
|
237 | 237 | foreach (array_keys($pm_arr) as $i) { |
238 | 238 | $message = $pm_arr[$i]; |
239 | 239 | //$message['msg_time'] = XoopsLocale::formatTimestamp($message["msg_time"], 'e'); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $send_button = new Xoops\Form\Button('', 'send', XoopsLocale::A_SEND); |
253 | 253 | $send_button->set( |
254 | 254 | 'onclick', |
255 | - 'openWithSelfMain("' . $xoops->url('modules/pm/pmlite.php?send=1') . '" , "pmlite", 740,640);' |
|
255 | + 'openWithSelfMain("'.$xoops->url('modules/pm/pmlite.php?send=1').'" , "pmlite", 740,640);' |
|
256 | 256 | ); |
257 | 257 | $delete_button = new Xoops\Form\Button('', 'delete_messages', XoopsLocale::A_DELETE, 'submit'); |
258 | 258 | $move_button = new Xoops\Form\Button('', 'move_messages', ($op === 'save') ? _PM_UNSAVE |
@@ -180,8 +180,8 @@ |
||
180 | 180 | $msg .= _PM_EMAIL_MESSAGE . ":\n"; |
181 | 181 | $msg .= "\n" . $pm->getVar("subject") . "\n"; |
182 | 182 | $msg .= "\n" . strip_tags(str_replace(array( |
183 | - "<p>", "</p>", "<br />", "<br />" |
|
184 | - ), "\n", $pm->getVar("msg_text"))) . "\n\n"; |
|
183 | + "<p>", "</p>", "<br />", "<br />" |
|
184 | + ), "\n", $pm->getVar("msg_text"))) . "\n\n"; |
|
185 | 185 | $msg .= "--------------\n"; |
186 | 186 | $msg .= $xoops->getConfig('sitename') . ": " . \XoopsBaseConfig::get('url') . "\n"; |
187 | 187 |
@@ -171,19 +171,19 @@ |
||
171 | 171 | $msg .= "\n"; |
172 | 172 | $from = new XoopsUser($pm->getVar("from_userid")); |
173 | 173 | $to = new XoopsUser($pm->getVar("to_userid")); |
174 | - $msg .= sprintf(_PM_EMAIL_FROM, $from->getVar("uname") . " (" . \XoopsBaseConfig::get('url') |
|
175 | - . "/userinfo.php?uid=" . $pm->getVar("from_userid") . ")"); |
|
174 | + $msg .= sprintf(_PM_EMAIL_FROM, $from->getVar("uname")." (".\XoopsBaseConfig::get('url') |
|
175 | + . "/userinfo.php?uid=".$pm->getVar("from_userid").")"); |
|
176 | 176 | $msg .= "\n"; |
177 | - $msg .= sprintf(_PM_EMAIL_TO, $to->getVar("uname") . " (" . \XoopsBaseConfig::get('url') |
|
178 | - . "/userinfo.php?uid=" . $pm->getVar("to_userid") . ")"); |
|
177 | + $msg .= sprintf(_PM_EMAIL_TO, $to->getVar("uname")." (".\XoopsBaseConfig::get('url') |
|
178 | + . "/userinfo.php?uid=".$pm->getVar("to_userid").")"); |
|
179 | 179 | $msg .= "\n"; |
180 | - $msg .= _PM_EMAIL_MESSAGE . ":\n"; |
|
181 | - $msg .= "\n" . $pm->getVar("subject") . "\n"; |
|
182 | - $msg .= "\n" . strip_tags(str_replace(array( |
|
180 | + $msg .= _PM_EMAIL_MESSAGE.":\n"; |
|
181 | + $msg .= "\n".$pm->getVar("subject")."\n"; |
|
182 | + $msg .= "\n".strip_tags(str_replace(array( |
|
183 | 183 | "<p>", "</p>", "<br />", "<br />" |
184 | - ), "\n", $pm->getVar("msg_text"))) . "\n\n"; |
|
184 | + ), "\n", $pm->getVar("msg_text")))."\n\n"; |
|
185 | 185 | $msg .= "--------------\n"; |
186 | - $msg .= $xoops->getConfig('sitename') . ": " . \XoopsBaseConfig::get('url') . "\n"; |
|
186 | + $msg .= $xoops->getConfig('sitename').": ".\XoopsBaseConfig::get('url')."\n"; |
|
187 | 187 | |
188 | 188 | $xoopsMailer = $xoops->getMailer(); |
189 | 189 | $xoopsMailer->useMail(); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | $name = XoopsLocale::INBOX; |
34 | 34 | if ($pm_count = $pm_handler->getCount($criteria)) { |
35 | - $name = XoopsLocale::INBOX . ' <span class="badge">' . $pm_count . '</span>'; |
|
35 | + $name = XoopsLocale::INBOX.' <span class="badge">'.$pm_count.'</span>'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $ret[] = [ |
@@ -24,4 +24,4 @@ |
||
24 | 24 | define("_MI_SEARCH_MINSEARCH", "Minimum keyword length"); |
25 | 25 | define("_MI_SEARCH_MINSEARCHDSC", "Enter the minimum keyword length that users are required to enter to perform search"); |
26 | 26 | |
27 | -define("_MI_SEARCH_BNAME1","Search"); |
|
27 | +define("_MI_SEARCH_BNAME1", "Search"); |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | //todo, would be nice to have the module ids availabe also |
55 | 55 | $criteria = new CriteriaCompo(); |
56 | - $criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN')); |
|
56 | + $criteria->add(new Criteria('dirname', "('".implode("','", array_keys($available_plugins))."')", 'IN')); |
|
57 | 57 | if (isset($available_modules) && !empty($available_modules)) { |
58 | - $criteria->add(new Criteria('mid', '(' . implode(',', $available_modules) . ')', 'IN')); |
|
58 | + $criteria->add(new Criteria('mid', '('.implode(',', $available_modules).')', 'IN')); |
|
59 | 59 | } |
60 | 60 | $module_handler = $xoops->getHandlerModule(); |
61 | 61 | $mods_checkbox->addOptionArray($module_handler->getNameList($criteria)); |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | $query = ''; |
91 | 91 | foreach ($queries as $term) { |
92 | 92 | if (false === strpos($term, ' ')) { |
93 | - $query .= $term . ' '; |
|
93 | + $query .= $term.' '; |
|
94 | 94 | } else { |
95 | - $query .= '"' . $term . '" '; |
|
95 | + $query .= '"'.$term.'" '; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | $query = trim($query); |
@@ -110,156 +110,156 @@ |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | switch ($action) { |
113 | - case "results": |
|
114 | - $module_handler = $xoops->getHandlerModule(); |
|
115 | - $criteria = new CriteriaCompo(); |
|
116 | - $criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN')); |
|
117 | - $modules = $module_handler->getObjectsArray($criteria, true); |
|
118 | - if (empty($mids) || !is_array($mids)) { |
|
119 | - unset($mids); |
|
120 | - $mids = array_keys($modules); |
|
121 | - } |
|
122 | - $xoops->header('module:search/search.tpl'); |
|
123 | - $nomatch = true; |
|
124 | - $xoops->tpl()->assign('search', true); |
|
125 | - $xoops->tpl()->assign('queries', $queries); |
|
126 | - $xoops->tpl()->assign('ignored_words', sprintf(_MD_SEARCH_IGNOREDWORDS, $search->getConfig('keyword_min'))); |
|
127 | - $xoops->tpl()->assign('ignored_queries', $ignored_queries); |
|
113 | + case "results": |
|
114 | + $module_handler = $xoops->getHandlerModule(); |
|
115 | + $criteria = new CriteriaCompo(); |
|
116 | + $criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN')); |
|
117 | + $modules = $module_handler->getObjectsArray($criteria, true); |
|
118 | + if (empty($mids) || !is_array($mids)) { |
|
119 | + unset($mids); |
|
120 | + $mids = array_keys($modules); |
|
121 | + } |
|
122 | + $xoops->header('module:search/search.tpl'); |
|
123 | + $nomatch = true; |
|
124 | + $xoops->tpl()->assign('search', true); |
|
125 | + $xoops->tpl()->assign('queries', $queries); |
|
126 | + $xoops->tpl()->assign('ignored_words', sprintf(_MD_SEARCH_IGNOREDWORDS, $search->getConfig('keyword_min'))); |
|
127 | + $xoops->tpl()->assign('ignored_queries', $ignored_queries); |
|
128 | + |
|
129 | + $modules_result = array(); |
|
130 | + foreach ($mids as $mid) { |
|
131 | + $mid = (int)($mid); |
|
132 | + /* @var $module XoopsModule */ |
|
133 | + $module = $modules[$mid]; |
|
134 | + /* @var $plugin SearchPluginInterface */ |
|
135 | + $plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'search'); |
|
136 | + $results = $plugin->search($queries, $andor, 5, 0, null); |
|
137 | + $count = count($results); |
|
138 | + $mid = $module->getVar('mid'); |
|
139 | + |
|
140 | + $res = array(); |
|
141 | + if (is_array($results) && $count > 0) { |
|
142 | + $nomatch = false; |
|
143 | + $modules_result[$mid]['name'] = $module->getVar('name'); |
|
144 | + if (XoopsLoad::fileExists($image = $xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'))) { |
|
145 | + $modules_result[$mid]['image'] = $xoops->url($image); |
|
146 | + } else { |
|
147 | + $modules_result[$mid]['image'] = $xoops->url('images/icons/posticon2.gif'); |
|
148 | + } |
|
149 | + $res = array(); |
|
150 | + for ($i = 0; $i < $count; ++$i) { |
|
151 | + if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { |
|
152 | + $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']); |
|
153 | + } else { |
|
154 | + $res[$i]['link'] = $results[$i]['link']; |
|
155 | + } |
|
156 | + $res[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']); |
|
157 | + $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title'])); |
|
158 | + if (!empty($results[$i]['uid'])) { |
|
159 | + $res[$i]['uid'] = (int)($results[$i]['uid']); |
|
160 | + $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); |
|
161 | + } |
|
162 | + $res[$i]['time'] = !empty($results[$i]['time']) ? XoopsLocale::formatTimestamp((int)($results[$i]['time'])) : ""; |
|
163 | + $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); |
|
164 | + } |
|
165 | + if ($count >= 5) { |
|
166 | + $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); |
|
167 | + $search_url .= "&mid={$mid}&action=showall&andor={$andor}"; |
|
168 | + $modules_result[$mid]['search_url'] = htmlspecialchars($search_url); |
|
169 | + } |
|
170 | + } |
|
171 | + if (count($res) > 0) { |
|
172 | + $modules_result[$mid]['result'] = $res; |
|
173 | + } |
|
174 | + } |
|
175 | + unset($results); |
|
176 | + unset($module); |
|
177 | + |
|
178 | + $xoops->tpl()->assign('modules', $modules_result); |
|
179 | + |
|
180 | + /* @var $formHandler SearchSearchForm */ |
|
181 | + $formHandler = $search->getForm(null, 'search'); |
|
182 | + $form = $formHandler->getSearchFrom($andor, $queries, $mids, $mid); |
|
183 | + $form->display(); |
|
184 | + break; |
|
128 | 185 | |
129 | - $modules_result = array(); |
|
130 | - foreach ($mids as $mid) { |
|
131 | - $mid = (int)($mid); |
|
132 | - /* @var $module XoopsModule */ |
|
133 | - $module = $modules[$mid]; |
|
186 | + case "showall": |
|
187 | + case 'showallbyuser': |
|
188 | + $xoops->header('module:search/search.tpl'); |
|
189 | + $xoops->tpl()->assign('search', true); |
|
190 | + $xoops->tpl()->assign('queries', $queries); |
|
191 | + $xoops->tpl()->assign('ignored_words', sprintf(_MD_SEARCH_IGNOREDWORDS, $search->getConfig('keyword_min'))); |
|
192 | + $xoops->tpl()->assign('ignored_queries', $ignored_queries); |
|
193 | + |
|
194 | + $module_handler = $xoops->getHandlerModule(); |
|
195 | + $module = $xoops->getModuleById($mid); |
|
134 | 196 | /* @var $plugin SearchPluginInterface */ |
135 | 197 | $plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'search'); |
136 | - $results = $plugin->search($queries, $andor, 5, 0, null); |
|
137 | - $count = count($results); |
|
138 | - $mid = $module->getVar('mid'); |
|
198 | + $results = $plugin->search($queries, $andor, 20, $start, $uid); |
|
199 | + |
|
200 | + $modules_result[$mid]['name'] = $module->getVar('name'); |
|
201 | + $modules_result[$mid]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'); |
|
139 | 202 | |
140 | - $res = array(); |
|
203 | + $count = count($results); |
|
141 | 204 | if (is_array($results) && $count > 0) { |
142 | - $nomatch = false; |
|
143 | - $modules_result[$mid]['name'] = $module->getVar('name'); |
|
144 | - if (XoopsLoad::fileExists($image = $xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'))) { |
|
145 | - $modules_result[$mid]['image'] = $xoops->url($image); |
|
146 | - } else { |
|
147 | - $modules_result[$mid]['image'] = $xoops->url('images/icons/posticon2.gif'); |
|
205 | + $next_results = $plugin->search($queries, $andor, 1, $start + 20, $uid); |
|
206 | + $next_count = count($next_results); |
|
207 | + $has_next = false; |
|
208 | + if (is_array($next_results) && $next_count == 1) { |
|
209 | + $has_next = true; |
|
148 | 210 | } |
211 | + $xoops->tpl()->assign('sr_showing', sprintf(_MD_SEARCH_SHOWING, $start + 1, $start + $count)); |
|
149 | 212 | $res = array(); |
150 | 213 | for ($i = 0; $i < $count; ++$i) { |
214 | + if (isset($results[$i]['image']) && $results[$i]['image'] != "") { |
|
215 | + $res[$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']); |
|
216 | + } else { |
|
217 | + $res[$i]['image'] = $xoops->url('images/icons/posticon2.gif'); |
|
218 | + } |
|
151 | 219 | if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { |
152 | 220 | $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']); |
153 | 221 | } else { |
154 | 222 | $res[$i]['link'] = $results[$i]['link']; |
155 | 223 | } |
156 | 224 | $res[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']); |
157 | - $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title'])); |
|
225 | + if (isset($queries_pattern)) { |
|
226 | + $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title'])); |
|
227 | + } else { |
|
228 | + $res[$i]['title_highligh'] = $myts->htmlSpecialChars($results[$i]['title']); |
|
229 | + } |
|
158 | 230 | if (!empty($results[$i]['uid'])) { |
159 | - $res[$i]['uid'] = (int)($results[$i]['uid']); |
|
231 | + $res[$i]['uid'] = @(int)($results[$i]['uid']); |
|
160 | 232 | $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); |
161 | 233 | } |
162 | - $res[$i]['time'] = !empty($results[$i]['time']) ? XoopsLocale::formatTimestamp((int)($results[$i]['time'])) : ""; |
|
234 | + $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocale::formatTimestamp((int)($results[$i]['time'])) . ")" : ""; |
|
163 | 235 | $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); |
164 | 236 | } |
165 | - if ($count >= 5) { |
|
166 | - $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); |
|
167 | - $search_url .= "&mid={$mid}&action=showall&andor={$andor}"; |
|
168 | - $modules_result[$mid]['search_url'] = htmlspecialchars($search_url); |
|
237 | + if (count($res) > 0) { |
|
238 | + $modules_result[$mid]['result'] = $res; |
|
169 | 239 | } |
170 | - } |
|
171 | - if (count($res) > 0) { |
|
172 | - $modules_result[$mid]['result'] = $res; |
|
173 | - } |
|
174 | - } |
|
175 | - unset($results); |
|
176 | - unset($module); |
|
177 | - |
|
178 | - $xoops->tpl()->assign('modules', $modules_result); |
|
179 | - |
|
180 | - /* @var $formHandler SearchSearchForm */ |
|
181 | - $formHandler = $search->getForm(null, 'search'); |
|
182 | - $form = $formHandler->getSearchFrom($andor, $queries, $mids, $mid); |
|
183 | - $form->display(); |
|
184 | - break; |
|
185 | - |
|
186 | - case "showall": |
|
187 | - case 'showallbyuser': |
|
188 | - $xoops->header('module:search/search.tpl'); |
|
189 | - $xoops->tpl()->assign('search', true); |
|
190 | - $xoops->tpl()->assign('queries', $queries); |
|
191 | - $xoops->tpl()->assign('ignored_words', sprintf(_MD_SEARCH_IGNOREDWORDS, $search->getConfig('keyword_min'))); |
|
192 | - $xoops->tpl()->assign('ignored_queries', $ignored_queries); |
|
193 | - |
|
194 | - $module_handler = $xoops->getHandlerModule(); |
|
195 | - $module = $xoops->getModuleById($mid); |
|
196 | - /* @var $plugin SearchPluginInterface */ |
|
197 | - $plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'search'); |
|
198 | - $results = $plugin->search($queries, $andor, 20, $start, $uid); |
|
199 | 240 | |
200 | - $modules_result[$mid]['name'] = $module->getVar('name'); |
|
201 | - $modules_result[$mid]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'); |
|
202 | - |
|
203 | - $count = count($results); |
|
204 | - if (is_array($results) && $count > 0) { |
|
205 | - $next_results = $plugin->search($queries, $andor, 1, $start + 20, $uid); |
|
206 | - $next_count = count($next_results); |
|
207 | - $has_next = false; |
|
208 | - if (is_array($next_results) && $next_count == 1) { |
|
209 | - $has_next = true; |
|
210 | - } |
|
211 | - $xoops->tpl()->assign('sr_showing', sprintf(_MD_SEARCH_SHOWING, $start + 1, $start + $count)); |
|
212 | - $res = array(); |
|
213 | - for ($i = 0; $i < $count; ++$i) { |
|
214 | - if (isset($results[$i]['image']) && $results[$i]['image'] != "") { |
|
215 | - $res[$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']); |
|
216 | - } else { |
|
217 | - $res[$i]['image'] = $xoops->url('images/icons/posticon2.gif'); |
|
218 | - } |
|
219 | - if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { |
|
220 | - $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']); |
|
221 | - } else { |
|
222 | - $res[$i]['link'] = $results[$i]['link']; |
|
241 | + $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); |
|
242 | + $search_url .= "&mid={$mid}&action={$action}&andor={$andor}"; |
|
243 | + if ($action === 'showallbyuser') { |
|
244 | + $search_url .= "&uid={$uid}"; |
|
223 | 245 | } |
224 | - $res[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']); |
|
225 | - if (isset($queries_pattern)) { |
|
226 | - $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $myts->htmlSpecialChars($results[$i]['title'])); |
|
227 | - } else { |
|
228 | - $res[$i]['title_highligh'] = $myts->htmlSpecialChars($results[$i]['title']); |
|
246 | + if ($start > 0) { |
|
247 | + $prev = $start - 20; |
|
248 | + $search_url_prev = $search_url . "&start={$prev}"; |
|
249 | + $modules_result[$mid]['prev'] = htmlspecialchars($search_url_prev); |
|
229 | 250 | } |
230 | - if (!empty($results[$i]['uid'])) { |
|
231 | - $res[$i]['uid'] = @(int)($results[$i]['uid']); |
|
232 | - $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); |
|
251 | + if (false != $has_next) { |
|
252 | + $next = $start + 20; |
|
253 | + $search_url_next = $search_url . "&start={$next}"; |
|
254 | + $modules_result[$mid]['next'] = htmlspecialchars($search_url_next); |
|
233 | 255 | } |
234 | - $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocale::formatTimestamp((int)($results[$i]['time'])) . ")" : ""; |
|
235 | - $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); |
|
236 | - } |
|
237 | - if (count($res) > 0) { |
|
238 | - $modules_result[$mid]['result'] = $res; |
|
239 | - } |
|
240 | - |
|
241 | - $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); |
|
242 | - $search_url .= "&mid={$mid}&action={$action}&andor={$andor}"; |
|
243 | - if ($action === 'showallbyuser') { |
|
244 | - $search_url .= "&uid={$uid}"; |
|
245 | - } |
|
246 | - if ($start > 0) { |
|
247 | - $prev = $start - 20; |
|
248 | - $search_url_prev = $search_url . "&start={$prev}"; |
|
249 | - $modules_result[$mid]['prev'] = htmlspecialchars($search_url_prev); |
|
250 | - } |
|
251 | - if (false != $has_next) { |
|
252 | - $next = $start + 20; |
|
253 | - $search_url_next = $search_url . "&start={$next}"; |
|
254 | - $modules_result[$mid]['next'] = htmlspecialchars($search_url_next); |
|
256 | + $xoops->tpl()->assign('modules', $modules_result); |
|
255 | 257 | } |
256 | - $xoops->tpl()->assign('modules', $modules_result); |
|
257 | - } |
|
258 | 258 | |
259 | - /* @var $formHandler SearchSearchForm */ |
|
260 | - $formHandler = $search->getForm(null, 'search'); |
|
261 | - $form = $formHandler->getSearchFrom($andor, $queries, $mids, $mid); |
|
262 | - $form->display(); |
|
263 | - break; |
|
259 | + /* @var $formHandler SearchSearchForm */ |
|
260 | + $formHandler = $search->getForm(null, 'search'); |
|
261 | + $form = $formHandler->getSearchFrom($andor, $queries, $mids, $mid); |
|
262 | + $form->display(); |
|
263 | + break; |
|
264 | 264 | } |
265 | 265 | $xoops->footer(); |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @version $Id$ |
25 | 25 | */ |
26 | 26 | |
27 | -include dirname(dirname(__DIR__)) . '/mainfile.php'; |
|
27 | +include dirname(dirname(__DIR__)).'/mainfile.php'; |
|
28 | 28 | |
29 | 29 | $xoops = Xoops::getInstance(); |
30 | 30 | $search = $xoops->getModuleHelper('search'); |
31 | 31 | if (!$search->getConfig('enable_search')) { |
32 | - header('Location: ' . XOOPS_URL . '/index.php'); |
|
32 | + header('Location: '.XOOPS_URL.'/index.php'); |
|
33 | 33 | exit(); |
34 | 34 | } |
35 | 35 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $q = trim($q); |
92 | 92 | if (mb_strlen($q) >= $search->getConfig('keyword_min')) { |
93 | 93 | $queries[] = $q; |
94 | - $queries_pattern[] = '~(' . $q . ')~sUi'; |
|
94 | + $queries_pattern[] = '~('.$q.')~sUi'; |
|
95 | 95 | } else { |
96 | 96 | $ignored_queries[] = $q; |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $xoops->redirect('index.php', 2, sprintf(_MD_SEARCH_KEYTOOSHORT, $search->getConfig('keyword_min'))); |
106 | 106 | } |
107 | 107 | $queries = array($query); |
108 | - $queries_pattern[] = '~(' . $query . ')~sUi'; |
|
108 | + $queries_pattern[] = '~('.$query.')~sUi'; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | case "results": |
114 | 114 | $module_handler = $xoops->getHandlerModule(); |
115 | 115 | $criteria = new CriteriaCompo(); |
116 | - $criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN')); |
|
116 | + $criteria->add(new Criteria('dirname', "('".implode("','", array_keys($available_plugins))."')", 'IN')); |
|
117 | 117 | $modules = $module_handler->getObjectsArray($criteria, true); |
118 | 118 | if (empty($mids) || !is_array($mids)) { |
119 | 119 | unset($mids); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (is_array($results) && $count > 0) { |
142 | 142 | $nomatch = false; |
143 | 143 | $modules_result[$mid]['name'] = $module->getVar('name'); |
144 | - if (XoopsLoad::fileExists($image = $xoops->path('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'))) { |
|
144 | + if (XoopsLoad::fileExists($image = $xoops->path('modules/'.$module->getVar('dirname').'/icons/logo_large.png'))) { |
|
145 | 145 | $modules_result[$mid]['image'] = $xoops->url($image); |
146 | 146 | } else { |
147 | 147 | $modules_result[$mid]['image'] = $xoops->url('images/icons/posticon2.gif'); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $res = array(); |
150 | 150 | for ($i = 0; $i < $count; ++$i) { |
151 | 151 | if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { |
152 | - $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']); |
|
152 | + $res[$i]['link'] = $xoops->url('modules/'.$module->getVar('dirname').'/'.$results[$i]['link']); |
|
153 | 153 | } else { |
154 | 154 | $res[$i]['link'] = $results[$i]['link']; |
155 | 155 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); |
164 | 164 | } |
165 | 165 | if ($count >= 5) { |
166 | - $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); |
|
166 | + $search_url = $search->url('index.php?query='.urlencode(stripslashes(implode(' ', $queries)))); |
|
167 | 167 | $search_url .= "&mid={$mid}&action=showall&andor={$andor}"; |
168 | 168 | $modules_result[$mid]['search_url'] = htmlspecialchars($search_url); |
169 | 169 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $results = $plugin->search($queries, $andor, 20, $start, $uid); |
199 | 199 | |
200 | 200 | $modules_result[$mid]['name'] = $module->getVar('name'); |
201 | - $modules_result[$mid]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/icons/logo_large.png'); |
|
201 | + $modules_result[$mid]['image'] = $xoops->url('modules/'.$module->getVar('dirname').'/icons/logo_large.png'); |
|
202 | 202 | |
203 | 203 | $count = count($results); |
204 | 204 | if (is_array($results) && $count > 0) { |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | $res = array(); |
213 | 213 | for ($i = 0; $i < $count; ++$i) { |
214 | 214 | if (isset($results[$i]['image']) && $results[$i]['image'] != "") { |
215 | - $res[$i]['image'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['image']); |
|
215 | + $res[$i]['image'] = $xoops->url('modules/'.$module->getVar('dirname').'/'.$results[$i]['image']); |
|
216 | 216 | } else { |
217 | 217 | $res[$i]['image'] = $xoops->url('images/icons/posticon2.gif'); |
218 | 218 | } |
219 | 219 | if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) { |
220 | - $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']); |
|
220 | + $res[$i]['link'] = $xoops->url('modules/'.$module->getVar('dirname').'/'.$results[$i]['link']); |
|
221 | 221 | } else { |
222 | 222 | $res[$i]['link'] = $results[$i]['link']; |
223 | 223 | } |
@@ -231,26 +231,26 @@ discard block |
||
231 | 231 | $res[$i]['uid'] = @(int)($results[$i]['uid']); |
232 | 232 | $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); |
233 | 233 | } |
234 | - $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocale::formatTimestamp((int)($results[$i]['time'])) . ")" : ""; |
|
234 | + $res[$i]['time'] = !empty($results[$i]['time']) ? " (".XoopsLocale::formatTimestamp((int)($results[$i]['time'])).")" : ""; |
|
235 | 235 | $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace($queries_pattern, "<span class='searchHighlight'>$1</span>", $results[$i]['content']); |
236 | 236 | } |
237 | 237 | if (count($res) > 0) { |
238 | 238 | $modules_result[$mid]['result'] = $res; |
239 | 239 | } |
240 | 240 | |
241 | - $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); |
|
241 | + $search_url = $search->url('index.php?query='.urlencode(stripslashes(implode(' ', $queries)))); |
|
242 | 242 | $search_url .= "&mid={$mid}&action={$action}&andor={$andor}"; |
243 | 243 | if ($action === 'showallbyuser') { |
244 | 244 | $search_url .= "&uid={$uid}"; |
245 | 245 | } |
246 | 246 | if ($start > 0) { |
247 | 247 | $prev = $start - 20; |
248 | - $search_url_prev = $search_url . "&start={$prev}"; |
|
248 | + $search_url_prev = $search_url."&start={$prev}"; |
|
249 | 249 | $modules_result[$mid]['prev'] = htmlspecialchars($search_url_prev); |
250 | 250 | } |
251 | 251 | if (false != $has_next) { |
252 | 252 | $next = $start + 20; |
253 | - $search_url_next = $search_url . "&start={$next}"; |
|
253 | + $search_url_next = $search_url."&start={$next}"; |
|
254 | 254 | $modules_result[$mid]['next'] = htmlspecialchars($search_url_next); |
255 | 255 | } |
256 | 256 | $xoops->tpl()->assign('modules', $modules_result); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @author Richard Griffith <[email protected]> |
16 | 16 | */ |
17 | 17 | |
18 | -require __DIR__ . '/admin_header.php'; |
|
18 | +require __DIR__.'/admin_header.php'; |
|
19 | 19 | |
20 | 20 | $aboutAdmin = new \Xoops\Module\Admin(); |
21 | 21 |
@@ -15,22 +15,22 @@ |
||
15 | 15 | * @author Richard Griffith <[email protected]> |
16 | 16 | */ |
17 | 17 | |
18 | -$adminmenu=array(); |
|
18 | +$adminmenu = array(); |
|
19 | 19 | // Index |
20 | 20 | $adminmenu[] = array( |
21 | - 'title' => _MI_SCHEMATOOL_ADMIN_INDEX , |
|
22 | - 'link' => 'admin/index.php' , |
|
21 | + 'title' => _MI_SCHEMATOOL_ADMIN_INDEX, |
|
22 | + 'link' => 'admin/index.php', |
|
23 | 23 | 'icon' => 'home.png' |
24 | 24 | ); |
25 | 25 | // About |
26 | 26 | $adminmenu[] = array( |
27 | - 'title' => _MI_SCHEMATOOL_ADMIN_ABOUT , |
|
28 | - 'link' => 'admin/about.php' , |
|
27 | + 'title' => _MI_SCHEMATOOL_ADMIN_ABOUT, |
|
28 | + 'link' => 'admin/about.php', |
|
29 | 29 | 'icon' => 'about.png' |
30 | 30 | ); |
31 | 31 | // SchemaTool |
32 | 32 | $adminmenu[] = array( |
33 | - 'title' => _MI_SCHEMATOOL_ADMIN_TOOL , |
|
34 | - 'link' => 'admin/schematool.php' , |
|
33 | + 'title' => _MI_SCHEMATOOL_ADMIN_TOOL, |
|
34 | + 'link' => 'admin/schematool.php', |
|
35 | 35 | 'icon' => 'schematool.png' |
36 | 36 | ); |