Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ I moved files, where I do not know whether they are still needed into folder _ar

TODOs:

implement constants interface
new xoops_confirm


Broken files:
Expand Down
2 changes: 1 addition & 1 deletion _archive/class/Files/User/UserBroken.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getUserBrokenHeader($moduleDirname, $fields)
$ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', '');
$ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']);
$ret .= $this->getInclude();
$ret .= $xc->getXcXoopsRequest('op', 'op', 'list');
$ret .= $xc->getXcXoopsRequest('op', 'op', 'list', 'Cmd');
$ret .= $xc->getXcXoopsRequest($ccFieldId, $fieldId, '', 'Int');
$ret .= $pc->getPhpCodeCommentLine('Template');
$ret .= $uxc->getUserTplMain($moduleDirname, 'broken');
Expand Down
2 changes: 1 addition & 1 deletion _archive/class/Files/User/UserSubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getUserSubmitHeader($moduleDirname, $tablePermissions)
$ret .= $this->getInclude();
$ret .= $xc->getXcXoopsLoadLanguage('admin', '', $moduleDirname);
$ret .= $pc->getPhpCodeCommentLine('It recovered the value of argument op in URL$');
$ret .= $xc->getXcXoopsRequest('op', 'op', 'form');
$ret .= $xc->getXcXoopsRequest('op', 'op', 'form', 'Cmd');
$ret .= $pc->getPhpCodeCommentLine('Template');
$ret .= $uxc->getUserTplMain($moduleDirname, 'submit');
$ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'header', true);
Expand Down
5 changes: 3 additions & 2 deletions class/Files/Admin/AdminBroken.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public function write($module, $tables, $filename)
/**
* @private function getAdminBrokenHeader
* @param $moduleDirname
* @param $fieldId
* @param $tableName
* @param string $t
* @return string
*/
private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '')
Expand All @@ -96,7 +97,7 @@ private function getAdminBrokenHeader($moduleDirname, $tableName, $t = '')

/**
* @private function getAdminBrokenList
* @param $table
* @param $tables
* @param $language
* @param string $t
* @return string
Expand Down
2 changes: 1 addition & 1 deletion class/Files/Admin/AdminPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function getPermissionsHeader($module, $language)
$ret .= $axc->getAdminTemplateMain($moduleDirname, 'permissions');
$ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('permissions.php')");
$ret .= $pc->getPhpCodeBlankLine();
$ret .= $xc->getXcXoopsRequest('op', 'op', 'global');
$ret .= $xc->getXcXoopsRequest('op', 'op', 'global', 'Cmd');
$ret .= $pc->getPhpCodeBlankLine();
$ret .= $pc->getPhpCodeCommentLine('Get Form');
$ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true);
Expand Down
40 changes: 27 additions & 13 deletions class/Files/Classes/ClassFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
$action = $xc->getXcEqualsOperator('$action', "\$_SERVER['REQUEST_URI']", null, "\t\t\t");
$ucfModuleDirname = ucfirst($moduleDirname);
$getForm = $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t");
$getForm .= $pc->getPhpCodeConditions('false', ' === ', '$action', $action, false, "\t\t");
$getForm .= $pc->getPhpCodeConditions('$action', ' === ', 'false', $action, false, "\t\t");
$xUser = $pc->getPhpCodeGlobals('xoopsUser');
$xModule = $pc->getPhpCodeGlobals('xoopsModule');
$getForm .= $xc->getXcEqualsOperator('$isAdmin', $xUser . '->isAdmin(' . $xModule . '->mid())', null, "\t\t");
$permString = 'upload_groups';
if (1 != $tableCategory/* && (1 == $tablePermissions)*/) {
$getForm .= $pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t");
Expand All @@ -288,7 +289,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
$ternaryOperator = $pc->getPhpCodeTernaryOperator('permissionUpload', $checkRight, 'true', 'false', "\t\t\t");
$permissionUpload = $xc->getXcEqualsOperator('$permissionUpload', 'true', null, "\t\t\t\t");
$ternOperator = $pc->getPhpCodeRemoveCarriageReturn($ternaryOperator, '', "\r");
$if = $pc->getPhpCodeConditions('!' . $xUser . '->isAdmin(' . $xModule . '->mid())', '', '', "\t" . $ternaryOperator, $permissionUpload, "\t\t\t");
$if = $pc->getPhpCodeConditions('$isAdmin', '', '', "\t" . $ternaryOperator, $permissionUpload, "\t\t\t");
$getForm .= $pc->getPhpCodeConditions($xUser, '', '', $if, $ternOperator, "\t\t");
}
$getForm .= $pc->getPhpCodeCommentLine('Title', '', "\t\t");
Expand Down Expand Up @@ -390,44 +391,57 @@ private function getValuesInObject($moduleDirname, $table, $fields)
$utility = 0;
$header = '';
$configMaxchar = 0;
$lenMaxName = 0;
foreach (array_keys($fields) as $f) {
$fieldName = $fields[$f]->getVar('field_name');
$rpFieldName = $this->getRightString($fieldName);
$len = strlen($rpFieldName);
if (3 == $fields[$f]->getVar('field_element') || 4 == $fields[$f]->getVar('field_element')) {
$len = $len + strlen('_short');
}
$lenMaxName = max($len, $lenMaxName);
}
foreach (array_keys($fields) as $f) {
$fieldName = $fields[$f]->getVar('field_name');
$fieldElement = $fields[$f]->getVar('field_element');
$rpFieldName = $this->getRightString($fieldName);
$spacer = str_repeat(' ', $lenMaxName - strlen($rpFieldName));
switch ($fieldElement) {
case 3:
$getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t");
$getValues .= $pc->getPhpCodeStripTags("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}', 'e')", false, "\t\t");
if ($configMaxchar == 0) {
$getValues .= $xc->getXcEqualsOperator('$editorMaxchar', $xc->getXcGetConfig('editor_maxchar'), false, "\t\t");
$configMaxchar = 1;
}
$truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)";
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']", $truncate, false, "\t\t");
$spacer = str_repeat(' ', $lenMaxName - strlen($rpFieldName) - strlen('_short'));
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']{$spacer}", $truncate, false, "\t\t");
$helper = 1;
$utility = 1;
break;
case 4:
$getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']", 'this', $fieldName, false, "\t\t", ", 'e'");
$getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t", ", 'e'");
if ($configMaxchar == 0) {
$getValues .= $xc->getXcEqualsOperator('$editorMaxchar', $xc->getXcGetConfig('editor_maxchar'), false, "\t\t");
$configMaxchar = 1;
}
$truncate = "\$utility::truncateHtml(\$ret['{$rpFieldName}'], \$editorMaxchar)";
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']", $truncate, false, "\t\t");
$spacer = str_repeat(' ', $lenMaxName - strlen($rpFieldName) - strlen('_short'));
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}_short']{$spacer}", $truncate, false, "\t\t");
$helper = 1;
$utility = 1;
break;
case 6:
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t");
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", "(int)\$this->getVar('{$fieldName}') > 0 ? _YES : _NO", false, "\t\t");
break;
case 8:
$getValues .= $xc->getXcXoopsUserUnameFromId("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", "\t\t");
$getValues .= $xc->getXcXoopsUserUnameFromId("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", "\t\t");
break;
case 15:
$getValues .= $xc->getXcFormatTimeStamp("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", 's', "\t\t");
$getValues .= $xc->getXcFormatTimeStamp("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", 's', "\t\t");
break;
case 21:
$getValues .= $xc->getXcFormatTimeStamp("ret['{$rpFieldName}']", "\$this->getVar('{$fieldName}')", 'm', "\t\t");
$getValues .= $xc->getXcFormatTimeStamp("ret['{$rpFieldName}']{$spacer}", "\$this->getVar('{$fieldName}')", 'm', "\t\t");
break;
default:
$fieldElements = $tc->getHandler('Fieldelements')->get($fieldElement);
Expand All @@ -448,10 +462,10 @@ private function getValuesInObject($moduleDirname, $table, $fields)
$getTopicTable = "\${$topicTableName}Handler->get(\$this->getVar('{$fieldName}'))";
$getValues .= $xc->getXcEqualsOperator("\${$topicTableName}Obj", $getTopicTable, null, "\t\t");
$fMainTopic = "\${$topicTableName}Obj->getVar('{$fieldMainTopic}')";
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']", $fMainTopic, null, "\t\t");
$getValues .= $xc->getXcEqualsOperator("\$ret['{$rpFieldName}']{$spacer}", $fMainTopic, null, "\t\t");
$helper = 1;
} else {
$getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']", 'this', $fieldName, false, "\t\t");
$getValues .= $xc->getXcGetVar("ret['{$rpFieldName}']{$spacer}", 'this', $fieldName, false, "\t\t");
}
break;
}
Expand Down Expand Up @@ -522,7 +536,7 @@ private function getOptionsCheck($table)
$rpFieldName = $this->getRightString($fieldName);
if (5 == $fieldElementId) {
$arrayPush = $pc->getPhpCodeArrayType('ret', 'push', "'{$rpFieldName}'", null, false, "\t\t\t");
$getOptions .= $pc->getPhpCodeConditions(1, ' == ', "\$this->getVar('{$fieldName}')", $arrayPush, false, "\t\t");
$getOptions .= $pc->getPhpCodeConditions("\$this->getVar('{$fieldName}')", ' == ', '1', $arrayPush, false, "\t\t");
}
}

Expand Down
12 changes: 9 additions & 3 deletions class/Files/Classes/ClassFormElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,25 @@ private function getXoopsFormDhtmlTextArea($language, $fieldName, $required = 'f
$pc = Modulebuilder\Files\CreatePhpCode::getInstance();
$xc = Modulebuilder\Files\CreateXoopsCode::getInstance();
$cxc = Modulebuilder\Files\Classes\ClassXoopsCode::getInstance();
$rpFieldName = $tf->getRightString($fieldName);
//$rpFieldName = $tf->getRightString($fieldName);
$ccFieldName = $tf->getCamelCase($fieldName, false, true);
$ret = $pc->getPhpCodeCommentLine('Form Editor', 'DhtmlTextArea ' . $ccFieldName, "\t\t");
$ret .= $pc->getPhpCodeArray('editorConfigs', null, false, "\t\t");
$getConfig = $xc->getXcGetConfig('editor_default');
$getConfig = $xc->getXcGetConfig('editor_admin');
$contIf = $xc->getXcEqualsOperator("\$editor", $getConfig, null, "\t\t\t");
$getConfig = $xc->getXcGetConfig('editor_user');
$contElse = $xc->getXcEqualsOperator("\$editor", $getConfig, null, "\t\t\t");
$ret .= $pc->getPhpCodeConditions('$isAdmin','','', $contIf, $contElse, "\t\t");


$configs = [
'name' => "'{$fieldName}'",
'value' => "\$this->getVar('{$fieldName}', 'e')",
'rows' => 5,
'cols' => 40,
'width' => "'100%'",
'height' => "'400px'",
'editor' => $getConfig,
'editor' => '$editor',
];
foreach ($configs as $c => $d) {
$ret .= $xc->getXcEqualsOperator("\$editorConfigs['{$c}']", $d, null, "\t\t");
Expand Down
2 changes: 1 addition & 1 deletion class/Files/Classes/ClassSpecialFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getGlobalPerms($permId)

$contIfInt = $xc->getXcEqualsOperator('$my_group_ids', '[XOOPS_GROUP_ANONYMOUS]', null, "\t\t\t");
$contElseInt = $xc->getXcEqualsOperator('$my_group_ids', '$memberHandler->getGroupsByUser($currentuid);', null, "\t\t\t");
$globalContent .= $pc->getPhpCodeConditions('0', ' == ', '$currentuid', $contIfInt, $contElseInt, "\t\t");
$globalContent .= $pc->getPhpCodeConditions('$currentuid', ' == ', '0', $contIfInt, $contElseInt, "\t\t");
$globalContent .= $cond;
$globalContent .= $this->getSimpleString("return false;", "\t\t");
$functions .= $pc->getPhpCodeFunction($funcname, '', $globalContent, 'public ', false, "\t");
Expand Down
5 changes: 4 additions & 1 deletion class/Files/CreateHtmlCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public function getHtmlEmpty($empty = '', $t = '', $n = '')
/**
* @public function getHtmlComment
* @param string $htmlComment
* @param string $n
* @param string $t
* @param string $n
* @return string
*/
public function getHtmlComment($htmlComment = '', $t = '', $n = '')
Expand Down Expand Up @@ -203,6 +204,7 @@ public function getHtmlPre($content = '', $preClass = '', $t = '', $n = "\n")
* @param string $spanClass
* @param string $t
* @param string $n
* @param bool $split
* @return string
*/
public function getHtmlSpan($content = '', $spanClass = '', $t = '', $n = "\n", $split = false)
Expand Down Expand Up @@ -243,6 +245,7 @@ public function getHtmlParagraph($content = '', $pClass = '', $t = '', $n = "\n"
* @public function getHtmlI
* @param string $content
* @param string $iClass
* @param string $iId
* @param string $t
* @param string $n
* @return string
Expand Down
13 changes: 11 additions & 2 deletions class/Files/CreatePhpCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public function getPhpCodeTernaryOperator($return, $condition, $one, $two, $t =
* @param $extends
* @param $type
*
* @param null $implements
* @return string
*/
public function getPhpCodeClass($name = null, $content = null, $extends = null, $type = null, $implements = null)
Expand Down Expand Up @@ -337,12 +338,20 @@ public function getPhpCodeFunction($name = null, $params = null, $content = null
*/
public function getPhpCodeConditions($condition = null, $operator = null, $type = null, $contentIf = null, $contentElse = false, $t = '', $conditionElse = '')
{
if ('==' === trim($operator) || '===' === trim($operator) || '!=' === trim($operator) || '!==' === trim($operator)) {
//yoda conditions
$left = $type;
$right = $condition;
} else {
$left = $condition;
$right = $type;
}
if (false === $contentElse) {
$ret = "{$t}if ({$condition}{$operator}{$type}) {\n";
$ret = "{$t}if ({$left}{$operator}{$right}) {\n";
$ret .= $contentIf;
$ret .= "{$t}}\n";
} else {
$ret = "{$t}if ({$condition}{$operator}{$type}) {\n";
$ret = "{$t}if ({$left}{$operator}{$right}) {\n";
$ret .= $contentIf;
if ('' !== $conditionElse) {
$ret .= "{$t}} elseif ({$conditionElse}) {\n";
Expand Down
4 changes: 3 additions & 1 deletion class/Files/CreateSmartyCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admi
* @public function getSmartyIncludeFileListSection
* @param $moduleDirname
* @param $fileName
* @param $tableFieldName
* @param $itemName
* @param $arrayName
* @param string $t
* @param string $n
* @return string
Expand Down Expand Up @@ -231,6 +232,7 @@ public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tabl
* @param bool $noSimbol
* @param string $t
* @param string $n
* @param bool $split
* @return string
*/
public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '', $n = "\n", $split = true)
Expand Down
Loading