mambax7 /
pedigree
| 1 | <?php namespace XoopsModules\Pedigree; |
||
| 2 | |||
| 3 | /** |
||
| 4 | * pedigree HTML Input Interface Class Elements |
||
| 5 | * |
||
| 6 | * @copyright ZySpec Incorporated |
||
| 7 | * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
||
| 8 | * @package pedigree |
||
| 9 | * @subpackage class |
||
| 10 | * @author zyspec <[email protected]> |
||
| 11 | * @since 1.3.1 |
||
| 12 | */ |
||
| 13 | |||
| 14 | use XoopsModules\Pedigree; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Pedigree\HtmlInputAbstract |
||
| 20 | * |
||
| 21 | * @package \XoopsModules\Pedigree\Class |
||
| 22 | * @author zyspec <[email protected]> |
||
| 23 | * @copyright Copyright (c) 2014-2019 ZySpec Incorporated |
||
| 24 | * @access public |
||
| 25 | */ |
||
| 26 | |||
| 27 | |||
| 28 | /** |
||
| 29 | * Class Pedigree\HtmlInputAbstract |
||
| 30 | */ |
||
| 31 | abstract class HtmlInputAbstract //extends Pedigree\Field |
||
| 32 | { |
||
| 33 | /** |
||
| 34 | * @return mixed |
||
| 35 | */ |
||
| 36 | abstract public function editField(); |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param $name |
||
| 40 | * @return mixed |
||
| 41 | */ |
||
| 42 | abstract public function newField($name); |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | abstract public function viewField(); |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return mixed |
||
| 51 | */ |
||
| 52 | abstract public function showField(); |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | abstract public function showValue(); |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return mixed |
||
| 61 | */ |
||
| 62 | abstract public function searchField(); |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return mixed |
||
| 66 | */ |
||
| 67 | abstract public function getSearchString(); |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param string $message |
||
| 71 | * |
||
| 72 | * @return void |
||
| 73 | */ |
||
| 74 | public function echoMsg($message) |
||
| 75 | { |
||
| 76 | echo "<span style='color: red;'><h3>{$message}</h3></span>"; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @param $fieldnumber |
||
| 81 | * |
||
| 82 | * @return array |
||
| 83 | */ |
||
| 84 | public function lookupField($fieldnumber) |
||
| 85 | { |
||
| 86 | $ret = []; |
||
| 87 | |||
| 88 | /** @var \Xmf\Database\Tables $pTables */ |
||
| 89 | $pTables = new \Xmf\Database\Tables(); |
||
| 90 | $exists = $pTables->useTable('pedigree_lookup' . $fieldnumber); |
||
| 91 | if ($exists) { |
||
| 92 | $tableName = $pTables->name('pedigree_lookup' . $fieldnumber); |
||
| 93 | $SQL = "SELECT * FROM `{$tableName}` ORDER BY 'order'"; |
||
| 94 | //$SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_lookup' . $fieldnumber) . " ORDER BY 'order'"; |
||
|
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...
|
|||
| 95 | $result = $GLOBALS['xoopsDB']->query($SQL); |
||
| 96 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
| 97 | $ret[] = ['id' => $row['id'], 'value' => $row['value']]; |
||
| 98 | } |
||
| 99 | } |
||
| 100 | |||
| 101 | //array_multisort($ret,SORT_ASC); |
||
| 102 | return $ret; |
||
| 103 | } |
||
| 104 | } |
||
| 105 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: