txmodxoops /
tdmcreate
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 |
||
| 2 | |||
| 3 | namespace XoopsModules\Tdmcreate\Files\User; |
||
| 4 | |||
| 5 | use XoopsModules\Tdmcreate; |
||
| 6 | |||
| 7 | /* |
||
| 8 | You may not change or alter any portion of this comment or credits |
||
| 9 | of supporting developers from this source code or any supporting source code |
||
| 10 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, |
||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 15 | */ |
||
| 16 | /** |
||
| 17 | * tdmcreate module. |
||
| 18 | * |
||
| 19 | * @copyright XOOPS Project (https://xoops.org) |
||
| 20 | * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
| 21 | * |
||
| 22 | * @since 2.5.0 |
||
| 23 | * |
||
| 24 | * @author Txmod Xoops http://www.txmodxoops.org |
||
| 25 | * |
||
| 26 | */ |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Class UserXoopsCode. |
||
| 30 | */ |
||
| 31 | class UserXoopsCode |
||
| 32 | { |
||
| 33 | /* |
||
| 34 | * @static function getInstance |
||
| 35 | * @param null |
||
| 36 | */ |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return UserXoopsCode |
||
| 40 | */ |
||
| 41 | public static function getInstance() |
||
| 42 | { |
||
| 43 | static $instance = false; |
||
| 44 | if (!$instance) { |
||
| 45 | $instance = new self(); |
||
| 46 | } |
||
| 47 | |||
| 48 | return $instance; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @public function getUserTplMain |
||
| 53 | * |
||
| 54 | * @param $moduleDirname |
||
| 55 | * @param string $tableName |
||
| 56 | * |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | public function getUserTplMain($moduleDirname, $tableName = 'index') |
||
| 60 | { |
||
| 61 | return "\$GLOBALS['xoopsOption']['template_main'] = '{$moduleDirname}_{$tableName}.tpl';\n"; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @public function getUserAddMeta |
||
| 66 | * |
||
| 67 | * @param string $type |
||
| 68 | * @param $language |
||
| 69 | * @param $tableName |
||
| 70 | * |
||
| 71 | * @param string $t |
||
| 72 | * @return string |
||
| 73 | */ |
||
| 74 | public function getUserAddMeta($type, $language, $tableName, $t = '') |
||
| 75 | { |
||
| 76 | $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 77 | $stuTableName = mb_strtoupper($tableName); |
||
| 78 | $stripTags = $pc->getPhpCodeStripTags('', $language . $stuTableName, true); |
||
| 79 | |||
| 80 | return "{$t}\$GLOBALS['xoTheme']->addMeta( 'meta', '{$type}', {$stripTags});\n"; |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @public function getUserMetaKeywords |
||
| 85 | * |
||
| 86 | * @param $moduleDirname |
||
| 87 | * |
||
| 88 | * @return string |
||
| 89 | */ |
||
| 90 | public function getUserMetaKeywords($moduleDirname) |
||
| 91 | { |
||
| 92 | $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 93 | $implode = $pc->getPhpCodeImplode(',', '$keywords'); |
||
| 94 | |||
| 95 | return "{$moduleDirname}MetaKeywords(\$helper->getConfig('keywords').', '. {$implode});\n"; |
||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @public function getUserMetaDesc |
||
| 100 | * |
||
| 101 | * @param $moduleDirname |
||
| 102 | * @param $language |
||
| 103 | * @param string $file |
||
| 104 | * |
||
| 105 | * @return string |
||
| 106 | */ |
||
| 107 | public function getUserMetaDesc($moduleDirname, $language, $file = 'INDEX') |
||
| 108 | { |
||
| 109 | return "{$moduleDirname}MetaDescription({$language}{$file}_DESC);\n"; |
||
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * @public function getUserBreadcrumbs |
||
| 114 | * |
||
| 115 | * @param $language |
||
| 116 | * @param string $tableName |
||
| 117 | * @param string $t |
||
| 118 | * |
||
| 119 | * @return string |
||
| 120 | */ |
||
| 121 | public function getUserBreadcrumbs($language, $tableName = 'index', $t = '') |
||
| 122 | { |
||
| 123 | $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 124 | $stuTableName = mb_strtoupper($tableName); |
||
| 125 | $title = ["'title'" => "{$language}{$stuTableName}"]; |
||
| 126 | |||
| 127 | return $pc->getPhpCodeArray('xoBreadcrumbs[]', $title, false, $t); |
||
| 128 | } |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @public function getUserBreadcrumbs |
||
| 132 | * |
||
| 133 | * @param $moduleDirname |
||
| 134 | * |
||
| 135 | * @param $language |
||
| 136 | * @return string |
||
| 137 | */ |
||
| 138 | public function getUserBreadcrumbsHeaderFile($moduleDirname, $language) |
||
| 139 | { |
||
| 140 | $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 141 | $stuModuleDirname = mb_strtoupper($moduleDirname); |
||
| 142 | $ret = $pc->getPhpCodeCommentLine('Breadcrumbs'); |
||
| 143 | $ret .= $pc->getPhpCodeArray('xoBreadcrumbs', null, false, ''); |
||
| 144 | $titleLink = ["'title'" => $language . 'TITLE', "'link'" => "{$stuModuleDirname}_URL . '/'"]; |
||
| 145 | $ret .= $pc->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 | $pc = Tdmcreate\Files\CreatePhpCode::getInstance(); |
||
| 158 | $xc = Tdmcreate\Files\CreateXoopsCode::getInstance(); |
||
| 159 | $cond = $xc->getXcXoopsTplAssign('xoBreadcrumbs', '$xoBreadcrumbs'); |
||
| 160 | $ret = $pc->getPhpCodeConditions('count($xoBreadcrumbs)', ' > ', '1', $cond, false, "\t\t"); |
||
| 161 | |||
| 162 | return $ret; |
||
| 163 | } |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @public function getUserModVersionArray |
||
| 167 | * |
||
| 168 | * @param int $eleArray |
||
| 169 | * @param $descriptions |
||
| 170 | * @param null $name |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 171 | * @param null $index |
||
|
0 ignored issues
–
show
|
|||
| 172 | * @param bool $num |
||
| 173 | * @param string $t |
||
| 174 | * |
||
| 175 | * @return string |
||
| 176 | */ |
||
| 177 | public function getUserModVersionArray($eleArray, $descriptions, $name = null, $index = null, $num = false, $t = '') |
||
| 178 | { |
||
| 179 | $ret = $t . '$modversion'; |
||
| 180 | $isArray = false; |
||
| 181 | $n = ''; |
||
| 182 | if (!is_array($descriptions)) { |
||
| 183 | $descs = [$descriptions]; |
||
| 184 | } else { |
||
| 185 | $descs = $descriptions; |
||
| 186 | $isArray = true; |
||
| 187 | $n = "\n"; |
||
| 188 | } |
||
| 189 | if (0 === $eleArray) { |
||
| 190 | $ret .= " = "; |
||
| 191 | } elseif (1 === $eleArray || 11 === $eleArray) { |
||
| 192 | $ret .= "['{$name}'] = "; |
||
| 193 | } elseif (2 === $eleArray) { |
||
| 194 | $ret .= "['{$name}'][{$index}] = "; |
||
| 195 | } elseif (3 === $eleArray) { |
||
| 196 | $ret .= "['{$name}'][{$index}][{$num}] = "; |
||
| 197 | } |
||
| 198 | if ($isArray) { |
||
| 199 | $ret .= "["; |
||
| 200 | } |
||
| 201 | $ret .= $n; |
||
| 202 | //search for longest key |
||
| 203 | $len = 0; |
||
| 204 | foreach ($descs as $key => $desc) { |
||
| 205 | $len = strlen($key) > $len ? strlen($key) : $len; |
||
| 206 | } |
||
| 207 | |||
| 208 | foreach ($descs as $key => $desc) { |
||
| 209 | $space = str_repeat ( ' ' , $len - strlen($key)); |
||
| 210 | if ($eleArray < 4) { |
||
| 211 | $ret .= $t . "\t'{$key}'{$space} => {$desc},{$n}"; |
||
| 212 | } elseif (11 === $eleArray) { |
||
| 213 | if ('/' === substr($desc, 1, 1)) { |
||
| 214 | $ret .= $t . "\t{$desc}"; |
||
| 215 | } else { |
||
| 216 | $ret .= $t . "\t{$desc},{$n}"; |
||
| 217 | } |
||
| 218 | |||
| 219 | } elseif (12 === $eleArray) { |
||
| 220 | $ret .= $t . "\t{$desc}{$n}"; |
||
| 221 | } |
||
| 222 | } |
||
| 223 | $ret .= $t; |
||
| 224 | if ($isArray) { |
||
| 225 | $ret .= "]"; |
||
| 226 | } |
||
| 227 | $ret .= ";\n"; |
||
| 228 | return $ret; |
||
| 229 | } |
||
| 230 | |||
| 231 | /** |
||
| 232 | * @public function getUserModVersionText |
||
| 233 | * |
||
| 234 | * @param int $eleArray |
||
| 235 | * @param $text |
||
| 236 | * @param null $name |
||
|
0 ignored issues
–
show
|
|||
| 237 | * @param null $index |
||
|
0 ignored issues
–
show
|
|||
| 238 | * @param bool $num |
||
| 239 | * @param string $t |
||
| 240 | * |
||
| 241 | * @return string |
||
| 242 | */ |
||
| 243 | public function getUserModVersionText($eleArray, $text, $name = null, $index = null, $num = false, $t = '') |
||
| 244 | { |
||
| 245 | $ret = $t . '$modversion'; |
||
| 246 | |||
| 247 | if (0 === $eleArray) { |
||
| 248 | $ret .= " = "; |
||
| 249 | } elseif (1 === $eleArray) { |
||
| 250 | $ret .= "['{$name}'] = "; |
||
| 251 | } elseif (2 === $eleArray) { |
||
| 252 | $ret .= "['{$name}'][{$index}] = "; |
||
| 253 | } elseif (3 === $eleArray) { |
||
| 254 | $ret .= "['{$name}'][{$index}][{$num}] = "; |
||
| 255 | } |
||
| 256 | |||
| 257 | $ret .= $t . "{$text};\n"; |
||
| 258 | return $ret; |
||
| 259 | } |
||
| 260 | } |
||
| 261 |