mambax7 /
smartfaq
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | |||
| 3 | /** |
||
| 4 | * Module: SmartFAQ |
||
| 5 | * Author: The SmartFactory <www.smartfactory.ca> |
||
| 6 | * Licence: GNU |
||
| 7 | */ |
||
| 8 | |||
| 9 | include_once __DIR__ . '/admin_header.php'; |
||
| 10 | $myts = MyTextSanitizer::getInstance(); |
||
| 11 | |||
| 12 | $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : 0; |
||
| 13 | |||
| 14 | //$pick = isset($_GET['pick'])? (int)($_GET['pick']) : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
76% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 15 | //$pick = isset($_POST['pick'])? (int)($_POST['pick']) : $_GET['pick']; |
||
| 16 | |||
| 17 | $statussel = isset($_GET['statussel']) ? (int)$_GET['statussel'] : _SF_STATUS_ALL; |
||
| 18 | $statussel = isset($_POST['statussel']) ? (int)$_POST['statussel'] : $statussel; |
||
| 19 | |||
| 20 | $sortsel = isset($_GET['sortsel']) ? $_GET['sortsel'] : 'faqid'; |
||
| 21 | $sortsel = isset($_POST['sortsel']) ? $_POST['sortsel'] : $sortsel; |
||
| 22 | |||
| 23 | $ordersel = isset($_GET['ordersel']) ? $_GET['ordersel'] : 'DESC'; |
||
| 24 | $ordersel = isset($_POST['ordersel']) ? $_POST['ordersel'] : $ordersel; |
||
| 25 | |||
| 26 | $module_id = $xoopsModule->getVar('mid'); |
||
| 27 | $gpermHandler = xoops_getHandler('groupperm'); |
||
| 28 | $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 29 | |||
| 30 | function buildTable() |
||
| 31 | { |
||
| 32 | global $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
||
| 33 | echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
||
| 34 | echo '<tr>'; |
||
| 35 | echo "<th width='40' class='bg3' align='center'><b>" . _AM_SF_FAQID . '</b></td>'; |
||
| 36 | echo "<th width='20%' class='bg3' align='center'><b>" . _AM_SF_FAQCAT . '</b></td>'; |
||
| 37 | echo "<th class='bg3' align='center'><b>" . _AM_SF_QUESTION . '</b></td>'; |
||
| 38 | |||
| 39 | echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ASKED . '</b></td>'; |
||
| 40 | echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ANSWERED . '</b></td>'; |
||
| 41 | |||
| 42 | echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_CREATED . '</b></td>'; |
||
| 43 | echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_STATUS . '</b></td>'; |
||
| 44 | //echo "<td width='30' class='bg3' align='center'><b>" . _AM_SF_ANSWERS . "</b></td>"; |
||
| 45 | echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
||
| 46 | echo '</tr>'; |
||
| 47 | } |
||
| 48 | |||
| 49 | // Code for the page |
||
| 50 | include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
| 51 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 52 | |||
| 53 | // Creating the category handler object |
||
| 54 | $categoryHandler = sf_gethandler('category'); |
||
| 55 | |||
| 56 | // Creating the FAQ handler object |
||
| 57 | $faqHandler = sf_gethandler('faq'); |
||
| 58 | |||
| 59 | $startentry = isset($_GET['startentry']) ? (int)$_GET['startentry'] : 0; |
||
| 60 | |||
| 61 | $indexAdmin = new ModuleAdmin(); |
||
| 62 | xoops_cp_header(); |
||
| 63 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
||
| 64 | global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $faqid; |
||
| 65 | |||
| 66 | // Total FAQs -- includes everything on the table |
||
| 67 | $totalfaqs = $faqHandler->getFaqsCount(); |
||
| 68 | |||
| 69 | // Total categories |
||
| 70 | $totalcategories = $categoryHandler->getCategoriesCount(-1); |
||
| 71 | |||
| 72 | // Total FAQ count by status |
||
| 73 | $totalfaqbystatus = $faqHandler->getFaqsCountByStatus(); |
||
| 74 | |||
| 75 | // Total asked FAQs |
||
| 76 | $totalasked = isset($totalfaqbystatus[_SF_STATUS_ASKED]) ? $totalfaqbystatus[_SF_STATUS_ASKED] : 0; |
||
| 77 | |||
| 78 | // Total opened FAQs |
||
| 79 | $totalopened = isset($totalfaqbystatus[_SF_STATUS_OPENED]) ? $totalfaqbystatus[_SF_STATUS_OPENED] : 0; |
||
| 80 | |||
| 81 | // Total answered FAQs |
||
| 82 | $totalanswered = isset($totalfaqbystatus[_SF_STATUS_ANSWERED]) ? $totalfaqbystatus[_SF_STATUS_ANSWERED] : 0; |
||
| 83 | |||
| 84 | // Total submitted FAQs |
||
| 85 | $totalsubmitted = isset($totalfaqbystatus[_SF_STATUS_SUBMITTED]) ? $totalfaqbystatus[_SF_STATUS_SUBMITTED] : 0; |
||
| 86 | |||
| 87 | // Total published FAQs |
||
| 88 | $totalpublished = isset($totalfaqbystatus[_SF_STATUS_PUBLISHED]) ? $totalfaqbystatus[_SF_STATUS_PUBLISHED] : 0; |
||
| 89 | |||
| 90 | // Total offline FAQs |
||
| 91 | $totaloffline = isset($totalfaqbystatus[_SF_STATUS_OFFLINE]) ? $totalfaqbystatus[_SF_STATUS_OFFLINE] : 0; |
||
| 92 | |||
| 93 | // Total rejected question |
||
| 94 | $totalrejectedquestion = isset($totalfaqbystatus[_SF_STATUS_REJECTED_QUESTION]) ? $totalfaqbystatus[_SF_STATUS_REJECTED_QUESTION] : 0; |
||
| 95 | |||
| 96 | // Total rejected smartfaq |
||
| 97 | $totalrejectedsmartfaq = isset($totalfaqbystatus[_SF_STATUS_REJECTED_SMARTFAQ]) ? $totalfaqbystatus[_SF_STATUS_REJECTED_SMARTFAQ] : 0; |
||
| 98 | |||
| 99 | // Total Q&A with new answers |
||
| 100 | $totalnewanswers = isset($totalfaqbystatus[_SF_STATUS_NEW_ANSWER]) ? $totalfaqbystatus[_SF_STATUS_NEW_ANSWER] : 0; |
||
| 101 | |||
| 102 | // -- // |
||
| 103 | //sf_collapsableBar('toptable', 'toptableicon'); |
||
| 104 | //echo "<img onclick='toggle('toptable'); toggleIcon('toptableicon');' id='toptableicon' name='toptableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . _AM_SF_INVENTORY . "</h3>"; |
||
| 105 | //echo "<div id='toptable'>"; |
||
| 106 | //echo "<br />"; |
||
| 107 | //echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>"; |
||
| 108 | //echo "<td class='head'>" . _AM_SF_TOTALCAT . "</td><td align='center' class='even'>" . $totalcategories . "</td>"; |
||
| 109 | //echo "<td class='head'>" . _AM_SF_TOTALASKED . "</td><td align='center' class='even'>" . $totalasked . "</td>"; |
||
| 110 | //echo "<td class='head'>" . _AM_SF_TOTALOPENED . "</td><td align='center' class='even'>" . $totalopened . "</td>"; |
||
| 111 | //echo "<td class='head'>" . _AM_SF_TOTALSUBMITTED . "</td><td align='center' class='even'>" . $totalsubmitted . "</td>"; |
||
| 112 | //echo "<td class='head'>" . _AM_SF_TOTALPUBLISHED . "</td><td align='center' class='even'>" . $totalpublished . "</td>"; |
||
| 113 | //echo "<td class='head'>" . _AM_SF_TOTALNEWANSWERS . "</td><td align='center' class='even'>" . $totalnewanswers . "</td>"; |
||
| 114 | //echo "</tr></table>"; |
||
| 115 | //echo "<br />"; |
||
| 116 | |||
| 117 | //$indexAdmin = new ModuleAdmin(); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 118 | $indexAdmin->addItemButton(_AM_SF_CATEGORY_CREATE, 'category.php?op=mod', 'add', ''); |
||
| 119 | $indexAdmin->addItemButton(_AM_SF_CREATEART, 'faq.php?op=mod', 'add', ''); |
||
| 120 | $indexAdmin->addItemButton(_AM_SF_CREATEQUESTION, 'question.php?op=mod', 'add', ''); |
||
| 121 | echo $indexAdmin->renderButton('left', ''); |
||
| 122 | |||
| 123 | //echo "<form><div style=\"margin-bottom: 24px;\">"; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
39% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 124 | //echo "<input type='button' name='button' onclick=\"location='category.php?op=mod'\" value='" . _AM_SF_CATEGORY_CREATE . "'> "; |
||
| 125 | //echo "<input type='button' name='button' onclick=\"location='faq.php?op=mod'\" value='" . _AM_SF_CREATEART . "'> "; |
||
| 126 | //echo "<input type='button' name='button' onclick=\"location='question.php?op=mod'\" value='" . _AM_SF_CREATEQUESTION . "'> "; |
||
| 127 | //echo "</div></form>"; |
||
| 128 | //echo "</div>"; |
||
| 129 | |||
| 130 | // Construction of lower table |
||
| 131 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
||
| 132 | echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . _AM_SF_ALLFAQS . '</h3>'; |
||
| 133 | echo "<div id='bottomtable'>"; |
||
| 134 | echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">" . _AM_SF_ALLFAQSMSG . '</span>'; |
||
| 135 | |||
| 136 | $showingtxt = ''; |
||
| 137 | $selectedtxt = ''; |
||
| 138 | $cond = ''; |
||
| 139 | $selectedtxt0 = ''; |
||
| 140 | $selectedtxt1 = ''; |
||
| 141 | $selectedtxt2 = ''; |
||
| 142 | $selectedtxt3 = ''; |
||
| 143 | $selectedtxt4 = ''; |
||
| 144 | $selectedtxt5 = ''; |
||
| 145 | $selectedtxt6 = ''; |
||
| 146 | $selectedtxt7 = ''; |
||
| 147 | $selectedtxt8 = ''; |
||
| 148 | $selectedtxt9 = ''; |
||
| 149 | $selectedtxt10 = ''; |
||
| 150 | |||
| 151 | $sorttxtquestion = ''; |
||
| 152 | $sorttxtcategory = ''; |
||
| 153 | $sorttxtcreated = ''; |
||
| 154 | $sorttxtweight = ''; |
||
| 155 | $sorttxtfaqid = ''; |
||
| 156 | |||
| 157 | $ordertxtasc = ''; |
||
| 158 | $ordertxtdesc = ''; |
||
| 159 | |||
| 160 | switch ($sortsel) { |
||
| 161 | case 'faq.question': |
||
| 162 | $sorttxtquestion = "selected='selected'"; |
||
| 163 | break; |
||
| 164 | |||
| 165 | case 'category.name': |
||
| 166 | $sorttxtcategory = "selected='selected'"; |
||
| 167 | break; |
||
| 168 | |||
| 169 | case 'faq.datesub': |
||
| 170 | $sorttxtcreated = "selected='selected'"; |
||
| 171 | break; |
||
| 172 | |||
| 173 | case 'faq.weight': |
||
| 174 | $sorttxtweight = "selected='selected'"; |
||
| 175 | break; |
||
| 176 | |||
| 177 | default: |
||
| 178 | $sorttxtfaqid = "selected='selected'"; |
||
| 179 | break; |
||
| 180 | } |
||
| 181 | |||
| 182 | switch ($ordersel) { |
||
| 183 | case 'ASC': |
||
| 184 | $ordertxtasc = "selected='selected'"; |
||
| 185 | break; |
||
| 186 | |||
| 187 | default: |
||
| 188 | $ordertxtdesc = "selected='selected'"; |
||
| 189 | break; |
||
| 190 | } |
||
| 191 | |||
| 192 | switch ($statussel) { |
||
| 193 | case _SF_STATUS_ALL: |
||
| 194 | $selectedtxt0 = "selected='selected'"; |
||
| 195 | $caption = _AM_SF_ALL; |
||
| 196 | $cond = ''; |
||
| 197 | $status_explaination = _AM_SF_ALL_EXP; |
||
| 198 | break; |
||
| 199 | |||
| 200 | case _SF_STATUS_ASKED: |
||
| 201 | $selectedtxt1 = "selected='selected'"; |
||
| 202 | $caption = _AM_SF_ASKED; |
||
| 203 | $cond = ' WHERE status = ' . _SF_STATUS_ASKED . ' '; |
||
| 204 | $status_explaination = _AM_SF_ASKED_EXP; |
||
| 205 | break; |
||
| 206 | |||
| 207 | case _SF_STATUS_OPENED: |
||
| 208 | $selectedtxt2 = "selected='selected'"; |
||
| 209 | $caption = _AM_SF_OPENED; |
||
| 210 | $cond = ' WHERE status = ' . _SF_STATUS_OPENED . ' '; |
||
| 211 | $status_explaination = _AM_SF_OPENED_EXP; |
||
| 212 | break; |
||
| 213 | |||
| 214 | case _SF_STATUS_ANSWERED: |
||
| 215 | $selectedtxt3 = "selected='selected'"; |
||
| 216 | $caption = _AM_SF_ANSWERED; |
||
| 217 | $cond = ' WHERE status = ' . _SF_STATUS_ANSWERED . ' '; |
||
| 218 | $status_explaination = _AM_SF_ANSWERED_EXP; |
||
| 219 | break; |
||
| 220 | |||
| 221 | case _SF_STATUS_SUBMITTED: |
||
| 222 | $selectedtxt4 = "selected='selected'"; |
||
| 223 | $caption = _AM_SF_SUBMITTED; |
||
| 224 | $cond = ' WHERE status = ' . _SF_STATUS_SUBMITTED . ' '; |
||
| 225 | $status_explaination = _AM_SF_SUBMITTED_EXP; |
||
| 226 | break; |
||
| 227 | |||
| 228 | case _SF_STATUS_PUBLISHED: |
||
| 229 | $selectedtxt5 = "selected='selected'"; |
||
| 230 | $caption = _AM_SF_PUBLISHED; |
||
| 231 | $cond = ' WHERE status = ' . _SF_STATUS_PUBLISHED . ' '; |
||
| 232 | $status_explaination = _AM_SF_PUBLISHED_EXP; |
||
| 233 | break; |
||
| 234 | |||
| 235 | case _SF_STATUS_NEW_ANSWER: |
||
| 236 | $selectedtxt6 = "selected='selected'"; |
||
| 237 | $caption = _AM_SF_NEW_ANSWER; |
||
| 238 | $cond = ' WHERE status = ' . _SF_STATUS_NEW_ANSWER . ' '; |
||
| 239 | $status_explaination = _AM_SF_NEW_ANSWER_EXP; |
||
| 240 | break; |
||
| 241 | |||
| 242 | case _SF_STATUS_OFFLINE: |
||
| 243 | $selectedtxt7 = "selected='selected'"; |
||
| 244 | $caption = _AM_SF_OFFLINE; |
||
| 245 | $cond = ' WHERE status = ' . _SF_STATUS_OFFLINE . ' '; |
||
| 246 | $status_explaination = _AM_SF_OFFLINE_EXP; |
||
| 247 | break; |
||
| 248 | |||
| 249 | case _SF_STATUS_REJECTED_QUESTION: |
||
| 250 | $selectedtxt8 = "selected='selected'"; |
||
| 251 | $caption = _AM_SF_REJECTED_QUESTION; |
||
| 252 | $cond = ' WHERE status = ' . _SF_STATUS_REJECTED_QUESTION . ' '; |
||
| 253 | $status_explaination = _AM_SF_REJECTED_QUESTION_EXP; |
||
| 254 | break; |
||
| 255 | |||
| 256 | case _SF_STATUS_REJECTED_SMARTFAQ: |
||
| 257 | $selectedtxt9 = "selected='selected'"; |
||
| 258 | $caption = _AM_SF_REJECTED_SMARTFAQ; |
||
| 259 | $cond = ' WHERE status = ' . _SF_STATUS_REJECTED_SMARTFAQ . ' '; |
||
| 260 | $status_explaination = _AM_SF_REJECTED_SMARTFAQ_EXP; |
||
| 261 | break; |
||
| 262 | } |
||
| 263 | |||
| 264 | /* -- Code to show selected terms -- */ |
||
| 265 | echo "<form name='pick' id='pick' action='" . $_SERVER['PHP_SELF'] . "' method='POST' style='margin: 0;'>"; |
||
| 266 | |||
| 267 | echo " |
||
| 268 | <table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'> |
||
| 269 | <tr> |
||
| 270 | <td><span style='font-weight: bold; font-size: 12px; font-variant: small-caps;'>" . _AM_SF_SHOWING . ' ' . $caption . "</span></td> |
||
| 271 | <td align='right'>" . _AM_SF_SELECT_SORT . " |
||
| 272 | <select name='sortsel' onchange='submit()'> |
||
| 273 | <option value='faq.faqid' $sorttxtfaqid>" . _AM_SF_ID . "</option> |
||
| 274 | <option value='category.name' $sorttxtcategory>" . _AM_SF_CATEGORY . "</option> |
||
| 275 | <option value='faq.question' $sorttxtquestion>" . _AM_SF_QUESTION . "</option> |
||
| 276 | <option value='faq.datesub' $sorttxtcreated>" . _AM_SF_CREATED . "</option> |
||
| 277 | <option value='faq.weight' $sorttxtweight>" . _AM_SF_WEIGHT . "</option> |
||
| 278 | </select> |
||
| 279 | <select name='ordersel' onchange='submit()'> |
||
| 280 | <option value='ASC' $ordertxtasc>" . _AM_SF_ASC . "</option> |
||
| 281 | <option value='DESC' $ordertxtdesc>" . _AM_SF_DESC . '</option> |
||
| 282 | </select> |
||
| 283 | ' . _AM_SF_SELECT_STATUS . " : |
||
| 284 | <select name='statussel' onchange='submit()'> |
||
| 285 | <option value='0' $selectedtxt0>" . _AM_SF_ALL . " [$totalfaqs]</option> |
||
| 286 | <option value='1' $selectedtxt1>" . _AM_SF_ASKED . " [$totalasked]</option> |
||
| 287 | <option value='2' $selectedtxt2>" . _AM_SF_OPENED . " [$totalopened]</option> |
||
| 288 | <option value='3' $selectedtxt3>" . _AM_SF_ANSWERED . " [$totalanswered]</option> |
||
| 289 | <option value='4' $selectedtxt4>" . _AM_SF_SUBMITTED . " [$totalsubmitted]</option> |
||
| 290 | <option value='5' $selectedtxt5>" . _AM_SF_PUBLISHED . " [$totalpublished]</option> |
||
| 291 | <option value='6' $selectedtxt6>" . _AM_SF_NEWANSWER . " [$totalnewanswers]</option> |
||
| 292 | <option value='7' $selectedtxt7>" . _AM_SF_OFFLINE . " [$totaloffline]</option> |
||
| 293 | <option value='8' $selectedtxt8>" . _AM_SF_REJECTED_QUESTION . " [$totalrejectedquestion]</option> |
||
| 294 | <option value='9' $selectedtxt9>" . _AM_SF_REJECTED_SMARTFAQ . " [$totalrejectedsmartfaq]</option> |
||
| 295 | </select> |
||
| 296 | </td> |
||
| 297 | </tr> |
||
| 298 | </table> |
||
| 299 | </form>"; |
||
| 300 | |||
| 301 | // Get number of entries in the selected state |
||
| 302 | $numrows = ($statussel == 0) ? $totalfaqs : $totalfaqbystatus[$statussel]; |
||
| 303 | $statusSelected = ($statussel == 0) ? _SF_STATUS_ALL : $statussel; |
||
| 304 | |||
| 305 | // creating the Q&As objects |
||
| 306 | $faqsObj = $faqHandler->getFaqsAdminSide($xoopsModuleConfig['perpage'], $startentry, $statusSelected, -1, $sortsel, $ordersel); |
||
| 307 | |||
| 308 | // fetching all categories |
||
| 309 | $allcats = $categoryHandler->getObjects(null, true); |
||
| 310 | $totalItemsOnPage = count($faqsObj); |
||
| 311 | buildTable(); |
||
| 312 | |||
| 313 | if ($numrows > 0) { |
||
| 314 | |||
| 315 | //$answer_criteria = new Criteria('faqid', "(".implode(',', array_keys($faqsObj)).")", 'IN'); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
60% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 316 | //$answer_criteria->setGroupby("faqid"); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
86% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 317 | //$answerHandler = sf_gethandler('answer'); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
56% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 318 | //$answer_arr = $answerHandler->getCountByFAQ($answer_criteria); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 319 | |||
| 320 | foreach (array_keys($faqsObj) as $i) { |
||
| 321 | // Creating the category object to which this faq is linked |
||
| 322 | $categoryObj =& $allcats[$faqsObj[$i]->categoryid()]; |
||
| 323 | global $pathIcon16, $smartModuleConfig; |
||
| 324 | |||
| 325 | //$answers = $answer_arr[$i]; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 326 | |||
| 327 | $approve = ''; |
||
| 328 | |||
| 329 | switch ($faqsObj[$i]->status()) { |
||
| 330 | View Code Duplication | case _SF_STATUS_ASKED: |
|
| 331 | $statustxt = _AM_SF_ASKED; |
||
| 332 | $approve = "<a href='question.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/on.png' . "' title='" . _AM_SF_QUESTION_MODERATE . "' alt='" . _AM_SF_QUESTION_MODERATE . "' /></a> "; |
||
| 333 | $modify = ''; |
||
| 334 | $delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "' /></a>"; |
||
| 335 | break; |
||
| 336 | |||
| 337 | View Code Duplication | case _SF_STATUS_OPENED: |
|
| 338 | $statustxt = _AM_SF_OPENED; |
||
| 339 | $approve = ''; |
||
| 340 | $modify = "<a href='question.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_QUESTION_EDIT . "' alt='" . _AM_SF_QUESTION_EDIT . "' /></a> "; |
||
| 341 | $delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "' /></a>"; |
||
| 342 | break; |
||
| 343 | |||
| 344 | View Code Duplication | case _SF_STATUS_ANSWERED: |
|
| 345 | $statustxt = _AM_SF_ANSWERED; |
||
| 346 | $approve = "<a href='answer.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/approve.gif' title='" . _AM_SF_ANSWERED_MODERATE . "' alt='" . _AM_SF_ANSWERED_MODERATE . "' /></a> "; |
||
| 347 | $modify = ''; |
||
| 348 | $delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/delete.gif' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "' /></a>"; |
||
| 349 | break; |
||
| 350 | |||
| 351 | View Code Duplication | case _SF_STATUS_SUBMITTED: |
|
| 352 | $statustxt = _AM_SF_SUBMITTED; |
||
| 353 | $approve = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/approve.gif' title='" . _AM_SF_SUBMISSION_MODERATE . "' alt='" . _AM_SF_SUBMISSION_MODERATE . "' /></a> "; |
||
| 354 | $delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/delete.gif' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "' /></a>"; |
||
| 355 | $modify = ''; |
||
| 356 | break; |
||
| 357 | |||
| 358 | View Code Duplication | case _SF_STATUS_PUBLISHED: |
|
| 359 | $statustxt = _AM_SF_PUBLISHED; |
||
| 360 | $approve = ''; |
||
| 361 | $modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_FAQ_EDIT . "' alt='" . _AM_SF_FAQ_EDIT . "' /></a> "; |
||
| 362 | $delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "' /></a>"; |
||
| 363 | break; |
||
| 364 | |||
| 365 | View Code Duplication | case _SF_STATUS_NEW_ANSWER: |
|
| 366 | $statustxt = _AM_SF_NEWANSWER; |
||
| 367 | $approve = "<a href='answer.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/approve.gif' title='" . _AM_SF_FAQ_EDIT . "' alt='" . _AM_SF_FAQ_EDIT . "' /></a> "; |
||
| 368 | $delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/delete.gif' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "' /></a>"; |
||
| 369 | $modify = ''; |
||
| 370 | break; |
||
| 371 | |||
| 372 | View Code Duplication | case _SF_STATUS_OFFLINE: |
|
| 373 | $statustxt = _AM_SF_OFFLINE; |
||
| 374 | $approve = ''; |
||
| 375 | $modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_FAQ_EDIT . "' alt='" . _AM_SF_FAQ_EDIT . "' /></a> "; |
||
| 376 | $delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "' /></a>"; |
||
| 377 | break; |
||
| 378 | |||
| 379 | View Code Duplication | case _SF_STATUS_REJECTED_QUESTION: |
|
| 380 | $statustxt = _AM_SF_REJECTED_QUESTION; |
||
| 381 | $approve = ''; |
||
| 382 | $modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_REJECTED_EDIT . "' alt='" . _AM_SF_REJECTED_EDIT . "' /></a> "; |
||
| 383 | $delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "' /></a>"; |
||
| 384 | break; |
||
| 385 | |||
| 386 | View Code Duplication | case _SF_STATUS_REJECTED_SMARTFAQ: |
|
| 387 | $statustxt = _AM_SF_REJECTED_SMARTFAQ; |
||
| 388 | $approve = ''; |
||
| 389 | $modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_REJECTED_EDIT . "' alt='" . _AM_SF_REJECTED_EDIT . "' /></a> "; |
||
| 390 | $delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "' /></a>"; |
||
| 391 | break; |
||
| 392 | |||
| 393 | case 'default': |
||
| 394 | default: |
||
| 395 | $statustxt = _AM_SF_STATUS0; |
||
| 396 | $approve = ''; |
||
| 397 | $modify = ''; |
||
| 398 | break; |
||
| 399 | } |
||
| 400 | |||
| 401 | //$modify = "<a href='faq.php?op=mod&faqid=" . $faqid . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/assets/images/icon/edit.gif' alt='" . _AM_SF_EDITART . "' /></a> "; |
||
| 402 | |||
| 403 | echo '<tr>'; |
||
| 404 | echo "<td class='head' align='center'>" . $faqsObj[$i]->faqid() . '</td>'; |
||
| 405 | echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
||
| 406 | echo "<td class='even' align='left'>" . $faqsObj[$i]->question(100) . '</td>'; |
||
| 407 | |||
| 408 | //mb--------------------------------------- |
||
| 409 | //adding name of the Question Submitter |
||
| 410 | $requester = sf_getLinkedUnameFromId($faqsObj[$i]->uid(), $smartModuleConfig['userealname']); |
||
| 411 | echo "<td class='even' align='center'>" . $requester . '</td>'; |
||
| 412 | |||
| 413 | //adding name of the Answer Submitter |
||
| 414 | |||
| 415 | $answerHandler = sf_gethandler('answer'); |
||
| 416 | |||
| 417 | $criteria = new CriteriaCompo(); |
||
| 418 | $criteria->add(new Criteria('faqid', $faqsObj[$i]->faqid())); |
||
| 419 | $criteria->add(new Criteria('status', true)); |
||
| 420 | |||
| 421 | $answerObjects = $answerHandler->getObjects($criteria, true); |
||
| 422 | |||
| 423 | foreach (array_keys($answerObjects) as $j) { |
||
| 424 | $answerObj = $answerObjects[$j]; |
||
| 425 | } |
||
| 426 | |||
| 427 | View Code Duplication | if (isset($answerObj->vars['uid']['value'])) { |
|
| 428 | $answerSubmitterID = $answerObj->vars['uid']['value']; |
||
| 429 | |||
| 430 | $answerSubmitter = sf_getLinkedUnameFromId($answerSubmitterID, $smartModuleConfig['userealname']); |
||
| 431 | } else { |
||
| 432 | $answerSubmitter = '--------'; |
||
| 433 | } |
||
| 434 | echo "<td class='even' align='center'>" . $answerSubmitter . '</td>'; |
||
| 435 | |||
| 436 | //mb--------------------------------------- |
||
| 437 | |||
| 438 | echo "<td class='even' align='center'>" . $faqsObj[$i]->datesub('s') . '</td>'; |
||
| 439 | echo "<td class='even' align='center'>" . $statustxt . '</td>'; |
||
| 440 | //echo "<td class='even' align='center'>" . $answers . "</td>"; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
42% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 441 | echo "<td class='even' align='center'> " . $approve . $modify . $delete . '</td>'; |
||
| 442 | echo '</tr>'; |
||
| 443 | } |
||
| 444 | } else { |
||
| 445 | // that is, $numrows = 0, there's no entries yet |
||
| 446 | echo '<tr>'; |
||
| 447 | echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOFAQSSEL . '</td>'; |
||
| 448 | echo '</tr>'; |
||
| 449 | } |
||
| 450 | echo "</table>\n"; |
||
| 451 | echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">$status_explaination</span>"; |
||
| 452 | $pagenav = new XoopsPageNav($numrows, $xoopsModuleConfig['perpage'], $startentry, 'startentry', "statussel=$statussel&sortsel=$sortsel&ordersel=$ordersel"); |
||
| 453 | |||
| 454 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
||
| 455 | echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderImageNav() . '</div>'; |
||
| 456 | } else { |
||
| 457 | echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderNav() . '</div>'; |
||
| 458 | } |
||
| 459 | // ENDs code to show active entries |
||
| 460 | echo '</div>'; |
||
| 461 | // Close the collapsable div |
||
| 462 | echo '</div>'; |
||
| 463 | echo '</div>'; |
||
| 464 | |||
| 465 | include_once __DIR__ . '/admin_footer.php'; |
||
| 466 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.