These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * |
||
4 | * Module: WF-Links |
||
5 | * Version: v1.0.3 |
||
6 | * Release Date: 21 June 2005 |
||
7 | * Developer: John N |
||
8 | * Team: WF-Projects |
||
9 | * Licence: GNU |
||
10 | */ |
||
11 | |||
12 | require_once __DIR__ . '/header.php'; |
||
13 | |||
14 | global $xoopsTpl, $xoTheme; |
||
15 | |||
16 | $lid = (int)WflinksUtility::cleanRequestVars($_REQUEST, 'lid', 0); |
||
17 | $cid = (int)WflinksUtility::cleanRequestVars($_REQUEST, 'cid', 0); |
||
18 | |||
19 | $sql2 = 'SELECT count(*) FROM ' |
||
20 | . $xoopsDB->prefix('wflinks_links') |
||
21 | . ' a LEFT JOIN ' |
||
22 | . $xoopsDB->prefix('wflinks_altcat') |
||
23 | . ' b ' |
||
24 | . ' ON b.lid = a.lid' |
||
25 | . ' WHERE a.published > 0 AND a.published <= ' |
||
26 | . time() |
||
27 | . ' AND (a.expired = 0 OR a.expired > ' |
||
28 | . time() |
||
29 | . ') AND a.offline = 0' |
||
30 | . ' AND (b.cid=a.cid OR (a.cid=' |
||
31 | . $cid |
||
32 | . ' OR b.cid=' |
||
33 | . $cid |
||
34 | . '))'; |
||
35 | list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql2)); |
||
36 | |||
37 | View Code Duplication | if (0 == $count && false === WflinksUtility::checkGroups($cid = 0)) { |
|
38 | redirect_header('index.php', 1, _MD_WFL_MUSTREGFIRST); |
||
39 | } |
||
40 | |||
41 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid . ' |
||
42 | AND (published > 0 AND published <= ' . time() . ') |
||
43 | AND (expired = 0 OR expired > ' . time() . ') |
||
44 | AND offline = 0 |
||
45 | AND cid > 0'; |
||
46 | $result = $xoopsDB->query($sql); |
||
47 | $link_arr = $xoopsDB->fetchArray($result); |
||
48 | |||
49 | if (!is_array($link_arr)) { |
||
50 | redirect_header('index.php', 1, _MD_WFL_NOLINKLOAD); |
||
51 | } |
||
52 | |||
53 | $GLOBALS['xoopsOption']['template_main'] = 'wflinks_singlelink.tpl'; |
||
54 | |||
55 | include XOOPS_ROOT_PATH . '/header.php'; |
||
56 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/sbookmarks.php'; |
||
57 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/address.php'; |
||
58 | |||
59 | // tags support |
||
60 | if (WflinksUtility::isTagModuleIncluded()) { |
||
61 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/tagbar.php'; |
||
62 | $xoopsTpl->assign('tagbar', tagBar($link_arr['lid'], 0)); |
||
63 | } |
||
64 | |||
65 | //$link['imageheader'] = WflinksUtility::getImageHeader(); |
||
66 | $link['id'] = $link_arr['lid']; |
||
67 | $link['cid'] = $link_arr['cid']; |
||
68 | $link['description2'] = $wfmyts->displayTarea($link_arr['description'], 1, 1, 1, 1, 1); |
||
69 | $link['sbmarks'] = wflinks_sbmarks($link_arr['lid']); |
||
70 | |||
71 | // Address |
||
72 | $street1 = $link_arr['street1']; |
||
73 | $street2 = $link_arr['street2']; |
||
74 | $town = $link_arr['town']; |
||
75 | $state = $link_arr['state']; |
||
76 | $zip = $link_arr['zip']; |
||
77 | $tel = $link_arr['tel']; |
||
78 | $mobile = $link_arr['mobile']; |
||
79 | $voip = $link_arr['voip']; |
||
80 | $fax = $link_arr['fax']; |
||
81 | $email = $link_arr['email']; |
||
82 | $vat = $link_arr['vat']; |
||
83 | $country = WflinksUtility::getCountryName($link_arr['country']); |
||
84 | |||
85 | if ($street1 === '' || $town === '' || $xoopsModuleConfig['useaddress'] == 0) { |
||
86 | $link['addryn'] = 0; |
||
87 | } else { |
||
88 | $link['addryn'] = 1; |
||
89 | $link['address'] = '<br>' . wfl_address($street1, $street2, $town, $state, $zip, $country) . '<br>' . $country; |
||
90 | } |
||
91 | |||
92 | if ($xoopsModuleConfig['useaddress'] == 1) { |
||
93 | $link['addryn'] = 1; |
||
94 | |||
95 | View Code Duplication | if ($link_arr['tel'] === true) { |
|
96 | $link['tel'] = '<br>' . '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/telephone.png" title="' . _MD_WFL_TELEPHONE . '" alt="' . _MD_WFL_TELEPHONE . '" align="absmiddle"> ' . $tel; |
||
97 | } |
||
98 | |||
99 | View Code Duplication | if ($link_arr['mobile'] === true) { |
|
0 ignored issues
–
show
|
|||
100 | $link['mobile'] = '<br>' . '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/phone.png" title="' . _MD_WFL_MOBILE . '" alt="' . _MD_WFL_MOBILE . '" align="absmiddle"> ' . $mobile; |
||
101 | } |
||
102 | |||
103 | View Code Duplication | if ($link_arr['voip'] === true) { |
|
104 | $link['voip'] = '<br>' . '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/voip.png" title="' . _MD_WFL_VOIP . '" alt="' . _MD_WFL_VOIP . '" align="absmiddle"> ' . $voip; |
||
105 | } |
||
106 | |||
107 | View Code Duplication | if ($link_arr['fax'] === true) { |
|
108 | $link['fax'] = '<br>' . '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/fax.png" title="' . _MD_WFL_FAX . '" alt="' . _MD_WFL_FAX . '" align="absmiddle"> ' . $fax; |
||
109 | } |
||
110 | |||
111 | View Code Duplication | if ($link_arr['email'] === true) { |
|
112 | $link['email'] = '<br>' . '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/email.png" title="' . _MD_WFL_EMAIL . '" alt="' . _MD_WFL_EMAIL . '" align="absmiddle"> ' . $email; |
||
113 | } |
||
114 | |||
115 | if ($link_arr['vat'] === true) { |
||
116 | $link['vat'] = '<br>' . _MD_WFL_VAT . ': ' . $vat; |
||
117 | } |
||
118 | } |
||
119 | |||
120 | if ($link_arr['street1'] === true || $link_arr['tel'] === true || $link_arr['mobile'] === true || $link_arr['fax'] === true |
||
121 | || $link_arr['email'] === true) { |
||
122 | $xoopsTpl->assign('contactdetails', '<b>' . _MD_WFL_ADDRESS . '</b>'); |
||
123 | $xoopsTpl->assign('vcard', '<br>' . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/class/vcard.php?lid=' . $link_arr['lid'] . '"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/vcard.png" title="vCard" alt="vCard"></a>'); |
||
124 | } |
||
125 | |||
126 | // Maps |
||
127 | if ($xoopsModuleConfig['useaddress'] == 1) { |
||
128 | $googlemap = $link_arr['googlemap']; |
||
129 | $yahoomap = $link_arr['yahoomap']; |
||
130 | $mslivemap = $link_arr['multimap']; |
||
131 | |||
132 | View Code Duplication | if ($link_arr['googlemap'] === true) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
133 | $link['googlemap'] = '<a href="' . $googlemap . '" target="_blank"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/google_map.png" alt="' . _MD_WFL_GETMAP . '" title="' . _MD_WFL_GETMAP . '" align="absmiddle"></a> '; |
||
134 | } |
||
135 | |||
136 | View Code Duplication | if ($link_arr['yahoomap'] === true) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
137 | $link['yahoomap'] = '<a href="' . $yahoomap . '" target="_blank"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/yahoo_map.png" alt="' . _MD_WFL_GETMAP . '" title="' . _MD_WFL_GETMAP . '" align="absmiddle"></a> '; |
||
138 | } |
||
139 | |||
140 | View Code Duplication | if ($link_arr['multimap'] === true) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
141 | $link['multimap'] = '<a href="' . $multimap . '" target="_blank"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/multimap.png" alt="' . _MD_WFL_GETMAP . '" title="' . _MD_WFL_GETMAP . '" align="absmiddle"></a>'; |
||
142 | } |
||
143 | } |
||
144 | |||
145 | $mytree = new WflinksXoopsTree($xoopsDB->prefix('wflinks_cat'), 'cid', 'pid'); |
||
146 | $pathstring = "<a href='index.php'>" . _MD_WFL_MAIN . '</a> : '; |
||
147 | $pathstring .= $mytree->getNicePathFromId($link['cid'], 'title', 'viewcat.php?op='); |
||
148 | $link['path'] = $pathstring; |
||
149 | |||
150 | // Start of meta tags |
||
151 | $maxWords = 100; |
||
152 | $words = []; |
||
153 | $words = explode(' ', WflinksUtility::convertHtml2text($link_arr['description'])); |
||
154 | $newWords = []; |
||
155 | $i = 0; |
||
156 | |||
157 | View Code Duplication | while ($i < $maxWords - 1 && $i < count($words)) { |
|
158 | if (isset($words[$i])) { |
||
159 | $newWords[] = trim($words[$i]); |
||
160 | } |
||
161 | ++$i; |
||
162 | } |
||
163 | $link_meta_description = implode(' ', $newWords); |
||
164 | |||
165 | if (is_object($xoTheme)) { |
||
166 | $xoTheme->addMeta('meta', 'keywords', $link_arr['keywords']); |
||
167 | $xoTheme->addMeta('meta', 'title', $link_arr['title']); |
||
168 | $xoTheme->addMeta('meta', 'description', $link_meta_description); |
||
169 | } else { |
||
170 | $xoopsTpl->assign('xoops_meta_keywords', $link_arr['keywords']); |
||
171 | $xoopsTpl->assign('xoops_meta_description', $link_meta_description); |
||
172 | } |
||
173 | $xoopsTpl->assign('xoops_pagetitle', $link_arr['title']); |
||
174 | // End of meta tags |
||
175 | |||
176 | $moderate = 0; |
||
177 | $res_type = 1; |
||
178 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/linkloadinfo.php'; |
||
179 | |||
180 | $xoopsTpl->assign('show_screenshot', false); |
||
181 | if (isset($xoopsModuleConfig['screenshot']) && $xoopsModuleConfig['screenshot'] == 1) { |
||
182 | $xoopsTpl->assign('shots_dir', $xoopsModuleConfig['screenshots']); |
||
183 | $xoopsTpl->assign('shotwidth', $xoopsModuleConfig['shotwidth']); |
||
184 | $xoopsTpl->assign('shotheight', $xoopsModuleConfig['shotheight']); |
||
185 | $xoopsTpl->assign('show_screenshot', true); |
||
186 | } |
||
187 | |||
188 | // Show other author links |
||
189 | $sql = 'SELECT lid, cid, title, published FROM ' . $xoopsDB->prefix('wflinks_links') . ' |
||
190 | WHERE submitter=' . $link_arr['submitter'] . ' |
||
191 | AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() . ') |
||
192 | AND offline = 0 ORDER BY published DESC'; |
||
193 | $result = $xoopsDB->query($sql, 10, 0); |
||
194 | |||
195 | while ($arr = $xoopsDB->fetchArray($result)) { |
||
196 | $linkuid['title'] = $wfmyts->htmlSpecialCharsStrip($arr['title']); |
||
197 | $linkuid['lid'] = $arr['lid']; |
||
198 | $linkuid['cid'] = $arr['cid']; |
||
199 | $linkuid['published'] = formatTimestamp($arr['published'], $xoopsModuleConfig['dateformat']); |
||
200 | $xoopsTpl->append('link_uid', $linkuid); |
||
201 | } |
||
202 | |||
203 | // Copyright notice |
||
204 | if (isset($xoopsModuleConfig['copyright']) && $xoopsModuleConfig['copyright'] == 1) { |
||
205 | $xoopsTpl->assign('lang_copyright', '' . $link['title'] . ' © ' . _MD_WFL_COPYRIGHT . ' ' . formatTimestamp(time(), 'Y') . " - <a href='" . XOOPS_URL . "'>" . $xoopsConfig['sitename'] . '</a>'); |
||
206 | } |
||
207 | |||
208 | if (isset($xoopsModuleConfig['otherlinks']) && $xoopsModuleConfig['otherlinks'] == 1) { |
||
209 | $xoopsTpl->assign('other_links', '' . '<b>' . _MD_WFL_OTHERBYUID . '</b>' . $link['submitter'] . '<br>'); |
||
210 | } |
||
211 | |||
212 | $link['otherlinx'] = $xoopsModuleConfig['otherlinks']; |
||
213 | $link['showsbookmarx'] = $xoopsModuleConfig['showsbookmarks']; |
||
214 | $link['showpagerank'] = $xoopsModuleConfig['showpagerank']; |
||
215 | $xoopsTpl->assign('wfllink', $link); |
||
216 | |||
217 | $xoopsTpl->assign('back', '<a href="javascript:history.go(-1)"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/back.png"></a>'); // Displays Back button |
||
218 | |||
219 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
220 | |||
221 | include XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||
222 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
223 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.