Completed
Push — master ( b3fce7...c570af )
by Michael
02:32
created
admin/tag.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -17,45 +17,45 @@  discard block
 block discarded – undo
17 17
 
18 18
 function edittag($tagid = 0, $language = false, $fct = false)
19 19
 {
20
-    global $smartobjectTagHandler;
21
-
22
-    $tagObj = $smartobjectTagHandler->get($tagid);
23
-
24
-    if ($tagObj->isNew()) {
25
-        $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
26
-        $title                 = _AM_SOBJECT_TAG_CREATE;
27
-        $info                  = _AM_SOBJECT_TAG_CREATE_INFO;
28
-        $collaps_name          = 'tagcreate';
29
-        $form_name             = _AM_SOBJECT_TAG_CREATE;
30
-        $submit_button_caption = null;
31
-    //$tagObj->stripMultilanguageFields();
32
-    } else {
33
-        if ($language) {
34
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
35
-            $title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
36
-            $info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
37
-            $collaps_name          = 'tageditlanguage';
38
-            $form_name             = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
39
-            $submit_button_caption = null;
40
-            $tagObj->makeNonMLFieldReadOnly();
41
-        } else {
42
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
43
-            $title                 = _AM_SOBJECT_TAG_EDIT;
44
-            $info                  = _AM_SOBJECT_TAG_EDIT_INFO;
45
-            $collaps_name          = 'tagedit';
46
-            $form_name             = _AM_SOBJECT_TAG_EDIT;
47
-            $submit_button_caption = null;
48
-            $tagObj->stripMultilanguageFields();
49
-        }
50
-    }
51
-
52
-    //Smartobject\Utility::getAdminMenu(2, $breadcrumb);
53
-
54
-    Smartobject\Utility::getCollapsableBar($collaps_name, $title, $info);
55
-
56
-    $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption);
57
-    $sform->display();
58
-    Smartobject\Utility::closeCollapsable($collaps_name);
20
+	global $smartobjectTagHandler;
21
+
22
+	$tagObj = $smartobjectTagHandler->get($tagid);
23
+
24
+	if ($tagObj->isNew()) {
25
+		$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
26
+		$title                 = _AM_SOBJECT_TAG_CREATE;
27
+		$info                  = _AM_SOBJECT_TAG_CREATE_INFO;
28
+		$collaps_name          = 'tagcreate';
29
+		$form_name             = _AM_SOBJECT_TAG_CREATE;
30
+		$submit_button_caption = null;
31
+	//$tagObj->stripMultilanguageFields();
32
+	} else {
33
+		if ($language) {
34
+			$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
35
+			$title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
36
+			$info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
37
+			$collaps_name          = 'tageditlanguage';
38
+			$form_name             = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
39
+			$submit_button_caption = null;
40
+			$tagObj->makeNonMLFieldReadOnly();
41
+		} else {
42
+			$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
43
+			$title                 = _AM_SOBJECT_TAG_EDIT;
44
+			$info                  = _AM_SOBJECT_TAG_EDIT_INFO;
45
+			$collaps_name          = 'tagedit';
46
+			$form_name             = _AM_SOBJECT_TAG_EDIT;
47
+			$submit_button_caption = null;
48
+			$tagObj->stripMultilanguageFields();
49
+		}
50
+	}
51
+
52
+	//Smartobject\Utility::getAdminMenu(2, $breadcrumb);
53
+
54
+	Smartobject\Utility::getCollapsableBar($collaps_name, $title, $info);
55
+
56
+	$sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption);
57
+	$sform->display();
58
+	Smartobject\Utility::closeCollapsable($collaps_name);
59 59
 }
60 60
 
61 61
 require_once __DIR__ . '/admin_header.php';
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 $op = '';
68 68
 
69 69
 if (isset($_GET['op'])) {
70
-    $op = $_GET['op'];
70
+	$op = $_GET['op'];
71 71
 }
72 72
 if (isset($_POST['op'])) {
73
-    $op = $_POST['op'];
73
+	$op = $_POST['op'];
74 74
 }
75 75
 
76 76
 $tagid    = \Xmf\Request::getInt('tagid', 0, 'GET');
@@ -79,65 +79,65 @@  discard block
 block discarded – undo
79 79
 
80 80
 switch ($op) {
81 81
 
82
-    case 'del':
82
+	case 'del':
83 83
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
84
-        $controller = new ObjectController($smartobjectTagHandler);
85
-        $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
84
+		$controller = new ObjectController($smartobjectTagHandler);
85
+		$controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
86 86
 
87
-        break;
87
+		break;
88 88
 
89
-    case 'addtag':
89
+	case 'addtag':
90 90
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
91
-        $controller = new ObjectController($smartobjectTagHandler);
92
-        $tagObj     = $controller->storeSmartObject();
93
-        if ($tagObj->hasError()) {
94
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
95
-        }
91
+		$controller = new ObjectController($smartobjectTagHandler);
92
+		$tagObj     = $controller->storeSmartObject();
93
+		if ($tagObj->hasError()) {
94
+			redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
95
+		}
96 96
 
97
-        if ($tagObj->hasError()) {
98
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
99
-        } else {
100
-            redirect_header(Smartobject\Utility::getPageBeforeForm(), 3, _CO_SOBJECT_SAVE_SUCCESS);
101
-        }
102
-        exit;
103
-        break;
97
+		if ($tagObj->hasError()) {
98
+			redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
99
+		} else {
100
+			redirect_header(Smartobject\Utility::getPageBeforeForm(), 3, _CO_SOBJECT_SAVE_SUCCESS);
101
+		}
102
+		exit;
103
+		break;
104 104
 
105
-    case 'mod':
106
-        Smartobject\Utility::getXoopsCpHeader();
107
-        edittag($tagid, $language, $fct);
108
-        break;
105
+	case 'mod':
106
+		Smartobject\Utility::getXoopsCpHeader();
107
+		edittag($tagid, $language, $fct);
108
+		break;
109 109
 
110
-    default:
110
+	default:
111 111
 
112
-        Smartobject\Utility::getXoopsCpHeader();
112
+		Smartobject\Utility::getXoopsCpHeader();
113 113
 
114
-        //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_TAGS);
114
+		//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_TAGS);
115 115
 
116
-        Smartobject\Utility::getCollapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
116
+		Smartobject\Utility::getCollapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
117 117
 
118 118
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
119
-        $objectTable = new Table($smartobjectTagHandler, false, ['delete']);
120
-        $objectTable->addColumn(new ObjectColumn('name'));
121
-        $objectTable->addColumn(new ObjectColumn('language'));
122
-        $objectTable->addColumn(new ObjectColumn('value'));
123
-        //      $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo'));
119
+		$objectTable = new Table($smartobjectTagHandler, false, ['delete']);
120
+		$objectTable->addColumn(new ObjectColumn('name'));
121
+		$objectTable->addColumn(new ObjectColumn('language'));
122
+		$objectTable->addColumn(new ObjectColumn('value'));
123
+		//      $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo'));
124 124
 
125
-        $objectTable->addFilter('language', 'getLanguages');
125
+		$objectTable->addFilter('language', 'getLanguages');
126 126
 
127
-        $objectTable->addCustomAction('getEditLanguageLink');
128
-        $objectTable->addCustomAction('getEditItemLink');
127
+		$objectTable->addCustomAction('getEditLanguageLink');
128
+		$objectTable->addCustomAction('getEditItemLink');
129 129
 
130
-        $objectTable->setDefaultSort('tagid');
130
+		$objectTable->setDefaultSort('tagid');
131 131
 
132
-        $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE);
132
+		$objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE);
133 133
 
134
-        $objectTable->render();
134
+		$objectTable->render();
135 135
 
136
-        echo '<br>';
137
-        Smartobject\Utility::closeCollapsable('tags');
138
-        echo '<br>';
136
+		echo '<br>';
137
+		Smartobject\Utility::closeCollapsable('tags');
138
+		echo '<br>';
139 139
 
140
-        break;
140
+		break;
141 141
 }
142 142
 
143 143
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/adsense.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -19,32 +19,32 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function editclass($showmenu = false, $adsenseid = 0, $clone = false)
21 21
 {
22
-    global $smartobjectAdsenseHandler;
23
-
24
-    $adsenseObj = $smartobjectAdsenseHandler->get($adsenseid);
25
-
26
-    if (!$clone && !$adsenseObj->isNew()) {
27
-        if ($showmenu) {
28
-            //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING);
29
-        }
30
-        Smartobject\Utility::getCollapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO);
31
-
32
-        $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense');
33
-        $sform->display();
34
-        Smartobject\Utility::closeCollapsable('adsenseedit');
35
-    } else {
36
-        $adsenseObj->setVar('adsenseid', 0);
37
-        $adsenseObj->setVar('tag', '');
38
-
39
-        if ($showmenu) {
40
-            //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW);
41
-        }
42
-
43
-        Smartobject\Utility::getCollapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO);
44
-        $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true);
45
-        $sform->display();
46
-        Smartobject\Utility::closeCollapsable('adsensecreate');
47
-    }
22
+	global $smartobjectAdsenseHandler;
23
+
24
+	$adsenseObj = $smartobjectAdsenseHandler->get($adsenseid);
25
+
26
+	if (!$clone && !$adsenseObj->isNew()) {
27
+		if ($showmenu) {
28
+			//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING);
29
+		}
30
+		Smartobject\Utility::getCollapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO);
31
+
32
+		$sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense');
33
+		$sform->display();
34
+		Smartobject\Utility::closeCollapsable('adsenseedit');
35
+	} else {
36
+		$adsenseObj->setVar('adsenseid', 0);
37
+		$adsenseObj->setVar('tag', '');
38
+
39
+		if ($showmenu) {
40
+			//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW);
41
+		}
42
+
43
+		Smartobject\Utility::getCollapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO);
44
+		$sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true);
45
+		$sform->display();
46
+		Smartobject\Utility::closeCollapsable('adsensecreate');
47
+	}
48 48
 }
49 49
 
50 50
 require_once __DIR__ . '/admin_header.php';
@@ -61,72 +61,72 @@  discard block
 block discarded – undo
61 61
 $op = '';
62 62
 
63 63
 if (isset($_GET['op'])) {
64
-    $op = $_GET['op'];
64
+	$op = $_GET['op'];
65 65
 }
66 66
 if (isset($_POST['op'])) {
67
-    $op = $_POST['op'];
67
+	$op = $_POST['op'];
68 68
 }
69 69
 
70 70
 switch ($op) {
71
-    case 'mod':
71
+	case 'mod':
72 72
 
73
-        $adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
73
+		$adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
74 74
 
75
-        Smartobject\Utility::getXoopsCpHeader();
76
-        $adminObject->displayNavigation(basename(__FILE__));
75
+		Smartobject\Utility::getXoopsCpHeader();
76
+		$adminObject->displayNavigation(basename(__FILE__));
77 77
 
78
-        editclass(true, $adsenseid);
79
-        break;
78
+		editclass(true, $adsenseid);
79
+		break;
80 80
 
81
-    case 'clone':
81
+	case 'clone':
82 82
 
83
-        $adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
83
+		$adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
84 84
 
85
-        Smartobject\Utility::getXoopsCpHeader();
86
-        $adminObject->displayNavigation(basename(__FILE__));
85
+		Smartobject\Utility::getXoopsCpHeader();
86
+		$adminObject->displayNavigation(basename(__FILE__));
87 87
 
88
-        editclass(true, $adsenseid, true);
89
-        break;
88
+		editclass(true, $adsenseid, true);
89
+		break;
90 90
 
91
-    case 'addadsense':
92
-        if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
93
-            $xoopsCaptcha = XoopsCaptcha::getInstance();
94
-            if (!$xoopsCaptcha->verify()) {
95
-                redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
96
-            }
97
-        }
91
+	case 'addadsense':
92
+		if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
93
+			$xoopsCaptcha = XoopsCaptcha::getInstance();
94
+			if (!$xoopsCaptcha->verify()) {
95
+				redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
96
+			}
97
+		}
98 98
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
99
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
100
-        $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED);
101
-        break;
99
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
100
+		$controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED);
101
+		break;
102 102
 
103
-    case 'del':
103
+	case 'del':
104 104
 
105 105
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
106
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
107
-        $controller->handleObjectDeletion();
106
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
107
+		$controller->handleObjectDeletion();
108 108
 
109
-        break;
109
+		break;
110 110
 
111
-    default:
111
+	default:
112 112
 
113
-        Smartobject\Utility::getXoopsCpHeader();
114
-        $adminObject->displayNavigation(basename(__FILE__));
113
+		Smartobject\Utility::getXoopsCpHeader();
114
+		$adminObject->displayNavigation(basename(__FILE__));
115 115
 
116
-        //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES);
116
+		//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES);
117 117
 
118
-        Smartobject\Utility::getCollapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC);
118
+		Smartobject\Utility::getCollapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC);
119 119
 
120 120
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
121
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectAdsenseHandler);
122
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
123
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode'));
121
+		$objectTable = new XoopsModules\Smartobject\Table($smartobjectAdsenseHandler);
122
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
123
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode'));
124 124
 
125
-        //      $objectTable->addCustomAction('getCreateItemLink');
126
-        //      $objectTable->addCustomAction('getCreateAttributLink');
125
+		//      $objectTable->addCustomAction('getCreateItemLink');
126
+		//      $objectTable->addCustomAction('getCreateAttributLink');
127 127
 
128
-        $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE);
129
-        /*
128
+		$objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE);
129
+		/*
130 130
                 $criteria_upcoming = new \CriteriaCompo();
131 131
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
132 132
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
                                             'criteria' => $criteria_last30days
151 151
                 ));
152 152
         */
153
-        $objectTable->addQuickSearch(['title', 'summary', 'description']);
154
-        $objectTable->addCustomAction('getCloneLink');
153
+		$objectTable->addQuickSearch(['title', 'summary', 'description']);
154
+		$objectTable->addCustomAction('getCloneLink');
155 155
 
156
-        $objectTable->render();
156
+		$objectTable->render();
157 157
 
158
-        echo '<br>';
159
-        Smartobject\Utility::closeCollapsable('createdadsenses');
160
-        echo '<br>';
158
+		echo '<br>';
159
+		Smartobject\Utility::closeCollapsable('createdadsenses');
160
+		echo '<br>';
161 161
 
162
-        break;
162
+		break;
163 163
 }
164 164
 
165 165
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/link.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -26,81 +26,81 @@
 block discarded – undo
26 26
 $op = '';
27 27
 
28 28
 if (isset($_GET['op'])) {
29
-    $op = $_GET['op'];
29
+	$op = $_GET['op'];
30 30
 }
31 31
 if (isset($_POST['op'])) {
32
-    $op = $_POST['op'];
32
+	$op = $_POST['op'];
33 33
 }
34 34
 
35 35
 switch ($op) {
36 36
 
37
-    case 'del':
37
+	case 'del':
38 38
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
39
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
40
-        $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
39
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
40
+		$controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
41 41
 
42
-        break;
42
+		break;
43 43
 
44
-    case 'view':
45
-        $linkid  = \Xmf\Request::getInt('linkid', 0, 'GET');
46
-        $linkObj = $smartobjectLinkHandler->get($linkid);
44
+	case 'view':
45
+		$linkid  = \Xmf\Request::getInt('linkid', 0, 'GET');
46
+		$linkObj = $smartobjectLinkHandler->get($linkid);
47 47
 
48
-        if ($linkObj->isNew()) {
49
-            redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
50
-        }
48
+		if ($linkObj->isNew()) {
49
+			redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
50
+		}
51 51
 
52
-        Smartobject\Utility::getXoopsCpHeader();
52
+		Smartobject\Utility::getXoopsCpHeader();
53 53
 
54
-        //Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
54
+		//Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
55 55
 
56
-        Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
56
+		Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
57 57
 
58
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
58
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
59 59
 
60
-        // ---
61
-        // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
62
-        //      $xoopsTpl = new \XoopsTpl();
63
-        $xoopsTpl = new \XoopsTpl();
64
-        //---
60
+		// ---
61
+		// 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
62
+		//      $xoopsTpl = new \XoopsTpl();
63
+		$xoopsTpl = new \XoopsTpl();
64
+		//---
65 65
 
66
-        $xoopsTpl->assign('link', $linkObj->toArray());
67
-        $xoopsTpl->display('db:smartobject_sentlink_display.tpl');
66
+		$xoopsTpl->assign('link', $linkObj->toArray());
67
+		$xoopsTpl->display('db:smartobject_sentlink_display.tpl');
68 68
 
69
-        echo '<br>';
70
-        Smartobject\Utility::closeCollapsable('sentlinks');
71
-        echo '<br>';
69
+		echo '<br>';
70
+		Smartobject\Utility::closeCollapsable('sentlinks');
71
+		echo '<br>';
72 72
 
73
-        break;
73
+		break;
74 74
 
75
-    default:
75
+	default:
76 76
 
77
-        Smartobject\Utility::getXoopsCpHeader();
77
+		Smartobject\Utility::getXoopsCpHeader();
78 78
 
79
-        $adminObject->displayNavigation(basename(__FILE__));
79
+		$adminObject->displayNavigation(basename(__FILE__));
80 80
 
81
-        //Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINKS);
81
+		//Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINKS);
82 82
 
83
-        Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
83
+		Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
84 84
 
85 85
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
86
-        $objectTable = new Smartobject\Table($smartobjectLinkHandler, null, ['delete']);
87
-        $objectTable->addColumn(new Smartobject\ObjectColumn('date'));
88
-        $objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
89
-        $objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
90
-        $objectTable->addColumn(new Smartobject\ObjectColumn('link'));
86
+		$objectTable = new Smartobject\Table($smartobjectLinkHandler, null, ['delete']);
87
+		$objectTable->addColumn(new Smartobject\ObjectColumn('date'));
88
+		$objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
89
+		$objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
90
+		$objectTable->addColumn(new Smartobject\ObjectColumn('link'));
91 91
 
92
-        $objectTable->addCustomAction('getViewItemLink');
92
+		$objectTable->addCustomAction('getViewItemLink');
93 93
 
94
-        $objectTable->setDefaultSort('date');
95
-        $objectTable->setDefaultOrder('DESC');
94
+		$objectTable->setDefaultSort('date');
95
+		$objectTable->setDefaultOrder('DESC');
96 96
 
97
-        $objectTable->render();
97
+		$objectTable->render();
98 98
 
99
-        echo '<br>';
100
-        Smartobject\Utility::closeCollapsable('sentlinks');
101
-        echo '<br>';
99
+		echo '<br>';
100
+		Smartobject\Utility::closeCollapsable('sentlinks');
101
+		echo '<br>';
102 102
 
103
-        break;
103
+		break;
104 104
 }
105 105
 
106 106
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/currency.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
 
16 16
 function editclass($showmenu = false, $currencyid = 0)
17 17
 {
18
-    global $smartobjectCurrencyHandler;
19
-
20
-    $currencyObj = $smartobjectCurrencyHandler->get($currencyid);
21
-
22
-    if (!$currencyObj->isNew()) {
23
-        if ($showmenu) {
24
-            //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING);
25
-        }
26
-        Smartobject\Utility::getCollapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO);
27
-
28
-        $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency');
29
-        $sform->display();
30
-        Smartobject\Utility::closeCollapsable('currencyedit');
31
-    } else {
32
-        if ($showmenu) {
33
-            //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW);
34
-        }
35
-
36
-        Smartobject\Utility::getCollapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO);
37
-        $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency');
38
-        $sform->display();
39
-        Smartobject\Utility::closeCollapsable('currencycreate');
40
-    }
18
+	global $smartobjectCurrencyHandler;
19
+
20
+	$currencyObj = $smartobjectCurrencyHandler->get($currencyid);
21
+
22
+	if (!$currencyObj->isNew()) {
23
+		if ($showmenu) {
24
+			//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING);
25
+		}
26
+		Smartobject\Utility::getCollapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO);
27
+
28
+		$sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency');
29
+		$sform->display();
30
+		Smartobject\Utility::closeCollapsable('currencyedit');
31
+	} else {
32
+		if ($showmenu) {
33
+			//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW);
34
+		}
35
+
36
+		Smartobject\Utility::getCollapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO);
37
+		$sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency');
38
+		$sform->display();
39
+		Smartobject\Utility::closeCollapsable('currencycreate');
40
+	}
41 41
 }
42 42
 
43 43
 require_once __DIR__ . '/admin_header.php';
@@ -48,36 +48,36 @@  discard block
 block discarded – undo
48 48
 $op = '';
49 49
 
50 50
 if (isset($_GET['op'])) {
51
-    $op = $_GET['op'];
51
+	$op = $_GET['op'];
52 52
 }
53 53
 if (isset($_POST['op'])) {
54
-    $op = $_POST['op'];
54
+	$op = $_POST['op'];
55 55
 }
56 56
 
57 57
 switch ($op) {
58
-    case 'mod':
59
-        $currencyid = \Xmf\Request::getInt('currencyid', 0, 'GET');
58
+	case 'mod':
59
+		$currencyid = \Xmf\Request::getInt('currencyid', 0, 'GET');
60 60
 
61
-        Smartobject\Utility::getXoopsCpHeader();
61
+		Smartobject\Utility::getXoopsCpHeader();
62 62
 
63
-        editclass(true, $currencyid);
64
-        break;
63
+		editclass(true, $currencyid);
64
+		break;
65 65
 
66
-    case 'updateCurrencies':
66
+	case 'updateCurrencies':
67 67
 
68
-        if (!isset($_POST['SmartobjectCurrency_objects']) || 0 == count($_POST['SmartobjectCurrency_objects'])) {
69
-            redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE);
70
-        }
68
+		if (!isset($_POST['SmartobjectCurrency_objects']) || 0 == count($_POST['SmartobjectCurrency_objects'])) {
69
+			redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE);
70
+		}
71 71
 
72
-        if (isset($_POST['default_currency'])) {
73
-            $newDefaultCurrency = $_POST['default_currency'];
74
-            $sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
75
-            $smartobjectCurrencyHandler->query($sql);
76
-            $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
77
-            $smartobjectCurrencyHandler->query($sql);
78
-        }
72
+		if (isset($_POST['default_currency'])) {
73
+			$newDefaultCurrency = $_POST['default_currency'];
74
+			$sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
75
+			$smartobjectCurrencyHandler->query($sql);
76
+			$sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
77
+			$smartobjectCurrencyHandler->query($sql);
78
+		}
79 79
 
80
-        /*
80
+		/*
81 81
         $criteria = new \CriteriaCompo();
82 82
         $criteria->add(new \Criteria('currencyid', '(' . implode(', ', $_POST['SmartobjectCurrency_objects']) . ')', 'IN'));
83 83
         $currenciesObj = $smartobjectCurrencyHandler->getObjects($criteria, true);
@@ -87,49 +87,49 @@  discard block
 block discarded – undo
87 87
             $smartobjectCurrencyHandler->insert($currencyObj);
88 88
         }
89 89
         */
90
-        redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED);
91
-        break;
90
+		redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED);
91
+		break;
92 92
 
93
-    case 'addcurrency':
93
+	case 'addcurrency':
94 94
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
-        $controller = new ObjectController($smartobjectCurrencyHandler);
96
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
95
+		$controller = new ObjectController($smartobjectCurrencyHandler);
96
+		$controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
97 97
 
98
-        break;
98
+		break;
99 99
 
100
-    case 'del':
100
+	case 'del':
101 101
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
102
-        $controller = new ObjectController($smartobjectCurrencyHandler);
103
-        $controller->handleObjectDeletion();
102
+		$controller = new ObjectController($smartobjectCurrencyHandler);
103
+		$controller->handleObjectDeletion();
104 104
 
105
-        break;
105
+		break;
106 106
 
107
-    default:
107
+	default:
108 108
 
109
-        Smartobject\Utility::getXoopsCpHeader();
109
+		Smartobject\Utility::getXoopsCpHeader();
110 110
 
111
-        //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES);
111
+		//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES);
112 112
 
113
-        Smartobject\Utility::getCollapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC);
113
+		Smartobject\Utility::getCollapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC);
114 114
 
115 115
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
116
-        $objectTable = new Table($smartobjectCurrencyHandler);
117
-        $objectTable->addColumn(new ObjectColumn('name', 'left', false, 'getCurrencyLink'));
118
-        $objectTable->addColumn(new ObjectColumn('rate', 'center', 150));
119
-        $objectTable->addColumn(new ObjectColumn('iso4217', 'center', 150));
120
-        $objectTable->addColumn(new ObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl'));
116
+		$objectTable = new Table($smartobjectCurrencyHandler);
117
+		$objectTable->addColumn(new ObjectColumn('name', 'left', false, 'getCurrencyLink'));
118
+		$objectTable->addColumn(new ObjectColumn('rate', 'center', 150));
119
+		$objectTable->addColumn(new ObjectColumn('iso4217', 'center', 150));
120
+		$objectTable->addColumn(new ObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl'));
121 121
 
122
-        $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE);
122
+		$objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE);
123 123
 
124
-        $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL);
124
+		$objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL);
125 125
 
126
-        $objectTable->render();
126
+		$objectTable->render();
127 127
 
128
-        echo '<br>';
129
-        Smartobject\Utility::closeCollapsable('createdcurrencies');
130
-        echo '<br>';
128
+		echo '<br>';
129
+		Smartobject\Utility::closeCollapsable('createdcurrencies');
130
+		echo '<br>';
131 131
 
132
-        break;
132
+		break;
133 133
 }
134 134
 
135 135
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/update.php 1 patch
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -21,188 +21,188 @@  discard block
 block discarded – undo
21 21
 // =========================================================================================
22 22
 function update_tables_to_300()
23 23
 {
24
-    $dbupdater = new Wfdownloads\Dbupdater();
24
+	$dbupdater = new Wfdownloads\Dbupdater();
25 25
 
26
-    if (!wfdownloads_TableExists('wfdownloads_meta')) {
27
-        // Create table wfdownloads_meta
28
-        $table = new Wfdownloads\DbupdaterTable('wfdownloads_meta');
29
-        $table->setStructure("CREATE TABLE `%s` (
26
+	if (!wfdownloads_TableExists('wfdownloads_meta')) {
27
+		// Create table wfdownloads_meta
28
+		$table = new Wfdownloads\DbupdaterTable('wfdownloads_meta');
29
+		$table->setStructure("CREATE TABLE `%s` (
30 30
                                 metakey varchar(50) NOT NULL default '',
31 31
                                 metavalue varchar(255) NOT NULL default '',
32 32
                                 PRIMARY KEY (metakey))
33 33
                                 ENGINE=MyISAM;");
34 34
 
35
-        $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
36
-        if ($dbupdater->updateTable($table)) {
37
-            echo 'wfdownloads_meta table created<br>';
38
-        }
39
-    }
40
-
41
-    $download_fields = [
42
-        'lid'           => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false],
43
-        'cid'           => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
44
-        'title'         => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
45
-        'url'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
46
-        'filename'      => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
47
-        'filetype'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
48
-        'homepage'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
49
-        'version'       => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
50
-        'size'          => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
51
-        'platform'      => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
52
-        'screenshot'    => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
53
-        'submitter'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
54
-        'publisher'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
55
-        'status'        => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
56
-        'date'          => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
57
-        'hits'          => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
58
-        'rating'        => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
59
-        'votes'         => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
60
-        'comments'      => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
61
-        'license'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
62
-        'mirror'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
63
-        'price'         => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
64
-        'paypalemail'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
65
-        'features'      => ['Type' => 'text NOT NULL', 'Default' => false],
66
-        'requirements'  => ['Type' => 'text NOT NULL', 'Default' => false],
67
-        'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
68
-        'forumid'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
69
-        'limitations'   => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
70
-        'dhistory'      => ['Type' => 'text NOT NULL', 'Default' => false],
71
-        'published'     => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true],
72
-        'expired'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
73
-        'updated'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
74
-        'offline'       => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
75
-        'description'   => ['Type' => 'text NOT NULL', 'Default' => false],
76
-        'ipaddress'     => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true],
77
-        'notifypub'     => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true],
78
-        'summary'       => ['Type' => 'text NOT NULL', 'Default' => false]
79
-    ];
80
-
81
-    $renamed_fields = [
82
-        'logourl' => 'screenshot'
83
-    ];
84
-
85
-    echo '<br><b>Checking Download table</b><br>';
86
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
87
-    $downloadHandler = $helperWfdownloads->getHandler('Download');
88
-    $download_table  = new Wfdownloads\DbupdaterTable('wfdownloads_downloads');
89
-    $fields          = get_table_info($downloadHandler->table, $download_fields);
90
-    // Check for renamed fields
91
-    rename_fields($download_table, $renamed_fields, $fields, $download_fields);
92
-    update_table($download_fields, $fields, $download_table);
93
-    if ($dbupdater->updateTable($download_table)) {
94
-        echo 'Downloads table updated<br>';
95
-    }
96
-    unset($fields);
97
-
98
-    $mod_fields = [
99
-        'requestid'       => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false],
100
-        'lid'             => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
101
-        'cid'             => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
102
-        'title'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
103
-        'url'             => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
104
-        'filename'        => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
105
-        'filetype'        => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
106
-        'homepage'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
107
-        'version'         => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
108
-        'size'            => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
109
-        'platform'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
110
-        'screenshot'      => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
111
-        'submitter'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
112
-        'publisher'       => ['Type' => 'text NOT NULL', 'Default' => false],
113
-        'status'          => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
114
-        'date'            => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
115
-        'hits'            => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
116
-        'rating'          => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
117
-        'votes'           => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
118
-        'comments'        => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
119
-        'license'         => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
120
-        'mirror'          => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
121
-        'price'           => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
122
-        'paypalemail'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
123
-        'features'        => ['Type' => 'text NOT NULL', 'Default' => false],
124
-        'requirements'    => ['Type' => 'text NOT NULL', 'Default' => false],
125
-        'homepagetitle'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
126
-        'forumid'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
127
-        'limitations'     => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
128
-        'dhistory'        => ['Type' => 'text NOT NULL', 'Default' => false],
129
-        'published'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
130
-        'expired'         => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
131
-        'updated'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
132
-        'offline'         => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
133
-        'summary'         => ['Type' => 'text NOT NULL', 'Default' => false],
134
-        'description'     => ['Type' => 'text NOT NULL', 'Default' => false],
135
-        'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
136
-        'requestdate'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
137
-    ];
138
-
139
-    $renamed_fields = [
140
-        'logourl' => 'screenshot'
141
-    ];
142
-
143
-    echo '<br><b>Checking Modified Downloads table</b><br>';
35
+		$table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
36
+		if ($dbupdater->updateTable($table)) {
37
+			echo 'wfdownloads_meta table created<br>';
38
+		}
39
+	}
40
+
41
+	$download_fields = [
42
+		'lid'           => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false],
43
+		'cid'           => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
44
+		'title'         => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
45
+		'url'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
46
+		'filename'      => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
47
+		'filetype'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
48
+		'homepage'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
49
+		'version'       => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
50
+		'size'          => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
51
+		'platform'      => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
52
+		'screenshot'    => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
53
+		'submitter'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
54
+		'publisher'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
55
+		'status'        => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
56
+		'date'          => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
57
+		'hits'          => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
58
+		'rating'        => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
59
+		'votes'         => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
60
+		'comments'      => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
61
+		'license'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
62
+		'mirror'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
63
+		'price'         => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
64
+		'paypalemail'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
65
+		'features'      => ['Type' => 'text NOT NULL', 'Default' => false],
66
+		'requirements'  => ['Type' => 'text NOT NULL', 'Default' => false],
67
+		'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
68
+		'forumid'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
69
+		'limitations'   => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
70
+		'dhistory'      => ['Type' => 'text NOT NULL', 'Default' => false],
71
+		'published'     => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true],
72
+		'expired'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
73
+		'updated'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
74
+		'offline'       => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
75
+		'description'   => ['Type' => 'text NOT NULL', 'Default' => false],
76
+		'ipaddress'     => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true],
77
+		'notifypub'     => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true],
78
+		'summary'       => ['Type' => 'text NOT NULL', 'Default' => false]
79
+	];
80
+
81
+	$renamed_fields = [
82
+		'logourl' => 'screenshot'
83
+	];
84
+
85
+	echo '<br><b>Checking Download table</b><br>';
86
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
87
+	$downloadHandler = $helperWfdownloads->getHandler('Download');
88
+	$download_table  = new Wfdownloads\DbupdaterTable('wfdownloads_downloads');
89
+	$fields          = get_table_info($downloadHandler->table, $download_fields);
90
+	// Check for renamed fields
91
+	rename_fields($download_table, $renamed_fields, $fields, $download_fields);
92
+	update_table($download_fields, $fields, $download_table);
93
+	if ($dbupdater->updateTable($download_table)) {
94
+		echo 'Downloads table updated<br>';
95
+	}
96
+	unset($fields);
97
+
98
+	$mod_fields = [
99
+		'requestid'       => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false],
100
+		'lid'             => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
101
+		'cid'             => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
102
+		'title'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
103
+		'url'             => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
104
+		'filename'        => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
105
+		'filetype'        => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
106
+		'homepage'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
107
+		'version'         => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
108
+		'size'            => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
109
+		'platform'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
110
+		'screenshot'      => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
111
+		'submitter'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
112
+		'publisher'       => ['Type' => 'text NOT NULL', 'Default' => false],
113
+		'status'          => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
114
+		'date'            => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
115
+		'hits'            => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
116
+		'rating'          => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
117
+		'votes'           => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
118
+		'comments'        => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
119
+		'license'         => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
120
+		'mirror'          => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
121
+		'price'           => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
122
+		'paypalemail'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
123
+		'features'        => ['Type' => 'text NOT NULL', 'Default' => false],
124
+		'requirements'    => ['Type' => 'text NOT NULL', 'Default' => false],
125
+		'homepagetitle'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
126
+		'forumid'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
127
+		'limitations'     => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
128
+		'dhistory'        => ['Type' => 'text NOT NULL', 'Default' => false],
129
+		'published'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
130
+		'expired'         => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
131
+		'updated'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
132
+		'offline'         => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
133
+		'summary'         => ['Type' => 'text NOT NULL', 'Default' => false],
134
+		'description'     => ['Type' => 'text NOT NULL', 'Default' => false],
135
+		'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
136
+		'requestdate'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
137
+	];
138
+
139
+	$renamed_fields = [
140
+		'logourl' => 'screenshot'
141
+	];
142
+
143
+	echo '<br><b>Checking Modified Downloads table</b><br>';
144 144
 //    $moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads');
145
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
146
-    $moduleHandler = $helperWfdownloads->getHandler('Modification');
147
-    $mod_table     = new Wfdownloads\DbupdaterTable('wfdownloads_mod');
148
-    $fields        = get_table_info($moduleHandler->table, $mod_fields);
149
-    rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
150
-    update_table($mod_fields, $fields, $mod_table);
151
-    if ($dbupdater->updateTable($mod_table)) {
152
-        echo 'Modified Downloads table updated <br>';
153
-    }
154
-    unset($fields);
155
-
156
-    $cat_fields = [
157
-        'cid'          => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false],
158
-        'pid'          => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
159
-        'title'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
160
-        'imgurl'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
161
-        'description'  => ['Type' => 'text NULL', 'Default' => true],
162
-        'total'        => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
163
-        'summary'      => ['Type' => 'text NOT NULL', 'Default' => false],
164
-        'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
165
-        'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
166
-        'dohtml'       => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
167
-        'dosmiley'     => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
168
-        'doxcode'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
169
-        'doimage'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
170
-        'dobr'         => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
171
-        'weight'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
172
-    ];
173
-    echo '<br><b>Checking Category table</b><br>';
145
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
146
+	$moduleHandler = $helperWfdownloads->getHandler('Modification');
147
+	$mod_table     = new Wfdownloads\DbupdaterTable('wfdownloads_mod');
148
+	$fields        = get_table_info($moduleHandler->table, $mod_fields);
149
+	rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
150
+	update_table($mod_fields, $fields, $mod_table);
151
+	if ($dbupdater->updateTable($mod_table)) {
152
+		echo 'Modified Downloads table updated <br>';
153
+	}
154
+	unset($fields);
155
+
156
+	$cat_fields = [
157
+		'cid'          => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false],
158
+		'pid'          => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
159
+		'title'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
160
+		'imgurl'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
161
+		'description'  => ['Type' => 'text NULL', 'Default' => true],
162
+		'total'        => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
163
+		'summary'      => ['Type' => 'text NOT NULL', 'Default' => false],
164
+		'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
165
+		'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
166
+		'dohtml'       => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
167
+		'dosmiley'     => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
168
+		'doxcode'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
169
+		'doimage'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
170
+		'dobr'         => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
171
+		'weight'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
172
+	];
173
+	echo '<br><b>Checking Category table</b><br>';
174 174
 //    $catHandler = xoops_getModuleHandler('category', 'wfdownloads');
175
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
176
-    $catHandler = $helperWfdownloads->getHandler('Report');
177
-
178
-    $cat_table  = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
179
-    $fields     = get_table_info($catHandler->table, $cat_fields);
180
-    update_table($cat_fields, $fields, $cat_table);
181
-    if ($dbupdater->updateTable($cat_table)) {
182
-        echo 'Category table updated<br>';
183
-    }
184
-    unset($fields);
185
-
186
-    $broken_fields = [
187
-        'reportid'     => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false],
188
-        'lid'          => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
189
-        'sender'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
190
-        'ip'           => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
191
-        'date'         => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true],
192
-        'confirmed'    => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true],
193
-        'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true]
194
-    ];
195
-    echo '<br><b>Checking Broken Report table</b><br>';
196
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
197
-    $brokenHandler = $helperWfdownloads->getHandler('Report');
175
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
176
+	$catHandler = $helperWfdownloads->getHandler('Report');
177
+
178
+	$cat_table  = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
179
+	$fields     = get_table_info($catHandler->table, $cat_fields);
180
+	update_table($cat_fields, $fields, $cat_table);
181
+	if ($dbupdater->updateTable($cat_table)) {
182
+		echo 'Category table updated<br>';
183
+	}
184
+	unset($fields);
185
+
186
+	$broken_fields = [
187
+		'reportid'     => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false],
188
+		'lid'          => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
189
+		'sender'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
190
+		'ip'           => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
191
+		'date'         => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true],
192
+		'confirmed'    => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true],
193
+		'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true]
194
+	];
195
+	echo '<br><b>Checking Broken Report table</b><br>';
196
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
197
+	$brokenHandler = $helperWfdownloads->getHandler('Report');
198 198
 //    $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads');
199
-    $broken_table  = new Wfdownloads\DbupdaterTable('wfdownloads_broken');
200
-    $fields        = get_table_info($brokenHandler->table, $broken_fields);
201
-    update_table($broken_fields, $fields, $broken_table);
202
-    if ($dbupdater->updateTable($broken_table)) {
203
-        echo 'Broken Reports table updated<br>';
204
-    }
205
-    unset($fields);
199
+	$broken_table  = new Wfdownloads\DbupdaterTable('wfdownloads_broken');
200
+	$fields        = get_table_info($brokenHandler->table, $broken_fields);
201
+	update_table($broken_fields, $fields, $broken_table);
202
+	if ($dbupdater->updateTable($broken_table)) {
203
+		echo 'Broken Reports table updated<br>';
204
+	}
205
+	unset($fields);
206 206
 }
207 207
 
208 208
 // =========================================================================================
@@ -215,49 +215,49 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function invert_nohtm_dohtml_values()
217 217
 {
218
-    $ret = [];
219
-    global $xoopsDB;
220
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
221
-    $catHandler = $helperWfdownloads->getHandler('Category');
222
-    $result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
223
-    while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
224
-        $fields[$existing_field['field']] = $existing_field['type'];
225
-    }
226
-    if (in_array('nohtml', array_keys($fields))) {
227
-        $dbupdater = new Wfdownloads\Dbupdater();
228
-        //Invert column values
229
-        // alter options in wfdownloads_cat
230
-        $table = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
231
-        $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'");
232
-        $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'");
233
-        $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'");
234
-        $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'");
235
-        $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'");
236
-
237
-        //inverting values no=1 <=> do=0
238
-        // have to store teporarly as value = 2 to
239
-        // avoid putting everithing to same value
240
-        // if you change 1 to 0, then 0 to one,
241
-        // every value will be 1, follow me?
242
-        $table->addUpdatedWhere('dohtml', 2, '=1');
243
-        $table->addUpdatedWhere('dohtml', 1, '=0');
244
-        $table->addUpdatedWhere('dohtml', 0, '=2');
245
-
246
-        $table->addUpdatedWhere('dosmiley', 2, '=1');
247
-        $table->addUpdatedWhere('dosmiley', 1, '=0');
248
-        $table->addUpdatedWhere('dosmiley', 0, '=2');
249
-
250
-        $table->addUpdatedWhere('doxcode', 2, '=1');
251
-        $table->addUpdatedWhere('doxcode', 1, '=0');
252
-        $table->addUpdatedWhere('doxcode', 0, '=2');
253
-
254
-        $table->addUpdatedWhere('doimage', 2, '=1');
255
-        $table->addUpdatedWhere('doimage', 1, '=0');
256
-        $table->addUpdatedWhere('doimage', 0, '=2');
257
-        $ret = $dbupdater->updateTable($table);
258
-    }
259
-
260
-    return $ret;
218
+	$ret = [];
219
+	global $xoopsDB;
220
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
221
+	$catHandler = $helperWfdownloads->getHandler('Category');
222
+	$result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
223
+	while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
224
+		$fields[$existing_field['field']] = $existing_field['type'];
225
+	}
226
+	if (in_array('nohtml', array_keys($fields))) {
227
+		$dbupdater = new Wfdownloads\Dbupdater();
228
+		//Invert column values
229
+		// alter options in wfdownloads_cat
230
+		$table = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
231
+		$table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'");
232
+		$table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'");
233
+		$table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'");
234
+		$table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'");
235
+		$table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'");
236
+
237
+		//inverting values no=1 <=> do=0
238
+		// have to store teporarly as value = 2 to
239
+		// avoid putting everithing to same value
240
+		// if you change 1 to 0, then 0 to one,
241
+		// every value will be 1, follow me?
242
+		$table->addUpdatedWhere('dohtml', 2, '=1');
243
+		$table->addUpdatedWhere('dohtml', 1, '=0');
244
+		$table->addUpdatedWhere('dohtml', 0, '=2');
245
+
246
+		$table->addUpdatedWhere('dosmiley', 2, '=1');
247
+		$table->addUpdatedWhere('dosmiley', 1, '=0');
248
+		$table->addUpdatedWhere('dosmiley', 0, '=2');
249
+
250
+		$table->addUpdatedWhere('doxcode', 2, '=1');
251
+		$table->addUpdatedWhere('doxcode', 1, '=0');
252
+		$table->addUpdatedWhere('doxcode', 0, '=2');
253
+
254
+		$table->addUpdatedWhere('doimage', 2, '=1');
255
+		$table->addUpdatedWhere('doimage', 1, '=0');
256
+		$table->addUpdatedWhere('doimage', 0, '=2');
257
+		$ret = $dbupdater->updateTable($table);
258
+	}
259
+
260
+	return $ret;
261 261
 }
262 262
 
263 263
 /**
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
  */
271 271
 function update_table($new_fields, $existing_fields, &$table)
272 272
 {
273
-    foreach ($new_fields as $field => $fieldinfo) {
274
-        $type = $fieldinfo['Type'];
275
-        if (!in_array($field, array_keys($existing_fields))) {
276
-            //Add field as it is missing
277
-            $table->addNewField($field, $type);
278
-        //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
279
-            //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
280
-        } elseif ($existing_fields[$field] != $type) {
281
-            $table->addAlteredField($field, $field . ' ' . $type);
282
-        // check $fields[$field]['type'] for things like "int(10) unsigned"
283
-            //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
284
-            //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
285
-        } else {
286
-            //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>";
287
-        }
288
-    }
273
+	foreach ($new_fields as $field => $fieldinfo) {
274
+		$type = $fieldinfo['Type'];
275
+		if (!in_array($field, array_keys($existing_fields))) {
276
+			//Add field as it is missing
277
+			$table->addNewField($field, $type);
278
+		//$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
279
+			//echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
280
+		} elseif ($existing_fields[$field] != $type) {
281
+			$table->addAlteredField($field, $field . ' ' . $type);
282
+		// check $fields[$field]['type'] for things like "int(10) unsigned"
283
+			//$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
284
+			//echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
285
+		} else {
286
+			//echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>";
287
+		}
288
+	}
289 289
 }
290 290
 
291 291
 /**
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
  */
299 299
 function get_table_info($table, $default_fields)
300 300
 {
301
-    global $xoopsDB;
302
-    $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
303
-    while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
304
-        $fields[$existing_field['Field']] = $existing_field['Type'];
305
-        if ('YES' !== $existing_field['Null']) {
306
-            $fields[$existing_field['Field']] .= ' NOT NULL';
307
-        }
308
-        if ($existing_field['Extra']) {
309
-            $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
310
-        }
311
-        if ($default_fields[$existing_field['Field']]['Default']) {
312
-            $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
313
-        }
314
-    }
315
-
316
-    return $fields;
301
+	global $xoopsDB;
302
+	$result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
303
+	while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
304
+		$fields[$existing_field['Field']] = $existing_field['Type'];
305
+		if ('YES' !== $existing_field['Null']) {
306
+			$fields[$existing_field['Field']] .= ' NOT NULL';
307
+		}
308
+		if ($existing_field['Extra']) {
309
+			$fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
310
+		}
311
+		if ($default_fields[$existing_field['Field']]['Default']) {
312
+			$fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
313
+		}
314
+	}
315
+
316
+	return $fields;
317 317
 }
318 318
 
319 319
 /**
@@ -327,60 +327,60 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function rename_fields(&$table, $renamed_fields, &$fields, $new_fields)
329 329
 {
330
-    foreach (array_keys($fields) as $field) {
331
-        if (in_array($field, array_keys($renamed_fields))) {
332
-            $new_field_name = $renamed_fields[$field];
333
-            $new_field_type = $new_fields[$new_field_name]['Type'];
334
-            $table->addAltered($field, $new_field_name . ' ' . $new_field_type);
335
-            //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
336
-            //echo $field." Renamed to ".$new_field_name."<br>";
337
-            $fields[$new_field_name] = $new_field_type;
338
-        }
339
-    }
340
-    //return $fields;
330
+	foreach (array_keys($fields) as $field) {
331
+		if (in_array($field, array_keys($renamed_fields))) {
332
+			$new_field_name = $renamed_fields[$field];
333
+			$new_field_type = $new_fields[$new_field_name]['Type'];
334
+			$table->addAltered($field, $new_field_name . ' ' . $new_field_type);
335
+			//$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
336
+			//echo $field." Renamed to ".$new_field_name."<br>";
337
+			$fields[$new_field_name] = $new_field_type;
338
+		}
339
+	}
340
+	//return $fields;
341 341
 }
342 342
 
343 343
 $op = \Xmf\Request::getInt('op', 0, 'REQUEST');
344 344
 switch ($op) {
345
-    case 1:
346
-        // Make sure that nohtml is properly changed to dohtml
347
-        invert_nohtm_dohtml_values();
348
-        // Ensure that the proper tables are present
349
-        update_tables_to_300();
350
-        // Import data from MyDownloads
351
-        import_mydownloads_to_wfdownloads();
352
-        break;
353
-
354
-    case 2:
355
-        // Update WF-Downloads
356
-        $log = invert_nohtm_dohtml_values();
357
-        update_tables_to_300();
358
-        break;
359
-
360
-    default:
361
-        //ask what to do
362
-        include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
363
-        $form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
364
-
365
-        //Is MyDownloads installed?
366
-        /** @var XoopsModuleHandler $moduleHandler */
367
-        $moduleHandler     = xoops_getHandler('module');
368
-        $mydownloadsModule = $moduleHandler->getByDirname('mydownloads');
369
-        if (is_object($mydownloadsModule)) {
370
-            $mydownloadsButton = new \XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit');
371
-            $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'");
372
-            $form->addElement($mydownloadsButton);
373
-        }
374
-
375
-        if (!wfdownloads_TableExists('wfdownloads_meta')) {
376
-            $updateButton = new \XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit');
377
-            $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'");
378
-            $form->addElement($updateButton);
379
-        }
380
-
381
-        $form->addElement(new \XoopsFormHidden('op', 0));
382
-        $form->display();
383
-        break;
345
+	case 1:
346
+		// Make sure that nohtml is properly changed to dohtml
347
+		invert_nohtm_dohtml_values();
348
+		// Ensure that the proper tables are present
349
+		update_tables_to_300();
350
+		// Import data from MyDownloads
351
+		import_mydownloads_to_wfdownloads();
352
+		break;
353
+
354
+	case 2:
355
+		// Update WF-Downloads
356
+		$log = invert_nohtm_dohtml_values();
357
+		update_tables_to_300();
358
+		break;
359
+
360
+	default:
361
+		//ask what to do
362
+		include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
363
+		$form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
364
+
365
+		//Is MyDownloads installed?
366
+		/** @var XoopsModuleHandler $moduleHandler */
367
+		$moduleHandler     = xoops_getHandler('module');
368
+		$mydownloadsModule = $moduleHandler->getByDirname('mydownloads');
369
+		if (is_object($mydownloadsModule)) {
370
+			$mydownloadsButton = new \XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit');
371
+			$mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'");
372
+			$form->addElement($mydownloadsButton);
373
+		}
374
+
375
+		if (!wfdownloads_TableExists('wfdownloads_meta')) {
376
+			$updateButton = new \XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit');
377
+			$updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'");
378
+			$form->addElement($updateButton);
379
+		}
380
+
381
+		$form->addElement(new \XoopsFormHidden('op', 0));
382
+		$form->display();
383
+		break;
384 384
 }
385 385
 //wfdownloads_modFooter();
386 386
 //xoops_cp_footer();
Please login to merge, or discard this patch.
admin/customtag.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -17,32 +17,32 @@  discard block
 block discarded – undo
17 17
 
18 18
 function editcustomtag($showmenu = false, $customtagid = 0, $clone = false)
19 19
 {
20
-    global $smartobjectCustomtagHandler;
21
-
22
-    $customtagObj = $smartobjectCustomtagHandler->get($customtagid);
23
-
24
-    if (!$clone && !$customtagObj->isNew()) {
25
-        if ($showmenu) {
26
-            //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _AM_SOBJECT_EDITING);
27
-        }
28
-        Smartobject\Utility::getCollapsableBar('customtagedit', _AM_SOBJECT_CUSTOMTAGS_EDIT, _AM_SOBJECT_CUSTOMTAGS_EDIT_INFO);
29
-
30
-        $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_EDIT, 'addcustomtag');
31
-        $sform->display();
32
-        Smartobject\Utility::closeCollapsable('customtagedit');
33
-    } else {
34
-        $customtagObj->setVar('customtagid', 0);
35
-        $customtagObj->setVar('tag', '');
36
-
37
-        if ($showmenu) {
38
-            //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _CO_SOBJECT_CREATINGNEW);
39
-        }
40
-
41
-        Smartobject\Utility::getCollapsableBar('customtagcreate', _AM_SOBJECT_CUSTOMTAGS_CREATE, _AM_SOBJECT_CUSTOMTAGS_CREATE_INFO);
42
-        $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'addcustomtag');
43
-        $sform->display();
44
-        Smartobject\Utility::closeCollapsable('customtagcreate');
45
-    }
20
+	global $smartobjectCustomtagHandler;
21
+
22
+	$customtagObj = $smartobjectCustomtagHandler->get($customtagid);
23
+
24
+	if (!$clone && !$customtagObj->isNew()) {
25
+		if ($showmenu) {
26
+			//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _AM_SOBJECT_EDITING);
27
+		}
28
+		Smartobject\Utility::getCollapsableBar('customtagedit', _AM_SOBJECT_CUSTOMTAGS_EDIT, _AM_SOBJECT_CUSTOMTAGS_EDIT_INFO);
29
+
30
+		$sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_EDIT, 'addcustomtag');
31
+		$sform->display();
32
+		Smartobject\Utility::closeCollapsable('customtagedit');
33
+	} else {
34
+		$customtagObj->setVar('customtagid', 0);
35
+		$customtagObj->setVar('tag', '');
36
+
37
+		if ($showmenu) {
38
+			//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _CO_SOBJECT_CREATINGNEW);
39
+		}
40
+
41
+		Smartobject\Utility::getCollapsableBar('customtagcreate', _AM_SOBJECT_CUSTOMTAGS_CREATE, _AM_SOBJECT_CUSTOMTAGS_CREATE_INFO);
42
+		$sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'addcustomtag');
43
+		$sform->display();
44
+		Smartobject\Utility::closeCollapsable('customtagcreate');
45
+	}
46 46
 }
47 47
 
48 48
 require_once __DIR__ . '/admin_header.php';
@@ -57,70 +57,70 @@  discard block
 block discarded – undo
57 57
 $op = '';
58 58
 
59 59
 if (isset($_GET['op'])) {
60
-    $op = $_GET['op'];
60
+	$op = $_GET['op'];
61 61
 }
62 62
 if (isset($_POST['op'])) {
63
-    $op = $_POST['op'];
63
+	$op = $_POST['op'];
64 64
 }
65 65
 
66 66
 switch ($op) {
67
-    case 'mod':
67
+	case 'mod':
68 68
 
69
-        $customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
69
+		$customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
70 70
 
71
-        Smartobject\Utility::getXoopsCpHeader();
72
-        $adminObject->displayNavigation(basename(__FILE__));
71
+		Smartobject\Utility::getXoopsCpHeader();
72
+		$adminObject->displayNavigation(basename(__FILE__));
73 73
 
74
-        editcustomtag(true, $customtagid);
75
-        break;
74
+		editcustomtag(true, $customtagid);
75
+		break;
76 76
 
77
-    case 'clone':
77
+	case 'clone':
78 78
 
79
-        $customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
79
+		$customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
80 80
 
81
-        Smartobject\Utility::getXoopsCpHeader();
82
-        $adminObject->displayNavigation(basename(__FILE__));
81
+		Smartobject\Utility::getXoopsCpHeader();
82
+		$adminObject->displayNavigation(basename(__FILE__));
83 83
 
84
-        editcustomtag(true, $customtagid, true);
85
-        break;
84
+		editcustomtag(true, $customtagid, true);
85
+		break;
86 86
 
87
-    case 'addcustomtag':
87
+	case 'addcustomtag':
88 88
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
89
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
90
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED);
91
-        break;
89
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
90
+		$controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED);
91
+		break;
92 92
 
93
-    case 'del':
93
+	case 'del':
94 94
 
95 95
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
96
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
97
-        $controller->handleObjectDeletion();
96
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
97
+		$controller->handleObjectDeletion();
98 98
 
99
-        break;
99
+		break;
100 100
 
101
-    default:
101
+	default:
102 102
 
103
-        Smartobject\Utility::getXoopsCpHeader();
104
-        $adminObject->displayNavigation(basename(__FILE__));
105
-        $adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', '');
106
-        $adminObject->displayButton('left', '');
103
+		Smartobject\Utility::getXoopsCpHeader();
104
+		$adminObject->displayNavigation(basename(__FILE__));
105
+		$adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', '');
106
+		$adminObject->displayButton('left', '');
107 107
 
108
-        //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS);
108
+		//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS);
109 109
 
110
-        Smartobject\Utility::getCollapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC);
110
+		Smartobject\Utility::getCollapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC);
111 111
 
112 112
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
113
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectCustomtagHandler);
114
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left', 150, 'getCustomtagName'));
115
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
116
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('language', 'center', 150));
113
+		$objectTable = new XoopsModules\Smartobject\Table($smartobjectCustomtagHandler);
114
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left', 150, 'getCustomtagName'));
115
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
116
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('language', 'center', 150));
117 117
 
118
-        //      $objectTable->addCustomAction('getCreateItemLink');
119
-        //      $objectTable->addCustomAction('getCreateAttributLink');
118
+		//      $objectTable->addCustomAction('getCreateItemLink');
119
+		//      $objectTable->addCustomAction('getCreateAttributLink');
120 120
 
121
-        //      $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button
121
+		//      $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button
122 122
 
123
-        /*
123
+		/*
124 124
                 $criteria_upcoming = new \CriteriaCompo();
125 125
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
126 126
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
                                             'criteria' => $criteria_last30days
145 145
                 ));
146 146
         */
147
-        $objectTable->addQuickSearch(['title', 'summary', 'description']);
148
-        $objectTable->addCustomAction('getCloneLink');
147
+		$objectTable->addQuickSearch(['title', 'summary', 'description']);
148
+		$objectTable->addCustomAction('getCloneLink');
149 149
 
150
-        $objectTable->render();
150
+		$objectTable->render();
151 151
 
152
-        echo '<br>';
153
-        Smartobject\Utility::closeCollapsable('createdcustomtags');
154
-        echo '<br>';
152
+		echo '<br>';
153
+		Smartobject\Utility::closeCollapsable('createdcustomtags');
154
+		echo '<br>';
155 155
 
156
-        break;
156
+		break;
157 157
 }
158 158
 
159 159
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/rating.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -16,44 +16,44 @@  discard block
 block discarded – undo
16 16
 
17 17
 function editclass($showmenu = false, $ratingid = 0)
18 18
 {
19
-    global $smartobjectRatingHandler;
20
-
21
-    $ratingObj = $smartobjectRatingHandler->get($ratingid);
22
-
23
-    if (!$ratingObj->isNew()) {
24
-        if ($showmenu) {
25
-            //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING);
26
-        }
27
-        Smartobject\Utility::getCollapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO);
28
-
29
-        $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating');
30
-        $sform->display();
31
-        Smartobject\Utility::closeCollapsable('ratingedit');
32
-    } else {
33
-        $ratingObj->hideFieldFromForm(['item', 'itemid', 'uid', 'date', 'rate']);
34
-
35
-        if (isset($_POST['op'])) {
36
-            $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
37
-            $controller->postDataToObject($ratingObj);
38
-
39
-            if ('changedField' === $_POST['op']) {
40
-                switch ($_POST['changedField']) {
41
-                    case 'dirname':
42
-                        $ratingObj->showFieldOnForm(['item', 'itemid', 'uid', 'date', 'rate']);
43
-                        break;
44
-                }
45
-            }
46
-        }
47
-
48
-        if ($showmenu) {
49
-            //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW);
50
-        }
51
-
52
-        Smartobject\Utility::getCollapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO);
53
-        $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating');
54
-        $sform->display();
55
-        Smartobject\Utility::closeCollapsable('ratingcreate');
56
-    }
19
+	global $smartobjectRatingHandler;
20
+
21
+	$ratingObj = $smartobjectRatingHandler->get($ratingid);
22
+
23
+	if (!$ratingObj->isNew()) {
24
+		if ($showmenu) {
25
+			//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING);
26
+		}
27
+		Smartobject\Utility::getCollapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO);
28
+
29
+		$sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating');
30
+		$sform->display();
31
+		Smartobject\Utility::closeCollapsable('ratingedit');
32
+	} else {
33
+		$ratingObj->hideFieldFromForm(['item', 'itemid', 'uid', 'date', 'rate']);
34
+
35
+		if (isset($_POST['op'])) {
36
+			$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
37
+			$controller->postDataToObject($ratingObj);
38
+
39
+			if ('changedField' === $_POST['op']) {
40
+				switch ($_POST['changedField']) {
41
+					case 'dirname':
42
+						$ratingObj->showFieldOnForm(['item', 'itemid', 'uid', 'date', 'rate']);
43
+						break;
44
+				}
45
+			}
46
+		}
47
+
48
+		if ($showmenu) {
49
+			//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW);
50
+		}
51
+
52
+		Smartobject\Utility::getCollapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO);
53
+		$sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating');
54
+		$sform->display();
55
+		Smartobject\Utility::closeCollapsable('ratingcreate');
56
+	}
57 57
 }
58 58
 
59 59
 require_once __DIR__ . '/admin_header.php';
@@ -65,60 +65,60 @@  discard block
 block discarded – undo
65 65
 $op = '';
66 66
 
67 67
 if (isset($_GET['op'])) {
68
-    $op = $_GET['op'];
68
+	$op = $_GET['op'];
69 69
 }
70 70
 if (isset($_POST['op'])) {
71
-    $op = $_POST['op'];
71
+	$op = $_POST['op'];
72 72
 }
73 73
 
74 74
 switch ($op) {
75
-    case 'mod':
76
-    case 'changedField':
75
+	case 'mod':
76
+	case 'changedField':
77 77
 
78
-        $ratingid = \Xmf\Request::getInt('ratingid', 0, 'GET');
78
+		$ratingid = \Xmf\Request::getInt('ratingid', 0, 'GET');
79 79
 
80
-        Smartobject\Utility::getXoopsCpHeader();
81
-        $adminObject->displayNavigation(basename(__FILE__));
80
+		Smartobject\Utility::getXoopsCpHeader();
81
+		$adminObject->displayNavigation(basename(__FILE__));
82 82
 
83
-        editclass(true, $ratingid);
84
-        break;
83
+		editclass(true, $ratingid);
84
+		break;
85 85
 
86
-    case 'addrating':
86
+	case 'addrating':
87 87
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
88
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
-        $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
88
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
+		$controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
90 90
 
91
-        break;
91
+		break;
92 92
 
93
-    case 'del':
93
+	case 'del':
94 94
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
96
-        $controller->handleObjectDeletion();
95
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
96
+		$controller->handleObjectDeletion();
97 97
 
98
-        break;
98
+		break;
99 99
 
100
-    default:
100
+	default:
101 101
 
102
-        Smartobject\Utility::getXoopsCpHeader();
103
-        $adminObject->displayNavigation(basename(__FILE__));
102
+		Smartobject\Utility::getXoopsCpHeader();
103
+		$adminObject->displayNavigation(basename(__FILE__));
104 104
 
105
-        //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS);
105
+		//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS);
106 106
 
107
-        Smartobject\Utility::getCollapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC);
107
+		Smartobject\Utility::getCollapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC);
108 108
 
109 109
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
110
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectRatingHandler);
111
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left'));
112
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('dirname', 'left'));
113
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('item', 'left', false, 'getItemValue'));
114
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('date', 'center', 150));
115
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('rate', 'center', 40, 'getRateValue'));
116
-
117
-        //      $objectTable->addCustomAction('getCreateItemLink');
118
-        //      $objectTable->addCustomAction('getCreateAttributLink');
119
-
120
-        $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE);
121
-        /*
110
+		$objectTable = new XoopsModules\Smartobject\Table($smartobjectRatingHandler);
111
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left'));
112
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('dirname', 'left'));
113
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('item', 'left', false, 'getItemValue'));
114
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('date', 'center', 150));
115
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('rate', 'center', 40, 'getRateValue'));
116
+
117
+		//      $objectTable->addCustomAction('getCreateItemLink');
118
+		//      $objectTable->addCustomAction('getCreateAttributLink');
119
+
120
+		$objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE);
121
+		/*
122 122
                 $criteria_upcoming = new \CriteriaCompo();
123 123
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
124 124
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
                 ));
144 144
         */
145 145
 
146
-        $objectTable->render();
146
+		$objectTable->render();
147 147
 
148
-        echo '<br>';
149
-        Smartobject\Utility::closeCollapsable('createdratings');
150
-        echo '<br>';
148
+		echo '<br>';
149
+		Smartobject\Utility::closeCollapsable('createdratings');
150
+		echo '<br>';
151 151
 
152
-        break;
152
+		break;
153 153
 }
154 154
 
155 155
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
sendlink.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -28,82 +28,82 @@
 block discarded – undo
28 28
 $op = \Xmf\Request::getString('op', '', 'POST');
29 29
 
30 30
 switch ($op) {
31
-    case 'sendlink':
31
+	case 'sendlink':
32 32
 
33 33
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
34
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
35
-
36
-        $linkObj = $controller->storeSmartObject();
37
-        if ($linkObj->hasError()) {
38
-            /**
39
-             * @todo inform user and propose to close the window if a problem occured when saving the link
40
-             */
41
-        }
42
-
43
-        $xoopsMailer = xoops_getMailer();
44
-        $xoopsMailer->useMail();
45
-        $xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template');
46
-
47
-        $xoopsMailer->setTemplate('sendlink.tpl');
48
-        $xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
49
-        $xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name'));
50
-        $xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name'));
51
-        $xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
52
-        $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
53
-        $xoopsMailer->assign('MESSAGE', $_POST['body']);
54
-        $xoopsMailer->setToEmails($linkObj->getVar('to_email'));
55
-        $xoopsMailer->setFromEmail($linkObj->getVar('from_email'));
56
-        $xoopsMailer->setFromName($xoopsConfig['sitename']);
57
-        $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename'])));
58
-
59
-        if (!$xoopsMailer->send(true)) {
60
-            $xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true));
61
-        } else {
62
-            $xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS);
63
-        }
64
-
65
-        break;
66
-
67
-    default:
68
-        if (isset($_GET['mid'])) {
69
-            $mid = $_GET['mid'];
70
-        } else {
71
-            /**
72
-             * @todo close the window if no mid is passed as GET
73
-             */
74
-        }
75
-
76
-        $hModule = xoops_getHandler('module');
77
-        $module  = $hModule->get($mid);
78
-        $linkObj->setVar('mid', $module->getVar('mid'));
79
-        $linkObj->setVar('mid_name', $module->getVar('name'));
80
-
81
-        if (isset($_GET['link'])) {
82
-            $link = $_GET['link'];
83
-        } else {
84
-            /**
85
-             * @todo close the window if no link is passed as GET
86
-             */
87
-        }
88
-        $linkObj->setVar('link', $link);
89
-
90
-        if (is_object($xoopsUser)) {
91
-            $linkObj->setVar('from_uid', $xoopsUser->getVar('uid'));
92
-            $linkObj->setVar('from_name', '' !== $xoopsUser->getVar('name') ? $xoopsUser->getVar('name') : $xoopsUser->getVar('uname'));
93
-            $linkObj->setVar('from_email', $xoopsUser->getVar('email'));
94
-        }
95
-
96
-        $linkObj->setVar('subject', sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $xoopsConfig['sitename']));
97
-        $linkObj->setVar('body', sprintf(_CO_SOBJECT_BODY_DEFAULT, $xoopsConfig['sitename'], $link));
98
-        $linkObj->setVar('date', time());
99
-        $linkObj->hideFieldFromForm(['from_uid', 'to_uid', 'link', 'mid', 'mid_name']);
100
-
101
-        $form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();');
102
-
103
-        $form->assign($xoopsTpl);
104
-
105
-        $xoopsTpl->assign('showform', true);
106
-        break;
34
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
35
+
36
+		$linkObj = $controller->storeSmartObject();
37
+		if ($linkObj->hasError()) {
38
+			/**
39
+			 * @todo inform user and propose to close the window if a problem occured when saving the link
40
+			 */
41
+		}
42
+
43
+		$xoopsMailer = xoops_getMailer();
44
+		$xoopsMailer->useMail();
45
+		$xoopsMailer->setTemplateDir('language/' . $xoopsConfig['language'] . '/mail_template');
46
+
47
+		$xoopsMailer->setTemplate('sendlink.tpl');
48
+		$xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
49
+		$xoopsMailer->assign('TO_NAME', $linkObj->getVar('to_name'));
50
+		$xoopsMailer->assign('FROM_NAME', $linkObj->getVar('from_name'));
51
+		$xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
52
+		$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
53
+		$xoopsMailer->assign('MESSAGE', $_POST['body']);
54
+		$xoopsMailer->setToEmails($linkObj->getVar('to_email'));
55
+		$xoopsMailer->setFromEmail($linkObj->getVar('from_email'));
56
+		$xoopsMailer->setFromName($xoopsConfig['sitename']);
57
+		$xoopsMailer->setSubject(sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $myts->oopsStripSlashesGPC($xoopsConfig['sitename'])));
58
+
59
+		if (!$xoopsMailer->send(true)) {
60
+			$xoopsTpl->assign('send_error', sprintf(_CO_SOBJECT_SEND_ERROR, $xoopsConfig['adminmail']) . '<br>' . $xoopsMailer->getErrors(true));
61
+		} else {
62
+			$xoopsTpl->assign('send_success', _CO_SOBJECT_SEND_SUCCESS);
63
+		}
64
+
65
+		break;
66
+
67
+	default:
68
+		if (isset($_GET['mid'])) {
69
+			$mid = $_GET['mid'];
70
+		} else {
71
+			/**
72
+			 * @todo close the window if no mid is passed as GET
73
+			 */
74
+		}
75
+
76
+		$hModule = xoops_getHandler('module');
77
+		$module  = $hModule->get($mid);
78
+		$linkObj->setVar('mid', $module->getVar('mid'));
79
+		$linkObj->setVar('mid_name', $module->getVar('name'));
80
+
81
+		if (isset($_GET['link'])) {
82
+			$link = $_GET['link'];
83
+		} else {
84
+			/**
85
+			 * @todo close the window if no link is passed as GET
86
+			 */
87
+		}
88
+		$linkObj->setVar('link', $link);
89
+
90
+		if (is_object($xoopsUser)) {
91
+			$linkObj->setVar('from_uid', $xoopsUser->getVar('uid'));
92
+			$linkObj->setVar('from_name', '' !== $xoopsUser->getVar('name') ? $xoopsUser->getVar('name') : $xoopsUser->getVar('uname'));
93
+			$linkObj->setVar('from_email', $xoopsUser->getVar('email'));
94
+		}
95
+
96
+		$linkObj->setVar('subject', sprintf(_CO_SOBJECT_SUBJECT_DEFAULT, $xoopsConfig['sitename']));
97
+		$linkObj->setVar('body', sprintf(_CO_SOBJECT_BODY_DEFAULT, $xoopsConfig['sitename'], $link));
98
+		$linkObj->setVar('date', time());
99
+		$linkObj->hideFieldFromForm(['from_uid', 'to_uid', 'link', 'mid', 'mid_name']);
100
+
101
+		$form = $linkObj->getForm(_CO_SOBJECT_SEND_LINK_FORM, 'sendlink', false, _SEND, 'javascript:window.close();');
102
+
103
+		$form->assign($xoopsTpl);
104
+
105
+		$xoopsTpl->assign('showform', true);
106
+		break;
107 107
 }
108 108
 
109 109
 $xoopsTpl->display('db:smartobject_sendlink.tpl');
Please login to merge, or discard this patch.
class/MetaGen.php 1 patch
Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -22,357 +22,357 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class MetaGen
24 24
 {
25
-    public $_myts;
26
-
27
-    public $_title;
28
-    public $_original_title;
29
-    public $_keywords;
30
-    public $_meta_description;
31
-    public $_categoryPath;
32
-    public $_description;
33
-    public $_minChar = 4;
34
-
35
-    /**
36
-     * SmartMetaGen constructor.
37
-     * @param      $title
38
-     * @param bool $keywords
39
-     * @param bool $description
40
-     * @param bool $categoryPath
41
-     */
42
-    public function __construct($title, $keywords = false, $description = false, $categoryPath = false)
43
-    {
44
-        $this->_myts = \MyTextSanitizer::getInstance();
45
-        $this->setCategoryPath($categoryPath);
46
-        $this->setTitle($title);
47
-        $this->setDescription($description);
48
-
49
-        if (!$keywords) {
50
-            $keywords = $this->createMetaKeywords();
51
-        }
52
-
53
-        /*      $myts = \MyTextSanitizer::getInstance();
25
+	public $_myts;
26
+
27
+	public $_title;
28
+	public $_original_title;
29
+	public $_keywords;
30
+	public $_meta_description;
31
+	public $_categoryPath;
32
+	public $_description;
33
+	public $_minChar = 4;
34
+
35
+	/**
36
+	 * SmartMetaGen constructor.
37
+	 * @param      $title
38
+	 * @param bool $keywords
39
+	 * @param bool $description
40
+	 * @param bool $categoryPath
41
+	 */
42
+	public function __construct($title, $keywords = false, $description = false, $categoryPath = false)
43
+	{
44
+		$this->_myts = \MyTextSanitizer::getInstance();
45
+		$this->setCategoryPath($categoryPath);
46
+		$this->setTitle($title);
47
+		$this->setDescription($description);
48
+
49
+		if (!$keywords) {
50
+			$keywords = $this->createMetaKeywords();
51
+		}
52
+
53
+		/*      $myts = \MyTextSanitizer::getInstance();
54 54
          if (method_exists($myts, 'formatForML')) {
55 55
          $keywords = $myts->formatForML($keywords);
56 56
          $description = $myts->formatForML($description);
57 57
          }
58 58
          */
59
-        $this->setKeywords($keywords);
60
-    }
61
-
62
-    /**
63
-     * Return true if the string is length > 0
64
-     *
65
-     * @credit psylove
66
-     *
67
-     * @var    string $string Chaine de caract�re
68
-     * @return boolean
69
-     */
70
-    public function emptyString($var)
71
-    {
72
-        return (strlen($var) > 0);
73
-    }
74
-
75
-    /**
76
-     * Create a title for the short_url field of an article
77
-     *
78
-     * @credit psylove
79
-     *
80
-     * @var    string      $title title of the article
81
-     * @param  bool|string $withExt
82
-     * @return string      sort_url for the article
83
-     */
84
-    public function generateSeoTitle($title = '', $withExt = true)
85
-    {
86
-        // Transformation de la chaine en minuscule
87
-        // Codage de la chaine afin d'éviter les erreurs 500 en cas de caractères imprévus
88
-        $title = rawurlencode(strtolower($title));
89
-
90
-        // Transformation des ponctuations
91
-        $pattern = [
92
-            '/%09/', // Tab
93
-            '/%20/', // Space
94
-            '/%21/', // !
95
-            '/%22/', // "
96
-            '/%23/', // #
97
-            '/%25/', // %
98
-            '/%26/', // &
99
-            '/%27/', // '
100
-            '/%28/', // (
101
-            '/%29/', // )
102
-            '/%2C/', // ,
103
-            '/%2F/', // /
104
-            '/%3A/', // :
105
-            '/%3B/', // ;
106
-            '/%3C/', // <
107
-            '/%3D/', // =
108
-            '/%3E/', // >
109
-            '/%3F/', // ?
110
-            '/%40/', // @
111
-            '/%5B/', // [
112
-            '/%5C/', // \
113
-            '/%5D/', // ]
114
-            '/%5E/', // ^
115
-            '/%7B/', // {
116
-            '/%7C/', // |
117
-            '/%7D/', // }
118
-            '/%7E/', // ~
119
-            "/\./" // .
120
-        ];
121
-        $rep_pat = [
122
-            '-',
123
-            '-',
124
-            '-',
125
-            '-',
126
-            '-',
127
-            '-100',
128
-            '-',
129
-            '-',
130
-            '-',
131
-            '-',
132
-            '-',
133
-            '-',
134
-            '-',
135
-            '-',
136
-            '-',
137
-            '-',
138
-            '-',
139
-            '-',
140
-            '-at-',
141
-            '-',
142
-            '-',
143
-            '-',
144
-            '-',
145
-            '-',
146
-            '-',
147
-            '-',
148
-            '-',
149
-            '-'
150
-        ];
151
-        $title   = preg_replace($pattern, $rep_pat, $title);
152
-
153
-        // Transformation des caractères accentués
154
-        $pattern = [
155
-            '/%B0/', // °
156
-            '/%E8/', // è
157
-            '/%E9/', // é
158
-            '/%EA/', // ê
159
-            '/%EB/', // ë
160
-            '/%E7/', // ç
161
-            '/%E0/', // à
162
-            '/%E2/', // â
163
-            '/%E4/', // ä
164
-            '/%EE/', // î
165
-            '/%EF/', // ï
166
-            '/%F9/', // ù
167
-            '/%FC/', // ü
168
-            '/%FB/', // û
169
-            '/%F4/', // ô
170
-            '/%F6/', // ö
171
-        ];
172
-        $rep_pat = ['-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o'];
173
-        $title   = preg_replace($pattern, $rep_pat, $title);
174
-
175
-        $tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
176
-        $tableau = array_filter($tableau, [$this, 'emptyString']); // Supprime les chaines vides du tableau
177
-        $title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
178
-
179
-        if (count($title) > 0) {
180
-            if ($withExt) {
181
-                $title .= '.html';
182
-            }
183
-
184
-            return $title;
185
-        } else {
186
-            return '';
187
-        }
188
-    }
189
-
190
-    /**
191
-     * @param $document
192
-     * @return mixed
193
-     */
194
-    public function html2text($document)
195
-    {
196
-        return Smartobject\Utility::getHtml2text($document);
197
-    }
198
-
199
-    /**
200
-     * @param $title
201
-     */
202
-    public function setTitle($title)
203
-    {
204
-        global $xoopsModule;
205
-        /** @var Smartobject\Helper $helper */
206
-        $helper = Smartobject\Helper::getInstance();
207
-
208
-        $this->_title          = $this->html2text($title);
209
-        $this->_title          = $this->purifyText($this->_title);
210
-        $this->_original_title = $this->_title;
211
-
212
-        $moduleName = $xoopsModule->getVar('name');
213
-
214
-        $titleTag = [];
215
-
216
-        $show_mod_name_breadcrumb = null !==($helper->getConfig('show_mod_name_breadcrumb')) ? $helper->getConfig('show_mod_name_breadcrumb') : true;
217
-
218
-        if ($moduleName && $show_mod_name_breadcrumb) {
219
-            $titleTag['module'] = $moduleName;
220
-        }
221
-
222
-        if (isset($this->_title) && ('' !== $this->_title) && (strtoupper($this->_title) != strtoupper($moduleName))) {
223
-            $titleTag['title'] = $this->_title;
224
-        }
225
-
226
-        if (isset($this->_categoryPath) && ('' !== $this->_categoryPath)) {
227
-            $titleTag['category'] = $this->_categoryPath;
228
-        }
229
-
230
-        $ret = isset($titleTag['title']) ? $titleTag['title'] : '';
231
-
232
-        if (isset($titleTag['category']) && '' !== $titleTag['category']) {
233
-            if ('' !== $ret) {
234
-                $ret .= ' - ';
235
-            }
236
-            $ret .= $titleTag['category'];
237
-        }
238
-        if (isset($titleTag['module']) && '' !== $titleTag['module']) {
239
-            if ('' !== $ret) {
240
-                $ret .= ' - ';
241
-            }
242
-            $ret .= $titleTag['module'];
243
-        }
244
-        $this->_title = $ret;
245
-    }
246
-
247
-    /**
248
-     * @param $keywords
249
-     */
250
-    public function setKeywords($keywords)
251
-    {
252
-        $this->_keywords = $keywords;
253
-    }
254
-
255
-    /**
256
-     * @param $categoryPath
257
-     */
258
-    public function setCategoryPath($categoryPath)
259
-    {
260
-        $categoryPath        = $this->html2text($categoryPath);
261
-        $this->_categoryPath = $categoryPath;
262
-    }
263
-
264
-    /**
265
-     * @param $description
266
-     */
267
-    public function setDescription($description)
268
-    {
269
-        if (!$description) {
270
-            /** @var Smartobject\Helper $helper */
271
-            $helper = Smartobject\Helper::getInstance();
272
-
273
-            if  (null !== ($helper->getConfig('module_meta_description'))) {
274
-                $description = $helper->getConfig('module_meta_description');
275
-            }
276
-        }
277
-
278
-        $description = $this->html2text($description);
279
-        $description = $this->purifyText($description);
280
-
281
-        $description = preg_replace("/([^\r\n])\r\n([^\r\n])/", "\\1 \\2", $description);
282
-        $description = preg_replace("/[\r\n]*\r\n[\r\n]*/", "\r\n\r\n", $description);
283
-        $description = preg_replace('/[ ]* [ ]*/', ' ', $description);
284
-        $description = stripslashes($description);
285
-
286
-        $this->_description      = $description;
287
-        $this->_meta_description = $this->createMetaDescription();
288
-    }
289
-
290
-    public function createTitleTag()
291
-    {
292
-    }
293
-
294
-    /**
295
-     * @param               $text
296
-     * @param  bool         $keyword
297
-     * @return mixed|string
298
-     */
299
-    public function purifyText($text, $keyword = false)
300
-    {
301
-        return Smartobject\Utility::purifyText($text, $keyword);
302
-    }
303
-
304
-    /**
305
-     * @param  int $maxWords
306
-     * @return string
307
-     */
308
-    public function createMetaDescription($maxWords = 100)
309
-    {
310
-        $words = [];
311
-        $words = explode(' ', $this->_description);
312
-
313
-        // Only keep $maxWords words
314
-        $newWords = [];
315
-        $i        = 0;
316
-
317
-        while ($i < $maxWords - 1 && $i < count($words)) {
318
-            $newWords[] = $words[$i];
319
-            ++$i;
320
-        }
321
-        $ret = implode(' ', $newWords);
322
-
323
-        return $ret;
324
-    }
325
-
326
-    /**
327
-     * @param $text
328
-     * @param $minChar
329
-     * @return array
330
-     */
331
-    public function findMetaKeywords($text, $minChar)
332
-    {
333
-        $keywords = [];
334
-
335
-        $text = $this->purifyText($text);
336
-        $text = $this->html2text($text);
337
-
338
-        $text = preg_replace("/([^\r\n])\r\n([^\r\n])/", "\\1 \\2", $text);
339
-        $text = preg_replace("/[\r\n]*\r\n[\r\n]*/", "\r\n\r\n", $text);
340
-        $text = preg_replace('/[ ]* [ ]*/', ' ', $text);
341
-        $text = stripslashes($text);
342
-        $text =
343
-
344
-        $originalKeywords = preg_split('/[^a-zA-Z\'"-]+/', $text, -1, PREG_SPLIT_NO_EMPTY);
345
-
346
-        foreach ($originalKeywords as $originalKeyword) {
347
-            $secondRoundKeywords = explode("'", $originalKeyword);
348
-            foreach ($secondRoundKeywords as $secondRoundKeyword) {
349
-                if (strlen($secondRoundKeyword) >= $minChar) {
350
-                    if (!in_array($secondRoundKeyword, $keywords)) {
351
-                        $keywords[] = trim($secondRoundKeyword);
352
-                    }
353
-                }
354
-            }
355
-        }
356
-
357
-        return $keywords;
358
-    }
359
-
360
-    /**
361
-     * @return string
362
-     */
363
-    public function createMetaKeywords()
364
-    {
365
-        /** @var Smartobject\Helper $helper */
366
-        $helper = Smartobject\Helper::getInstance();
367
-
368
-        $keywords = $this->findMetaKeywords($this->_original_title . ' ' . $this->_description, $this->_minChar);
369
-        if (null !== ($helper->getModule()) && null !== ($helper->getConfig('moduleMetaKeywords'))
370
-            && '' !== $helper->getConfig('moduleMetaKeywords')) {
371
-            $moduleKeywords = explode(',', $helper->getConfig('moduleMetaKeywords'));
372
-            $keywords       = array_merge($keywords, $moduleKeywords);
373
-        }
374
-
375
-        /* Commenting this out as it may cause problem on XOOPS ML websites
59
+		$this->setKeywords($keywords);
60
+	}
61
+
62
+	/**
63
+	 * Return true if the string is length > 0
64
+	 *
65
+	 * @credit psylove
66
+	 *
67
+	 * @var    string $string Chaine de caract�re
68
+	 * @return boolean
69
+	 */
70
+	public function emptyString($var)
71
+	{
72
+		return (strlen($var) > 0);
73
+	}
74
+
75
+	/**
76
+	 * Create a title for the short_url field of an article
77
+	 *
78
+	 * @credit psylove
79
+	 *
80
+	 * @var    string      $title title of the article
81
+	 * @param  bool|string $withExt
82
+	 * @return string      sort_url for the article
83
+	 */
84
+	public function generateSeoTitle($title = '', $withExt = true)
85
+	{
86
+		// Transformation de la chaine en minuscule
87
+		// Codage de la chaine afin d'éviter les erreurs 500 en cas de caractères imprévus
88
+		$title = rawurlencode(strtolower($title));
89
+
90
+		// Transformation des ponctuations
91
+		$pattern = [
92
+			'/%09/', // Tab
93
+			'/%20/', // Space
94
+			'/%21/', // !
95
+			'/%22/', // "
96
+			'/%23/', // #
97
+			'/%25/', // %
98
+			'/%26/', // &
99
+			'/%27/', // '
100
+			'/%28/', // (
101
+			'/%29/', // )
102
+			'/%2C/', // ,
103
+			'/%2F/', // /
104
+			'/%3A/', // :
105
+			'/%3B/', // ;
106
+			'/%3C/', // <
107
+			'/%3D/', // =
108
+			'/%3E/', // >
109
+			'/%3F/', // ?
110
+			'/%40/', // @
111
+			'/%5B/', // [
112
+			'/%5C/', // \
113
+			'/%5D/', // ]
114
+			'/%5E/', // ^
115
+			'/%7B/', // {
116
+			'/%7C/', // |
117
+			'/%7D/', // }
118
+			'/%7E/', // ~
119
+			"/\./" // .
120
+		];
121
+		$rep_pat = [
122
+			'-',
123
+			'-',
124
+			'-',
125
+			'-',
126
+			'-',
127
+			'-100',
128
+			'-',
129
+			'-',
130
+			'-',
131
+			'-',
132
+			'-',
133
+			'-',
134
+			'-',
135
+			'-',
136
+			'-',
137
+			'-',
138
+			'-',
139
+			'-',
140
+			'-at-',
141
+			'-',
142
+			'-',
143
+			'-',
144
+			'-',
145
+			'-',
146
+			'-',
147
+			'-',
148
+			'-',
149
+			'-'
150
+		];
151
+		$title   = preg_replace($pattern, $rep_pat, $title);
152
+
153
+		// Transformation des caractères accentués
154
+		$pattern = [
155
+			'/%B0/', // °
156
+			'/%E8/', // è
157
+			'/%E9/', // é
158
+			'/%EA/', // ê
159
+			'/%EB/', // ë
160
+			'/%E7/', // ç
161
+			'/%E0/', // à
162
+			'/%E2/', // â
163
+			'/%E4/', // ä
164
+			'/%EE/', // î
165
+			'/%EF/', // ï
166
+			'/%F9/', // ù
167
+			'/%FC/', // ü
168
+			'/%FB/', // û
169
+			'/%F4/', // ô
170
+			'/%F6/', // ö
171
+		];
172
+		$rep_pat = ['-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o'];
173
+		$title   = preg_replace($pattern, $rep_pat, $title);
174
+
175
+		$tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
176
+		$tableau = array_filter($tableau, [$this, 'emptyString']); // Supprime les chaines vides du tableau
177
+		$title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
178
+
179
+		if (count($title) > 0) {
180
+			if ($withExt) {
181
+				$title .= '.html';
182
+			}
183
+
184
+			return $title;
185
+		} else {
186
+			return '';
187
+		}
188
+	}
189
+
190
+	/**
191
+	 * @param $document
192
+	 * @return mixed
193
+	 */
194
+	public function html2text($document)
195
+	{
196
+		return Smartobject\Utility::getHtml2text($document);
197
+	}
198
+
199
+	/**
200
+	 * @param $title
201
+	 */
202
+	public function setTitle($title)
203
+	{
204
+		global $xoopsModule;
205
+		/** @var Smartobject\Helper $helper */
206
+		$helper = Smartobject\Helper::getInstance();
207
+
208
+		$this->_title          = $this->html2text($title);
209
+		$this->_title          = $this->purifyText($this->_title);
210
+		$this->_original_title = $this->_title;
211
+
212
+		$moduleName = $xoopsModule->getVar('name');
213
+
214
+		$titleTag = [];
215
+
216
+		$show_mod_name_breadcrumb = null !==($helper->getConfig('show_mod_name_breadcrumb')) ? $helper->getConfig('show_mod_name_breadcrumb') : true;
217
+
218
+		if ($moduleName && $show_mod_name_breadcrumb) {
219
+			$titleTag['module'] = $moduleName;
220
+		}
221
+
222
+		if (isset($this->_title) && ('' !== $this->_title) && (strtoupper($this->_title) != strtoupper($moduleName))) {
223
+			$titleTag['title'] = $this->_title;
224
+		}
225
+
226
+		if (isset($this->_categoryPath) && ('' !== $this->_categoryPath)) {
227
+			$titleTag['category'] = $this->_categoryPath;
228
+		}
229
+
230
+		$ret = isset($titleTag['title']) ? $titleTag['title'] : '';
231
+
232
+		if (isset($titleTag['category']) && '' !== $titleTag['category']) {
233
+			if ('' !== $ret) {
234
+				$ret .= ' - ';
235
+			}
236
+			$ret .= $titleTag['category'];
237
+		}
238
+		if (isset($titleTag['module']) && '' !== $titleTag['module']) {
239
+			if ('' !== $ret) {
240
+				$ret .= ' - ';
241
+			}
242
+			$ret .= $titleTag['module'];
243
+		}
244
+		$this->_title = $ret;
245
+	}
246
+
247
+	/**
248
+	 * @param $keywords
249
+	 */
250
+	public function setKeywords($keywords)
251
+	{
252
+		$this->_keywords = $keywords;
253
+	}
254
+
255
+	/**
256
+	 * @param $categoryPath
257
+	 */
258
+	public function setCategoryPath($categoryPath)
259
+	{
260
+		$categoryPath        = $this->html2text($categoryPath);
261
+		$this->_categoryPath = $categoryPath;
262
+	}
263
+
264
+	/**
265
+	 * @param $description
266
+	 */
267
+	public function setDescription($description)
268
+	{
269
+		if (!$description) {
270
+			/** @var Smartobject\Helper $helper */
271
+			$helper = Smartobject\Helper::getInstance();
272
+
273
+			if  (null !== ($helper->getConfig('module_meta_description'))) {
274
+				$description = $helper->getConfig('module_meta_description');
275
+			}
276
+		}
277
+
278
+		$description = $this->html2text($description);
279
+		$description = $this->purifyText($description);
280
+
281
+		$description = preg_replace("/([^\r\n])\r\n([^\r\n])/", "\\1 \\2", $description);
282
+		$description = preg_replace("/[\r\n]*\r\n[\r\n]*/", "\r\n\r\n", $description);
283
+		$description = preg_replace('/[ ]* [ ]*/', ' ', $description);
284
+		$description = stripslashes($description);
285
+
286
+		$this->_description      = $description;
287
+		$this->_meta_description = $this->createMetaDescription();
288
+	}
289
+
290
+	public function createTitleTag()
291
+	{
292
+	}
293
+
294
+	/**
295
+	 * @param               $text
296
+	 * @param  bool         $keyword
297
+	 * @return mixed|string
298
+	 */
299
+	public function purifyText($text, $keyword = false)
300
+	{
301
+		return Smartobject\Utility::purifyText($text, $keyword);
302
+	}
303
+
304
+	/**
305
+	 * @param  int $maxWords
306
+	 * @return string
307
+	 */
308
+	public function createMetaDescription($maxWords = 100)
309
+	{
310
+		$words = [];
311
+		$words = explode(' ', $this->_description);
312
+
313
+		// Only keep $maxWords words
314
+		$newWords = [];
315
+		$i        = 0;
316
+
317
+		while ($i < $maxWords - 1 && $i < count($words)) {
318
+			$newWords[] = $words[$i];
319
+			++$i;
320
+		}
321
+		$ret = implode(' ', $newWords);
322
+
323
+		return $ret;
324
+	}
325
+
326
+	/**
327
+	 * @param $text
328
+	 * @param $minChar
329
+	 * @return array
330
+	 */
331
+	public function findMetaKeywords($text, $minChar)
332
+	{
333
+		$keywords = [];
334
+
335
+		$text = $this->purifyText($text);
336
+		$text = $this->html2text($text);
337
+
338
+		$text = preg_replace("/([^\r\n])\r\n([^\r\n])/", "\\1 \\2", $text);
339
+		$text = preg_replace("/[\r\n]*\r\n[\r\n]*/", "\r\n\r\n", $text);
340
+		$text = preg_replace('/[ ]* [ ]*/', ' ', $text);
341
+		$text = stripslashes($text);
342
+		$text =
343
+
344
+		$originalKeywords = preg_split('/[^a-zA-Z\'"-]+/', $text, -1, PREG_SPLIT_NO_EMPTY);
345
+
346
+		foreach ($originalKeywords as $originalKeyword) {
347
+			$secondRoundKeywords = explode("'", $originalKeyword);
348
+			foreach ($secondRoundKeywords as $secondRoundKeyword) {
349
+				if (strlen($secondRoundKeyword) >= $minChar) {
350
+					if (!in_array($secondRoundKeyword, $keywords)) {
351
+						$keywords[] = trim($secondRoundKeyword);
352
+					}
353
+				}
354
+			}
355
+		}
356
+
357
+		return $keywords;
358
+	}
359
+
360
+	/**
361
+	 * @return string
362
+	 */
363
+	public function createMetaKeywords()
364
+	{
365
+		/** @var Smartobject\Helper $helper */
366
+		$helper = Smartobject\Helper::getInstance();
367
+
368
+		$keywords = $this->findMetaKeywords($this->_original_title . ' ' . $this->_description, $this->_minChar);
369
+		if (null !== ($helper->getModule()) && null !== ($helper->getConfig('moduleMetaKeywords'))
370
+			&& '' !== $helper->getConfig('moduleMetaKeywords')) {
371
+			$moduleKeywords = explode(',', $helper->getConfig('moduleMetaKeywords'));
372
+			$keywords       = array_merge($keywords, $moduleKeywords);
373
+		}
374
+
375
+		/* Commenting this out as it may cause problem on XOOPS ML websites
376 376
          $return_keywords = array();
377 377
 
378 378
          // Cleaning for duplicate keywords
@@ -382,45 +382,45 @@  discard block
 block discarded – undo
382 382
          }
383 383
          }*/
384 384
 
385
-        // Only take the first 90 keywords
386
-        $newKeywords = [];
387
-        $i           = 0;
388
-        while ($i < 90 - 1 && isset($keywords[$i])) {
389
-            $newKeywords[] = $keywords[$i];
390
-            ++$i;
391
-        }
392
-        $ret = implode(', ', $newKeywords);
393
-
394
-        return $ret;
395
-    }
396
-
397
-    public function autoBuildMeta_keywords()
398
-    {
399
-    }
400
-
401
-    public function buildAutoMetaTags()
402
-    {
403
-        global $xoopsModule;
404
-        /** @var Smartobject\Helper $helper */
405
-        $helper = Smartobject\Helper::getInstance();
406
-
407
-        $this->_keywords         = $this->createMetaKeywords();
408
-        $this->_meta_description = $this->createMetaDescription();
409
-        $this->_title            = $this->createTitleTag();
410
-    }
411
-
412
-    public function createMetaTags()
413
-    {
414
-        global $xoopsTpl, $xoTheme;
415
-
416
-        if (is_object($xoTheme)) {
417
-            $xoTheme->addMeta('meta', 'keywords', $this->_keywords);
418
-            $xoTheme->addMeta('meta', 'description', $this->_description);
419
-            $xoTheme->addMeta('meta', 'title', $this->_title);
420
-        } else {
421
-            $xoopsTpl->assign('xoops_meta_keywords', $this->_keywords);
422
-            $xoopsTpl->assign('xoops_meta_description', $this->_description);
423
-        }
424
-        $xoopsTpl->assign('xoops_pagetitle', $this->_title);
425
-    }
385
+		// Only take the first 90 keywords
386
+		$newKeywords = [];
387
+		$i           = 0;
388
+		while ($i < 90 - 1 && isset($keywords[$i])) {
389
+			$newKeywords[] = $keywords[$i];
390
+			++$i;
391
+		}
392
+		$ret = implode(', ', $newKeywords);
393
+
394
+		return $ret;
395
+	}
396
+
397
+	public function autoBuildMeta_keywords()
398
+	{
399
+	}
400
+
401
+	public function buildAutoMetaTags()
402
+	{
403
+		global $xoopsModule;
404
+		/** @var Smartobject\Helper $helper */
405
+		$helper = Smartobject\Helper::getInstance();
406
+
407
+		$this->_keywords         = $this->createMetaKeywords();
408
+		$this->_meta_description = $this->createMetaDescription();
409
+		$this->_title            = $this->createTitleTag();
410
+	}
411
+
412
+	public function createMetaTags()
413
+	{
414
+		global $xoopsTpl, $xoTheme;
415
+
416
+		if (is_object($xoTheme)) {
417
+			$xoTheme->addMeta('meta', 'keywords', $this->_keywords);
418
+			$xoTheme->addMeta('meta', 'description', $this->_description);
419
+			$xoTheme->addMeta('meta', 'title', $this->_title);
420
+		} else {
421
+			$xoopsTpl->assign('xoops_meta_keywords', $this->_keywords);
422
+			$xoopsTpl->assign('xoops_meta_description', $this->_description);
423
+		}
424
+		$xoopsTpl->assign('xoops_pagetitle', $this->_title);
425
+	}
426 426
 }
Please login to merge, or discard this patch.