mambax7 /
tdmcreate-1.91
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php namespace XoopsModules\Tdmcreate\Files\User; |
||
| 2 | |||
| 3 | use XoopsModules\Tdmcreate; |
||
| 4 | |||
| 5 | /* |
||
| 6 | You may not change or alter any portion of this comment or credits |
||
| 7 | of supporting developers from this source code or any supporting source code |
||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, |
||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | /** |
||
| 15 | * tdmcreate module. |
||
| 16 | * |
||
| 17 | * @copyright XOOPS Project (https://xoops.org) |
||
| 18 | * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
| 19 | * |
||
| 20 | * @since 2.5.0 |
||
| 21 | * |
||
| 22 | * @author Txmod Xoops http://www.txmodxoops.org |
||
| 23 | * |
||
| 24 | * @version $Id: UserXoopsCode.php 12258 2014-01-02 09:33:29Z timgno $ |
||
| 25 | */ |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Class UserXoopsCode. |
||
| 29 | */ |
||
| 30 | class UserXoopsCode |
||
| 31 | { |
||
| 32 | /* |
||
| 33 | * @static function getInstance |
||
| 34 | * @param null |
||
| 35 | */ |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return UserXoopsCode |
||
| 39 | */ |
||
| 40 | public static function getInstance() |
||
| 41 | { |
||
| 42 | static $instance = false; |
||
| 43 | if (!$instance) { |
||
| 44 | $instance = new self(); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $instance; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @public function getUserTplMain |
||
| 52 | * |
||
| 53 | * @param $moduleDirname |
||
| 54 | * @param string $tableName |
||
| 55 | * |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | public function getUserTplMain($moduleDirname, $tableName = 'index') |
||
| 59 | { |
||
| 60 | return "\$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl';\n"; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @public function getUserAddMeta |
||
| 65 | * |
||
| 66 | * @param string $type |
||
| 67 | * @param $language |
||
| 68 | * @param $tableName |
||
| 69 | * |
||
| 70 | * @param string $t |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function getUserAddMeta($type, $language, $tableName, $t = '') |
||
| 74 | { |
||
| 75 | $pCodeAddMeta = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 76 | $stuTableName = mb_strtoupper($tableName); |
||
| 77 | $stripTags = $pCodeAddMeta->getPhpCodeStripTags('', $language . $stuTableName, true); |
||
| 78 | |||
| 79 | return "{$t}\$GLOBALS['xoTheme']->addMeta( 'meta', '{$type}', {$stripTags});\n"; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @public function getUserMetaKeywords |
||
| 84 | * |
||
| 85 | * @param $moduleDirname |
||
| 86 | * |
||
| 87 | * @return string |
||
| 88 | */ |
||
| 89 | public function getUserMetaKeywords($moduleDirname) |
||
| 90 | { |
||
| 91 | $pCodeMetaKeywords = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 92 | $implode = $pCodeMetaKeywords->getPhpCodeImplode(',', '$keywords'); |
||
| 93 | |||
| 94 | return "{$moduleDirname}MetaKeywords(\${$moduleDirname}->getConfig('keywords').', '. {$implode});\n"; |
||
| 95 | } |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @public function getUserMetaDesc |
||
| 99 | * |
||
| 100 | * @param $moduleDirname |
||
| 101 | * @param $language |
||
| 102 | * @param string $file |
||
| 103 | * |
||
| 104 | * @return string |
||
| 105 | */ |
||
| 106 | public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') |
||
| 107 | { |
||
| 108 | return "{$moduleDirname}MetaDescription({$language}{$file}_DESC);\n"; |
||
| 109 | } |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @public function getUserBreadcrumbs |
||
| 113 | * |
||
| 114 | * @param $language |
||
| 115 | * @param string $tableName |
||
| 116 | * @param string $t |
||
| 117 | * |
||
| 118 | * @return string |
||
| 119 | */ |
||
| 120 | public function getUserBreadcrumbs($language, $tableName = 'index', $t = '') |
||
| 121 | { |
||
| 122 | $stuTableName = mb_strtoupper($tableName); |
||
| 123 | $title = ["'title'" => "{$language}{$stuTableName}"]; |
||
| 124 | $pCodeBreadcrumbs = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 125 | |||
| 126 | return $pCodeBreadcrumbs->getPhpCodeArray('xoBreadcrumbs[]', $title, false, $t); |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * @public function getUserBreadcrumbs |
||
| 131 | * |
||
| 132 | * @param $moduleDirname |
||
| 133 | * |
||
| 134 | * @param $language |
||
| 135 | * @return string |
||
| 136 | */ |
||
| 137 | public function getUserBreadcrumbsHeaderFile($moduleDirname, $language) |
||
| 138 | { |
||
| 139 | $pCodeHeaderFile = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 140 | $xCodeHeaderFile = Tdmcreate\Files\CreateXoopsCode::getInstance(); |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 141 | $stuModuleDirname = mb_strtoupper($moduleDirname); |
||
| 142 | $ret = $pCodeHeaderFile->getPhpCodeCommentLine('Breadcrumbs'); |
||
| 143 | $ret .= $pCodeHeaderFile->getPhpCodeArray('xoBreadcrumbs', null, false, ''); |
||
| 144 | $titleLink = ["'title'" => $language . 'TITLE', "'link'" => "{$stuModuleDirname}_URL . '/'"]; |
||
| 145 | $ret .= $pCodeHeaderFile->getPhpCodeArray('xoBreadcrumbs[]', $titleLink, false, ''); |
||
| 146 | |||
| 147 | return $ret; |
||
| 148 | } |
||
| 149 | |||
| 150 | /** |
||
| 151 | * @public function getUserBreadcrumbs |
||
| 152 | * |
||
| 153 | * @return string |
||
| 154 | */ |
||
| 155 | public function getUserBreadcrumbsFooterFile() |
||
| 156 | { |
||
| 157 | $pCodeFooterFile = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 158 | $xCodeFooterFile = Tdmcreate\Files\CreateXoopsCode::getInstance(); |
||
| 159 | $cond = $xCodeFooterFile->getXcTplAssign('xoBreadcrumbs', '$xoBreadcrumbs'); |
||
| 160 | $ret = $pCodeFooterFile->getPhpCodeConditions('count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); |
||
| 161 | |||
| 162 | return $ret; |
||
| 163 | } |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @public function getUserModVersion |
||
| 167 | * |
||
| 168 | * @param int $eleArray |
||
| 169 | * @param $descriptions |
||
| 170 | * @param null $name |
||
|
0 ignored issues
–
show
|
|||
| 171 | * @param null $index |
||
|
0 ignored issues
–
show
|
|||
| 172 | * @param bool $num |
||
| 173 | * @param string $t |
||
| 174 | * |
||
| 175 | * @return string |
||
| 176 | */ |
||
| 177 | public function getUserModVersion($eleArray, $descriptions, $name = null, $index = null, $num = false, $t = '') |
||
| 178 | { |
||
| 179 | $ret = ''; |
||
| 180 | $mv = $t . '$modversion'; |
||
| 181 | if (!is_array($descriptions)) { |
||
| 182 | $descs = [$descriptions]; |
||
| 183 | } else { |
||
| 184 | $descs = $descriptions; |
||
| 185 | } |
||
| 186 | foreach ($descs as $key => $desc) { |
||
| 187 | $one = (null === $name) ? $key : $name; |
||
| 188 | $two = (null === $index) ? $key : $index; |
||
| 189 | if (1 === $eleArray) { |
||
| 190 | $ret .= $mv . "['{$one}'] = {$desc};\n"; |
||
| 191 | } elseif (2 === $eleArray) { |
||
| 192 | $ret .= $mv . "['{$one}'][{$two}] = {$desc};\n"; |
||
| 193 | } elseif (3 === $eleArray) { |
||
| 194 | $ret .= $mv . "['{$one}'][{$two}]['{$key}'] = {$desc};\n"; |
||
| 195 | } elseif (4 === $eleArray) { |
||
| 196 | $ret .= $mv . "['{$one}'][{$two}][{$num}]['{$key}'] = {$desc};\n"; |
||
| 197 | } |
||
| 198 | } |
||
| 199 | |||
| 200 | return $ret; |
||
| 201 | } |
||
| 202 | } |
||
| 203 |