@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | $myts = MyTextSanitizer::getInstance(); |
| 37 | 37 | // |
| 38 | 38 | if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { |
| 39 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 40 | - $xoopsTpl = new \XoopsTpl(); |
|
| 39 | + include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 40 | + $xoopsTpl = new \XoopsTpl(); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Load languages |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | // Local admin menu class |
| 48 | 48 | if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) { |
| 49 | - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); |
|
| 49 | + include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); |
|
| 50 | 50 | } else { |
| 51 | - redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); |
|
| 51 | + redirect_header('../../../admin.php', 5, _AM_MODULEADMIN_MISSING); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | xoops_cp_header(); |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | if(is_array($permissions) && array_key_exists($permtype, $permissions)) { |
| 55 | 55 | return $permissions[$permtype]; |
| 56 | 56 | } |
| 57 | - $moduleHandler = xoops_getHandler('module'); |
|
| 58 | - $mymodule2Module = $moduleHandler->getByDirname($dirname); |
|
| 59 | - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 60 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 61 | - $testfields = $grouppermHandler->getItemIds($permtype, $groups, $mymodule2Module->getVar('mid')); |
|
| 57 | + $moduleHandler = xoops_getHandler('module'); |
|
| 58 | + $mymodule2Module = $moduleHandler->getByDirname($dirname); |
|
| 59 | + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 60 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
| 61 | + $testfields = $grouppermHandler->getItemIds($permtype, $groups, $mymodule2Module->getVar('mid')); |
|
| 62 | 62 | return $testfields; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | case 'none': |
| 162 | 162 | if($topic_name) { |
| 163 | - $topic_name = 'topic=' . $topic_name . '&'; |
|
| 163 | + $topic_name = 'topic=' . $topic_name . '&'; |
|
| 164 | 164 | } |
| 165 | 165 | $rewrite_base = '/modules/'; |
| 166 | 166 | $page = 'page=' . $array['content_alias']; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | return XOOPS_URL . $rewrite_base . $module_name . $type . $topic_name . $id . $page . $rewrite_ext; |
| 191 | 191 | break; |
| 192 | 192 | |
| 193 | - case 'short': |
|
| 193 | + case 'short': |
|
| 194 | 194 | if($topic_name) { |
| 195 | 195 | $topic_name .= '/'; |
| 196 | 196 | } |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | $result = $xoopsDB->query($sql); // TODO: error check |
| 64 | 64 | $result_array = $xoopsDB->fetchArray($result); |
| 65 | 65 | $item['name'] = $result_array['tf_text']; |
| 66 | - $item['url'] = MYMODULE2_URL . '/single.php?cid=' . $result_array['cid'] . '&tf_id=' . $item_id; |
|
| 67 | - return $item; |
|
| 66 | + $item['url'] = MYMODULE2_URL . '/single.php?cid=' . $result_array['cid'] . '&tf_id=' . $item_id; |
|
| 67 | + return $item; |
|
| 68 | 68 | break; |
| 69 | 69 | } |
| 70 | 70 | return null; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $ret = mymodule2_check_db($module); |
| 40 | 40 | |
| 41 | 41 | //check upload directory |
| 42 | - include_once __DIR__ . '/install.php'; |
|
| 42 | + include_once __DIR__ . '/install.php'; |
|
| 43 | 43 | $ret = xoops_module_install_mymodule2($module); |
| 44 | 44 | |
| 45 | 45 | $errors = $module->getErrors(); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | function mymodule2_check_db($module) |
| 114 | 114 | { |
| 115 | 115 | $ret = true; |
| 116 | - //insert here code for database check |
|
| 116 | + //insert here code for database check |
|
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | // Example: update table (add new field) |
@@ -42,23 +42,23 @@ |
||
| 42 | 42 | $articlesAll = $articlesHandler->getAllArticles($start, $limit); |
| 43 | 43 | $keywords = []; |
| 44 | 44 | if ($articlesCount > 0) { |
| 45 | - $articles = []; |
|
| 46 | - // Get All Articles |
|
| 47 | - foreach(array_keys($articlesAll) as $i) { |
|
| 48 | - $articles[] = $articlesAll[$i]->getValuesArticles(); |
|
| 49 | - $keywords[] = $articlesAll[$i]->getVar('art_title'); |
|
| 50 | - } |
|
| 51 | - $GLOBALS['xoopsTpl']->assign('articles', $articles); |
|
| 52 | - unset($articles); |
|
| 53 | - // Display Navigation |
|
| 54 | - if ($articlesCount > $limit) { |
|
| 55 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 56 | - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 57 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 58 | - } |
|
| 59 | - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
| 60 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 61 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 45 | + $articles = []; |
|
| 46 | + // Get All Articles |
|
| 47 | + foreach(array_keys($articlesAll) as $i) { |
|
| 48 | + $articles[] = $articlesAll[$i]->getValuesArticles(); |
|
| 49 | + $keywords[] = $articlesAll[$i]->getVar('art_title'); |
|
| 50 | + } |
|
| 51 | + $GLOBALS['xoopsTpl']->assign('articles', $articles); |
|
| 52 | + unset($articles); |
|
| 53 | + // Display Navigation |
|
| 54 | + if ($articlesCount > $limit) { |
|
| 55 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 56 | + $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 57 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 58 | + } |
|
| 59 | + $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
| 60 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 61 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Breadcrumbs |
@@ -31,176 +31,176 @@ |
||
| 31 | 31 | include_once XOOPS_ROOT_PATH . '/header.php'; |
| 32 | 32 | // Define Stylesheet |
| 33 | 33 | $GLOBALS['xoTheme']->addStylesheet( $style, null ); |
| 34 | - switch($op) { |
|
| 35 | - case 'form': |
|
| 36 | - default: |
|
| 37 | - // Navigation |
|
| 38 | - $navigation = _MA_MYMODULE2_RATE; |
|
| 39 | - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
|
| 40 | - // Title of page |
|
| 41 | - $title = _MA_MYMODULE2_RATE . ' - '; |
|
| 42 | - $title .= $GLOBALS['xoopsModule']->name(); |
|
| 43 | - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
|
| 44 | - // Description |
|
| 45 | - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_RATE)); |
|
| 46 | - // Form Create |
|
| 47 | - $testfieldsObj = $testfieldsHandler->create(); |
|
| 48 | - $form = $testfieldsObj->getFormTestfields(); |
|
| 49 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
| 34 | + switch($op) { |
|
| 35 | + case 'form': |
|
| 36 | + default: |
|
| 37 | + // Navigation |
|
| 38 | + $navigation = _MA_MYMODULE2_RATE; |
|
| 39 | + $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
|
| 40 | + // Title of page |
|
| 41 | + $title = _MA_MYMODULE2_RATE . ' - '; |
|
| 42 | + $title .= $GLOBALS['xoopsModule']->name(); |
|
| 43 | + $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
|
| 44 | + // Description |
|
| 45 | + $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_RATE)); |
|
| 46 | + // Form Create |
|
| 47 | + $testfieldsObj = $testfieldsHandler->create(); |
|
| 48 | + $form = $testfieldsObj->getFormTestfields(); |
|
| 49 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
| 50 | 50 | |
| 51 | - break; |
|
| 52 | - case 'save': |
|
| 53 | - // Security Check |
|
| 54 | - if ($GLOBALS['xoopsSecurity']->check()) { |
|
| 55 | - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 56 | - } |
|
| 57 | - $testfieldsObj = $testfieldsHandler->create(); |
|
| 58 | - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
|
| 59 | - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
|
| 60 | - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
|
| 61 | - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
|
| 62 | - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
|
| 63 | - $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); |
|
| 64 | - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
|
| 65 | - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
|
| 66 | - // Set Var tf_imagelist |
|
| 67 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 68 | - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
|
| 69 | - $helper->getConfig('mimetypes_image'), |
|
| 70 | - $helper->getConfig('maxsize_image'), null, null); |
|
| 71 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 72 | - //$uploader->setPrefix(tf_imagelist_); |
|
| 73 | - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
|
| 74 | - if (!$uploader->upload()) { |
|
| 75 | - $errors = $uploader->getErrors(); |
|
| 76 | - redirect_header('javascript:history.go(-1).php', 3, $errors); |
|
| 77 | - } else { |
|
| 78 | - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
|
| 79 | - } |
|
| 80 | - } else { |
|
| 81 | - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
|
| 82 | - } |
|
| 83 | - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
|
| 84 | - // Set Var tf_urlfile |
|
| 85 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 86 | - $filename = $_FILES['tf_urlfile']['name']; |
|
| 87 | - $imgNameDef = Request::getString('tf_text'); |
|
| 88 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 89 | - $helper->getConfig('mimetypes_file'), |
|
| 90 | - $helper->getConfig('maxsize_file'), null, null); |
|
| 91 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
|
| 92 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 93 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 94 | - $uploader->setPrefix($imgName); |
|
| 95 | - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
|
| 96 | - if (!$uploader->upload()) { |
|
| 97 | - $errors = $uploader->getErrors(); |
|
| 98 | - } else { |
|
| 99 | - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
|
| 100 | - } |
|
| 101 | - } else { |
|
| 102 | - if ($filename > '') { |
|
| 103 | - $uploaderErrors = $uploader->getErrors(); |
|
| 104 | - } |
|
| 105 | - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
|
| 106 | - } |
|
| 107 | - // Set Var tf_uplimage |
|
| 108 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 109 | - $filename = $_FILES['tf_uplimage']['name']; |
|
| 110 | - $imgMimetype = $_FILES['tf_uplimage']['type']; |
|
| 111 | - $imgNameDef = Request::getString('tf_text'); |
|
| 112 | - $uploaderErrors = ''; |
|
| 113 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
|
| 114 | - $helper->getConfig('mimetypes_image'), |
|
| 115 | - $helper->getConfig('maxsize_image'), null, null); |
|
| 116 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
|
| 117 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 118 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 119 | - $uploader->setPrefix($imgName); |
|
| 120 | - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
|
| 121 | - if (!$uploader->upload()) { |
|
| 122 | - $uploaderErrors = $uploader->getErrors(); |
|
| 123 | - } else { |
|
| 124 | - $savedFilename = $uploader->getSavedFileName(); |
|
| 125 | - $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
|
| 126 | - $maxheight = (int)$helper->getConfig('maxheight_image'); |
|
| 127 | - if ($maxwidth > 0 && $maxheight > 0) { |
|
| 128 | - // Resize image |
|
| 129 | - $imgHandler = new Mymodule2\Common\Resizer(); |
|
| 130 | - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 131 | - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 132 | - $imgHandler->imageMimetype = $imgMimetype; |
|
| 133 | - $imgHandler->maxWidth = $maxwidth; |
|
| 134 | - $imgHandler->maxHeight = $maxheight; |
|
| 135 | - $result = $imgHandler->resizeImage(); |
|
| 136 | - } |
|
| 137 | - $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
|
| 138 | - } |
|
| 139 | - } else { |
|
| 140 | - if ($filename > '') { |
|
| 141 | - $uploaderErrors = $uploader->getErrors(); |
|
| 142 | - } |
|
| 143 | - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
|
| 144 | - } |
|
| 145 | - // Set Var tf_uplfile |
|
| 146 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 147 | - $filename = $_FILES['tf_uplfile']['name']; |
|
| 148 | - $imgNameDef = Request::getString('tf_text'); |
|
| 149 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 150 | - $helper->getConfig('mimetypes_file'), |
|
| 151 | - $helper->getConfig('maxsize_file'), null, null); |
|
| 152 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
|
| 153 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 154 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 155 | - $uploader->setPrefix($imgName); |
|
| 156 | - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
|
| 157 | - if (!$uploader->upload()) { |
|
| 158 | - $errors = $uploader->getErrors(); |
|
| 159 | - } else { |
|
| 160 | - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
|
| 161 | - } |
|
| 162 | - } else { |
|
| 163 | - if ($filename > '') { |
|
| 164 | - $uploaderErrors = $uploader->getErrors(); |
|
| 165 | - } |
|
| 166 | - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
|
| 167 | - } |
|
| 168 | - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
|
| 169 | - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
|
| 170 | - // Set Var tf_selectfile |
|
| 171 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 172 | - $filename = $_FILES['tf_selectfile']['name']; |
|
| 173 | - $imgNameDef = Request::getString('tf_text'); |
|
| 174 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 175 | - $helper->getConfig('mimetypes_file'), |
|
| 176 | - $helper->getConfig('maxsize_file'), null, null); |
|
| 177 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
|
| 178 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 179 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 180 | - $uploader->setPrefix($imgName); |
|
| 181 | - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
|
| 182 | - if (!$uploader->upload()) { |
|
| 183 | - $errors = $uploader->getErrors(); |
|
| 184 | - } else { |
|
| 185 | - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
|
| 186 | - } |
|
| 187 | - } else { |
|
| 188 | - if ($filename > '') { |
|
| 189 | - $uploaderErrors = $uploader->getErrors(); |
|
| 190 | - } |
|
| 191 | - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
|
| 192 | - } |
|
| 193 | - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
|
| 194 | - // Insert Data |
|
| 195 | - if ($testfields1->insert($testfieldsObj)) { |
|
| 196 | - redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); |
|
| 197 | - } |
|
| 198 | - // Get Form Error |
|
| 199 | - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
|
| 200 | - $form = $testfieldsObj->getFormTestfields(); |
|
| 201 | - $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
|
| 51 | + break; |
|
| 52 | + case 'save': |
|
| 53 | + // Security Check |
|
| 54 | + if ($GLOBALS['xoopsSecurity']->check()) { |
|
| 55 | + redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 56 | + } |
|
| 57 | + $testfieldsObj = $testfieldsHandler->create(); |
|
| 58 | + $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
|
| 59 | + $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
|
| 60 | + $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
|
| 61 | + $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
|
| 62 | + $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
|
| 63 | + $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); |
|
| 64 | + $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
|
| 65 | + $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
|
| 66 | + // Set Var tf_imagelist |
|
| 67 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 68 | + $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
|
| 69 | + $helper->getConfig('mimetypes_image'), |
|
| 70 | + $helper->getConfig('maxsize_image'), null, null); |
|
| 71 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 72 | + //$uploader->setPrefix(tf_imagelist_); |
|
| 73 | + //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
|
| 74 | + if (!$uploader->upload()) { |
|
| 75 | + $errors = $uploader->getErrors(); |
|
| 76 | + redirect_header('javascript:history.go(-1).php', 3, $errors); |
|
| 77 | + } else { |
|
| 78 | + $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
|
| 79 | + } |
|
| 80 | + } else { |
|
| 81 | + $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
|
| 82 | + } |
|
| 83 | + $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
|
| 84 | + // Set Var tf_urlfile |
|
| 85 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 86 | + $filename = $_FILES['tf_urlfile']['name']; |
|
| 87 | + $imgNameDef = Request::getString('tf_text'); |
|
| 88 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 89 | + $helper->getConfig('mimetypes_file'), |
|
| 90 | + $helper->getConfig('maxsize_file'), null, null); |
|
| 91 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
|
| 92 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 93 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 94 | + $uploader->setPrefix($imgName); |
|
| 95 | + $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
|
| 96 | + if (!$uploader->upload()) { |
|
| 97 | + $errors = $uploader->getErrors(); |
|
| 98 | + } else { |
|
| 99 | + $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
|
| 100 | + } |
|
| 101 | + } else { |
|
| 102 | + if ($filename > '') { |
|
| 103 | + $uploaderErrors = $uploader->getErrors(); |
|
| 104 | + } |
|
| 105 | + $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
|
| 106 | + } |
|
| 107 | + // Set Var tf_uplimage |
|
| 108 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 109 | + $filename = $_FILES['tf_uplimage']['name']; |
|
| 110 | + $imgMimetype = $_FILES['tf_uplimage']['type']; |
|
| 111 | + $imgNameDef = Request::getString('tf_text'); |
|
| 112 | + $uploaderErrors = ''; |
|
| 113 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
|
| 114 | + $helper->getConfig('mimetypes_image'), |
|
| 115 | + $helper->getConfig('maxsize_image'), null, null); |
|
| 116 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
|
| 117 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 118 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 119 | + $uploader->setPrefix($imgName); |
|
| 120 | + $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
|
| 121 | + if (!$uploader->upload()) { |
|
| 122 | + $uploaderErrors = $uploader->getErrors(); |
|
| 123 | + } else { |
|
| 124 | + $savedFilename = $uploader->getSavedFileName(); |
|
| 125 | + $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
|
| 126 | + $maxheight = (int)$helper->getConfig('maxheight_image'); |
|
| 127 | + if ($maxwidth > 0 && $maxheight > 0) { |
|
| 128 | + // Resize image |
|
| 129 | + $imgHandler = new Mymodule2\Common\Resizer(); |
|
| 130 | + $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 131 | + $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 132 | + $imgHandler->imageMimetype = $imgMimetype; |
|
| 133 | + $imgHandler->maxWidth = $maxwidth; |
|
| 134 | + $imgHandler->maxHeight = $maxheight; |
|
| 135 | + $result = $imgHandler->resizeImage(); |
|
| 136 | + } |
|
| 137 | + $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
|
| 138 | + } |
|
| 139 | + } else { |
|
| 140 | + if ($filename > '') { |
|
| 141 | + $uploaderErrors = $uploader->getErrors(); |
|
| 142 | + } |
|
| 143 | + $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
|
| 144 | + } |
|
| 145 | + // Set Var tf_uplfile |
|
| 146 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 147 | + $filename = $_FILES['tf_uplfile']['name']; |
|
| 148 | + $imgNameDef = Request::getString('tf_text'); |
|
| 149 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 150 | + $helper->getConfig('mimetypes_file'), |
|
| 151 | + $helper->getConfig('maxsize_file'), null, null); |
|
| 152 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
|
| 153 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 154 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 155 | + $uploader->setPrefix($imgName); |
|
| 156 | + $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
|
| 157 | + if (!$uploader->upload()) { |
|
| 158 | + $errors = $uploader->getErrors(); |
|
| 159 | + } else { |
|
| 160 | + $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
|
| 161 | + } |
|
| 162 | + } else { |
|
| 163 | + if ($filename > '') { |
|
| 164 | + $uploaderErrors = $uploader->getErrors(); |
|
| 165 | + } |
|
| 166 | + $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
|
| 167 | + } |
|
| 168 | + $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
|
| 169 | + $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
|
| 170 | + // Set Var tf_selectfile |
|
| 171 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 172 | + $filename = $_FILES['tf_selectfile']['name']; |
|
| 173 | + $imgNameDef = Request::getString('tf_text'); |
|
| 174 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 175 | + $helper->getConfig('mimetypes_file'), |
|
| 176 | + $helper->getConfig('maxsize_file'), null, null); |
|
| 177 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
|
| 178 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 179 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 180 | + $uploader->setPrefix($imgName); |
|
| 181 | + $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
|
| 182 | + if (!$uploader->upload()) { |
|
| 183 | + $errors = $uploader->getErrors(); |
|
| 184 | + } else { |
|
| 185 | + $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
|
| 186 | + } |
|
| 187 | + } else { |
|
| 188 | + if ($filename > '') { |
|
| 189 | + $uploaderErrors = $uploader->getErrors(); |
|
| 190 | + } |
|
| 191 | + $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
|
| 192 | + } |
|
| 193 | + $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
|
| 194 | + // Insert Data |
|
| 195 | + if ($testfields1->insert($testfieldsObj)) { |
|
| 196 | + redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); |
|
| 197 | + } |
|
| 198 | + // Get Form Error |
|
| 199 | + $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
|
| 200 | + $form = $testfieldsObj->getFormTestfields(); |
|
| 201 | + $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
|
| 202 | 202 | |
| 203 | - break; |
|
| 203 | + break; |
|
| 204 | 204 | } |
| 205 | 205 | // Breadcrumbs |
| 206 | 206 | $xoBreadcrumbs[] = ['title' => RATE_MA_MYMODULE2_]; |
@@ -33,191 +33,191 @@ |
||
| 33 | 33 | $GLOBALS['xoTheme']->addStylesheet( $style, null ); |
| 34 | 34 | // Redirection if not permissions |
| 35 | 35 | if ($permSubmit === false) { |
| 36 | - redirect_header('index.php', 2, _NOPERM); |
|
| 37 | - exit(); |
|
| 36 | + redirect_header('index.php', 2, _NOPERM); |
|
| 37 | + exit(); |
|
| 38 | 38 | } |
| 39 | 39 | switch($op) { |
| 40 | - case 'form': |
|
| 41 | - default: |
|
| 42 | - // Navigation |
|
| 43 | - $navigation = _MA_MYMODULE2_SUBMIT_PROPOSER; |
|
| 44 | - $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
|
| 45 | - // Title of page |
|
| 46 | - $title = _MA_MYMODULE2_SUBMIT_PROPOSER . ' - '; |
|
| 47 | - $title .= $GLOBALS['xoopsModule']->name(); |
|
| 48 | - $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
|
| 49 | - // Description |
|
| 50 | - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_SUBMIT_PROPOSER)); |
|
| 51 | - // Form Create |
|
| 52 | - $testfieldsObj = $testfieldsHandler->create(); |
|
| 53 | - $form = $testfieldsObj->getFormTestfields(); |
|
| 54 | - $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
| 40 | + case 'form': |
|
| 41 | + default: |
|
| 42 | + // Navigation |
|
| 43 | + $navigation = _MA_MYMODULE2_SUBMIT_PROPOSER; |
|
| 44 | + $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
|
| 45 | + // Title of page |
|
| 46 | + $title = _MA_MYMODULE2_SUBMIT_PROPOSER . ' - '; |
|
| 47 | + $title .= $GLOBALS['xoopsModule']->name(); |
|
| 48 | + $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
|
| 49 | + // Description |
|
| 50 | + $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_SUBMIT_PROPOSER)); |
|
| 51 | + // Form Create |
|
| 52 | + $testfieldsObj = $testfieldsHandler->create(); |
|
| 53 | + $form = $testfieldsObj->getFormTestfields(); |
|
| 54 | + $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
|
| 55 | 55 | |
| 56 | - break; |
|
| 57 | - case 'save': |
|
| 58 | - // Security Check |
|
| 59 | - if ($GLOBALS['xoopsSecurity']->check()) { |
|
| 60 | - redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 61 | - } |
|
| 62 | - $testfieldsObj = $testfieldsHandler->create(); |
|
| 63 | - $error = false; |
|
| 64 | - $errorMessage = ''; |
|
| 65 | - // Test first the validation |
|
| 66 | - xoops_load('captcha'); |
|
| 67 | - $xoopsCaptcha = \XoopsCaptcha::getInstance(); |
|
| 68 | - if (!$xoopsCaptcha->verify()) { |
|
| 69 | - $errorMessage .= $xoopsCaptcha->getMessage().'<br>'; |
|
| 70 | - $error = true; |
|
| 71 | - } |
|
| 72 | - $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
|
| 73 | - $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
|
| 74 | - $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
|
| 75 | - $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
|
| 76 | - $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
|
| 77 | - $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); |
|
| 78 | - $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
|
| 79 | - $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
|
| 80 | - // Set Var tf_imagelist |
|
| 81 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 82 | - $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
|
| 83 | - $helper->getConfig('mimetypes_image'), |
|
| 84 | - $helper->getConfig('maxsize_image'), null, null); |
|
| 85 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 86 | - //$uploader->setPrefix(tf_imagelist_); |
|
| 87 | - //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
|
| 88 | - if (!$uploader->upload()) { |
|
| 89 | - $errors = $uploader->getErrors(); |
|
| 90 | - redirect_header('javascript:history.go(-1).php', 3, $errors); |
|
| 91 | - } else { |
|
| 92 | - $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
|
| 93 | - } |
|
| 94 | - } else { |
|
| 95 | - $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
|
| 96 | - } |
|
| 97 | - $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
|
| 98 | - // Set Var tf_urlfile |
|
| 99 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 100 | - $filename = $_FILES['tf_urlfile']['name']; |
|
| 101 | - $imgNameDef = Request::getString('tf_text'); |
|
| 102 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 103 | - $helper->getConfig('mimetypes_file'), |
|
| 104 | - $helper->getConfig('maxsize_file'), null, null); |
|
| 105 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
|
| 106 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 107 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 108 | - $uploader->setPrefix($imgName); |
|
| 109 | - $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
|
| 110 | - if (!$uploader->upload()) { |
|
| 111 | - $errors = $uploader->getErrors(); |
|
| 112 | - } else { |
|
| 113 | - $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
|
| 114 | - } |
|
| 115 | - } else { |
|
| 116 | - if ($filename > '') { |
|
| 117 | - $uploaderErrors = $uploader->getErrors(); |
|
| 118 | - } |
|
| 119 | - $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
|
| 120 | - } |
|
| 121 | - // Set Var tf_uplimage |
|
| 122 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 123 | - $filename = $_FILES['tf_uplimage']['name']; |
|
| 124 | - $imgMimetype = $_FILES['tf_uplimage']['type']; |
|
| 125 | - $imgNameDef = Request::getString('tf_text'); |
|
| 126 | - $uploaderErrors = ''; |
|
| 127 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
|
| 128 | - $helper->getConfig('mimetypes_image'), |
|
| 129 | - $helper->getConfig('maxsize_image'), null, null); |
|
| 130 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
|
| 131 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 132 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 133 | - $uploader->setPrefix($imgName); |
|
| 134 | - $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
|
| 135 | - if (!$uploader->upload()) { |
|
| 136 | - $uploaderErrors = $uploader->getErrors(); |
|
| 137 | - } else { |
|
| 138 | - $savedFilename = $uploader->getSavedFileName(); |
|
| 139 | - $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
|
| 140 | - $maxheight = (int)$helper->getConfig('maxheight_image'); |
|
| 141 | - if ($maxwidth > 0 && $maxheight > 0) { |
|
| 142 | - // Resize image |
|
| 143 | - $imgHandler = new Mymodule2\Common\Resizer(); |
|
| 144 | - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 145 | - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 146 | - $imgHandler->imageMimetype = $imgMimetype; |
|
| 147 | - $imgHandler->maxWidth = $maxwidth; |
|
| 148 | - $imgHandler->maxHeight = $maxheight; |
|
| 149 | - $result = $imgHandler->resizeImage(); |
|
| 150 | - } |
|
| 151 | - $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
|
| 152 | - } |
|
| 153 | - } else { |
|
| 154 | - if ($filename > '') { |
|
| 155 | - $uploaderErrors = $uploader->getErrors(); |
|
| 156 | - } |
|
| 157 | - $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
|
| 158 | - } |
|
| 159 | - // Set Var tf_uplfile |
|
| 160 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 161 | - $filename = $_FILES['tf_uplfile']['name']; |
|
| 162 | - $imgNameDef = Request::getString('tf_text'); |
|
| 163 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 164 | - $helper->getConfig('mimetypes_file'), |
|
| 165 | - $helper->getConfig('maxsize_file'), null, null); |
|
| 166 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
|
| 167 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 168 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 169 | - $uploader->setPrefix($imgName); |
|
| 170 | - $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
|
| 171 | - if (!$uploader->upload()) { |
|
| 172 | - $errors = $uploader->getErrors(); |
|
| 173 | - } else { |
|
| 174 | - $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
|
| 175 | - } |
|
| 176 | - } else { |
|
| 177 | - if ($filename > '') { |
|
| 178 | - $uploaderErrors = $uploader->getErrors(); |
|
| 179 | - } |
|
| 180 | - $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
|
| 181 | - } |
|
| 182 | - $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
|
| 183 | - $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
|
| 184 | - // Set Var tf_selectfile |
|
| 185 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 186 | - $filename = $_FILES['tf_selectfile']['name']; |
|
| 187 | - $imgNameDef = Request::getString('tf_text'); |
|
| 188 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 189 | - $helper->getConfig('mimetypes_file'), |
|
| 190 | - $helper->getConfig('maxsize_file'), null, null); |
|
| 191 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
|
| 192 | - $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 193 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 194 | - $uploader->setPrefix($imgName); |
|
| 195 | - $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
|
| 196 | - if (!$uploader->upload()) { |
|
| 197 | - $errors = $uploader->getErrors(); |
|
| 198 | - } else { |
|
| 199 | - $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
|
| 200 | - } |
|
| 201 | - } else { |
|
| 202 | - if ($filename > '') { |
|
| 203 | - $uploaderErrors = $uploader->getErrors(); |
|
| 204 | - } |
|
| 205 | - $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
|
| 206 | - } |
|
| 207 | - $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
|
| 208 | - if ($error === true) { |
|
| 209 | - $GLOBALS['xoopsTpl']->assign('error_message', $errorMessage); |
|
| 210 | - } else { |
|
| 211 | - // Insert Data |
|
| 212 | - if ($testfields1->insert($testfieldsObj)) { |
|
| 213 | - redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - // Get Form Error |
|
| 217 | - $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
|
| 218 | - $form = $testfieldsObj->getFormTestfields(); |
|
| 219 | - $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
|
| 56 | + break; |
|
| 57 | + case 'save': |
|
| 58 | + // Security Check |
|
| 59 | + if ($GLOBALS['xoopsSecurity']->check()) { |
|
| 60 | + redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 61 | + } |
|
| 62 | + $testfieldsObj = $testfieldsHandler->create(); |
|
| 63 | + $error = false; |
|
| 64 | + $errorMessage = ''; |
|
| 65 | + // Test first the validation |
|
| 66 | + xoops_load('captcha'); |
|
| 67 | + $xoopsCaptcha = \XoopsCaptcha::getInstance(); |
|
| 68 | + if (!$xoopsCaptcha->verify()) { |
|
| 69 | + $errorMessage .= $xoopsCaptcha->getMessage().'<br>'; |
|
| 70 | + $error = true; |
|
| 71 | + } |
|
| 72 | + $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
|
| 73 | + $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
|
| 74 | + $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
|
| 75 | + $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
|
| 76 | + $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
|
| 77 | + $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); |
|
| 78 | + $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
|
| 79 | + $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
|
| 80 | + // Set Var tf_imagelist |
|
| 81 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 82 | + $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
|
| 83 | + $helper->getConfig('mimetypes_image'), |
|
| 84 | + $helper->getConfig('maxsize_image'), null, null); |
|
| 85 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 86 | + //$uploader->setPrefix(tf_imagelist_); |
|
| 87 | + //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
|
| 88 | + if (!$uploader->upload()) { |
|
| 89 | + $errors = $uploader->getErrors(); |
|
| 90 | + redirect_header('javascript:history.go(-1).php', 3, $errors); |
|
| 91 | + } else { |
|
| 92 | + $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
|
| 93 | + } |
|
| 94 | + } else { |
|
| 95 | + $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
|
| 96 | + } |
|
| 97 | + $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
|
| 98 | + // Set Var tf_urlfile |
|
| 99 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 100 | + $filename = $_FILES['tf_urlfile']['name']; |
|
| 101 | + $imgNameDef = Request::getString('tf_text'); |
|
| 102 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 103 | + $helper->getConfig('mimetypes_file'), |
|
| 104 | + $helper->getConfig('maxsize_file'), null, null); |
|
| 105 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
|
| 106 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 107 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 108 | + $uploader->setPrefix($imgName); |
|
| 109 | + $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
|
| 110 | + if (!$uploader->upload()) { |
|
| 111 | + $errors = $uploader->getErrors(); |
|
| 112 | + } else { |
|
| 113 | + $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
|
| 114 | + } |
|
| 115 | + } else { |
|
| 116 | + if ($filename > '') { |
|
| 117 | + $uploaderErrors = $uploader->getErrors(); |
|
| 118 | + } |
|
| 119 | + $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
|
| 120 | + } |
|
| 121 | + // Set Var tf_uplimage |
|
| 122 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 123 | + $filename = $_FILES['tf_uplimage']['name']; |
|
| 124 | + $imgMimetype = $_FILES['tf_uplimage']['type']; |
|
| 125 | + $imgNameDef = Request::getString('tf_text'); |
|
| 126 | + $uploaderErrors = ''; |
|
| 127 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
|
| 128 | + $helper->getConfig('mimetypes_image'), |
|
| 129 | + $helper->getConfig('maxsize_image'), null, null); |
|
| 130 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
|
| 131 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 132 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 133 | + $uploader->setPrefix($imgName); |
|
| 134 | + $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
|
| 135 | + if (!$uploader->upload()) { |
|
| 136 | + $uploaderErrors = $uploader->getErrors(); |
|
| 137 | + } else { |
|
| 138 | + $savedFilename = $uploader->getSavedFileName(); |
|
| 139 | + $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
|
| 140 | + $maxheight = (int)$helper->getConfig('maxheight_image'); |
|
| 141 | + if ($maxwidth > 0 && $maxheight > 0) { |
|
| 142 | + // Resize image |
|
| 143 | + $imgHandler = new Mymodule2\Common\Resizer(); |
|
| 144 | + $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 145 | + $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 146 | + $imgHandler->imageMimetype = $imgMimetype; |
|
| 147 | + $imgHandler->maxWidth = $maxwidth; |
|
| 148 | + $imgHandler->maxHeight = $maxheight; |
|
| 149 | + $result = $imgHandler->resizeImage(); |
|
| 150 | + } |
|
| 151 | + $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
|
| 152 | + } |
|
| 153 | + } else { |
|
| 154 | + if ($filename > '') { |
|
| 155 | + $uploaderErrors = $uploader->getErrors(); |
|
| 156 | + } |
|
| 157 | + $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
|
| 158 | + } |
|
| 159 | + // Set Var tf_uplfile |
|
| 160 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 161 | + $filename = $_FILES['tf_uplfile']['name']; |
|
| 162 | + $imgNameDef = Request::getString('tf_text'); |
|
| 163 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 164 | + $helper->getConfig('mimetypes_file'), |
|
| 165 | + $helper->getConfig('maxsize_file'), null, null); |
|
| 166 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
|
| 167 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 168 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 169 | + $uploader->setPrefix($imgName); |
|
| 170 | + $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
|
| 171 | + if (!$uploader->upload()) { |
|
| 172 | + $errors = $uploader->getErrors(); |
|
| 173 | + } else { |
|
| 174 | + $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
|
| 175 | + } |
|
| 176 | + } else { |
|
| 177 | + if ($filename > '') { |
|
| 178 | + $uploaderErrors = $uploader->getErrors(); |
|
| 179 | + } |
|
| 180 | + $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
|
| 181 | + } |
|
| 182 | + $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
|
| 183 | + $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
|
| 184 | + // Set Var tf_selectfile |
|
| 185 | + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 186 | + $filename = $_FILES['tf_selectfile']['name']; |
|
| 187 | + $imgNameDef = Request::getString('tf_text'); |
|
| 188 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 189 | + $helper->getConfig('mimetypes_file'), |
|
| 190 | + $helper->getConfig('maxsize_file'), null, null); |
|
| 191 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
|
| 192 | + $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
|
| 193 | + $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 194 | + $uploader->setPrefix($imgName); |
|
| 195 | + $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
|
| 196 | + if (!$uploader->upload()) { |
|
| 197 | + $errors = $uploader->getErrors(); |
|
| 198 | + } else { |
|
| 199 | + $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
|
| 200 | + } |
|
| 201 | + } else { |
|
| 202 | + if ($filename > '') { |
|
| 203 | + $uploaderErrors = $uploader->getErrors(); |
|
| 204 | + } |
|
| 205 | + $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
|
| 206 | + } |
|
| 207 | + $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
|
| 208 | + if ($error === true) { |
|
| 209 | + $GLOBALS['xoopsTpl']->assign('error_message', $errorMessage); |
|
| 210 | + } else { |
|
| 211 | + // Insert Data |
|
| 212 | + if ($testfields1->insert($testfieldsObj)) { |
|
| 213 | + redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + // Get Form Error |
|
| 217 | + $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
|
| 218 | + $form = $testfieldsObj->getFormTestfields(); |
|
| 219 | + $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
|
| 220 | 220 | |
| 221 | - break; |
|
| 221 | + break; |
|
| 222 | 222 | } |
| 223 | 223 | require __DIR__ . '/footer.php'; |
@@ -38,29 +38,29 @@ discard block |
||
| 38 | 38 | $GLOBALS['xoopsTpl']->assign('articlesCount', $articlesCount); |
| 39 | 39 | $count = 1; |
| 40 | 40 | if ($articlesCount > 0) { |
| 41 | - $start = Request::getInt('start', 0); |
|
| 42 | - $limit = Request::getInt('limit', $helper->getConfig('userpager')); |
|
| 43 | - $articlesAll = $articlesHandler->getAllArticles($start, $limit); |
|
| 44 | - // Get All Articles |
|
| 45 | - $articles = []; |
|
| 46 | - foreach(array_keys($articlesAll) as $i) { |
|
| 47 | - $article = $articlesAll[$i]->getValuesArticles(); |
|
| 48 | - $acount = ['count', $count]; |
|
| 49 | - $articles[] = array_merge($article, $acount); |
|
| 50 | - $keywords[] = $articlesAll[$i]->getVar('tf_text'); |
|
| 51 | - ++$count; |
|
| 52 | - } |
|
| 53 | - $GLOBALS['xoopsTpl']->assign('articles', $articles); |
|
| 54 | - unset($articles); |
|
| 55 | - // Display Navigation |
|
| 56 | - if ($articlesCount > $limit) { |
|
| 57 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 58 | - $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 59 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 60 | - } |
|
| 61 | - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $articlesCount)); |
|
| 62 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 63 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 41 | + $start = Request::getInt('start', 0); |
|
| 42 | + $limit = Request::getInt('limit', $helper->getConfig('userpager')); |
|
| 43 | + $articlesAll = $articlesHandler->getAllArticles($start, $limit); |
|
| 44 | + // Get All Articles |
|
| 45 | + $articles = []; |
|
| 46 | + foreach(array_keys($articlesAll) as $i) { |
|
| 47 | + $article = $articlesAll[$i]->getValuesArticles(); |
|
| 48 | + $acount = ['count', $count]; |
|
| 49 | + $articles[] = array_merge($article, $acount); |
|
| 50 | + $keywords[] = $articlesAll[$i]->getVar('tf_text'); |
|
| 51 | + ++$count; |
|
| 52 | + } |
|
| 53 | + $GLOBALS['xoopsTpl']->assign('articles', $articles); |
|
| 54 | + unset($articles); |
|
| 55 | + // Display Navigation |
|
| 56 | + if ($articlesCount > $limit) { |
|
| 57 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 58 | + $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 59 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 60 | + } |
|
| 61 | + $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $articlesCount)); |
|
| 62 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 63 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 64 | 64 | } |
| 65 | 65 | unset($count); |
| 66 | 66 | $GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); |
@@ -72,29 +72,29 @@ discard block |
||
| 72 | 72 | $GLOBALS['xoopsTpl']->assign('testfieldsCount', $testfieldsCount); |
| 73 | 73 | $count = 1; |
| 74 | 74 | if ($testfieldsCount > 0) { |
| 75 | - $start = Request::getInt('start', 0); |
|
| 76 | - $limit = Request::getInt('limit', $helper->getConfig('userpager')); |
|
| 77 | - $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); |
|
| 78 | - // Get All Testfields |
|
| 79 | - $testfields = []; |
|
| 80 | - foreach(array_keys($testfieldsAll) as $i) { |
|
| 81 | - $testfield = $testfieldsAll[$i]->getValuesTestfields(); |
|
| 82 | - $acount = ['count', $count]; |
|
| 83 | - $testfields[] = array_merge($testfield, $acount); |
|
| 84 | - $keywords[] = $testfieldsAll[$i]->getVar('tf_text'); |
|
| 85 | - ++$count; |
|
| 86 | - } |
|
| 87 | - $GLOBALS['xoopsTpl']->assign('testfields', $testfields); |
|
| 88 | - unset($testfields); |
|
| 89 | - // Display Navigation |
|
| 90 | - if ($testfieldsCount > $limit) { |
|
| 91 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 92 | - $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 93 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 94 | - } |
|
| 95 | - $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $testfieldsCount)); |
|
| 96 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 97 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 75 | + $start = Request::getInt('start', 0); |
|
| 76 | + $limit = Request::getInt('limit', $helper->getConfig('userpager')); |
|
| 77 | + $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); |
|
| 78 | + // Get All Testfields |
|
| 79 | + $testfields = []; |
|
| 80 | + foreach(array_keys($testfieldsAll) as $i) { |
|
| 81 | + $testfield = $testfieldsAll[$i]->getValuesTestfields(); |
|
| 82 | + $acount = ['count', $count]; |
|
| 83 | + $testfields[] = array_merge($testfield, $acount); |
|
| 84 | + $keywords[] = $testfieldsAll[$i]->getVar('tf_text'); |
|
| 85 | + ++$count; |
|
| 86 | + } |
|
| 87 | + $GLOBALS['xoopsTpl']->assign('testfields', $testfields); |
|
| 88 | + unset($testfields); |
|
| 89 | + // Display Navigation |
|
| 90 | + if ($testfieldsCount > $limit) { |
|
| 91 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 92 | + $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
| 93 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
| 94 | + } |
|
| 95 | + $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $testfieldsCount)); |
|
| 96 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
| 97 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
| 98 | 98 | } |
| 99 | 99 | unset($count); |
| 100 | 100 | $GLOBALS['xoopsTpl']->assign('table_type', $helper->getConfig('table_type')); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // Define Stylesheet |
| 30 | 30 | $GLOBALS['xoTheme']->addStylesheet( $style, null ); |
| 31 | 31 | if (empty($tfId)) { |
| 32 | - redirect_header(MYMODULE2_URL . '/index.php', 2, _MA_MYMODULE2_NOTFID); |
|
| 32 | + redirect_header(MYMODULE2_URL . '/index.php', 2, _MA_MYMODULE2_NOTFID); |
|
| 33 | 33 | } |
| 34 | 34 | // Get Instance of Handler |
| 35 | 35 | $testfieldsHandler = $helper->getHandler('testfields'); |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | $testfields = $testfieldsHandler->get($tfId); |
| 38 | 38 | // Verify permissions |
| 39 | 39 | if (!$grouppermHandler->checkRight('mymodule2_view', $tfId->getVar('tf_id'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) { |
| 40 | - redirect_header(MYMODULE2_URL . '/index.php', 3, _NOPERM); |
|
| 41 | - exit(); |
|
| 40 | + redirect_header(MYMODULE2_URL . '/index.php', 3, _NOPERM); |
|
| 41 | + exit(); |
|
| 42 | 42 | } |
| 43 | 43 | $testfield = $testfields->getValuesTestfields(); |
| 44 | 44 | foreach($testfield as $k => $v) { |
| 45 | - $GLOBALS['xoopsTpl']->append('"{$k}"', $v); |
|
| 45 | + $GLOBALS['xoopsTpl']->append('"{$k}"', $v); |
|
| 46 | 46 | } |
| 47 | 47 | $GLOBALS['xoopsTpl']->assign('xoops_sitename', $GLOBALS['xoopsConfig']['sitename']); |
| 48 | 48 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', strip_tags($testfield->getVar('tf_text') - _MA_MYMODULE2_PRINT - $GLOBALS['xoopsModule']->name())); |