@@ -13,45 +13,45 @@ |
||
13 | 13 | */ |
14 | 14 | function instruction_search($queryarray, $andor, $limit, $offset, $userid) |
15 | 15 | { |
16 | - // Подключаем функции |
|
17 | - include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php'); |
|
16 | + // Подключаем функции |
|
17 | + include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php'); |
|
18 | 18 | |
19 | - $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0'; |
|
20 | - if (0 != $userid) { |
|
21 | - $sql .= ' AND p.uid = ' . (int)$userid . ' '; |
|
22 | - //return NULL; |
|
23 | - } |
|
19 | + $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0'; |
|
20 | + if (0 != $userid) { |
|
21 | + $sql .= ' AND p.uid = ' . (int)$userid . ' '; |
|
22 | + //return NULL; |
|
23 | + } |
|
24 | 24 | |
25 | - // Права на просмотр |
|
26 | - $categories = Xoopsmodules\instruction\Utility::getItemIds(); |
|
27 | - if (is_array($categories) && count($categories) > 0) { |
|
28 | - $sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) '; |
|
29 | - // Если пользователь не имеет прав просмотра ни одной категории |
|
30 | - } else { |
|
31 | - return null; |
|
32 | - } |
|
25 | + // Права на просмотр |
|
26 | + $categories = Xoopsmodules\instruction\Utility::getItemIds(); |
|
27 | + if (is_array($categories) && count($categories) > 0) { |
|
28 | + $sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) '; |
|
29 | + // Если пользователь не имеет прав просмотра ни одной категории |
|
30 | + } else { |
|
31 | + return null; |
|
32 | + } |
|
33 | 33 | |
34 | - // Добавляем в условие ключевые слова поиска |
|
35 | - if (is_array($queryarray) && $count = count($queryarray)) { |
|
36 | - $sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )"; |
|
37 | - for ($i = 1; $i < $count; $i++) { |
|
38 | - $sql .= " $andor "; |
|
39 | - $sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )"; |
|
40 | - } |
|
41 | - $sql .= ' ) '; |
|
42 | - } |
|
43 | - //$sql .= "ORDER BY date DESC"; |
|
44 | - $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset); |
|
45 | - $ret = []; |
|
46 | - $i = 0; |
|
47 | - // Перебираем все результаты |
|
48 | - while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) { |
|
49 | - $ret[$i]['image'] = 'assets/images/size2.gif'; |
|
50 | - $ret[$i]['link'] = 'page.php?id=' . $pageid; |
|
51 | - $ret[$i]['title'] = $ititle . ': ' . $ptitle; |
|
52 | - $ret[$i]['time'] = $pdatecreated; |
|
53 | - $ret[$i]['uid'] = $puid; |
|
54 | - $i++; |
|
55 | - } |
|
56 | - return $ret; |
|
34 | + // Добавляем в условие ключевые слова поиска |
|
35 | + if (is_array($queryarray) && $count = count($queryarray)) { |
|
36 | + $sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )"; |
|
37 | + for ($i = 1; $i < $count; $i++) { |
|
38 | + $sql .= " $andor "; |
|
39 | + $sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )"; |
|
40 | + } |
|
41 | + $sql .= ' ) '; |
|
42 | + } |
|
43 | + //$sql .= "ORDER BY date DESC"; |
|
44 | + $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset); |
|
45 | + $ret = []; |
|
46 | + $i = 0; |
|
47 | + // Перебираем все результаты |
|
48 | + while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) { |
|
49 | + $ret[$i]['image'] = 'assets/images/size2.gif'; |
|
50 | + $ret[$i]['link'] = 'page.php?id=' . $pageid; |
|
51 | + $ret[$i]['title'] = $ititle . ': ' . $ptitle; |
|
52 | + $ret[$i]['time'] = $pdatecreated; |
|
53 | + $ret[$i]['uid'] = $puid; |
|
54 | + $i++; |
|
55 | + } |
|
56 | + return $ret; |
|
57 | 57 | } |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | */ |
10 | 10 | function instruction_com_update($pageid, $total_num) |
11 | 11 | { |
12 | - $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
13 | - $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid = ' . $pageid; |
|
14 | - $db->query($sql); |
|
12 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
13 | + $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid = ' . $pageid; |
|
14 | + $db->query($sql); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function instruction_com_approve(&$comment) |
21 | 21 | { |
22 | - // notification mail here |
|
22 | + // notification mail here |
|
23 | 23 | } |
@@ -23,57 +23,57 @@ |
||
23 | 23 | $capsDirName = strtoupper($moduleDirName); |
24 | 24 | |
25 | 25 | if (!defined($capsDirName . '_DIRNAME')) { |
26 | - //if (!defined(constant($capsDirName . '_DIRNAME'))) { |
|
27 | - define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
|
28 | - define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
29 | - define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
30 | - define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); |
|
31 | - define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
32 | - define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); |
|
33 | - define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
34 | - define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
26 | + //if (!defined(constant($capsDirName . '_DIRNAME'))) { |
|
27 | + define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
|
28 | + define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
29 | + define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
30 | + define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); |
|
31 | + define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
32 | + define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); |
|
33 | + define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
34 | + define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | //Configurator |
38 | 38 | return (object)[ |
39 | - 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
40 | - 'paths' => [ |
|
41 | - 'dirname' => $moduleDirName, |
|
42 | - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
43 | - // 'path' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
44 | - // 'url' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
45 | - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
46 | - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
47 | - ], |
|
48 | - 'uploadFolders' => [ |
|
49 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
50 | - //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
51 | - //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
52 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
53 | - ], |
|
54 | - 'blankFiles' => [ |
|
55 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
56 | - //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
57 | - //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
58 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
59 | - ], |
|
39 | + 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
40 | + 'paths' => [ |
|
41 | + 'dirname' => $moduleDirName, |
|
42 | + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
43 | + // 'path' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
44 | + // 'url' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
45 | + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
46 | + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
47 | + ], |
|
48 | + 'uploadFolders' => [ |
|
49 | + constant($capsDirName . '_UPLOAD_PATH'), |
|
50 | + //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
51 | + //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
52 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
53 | + ], |
|
54 | + 'blankFiles' => [ |
|
55 | + constant($capsDirName . '_UPLOAD_PATH'), |
|
56 | + //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
57 | + //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
58 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
59 | + ], |
|
60 | 60 | |
61 | - 'templateFolders' => [ |
|
62 | - '/templates/', |
|
63 | - '/templates/blocks/', |
|
64 | - '/templates/admin/' |
|
61 | + 'templateFolders' => [ |
|
62 | + '/templates/', |
|
63 | + '/templates/blocks/', |
|
64 | + '/templates/admin/' |
|
65 | 65 | |
66 | - ], |
|
67 | - 'oldFiles' => [// '/sql/mysql.sql', |
|
68 | - ], |
|
69 | - 'oldFolders' => [ |
|
70 | - '/images', |
|
71 | - '/css', |
|
72 | - '/js', |
|
73 | - '/tree', |
|
74 | - '/images/icons/16', |
|
75 | - '/images/icons/32', |
|
76 | - ], |
|
77 | - 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
66 | + ], |
|
67 | + 'oldFiles' => [// '/sql/mysql.sql', |
|
68 | + ], |
|
69 | + 'oldFolders' => [ |
|
70 | + '/images', |
|
71 | + '/css', |
|
72 | + '/js', |
|
73 | + '/tree', |
|
74 | + '/images/icons/16', |
|
75 | + '/images/icons/32', |
|
76 | + ], |
|
77 | + 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
78 | 78 | <img src='" . $capsDirName . '_AUTHOR_LOGOIMG' . '\' alt=\'XOOPS Project\' /></a>', |
79 | 79 | ]; |