@@ -11,44 +11,44 @@ discard block |
||
11 | 11 | |
12 | 12 | function editclass($showmenu = false, $ratingid = 0) |
13 | 13 | { |
14 | - global $smartobjectRatingHandler; |
|
15 | - |
|
16 | - $ratingObj = $smartobjectRatingHandler->get($ratingid); |
|
17 | - |
|
18 | - if (!$ratingObj->isNew()) { |
|
19 | - if ($showmenu) { |
|
20 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING); |
|
21 | - } |
|
22 | - smart_collapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO); |
|
23 | - |
|
24 | - $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating'); |
|
25 | - $sform->display(); |
|
26 | - smart_close_collapsable('ratingedit'); |
|
27 | - } else { |
|
28 | - $ratingObj->hideFieldFromForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
29 | - |
|
30 | - if (isset($_POST['op'])) { |
|
31 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
32 | - $controller->postDataToObject($ratingObj); |
|
33 | - |
|
34 | - if ($_POST['op'] === 'changedField') { |
|
35 | - switch ($_POST['changedField']) { |
|
36 | - case 'dirname': |
|
37 | - $ratingObj->showFieldOnForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
38 | - break; |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - |
|
43 | - if ($showmenu) { |
|
44 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW); |
|
45 | - } |
|
46 | - |
|
47 | - smart_collapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO); |
|
48 | - $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating'); |
|
49 | - $sform->display(); |
|
50 | - smart_close_collapsable('ratingcreate'); |
|
51 | - } |
|
14 | + global $smartobjectRatingHandler; |
|
15 | + |
|
16 | + $ratingObj = $smartobjectRatingHandler->get($ratingid); |
|
17 | + |
|
18 | + if (!$ratingObj->isNew()) { |
|
19 | + if ($showmenu) { |
|
20 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING); |
|
21 | + } |
|
22 | + smart_collapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO); |
|
23 | + |
|
24 | + $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating'); |
|
25 | + $sform->display(); |
|
26 | + smart_close_collapsable('ratingedit'); |
|
27 | + } else { |
|
28 | + $ratingObj->hideFieldFromForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
29 | + |
|
30 | + if (isset($_POST['op'])) { |
|
31 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
32 | + $controller->postDataToObject($ratingObj); |
|
33 | + |
|
34 | + if ($_POST['op'] === 'changedField') { |
|
35 | + switch ($_POST['changedField']) { |
|
36 | + case 'dirname': |
|
37 | + $ratingObj->showFieldOnForm(array('item', 'itemid', 'uid', 'date', 'rate')); |
|
38 | + break; |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | + |
|
43 | + if ($showmenu) { |
|
44 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW); |
|
45 | + } |
|
46 | + |
|
47 | + smart_collapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO); |
|
48 | + $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating'); |
|
49 | + $sform->display(); |
|
50 | + smart_close_collapsable('ratingcreate'); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | require_once __DIR__ . '/admin_header.php'; |
@@ -60,60 +60,60 @@ discard block |
||
60 | 60 | $op = ''; |
61 | 61 | |
62 | 62 | if (isset($_GET['op'])) { |
63 | - $op = $_GET['op']; |
|
63 | + $op = $_GET['op']; |
|
64 | 64 | } |
65 | 65 | if (isset($_POST['op'])) { |
66 | - $op = $_POST['op']; |
|
66 | + $op = $_POST['op']; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | switch ($op) { |
70 | - case 'mod': |
|
71 | - case 'changedField': |
|
70 | + case 'mod': |
|
71 | + case 'changedField': |
|
72 | 72 | |
73 | - $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
73 | + $ratingid = isset($_GET['ratingid']) ? (int)$_GET['ratingid'] : 0; |
|
74 | 74 | |
75 | - smart_xoops_cp_header(); |
|
76 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
75 | + smart_xoops_cp_header(); |
|
76 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
77 | 77 | |
78 | - editclass(true, $ratingid); |
|
79 | - break; |
|
78 | + editclass(true, $ratingid); |
|
79 | + break; |
|
80 | 80 | |
81 | - case 'addrating': |
|
82 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
83 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
84 | - $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php'); |
|
81 | + case 'addrating': |
|
82 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
83 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
84 | + $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php'); |
|
85 | 85 | |
86 | - break; |
|
86 | + break; |
|
87 | 87 | |
88 | - case 'del': |
|
89 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | - $controller = new SmartObjectController($smartobjectRatingHandler); |
|
91 | - $controller->handleObjectDeletion(); |
|
88 | + case 'del': |
|
89 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
90 | + $controller = new SmartObjectController($smartobjectRatingHandler); |
|
91 | + $controller->handleObjectDeletion(); |
|
92 | 92 | |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | - default: |
|
95 | + default: |
|
96 | 96 | |
97 | - smart_xoops_cp_header(); |
|
98 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | + smart_xoops_cp_header(); |
|
98 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
99 | 99 | |
100 | - //smart_adminMenu(4, _AM_SOBJECT_RATINGS); |
|
100 | + //smart_adminMenu(4, _AM_SOBJECT_RATINGS); |
|
101 | 101 | |
102 | - smart_collapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC); |
|
102 | + smart_collapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC); |
|
103 | 103 | |
104 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
105 | - $objectTable = new SmartObjectTable($smartobjectRatingHandler); |
|
106 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left')); |
|
107 | - $objectTable->addColumn(new SmartObjectColumn('dirname', 'left')); |
|
108 | - $objectTable->addColumn(new SmartObjectColumn('item', 'left', false, 'getItemValue')); |
|
109 | - $objectTable->addColumn(new SmartObjectColumn('date', 'center', 150)); |
|
110 | - $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 40, 'getRateValue')); |
|
104 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
105 | + $objectTable = new SmartObjectTable($smartobjectRatingHandler); |
|
106 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left')); |
|
107 | + $objectTable->addColumn(new SmartObjectColumn('dirname', 'left')); |
|
108 | + $objectTable->addColumn(new SmartObjectColumn('item', 'left', false, 'getItemValue')); |
|
109 | + $objectTable->addColumn(new SmartObjectColumn('date', 'center', 150)); |
|
110 | + $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 40, 'getRateValue')); |
|
111 | 111 | |
112 | - // $objectTable->addCustomAction('getCreateItemLink'); |
|
113 | - // $objectTable->addCustomAction('getCreateAttributLink'); |
|
112 | + // $objectTable->addCustomAction('getCreateItemLink'); |
|
113 | + // $objectTable->addCustomAction('getCreateAttributLink'); |
|
114 | 114 | |
115 | - $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE); |
|
116 | - /* |
|
115 | + $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE); |
|
116 | + /* |
|
117 | 117 | $criteria_upcoming = new CriteriaCompo(); |
118 | 118 | $criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
119 | 119 | $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | )); |
139 | 139 | */ |
140 | 140 | |
141 | - $objectTable->render(); |
|
141 | + $objectTable->render(); |
|
142 | 142 | |
143 | - echo '<br>'; |
|
144 | - smart_close_collapsable('createdratings'); |
|
145 | - echo '<br>'; |
|
143 | + echo '<br>'; |
|
144 | + smart_close_collapsable('createdratings'); |
|
145 | + echo '<br>'; |
|
146 | 146 | |
147 | - break; |
|
147 | + break; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | //smart_modFooter(); |
@@ -21,81 +21,81 @@ |
||
21 | 21 | $op = ''; |
22 | 22 | |
23 | 23 | if (isset($_GET['op'])) { |
24 | - $op = $_GET['op']; |
|
24 | + $op = $_GET['op']; |
|
25 | 25 | } |
26 | 26 | if (isset($_POST['op'])) { |
27 | - $op = $_POST['op']; |
|
27 | + $op = $_POST['op']; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | switch ($op) { |
31 | 31 | |
32 | - case 'del': |
|
33 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
34 | - $controller = new SmartObjectController($smartobjectLinkHandler); |
|
35 | - $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); |
|
32 | + case 'del': |
|
33 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
34 | + $controller = new SmartObjectController($smartobjectLinkHandler); |
|
35 | + $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM); |
|
36 | 36 | |
37 | - break; |
|
37 | + break; |
|
38 | 38 | |
39 | - case 'view': |
|
40 | - $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; |
|
41 | - $linkObj = $smartobjectLinkHandler->get($linkid); |
|
39 | + case 'view': |
|
40 | + $linkid = isset($_GET['linkid']) ? $_GET['linkid'] : 0; |
|
41 | + $linkObj = $smartobjectLinkHandler->get($linkid); |
|
42 | 42 | |
43 | - if ($linkObj->isNew()) { |
|
44 | - redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND); |
|
45 | - } |
|
43 | + if ($linkObj->isNew()) { |
|
44 | + redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND); |
|
45 | + } |
|
46 | 46 | |
47 | - smart_xoops_cp_header(); |
|
47 | + smart_xoops_cp_header(); |
|
48 | 48 | |
49 | - //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); |
|
49 | + //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY); |
|
50 | 50 | |
51 | - smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); |
|
51 | + smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO); |
|
52 | 52 | |
53 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
53 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
54 | 54 | |
55 | - // --- |
|
56 | - // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
57 | - // $xoopsTpl = new XoopsTpl(); |
|
58 | - $xoopsTpl = new XoopsTpl(); |
|
59 | - //--- |
|
55 | + // --- |
|
56 | + // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated. |
|
57 | + // $xoopsTpl = new XoopsTpl(); |
|
58 | + $xoopsTpl = new XoopsTpl(); |
|
59 | + //--- |
|
60 | 60 | |
61 | - $xoopsTpl->assign('link', $linkObj->toArray()); |
|
62 | - $xoopsTpl->display('db:smartobject_sentlink_display.tpl'); |
|
61 | + $xoopsTpl->assign('link', $linkObj->toArray()); |
|
62 | + $xoopsTpl->display('db:smartobject_sentlink_display.tpl'); |
|
63 | 63 | |
64 | - echo '<br>'; |
|
65 | - smart_close_collapsable('sentlinks'); |
|
66 | - echo '<br>'; |
|
64 | + echo '<br>'; |
|
65 | + smart_close_collapsable('sentlinks'); |
|
66 | + echo '<br>'; |
|
67 | 67 | |
68 | - break; |
|
68 | + break; |
|
69 | 69 | |
70 | - default: |
|
70 | + default: |
|
71 | 71 | |
72 | - smart_xoops_cp_header(); |
|
72 | + smart_xoops_cp_header(); |
|
73 | 73 | |
74 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
74 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
75 | 75 | |
76 | - //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS); |
|
76 | + //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS); |
|
77 | 77 | |
78 | - smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO); |
|
78 | + smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO); |
|
79 | 79 | |
80 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
81 | - $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, array('delete')); |
|
82 | - $objectTable->addColumn(new SmartObjectColumn('date')); |
|
83 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo')); |
|
84 | - $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo')); |
|
85 | - $objectTable->addColumn(new SmartObjectColumn('link')); |
|
80 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
81 | + $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, array('delete')); |
|
82 | + $objectTable->addColumn(new SmartObjectColumn('date')); |
|
83 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo')); |
|
84 | + $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo')); |
|
85 | + $objectTable->addColumn(new SmartObjectColumn('link')); |
|
86 | 86 | |
87 | - $objectTable->addCustomAction('getViewItemLink'); |
|
87 | + $objectTable->addCustomAction('getViewItemLink'); |
|
88 | 88 | |
89 | - $objectTable->setDefaultSort('date'); |
|
90 | - $objectTable->setDefaultOrder('DESC'); |
|
89 | + $objectTable->setDefaultSort('date'); |
|
90 | + $objectTable->setDefaultOrder('DESC'); |
|
91 | 91 | |
92 | - $objectTable->render(); |
|
92 | + $objectTable->render(); |
|
93 | 93 | |
94 | - echo '<br>'; |
|
95 | - smart_close_collapsable('sentlinks'); |
|
96 | - echo '<br>'; |
|
94 | + echo '<br>'; |
|
95 | + smart_close_collapsable('sentlinks'); |
|
96 | + echo '<br>'; |
|
97 | 97 | |
98 | - break; |
|
98 | + break; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | //smart_modFooter(); |
@@ -12,45 +12,45 @@ discard block |
||
12 | 12 | |
13 | 13 | function edittag($tagid = 0, $language = false, $fct = false) |
14 | 14 | { |
15 | - global $smartobjectTagHandler; |
|
16 | - |
|
17 | - $tagObj = $smartobjectTagHandler->get($tagid); |
|
18 | - |
|
19 | - if ($tagObj->isNew()) { |
|
20 | - $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE; |
|
21 | - $title = _AM_SOBJECT_TAG_CREATE; |
|
22 | - $info = _AM_SOBJECT_TAG_CREATE_INFO; |
|
23 | - $collaps_name = 'tagcreate'; |
|
24 | - $form_name = _AM_SOBJECT_TAG_CREATE; |
|
25 | - $submit_button_caption = null; |
|
26 | - //$tagObj->stripMultilanguageFields(); |
|
27 | - } else { |
|
28 | - if ($language) { |
|
29 | - $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE; |
|
30 | - $title = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
31 | - $info = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO; |
|
32 | - $collaps_name = 'tageditlanguage'; |
|
33 | - $form_name = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
34 | - $submit_button_caption = null; |
|
35 | - $tagObj->makeNonMLFieldReadOnly(); |
|
36 | - } else { |
|
37 | - $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING; |
|
38 | - $title = _AM_SOBJECT_TAG_EDIT; |
|
39 | - $info = _AM_SOBJECT_TAG_EDIT_INFO; |
|
40 | - $collaps_name = 'tagedit'; |
|
41 | - $form_name = _AM_SOBJECT_TAG_EDIT; |
|
42 | - $submit_button_caption = null; |
|
43 | - $tagObj->stripMultilanguageFields(); |
|
44 | - } |
|
45 | - } |
|
46 | - |
|
47 | - //smart_adminMenu(2, $breadcrumb); |
|
48 | - |
|
49 | - smart_collapsableBar($collaps_name, $title, $info); |
|
50 | - |
|
51 | - $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption); |
|
52 | - $sform->display(); |
|
53 | - smart_close_collapsable($collaps_name); |
|
15 | + global $smartobjectTagHandler; |
|
16 | + |
|
17 | + $tagObj = $smartobjectTagHandler->get($tagid); |
|
18 | + |
|
19 | + if ($tagObj->isNew()) { |
|
20 | + $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE; |
|
21 | + $title = _AM_SOBJECT_TAG_CREATE; |
|
22 | + $info = _AM_SOBJECT_TAG_CREATE_INFO; |
|
23 | + $collaps_name = 'tagcreate'; |
|
24 | + $form_name = _AM_SOBJECT_TAG_CREATE; |
|
25 | + $submit_button_caption = null; |
|
26 | + //$tagObj->stripMultilanguageFields(); |
|
27 | + } else { |
|
28 | + if ($language) { |
|
29 | + $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE; |
|
30 | + $title = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
31 | + $info = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO; |
|
32 | + $collaps_name = 'tageditlanguage'; |
|
33 | + $form_name = _AM_SOBJECT_TAG_EDIT_LANGUAGE; |
|
34 | + $submit_button_caption = null; |
|
35 | + $tagObj->makeNonMLFieldReadOnly(); |
|
36 | + } else { |
|
37 | + $breadcrumb = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING; |
|
38 | + $title = _AM_SOBJECT_TAG_EDIT; |
|
39 | + $info = _AM_SOBJECT_TAG_EDIT_INFO; |
|
40 | + $collaps_name = 'tagedit'; |
|
41 | + $form_name = _AM_SOBJECT_TAG_EDIT; |
|
42 | + $submit_button_caption = null; |
|
43 | + $tagObj->stripMultilanguageFields(); |
|
44 | + } |
|
45 | + } |
|
46 | + |
|
47 | + //smart_adminMenu(2, $breadcrumb); |
|
48 | + |
|
49 | + smart_collapsableBar($collaps_name, $title, $info); |
|
50 | + |
|
51 | + $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption); |
|
52 | + $sform->display(); |
|
53 | + smart_close_collapsable($collaps_name); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | require_once __DIR__ . '/admin_header.php'; |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | $op = ''; |
63 | 63 | |
64 | 64 | if (isset($_GET['op'])) { |
65 | - $op = $_GET['op']; |
|
65 | + $op = $_GET['op']; |
|
66 | 66 | } |
67 | 67 | if (isset($_POST['op'])) { |
68 | - $op = $_POST['op']; |
|
68 | + $op = $_POST['op']; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $tagid = isset($_GET['tagid']) ? $_GET['tagid'] : 0; |
@@ -74,66 +74,66 @@ discard block |
||
74 | 74 | |
75 | 75 | switch ($op) { |
76 | 76 | |
77 | - case 'del': |
|
78 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
79 | - $controller = new SmartObjectController($smartobjectTagHandler); |
|
80 | - $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM); |
|
77 | + case 'del': |
|
78 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
79 | + $controller = new SmartObjectController($smartobjectTagHandler); |
|
80 | + $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM); |
|
81 | 81 | |
82 | - break; |
|
82 | + break; |
|
83 | 83 | |
84 | - case 'addtag': |
|
85 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
86 | - $controller = new SmartObjectController($smartobjectTagHandler); |
|
87 | - $tagObj = $controller->storeSmartObject(); |
|
88 | - if ($tagObj->hasError()) { |
|
89 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
90 | - exit; |
|
91 | - } |
|
84 | + case 'addtag': |
|
85 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
86 | + $controller = new SmartObjectController($smartobjectTagHandler); |
|
87 | + $tagObj = $controller->storeSmartObject(); |
|
88 | + if ($tagObj->hasError()) { |
|
89 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
90 | + exit; |
|
91 | + } |
|
92 | 92 | |
93 | - if ($tagObj->hasError()) { |
|
94 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
95 | - } else { |
|
96 | - redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS); |
|
97 | - } |
|
98 | - exit; |
|
99 | - break; |
|
93 | + if ($tagObj->hasError()) { |
|
94 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors()); |
|
95 | + } else { |
|
96 | + redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS); |
|
97 | + } |
|
98 | + exit; |
|
99 | + break; |
|
100 | 100 | |
101 | - case 'mod': |
|
102 | - smart_xoops_cp_header(); |
|
103 | - edittag($tagid, $language, $fct); |
|
104 | - break; |
|
101 | + case 'mod': |
|
102 | + smart_xoops_cp_header(); |
|
103 | + edittag($tagid, $language, $fct); |
|
104 | + break; |
|
105 | 105 | |
106 | - default: |
|
106 | + default: |
|
107 | 107 | |
108 | - smart_xoops_cp_header(); |
|
108 | + smart_xoops_cp_header(); |
|
109 | 109 | |
110 | - //smart_adminMenu(2, _AM_SOBJECT_TAGS); |
|
110 | + //smart_adminMenu(2, _AM_SOBJECT_TAGS); |
|
111 | 111 | |
112 | - smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO); |
|
112 | + smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO); |
|
113 | 113 | |
114 | - require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
115 | - $objectTable = new SmartObjectTable($smartobjectTagHandler, false, array('delete')); |
|
116 | - $objectTable->addColumn(new SmartObjectColumn('name')); |
|
117 | - $objectTable->addColumn(new SmartObjectColumn('language')); |
|
118 | - $objectTable->addColumn(new SmartObjectColumn('value')); |
|
119 | - // $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo')); |
|
114 | + require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
115 | + $objectTable = new SmartObjectTable($smartobjectTagHandler, false, array('delete')); |
|
116 | + $objectTable->addColumn(new SmartObjectColumn('name')); |
|
117 | + $objectTable->addColumn(new SmartObjectColumn('language')); |
|
118 | + $objectTable->addColumn(new SmartObjectColumn('value')); |
|
119 | + // $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo')); |
|
120 | 120 | |
121 | - $objectTable->addFilter('language', 'getLanguages'); |
|
121 | + $objectTable->addFilter('language', 'getLanguages'); |
|
122 | 122 | |
123 | - $objectTable->addCustomAction('getEditLanguageLink'); |
|
124 | - $objectTable->addCustomAction('getEditItemLink'); |
|
123 | + $objectTable->addCustomAction('getEditLanguageLink'); |
|
124 | + $objectTable->addCustomAction('getEditItemLink'); |
|
125 | 125 | |
126 | - $objectTable->setDefaultSort('tagid'); |
|
126 | + $objectTable->setDefaultSort('tagid'); |
|
127 | 127 | |
128 | - $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE); |
|
128 | + $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE); |
|
129 | 129 | |
130 | - $objectTable->render(); |
|
130 | + $objectTable->render(); |
|
131 | 131 | |
132 | - echo '<br>'; |
|
133 | - smart_close_collapsable('tags'); |
|
134 | - echo '<br>'; |
|
132 | + echo '<br>'; |
|
133 | + smart_close_collapsable('tags'); |
|
134 | + echo '<br>'; |
|
135 | 135 | |
136 | - break; |
|
136 | + break; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | //smart_modFooter(); |
@@ -18,180 +18,180 @@ discard block |
||
18 | 18 | // ========================================================================================= |
19 | 19 | function update_tables_to_300() |
20 | 20 | { |
21 | - $dbupdater = new WfdownloadsDbupdater(); |
|
21 | + $dbupdater = new WfdownloadsDbupdater(); |
|
22 | 22 | |
23 | - if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
24 | - // Create table wfdownloads_meta |
|
25 | - $table = new WfdownloadsTable('wfdownloads_meta'); |
|
26 | - $table->setStructure("CREATE TABLE %s ( |
|
23 | + if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
24 | + // Create table wfdownloads_meta |
|
25 | + $table = new WfdownloadsTable('wfdownloads_meta'); |
|
26 | + $table->setStructure("CREATE TABLE %s ( |
|
27 | 27 | metakey varchar(50) NOT NULL default '', |
28 | 28 | metavalue varchar(255) NOT NULL default '', |
29 | 29 | PRIMARY KEY (metakey)) |
30 | 30 | ENGINE=MyISAM;"); |
31 | 31 | |
32 | - $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2))); |
|
33 | - if ($dbupdater->updateTable($table)) { |
|
34 | - echo 'wfdownloads_meta table created<br>'; |
|
35 | - } |
|
36 | - } |
|
32 | + $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2))); |
|
33 | + if ($dbupdater->updateTable($table)) { |
|
34 | + echo 'wfdownloads_meta table created<br>'; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | - $download_fields = array( |
|
39 | - 'lid' => array('Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false), |
|
40 | - 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
41 | - 'title' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
42 | - 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
43 | - 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
44 | - 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
45 | - 'homepage' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
46 | - 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
47 | - 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
48 | - 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
49 | - 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
50 | - 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
51 | - 'publisher' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
52 | - 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
53 | - 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
54 | - 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
55 | - 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
56 | - 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
57 | - 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
58 | - 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
59 | - 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
60 | - 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
61 | - 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
62 | - 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
63 | - 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
64 | - 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
65 | - 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
66 | - 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
67 | - 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
68 | - 'published' => array('Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true), |
|
69 | - 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
70 | - 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
71 | - 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
72 | - 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
73 | - 'ipaddress' => array('Type' => "varchar(120) NOT NULL default '0'", 'Default' => true), |
|
74 | - 'notifypub' => array('Type' => "int(1) NOT NULL default '0'", 'Default' => true), |
|
75 | - 'summary' => array('Type' => 'text NOT NULL', 'Default' => false) |
|
76 | - ); |
|
38 | + $download_fields = array( |
|
39 | + 'lid' => array('Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false), |
|
40 | + 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
41 | + 'title' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
42 | + 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
43 | + 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
44 | + 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
45 | + 'homepage' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
46 | + 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
47 | + 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
48 | + 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
49 | + 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
50 | + 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
51 | + 'publisher' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
52 | + 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
53 | + 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
54 | + 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
55 | + 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
56 | + 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
57 | + 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
58 | + 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
59 | + 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
60 | + 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
61 | + 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
62 | + 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
63 | + 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
64 | + 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
65 | + 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
66 | + 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
67 | + 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
68 | + 'published' => array('Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true), |
|
69 | + 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
70 | + 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
71 | + 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
72 | + 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
73 | + 'ipaddress' => array('Type' => "varchar(120) NOT NULL default '0'", 'Default' => true), |
|
74 | + 'notifypub' => array('Type' => "int(1) NOT NULL default '0'", 'Default' => true), |
|
75 | + 'summary' => array('Type' => 'text NOT NULL', 'Default' => false) |
|
76 | + ); |
|
77 | 77 | |
78 | - $renamed_fields = array( |
|
79 | - 'logourl' => 'screenshot' |
|
80 | - ); |
|
78 | + $renamed_fields = array( |
|
79 | + 'logourl' => 'screenshot' |
|
80 | + ); |
|
81 | 81 | |
82 | - echo '<br><b>Checking Download table</b><br>'; |
|
83 | - $downloadHandler = xoops_getModuleHandler('download', 'wfdownloads'); |
|
84 | - $download_table = new WfdownloadsTable('wfdownloads_downloads'); |
|
85 | - $fields = get_table_info($downloadHandler->table, $download_fields); |
|
86 | - // Check for renamed fields |
|
87 | - rename_fields($download_table, $renamed_fields, $fields, $download_fields); |
|
88 | - update_table($download_fields, $fields, $download_table); |
|
89 | - if ($dbupdater->updateTable($download_table)) { |
|
90 | - echo 'Downloads table updated<br>'; |
|
91 | - } |
|
92 | - unset($fields); |
|
82 | + echo '<br><b>Checking Download table</b><br>'; |
|
83 | + $downloadHandler = xoops_getModuleHandler('download', 'wfdownloads'); |
|
84 | + $download_table = new WfdownloadsTable('wfdownloads_downloads'); |
|
85 | + $fields = get_table_info($downloadHandler->table, $download_fields); |
|
86 | + // Check for renamed fields |
|
87 | + rename_fields($download_table, $renamed_fields, $fields, $download_fields); |
|
88 | + update_table($download_fields, $fields, $download_table); |
|
89 | + if ($dbupdater->updateTable($download_table)) { |
|
90 | + echo 'Downloads table updated<br>'; |
|
91 | + } |
|
92 | + unset($fields); |
|
93 | 93 | |
94 | - $mod_fields = array( |
|
95 | - 'requestid' => array('Type' => 'int(11) NOT NULL auto_increment', 'Default' => false), |
|
96 | - 'lid' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
97 | - 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
98 | - 'title' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
99 | - 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
100 | - 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
101 | - 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
102 | - 'homepage' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
103 | - 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
104 | - 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
105 | - 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
106 | - 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
107 | - 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
108 | - 'publisher' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
109 | - 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
110 | - 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
111 | - 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
112 | - 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
113 | - 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
114 | - 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
115 | - 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
116 | - 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
117 | - 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
118 | - 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
119 | - 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
120 | - 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
121 | - 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
122 | - 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
123 | - 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
124 | - 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
125 | - 'published' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
126 | - 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
127 | - 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
128 | - 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
129 | - 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
130 | - 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
131 | - 'modifysubmitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
132 | - 'requestdate' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
133 | - ); |
|
94 | + $mod_fields = array( |
|
95 | + 'requestid' => array('Type' => 'int(11) NOT NULL auto_increment', 'Default' => false), |
|
96 | + 'lid' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
97 | + 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
98 | + 'title' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
99 | + 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
100 | + 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
101 | + 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
102 | + 'homepage' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
103 | + 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
104 | + 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
105 | + 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
106 | + 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
107 | + 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
108 | + 'publisher' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
109 | + 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
110 | + 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
111 | + 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
112 | + 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
113 | + 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
114 | + 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
115 | + 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
116 | + 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
117 | + 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
118 | + 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
119 | + 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
120 | + 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
121 | + 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
122 | + 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
123 | + 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
124 | + 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
125 | + 'published' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
126 | + 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
127 | + 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
128 | + 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
129 | + 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
130 | + 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
131 | + 'modifysubmitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
132 | + 'requestdate' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
133 | + ); |
|
134 | 134 | |
135 | - $renamed_fields = array( |
|
136 | - 'logourl' => 'screenshot' |
|
137 | - ); |
|
135 | + $renamed_fields = array( |
|
136 | + 'logourl' => 'screenshot' |
|
137 | + ); |
|
138 | 138 | |
139 | - echo '<br><b>Checking Modified Downloads table</b><br>'; |
|
140 | - $moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads'); |
|
141 | - $mod_table = new WfdownloadsTable('wfdownloads_mod'); |
|
142 | - $fields = get_table_info($moduleHandler->table, $mod_fields); |
|
143 | - rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); |
|
144 | - update_table($mod_fields, $fields, $mod_table); |
|
145 | - if ($dbupdater->updateTable($mod_table)) { |
|
146 | - echo 'Modified Downloads table updated <br>'; |
|
147 | - } |
|
148 | - unset($fields); |
|
139 | + echo '<br><b>Checking Modified Downloads table</b><br>'; |
|
140 | + $moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads'); |
|
141 | + $mod_table = new WfdownloadsTable('wfdownloads_mod'); |
|
142 | + $fields = get_table_info($moduleHandler->table, $mod_fields); |
|
143 | + rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); |
|
144 | + update_table($mod_fields, $fields, $mod_table); |
|
145 | + if ($dbupdater->updateTable($mod_table)) { |
|
146 | + echo 'Modified Downloads table updated <br>'; |
|
147 | + } |
|
148 | + unset($fields); |
|
149 | 149 | |
150 | - $cat_fields = array( |
|
151 | - 'cid' => array('Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false), |
|
152 | - 'pid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
153 | - 'title' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
154 | - 'imgurl' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
155 | - 'description' => array('Type' => "text NULL", 'Default' => true), |
|
156 | - 'total' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
157 | - 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
158 | - 'spotlighttop' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
159 | - 'spotlighthis' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
160 | - 'dohtml' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
161 | - 'dosmiley' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
162 | - 'doxcode' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
163 | - 'doimage' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
164 | - 'dobr' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
165 | - 'weight' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
166 | - ); |
|
167 | - echo '<br><b>Checking Category table</b><br>'; |
|
168 | - $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
169 | - $cat_table = new WfdownloadsTable('wfdownloads_cat'); |
|
170 | - $fields = get_table_info($catHandler->table, $cat_fields); |
|
171 | - update_table($cat_fields, $fields, $cat_table); |
|
172 | - if ($dbupdater->updateTable($cat_table)) { |
|
173 | - echo 'Category table updated<br>'; |
|
174 | - } |
|
175 | - unset($fields); |
|
150 | + $cat_fields = array( |
|
151 | + 'cid' => array('Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false), |
|
152 | + 'pid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
153 | + 'title' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
154 | + 'imgurl' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
155 | + 'description' => array('Type' => "text NULL", 'Default' => true), |
|
156 | + 'total' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
157 | + 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
158 | + 'spotlighttop' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
159 | + 'spotlighthis' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
160 | + 'dohtml' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
161 | + 'dosmiley' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
162 | + 'doxcode' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
163 | + 'doimage' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
164 | + 'dobr' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
165 | + 'weight' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
166 | + ); |
|
167 | + echo '<br><b>Checking Category table</b><br>'; |
|
168 | + $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
169 | + $cat_table = new WfdownloadsTable('wfdownloads_cat'); |
|
170 | + $fields = get_table_info($catHandler->table, $cat_fields); |
|
171 | + update_table($cat_fields, $fields, $cat_table); |
|
172 | + if ($dbupdater->updateTable($cat_table)) { |
|
173 | + echo 'Category table updated<br>'; |
|
174 | + } |
|
175 | + unset($fields); |
|
176 | 176 | |
177 | - $broken_fields = array( |
|
178 | - 'reportid' => array('Type' => 'int(5) NOT NULL auto_increment', 'Default' => false), |
|
179 | - 'lid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
180 | - 'sender' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
181 | - 'ip' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
182 | - 'date' => array('Type' => "varchar(11) NOT NULL default '0'", 'Default' => true), |
|
183 | - 'confirmed' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true), |
|
184 | - 'acknowledged' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true) |
|
185 | - ); |
|
186 | - echo '<br><b>Checking Broken Report table</b><br>'; |
|
187 | - $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads'); |
|
188 | - $broken_table = new WfdownloadsTable('wfdownloads_broken'); |
|
189 | - $fields = get_table_info($brokenHandler->table, $broken_fields); |
|
190 | - update_table($broken_fields, $fields, $broken_table); |
|
191 | - if ($dbupdater->updateTable($broken_table)) { |
|
192 | - echo 'Broken Reports table updated<br>'; |
|
193 | - } |
|
194 | - unset($fields); |
|
177 | + $broken_fields = array( |
|
178 | + 'reportid' => array('Type' => 'int(5) NOT NULL auto_increment', 'Default' => false), |
|
179 | + 'lid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
180 | + 'sender' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
181 | + 'ip' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
182 | + 'date' => array('Type' => "varchar(11) NOT NULL default '0'", 'Default' => true), |
|
183 | + 'confirmed' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true), |
|
184 | + 'acknowledged' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true) |
|
185 | + ); |
|
186 | + echo '<br><b>Checking Broken Report table</b><br>'; |
|
187 | + $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads'); |
|
188 | + $broken_table = new WfdownloadsTable('wfdownloads_broken'); |
|
189 | + $fields = get_table_info($brokenHandler->table, $broken_fields); |
|
190 | + update_table($broken_fields, $fields, $broken_table); |
|
191 | + if ($dbupdater->updateTable($broken_table)) { |
|
192 | + echo 'Broken Reports table updated<br>'; |
|
193 | + } |
|
194 | + unset($fields); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | // ========================================================================================= |
@@ -204,48 +204,48 @@ discard block |
||
204 | 204 | */ |
205 | 205 | function invert_nohtm_dohtml_values() |
206 | 206 | { |
207 | - $ret = array(); |
|
208 | - global $xoopsDB; |
|
209 | - $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
210 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
211 | - while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
212 | - $fields[$existing_field['field']] = $existing_field['type']; |
|
213 | - } |
|
214 | - if (in_array('nohtml', array_keys($fields))) { |
|
215 | - $dbupdater = new WfdownloadsDbupdater(); |
|
216 | - //Invert column values |
|
217 | - // alter options in wfdownloads_cat |
|
218 | - $table = new WfdownloadsTable('wfdownloads_cat'); |
|
219 | - $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'"); |
|
220 | - $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'"); |
|
221 | - $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'"); |
|
222 | - $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'"); |
|
223 | - $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'"); |
|
207 | + $ret = array(); |
|
208 | + global $xoopsDB; |
|
209 | + $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
210 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
211 | + while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
212 | + $fields[$existing_field['field']] = $existing_field['type']; |
|
213 | + } |
|
214 | + if (in_array('nohtml', array_keys($fields))) { |
|
215 | + $dbupdater = new WfdownloadsDbupdater(); |
|
216 | + //Invert column values |
|
217 | + // alter options in wfdownloads_cat |
|
218 | + $table = new WfdownloadsTable('wfdownloads_cat'); |
|
219 | + $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'"); |
|
220 | + $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'"); |
|
221 | + $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'"); |
|
222 | + $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'"); |
|
223 | + $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'"); |
|
224 | 224 | |
225 | - //inverting values no=1 <=> do=0 |
|
226 | - // have to store teporarly as value = 2 to |
|
227 | - // avoid putting everithing to same value |
|
228 | - // if you change 1 to 0, then 0 to one, |
|
229 | - // every value will be 1, follow me? |
|
230 | - $table->addUpdatedWhere('dohtml', 2, '=1'); |
|
231 | - $table->addUpdatedWhere('dohtml', 1, '=0'); |
|
232 | - $table->addUpdatedWhere('dohtml', 0, '=2'); |
|
225 | + //inverting values no=1 <=> do=0 |
|
226 | + // have to store teporarly as value = 2 to |
|
227 | + // avoid putting everithing to same value |
|
228 | + // if you change 1 to 0, then 0 to one, |
|
229 | + // every value will be 1, follow me? |
|
230 | + $table->addUpdatedWhere('dohtml', 2, '=1'); |
|
231 | + $table->addUpdatedWhere('dohtml', 1, '=0'); |
|
232 | + $table->addUpdatedWhere('dohtml', 0, '=2'); |
|
233 | 233 | |
234 | - $table->addUpdatedWhere('dosmiley', 2, '=1'); |
|
235 | - $table->addUpdatedWhere('dosmiley', 1, '=0'); |
|
236 | - $table->addUpdatedWhere('dosmiley', 0, '=2'); |
|
234 | + $table->addUpdatedWhere('dosmiley', 2, '=1'); |
|
235 | + $table->addUpdatedWhere('dosmiley', 1, '=0'); |
|
236 | + $table->addUpdatedWhere('dosmiley', 0, '=2'); |
|
237 | 237 | |
238 | - $table->addUpdatedWhere('doxcode', 2, '=1'); |
|
239 | - $table->addUpdatedWhere('doxcode', 1, '=0'); |
|
240 | - $table->addUpdatedWhere('doxcode', 0, '=2'); |
|
238 | + $table->addUpdatedWhere('doxcode', 2, '=1'); |
|
239 | + $table->addUpdatedWhere('doxcode', 1, '=0'); |
|
240 | + $table->addUpdatedWhere('doxcode', 0, '=2'); |
|
241 | 241 | |
242 | - $table->addUpdatedWhere('doimage', 2, '=1'); |
|
243 | - $table->addUpdatedWhere('doimage', 1, '=0'); |
|
244 | - $table->addUpdatedWhere('doimage', 0, '=2'); |
|
245 | - $ret = $dbupdater->updateTable($table); |
|
246 | - } |
|
242 | + $table->addUpdatedWhere('doimage', 2, '=1'); |
|
243 | + $table->addUpdatedWhere('doimage', 1, '=0'); |
|
244 | + $table->addUpdatedWhere('doimage', 0, '=2'); |
|
245 | + $ret = $dbupdater->updateTable($table); |
|
246 | + } |
|
247 | 247 | |
248 | - return $ret; |
|
248 | + return $ret; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -258,22 +258,22 @@ discard block |
||
258 | 258 | */ |
259 | 259 | function update_table($new_fields, $existing_fields, &$table) |
260 | 260 | { |
261 | - foreach ($new_fields as $field => $fieldinfo) { |
|
262 | - $type = $fieldinfo['Type']; |
|
263 | - if (!in_array($field, array_keys($existing_fields))) { |
|
264 | - //Add field as it is missing |
|
265 | - $table->addNewField($field, $type); |
|
266 | - //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
|
267 | - //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>"; |
|
268 | - } elseif ($existing_fields[$field] != $type) { |
|
269 | - $table->addAlteredField($field, $field . ' ' . $type); |
|
270 | - // check $fields[$field]['type'] for things like "int(10) unsigned" |
|
271 | - //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
|
272 | - //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>"; |
|
273 | - } else { |
|
274 | - //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>"; |
|
275 | - } |
|
276 | - } |
|
261 | + foreach ($new_fields as $field => $fieldinfo) { |
|
262 | + $type = $fieldinfo['Type']; |
|
263 | + if (!in_array($field, array_keys($existing_fields))) { |
|
264 | + //Add field as it is missing |
|
265 | + $table->addNewField($field, $type); |
|
266 | + //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
|
267 | + //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>"; |
|
268 | + } elseif ($existing_fields[$field] != $type) { |
|
269 | + $table->addAlteredField($field, $field . ' ' . $type); |
|
270 | + // check $fields[$field]['type'] for things like "int(10) unsigned" |
|
271 | + //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
|
272 | + //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>"; |
|
273 | + } else { |
|
274 | + //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>"; |
|
275 | + } |
|
276 | + } |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -286,22 +286,22 @@ discard block |
||
286 | 286 | */ |
287 | 287 | function get_table_info($table, $default_fields) |
288 | 288 | { |
289 | - global $xoopsDB; |
|
290 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
291 | - while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
292 | - $fields[$existing_field['Field']] = $existing_field['Type']; |
|
293 | - if ($existing_field['Null'] !== 'YES') { |
|
294 | - $fields[$existing_field['Field']] .= ' NOT NULL'; |
|
295 | - } |
|
296 | - if ($existing_field['Extra']) { |
|
297 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
298 | - } |
|
299 | - if ($default_fields[$existing_field['Field']]['Default']) { |
|
300 | - $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
301 | - } |
|
302 | - } |
|
289 | + global $xoopsDB; |
|
290 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
291 | + while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
292 | + $fields[$existing_field['Field']] = $existing_field['Type']; |
|
293 | + if ($existing_field['Null'] !== 'YES') { |
|
294 | + $fields[$existing_field['Field']] .= ' NOT NULL'; |
|
295 | + } |
|
296 | + if ($existing_field['Extra']) { |
|
297 | + $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
298 | + } |
|
299 | + if ($default_fields[$existing_field['Field']]['Default']) { |
|
300 | + $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
301 | + } |
|
302 | + } |
|
303 | 303 | |
304 | - return $fields; |
|
304 | + return $fields; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -315,60 +315,60 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function rename_fields(&$table, $renamed_fields, &$fields, $new_fields) |
317 | 317 | { |
318 | - foreach (array_keys($fields) as $field) { |
|
319 | - if (in_array($field, array_keys($renamed_fields))) { |
|
320 | - $new_field_name = $renamed_fields[$field]; |
|
321 | - $new_field_type = $new_fields[$new_field_name]['Type']; |
|
322 | - $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
323 | - //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
|
324 | - //echo $field." Renamed to ".$new_field_name."<br>"; |
|
325 | - $fields[$new_field_name] = $new_field_type; |
|
326 | - } |
|
327 | - } |
|
328 | - //return $fields; |
|
318 | + foreach (array_keys($fields) as $field) { |
|
319 | + if (in_array($field, array_keys($renamed_fields))) { |
|
320 | + $new_field_name = $renamed_fields[$field]; |
|
321 | + $new_field_type = $new_fields[$new_field_name]['Type']; |
|
322 | + $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
323 | + //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
|
324 | + //echo $field." Renamed to ".$new_field_name."<br>"; |
|
325 | + $fields[$new_field_name] = $new_field_type; |
|
326 | + } |
|
327 | + } |
|
328 | + //return $fields; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | $op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0; |
332 | 332 | switch ($op) { |
333 | - case 1: |
|
334 | - // Make sure that nohtml is properly changed to dohtml |
|
335 | - invert_nohtm_dohtml_values(); |
|
336 | - // Ensure that the proper tables are present |
|
337 | - update_tables_to_300(); |
|
338 | - // Import data from MyDownloads |
|
339 | - import_mydownloads_to_wfdownloads(); |
|
340 | - break; |
|
333 | + case 1: |
|
334 | + // Make sure that nohtml is properly changed to dohtml |
|
335 | + invert_nohtm_dohtml_values(); |
|
336 | + // Ensure that the proper tables are present |
|
337 | + update_tables_to_300(); |
|
338 | + // Import data from MyDownloads |
|
339 | + import_mydownloads_to_wfdownloads(); |
|
340 | + break; |
|
341 | 341 | |
342 | - case 2: |
|
343 | - // Update WF-Downloads |
|
344 | - $log = invert_nohtm_dohtml_values(); |
|
345 | - update_tables_to_300(); |
|
346 | - break; |
|
342 | + case 2: |
|
343 | + // Update WF-Downloads |
|
344 | + $log = invert_nohtm_dohtml_values(); |
|
345 | + update_tables_to_300(); |
|
346 | + break; |
|
347 | 347 | |
348 | - default: |
|
349 | - //ask what to do |
|
350 | - include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
351 | - $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
|
348 | + default: |
|
349 | + //ask what to do |
|
350 | + include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
351 | + $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
|
352 | 352 | |
353 | - //Is MyDownloads installed? |
|
354 | - /** @var XoopsModuleHandler $moduleHandler */ |
|
355 | - $moduleHandler = xoops_getHandler('module'); |
|
356 | - $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
|
357 | - if (is_object($mydownloadsModule)) { |
|
358 | - $mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
|
359 | - $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'"); |
|
360 | - $form->addElement($mydownloadsButton); |
|
361 | - } |
|
353 | + //Is MyDownloads installed? |
|
354 | + /** @var XoopsModuleHandler $moduleHandler */ |
|
355 | + $moduleHandler = xoops_getHandler('module'); |
|
356 | + $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
|
357 | + if (is_object($mydownloadsModule)) { |
|
358 | + $mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
|
359 | + $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'"); |
|
360 | + $form->addElement($mydownloadsButton); |
|
361 | + } |
|
362 | 362 | |
363 | - if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
364 | - $updateButton = new XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit'); |
|
365 | - $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'"); |
|
366 | - $form->addElement($updateButton); |
|
367 | - } |
|
363 | + if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
364 | + $updateButton = new XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit'); |
|
365 | + $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'"); |
|
366 | + $form->addElement($updateButton); |
|
367 | + } |
|
368 | 368 | |
369 | - $form->addElement(new XoopsFormHidden('op', 0)); |
|
370 | - $form->display(); |
|
371 | - break; |
|
369 | + $form->addElement(new XoopsFormHidden('op', 0)); |
|
370 | + $form->display(); |
|
371 | + break; |
|
372 | 372 | } |
373 | 373 | //wfdownloads_modFooter(); |
374 | 374 | //xoops_cp_footer(); |
@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | function smart_adsense_initiate_smartytags() |
12 | 12 | { |
13 | - global $xoopsTpl, $smartobjectAdsenseHandler; |
|
14 | - if (is_object($xoopsTpl)) { |
|
15 | - foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
16 | - $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
17 | - } |
|
18 | - } |
|
13 | + global $xoopsTpl, $smartobjectAdsenseHandler; |
|
14 | + if (is_object($xoopsTpl)) { |
|
15 | + foreach ($smartobjectAdsenseHandler->objects as $k => $v) { |
|
16 | + $xoopsTpl->assign('adsense_' . $k, $v->render()); |
|
17 | + } |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
22 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | function smart_customtag_initiate() |
12 | 12 | { |
13 | - global $xoopsTpl, $smartobjectCustomtagHandler; |
|
14 | - if (is_object($xoopsTpl)) { |
|
15 | - foreach ($smartobjectCustomtagHandler->objects as $k => $v) { |
|
16 | - $xoopsTpl->assign($k, $v->render()); |
|
17 | - } |
|
18 | - } |
|
13 | + global $xoopsTpl, $smartobjectCustomtagHandler; |
|
14 | + if (is_object($xoopsTpl)) { |
|
15 | + foreach ($smartobjectCustomtagHandler->objects as $k => $v) { |
|
16 | + $xoopsTpl->assign($k, $v->render()); |
|
17 | + } |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!defined('SMARTOBJECT_URL')) { |
22 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
22 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | smart_loadLanguageFile('smartobject', 'customtag'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
10 | 10 | |
11 | 11 | if (!defined('SMARTOBJECT_URL')) { |
12 | - require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
12 | + require_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
13 | 13 | } |
14 | 14 | require_once SMARTOBJECT_ROOT_PATH . 'class/rating.php'; |
15 | 15 | require_once SMARTOBJECT_ROOT_PATH . 'include/functions.php'; |
@@ -23,53 +23,53 @@ discard block |
||
23 | 23 | $smartobjectPluginHandler = new SmartPluginHandler(); |
24 | 24 | $pluginObj = $smartobjectPluginHandler->getPlugin($module_dirname); |
25 | 25 | if ($pluginObj) { |
26 | - $rating_item = $pluginObj->getItem(); |
|
27 | - if ($rating_item) { |
|
28 | - $rating_itemid = $pluginObj->getItemIdForItem($rating_item); |
|
29 | - $stats = $smartobjectRatingHandler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); |
|
30 | - $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); |
|
31 | - $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); |
|
32 | - $xoopsTpl->assign('smartobject_rating_item', $rating_item); |
|
33 | - if (is_object($xoopsUser)) { |
|
34 | - $ratingObj = $smartobjectRatingHandler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); |
|
35 | - $xoopsTpl->assign('smartobject_user_can_rate', true); |
|
36 | - } |
|
37 | - if (isset($ratingObj) && is_object($ratingObj)) { |
|
38 | - $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); |
|
39 | - $xoopsTpl->assign('smartobject_rated', true); |
|
40 | - } else { |
|
41 | - $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); |
|
42 | - $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); |
|
43 | - $urls = smart_getCurrentUrls(); |
|
44 | - $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
|
45 | - if (isset($xoTheme) && is_object($xoTheme)) { |
|
46 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
47 | - } else { |
|
48 | - //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
|
49 | - //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
26 | + $rating_item = $pluginObj->getItem(); |
|
27 | + if ($rating_item) { |
|
28 | + $rating_itemid = $pluginObj->getItemIdForItem($rating_item); |
|
29 | + $stats = $smartobjectRatingHandler->getRatingAverageByItemId($rating_itemid, $module_dirname, $rating_item); |
|
30 | + $xoopsTpl->assign('smartobject_rating_stats_total', $stats['sum']); |
|
31 | + $xoopsTpl->assign('smartobject_rating_stats_average', $stats['average']); |
|
32 | + $xoopsTpl->assign('smartobject_rating_item', $rating_item); |
|
33 | + if (is_object($xoopsUser)) { |
|
34 | + $ratingObj = $smartobjectRatingHandler->already_rated($rating_item, $rating_itemid, $module_dirname, $xoopsUser->getVar('uid')); |
|
35 | + $xoopsTpl->assign('smartobject_user_can_rate', true); |
|
36 | + } |
|
37 | + if (isset($ratingObj) && is_object($ratingObj)) { |
|
38 | + $xoopsTpl->assign('smartobject_user_rate', $ratingObj->getVar('rate')); |
|
39 | + $xoopsTpl->assign('smartobject_rated', true); |
|
40 | + } else { |
|
41 | + $xoopsTpl->assign('smartobject_rating_dirname', $module_dirname); |
|
42 | + $xoopsTpl->assign('smartobject_rating_itemid', $rating_itemid); |
|
43 | + $urls = smart_getCurrentUrls(); |
|
44 | + $xoopsTpl->assign('smartobject_rating_current_page', $urls['full']); |
|
45 | + if (isset($xoTheme) && is_object($xoTheme)) { |
|
46 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'assets/css/module.css'); |
|
47 | + } else { |
|
48 | + //probleme d'inclusion de css apres le flashplayer. Style plac� dans css du theme |
|
49 | + //$xoopsTpl->assign('smartobject_css',"<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartobject/assets/css/module.css'>"); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (isset($_POST['smartobject_rating_submit'])) { |
56 | - // The rating form has just been posted. Let's save the info |
|
57 | - $ratingObj = $smartobjectRatingHandler->create(); |
|
58 | - $ratingObj->setVar('dirname', $module_dirname); |
|
59 | - $ratingObj->setVar('item', $rating_item); |
|
60 | - $ratingObj->setVar('itemid', $rating_itemid); |
|
61 | - $ratingObj->setVar('uid', $xoopsUser->getVar('uid')); |
|
62 | - $ratingObj->setVar('date', time()); |
|
63 | - $ratingObj->setVar('rate', $_POST['smartobject_rating_value']); |
|
64 | - if (!$smartobjectRatingHandler->insert($ratingObj)) { |
|
65 | - if ($xoopsDB->errno() == 1062) { |
|
66 | - $message = _SOBJECT_RATING_DUPLICATE_ENTRY; |
|
67 | - } else { |
|
68 | - $message = _SOBJECT_RATING_ERROR; |
|
69 | - } |
|
70 | - } else { |
|
71 | - $message = _SOBJECT_RATING_SUCCESS; |
|
72 | - } |
|
73 | - redirect_header('', 3, $message); |
|
74 | - exit; |
|
56 | + // The rating form has just been posted. Let's save the info |
|
57 | + $ratingObj = $smartobjectRatingHandler->create(); |
|
58 | + $ratingObj->setVar('dirname', $module_dirname); |
|
59 | + $ratingObj->setVar('item', $rating_item); |
|
60 | + $ratingObj->setVar('itemid', $rating_itemid); |
|
61 | + $ratingObj->setVar('uid', $xoopsUser->getVar('uid')); |
|
62 | + $ratingObj->setVar('date', time()); |
|
63 | + $ratingObj->setVar('rate', $_POST['smartobject_rating_value']); |
|
64 | + if (!$smartobjectRatingHandler->insert($ratingObj)) { |
|
65 | + if ($xoopsDB->errno() == 1062) { |
|
66 | + $message = _SOBJECT_RATING_DUPLICATE_ENTRY; |
|
67 | + } else { |
|
68 | + $message = _SOBJECT_RATING_ERROR; |
|
69 | + } |
|
70 | + } else { |
|
71 | + $message = _SOBJECT_RATING_SUCCESS; |
|
72 | + } |
|
73 | + redirect_header('', 3, $message); |
|
74 | + exit; |
|
75 | 75 | } |
@@ -15,322 +15,322 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class Scriptaculous extends Prototype |
17 | 17 | { |
18 | - public $TOGGLE_EFFECTS = array('toggle_appear', 'toggle_slide', 'toggle_blind'); |
|
19 | - |
|
20 | - /** |
|
21 | - * Scriptaculous constructor. |
|
22 | - */ |
|
23 | - public function __construct() |
|
24 | - { |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * @param $element_id |
|
29 | - * @param null $options |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function dragable_element($element_id, $options = null) |
|
33 | - { |
|
34 | - return $this->tag($this->_dragable_element_js($element_id, $options)); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * @param $element_id |
|
39 | - * @param null $options |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function drop_receiving_element($element_id, $options = null) |
|
43 | - { |
|
44 | - return $this->tag($this->_drop_receiving_element($element_id, $options)); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * @param $name |
|
49 | - * @param bool $element_id |
|
50 | - * @param null $js_options |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function visual_effect($name, $element_id = false, $js_options = null) |
|
54 | - { |
|
55 | - $element = $element_id ? "'$element_id'" : 'element'; |
|
56 | - |
|
57 | - $js_queue = ''; |
|
58 | - if (isset($js_options) && is_array($js_options['queue'])) { |
|
59 | - } elseif (isset($js_options)) { |
|
60 | - $js_queue = "'$js_options'"; |
|
61 | - } |
|
62 | - |
|
63 | - if (in_array($name, $this->TOGGLE_EFFECTS)) { |
|
64 | - return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
65 | - } else { |
|
66 | - return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param $element_id |
|
72 | - * @param null $options |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function sortabe_element($element_id, $options = null) |
|
76 | - { |
|
77 | - return $this->tag($this->_sortabe_element($element_id, $options)); |
|
78 | - } |
|
79 | - |
|
80 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
81 | - // Private functions |
|
82 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
83 | - |
|
84 | - /** |
|
85 | - * @param $element_id |
|
86 | - * @param $options |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - |
|
90 | - public function _sortabe_element($element_id, $options) |
|
91 | - { |
|
92 | - //if (isset($options['with'])) |
|
93 | - { |
|
94 | - $options['with'] = "Sortable.serialize('$element_id')"; |
|
95 | - } |
|
96 | - |
|
97 | - //if (isset($option['onUpdate'])) |
|
98 | - { |
|
99 | - $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
100 | - } |
|
101 | - |
|
102 | - foreach ($options as $var => $val) { |
|
103 | - if (in_array($var, $this->AJAX_OPTIONS)) { |
|
104 | - unset($options[$var]); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - $arr = array('tag', 'overlap', 'contraint', 'handle'); |
|
109 | - |
|
110 | - foreach ($arr as $var) { |
|
111 | - if (isset($options[$var])) { |
|
112 | - $options[$var] = "'" . $options[$var] . "'"; |
|
113 | - } |
|
114 | - } |
|
115 | - |
|
116 | - if (isset($options['containment'])) { |
|
117 | - $options['containment'] = $this->_array_or_string_for_javascript($options['containment']); |
|
118 | - } |
|
119 | - |
|
120 | - if (isset($options['only'])) { |
|
121 | - $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
|
122 | - } |
|
123 | - |
|
124 | - return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * @param $element_id |
|
129 | - * @param $options |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - public function _dragable_element_js($element_id, $options) |
|
133 | - { |
|
134 | - return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * @param $element_id |
|
139 | - * @param $options |
|
140 | - * @return string |
|
141 | - */ |
|
142 | - public function _drop_receiving_element($element_id, $options) |
|
143 | - { |
|
144 | - |
|
145 | - //if (isset($options['with'])) |
|
146 | - { |
|
147 | - $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; |
|
148 | - } |
|
149 | - |
|
150 | - //if (isset($option['onDrop'])) |
|
151 | - { |
|
152 | - $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
153 | - } |
|
154 | - |
|
155 | - if (is_array($options)) { |
|
156 | - foreach ($options as $var => $val) { |
|
157 | - if (in_array($var, $this->AJAX_OPTIONS)) { |
|
158 | - unset($options[$var]); |
|
159 | - } |
|
160 | - } |
|
161 | - } |
|
162 | - |
|
163 | - if (isset($options['accept'])) { |
|
164 | - $options['accept'] = $this->_array_or_string_for_javascript($options['accept']); |
|
165 | - } |
|
166 | - |
|
167 | - if (isset($options['hoverclass'])) { |
|
168 | - $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
169 | - } |
|
170 | - |
|
171 | - return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
172 | - } |
|
173 | - |
|
174 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
175 | - // Merged Javascript macro |
|
176 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
177 | - |
|
178 | - /** |
|
179 | - * @param $field_id |
|
180 | - * @param $options |
|
181 | - * @param bool $tag |
|
182 | - * @return string |
|
183 | - */ |
|
184 | - public function in_place_editor($field_id, $options, $tag = true) |
|
185 | - { |
|
186 | - $function = 'new Ajax.InPlaceEditor('; |
|
187 | - $function .= "'$field_id', "; |
|
188 | - $function .= "'" . $options['url'] . "'"; |
|
189 | - |
|
190 | - $js_options = array(); |
|
191 | - if (isset($options['cancel_text'])) { |
|
192 | - $js_options['cancelText'] = $options['cancel_text']; |
|
193 | - } |
|
194 | - if (isset($options['save_text'])) { |
|
195 | - $js_options['okText'] = $options['save_text']; |
|
196 | - } |
|
197 | - if (isset($options['loading_text'])) { |
|
198 | - $js_options['loadingText'] = $options['loading_text']; |
|
199 | - } |
|
200 | - if (isset($options['rows'])) { |
|
201 | - $js_options['rows'] = $options['rows']; |
|
202 | - } |
|
203 | - if (isset($options['cols'])) { |
|
204 | - $js_options['cols'] = $options['cols']; |
|
205 | - } |
|
206 | - if (isset($options['size'])) { |
|
207 | - $js_options['size'] = $options['size']; |
|
208 | - } |
|
209 | - if (isset($options['external_control'])) { |
|
210 | - $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
211 | - } |
|
212 | - if (isset($options['load_text_url'])) { |
|
213 | - $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
214 | - } |
|
215 | - if (isset($options['options'])) { |
|
216 | - $js_options['ajaxOptions'] = $options['options']; |
|
217 | - } |
|
218 | - if (isset($options['script'])) { |
|
219 | - $js_options['evalScripts'] = $options['script']; |
|
220 | - } |
|
221 | - if (isset($options['with'])) { |
|
222 | - $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
223 | - } |
|
224 | - |
|
225 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
226 | - if ($tag) { |
|
227 | - return $this->tag($function); |
|
228 | - } else { |
|
229 | - return $function; |
|
230 | - } |
|
231 | - } |
|
232 | - |
|
233 | - /** |
|
234 | - * @param $object |
|
235 | - * @param null $tag_options |
|
236 | - * @param null $in_place_editor_options |
|
237 | - * @return string |
|
238 | - */ |
|
239 | - public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
|
240 | - { |
|
241 | - $ret_val = ''; |
|
242 | - $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
243 | - $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
|
244 | - |
|
245 | - return $ret_val; |
|
246 | - } |
|
247 | - |
|
248 | - /** |
|
249 | - * @param $field_id |
|
250 | - * @param $options |
|
251 | - * @return mixed |
|
252 | - */ |
|
253 | - public function auto_complete_field($field_id, $options) |
|
254 | - { |
|
255 | - $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
256 | - $function .= "'$field_id', "; |
|
257 | - $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
258 | - $function .= "'" . $options['url'] . "'"; |
|
259 | - |
|
260 | - $js_options = array(); |
|
261 | - if (isset($options['tokens'])) { |
|
262 | - $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
|
263 | - } |
|
264 | - if (isset($options['with'])) { |
|
265 | - $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
266 | - } |
|
267 | - if (isset($options['indicator'])) { |
|
268 | - $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
269 | - } |
|
270 | - if (isset($options['select'])) { |
|
271 | - $js_options['select'] = "'" . $options['select'] . "'"; |
|
272 | - } |
|
273 | - |
|
274 | - foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) { |
|
275 | - if (isset($options[$var])) { |
|
276 | - $js_options['$val'] = $options['var']; |
|
277 | - } |
|
278 | - } |
|
279 | - |
|
280 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
281 | - |
|
282 | - return $this->tag($function); |
|
283 | - } |
|
284 | - |
|
285 | - /** |
|
286 | - * @param $entries |
|
287 | - * @param $field |
|
288 | - * @param null $phrase |
|
289 | - */ |
|
290 | - public function auto_complete_results($entries, $field, $phrase = null) |
|
291 | - { |
|
292 | - if (!is_array($entries)) { |
|
293 | - return; |
|
294 | - } |
|
295 | - $ret_val = '<ul>'; |
|
296 | - // Complete this function |
|
297 | - } |
|
298 | - |
|
299 | - /** |
|
300 | - * @param $object |
|
301 | - * @param null $tag_options |
|
302 | - * @param null $completion_options |
|
303 | - * @return string |
|
304 | - */ |
|
305 | - public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null) |
|
306 | - { |
|
307 | - $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet(); |
|
308 | - $ret_val .= '<input autocomplete="off" id="' |
|
309 | - . $object |
|
310 | - . '" name="' |
|
311 | - . $object |
|
312 | - . '" size="' |
|
313 | - . (isset($tag_options['size']) ? $tag_options['size'] : 30) |
|
314 | - . '" type="text" value="' |
|
315 | - . (isset($tag_options['size']) ? $tag_options['value'] : '') |
|
316 | - . '" ' |
|
317 | - . (isset($tag_options['class']) ? 'class = "' |
|
318 | - . $tag_options['class'] |
|
319 | - . '" ' : '') |
|
320 | - . '>'; |
|
321 | - |
|
322 | - $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
323 | - $ret_val .= $this->auto_complete_field($object, $completion_options); |
|
324 | - |
|
325 | - return $ret_val; |
|
326 | - } |
|
327 | - |
|
328 | - /** |
|
329 | - * @return string |
|
330 | - */ |
|
331 | - public function _auto_complete_stylesheet() |
|
332 | - { |
|
333 | - return '<style> div.auto_complete { |
|
18 | + public $TOGGLE_EFFECTS = array('toggle_appear', 'toggle_slide', 'toggle_blind'); |
|
19 | + |
|
20 | + /** |
|
21 | + * Scriptaculous constructor. |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * @param $element_id |
|
29 | + * @param null $options |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function dragable_element($element_id, $options = null) |
|
33 | + { |
|
34 | + return $this->tag($this->_dragable_element_js($element_id, $options)); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * @param $element_id |
|
39 | + * @param null $options |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function drop_receiving_element($element_id, $options = null) |
|
43 | + { |
|
44 | + return $this->tag($this->_drop_receiving_element($element_id, $options)); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * @param $name |
|
49 | + * @param bool $element_id |
|
50 | + * @param null $js_options |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function visual_effect($name, $element_id = false, $js_options = null) |
|
54 | + { |
|
55 | + $element = $element_id ? "'$element_id'" : 'element'; |
|
56 | + |
|
57 | + $js_queue = ''; |
|
58 | + if (isset($js_options) && is_array($js_options['queue'])) { |
|
59 | + } elseif (isset($js_options)) { |
|
60 | + $js_queue = "'$js_options'"; |
|
61 | + } |
|
62 | + |
|
63 | + if (in_array($name, $this->TOGGLE_EFFECTS)) { |
|
64 | + return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
65 | + } else { |
|
66 | + return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param $element_id |
|
72 | + * @param null $options |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function sortabe_element($element_id, $options = null) |
|
76 | + { |
|
77 | + return $this->tag($this->_sortabe_element($element_id, $options)); |
|
78 | + } |
|
79 | + |
|
80 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
81 | + // Private functions |
|
82 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
83 | + |
|
84 | + /** |
|
85 | + * @param $element_id |
|
86 | + * @param $options |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + |
|
90 | + public function _sortabe_element($element_id, $options) |
|
91 | + { |
|
92 | + //if (isset($options['with'])) |
|
93 | + { |
|
94 | + $options['with'] = "Sortable.serialize('$element_id')"; |
|
95 | + } |
|
96 | + |
|
97 | + //if (isset($option['onUpdate'])) |
|
98 | + { |
|
99 | + $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
100 | + } |
|
101 | + |
|
102 | + foreach ($options as $var => $val) { |
|
103 | + if (in_array($var, $this->AJAX_OPTIONS)) { |
|
104 | + unset($options[$var]); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + $arr = array('tag', 'overlap', 'contraint', 'handle'); |
|
109 | + |
|
110 | + foreach ($arr as $var) { |
|
111 | + if (isset($options[$var])) { |
|
112 | + $options[$var] = "'" . $options[$var] . "'"; |
|
113 | + } |
|
114 | + } |
|
115 | + |
|
116 | + if (isset($options['containment'])) { |
|
117 | + $options['containment'] = $this->_array_or_string_for_javascript($options['containment']); |
|
118 | + } |
|
119 | + |
|
120 | + if (isset($options['only'])) { |
|
121 | + $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
|
122 | + } |
|
123 | + |
|
124 | + return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * @param $element_id |
|
129 | + * @param $options |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + public function _dragable_element_js($element_id, $options) |
|
133 | + { |
|
134 | + return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * @param $element_id |
|
139 | + * @param $options |
|
140 | + * @return string |
|
141 | + */ |
|
142 | + public function _drop_receiving_element($element_id, $options) |
|
143 | + { |
|
144 | + |
|
145 | + //if (isset($options['with'])) |
|
146 | + { |
|
147 | + $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; |
|
148 | + } |
|
149 | + |
|
150 | + //if (isset($option['onDrop'])) |
|
151 | + { |
|
152 | + $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
153 | + } |
|
154 | + |
|
155 | + if (is_array($options)) { |
|
156 | + foreach ($options as $var => $val) { |
|
157 | + if (in_array($var, $this->AJAX_OPTIONS)) { |
|
158 | + unset($options[$var]); |
|
159 | + } |
|
160 | + } |
|
161 | + } |
|
162 | + |
|
163 | + if (isset($options['accept'])) { |
|
164 | + $options['accept'] = $this->_array_or_string_for_javascript($options['accept']); |
|
165 | + } |
|
166 | + |
|
167 | + if (isset($options['hoverclass'])) { |
|
168 | + $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
169 | + } |
|
170 | + |
|
171 | + return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
172 | + } |
|
173 | + |
|
174 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
175 | + // Merged Javascript macro |
|
176 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
177 | + |
|
178 | + /** |
|
179 | + * @param $field_id |
|
180 | + * @param $options |
|
181 | + * @param bool $tag |
|
182 | + * @return string |
|
183 | + */ |
|
184 | + public function in_place_editor($field_id, $options, $tag = true) |
|
185 | + { |
|
186 | + $function = 'new Ajax.InPlaceEditor('; |
|
187 | + $function .= "'$field_id', "; |
|
188 | + $function .= "'" . $options['url'] . "'"; |
|
189 | + |
|
190 | + $js_options = array(); |
|
191 | + if (isset($options['cancel_text'])) { |
|
192 | + $js_options['cancelText'] = $options['cancel_text']; |
|
193 | + } |
|
194 | + if (isset($options['save_text'])) { |
|
195 | + $js_options['okText'] = $options['save_text']; |
|
196 | + } |
|
197 | + if (isset($options['loading_text'])) { |
|
198 | + $js_options['loadingText'] = $options['loading_text']; |
|
199 | + } |
|
200 | + if (isset($options['rows'])) { |
|
201 | + $js_options['rows'] = $options['rows']; |
|
202 | + } |
|
203 | + if (isset($options['cols'])) { |
|
204 | + $js_options['cols'] = $options['cols']; |
|
205 | + } |
|
206 | + if (isset($options['size'])) { |
|
207 | + $js_options['size'] = $options['size']; |
|
208 | + } |
|
209 | + if (isset($options['external_control'])) { |
|
210 | + $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
211 | + } |
|
212 | + if (isset($options['load_text_url'])) { |
|
213 | + $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
214 | + } |
|
215 | + if (isset($options['options'])) { |
|
216 | + $js_options['ajaxOptions'] = $options['options']; |
|
217 | + } |
|
218 | + if (isset($options['script'])) { |
|
219 | + $js_options['evalScripts'] = $options['script']; |
|
220 | + } |
|
221 | + if (isset($options['with'])) { |
|
222 | + $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
223 | + } |
|
224 | + |
|
225 | + $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
226 | + if ($tag) { |
|
227 | + return $this->tag($function); |
|
228 | + } else { |
|
229 | + return $function; |
|
230 | + } |
|
231 | + } |
|
232 | + |
|
233 | + /** |
|
234 | + * @param $object |
|
235 | + * @param null $tag_options |
|
236 | + * @param null $in_place_editor_options |
|
237 | + * @return string |
|
238 | + */ |
|
239 | + public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
|
240 | + { |
|
241 | + $ret_val = ''; |
|
242 | + $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
243 | + $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
|
244 | + |
|
245 | + return $ret_val; |
|
246 | + } |
|
247 | + |
|
248 | + /** |
|
249 | + * @param $field_id |
|
250 | + * @param $options |
|
251 | + * @return mixed |
|
252 | + */ |
|
253 | + public function auto_complete_field($field_id, $options) |
|
254 | + { |
|
255 | + $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
256 | + $function .= "'$field_id', "; |
|
257 | + $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
258 | + $function .= "'" . $options['url'] . "'"; |
|
259 | + |
|
260 | + $js_options = array(); |
|
261 | + if (isset($options['tokens'])) { |
|
262 | + $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
|
263 | + } |
|
264 | + if (isset($options['with'])) { |
|
265 | + $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
266 | + } |
|
267 | + if (isset($options['indicator'])) { |
|
268 | + $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
269 | + } |
|
270 | + if (isset($options['select'])) { |
|
271 | + $js_options['select'] = "'" . $options['select'] . "'"; |
|
272 | + } |
|
273 | + |
|
274 | + foreach (array('on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars') as $var => $val) { |
|
275 | + if (isset($options[$var])) { |
|
276 | + $js_options['$val'] = $options['var']; |
|
277 | + } |
|
278 | + } |
|
279 | + |
|
280 | + $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
281 | + |
|
282 | + return $this->tag($function); |
|
283 | + } |
|
284 | + |
|
285 | + /** |
|
286 | + * @param $entries |
|
287 | + * @param $field |
|
288 | + * @param null $phrase |
|
289 | + */ |
|
290 | + public function auto_complete_results($entries, $field, $phrase = null) |
|
291 | + { |
|
292 | + if (!is_array($entries)) { |
|
293 | + return; |
|
294 | + } |
|
295 | + $ret_val = '<ul>'; |
|
296 | + // Complete this function |
|
297 | + } |
|
298 | + |
|
299 | + /** |
|
300 | + * @param $object |
|
301 | + * @param null $tag_options |
|
302 | + * @param null $completion_options |
|
303 | + * @return string |
|
304 | + */ |
|
305 | + public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null) |
|
306 | + { |
|
307 | + $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet(); |
|
308 | + $ret_val .= '<input autocomplete="off" id="' |
|
309 | + . $object |
|
310 | + . '" name="' |
|
311 | + . $object |
|
312 | + . '" size="' |
|
313 | + . (isset($tag_options['size']) ? $tag_options['size'] : 30) |
|
314 | + . '" type="text" value="' |
|
315 | + . (isset($tag_options['size']) ? $tag_options['value'] : '') |
|
316 | + . '" ' |
|
317 | + . (isset($tag_options['class']) ? 'class = "' |
|
318 | + . $tag_options['class'] |
|
319 | + . '" ' : '') |
|
320 | + . '>'; |
|
321 | + |
|
322 | + $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
323 | + $ret_val .= $this->auto_complete_field($object, $completion_options); |
|
324 | + |
|
325 | + return $ret_val; |
|
326 | + } |
|
327 | + |
|
328 | + /** |
|
329 | + * @return string |
|
330 | + */ |
|
331 | + public function _auto_complete_stylesheet() |
|
332 | + { |
|
333 | + return '<style> div.auto_complete { |
|
334 | 334 | width: 350px; |
335 | 335 | background: #fff; |
336 | 336 | } |
@@ -354,5 +354,5 @@ discard block |
||
354 | 354 | padding:0; |
355 | 355 | } |
356 | 356 | </style>'; |
357 | - } |
|
357 | + } |
|
358 | 358 | } |
@@ -15,90 +15,90 @@ |
||
15 | 15 | */ |
16 | 16 | class JavaScript |
17 | 17 | { |
18 | - /** |
|
19 | - * @param $name |
|
20 | - * @param null $function |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function button_to_function($name, $function = null) |
|
24 | - { |
|
25 | - return '<input type="button" value="' . $name . '" onclick="' . $function . '">'; |
|
26 | - } |
|
18 | + /** |
|
19 | + * @param $name |
|
20 | + * @param null $function |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function button_to_function($name, $function = null) |
|
24 | + { |
|
25 | + return '<input type="button" value="' . $name . '" onclick="' . $function . '">'; |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @param $javascript |
|
30 | - * @return mixed|string |
|
31 | - */ |
|
32 | - public function escape($javascript) |
|
33 | - { |
|
34 | - $javascript = addslashes($javascript); |
|
35 | - $javascript = str_replace(array("\r\n", "\n", "\r"), array("\n"), $javascript); |
|
28 | + /** |
|
29 | + * @param $javascript |
|
30 | + * @return mixed|string |
|
31 | + */ |
|
32 | + public function escape($javascript) |
|
33 | + { |
|
34 | + $javascript = addslashes($javascript); |
|
35 | + $javascript = str_replace(array("\r\n", "\n", "\r"), array("\n"), $javascript); |
|
36 | 36 | |
37 | - return $javascript; |
|
38 | - } |
|
37 | + return $javascript; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param $content |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function tag($content) |
|
45 | - { |
|
46 | - return '<script type="text/javascript">' . $content . '</script>'; |
|
47 | - } |
|
40 | + /** |
|
41 | + * @param $content |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function tag($content) |
|
45 | + { |
|
46 | + return '<script type="text/javascript">' . $content . '</script>'; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param $name |
|
51 | - * @param $function |
|
52 | - * @param null $html_options |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function link_to_function($name, $function, $html_options = null) |
|
56 | - { |
|
57 | - return '<a href="' . (isset($html_options['href']) ? $html_options['href'] : '#') . '" onclick="' . (isset($html_options['onclick']) ? $html_options['onclick'] . ';' : '') . $function . '; return false;">' . $name . '</a>'; |
|
58 | - } |
|
49 | + /** |
|
50 | + * @param $name |
|
51 | + * @param $function |
|
52 | + * @param null $html_options |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function link_to_function($name, $function, $html_options = null) |
|
56 | + { |
|
57 | + return '<a href="' . (isset($html_options['href']) ? $html_options['href'] : '#') . '" onclick="' . (isset($html_options['onclick']) ? $html_options['onclick'] . ';' : '') . $function . '; return false;">' . $name . '</a>'; |
|
58 | + } |
|
59 | 59 | |
60 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
61 | - // Private functions |
|
62 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
60 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
61 | + // Private functions |
|
62 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param $option |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function _array_or_string_for_javascript($option) |
|
69 | - { |
|
70 | - $return_val = ''; |
|
71 | - if (is_array($option)) { |
|
72 | - foreach ($option as $value) { |
|
73 | - if (!empty($return_val)) { |
|
74 | - $ret_val .= ', '; |
|
75 | - } |
|
76 | - $return_val .= $value; |
|
77 | - } |
|
64 | + /** |
|
65 | + * @param $option |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function _array_or_string_for_javascript($option) |
|
69 | + { |
|
70 | + $return_val = ''; |
|
71 | + if (is_array($option)) { |
|
72 | + foreach ($option as $value) { |
|
73 | + if (!empty($return_val)) { |
|
74 | + $ret_val .= ', '; |
|
75 | + } |
|
76 | + $return_val .= $value; |
|
77 | + } |
|
78 | 78 | |
79 | - return '[' . $return_val . ']'; |
|
80 | - } |
|
79 | + return '[' . $return_val . ']'; |
|
80 | + } |
|
81 | 81 | |
82 | - return "'$option'"; |
|
83 | - } |
|
82 | + return "'$option'"; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @param $options |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function _options_for_javascript($options) |
|
90 | - { |
|
91 | - $return_val = ''; |
|
85 | + /** |
|
86 | + * @param $options |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function _options_for_javascript($options) |
|
90 | + { |
|
91 | + $return_val = ''; |
|
92 | 92 | |
93 | - if (is_array($options)) { |
|
94 | - foreach ($options as $var => $val) { |
|
95 | - if (!empty($return_val)) { |
|
96 | - $return_val .= ', '; |
|
97 | - } |
|
98 | - $return_val .= "$var:$val"; |
|
99 | - } |
|
100 | - } |
|
93 | + if (is_array($options)) { |
|
94 | + foreach ($options as $var => $val) { |
|
95 | + if (!empty($return_val)) { |
|
96 | + $return_val .= ', '; |
|
97 | + } |
|
98 | + $return_val .= "$var:$val"; |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - return '{' . $return_val . '}'; |
|
103 | - } |
|
102 | + return '{' . $return_val . '}'; |
|
103 | + } |
|
104 | 104 | } |