@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | function mymodule2_search($queryarray, $andor, $limit, $offset, $userid) |
| 33 | 33 | { |
| 34 | 34 | global $xoopsDB; |
| 35 | - $sql = "SELECT 'tf_id', 'tf_text' FROM " . $xoopsDB->prefix('mymodule2_testfields') . ' WHERE tf_id != 0'; |
|
| 36 | - if ( $userid != 0 ) { |
|
| 35 | + $sql = "SELECT 'tf_id', 'tf_text' FROM ".$xoopsDB->prefix('mymodule2_testfields').' WHERE tf_id != 0'; |
|
| 36 | + if ($userid != 0) { |
|
| 37 | 37 | $sql .= ' AND tf_submitter='.(int)$userid; |
| 38 | 38 | } |
| 39 | - if ( is_array($queryarray) && $count = count($queryarray) ) |
|
| 39 | + if (is_array($queryarray) && $count = count($queryarray)) |
|
| 40 | 40 | { |
| 41 | 41 | $sql .= " AND (()"; |
| 42 | - for($i = 1; $i < $count; ++$i) |
|
| 42 | + for ($i = 1; $i < $count; ++$i) |
|
| 43 | 43 | { |
| 44 | 44 | $sql .= " $andor "; |
| 45 | 45 | $sql .= "()"; |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | $sql .= ')'; |
| 48 | 48 | } |
| 49 | 49 | $sql .= " ORDER BY 'tf_id' DESC"; |
| 50 | - $result = $xoopsDB->query($sql,$limit,$offset); |
|
| 50 | + $result = $xoopsDB->query($sql, $limit, $offset); |
|
| 51 | 51 | $ret = array(); |
| 52 | 52 | $i = 0; |
| 53 | - while($myrow = $xoopsDB->fetchArray($result)) |
|
| 53 | + while ($myrow = $xoopsDB->fetchArray($result)) |
|
| 54 | 54 | { |
| 55 | 55 | $ret[$i]['image'] = 'assets/icons/32/blank.gif'; |
| 56 | 56 | $ret[$i]['link'] = 'testfields.php?tf_id='.$myrow['tf_id']; |
@@ -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) |
@@ -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(); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | global $xoopsDB; |
| 63 | 63 | $result = $xoopsDB->query( |
| 64 | - 'SELECT t1.tpl_id FROM ' . $xoopsDB->prefix('tplfile') . ' t1, ' . $xoopsDB->prefix('tplfile') . ' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id' |
|
| 64 | + 'SELECT t1.tpl_id FROM '.$xoopsDB->prefix('tplfile').' t1, '.$xoopsDB->prefix('tplfile').' t2 WHERE t1.tpl_refid = t2.tpl_refid AND t1.tpl_module = t2.tpl_module AND t1.tpl_tplset=t2.tpl_tplset AND t1.tpl_file = t2.tpl_file AND t1.tpl_type = t2.tpl_type AND t1.tpl_id > t2.tpl_id' |
|
| 65 | 65 | ); |
| 66 | 66 | $tplids = []; |
| 67 | 67 | while (false !== (list($tplid) = $xoopsDB->fetchRow($result))) { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | if (count($tplids) > 0) { |
| 71 | 71 | $tplfileHandler = xoops_getHandler('tplfile'); |
| 72 | - $duplicate_files = $tplfileHandler->getObjects(new \Criteria('tpl_id', '(' . implode(',', $tplids) . ')', 'IN')); |
|
| 72 | + $duplicate_files = $tplfileHandler->getObjects(new \Criteria('tpl_id', '('.implode(',', $tplids).')', 'IN')); |
|
| 73 | 73 | |
| 74 | 74 | if (count($duplicate_files) > 0) { |
| 75 | 75 | foreach (array_keys($duplicate_files) as $i) { |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | - $sql = 'SHOW INDEX FROM ' . $xoopsDB->prefix('tplfile') . " WHERE KEY_NAME = 'tpl_refid_module_set_file_type'"; |
|
| 80 | + $sql = 'SHOW INDEX FROM '.$xoopsDB->prefix('tplfile')." WHERE KEY_NAME = 'tpl_refid_module_set_file_type'"; |
|
| 81 | 81 | if (!$result = $xoopsDB->queryF($sql)) { |
| 82 | - xoops_error($xoopsDB->error() . '<br>' . $sql); |
|
| 82 | + xoops_error($xoopsDB->error().'<br>'.$sql); |
|
| 83 | 83 | |
| 84 | 84 | return false; |
| 85 | 85 | } |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | return true; |
| 94 | 94 | } |
| 95 | - $sql = 'ALTER TABLE ' . $xoopsDB->prefix('tplfile') . ' ADD UNIQUE tpl_refid_module_set_file_type ( tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type )'; |
|
| 95 | + $sql = 'ALTER TABLE '.$xoopsDB->prefix('tplfile').' ADD UNIQUE tpl_refid_module_set_file_type ( tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type )'; |
|
| 96 | 96 | if (!$result = $xoopsDB->queryF($sql)) { |
| 97 | - xoops_error($xoopsDB->error() . '<br>' . $sql); |
|
| 97 | + xoops_error($xoopsDB->error().'<br>'.$sql); |
|
| 98 | 98 | $module->setErrors("'tpl_refid_module_set_file_type' unique index is not added to 'tplfile' table. Warning: do not use XOOPS until you add this unique index."); |
| 99 | 99 | |
| 100 | 100 | return false; |
@@ -19,5 +19,5 @@ |
||
| 19 | 19 | * @min_xoops 2.5.9 |
| 20 | 20 | * @author TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org> |
| 21 | 21 | */ |
| 22 | -require __DIR__ . '/header.php'; |
|
| 23 | -include XOOPS_ROOT_PATH . '/modules/tag/list.tag.php'; |
|
| 22 | +require __DIR__.'/header.php'; |
|
| 23 | +include XOOPS_ROOT_PATH.'/modules/tag/list.tag.php'; |
|
@@ -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 |
@@ -24,15 +24,15 @@ discard block |
||
| 24 | 24 | use XoopsModules\Mymodule2; |
| 25 | 25 | use XoopsModules\Mymodule2\Constants; |
| 26 | 26 | |
| 27 | -require __DIR__ . '/header.php'; |
|
| 27 | +require __DIR__.'/header.php'; |
|
| 28 | 28 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_articles.tpl'; |
| 29 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 29 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 30 | 30 | |
| 31 | 31 | $start = Request::getInt('start', 0); |
| 32 | 32 | $limit = Request::getInt('limit', $helper->getConfig('userpager')); |
| 33 | 33 | |
| 34 | 34 | // Define Stylesheet |
| 35 | -$GLOBALS['xoTheme']->addStylesheet( $style, null ); |
|
| 35 | +$GLOBALS['xoTheme']->addStylesheet($style, null); |
|
| 36 | 36 | |
| 37 | 37 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); |
| 38 | 38 | $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ($articlesCount > 0) { |
| 45 | 45 | $articles = []; |
| 46 | 46 | // Get All Articles |
| 47 | - foreach(array_keys($articlesAll) as $i) { |
|
| 47 | + foreach (array_keys($articlesAll) as $i) { |
|
| 48 | 48 | $articles[] = $articlesAll[$i]->getValuesArticles(); |
| 49 | 49 | $keywords[] = $articlesAll[$i]->getVar('art_title'); |
| 50 | 50 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | unset($articles); |
| 53 | 53 | // Display Navigation |
| 54 | 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); |
|
| 55 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 56 | + $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
| 57 | 57 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
| 58 | 58 | } |
| 59 | 59 | $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_ARTICLES]; |
| 66 | 66 | |
| 67 | 67 | // Keywords |
| 68 | -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); |
|
| 68 | +mymodule2MetaKeywords($helper->getConfig('keywords').', '.implode(',', $keywords)); |
|
| 69 | 69 | unset($keywords); |
| 70 | 70 | |
| 71 | 71 | // Description |
| 72 | 72 | mymodule2MetaDescription(_MA_MYMODULE2_ARTICLES_DESC); |
| 73 | 73 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/articles.php'); |
| 74 | 74 | $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); |
| 75 | -require __DIR__ . '/footer.php'; |
|
| 75 | +require __DIR__.'/footer.php'; |
|
@@ -24,21 +24,21 @@ |
||
| 24 | 24 | use XoopsModules\Mymodule2; |
| 25 | 25 | use XoopsModules\Mymodule2\Constants; |
| 26 | 26 | |
| 27 | -require __DIR__ . '/header.php'; |
|
| 27 | +require __DIR__.'/header.php'; |
|
| 28 | 28 | $tfId = Request::getInt('tf_id', 0); |
| 29 | 29 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_single.tpl'; |
| 30 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 30 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 31 | 31 | // Define Stylesheet |
| 32 | -$GLOBALS['xoTheme']->addStylesheet( $style, null ); |
|
| 32 | +$GLOBALS['xoTheme']->addStylesheet($style, null); |
|
| 33 | 33 | $keywords = array(); |
| 34 | 34 | // Breadcrumbs |
| 35 | 35 | $xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_TESTFIELDS]; |
| 36 | 36 | // Keywords |
| 37 | -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); |
|
| 37 | +mymodule2MetaKeywords($helper->getConfig('keywords').', '.implode(',', $keywords)); |
|
| 38 | 38 | unset($keywords); |
| 39 | 39 | // Description |
| 40 | 40 | mymodule2MetaDescription(_MA_MYMODULE2_TESTFIELDS_DESC); |
| 41 | 41 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/index.php'); |
| 42 | 42 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); |
| 43 | 43 | $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); |
| 44 | -require __DIR__ . '/footer.php'; |
|
| 44 | +require __DIR__.'/footer.php'; |
|
@@ -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_]; |
@@ -24,25 +24,25 @@ discard block |
||
| 24 | 24 | use XoopsModules\Mymodule2; |
| 25 | 25 | use XoopsModules\Mymodule2\Constants; |
| 26 | 26 | |
| 27 | -require __DIR__ . '/header.php'; |
|
| 27 | +require __DIR__.'/header.php'; |
|
| 28 | 28 | $op = Request::getString('op', 'form'); |
| 29 | 29 | $lid = Request::getInt('lid'); |
| 30 | 30 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_testfields.tpl'; |
| 31 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 31 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 32 | 32 | // Define Stylesheet |
| 33 | -$GLOBALS['xoTheme']->addStylesheet( $style, null ); |
|
| 34 | - switch($op) { |
|
| 33 | +$GLOBALS['xoTheme']->addStylesheet($style, null); |
|
| 34 | + switch ($op) { |
|
| 35 | 35 | case 'form': |
| 36 | 36 | default: |
| 37 | 37 | // Navigation |
| 38 | 38 | $navigation = _MA_MYMODULE2_RATE; |
| 39 | 39 | $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
| 40 | 40 | // Title of page |
| 41 | - $title = _MA_MYMODULE2_RATE . ' - '; |
|
| 41 | + $title = _MA_MYMODULE2_RATE.' - '; |
|
| 42 | 42 | $title .= $GLOBALS['xoopsModule']->name(); |
| 43 | 43 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
| 44 | 44 | // Description |
| 45 | - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_RATE)); |
|
| 45 | + $GLOBALS['xoTheme']->addMeta('meta', 'description', strip_tags(_MA_MYMODULE2_RATE)); |
|
| 46 | 46 | // Form Create |
| 47 | 47 | $testfieldsObj = $testfieldsHandler->create(); |
| 48 | 48 | $form = $testfieldsObj->getFormTestfields(); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
| 65 | 65 | $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
| 66 | 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', |
|
| 67 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 68 | + $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH.'/Frameworks/moduleclasses/icons/32', |
|
| 69 | 69 | $helper->getConfig('mimetypes_image'), |
| 70 | 70 | $helper->getConfig('maxsize_image'), null, null); |
| 71 | 71 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
| 84 | 84 | // Set Var tf_urlfile |
| 85 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 85 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 86 | 86 | $filename = $_FILES['tf_urlfile']['name']; |
| 87 | 87 | $imgNameDef = Request::getString('tf_text'); |
| 88 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 88 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', |
|
| 89 | 89 | $helper->getConfig('mimetypes_file'), |
| 90 | 90 | $helper->getConfig('maxsize_file'), null, null); |
| 91 | 91 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
| 92 | 92 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 93 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 93 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 94 | 94 | $uploader->setPrefix($imgName); |
| 95 | 95 | $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
| 96 | 96 | if (!$uploader->upload()) { |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
| 106 | 106 | } |
| 107 | 107 | // Set Var tf_uplimage |
| 108 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 108 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 109 | 109 | $filename = $_FILES['tf_uplimage']['name']; |
| 110 | 110 | $imgMimetype = $_FILES['tf_uplimage']['type']; |
| 111 | 111 | $imgNameDef = Request::getString('tf_text'); |
| 112 | 112 | $uploaderErrors = ''; |
| 113 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
|
| 113 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/', |
|
| 114 | 114 | $helper->getConfig('mimetypes_image'), |
| 115 | 115 | $helper->getConfig('maxsize_image'), null, null); |
| 116 | 116 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
| 117 | 117 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 118 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 118 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 119 | 119 | $uploader->setPrefix($imgName); |
| 120 | 120 | $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
| 121 | 121 | if (!$uploader->upload()) { |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | if ($maxwidth > 0 && $maxheight > 0) { |
| 128 | 128 | // Resize image |
| 129 | 129 | $imgHandler = new Mymodule2\Common\Resizer(); |
| 130 | - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 131 | - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 130 | + $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/'.$savedFilename; |
|
| 131 | + $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/'.$savedFilename; |
|
| 132 | 132 | $imgHandler->imageMimetype = $imgMimetype; |
| 133 | 133 | $imgHandler->maxWidth = $maxwidth; |
| 134 | 134 | $imgHandler->maxHeight = $maxheight; |
@@ -143,15 +143,15 @@ discard block |
||
| 143 | 143 | $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
| 144 | 144 | } |
| 145 | 145 | // Set Var tf_uplfile |
| 146 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 146 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 147 | 147 | $filename = $_FILES['tf_uplfile']['name']; |
| 148 | 148 | $imgNameDef = Request::getString('tf_text'); |
| 149 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 149 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', |
|
| 150 | 150 | $helper->getConfig('mimetypes_file'), |
| 151 | 151 | $helper->getConfig('maxsize_file'), null, null); |
| 152 | 152 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
| 153 | 153 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 154 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 154 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 155 | 155 | $uploader->setPrefix($imgName); |
| 156 | 156 | $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
| 157 | 157 | if (!$uploader->upload()) { |
@@ -168,15 +168,15 @@ discard block |
||
| 168 | 168 | $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
| 169 | 169 | $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
| 170 | 170 | // Set Var tf_selectfile |
| 171 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 171 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 172 | 172 | $filename = $_FILES['tf_selectfile']['name']; |
| 173 | 173 | $imgNameDef = Request::getString('tf_text'); |
| 174 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 174 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', |
|
| 175 | 175 | $helper->getConfig('mimetypes_file'), |
| 176 | 176 | $helper->getConfig('maxsize_file'), null, null); |
| 177 | 177 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
| 178 | 178 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 179 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 179 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 180 | 180 | $uploader->setPrefix($imgName); |
| 181 | 181 | $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
| 182 | 182 | if (!$uploader->upload()) { |
@@ -204,4 +204,4 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | // Breadcrumbs |
| 206 | 206 | $xoBreadcrumbs[] = ['title' => RATE_MA_MYMODULE2_]; |
| 207 | -require __DIR__ . '/footer.php'; |
|
| 207 | +require __DIR__.'/footer.php'; |
|
@@ -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'; |
@@ -37,187 +37,187 @@ |
||
| 37 | 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'; |
@@ -24,30 +24,30 @@ discard block |
||
| 24 | 24 | use XoopsModules\Mymodule2; |
| 25 | 25 | use XoopsModules\Mymodule2\Constants; |
| 26 | 26 | |
| 27 | -require __DIR__ . '/header.php'; |
|
| 27 | +require __DIR__.'/header.php'; |
|
| 28 | 28 | $op = Request::getString('op', 'list'); |
| 29 | 29 | $tfId = Request::getInt('tf_id'); |
| 30 | 30 | // Template |
| 31 | 31 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_broken.tpl'; |
| 32 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 33 | -$GLOBALS['xoTheme']->addStylesheet( $style, null ); |
|
| 32 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 33 | +$GLOBALS['xoTheme']->addStylesheet($style, null); |
|
| 34 | 34 | // Redirection if not permissions |
| 35 | 35 | if ($permSubmit === false) { |
| 36 | 36 | redirect_header('index.php', 2, _NOPERM); |
| 37 | 37 | exit(); |
| 38 | 38 | } |
| 39 | -switch($op) { |
|
| 39 | +switch ($op) { |
|
| 40 | 40 | case 'form': |
| 41 | 41 | default: |
| 42 | 42 | // Navigation |
| 43 | 43 | $navigation = _MA_MYMODULE2_SUBMIT_PROPOSER; |
| 44 | 44 | $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
| 45 | 45 | // Title of page |
| 46 | - $title = _MA_MYMODULE2_SUBMIT_PROPOSER . ' - '; |
|
| 46 | + $title = _MA_MYMODULE2_SUBMIT_PROPOSER.' - '; |
|
| 47 | 47 | $title .= $GLOBALS['xoopsModule']->name(); |
| 48 | 48 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
| 49 | 49 | // Description |
| 50 | - $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_SUBMIT_PROPOSER)); |
|
| 50 | + $GLOBALS['xoTheme']->addMeta('meta', 'description', strip_tags(_MA_MYMODULE2_SUBMIT_PROPOSER)); |
|
| 51 | 51 | // Form Create |
| 52 | 52 | $testfieldsObj = $testfieldsHandler->create(); |
| 53 | 53 | $form = $testfieldsObj->getFormTestfields(); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
| 79 | 79 | $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
| 80 | 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', |
|
| 81 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 82 | + $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH.'/Frameworks/moduleclasses/icons/32', |
|
| 83 | 83 | $helper->getConfig('mimetypes_image'), |
| 84 | 84 | $helper->getConfig('maxsize_image'), null, null); |
| 85 | 85 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
| 98 | 98 | // Set Var tf_urlfile |
| 99 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 99 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 100 | 100 | $filename = $_FILES['tf_urlfile']['name']; |
| 101 | 101 | $imgNameDef = Request::getString('tf_text'); |
| 102 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 102 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', |
|
| 103 | 103 | $helper->getConfig('mimetypes_file'), |
| 104 | 104 | $helper->getConfig('maxsize_file'), null, null); |
| 105 | 105 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
| 106 | 106 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 107 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 107 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 108 | 108 | $uploader->setPrefix($imgName); |
| 109 | 109 | $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
| 110 | 110 | if (!$uploader->upload()) { |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
| 120 | 120 | } |
| 121 | 121 | // Set Var tf_uplimage |
| 122 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 122 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 123 | 123 | $filename = $_FILES['tf_uplimage']['name']; |
| 124 | 124 | $imgMimetype = $_FILES['tf_uplimage']['type']; |
| 125 | 125 | $imgNameDef = Request::getString('tf_text'); |
| 126 | 126 | $uploaderErrors = ''; |
| 127 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
|
| 127 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/', |
|
| 128 | 128 | $helper->getConfig('mimetypes_image'), |
| 129 | 129 | $helper->getConfig('maxsize_image'), null, null); |
| 130 | 130 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
| 131 | 131 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 132 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 132 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 133 | 133 | $uploader->setPrefix($imgName); |
| 134 | 134 | $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
| 135 | 135 | if (!$uploader->upload()) { |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | if ($maxwidth > 0 && $maxheight > 0) { |
| 142 | 142 | // Resize image |
| 143 | 143 | $imgHandler = new Mymodule2\Common\Resizer(); |
| 144 | - $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 145 | - $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
|
| 144 | + $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/'.$savedFilename; |
|
| 145 | + $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/'.$savedFilename; |
|
| 146 | 146 | $imgHandler->imageMimetype = $imgMimetype; |
| 147 | 147 | $imgHandler->maxWidth = $maxwidth; |
| 148 | 148 | $imgHandler->maxHeight = $maxheight; |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
| 158 | 158 | } |
| 159 | 159 | // Set Var tf_uplfile |
| 160 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 160 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 161 | 161 | $filename = $_FILES['tf_uplfile']['name']; |
| 162 | 162 | $imgNameDef = Request::getString('tf_text'); |
| 163 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 163 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', |
|
| 164 | 164 | $helper->getConfig('mimetypes_file'), |
| 165 | 165 | $helper->getConfig('maxsize_file'), null, null); |
| 166 | 166 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
| 167 | 167 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 168 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 168 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 169 | 169 | $uploader->setPrefix($imgName); |
| 170 | 170 | $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
| 171 | 171 | if (!$uploader->upload()) { |
@@ -182,15 +182,15 @@ discard block |
||
| 182 | 182 | $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
| 183 | 183 | $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
| 184 | 184 | // Set Var tf_selectfile |
| 185 | - include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 185 | + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 186 | 186 | $filename = $_FILES['tf_selectfile']['name']; |
| 187 | 187 | $imgNameDef = Request::getString('tf_text'); |
| 188 | - $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
|
| 188 | + $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', |
|
| 189 | 189 | $helper->getConfig('mimetypes_file'), |
| 190 | 190 | $helper->getConfig('maxsize_file'), null, null); |
| 191 | 191 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
| 192 | 192 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
| 193 | - $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
|
| 193 | + $imgName = str_replace(' ', '', $imgNameDef).'.'.$extension; |
|
| 194 | 194 | $uploader->setPrefix($imgName); |
| 195 | 195 | $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
| 196 | 196 | if (!$uploader->upload()) { |
@@ -220,4 +220,4 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | break; |
| 222 | 222 | } |
| 223 | -require __DIR__ . '/footer.php'; |
|
| 223 | +require __DIR__.'/footer.php'; |
|
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | use XoopsModules\Mymodule2\Common; |
| 19 | 19 | use XoopsModules\Mymodule2\Utility; |
| 20 | 20 | |
| 21 | -require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
|
| 22 | -require dirname(__DIR__) . '/preloads/autoloader.php'; |
|
| 21 | +require_once dirname(dirname(dirname(__DIR__))).'/include/cp_header.php'; |
|
| 22 | +require dirname(__DIR__).'/preloads/autoloader.php'; |
|
| 23 | 23 | |
| 24 | 24 | $op = \Xmf\Request::getCmd('op', ''); |
| 25 | 25 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | loadSampleData(); |
| 40 | 40 | } else { |
| 41 | 41 | xoops_cp_header(); |
| 42 | - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 42 | + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA_OK')), constant('CO_'.$moduleDirNameUpper.'_'.'CONFIRM'), true); |
|
| 43 | 43 | xoops_cp_footer(); |
| 44 | 44 | } |
| 45 | 45 | break; |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); |
| 64 | 64 | |
| 65 | 65 | $language = 'english/'; |
| 66 | - if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { |
|
| 67 | - $language = $xoopsConfig['language'] . '/'; |
|
| 66 | + if (is_dir(__DIR__.'/'.$xoopsConfig['language'])) { |
|
| 67 | + $language = $xoopsConfig['language'].'/'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // load module tables |
| 71 | 71 | foreach ($tables as $table) { |
| 72 | - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); |
|
| 72 | + $tabledata = \Xmf\Yaml::readWrapped($language.$table.'.yml'); |
|
| 73 | 73 | \Xmf\Database\TableLoad::truncateTable($table); |
| 74 | 74 | \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // load permissions |
| 78 | 78 | $table = 'group_permission'; |
| 79 | - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); |
|
| 79 | + $tabledata = \Xmf\Yaml::readWrapped($language.$table.'.yml'); |
|
| 80 | 80 | $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); |
| 81 | 81 | loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); |
| 82 | 82 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $utility::rcopy($src, $dest); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | - redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); |
|
| 92 | + redirect_header('../admin/index.php', 1, constant('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS')); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | function saveSampleData() |
@@ -103,23 +103,23 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); |
| 105 | 105 | |
| 106 | - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; |
|
| 107 | - if (!file_exists($languageFolder . '/')) { |
|
| 108 | - Utility::createFolder($languageFolder . '/'); |
|
| 106 | + $languageFolder = __DIR__.'/'.$xoopsConfig['language']; |
|
| 107 | + if (!file_exists($languageFolder.'/')) { |
|
| 108 | + Utility::createFolder($languageFolder.'/'); |
|
| 109 | 109 | } |
| 110 | - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; |
|
| 110 | + $exportFolder = $languageFolder.'/Exports-'.date('Y-m-d-H-i-s').'/'; |
|
| 111 | 111 | Utility::createFolder($exportFolder); |
| 112 | 112 | |
| 113 | 113 | // save module tables |
| 114 | 114 | foreach ($tables as $table) { |
| 115 | - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); |
|
| 115 | + \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder.$table.'.yml'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // save permissions |
| 119 | 119 | $criteria = new \CriteriaCompo(); |
| 120 | 120 | $criteria->add(new \Criteria('gperm_modid', \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); |
| 121 | 121 | $skipColumns[] = 'gperm_id'; |
| 122 | - \Xmf\Database\TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); |
|
| 122 | + \Xmf\Database\TableLoad::saveTableToYamlFile('group_permission', $exportFolder.'group_permission.yml', $criteria, $skipColumns); |
|
| 123 | 123 | unset($criteria); |
| 124 | 124 | |
| 125 | 125 | // --- COPY test folder files --------------- |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | Utility::rcopy($src, $dest); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); |
|
| 133 | + redirect_header('../admin/index.php', 1, constant('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS')); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | function exportSchema() |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); |
| 147 | 147 | } |
| 148 | 148 | catch (\Exception $e) { |
| 149 | - exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); |
|
| 149 | + exit(constant('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_ERROR')); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | } |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | $prefixedTable = $db->prefix($table); |
| 172 | 172 | $count = 0; |
| 173 | 173 | |
| 174 | - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); |
|
| 174 | + $sql = 'DELETE FROM '.$prefixedTable.' WHERE `'.$search.'`='.$db->quote($replace); |
|
| 175 | 175 | |
| 176 | 176 | $result = $db->queryF($sql); |
| 177 | 177 | |
| 178 | 178 | foreach ($data as $row) { |
| 179 | - $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; |
|
| 179 | + $insertInto = 'INSERT INTO '.$prefixedTable.' ('; |
|
| 180 | 180 | $valueClause = ' VALUES ('; |
| 181 | 181 | $first = true; |
| 182 | 182 | foreach ($row as $column => $value) { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - $sql = $insertInto . ') ' . $valueClause . ')'; |
|
| 198 | + $sql = $insertInto.') '.$valueClause.')'; |
|
| 199 | 199 | |
| 200 | 200 | $result = $db->queryF($sql); |
| 201 | 201 | if (false !== $result) { |
@@ -119,8 +119,7 @@ |
||
| 119 | 119 | // $migrate->saveCurrentSchema(); |
| 120 | 120 | // |
| 121 | 121 | // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); |
| 122 | - } |
|
| 123 | - catch (\Exception $e) { |
|
| 122 | + } catch (\Exception $e) { |
|
| 124 | 123 | exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); |
| 125 | 124 | } |
| 126 | 125 | |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | $language = $xoopsConfig['language'] . '/'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - // load module tables |
|
| 70 | + // load module tables |
|
| 71 | 71 | foreach ($tables as $table) { |
| 72 | 72 | $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); |
| 73 | 73 | \Xmf\Database\TableLoad::truncateTable($table); |
| 74 | 74 | \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - // load permissions |
|
| 77 | + // load permissions |
|
| 78 | 78 | $table = 'group_permission'; |
| 79 | 79 | $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); |
| 80 | 80 | $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; |
| 107 | 107 | if (!file_exists($languageFolder . '/')) { |
| 108 | - Utility::createFolder($languageFolder . '/'); |
|
| 108 | + Utility::createFolder($languageFolder . '/'); |
|
| 109 | 109 | } |
| 110 | 110 | $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; |
| 111 | 111 | Utility::createFolder($exportFolder); |
| 112 | 112 | |
| 113 | - // save module tables |
|
| 113 | + // save module tables |
|
| 114 | 114 | foreach ($tables as $table) { |
| 115 | 115 | \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - // save permissions |
|
| 119 | - $criteria = new \CriteriaCompo(); |
|
| 118 | + // save permissions |
|
| 119 | + $criteria = new \CriteriaCompo(); |
|
| 120 | 120 | $criteria->add(new \Criteria('gperm_modid', \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); |
| 121 | 121 | $skipColumns[] = 'gperm_id'; |
| 122 | 122 | \Xmf\Database\TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); |
@@ -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')); |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | use XoopsModules\Mymodule2; |
| 25 | 25 | use XoopsModules\Mymodule2\Constants; |
| 26 | 26 | |
| 27 | -require __DIR__ . '/header.php'; |
|
| 27 | +require __DIR__.'/header.php'; |
|
| 28 | 28 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_index.tpl'; |
| 29 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 29 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 30 | 30 | // Define Stylesheet |
| 31 | -$GLOBALS['xoTheme']->addStylesheet( $style, null ); |
|
| 31 | +$GLOBALS['xoTheme']->addStylesheet($style, null); |
|
| 32 | 32 | $keywords = []; |
| 33 | 33 | // |
| 34 | 34 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $articlesAll = $articlesHandler->getAllArticles($start, $limit); |
| 44 | 44 | // Get All Articles |
| 45 | 45 | $articles = []; |
| 46 | - foreach(array_keys($articlesAll) as $i) { |
|
| 46 | + foreach (array_keys($articlesAll) as $i) { |
|
| 47 | 47 | $article = $articlesAll[$i]->getValuesArticles(); |
| 48 | 48 | $acount = ['count', $count]; |
| 49 | 49 | $articles[] = array_merge($article, $acount); |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | unset($articles); |
| 55 | 55 | // Display Navigation |
| 56 | 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); |
|
| 57 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 58 | + $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
| 59 | 59 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
| 60 | 60 | } |
| 61 | 61 | $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $articlesCount)); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit); |
| 78 | 78 | // Get All Testfields |
| 79 | 79 | $testfields = []; |
| 80 | - foreach(array_keys($testfieldsAll) as $i) { |
|
| 80 | + foreach (array_keys($testfieldsAll) as $i) { |
|
| 81 | 81 | $testfield = $testfieldsAll[$i]->getValuesTestfields(); |
| 82 | 82 | $acount = ['count', $count]; |
| 83 | 83 | $testfields[] = array_merge($testfield, $acount); |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | unset($testfields); |
| 89 | 89 | // Display Navigation |
| 90 | 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); |
|
| 91 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 92 | + $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
| 93 | 93 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
| 94 | 94 | } |
| 95 | 95 | $GLOBALS['xoopsTpl']->assign('lang_thereare', sprintf(_MA_MYMODULE2_INDEX_THEREARE, $testfieldsCount)); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | // Breadcrumbs |
| 102 | 102 | $xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_INDEX]; |
| 103 | 103 | // Keywords |
| 104 | -mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords)); |
|
| 104 | +mymodule2MetaKeywords($helper->getConfig('keywords').', '.implode(',', $keywords)); |
|
| 105 | 105 | unset($keywords); |
| 106 | 106 | // Description |
| 107 | 107 | mymodule2MetaDescription(_MA_MYMODULE2_INDEX_DESC); |
| 108 | 108 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/index.php'); |
| 109 | 109 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL); |
| 110 | 110 | $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL); |
| 111 | -require __DIR__ . '/footer.php'; |
|
| 111 | +require __DIR__.'/footer.php'; |
|