@@ -19,21 +19,21 @@ discard block |
||
19 | 19 | * **************************************************************************** |
20 | 20 | */ |
21 | 21 | if (!defined('XOOPS_ROOT_PATH')) { |
22 | - die('XOOPS root path not defined'); |
|
22 | + die('XOOPS root path not defined'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if (!defined('REFERENCES_DIRNAME')) { |
26 | - define('REFERENCES_DIRNAME', 'references'); |
|
27 | - define('REFERENCES_URL', XOOPS_URL . '/modules/' . REFERENCES_DIRNAME . '/'); |
|
28 | - define('REFERENCES_PATH', XOOPS_ROOT_PATH . '/modules/' . REFERENCES_DIRNAME . '/'); |
|
29 | - define('REFERENCES_IMAGES_URL', REFERENCES_URL . 'assets/images/'); // Les images du module (l'url) |
|
30 | - define('REFERENCES_IMAGES_PATH', REFERENCES_PATH . 'assets/images/'); // Les images du module (le chemin) |
|
31 | - define('REFERENCES_CLASS_PATH', REFERENCES_PATH . 'class/'); |
|
32 | - define('REFERENCES_PLUGINS_PATH', REFERENCES_PATH . 'plugins/'); |
|
33 | - define('REFERENCES_PLUGINS_URL', REFERENCES_URL . 'plugins/'); |
|
34 | - define('REFERENCES_JS_URL', REFERENCES_URL . 'js/'); |
|
35 | - define('REFERENCES_TEXTFILE1', 'references_index.tpl'); |
|
36 | - define('REFERENCES_PERM_READ', 'references_view'); // Nom de la permission de lire |
|
26 | + define('REFERENCES_DIRNAME', 'references'); |
|
27 | + define('REFERENCES_URL', XOOPS_URL . '/modules/' . REFERENCES_DIRNAME . '/'); |
|
28 | + define('REFERENCES_PATH', XOOPS_ROOT_PATH . '/modules/' . REFERENCES_DIRNAME . '/'); |
|
29 | + define('REFERENCES_IMAGES_URL', REFERENCES_URL . 'assets/images/'); // Les images du module (l'url) |
|
30 | + define('REFERENCES_IMAGES_PATH', REFERENCES_PATH . 'assets/images/'); // Les images du module (le chemin) |
|
31 | + define('REFERENCES_CLASS_PATH', REFERENCES_PATH . 'class/'); |
|
32 | + define('REFERENCES_PLUGINS_PATH', REFERENCES_PATH . 'plugins/'); |
|
33 | + define('REFERENCES_PLUGINS_URL', REFERENCES_URL . 'plugins/'); |
|
34 | + define('REFERENCES_JS_URL', REFERENCES_URL . 'js/'); |
|
35 | + define('REFERENCES_TEXTFILE1', 'references_index.tpl'); |
|
36 | + define('REFERENCES_PERM_READ', 'references_view'); // Nom de la permission de lire |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Chargement des handler et des autres classes |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | |
58 | 58 | // Définition des images |
59 | 59 | if (!defined('_REFERENCES_EDIT')) { |
60 | - global $xoopsConfig; |
|
61 | - if (isset($xoopsConfig) && file_exists(REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/main.php')) { |
|
62 | - require REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/main.php'; |
|
63 | - } else { |
|
64 | - require REFERENCES_PATH . 'language/english/main.php'; |
|
65 | - } |
|
60 | + global $xoopsConfig; |
|
61 | + if (isset($xoopsConfig) && file_exists(REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/main.php')) { |
|
62 | + require REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/main.php'; |
|
63 | + } else { |
|
64 | + require REFERENCES_PATH . 'language/english/main.php'; |
|
65 | + } |
|
66 | 66 | |
67 | - $icones = array( |
|
68 | - 'edit' => "<img src='" . REFERENCES_IMAGES_URL . "edit.gif' alt='" . _REFERENCES_EDIT . "' align='middle' />", |
|
69 | - 'delete' => "<img src='" . REFERENCES_IMAGES_URL . "delete.gif' alt='" . _REFERENCES_DELETE . "' align='middle' />" |
|
70 | - ); |
|
67 | + $icones = array( |
|
68 | + 'edit' => "<img src='" . REFERENCES_IMAGES_URL . "edit.gif' alt='" . _REFERENCES_EDIT . "' align='middle' />", |
|
69 | + 'delete' => "<img src='" . REFERENCES_IMAGES_URL . "delete.gif' alt='" . _REFERENCES_DELETE . "' align='middle' />" |
|
70 | + ); |
|
71 | 71 | } |
@@ -24,32 +24,32 @@ discard block |
||
24 | 24 | |
25 | 25 | if (!defined('REFERENCES_DIRNAME')) { |
26 | 26 | define('REFERENCES_DIRNAME', 'references'); |
27 | - define('REFERENCES_URL', XOOPS_URL . '/modules/' . REFERENCES_DIRNAME . '/'); |
|
28 | - define('REFERENCES_PATH', XOOPS_ROOT_PATH . '/modules/' . REFERENCES_DIRNAME . '/'); |
|
29 | - define('REFERENCES_IMAGES_URL', REFERENCES_URL . 'assets/images/'); // Les images du module (l'url) |
|
30 | - define('REFERENCES_IMAGES_PATH', REFERENCES_PATH . 'assets/images/'); // Les images du module (le chemin) |
|
31 | - define('REFERENCES_CLASS_PATH', REFERENCES_PATH . 'class/'); |
|
32 | - define('REFERENCES_PLUGINS_PATH', REFERENCES_PATH . 'plugins/'); |
|
33 | - define('REFERENCES_PLUGINS_URL', REFERENCES_URL . 'plugins/'); |
|
34 | - define('REFERENCES_JS_URL', REFERENCES_URL . 'js/'); |
|
27 | + define('REFERENCES_URL', XOOPS_URL.'/modules/'.REFERENCES_DIRNAME.'/'); |
|
28 | + define('REFERENCES_PATH', XOOPS_ROOT_PATH.'/modules/'.REFERENCES_DIRNAME.'/'); |
|
29 | + define('REFERENCES_IMAGES_URL', REFERENCES_URL.'assets/images/'); // Les images du module (l'url) |
|
30 | + define('REFERENCES_IMAGES_PATH', REFERENCES_PATH.'assets/images/'); // Les images du module (le chemin) |
|
31 | + define('REFERENCES_CLASS_PATH', REFERENCES_PATH.'class/'); |
|
32 | + define('REFERENCES_PLUGINS_PATH', REFERENCES_PATH.'plugins/'); |
|
33 | + define('REFERENCES_PLUGINS_URL', REFERENCES_URL.'plugins/'); |
|
34 | + define('REFERENCES_JS_URL', REFERENCES_URL.'js/'); |
|
35 | 35 | define('REFERENCES_TEXTFILE1', 'references_index.tpl'); |
36 | - define('REFERENCES_PERM_READ', 'references_view'); // Nom de la permission de lire |
|
36 | + define('REFERENCES_PERM_READ', 'references_view'); // Nom de la permission de lire |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Chargement des handler et des autres classes |
40 | -require REFERENCES_PATH . 'config.php'; |
|
40 | +require REFERENCES_PATH.'config.php'; |
|
41 | 41 | |
42 | 42 | // La classe paramètres |
43 | -require_once REFERENCES_CLASS_PATH . 'references_parameters.php'; |
|
43 | +require_once REFERENCES_CLASS_PATH.'references_parameters.php'; |
|
44 | 44 | |
45 | 45 | // Les classes pour les plugins |
46 | -require_once REFERENCES_CLASS_PATH . 'references_plugins.php'; // Classe principale |
|
47 | -require_once REFERENCES_PLUGINS_PATH . 'models' . DIRECTORY_SEPARATOR . 'references_action.php'; |
|
48 | -require_once REFERENCES_PLUGINS_PATH . 'models' . DIRECTORY_SEPARATOR . 'references_filter.php'; |
|
46 | +require_once REFERENCES_CLASS_PATH.'references_plugins.php'; // Classe principale |
|
47 | +require_once REFERENCES_PLUGINS_PATH.'models'.DIRECTORY_SEPARATOR.'references_action.php'; |
|
48 | +require_once REFERENCES_PLUGINS_PATH.'models'.DIRECTORY_SEPARATOR.'references_filter.php'; |
|
49 | 49 | |
50 | -require_once REFERENCES_CLASS_PATH . 'references_utils.php'; |
|
51 | -require_once REFERENCES_CLASS_PATH . 'PEAR.php'; |
|
52 | -require_once REFERENCES_CLASS_PATH . 'references_handlers.php'; |
|
50 | +require_once REFERENCES_CLASS_PATH.'references_utils.php'; |
|
51 | +require_once REFERENCES_CLASS_PATH.'PEAR.php'; |
|
52 | +require_once REFERENCES_CLASS_PATH.'references_handlers.php'; |
|
53 | 53 | |
54 | 54 | $h_references_articles = xoops_getModuleHandler('references_articles', REFERENCES_DIRNAME); |
55 | 55 | $h_references_categories = xoops_getModuleHandler('references_categories', REFERENCES_DIRNAME); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | // Définition des images |
59 | 59 | if (!defined('_REFERENCES_EDIT')) { |
60 | 60 | global $xoopsConfig; |
61 | - if (isset($xoopsConfig) && file_exists(REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/main.php')) { |
|
62 | - require REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/main.php'; |
|
61 | + if (isset($xoopsConfig) && file_exists(REFERENCES_PATH.'language/'.$xoopsConfig['language'].'/main.php')) { |
|
62 | + require REFERENCES_PATH.'language/'.$xoopsConfig['language'].'/main.php'; |
|
63 | 63 | } else { |
64 | - require REFERENCES_PATH . 'language/english/main.php'; |
|
64 | + require REFERENCES_PATH.'language/english/main.php'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $icones = array( |
68 | - 'edit' => "<img src='" . REFERENCES_IMAGES_URL . "edit.gif' alt='" . _REFERENCES_EDIT . "' align='middle' />", |
|
69 | - 'delete' => "<img src='" . REFERENCES_IMAGES_URL . "delete.gif' alt='" . _REFERENCES_DELETE . "' align='middle' />" |
|
68 | + 'edit' => "<img src='".REFERENCES_IMAGES_URL."edit.gif' alt='"._REFERENCES_EDIT."' align='middle' />", |
|
69 | + 'delete' => "<img src='".REFERENCES_IMAGES_URL."delete.gif' alt='"._REFERENCES_DELETE."' align='middle' />" |
|
70 | 70 | ); |
71 | 71 | } |
@@ -27,35 +27,35 @@ |
||
27 | 27 | */ |
28 | 28 | function references_notify_iteminfo($category, $item_id) |
29 | 29 | { |
30 | - global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
|
31 | - $item_id = (int)$item_id; |
|
30 | + global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
|
31 | + $item_id = (int)$item_id; |
|
32 | 32 | |
33 | - if (empty($xoopsModule) || $xoopsModule->getVar('dirname') !== 'references') { |
|
34 | - $module_handler = xoops_getHandler('module'); |
|
35 | - $module = $module_handler->getByDirname('references'); |
|
36 | - $config_handler = xoops_getHandler('config'); |
|
37 | - $config = $config_handler->getConfigsByCat(0, $module->getVar('mid')); |
|
38 | - } else { |
|
39 | - $module =& $xoopsModule; |
|
40 | - $config =& $xoopsModuleConfig; |
|
41 | - } |
|
33 | + if (empty($xoopsModule) || $xoopsModule->getVar('dirname') !== 'references') { |
|
34 | + $module_handler = xoops_getHandler('module'); |
|
35 | + $module = $module_handler->getByDirname('references'); |
|
36 | + $config_handler = xoops_getHandler('config'); |
|
37 | + $config = $config_handler->getConfigsByCat(0, $module->getVar('mid')); |
|
38 | + } else { |
|
39 | + $module =& $xoopsModule; |
|
40 | + $config =& $xoopsModuleConfig; |
|
41 | + } |
|
42 | 42 | |
43 | - if ($category === 'global') { |
|
44 | - $item['name'] = ''; |
|
45 | - $item['url'] = ''; |
|
43 | + if ($category === 'global') { |
|
44 | + $item['name'] = ''; |
|
45 | + $item['url'] = ''; |
|
46 | 46 | |
47 | - return $item; |
|
48 | - } |
|
47 | + return $item; |
|
48 | + } |
|
49 | 49 | |
50 | - if ($category === 'new_article') { |
|
51 | - include REFERENCES_PATH . ' include/common.php'; |
|
52 | - $article = null; |
|
53 | - $article = $h_references_articles->get($item_id); |
|
54 | - if (is_object($article)) { |
|
55 | - $item['name'] = $article->getVar('article_title'); |
|
56 | - $item['url'] = REFERENCES_URL; |
|
57 | - } |
|
50 | + if ($category === 'new_article') { |
|
51 | + include REFERENCES_PATH . ' include/common.php'; |
|
52 | + $article = null; |
|
53 | + $article = $h_references_articles->get($item_id); |
|
54 | + if (is_object($article)) { |
|
55 | + $item['name'] = $article->getVar('article_title'); |
|
56 | + $item['url'] = REFERENCES_URL; |
|
57 | + } |
|
58 | 58 | |
59 | - return $item; |
|
60 | - } |
|
59 | + return $item; |
|
60 | + } |
|
61 | 61 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | function references_notify_iteminfo($category, $item_id) |
29 | 29 | { |
30 | 30 | global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
31 | - $item_id = (int)$item_id; |
|
31 | + $item_id = (int) $item_id; |
|
32 | 32 | |
33 | 33 | if (empty($xoopsModule) || $xoopsModule->getVar('dirname') !== 'references') { |
34 | 34 | $module_handler = xoops_getHandler('module'); |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | $config_handler = xoops_getHandler('config'); |
37 | 37 | $config = $config_handler->getConfigsByCat(0, $module->getVar('mid')); |
38 | 38 | } else { |
39 | - $module =& $xoopsModule; |
|
40 | - $config =& $xoopsModuleConfig; |
|
39 | + $module = & $xoopsModule; |
|
40 | + $config = & $xoopsModuleConfig; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if ($category === 'global') { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | if ($category === 'new_article') { |
51 | - include REFERENCES_PATH . ' include/common.php'; |
|
51 | + include REFERENCES_PATH.' include/common.php'; |
|
52 | 52 | $article = null; |
53 | 53 | $article = $h_references_articles->get($item_id); |
54 | 54 | if (is_object($article)) { |
@@ -22,30 +22,30 @@ discard block |
||
22 | 22 | |
23 | 23 | function references_tag_iteminfo(&$items) |
24 | 24 | { |
25 | - $items_id = array(); |
|
26 | - foreach (array_keys($items) as $cat_id) { |
|
27 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
28 | - $items_id[] = (int)$item_id; |
|
29 | - } |
|
30 | - } |
|
31 | - include XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
32 | - $items_obj = $h_references_articles->getItemsFromIds($items_id); |
|
25 | + $items_id = array(); |
|
26 | + foreach (array_keys($items) as $cat_id) { |
|
27 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
28 | + $items_id[] = (int)$item_id; |
|
29 | + } |
|
30 | + } |
|
31 | + include XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
32 | + $items_obj = $h_references_articles->getItemsFromIds($items_id); |
|
33 | 33 | |
34 | - foreach (array_keys($items) as $cat_id) { |
|
35 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
36 | - $item_obj =& $items_obj[$item_id]; |
|
37 | - /** @noinspection SenselessCommaInArrayDefinitionInspection */ |
|
38 | - $items[$cat_id][$item_id] = array( |
|
39 | - 'title' => $item_obj->getVar('article_title'), |
|
40 | - 'uid' => $item_obj->getVar('article_author'), |
|
41 | - 'link' => 'index.php', |
|
42 | - 'time' => $item_obj->getVar('article_timestamp'), |
|
43 | - 'tags' => '', |
|
44 | - 'content' => '', |
|
45 | - ); |
|
46 | - } |
|
47 | - } |
|
48 | - unset($items_obj); |
|
34 | + foreach (array_keys($items) as $cat_id) { |
|
35 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
36 | + $item_obj =& $items_obj[$item_id]; |
|
37 | + /** @noinspection SenselessCommaInArrayDefinitionInspection */ |
|
38 | + $items[$cat_id][$item_id] = array( |
|
39 | + 'title' => $item_obj->getVar('article_title'), |
|
40 | + 'uid' => $item_obj->getVar('article_author'), |
|
41 | + 'link' => 'index.php', |
|
42 | + 'time' => $item_obj->getVar('article_timestamp'), |
|
43 | + 'tags' => '', |
|
44 | + 'content' => '', |
|
45 | + ); |
|
46 | + } |
|
47 | + } |
|
48 | + unset($items_obj); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** Remove orphan tag-item links * |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function references_tag_synchronization($mid) |
55 | 55 | { |
56 | - global $xoopsDB; |
|
57 | - $item_handler_keyName = 'article_id'; |
|
58 | - $item_handler_table = $xoopsDB->prefix('references_articles'); |
|
59 | - $link_handler = xoops_getModuleHandler('link', 'tag'); |
|
60 | - $where = "($item_handler_table.article_online = 1)"; |
|
61 | - $where1 = "($item_handler_table.article_online = 0)"; |
|
56 | + global $xoopsDB; |
|
57 | + $item_handler_keyName = 'article_id'; |
|
58 | + $item_handler_table = $xoopsDB->prefix('references_articles'); |
|
59 | + $link_handler = xoops_getModuleHandler('link', 'tag'); |
|
60 | + $where = "($item_handler_table.article_online = 1)"; |
|
61 | + $where1 = "($item_handler_table.article_online = 0)"; |
|
62 | 62 | |
63 | - /* clear tag-item links */ |
|
64 | - if ($link_handler->mysql_major_version() >= 4): |
|
65 | - $sql = " DELETE FROM {$link_handler->table}" . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . ' ( tag_itemid NOT IN ' . " ( SELECT DISTINCT {$item_handler_keyName} " . " FROM {$item_handler_table} " . " WHERE $where" . ' ) ' |
|
66 | - . ' )'; |
|
67 | - else: |
|
68 | - $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" . " LEFT JOIN {$item_handler_table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler_keyName} " . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . " ( aa.{$item_handler_keyName} IS NULL" |
|
69 | - . " OR $where1" . ' )'; |
|
70 | - endif; |
|
71 | - if (!$link_handler->db->queryF($sql)) { |
|
72 | - trigger_error($link_handler->db->error()); |
|
73 | - } |
|
63 | + /* clear tag-item links */ |
|
64 | + if ($link_handler->mysql_major_version() >= 4): |
|
65 | + $sql = " DELETE FROM {$link_handler->table}" . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . ' ( tag_itemid NOT IN ' . " ( SELECT DISTINCT {$item_handler_keyName} " . " FROM {$item_handler_table} " . " WHERE $where" . ' ) ' |
|
66 | + . ' )'; |
|
67 | + else: |
|
68 | + $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" . " LEFT JOIN {$item_handler_table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler_keyName} " . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . " ( aa.{$item_handler_keyName} IS NULL" |
|
69 | + . " OR $where1" . ' )'; |
|
70 | + endif; |
|
71 | + if (!$link_handler->db->queryF($sql)) { |
|
72 | + trigger_error($link_handler->db->error()); |
|
73 | + } |
|
74 | 74 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | $items_id = array(); |
26 | 26 | foreach (array_keys($items) as $cat_id) { |
27 | 27 | foreach (array_keys($items[$cat_id]) as $item_id) { |
28 | - $items_id[] = (int)$item_id; |
|
28 | + $items_id[] = (int) $item_id; |
|
29 | 29 | } |
30 | 30 | } |
31 | - include XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
31 | + include XOOPS_ROOT_PATH.'/modules/references/include/common.php'; |
|
32 | 32 | $items_obj = $h_references_articles->getItemsFromIds($items_id); |
33 | 33 | |
34 | 34 | foreach (array_keys($items) as $cat_id) { |
35 | 35 | foreach (array_keys($items[$cat_id]) as $item_id) { |
36 | - $item_obj =& $items_obj[$item_id]; |
|
36 | + $item_obj = & $items_obj[$item_id]; |
|
37 | 37 | /** @noinspection SenselessCommaInArrayDefinitionInspection */ |
38 | 38 | $items[$cat_id][$item_id] = array( |
39 | 39 | 'title' => $item_obj->getVar('article_title'), |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | |
63 | 63 | /* clear tag-item links */ |
64 | 64 | if ($link_handler->mysql_major_version() >= 4): |
65 | - $sql = " DELETE FROM {$link_handler->table}" . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . ' ( tag_itemid NOT IN ' . " ( SELECT DISTINCT {$item_handler_keyName} " . " FROM {$item_handler_table} " . " WHERE $where" . ' ) ' |
|
65 | + $sql = " DELETE FROM {$link_handler->table}".' WHERE '." tag_modid = {$mid}".' AND '.' ( tag_itemid NOT IN '." ( SELECT DISTINCT {$item_handler_keyName} "." FROM {$item_handler_table} "." WHERE $where".' ) ' |
|
66 | 66 | . ' )'; |
67 | 67 | else: |
68 | - $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" . " LEFT JOIN {$item_handler_table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler_keyName} " . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . " ( aa.{$item_handler_keyName} IS NULL" |
|
69 | - . " OR $where1" . ' )'; |
|
68 | + $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}"." LEFT JOIN {$item_handler_table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler_keyName} ".' WHERE '." tag_modid = {$mid}".' AND '." ( aa.{$item_handler_keyName} IS NULL" |
|
69 | + . " OR $where1".' )'; |
|
70 | 70 | endif; |
71 | 71 | if (!$link_handler->db->queryF($sql)) { |
72 | 72 | trigger_error($link_handler->db->error()); |
@@ -64,9 +64,11 @@ |
||
64 | 64 | if ($link_handler->mysql_major_version() >= 4): |
65 | 65 | $sql = " DELETE FROM {$link_handler->table}" . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . ' ( tag_itemid NOT IN ' . " ( SELECT DISTINCT {$item_handler_keyName} " . " FROM {$item_handler_table} " . " WHERE $where" . ' ) ' |
66 | 66 | . ' )'; |
67 | - else: |
|
67 | + else { |
|
68 | + : |
|
68 | 69 | $sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" . " LEFT JOIN {$item_handler_table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler_keyName} " . ' WHERE ' . " tag_modid = {$mid}" . ' AND ' . " ( aa.{$item_handler_keyName} IS NULL" |
69 | 70 | . " OR $where1" . ' )'; |
71 | + } |
|
70 | 72 | endif; |
71 | 73 | if (!$link_handler->db->queryF($sql)) { |
72 | 74 | trigger_error($link_handler->db->error()); |
@@ -19,71 +19,71 @@ |
||
19 | 19 | * **************************************************************************** |
20 | 20 | */ |
21 | 21 | if (!defined('XOOPS_ROOT_PATH')) { |
22 | - die('XOOPS root path not defined'); |
|
22 | + die('XOOPS root path not defined'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | function references_search($queryarray, $andor, $limit, $offset, $userid) |
26 | 26 | { |
27 | - global $xoopsDB; |
|
28 | - include XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
27 | + global $xoopsDB; |
|
28 | + include XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
29 | 29 | |
30 | - // Recherche dans les articles |
|
31 | - $sql = 'SELECT article_id, article_title, article_text, article_timestamp, article_author FROM ' . $xoopsDB->prefix('references_articles') . ' WHERE (article_online = ' . REFERENCES_STATUS_ONLINE . ')'; |
|
32 | - // Permissions |
|
33 | - $handlers = references_handler::getInstance(); |
|
34 | - $permissions = $handlers->h_references_articles->getPermissionsCategoriesCriteria()->renderWhere(); |
|
35 | - $sql .= ' AND (' . trim(str_replace('WHERE ', '', $permissions)) . ')'; |
|
36 | - // ***** |
|
30 | + // Recherche dans les articles |
|
31 | + $sql = 'SELECT article_id, article_title, article_text, article_timestamp, article_author FROM ' . $xoopsDB->prefix('references_articles') . ' WHERE (article_online = ' . REFERENCES_STATUS_ONLINE . ')'; |
|
32 | + // Permissions |
|
33 | + $handlers = references_handler::getInstance(); |
|
34 | + $permissions = $handlers->h_references_articles->getPermissionsCategoriesCriteria()->renderWhere(); |
|
35 | + $sql .= ' AND (' . trim(str_replace('WHERE ', '', $permissions)) . ')'; |
|
36 | + // ***** |
|
37 | 37 | |
38 | - // Auteur |
|
39 | - if ($userid != 0) { |
|
40 | - $sql .= ' AND (article_author = ' . $userid . ') '; |
|
41 | - } |
|
38 | + // Auteur |
|
39 | + if ($userid != 0) { |
|
40 | + $sql .= ' AND (article_author = ' . $userid . ') '; |
|
41 | + } |
|
42 | 42 | |
43 | - $tmpObject = new references_articles(); |
|
44 | - $datas = $tmpObject->getVars(); |
|
45 | - $tblFields = array(); |
|
46 | - $cnt = 0; |
|
47 | - foreach ($datas as $key => $value) { |
|
48 | - if ($value['data_type'] == XOBJ_DTYPE_TXTBOX || $value['data_type'] == XOBJ_DTYPE_TXTAREA) { |
|
49 | - if ($cnt == 0) { |
|
50 | - $tblFields[] = $key; |
|
51 | - } else { |
|
52 | - $tblFields[] = ' OR ' . $key; |
|
53 | - } |
|
54 | - ++$cnt; |
|
55 | - } |
|
56 | - } |
|
43 | + $tmpObject = new references_articles(); |
|
44 | + $datas = $tmpObject->getVars(); |
|
45 | + $tblFields = array(); |
|
46 | + $cnt = 0; |
|
47 | + foreach ($datas as $key => $value) { |
|
48 | + if ($value['data_type'] == XOBJ_DTYPE_TXTBOX || $value['data_type'] == XOBJ_DTYPE_TXTAREA) { |
|
49 | + if ($cnt == 0) { |
|
50 | + $tblFields[] = $key; |
|
51 | + } else { |
|
52 | + $tblFields[] = ' OR ' . $key; |
|
53 | + } |
|
54 | + ++$cnt; |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | - $count = count($queryarray); |
|
59 | - $more = ''; |
|
60 | - if (is_array($queryarray) && $count > 0) { |
|
61 | - $cnt = 0; |
|
62 | - $sql .= ' AND ('; |
|
63 | - $more = ')'; |
|
64 | - foreach ($queryarray as $oneQuery) { |
|
65 | - $sql .= '('; |
|
66 | - $cond = " LIKE '%" . $oneQuery . "%' "; |
|
67 | - $sql .= implode($cond, $tblFields) . $cond . ')'; |
|
68 | - ++$cnt; |
|
69 | - if ($cnt != $count) { |
|
70 | - $sql .= ' ' . $andor . ' '; |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
74 | - $sql .= $more . ' ORDER BY article_timestamp DESC'; |
|
75 | - $i = 0; |
|
76 | - $ret = array(); |
|
77 | - $myts = MyTextSanitizer::getInstance(); |
|
78 | - $result = $xoopsDB->query($sql, $limit, $offset); |
|
79 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
80 | - $ret[$i]['image'] = 'assets/images/newspaper.png'; |
|
81 | - $ret[$i]['link'] = REFERENCES_URL . 'reference.php?article_id=' . $myrow['article_id']; |
|
82 | - $ret[$i]['title'] = $myts->htmlSpecialChars($myrow['article_title']); |
|
83 | - $ret[$i]['time'] = $myrow['article_timestamp']; |
|
84 | - $ret[$i]['uid'] = $myrow['article_author']; |
|
85 | - ++$i; |
|
86 | - } |
|
58 | + $count = count($queryarray); |
|
59 | + $more = ''; |
|
60 | + if (is_array($queryarray) && $count > 0) { |
|
61 | + $cnt = 0; |
|
62 | + $sql .= ' AND ('; |
|
63 | + $more = ')'; |
|
64 | + foreach ($queryarray as $oneQuery) { |
|
65 | + $sql .= '('; |
|
66 | + $cond = " LIKE '%" . $oneQuery . "%' "; |
|
67 | + $sql .= implode($cond, $tblFields) . $cond . ')'; |
|
68 | + ++$cnt; |
|
69 | + if ($cnt != $count) { |
|
70 | + $sql .= ' ' . $andor . ' '; |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | + $sql .= $more . ' ORDER BY article_timestamp DESC'; |
|
75 | + $i = 0; |
|
76 | + $ret = array(); |
|
77 | + $myts = MyTextSanitizer::getInstance(); |
|
78 | + $result = $xoopsDB->query($sql, $limit, $offset); |
|
79 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
80 | + $ret[$i]['image'] = 'assets/images/newspaper.png'; |
|
81 | + $ret[$i]['link'] = REFERENCES_URL . 'reference.php?article_id=' . $myrow['article_id']; |
|
82 | + $ret[$i]['title'] = $myts->htmlSpecialChars($myrow['article_title']); |
|
83 | + $ret[$i]['time'] = $myrow['article_timestamp']; |
|
84 | + $ret[$i]['uid'] = $myrow['article_author']; |
|
85 | + ++$i; |
|
86 | + } |
|
87 | 87 | |
88 | - return $ret; |
|
88 | + return $ret; |
|
89 | 89 | } |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | function references_search($queryarray, $andor, $limit, $offset, $userid) |
26 | 26 | { |
27 | 27 | global $xoopsDB; |
28 | - include XOOPS_ROOT_PATH . '/modules/references/include/common.php'; |
|
28 | + include XOOPS_ROOT_PATH.'/modules/references/include/common.php'; |
|
29 | 29 | |
30 | 30 | // Recherche dans les articles |
31 | - $sql = 'SELECT article_id, article_title, article_text, article_timestamp, article_author FROM ' . $xoopsDB->prefix('references_articles') . ' WHERE (article_online = ' . REFERENCES_STATUS_ONLINE . ')'; |
|
31 | + $sql = 'SELECT article_id, article_title, article_text, article_timestamp, article_author FROM '.$xoopsDB->prefix('references_articles').' WHERE (article_online = '.REFERENCES_STATUS_ONLINE.')'; |
|
32 | 32 | // Permissions |
33 | 33 | $handlers = references_handler::getInstance(); |
34 | 34 | $permissions = $handlers->h_references_articles->getPermissionsCategoriesCriteria()->renderWhere(); |
35 | - $sql .= ' AND (' . trim(str_replace('WHERE ', '', $permissions)) . ')'; |
|
35 | + $sql .= ' AND ('.trim(str_replace('WHERE ', '', $permissions)).')'; |
|
36 | 36 | // ***** |
37 | 37 | |
38 | 38 | // Auteur |
39 | 39 | if ($userid != 0) { |
40 | - $sql .= ' AND (article_author = ' . $userid . ') '; |
|
40 | + $sql .= ' AND (article_author = '.$userid.') '; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $tmpObject = new references_articles(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if ($cnt == 0) { |
50 | 50 | $tblFields[] = $key; |
51 | 51 | } else { |
52 | - $tblFields[] = ' OR ' . $key; |
|
52 | + $tblFields[] = ' OR '.$key; |
|
53 | 53 | } |
54 | 54 | ++$cnt; |
55 | 55 | } |
@@ -63,22 +63,22 @@ discard block |
||
63 | 63 | $more = ')'; |
64 | 64 | foreach ($queryarray as $oneQuery) { |
65 | 65 | $sql .= '('; |
66 | - $cond = " LIKE '%" . $oneQuery . "%' "; |
|
67 | - $sql .= implode($cond, $tblFields) . $cond . ')'; |
|
66 | + $cond = " LIKE '%".$oneQuery."%' "; |
|
67 | + $sql .= implode($cond, $tblFields).$cond.')'; |
|
68 | 68 | ++$cnt; |
69 | 69 | if ($cnt != $count) { |
70 | - $sql .= ' ' . $andor . ' '; |
|
70 | + $sql .= ' '.$andor.' '; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
74 | - $sql .= $more . ' ORDER BY article_timestamp DESC'; |
|
74 | + $sql .= $more.' ORDER BY article_timestamp DESC'; |
|
75 | 75 | $i = 0; |
76 | 76 | $ret = array(); |
77 | 77 | $myts = MyTextSanitizer::getInstance(); |
78 | 78 | $result = $xoopsDB->query($sql, $limit, $offset); |
79 | 79 | while ($myrow = $xoopsDB->fetchArray($result)) { |
80 | 80 | $ret[$i]['image'] = 'assets/images/newspaper.png'; |
81 | - $ret[$i]['link'] = REFERENCES_URL . 'reference.php?article_id=' . $myrow['article_id']; |
|
81 | + $ret[$i]['link'] = REFERENCES_URL.'reference.php?article_id='.$myrow['article_id']; |
|
82 | 82 | $ret[$i]['title'] = $myts->htmlSpecialChars($myrow['article_title']); |
83 | 83 | $ret[$i]['time'] = $myrow['article_timestamp']; |
84 | 84 | $ret[$i]['uid'] = $myrow['article_author']; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | |
22 | 22 | if (!defined('XOOPS_ROOT_PATH')) { |
23 | - die('XOOPS root path not defined'); |
|
23 | + die('XOOPS root path not defined'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $modversion['name'] = _MI_REFERENCES_NAME; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | $modversion['min_xoops'] = '2.5.8'; |
49 | 49 | $modversion['min_admin'] = '1.1'; |
50 | 50 | $modversion['min_db'] = array( |
51 | - 'mysql' => '5.0.7', |
|
52 | - 'mysqli' => '5.0.7' |
|
51 | + 'mysql' => '5.0.7', |
|
52 | + 'mysqli' => '5.0.7' |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | // **************************************************************************** |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * $options[3] - min font size (px or %) |
105 | 105 | */ |
106 | 106 | $modversion['blocks'][] = array( |
107 | - 'file' => 'references_block_tag.php', |
|
108 | - 'name' => _MI_REFERENCES_BNAME3, |
|
109 | - 'description' => 'Show tag cloud', |
|
110 | - 'show_func' => 'references_tag_block_cloud_show', |
|
111 | - 'edit_func' => 'references_tag_block_cloud_edit', |
|
112 | - 'options' => '100|0|150|80', |
|
113 | - 'template' => 'references_tag_block_cloud.tpl' |
|
107 | + 'file' => 'references_block_tag.php', |
|
108 | + 'name' => _MI_REFERENCES_BNAME3, |
|
109 | + 'description' => 'Show tag cloud', |
|
110 | + 'show_func' => 'references_tag_block_cloud_show', |
|
111 | + 'edit_func' => 'references_tag_block_cloud_edit', |
|
112 | + 'options' => '100|0|150|80', |
|
113 | + 'template' => 'references_tag_block_cloud.tpl' |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | /* |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | * $options[2] - sort: a - alphabet; c - count; t - time |
121 | 121 | */ |
122 | 122 | $modversion['blocks'][] = array( |
123 | - 'file' => 'references_block_tag.php', |
|
124 | - 'name' => _MI_REFERENCES_BNAME4, |
|
125 | - 'description' => 'Show top tags', |
|
126 | - 'show_func' => 'references_tag_block_top_show', |
|
127 | - 'edit_func' => 'references_tag_block_top_edit', |
|
128 | - 'options' => '50|30|c', |
|
129 | - 'template' => 'references_tag_block_top.tpl' |
|
123 | + 'file' => 'references_block_tag.php', |
|
124 | + 'name' => _MI_REFERENCES_BNAME4, |
|
125 | + 'description' => 'Show top tags', |
|
126 | + 'show_func' => 'references_tag_block_top_show', |
|
127 | + 'edit_func' => 'references_tag_block_top_edit', |
|
128 | + 'options' => '50|30|c', |
|
129 | + 'template' => 'references_tag_block_top.tpl' |
|
130 | 130 | ); |
131 | 131 | |
132 | 132 | // **************************************************************************** |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | require_once XOOPS_ROOT_PATH . '/modules/references/class/references_utils.php'; |
165 | 165 | if (references_utils::getModuleOption('use_rss')) { |
166 | - ++$cptm; |
|
167 | - $modversion['sub'][$cptm]['name'] = _MI_REFERENCES_SMENU1; |
|
168 | - $modversion['sub'][$cptm]['url'] = 'rss.php'; |
|
166 | + ++$cptm; |
|
167 | + $modversion['sub'][$cptm]['name'] = _MI_REFERENCES_SMENU1; |
|
168 | + $modversion['sub'][$cptm]['url'] = 'rss.php'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // **************************************************************************** |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | * Editor to use |
207 | 207 | */ |
208 | 208 | if (!defined('REFERENCES_MAINTAIN')) { |
209 | - ++$cpto; |
|
210 | - $modversion['config'][$cpto]['name'] = 'form_options'; |
|
211 | - $modversion['config'][$cpto]['title'] = '_MI_REFERENCES_OPTION2'; |
|
212 | - $modversion['config'][$cpto]['description'] = ''; |
|
213 | - $modversion['config'][$cpto]['formtype'] = 'select'; |
|
214 | - $modversion['config'][$cpto]['valuetype'] = 'text'; |
|
215 | - $modversion['config'][$cpto]['default'] = 'dhtmltextarea'; |
|
216 | - xoops_load('xoopseditorhandler'); |
|
217 | - $editor_handler = XoopsEditorHandler::getInstance(); |
|
218 | - $modversion['config'][$cpto]['options'] = array_flip($editor_handler->getList()); |
|
209 | + ++$cpto; |
|
210 | + $modversion['config'][$cpto]['name'] = 'form_options'; |
|
211 | + $modversion['config'][$cpto]['title'] = '_MI_REFERENCES_OPTION2'; |
|
212 | + $modversion['config'][$cpto]['description'] = ''; |
|
213 | + $modversion['config'][$cpto]['formtype'] = 'select'; |
|
214 | + $modversion['config'][$cpto]['valuetype'] = 'text'; |
|
215 | + $modversion['config'][$cpto]['default'] = 'dhtmltextarea'; |
|
216 | + xoops_load('xoopseditorhandler'); |
|
217 | + $editor_handler = XoopsEditorHandler::getInstance(); |
|
218 | + $modversion['config'][$cpto]['options'] = array_flip($editor_handler->getList()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | $modversion['config'][$cpto]['formtype'] = 'select'; |
373 | 373 | $modversion['config'][$cpto]['valuetype'] = 'text'; |
374 | 374 | $modversion['config'][$cpto]['options'] = array( |
375 | - _MI_REFERENCES_SORT_DATE => 'article_timestamp', |
|
376 | - _MI_REFERENCES_SORT_WEIGHT => 'article_weight' |
|
375 | + _MI_REFERENCES_SORT_DATE => 'article_timestamp', |
|
376 | + _MI_REFERENCES_SORT_WEIGHT => 'article_weight' |
|
377 | 377 | ); |
378 | 378 | $modversion['config'][$cpto]['default'] = 'article_timestamp'; |
379 | 379 | |
@@ -387,8 +387,8 @@ discard block |
||
387 | 387 | $modversion['config'][$cpto]['formtype'] = 'select'; |
388 | 388 | $modversion['config'][$cpto]['valuetype'] = 'text'; |
389 | 389 | $modversion['config'][$cpto]['options'] = array( |
390 | - _MI_REFERENCES_SORT_ASC => 'ASC', |
|
391 | - _MI_REFERENCES_SORT_DESC => 'DESC' |
|
390 | + _MI_REFERENCES_SORT_ASC => 'ASC', |
|
391 | + _MI_REFERENCES_SORT_DESC => 'DESC' |
|
392 | 392 | ); |
393 | 393 | $modversion['config'][$cpto]['default'] = 'DESC'; |
394 | 394 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | $modversion['config'][$cpto]['formtype'] = 'select'; |
403 | 403 | $modversion['config'][$cpto]['valuetype'] = 'text'; |
404 | 404 | $modversion['config'][$cpto]['options'] = array( |
405 | - _MI_REFERENCES_SORT_DATE => 'article_timestamp', |
|
406 | - _MI_REFERENCES_SORT_WEIGHT => 'article_weight', |
|
407 | - _MI_REFERENCES_SORT_TITLE => 'article_title' |
|
405 | + _MI_REFERENCES_SORT_DATE => 'article_timestamp', |
|
406 | + _MI_REFERENCES_SORT_WEIGHT => 'article_weight', |
|
407 | + _MI_REFERENCES_SORT_TITLE => 'article_title' |
|
408 | 408 | ); |
409 | 409 | $modversion['config'][$cpto]['default'] = 'article_weight'; |
410 | 410 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | $modversion['config'][$cpto]['formtype'] = 'select'; |
419 | 419 | $modversion['config'][$cpto]['valuetype'] = 'text'; |
420 | 420 | $modversion['config'][$cpto]['options'] = array( |
421 | - _MI_REFERENCES_SORT_ASC => 'ASC', |
|
422 | - _MI_REFERENCES_SORT_DESC => 'DESC' |
|
421 | + _MI_REFERENCES_SORT_ASC => 'ASC', |
|
422 | + _MI_REFERENCES_SORT_DESC => 'DESC' |
|
423 | 423 | ); |
424 | 424 | $modversion['config'][$cpto]['default'] = 'ASC'; |
425 | 425 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $modversion['blocks'][$cptb]['description'] = ''; |
82 | 82 | $modversion['blocks'][$cptb]['show_func'] = 'b_references_last_news_show'; |
83 | 83 | $modversion['blocks'][$cptb]['edit_func'] = 'b_references_last_news_edit'; |
84 | -$modversion['blocks'][$cptb]['options'] = '10|'; // Nombre d'articles � afficher, cat�gories � afficher |
|
84 | +$modversion['blocks'][$cptb]['options'] = '10|'; // Nombre d'articles � afficher, cat�gories � afficher |
|
85 | 85 | $modversion['blocks'][$cptb]['template'] = 'references_block_last_new.tpl'; |
86 | 86 | |
87 | 87 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $modversion['blocks'][$cptb]['description'] = ''; |
94 | 94 | $modversion['blocks'][$cptb]['show_func'] = 'b_references_random_news_show'; |
95 | 95 | $modversion['blocks'][$cptb]['edit_func'] = 'b_references_random_news_edit'; |
96 | -$modversion['blocks'][$cptb]['options'] = '5|'; // Number of items, categories to show |
|
96 | +$modversion['blocks'][$cptb]['options'] = '5|'; // Number of items, categories to show |
|
97 | 97 | $modversion['blocks'][$cptb]['template'] = 'references_block_random_news.tpl'; |
98 | 98 | |
99 | 99 | /* |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | $cptm = 0; |
163 | 163 | |
164 | -require_once XOOPS_ROOT_PATH . '/modules/references/class/references_utils.php'; |
|
164 | +require_once XOOPS_ROOT_PATH.'/modules/references/class/references_utils.php'; |
|
165 | 165 | if (references_utils::getModuleOption('use_rss')) { |
166 | 166 | ++$cptm; |
167 | 167 | $modversion['sub'][$cptm]['name'] = _MI_REFERENCES_SMENU1; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | _MI_REFERENCES_SORT_DATE => 'article_timestamp', |
376 | 376 | _MI_REFERENCES_SORT_WEIGHT => 'article_weight' |
377 | 377 | ); |
378 | -$modversion['config'][$cpto]['default'] = 'article_timestamp'; |
|
378 | +$modversion['config'][$cpto]['default'] = 'article_timestamp'; |
|
379 | 379 | |
380 | 380 | /** |
381 | 381 | * Sens du tri |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | _MI_REFERENCES_SORT_ASC => 'ASC', |
391 | 391 | _MI_REFERENCES_SORT_DESC => 'DESC' |
392 | 392 | ); |
393 | -$modversion['config'][$cpto]['default'] = 'DESC'; |
|
393 | +$modversion['config'][$cpto]['default'] = 'DESC'; |
|
394 | 394 | |
395 | 395 | /** |
396 | 396 | * Area to use to sort the references in admin |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | _MI_REFERENCES_SORT_WEIGHT => 'article_weight', |
407 | 407 | _MI_REFERENCES_SORT_TITLE => 'article_title' |
408 | 408 | ); |
409 | -$modversion['config'][$cpto]['default'] = 'article_weight'; |
|
409 | +$modversion['config'][$cpto]['default'] = 'article_weight'; |
|
410 | 410 | |
411 | 411 | /** |
412 | 412 | * Sens du tri |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | _MI_REFERENCES_SORT_ASC => 'ASC', |
422 | 422 | _MI_REFERENCES_SORT_DESC => 'DESC' |
423 | 423 | ); |
424 | -$modversion['config'][$cpto]['default'] = 'ASC'; |
|
424 | +$modversion['config'][$cpto]['default'] = 'ASC'; |
|
425 | 425 | |
426 | 426 | // **************************************************************************** |
427 | 427 | // Comments ******************************************************************* |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | require_once REFERENCES_PATH . 'admin/dbupdate.php'; |
31 | 31 | |
32 | 32 | if (!isset($op)) { |
33 | - $op = 'default'; |
|
33 | + $op = 'default'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | if (isset($_POST['op'])) { |
37 | - $op = $_POST['op']; |
|
37 | + $op = $_POST['op']; |
|
38 | 38 | } else { |
39 | - if (isset($_GET['op'])) { |
|
40 | - $op = $_GET['op']; |
|
41 | - } |
|
39 | + if (isset($_GET['op'])) { |
|
40 | + $op = $_GET['op']; |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // V???rification de l'existence et de l'???tat d'???criture des diff???rents r???pertoire de stockage et de cache |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function show_footer() |
67 | 67 | { |
68 | - echo "<br><br><div align='center'><a href='http://www.instant-zero.com' target='_blank' title='Instant Zero'><img src='../assets/images/instantzero.gif' alt='Instant Zero' /></a></div>"; |
|
68 | + echo "<br><br><div align='center'><a href='http://www.instant-zero.com' target='_blank' title='Instant Zero'><img src='../assets/images/instantzero.gif' alt='Instant Zero' /></a></div>"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | references_utils::loadLanguageFile('modinfo.php'); |
@@ -76,634 +76,634 @@ discard block |
||
76 | 76 | // ****************************************************************************************************************************************** |
77 | 77 | switch ($op) { |
78 | 78 | |
79 | - // **************************************************************************************************************** |
|
80 | - case 'default': // Gestion des articles |
|
81 | - case 'articles': |
|
82 | - // **************************************************************************************************************** |
|
83 | - xoops_cp_header(); |
|
84 | - // references_adminMenu(0); |
|
85 | - $objet = 'articles'; |
|
86 | - $items = array(); |
|
87 | - if (isset($_GET['move'])) { |
|
88 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
89 | - $ordre = isset($_GET['ordre']) ? (int)$_GET['ordre'] : 0; |
|
90 | - if ($_GET['move'] === 'up' && $id > 0) { |
|
91 | - $handlers->h_references_articles->moveUp($id, $ordre); |
|
92 | - } |
|
93 | - if ($_GET['move'] === 'down' && $id > 0) { |
|
94 | - $handlers->h_references_articles->moveDown($id, $ordre); |
|
95 | - } |
|
96 | - } |
|
97 | - $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='" . _AM_REFERENCES_ADD_ITEM . "' /></form>"; |
|
98 | - echo $form; |
|
99 | - $categoriesList = $h_references_categories->getListArray(); |
|
100 | - $upText = _AM_REFERENCES_UP; |
|
101 | - $downText = _AM_REFERENCES_DOWN; |
|
102 | - $upImg = "<a href='$baseurl?op=articles&move=up&id=%d&ordre=%d' title=\"$upText\"><img src='" . REFERENCES_IMAGES_URL . "up.png' alt=\"$upText\" /></a>"; |
|
103 | - $downImg = "<a href='$baseurl?op=articles&move=down&id=%d&ordre=%d' title=\"$downText\"><img src='" . REFERENCES_IMAGES_URL . "down.png' alt=\"$downText\" /></a>"; |
|
104 | - |
|
105 | - $referencesFilter = new references_listFilter($h_references_articles, 'op', 'articles', 'start', $limit, $baseurl, $defaultSortField, $defaultSortOrder, true, REFERENCES_JS_URL); |
|
106 | - $referencesFilter->initFilter('article_id', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 5, 'maxLength' => 10)); |
|
107 | - $referencesFilter->initFilter('article_title', array('dataType' => references_listFilter::FILTER_DATA_TEXT, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 35, 'maxLength' => 255, 'autoComplete' => true)); |
|
108 | - $referencesFilter->initFilter('article_weight', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 5, 'maxLength' => 10)); |
|
109 | - |
|
110 | - $referencesFilter->initFilter('article_category_id', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_SELECT, 'values' => $categoriesList, 'withNull' => true, 'style' => 'width: 170px; max-width: 170px;')); |
|
111 | - $referencesFilter->initFilter('article_online', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_SELECT, 'values' => array(2 => _YES, 1 => _NO), 'withNull' => true, 'minusOne' => true)); |
|
112 | - $sortFields = array('article_id' => _AM_REFERENCES_ID, 'article_title' => _AM_REFERENCES_TITLE, 'article_weight' => _AM_REFERENCES_WEIGHT, 'article_category_id' => _AM_REFERENCES_CATEGORY, 'article_online' => _AM_REFERENCES_ONLINE); |
|
113 | - $referencesFilter->setSortFields($sortFields); |
|
114 | - |
|
115 | - $referencesFilter->filter(); |
|
116 | - $itemsCount = $referencesFilter->getCount(); |
|
117 | - references_utils::htitle(_MI_REFERENCES_ADMENU0 . ' (' . $itemsCount . ')', 4); |
|
118 | - |
|
119 | - if ($itemsCount > $limit) { |
|
120 | - $pagenav = $referencesFilter->getPager(); |
|
121 | - } |
|
122 | - |
|
123 | - $items = $referencesFilter->getObjects(); |
|
124 | - $visibleCountItems = count($items); |
|
125 | - $counter = 0; |
|
126 | - $categories = $h_references_categories->getListArray(); |
|
127 | - echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
|
128 | - echo "<tr>\n"; |
|
129 | - echo "<form method='post' action='$baseurl'>\n"; |
|
130 | - echo "<td colspan='4' align='right'>" . $referencesFilter->getSortPlaceHolderHtmlCode(); |
|
131 | - echo $referencesFilter->getClearFilterbutton(); |
|
132 | - echo "</td>\n"; |
|
133 | - echo "<td colspan='2' align='right'>"; |
|
134 | - if (isset($pagenav) && is_object($pagenav)) { |
|
135 | - echo $pagenav->renderNav(); |
|
136 | - } |
|
137 | - echo "</td>\n</tr>\n"; |
|
138 | - |
|
139 | - echo "<th align='center'>" . _AM_REFERENCES_ID . "</th><th align='center'>" . _AM_REFERENCES_TITLE . "</th><th align='center'>" . _AM_REFERENCES_WEIGHT . "</th><th align='center'>" . _AM_REFERENCES_CATEGORY . "</th><th align='center'>" . _AM_REFERENCES_ONLINE . "</th><th align='center'>" |
|
140 | - . _AM_REFERENCES_MANUAL_DATE . "</th><th align='center'>" . _AM_REFERENCES_ACTION . '</th></tr>'; |
|
141 | - // Filtres **************************************** |
|
142 | - echo "<tr>\n"; |
|
143 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_id') . "</th>\n"; |
|
144 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_title') . "</th>\n"; |
|
145 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_weight') . "</th>\n"; |
|
146 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_category_id') . "</th>\n"; |
|
147 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_online') . "</th>\n"; |
|
148 | - echo "<th align='center'> </th>\n"; |
|
149 | - echo "<th align='center'>" . $referencesFilter->getGoButton() . "</th></form></tr>\n"; |
|
150 | - // ************************************************ |
|
151 | - $class = ''; |
|
152 | - foreach ($items as $item) { |
|
153 | - ++$counter; |
|
154 | - $class = ($class === 'even') ? 'odd' : 'even'; |
|
155 | - $id = $item->getVar('article_id'); |
|
156 | - $action_edit = "<a href='$baseurl?op=edit" . $objet . '&id=' . $id . "' title='" . _EDIT . "'>" . $icones['edit'] . '</a>'; |
|
157 | - $action_delete = "<a href='$baseurl?op=delete" . $objet . '&id=' . $id . "' title='" . _DELETE . "'" . $conf_msg . '>' . $icones['delete'] . '</a>'; |
|
158 | - $category = isset($categories[$item->getVar('article_category_id')]) ? $categories[$item->getVar('article_category_id')] : ''; |
|
159 | - $up = $down = ''; |
|
160 | - echo "<tr class='" . $class . "'>\n"; |
|
161 | - $ordre = $item->getVar('article_weight'); |
|
162 | - if ($counter == 1 && $visibleCountItems > 1) { // Premier ???l???ment |
|
163 | - $down = sprintf($downImg, $id, $ordre); |
|
164 | - } |
|
165 | - if ($counter == $visibleCountItems && $visibleCountItems > 1) { // Dernier ???l???ment |
|
166 | - $up = sprintf($upImg, $id, $ordre); |
|
167 | - } |
|
168 | - if ($counter > 1 & $counter < $visibleCountItems && $visibleCountItems > 1) { // Element dans le milieu |
|
169 | - $up = sprintf($upImg, $id, $ordre); |
|
170 | - $down = sprintf($downImg, $id, $ordre); |
|
171 | - } |
|
172 | - |
|
173 | - echo "<td align='center'>" . $id . '</td>'; |
|
174 | - echo "<td align='left'><a target='_blank' href='" . $item->getUrl() . "'>" . $item->getVar('article_title') . '</a></td>'; |
|
175 | - echo "<td align='center'>" . $item->getVar('article_weight') . " $up $down</td>"; |
|
176 | - echo "<td align='center'>" . $category . '</td>'; |
|
177 | - if ($item->isArticleOnline()) { |
|
178 | - $statusLink = "<a href='$baseurl?op=offline&id=$id' title='" . _AM_REFERENCES_GO_OFFLINE . "'><img src='" . REFERENCES_IMAGES_URL . "status_online.png' alt='" . _AM_REFERENCES_GO_OFFLINE . "' /></a>"; |
|
179 | - } else { |
|
180 | - $statusLink = "<a href='$baseurl?op=online&id=$id' title='" . _AM_REFERENCES_GO_ONLINE . "'><img src='" . REFERENCES_IMAGES_URL . "status_offline.png' alt='" . _AM_REFERENCES_GO_ONLINE . "' /></a>"; |
|
181 | - } |
|
182 | - echo "<td align='center'>" . $statusLink . '</td>'; |
|
183 | - echo "<td align='center'>" . $item->getVar('article_date') . '</td>'; |
|
184 | - echo "<td align='center'>" . $action_edit . ' ' . $action_delete . "</td>\n"; |
|
185 | - echo "<tr>\n"; |
|
186 | - } |
|
187 | - $class = ($class === 'even') ? 'odd' : 'even'; |
|
188 | - echo "<tr class='" . $class . "'>\n"; |
|
189 | - echo "<td colspan='7' align='center'>" . $form . "</td>\n"; |
|
190 | - echo "</tr>\n"; |
|
191 | - echo "</table>\n"; |
|
192 | - echo $referencesFilter->getJavascriptInitCode(); |
|
193 | - if (isset($pagenav) && is_object($pagenav)) { |
|
194 | - echo "<div align='center'>" . $pagenav->renderNav() . '</div>'; |
|
195 | - } |
|
196 | - echo "<br><br>\n"; |
|
197 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
198 | - break; |
|
199 | - |
|
200 | - // **************************************************************************************************************** |
|
201 | - case 'addarticles': // Ajout d'un article |
|
202 | - case 'editarticles': // Edition d'un article |
|
203 | - // **************************************************************************************************************** |
|
204 | - xoops_cp_header(); |
|
205 | - // references_adminMenu(0); |
|
206 | - $object = 'articles'; |
|
207 | - if ($op == 'edit' . $object) { |
|
208 | - $title = _AM_REFERENCES_EDIT_ARTICLE; |
|
209 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
210 | - if (empty($id)) { |
|
211 | - references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
212 | - } |
|
213 | - // Item exits ? |
|
214 | - $item = null; |
|
215 | - $item = $h_references_articles->get($id); |
|
216 | - if (!is_object($item)) { |
|
217 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
218 | - } |
|
219 | - $edit = true; |
|
220 | - $label_submit = _AM_REFERENCES_MODIFY; |
|
221 | - } else { |
|
222 | - $title = _AM_REFERENCES_ADD_ARTICLE; |
|
223 | - $item = $h_references_articles->create(true); |
|
224 | - $item->setVar('article_online', true); |
|
225 | - if (REFERENCES_AUTO_FILL_MANUAL_DATE) { |
|
226 | - $item->setVar('article_date', formatTimestamp(time(), 's')); |
|
227 | - } |
|
228 | - $label_submit = _AM_REFERENCES_ADD; |
|
229 | - $edit = false; |
|
230 | - } |
|
231 | - $sform = new XoopsThemeForm($title, 'frmadd' . $object, $baseurl); |
|
232 | - $sform->setExtra('enctype="multipart/form-data"'); |
|
233 | - $sform->addElement(new XoopsFormHidden('op', 'saveedit' . $object)); |
|
234 | - $sform->addElement(new XoopsFormHidden('article_id', $item->getVar('article_id'))); |
|
235 | - $categories = $h_references_categories->getListArray(); |
|
236 | - $categoriesList = new XoopsFormSelect(_AM_REFERENCES_CATEGORY, 'article_category_id', $item->getVar('article_category_id', 'e')); |
|
237 | - $categoriesList->addOptionArray($categories); |
|
238 | - $sform->addElement($categoriesList, true); |
|
239 | - |
|
240 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_TITLE, 'article_title', 50, 255, $item->getVar('article_title', 'e')), true); |
|
241 | - $sform->addElement(new XoopsFormRadioYN(_AM_REFERENCES_ONLINE, 'article_online', $item->getVar('article_online', 'e')), true); |
|
242 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_MANUAL_DATE, 'article_date', 30, 30, $item->getVar('article_date', 'e')), false); |
|
243 | - $sform->addElement(new XoopsFormTextDateSelect(_AM_REFERENCES_DATE, 'article_timestamp', 15, $item->getVar('article_timestamp', 'e'))); |
|
244 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_WEIGHT, 'article_weight', 5, 5, $item->getVar('article_weight', 'e')), false); |
|
245 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_URL, 'article_externalurl', 50, 255, $item->getVar('article_externalurl', 'e')), false); |
|
246 | - |
|
247 | - $editor = references_utils::getWysiwygForm(_AM_REFERENCES_TEXT, 'article_text', $item->getVar('article_text', 'e'), 15, 60, 'article_text_hidden'); |
|
248 | - if ($editor) { |
|
249 | - $sform->addElement($editor, false); |
|
250 | - } |
|
251 | - |
|
252 | - $editor1 = references_utils::getWysiwygForm(_AM_REFERENCES_TEXT_MORE, 'article_readmore', $item->getVar('article_readmore', 'e'), 15, 60, 'article_readmore_hidden'); |
|
253 | - if ($editor1) { |
|
254 | - $sform->addElement($editor1, false); |
|
255 | - } |
|
256 | - |
|
257 | - if (references_utils::getModuleOption('use_tags') && references_utils::tagModuleExists()) { |
|
258 | - require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
259 | - $sform->addElement(new XoopsFormTag('item_tag', 60, 255, $item->getVar('article_id'), 0)); |
|
260 | - } |
|
261 | - // Images |
|
262 | - for ($i = 1; $i <= 10; ++$i) { |
|
263 | - if ($op == 'edit' . $object && $item->pictureExists($i)) { |
|
264 | - $pictureTray = new XoopsFormElementTray(_AM_REFERENCES_CURRENT_PICTURE . ' ' . $i, '<br>'); |
|
265 | - $pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl($i) . "' alt='' border='0' />")); |
|
266 | - $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture' . $i); |
|
267 | - $deleteCheckbox->addOption(1, _DELETE); |
|
268 | - $pictureTray->addElement($deleteCheckbox); |
|
269 | - $sform->addElement($pictureTray); |
|
270 | - unset($pictureTray, $deleteCheckbox); |
|
271 | - } |
|
272 | - $sform->addElement(new XoopsFormFile(_AM_REFERENCES_IMAGE . ' ' . $i, 'attachedfile' . $i, references_utils::getModuleOption('maxuploadsize')), false); |
|
273 | - $fieldName = 'article_picture' . $i . '_text'; |
|
274 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_PICTURE_TEXT . ' ' . $i, $fieldName, 50, 255, $item->getVar($fieldName)), false); |
|
275 | - } |
|
276 | - |
|
277 | - // Fichier attach??? |
|
278 | - if ($op == 'edit' . $object && $item->attachmentExists()) { |
|
279 | - $attachedTray = new XoopsFormElementTray(_AM_REFERENCES_ATTACHED_FILE, '<br>'); |
|
280 | - $attachedTray->addElement(new XoopsFormLabel('', "<a href='" . $item->getAttachmentUrl() . "' target='_blank'>" . $item->getVar('article_attached_file') . '</a>')); |
|
281 | - $deleteCheckbox = new XoopsFormCheckBox('', 'delattach'); |
|
282 | - $deleteCheckbox->addOption(1, _DELETE); |
|
283 | - $attachedTray->addElement($deleteCheckbox); |
|
284 | - $sform->addElement($attachedTray); |
|
285 | - unset($attachedTray, $deleteCheckbox); |
|
286 | - } |
|
287 | - $sform->addElement(new XoopsFormFile(_AM_REFERENCES_ATTACHED_FILE, 'article_attached_file', references_utils::getModuleOption('maxuploadsize')), false); |
|
288 | - |
|
289 | - $button_tray = new XoopsFormElementTray('', ''); |
|
290 | - $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit'); |
|
291 | - $button_tray->addElement($submit_btn); |
|
292 | - $sform->addElement($button_tray); |
|
293 | - $sform = references_utils::formMarkRequiredFields($sform); |
|
294 | - $sform->display(); |
|
295 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
296 | - break; |
|
297 | - |
|
298 | - // **************************************************************************************************************** |
|
299 | - case 'saveeditarticles': // Sauvegarde d'un article |
|
300 | - // **************************************************************************************************************** |
|
301 | - xoops_cp_header(); |
|
302 | - $id = isset($_POST['article_id']) ? (int)$_POST['article_id'] : 0; |
|
303 | - $opRedirect = 'articles'; |
|
304 | - if (!empty($id)) { |
|
305 | - $edit = true; |
|
306 | - $item = $h_references_articles->get($id); |
|
307 | - if (!is_object($item)) { |
|
308 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
309 | - } |
|
310 | - $item->unsetNew(); |
|
311 | - } else { |
|
312 | - $edit = false; |
|
313 | - $item = $h_references_articles->create(true); |
|
314 | - } |
|
315 | - |
|
316 | - $item->setVars($_POST); |
|
317 | - |
|
318 | - // Images |
|
319 | - for ($i = 1; $i <= 10; ++$i) { |
|
320 | - if (isset($_POST['delpicture' . $i]) && (int)$_POST['delpicture' . $i] == 1) { |
|
321 | - $item->deletePicture($i); |
|
322 | - $item->setVar('article_picture' . $i, ''); |
|
323 | - } |
|
324 | - |
|
325 | - // Upload de l'image et cr???ation de la vignette |
|
326 | - $destname = ''; |
|
327 | - $return = references_utils::uploadFile($i - 1, references_utils::getModuleOption('images_path')); |
|
328 | - if ($return === true) { |
|
329 | - if (references_utils::getModuleOption('images_width') > 0 && references_utils::getModuleOption('images_height') > 0) { |
|
330 | - references_utils::createThumb(references_utils::getModuleOption('images_path') . '/' . basename($destname), references_utils::getModuleOption('images_path') . '/' . basename($destname), references_utils::getModuleOption('images_width'), |
|
331 | - references_utils::getModuleOption('images_height'), true); |
|
332 | - } |
|
333 | - $newDestName = references_utils::getModuleOption('images_path') . DIRECTORY_SEPARATOR . REFERENCES_THUMBS_PREFIX . basename($destname); |
|
334 | - $retval = references_utils::resizePicture(references_utils::getModuleOption('images_path') . '/' . basename($destname), $newDestName, $thumbs_width, $thumbs_height, true); |
|
335 | - if ($retval == 1 || $retval == 3) { |
|
336 | - $item->setVar('article_picture' . $i, $destname); |
|
337 | - } |
|
338 | - } else { |
|
339 | - if ($return !== false) { |
|
340 | - echo $return; |
|
341 | - } |
|
342 | - } |
|
343 | - } |
|
344 | - |
|
345 | - $timestamp = mktime(0, 0, 0, (int)substr($_POST['article_timestamp'], 5, 2), (int)substr($_POST['article_timestamp'], 8, 2), (int)substr($_POST['article_timestamp'], 0, 4)); |
|
346 | - $item->setVar('article_timestamp', $timestamp); |
|
347 | - |
|
348 | - if (!$edit) { |
|
349 | - $item->setVar('article_author', references_utils::getCurrentUserID()); |
|
350 | - } |
|
351 | - |
|
352 | - // Suppression ???ventuelle du fichier attach??? |
|
353 | - if (isset($_POST['delattach']) && (int)$_POST['delattach'] == 1) { |
|
354 | - $item->deleteAttachment(); |
|
355 | - } |
|
356 | - |
|
357 | - $destname = ''; |
|
358 | - // Upload de la pi???ce jointe |
|
359 | - $return = references_utils::uploadFile(10, references_utils::getModuleOption('attached_path')); |
|
360 | - if ($return === true) { |
|
361 | - $item->setVar('article_attached_file', $destname); |
|
362 | - } else { |
|
363 | - if ($return !== false) { |
|
364 | - echo $return; |
|
365 | - } |
|
366 | - } |
|
367 | - |
|
368 | - $res = $h_references_articles->insert($item); |
|
369 | - if ($res) { |
|
370 | - if (references_utils::getModuleOption('use_tags') && references_utils::tagModuleExists()) { |
|
371 | - $tag_handler = xoops_getModuleHandler('tag', 'tag'); |
|
372 | - $tag_handler->updateByItem($_POST['item_tag'], $item->getVar('article_id'), $xoopsModule->getVar('dirname'), 0); |
|
373 | - } |
|
374 | - if (!$edit) { |
|
375 | - $h_references_articles->notifyNewArticle($item); |
|
376 | - } |
|
377 | - references_utils::updateCache(); |
|
378 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
379 | - } else { |
|
380 | - references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); |
|
381 | - } |
|
382 | - break; |
|
383 | - |
|
384 | - // **************************************************************************************************************** |
|
385 | - case 'offline': // Mise hors ligne d'un article |
|
386 | - case 'online': // Mise en ligne d'un article |
|
387 | - // **************************************************************************************************************** |
|
388 | - xoops_cp_header(); |
|
389 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
390 | - if (empty($id)) { |
|
391 | - references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
392 | - } |
|
393 | - $opRedirect = 'articles'; |
|
394 | - $item = null; |
|
395 | - $item = $h_references_articles->get($id); |
|
396 | - if (is_object($item)) { |
|
397 | - if ($op === 'offline') { |
|
398 | - $res = $h_references_articles->offlineArticle($item); |
|
399 | - } else { |
|
400 | - $res = $h_references_articles->onlineArticle($item); |
|
401 | - } |
|
402 | - if ($res) { |
|
403 | - references_utils::updateCache(); |
|
404 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
405 | - } |
|
406 | - } |
|
407 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
408 | - break; |
|
409 | - |
|
410 | - // **************************************************************************************************************** |
|
411 | - case 'deletearticles': // Suppression d'un article |
|
412 | - // **************************************************************************************************************** |
|
413 | - xoops_cp_header(); |
|
414 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
415 | - if (empty($id)) { |
|
416 | - references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
417 | - } |
|
418 | - $opRedirect = 'articles'; |
|
419 | - $item = null; |
|
420 | - $item = $h_references_articles->get($id); |
|
421 | - if (is_object($item)) { |
|
422 | - $res = $h_references_articles->deleteArticle($item, true); |
|
423 | - if ($res) { |
|
424 | - references_utils::updateCache(); |
|
425 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
426 | - } |
|
427 | - } |
|
428 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
429 | - break; |
|
430 | - |
|
431 | - // **************************************************************************************************************** |
|
432 | - case 'instant-zero'; // Publicit??? |
|
433 | - // **************************************************************************************************************** |
|
434 | - xoops_cp_header(); |
|
435 | - // references_adminMenu(4); |
|
436 | - echo "<iframe src='http://www.instant-zero.com/modules/liaise/?form_id=2' width='100%' height='600' frameborder='0'></iframe>"; |
|
437 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
438 | - break; |
|
439 | - |
|
440 | - // **************************************************************************************************************** |
|
441 | - case 'perms'; // Permissions |
|
442 | - // **************************************************************************************************************** |
|
443 | - xoops_cp_header(); |
|
444 | - // references_adminMenu(3); |
|
445 | - require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
446 | - $categories = $handlers->h_references_categories->getCategories(); |
|
447 | - $permissionsForm = new XoopsGroupPermForm(_AM_REFERENCES_VIEWFORM, $xoopsModule->getVar('mid'), REFERENCES_PERM_READ, _AM_REFERENCES_VIEWFORM_DESC, 'admin/index.php?op=perms', 'true'); |
|
448 | - foreach ($categories as $category) { |
|
449 | - $permissionsForm->addItem($category->category_id, $category->category_title, 0); |
|
450 | - } |
|
451 | - echo $permissionsForm->render(); |
|
452 | - echo "<br><br><br><br>\n"; |
|
453 | - unset($permissionsForm); |
|
454 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
455 | - break; |
|
456 | - |
|
457 | - // **************************************************************************************************************** |
|
458 | - case 'texts': // Gestion des textes |
|
459 | - // **************************************************************************************************************** |
|
460 | - xoops_cp_header(); |
|
461 | - // references_adminMenu(2); |
|
462 | - require_once REFERENCES_PATH . 'class/registryfile.php'; |
|
463 | - $registry = new references_registryfile(); |
|
464 | - |
|
465 | - $sform = new XoopsThemeForm(_MI_REFERENCES_ADMENU1, 'frmatxt', $baseurl); |
|
466 | - $sform->addElement(new XoopsFormHidden('op', 'savetexts')); |
|
467 | - // Texte ??? afficher sur la page d'index du module |
|
468 | - $editor1 = references_utils::getWysiwygForm(_AM_REFERENCES_TEXT1, 'text1', $registry->getfile(REFERENCES_TEXTFILE1), 5, 60, 'hometext1_hidden'); |
|
469 | - if ($editor1) { |
|
470 | - $sform->addElement($editor1, false); |
|
471 | - } |
|
472 | - $button_tray = new XoopsFormElementTray('', ''); |
|
473 | - $submit_btn = new XoopsFormButton('', 'post', _AM_REFERENCES_MODIFY, 'submit'); |
|
474 | - $button_tray->addElement($submit_btn); |
|
475 | - $sform->addElement($button_tray); |
|
476 | - $sform = references_utils::formMarkRequiredFields($sform); |
|
477 | - $sform->display(); |
|
478 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
479 | - break; |
|
480 | - |
|
481 | - // **************************************************************************************************************** |
|
482 | - case 'savetexts': // Sauvegarde des textes |
|
483 | - // **************************************************************************************************************** |
|
484 | - xoops_cp_header(); |
|
485 | - require_once REFERENCES_PATH . 'class/registryfile.php'; |
|
486 | - $registry = new references_registryfile(); |
|
487 | - $myts = MyTextSanitizer::getInstance(); |
|
488 | - $registry->savefile($myts->stripSlashesGPC($_POST['text1']), REFERENCES_TEXTFILE1); |
|
489 | - references_utils::updateCache(); |
|
490 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=texts', 2); |
|
491 | - break; |
|
492 | - |
|
493 | - // **************************************************************************************************************** |
|
494 | - case 'maintain': // Maintenance des tables |
|
495 | - // **************************************************************************************************************** |
|
496 | - xoops_cp_header(); |
|
497 | - // references_adminMenu(); |
|
498 | - references_utils::maintainTablesCache(); |
|
499 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl, 2); |
|
500 | - break; |
|
501 | - |
|
502 | - // **************************************************************************************************************** |
|
503 | - case 'categories': // Gestion des cat???gories |
|
504 | - // **************************************************************************************************************** |
|
505 | - xoops_cp_header(); |
|
506 | - // references_adminMenu(1); |
|
507 | - $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
508 | - $objet = 'categories'; |
|
509 | - $items = array(); |
|
510 | - $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='" . _AM_REFERENCES_ADD_ITEM . "' /></form>"; |
|
511 | - echo $form; |
|
512 | - references_utils::htitle(_MI_REFERENCES_ADMENU2, 4); |
|
513 | - |
|
514 | - $itemsCount = $h_references_categories->getCount(); |
|
515 | - if ($itemsCount > $limit) { |
|
516 | - $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start'); |
|
517 | - } |
|
518 | - |
|
519 | - $items = $h_references_categories->getCategories($start, $limit); |
|
520 | - if (isset($pagenav) && is_object($pagenav)) { |
|
521 | - echo "<div align='right'>" . $pagenav->renderNav() . '</div>'; |
|
522 | - } |
|
523 | - echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
|
524 | - |
|
525 | - echo "<tr><th align='center'>" . _AM_REFERENCES_ID . "</th><th align='center'>" . _AM_REFERENCES_TITLE . "</th><th align='center'>" . _AM_REFERENCES_CATEGORY_WEIGHT . "</th><th align='center'>" . _AM_REFERENCES_ACTION . '</th></tr>'; |
|
526 | - |
|
527 | - $class = ''; |
|
528 | - foreach ($items as $item) { |
|
529 | - $class = ($class === 'even') ? 'odd' : 'even'; |
|
530 | - $id = $item->getVar('category_id'); |
|
531 | - $action_edit = "<a href='$baseurl?op=edit" . $objet . '&id=' . $id . "' title='" . _EDIT . "'>" . $icones['edit'] . '</a>'; |
|
532 | - $action_delete = "<a href='$baseurl?op=delete" . $objet . '&id=' . $id . "' title='" . _DELETE . "'" . $conf_msg . '>' . $icones['delete'] . '</a>'; |
|
533 | - |
|
534 | - echo "<tr class='" . $class . "'>\n"; |
|
535 | - echo "<td align='center'>" . $id . '</td>'; |
|
536 | - echo "<td align='left'><a target='_blank' href='" . $item->getUrl() . "'>" . $item->getVar('category_title') . '</a></td>'; |
|
537 | - echo "<td align='right'>" . $item->getVar('category_weight') . '</td>'; |
|
538 | - echo "<td align='center'>" . $action_edit . ' ' . $action_delete . "</td>\n"; |
|
539 | - echo "<tr>\n"; |
|
540 | - } |
|
541 | - $class = ($class === 'even') ? 'odd' : 'even'; |
|
542 | - echo "<tr class='" . $class . "'>\n"; |
|
543 | - echo "<td colspan='4' align='center'>" . $form . "</td>\n"; |
|
544 | - echo "</tr>\n"; |
|
545 | - echo "</table>\n"; |
|
546 | - if (isset($pagenav) && is_object($pagenav)) { |
|
547 | - echo "<div align='center'>" . $pagenav->renderNav() . '</div>'; |
|
548 | - } |
|
549 | - echo "<br><br>\n"; |
|
550 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
551 | - break; |
|
552 | - |
|
553 | - // **************************************************************************************************************** |
|
554 | - case 'addcategories': // Ajout d'une cat???gorie |
|
555 | - case 'editcategories': // Edition d'une categories |
|
556 | - // **************************************************************************************************************** |
|
557 | - xoops_cp_header(); |
|
558 | - // references_adminMenu(1); |
|
559 | - $object = 'categories'; |
|
560 | - if ($op == 'edit' . $object) { |
|
561 | - $title = _AM_REFERENCES_EDIT_CATEGORY; |
|
562 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
563 | - if (empty($id)) { |
|
564 | - references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
565 | - } |
|
566 | - // Item exits ? |
|
567 | - $item = null; |
|
568 | - $item = $h_references_categories->get($id); |
|
569 | - if (!is_object($item)) { |
|
570 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
571 | - } |
|
572 | - $edit = true; |
|
573 | - $label_submit = _AM_REFERENCES_MODIFY; |
|
574 | - } else { |
|
575 | - $title = _AM_REFERENCES_ADD_CATEGORY; |
|
576 | - $item = $h_references_categories->create(true); |
|
577 | - $label_submit = _AM_REFERENCES_ADD; |
|
578 | - $edit = false; |
|
579 | - } |
|
580 | - $sform = new XoopsThemeForm($title, 'frmadd' . $object, $baseurl); |
|
581 | - $sform->addElement(new XoopsFormHidden('op', 'saveedit' . $object)); |
|
582 | - $sform->addElement(new XoopsFormHidden('category_id', $item->getVar('category_id'))); |
|
583 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_TITLE, 'category_title', 50, 255, $item->getVar('category_title', 'e')), true); |
|
584 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_CATEGORY_WEIGHT, 'category_weight', 10, 10, $item->getVar('category_weight', 'e')), true); |
|
585 | - $editor = references_utils::getWysiwygForm(_AM_REFERENCES_DESCRIPTION, 'category_description', $item->getVar('category_description', 'e'), 15, 60, 'category_description_hidden'); |
|
586 | - if ($editor) { |
|
587 | - $sform->addElement($editor, false); |
|
588 | - } |
|
589 | - |
|
590 | - // Permissions |
|
591 | - $membersHandler = xoops_getHandler('member'); |
|
592 | - $allGroupsList = $membersHandler->getGroupList(); |
|
593 | - $permHandler = xoops_getHandler('groupperm'); |
|
594 | - $allGroupsIds = array_keys($allGroupsList); |
|
595 | - |
|
596 | - $groupsIds = array(); |
|
597 | - if ($edit) { |
|
598 | - $groupsIds = $permHandler->getGroupIds(REFERENCES_PERM_READ, $item->getVar('category_id'), $xoopsModule->getVar('mid')); |
|
599 | - $groupsIds = array_values($groupsIds); |
|
600 | - $groupsThatCanViewCheckbox = new XoopsFormCheckBox(_AM_REFERENCES_VIEWFORM, 'groups_references_can_view[]', $groupsIds); |
|
601 | - } else { |
|
602 | - $groupsThatCanViewCheckbox = new XoopsFormCheckBox(_AM_REFERENCES_VIEWFORM, 'groups_references_can_view[]', $allGroupsIds); |
|
603 | - } |
|
604 | - $groupsThatCanViewCheckbox->addOptionArray($allGroupsList); |
|
605 | - $sform->addElement($groupsThatCanViewCheckbox); |
|
606 | - // ***** |
|
607 | - |
|
608 | - $button_tray = new XoopsFormElementTray('', ''); |
|
609 | - $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit'); |
|
610 | - $button_tray->addElement($submit_btn); |
|
611 | - $sform->addElement($button_tray); |
|
612 | - $sform = references_utils::formMarkRequiredFields($sform); |
|
613 | - $sform->display(); |
|
614 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
615 | - break; |
|
616 | - |
|
617 | - // **************************************************************************************************************** |
|
618 | - case 'saveeditcategories': // Sauvegarde d'une cat???gorie |
|
619 | - // **************************************************************************************************************** |
|
620 | - xoops_cp_header(); |
|
621 | - $id = isset($_POST['category_id']) ? (int)$_POST['category_id'] : 0; |
|
622 | - $opRedirect = 'categories'; |
|
623 | - if (!empty($id)) { |
|
624 | - $edit = true; |
|
625 | - $item = $h_references_categories->get($id); |
|
626 | - if (!is_object($item)) { |
|
627 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
628 | - } |
|
629 | - $item->unsetNew(); |
|
630 | - } else { |
|
631 | - $edit = false; |
|
632 | - $item = $h_references_categories->create(true); |
|
633 | - } |
|
634 | - |
|
635 | - $item->setVars($_POST); |
|
636 | - |
|
637 | - $res = $h_references_categories->insert($item); |
|
638 | - if ($res) { |
|
639 | - // Permissions |
|
640 | - // Suppression des permissions actuelles |
|
641 | - $gperm_handler = xoops_getHandler('groupperm'); |
|
642 | - $criteria = new CriteriaCompo(); |
|
643 | - $criteria->add(new Criteria('gperm_itemid', $item->category_id, '=')); |
|
644 | - $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'), '=')); |
|
645 | - $criteria->add(new Criteria('gperm_name', REFERENCES_PERM_READ, '=')); |
|
646 | - $gperm_handler->deleteAll($criteria); |
|
647 | - // Sauvegarde des nouvelles permissions, si elles existente |
|
648 | - if (isset($_POST['groups_references_can_view'])) { |
|
649 | - foreach ($_POST['groups_references_can_view'] as $groupId) { |
|
650 | - $gperm_handler->addRight(REFERENCES_PERM_READ, $item->category_id, $groupId, $xoopsModule->getVar('mid')); |
|
651 | - } |
|
652 | - } |
|
653 | - // **** |
|
654 | - if (!$edit) { |
|
655 | - $h_references_categories->notifyNewCategory($item); |
|
656 | - } |
|
657 | - references_utils::updateCache(); |
|
658 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
659 | - } else { |
|
660 | - references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); |
|
661 | - } |
|
662 | - break; |
|
663 | - |
|
664 | - // **************************************************************************************************************** |
|
665 | - case 'deletecategories': // Suppression d'une cat???gorie |
|
666 | - // **************************************************************************************************************** |
|
667 | - xoops_cp_header(); |
|
668 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
669 | - if (empty($id)) { |
|
670 | - references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
671 | - } |
|
672 | - $opRedirect = 'categories'; |
|
673 | - $item = null; |
|
674 | - $item = $h_references_categories->get($id); |
|
675 | - if (is_object($item)) { |
|
676 | - $res = $h_references_categories->delete($item, true); |
|
677 | - if ($res) { |
|
678 | - references_utils::updateCache(); |
|
679 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
680 | - } |
|
681 | - } |
|
682 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
683 | - break; |
|
684 | - |
|
685 | - // **************************************************************************************************************** |
|
686 | - case 'autocomplete': // Ajax, autocompl???tion |
|
687 | - // **************************************************************************************************************** |
|
688 | - if (!isset($xoopsUser) || !is_object($xoopsUser)) { |
|
689 | - exit; |
|
690 | - } |
|
691 | - if (!references_utils::isAdmin()) { |
|
692 | - exit; |
|
693 | - } |
|
694 | - error_reporting(0); |
|
695 | - @$xoopsLogger->activated = false; |
|
696 | - $handler = isset($_REQUEST['handler']) ? $_REQUEST['handler'] : ''; |
|
697 | - if ($handler != '') { |
|
698 | - switch ($handler) { |
|
699 | - case 'references_articles': |
|
700 | - $referencesFilter = new references_listFilter($h_references_articles, 'op', 'articles', 'start', $limit, $baseurl, 'article_title', 'ASC', true, REFERENCES_JS_URL); |
|
701 | - $referencesFilter->initFilter('article_title', array('dataType' => references_listFilter::FILTER_DATA_TEXT, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 35, 'maxLength' => 255, 'autoComplete' => true)); |
|
702 | - echo utf8_encode($referencesFilter->autoComplete($_REQUEST['q'], $_REQUEST['limit'], $_REQUEST['field'])); |
|
703 | - break; |
|
704 | - } |
|
705 | - } |
|
706 | - exit; |
|
707 | - break; |
|
79 | + // **************************************************************************************************************** |
|
80 | + case 'default': // Gestion des articles |
|
81 | + case 'articles': |
|
82 | + // **************************************************************************************************************** |
|
83 | + xoops_cp_header(); |
|
84 | + // references_adminMenu(0); |
|
85 | + $objet = 'articles'; |
|
86 | + $items = array(); |
|
87 | + if (isset($_GET['move'])) { |
|
88 | + $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
89 | + $ordre = isset($_GET['ordre']) ? (int)$_GET['ordre'] : 0; |
|
90 | + if ($_GET['move'] === 'up' && $id > 0) { |
|
91 | + $handlers->h_references_articles->moveUp($id, $ordre); |
|
92 | + } |
|
93 | + if ($_GET['move'] === 'down' && $id > 0) { |
|
94 | + $handlers->h_references_articles->moveDown($id, $ordre); |
|
95 | + } |
|
96 | + } |
|
97 | + $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='" . _AM_REFERENCES_ADD_ITEM . "' /></form>"; |
|
98 | + echo $form; |
|
99 | + $categoriesList = $h_references_categories->getListArray(); |
|
100 | + $upText = _AM_REFERENCES_UP; |
|
101 | + $downText = _AM_REFERENCES_DOWN; |
|
102 | + $upImg = "<a href='$baseurl?op=articles&move=up&id=%d&ordre=%d' title=\"$upText\"><img src='" . REFERENCES_IMAGES_URL . "up.png' alt=\"$upText\" /></a>"; |
|
103 | + $downImg = "<a href='$baseurl?op=articles&move=down&id=%d&ordre=%d' title=\"$downText\"><img src='" . REFERENCES_IMAGES_URL . "down.png' alt=\"$downText\" /></a>"; |
|
104 | + |
|
105 | + $referencesFilter = new references_listFilter($h_references_articles, 'op', 'articles', 'start', $limit, $baseurl, $defaultSortField, $defaultSortOrder, true, REFERENCES_JS_URL); |
|
106 | + $referencesFilter->initFilter('article_id', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 5, 'maxLength' => 10)); |
|
107 | + $referencesFilter->initFilter('article_title', array('dataType' => references_listFilter::FILTER_DATA_TEXT, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 35, 'maxLength' => 255, 'autoComplete' => true)); |
|
108 | + $referencesFilter->initFilter('article_weight', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 5, 'maxLength' => 10)); |
|
109 | + |
|
110 | + $referencesFilter->initFilter('article_category_id', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_SELECT, 'values' => $categoriesList, 'withNull' => true, 'style' => 'width: 170px; max-width: 170px;')); |
|
111 | + $referencesFilter->initFilter('article_online', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_SELECT, 'values' => array(2 => _YES, 1 => _NO), 'withNull' => true, 'minusOne' => true)); |
|
112 | + $sortFields = array('article_id' => _AM_REFERENCES_ID, 'article_title' => _AM_REFERENCES_TITLE, 'article_weight' => _AM_REFERENCES_WEIGHT, 'article_category_id' => _AM_REFERENCES_CATEGORY, 'article_online' => _AM_REFERENCES_ONLINE); |
|
113 | + $referencesFilter->setSortFields($sortFields); |
|
114 | + |
|
115 | + $referencesFilter->filter(); |
|
116 | + $itemsCount = $referencesFilter->getCount(); |
|
117 | + references_utils::htitle(_MI_REFERENCES_ADMENU0 . ' (' . $itemsCount . ')', 4); |
|
118 | + |
|
119 | + if ($itemsCount > $limit) { |
|
120 | + $pagenav = $referencesFilter->getPager(); |
|
121 | + } |
|
122 | + |
|
123 | + $items = $referencesFilter->getObjects(); |
|
124 | + $visibleCountItems = count($items); |
|
125 | + $counter = 0; |
|
126 | + $categories = $h_references_categories->getListArray(); |
|
127 | + echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
|
128 | + echo "<tr>\n"; |
|
129 | + echo "<form method='post' action='$baseurl'>\n"; |
|
130 | + echo "<td colspan='4' align='right'>" . $referencesFilter->getSortPlaceHolderHtmlCode(); |
|
131 | + echo $referencesFilter->getClearFilterbutton(); |
|
132 | + echo "</td>\n"; |
|
133 | + echo "<td colspan='2' align='right'>"; |
|
134 | + if (isset($pagenav) && is_object($pagenav)) { |
|
135 | + echo $pagenav->renderNav(); |
|
136 | + } |
|
137 | + echo "</td>\n</tr>\n"; |
|
138 | + |
|
139 | + echo "<th align='center'>" . _AM_REFERENCES_ID . "</th><th align='center'>" . _AM_REFERENCES_TITLE . "</th><th align='center'>" . _AM_REFERENCES_WEIGHT . "</th><th align='center'>" . _AM_REFERENCES_CATEGORY . "</th><th align='center'>" . _AM_REFERENCES_ONLINE . "</th><th align='center'>" |
|
140 | + . _AM_REFERENCES_MANUAL_DATE . "</th><th align='center'>" . _AM_REFERENCES_ACTION . '</th></tr>'; |
|
141 | + // Filtres **************************************** |
|
142 | + echo "<tr>\n"; |
|
143 | + echo "<th align='center'>" . $referencesFilter->getFilterField('article_id') . "</th>\n"; |
|
144 | + echo "<th align='center'>" . $referencesFilter->getFilterField('article_title') . "</th>\n"; |
|
145 | + echo "<th align='center'>" . $referencesFilter->getFilterField('article_weight') . "</th>\n"; |
|
146 | + echo "<th align='center'>" . $referencesFilter->getFilterField('article_category_id') . "</th>\n"; |
|
147 | + echo "<th align='center'>" . $referencesFilter->getFilterField('article_online') . "</th>\n"; |
|
148 | + echo "<th align='center'> </th>\n"; |
|
149 | + echo "<th align='center'>" . $referencesFilter->getGoButton() . "</th></form></tr>\n"; |
|
150 | + // ************************************************ |
|
151 | + $class = ''; |
|
152 | + foreach ($items as $item) { |
|
153 | + ++$counter; |
|
154 | + $class = ($class === 'even') ? 'odd' : 'even'; |
|
155 | + $id = $item->getVar('article_id'); |
|
156 | + $action_edit = "<a href='$baseurl?op=edit" . $objet . '&id=' . $id . "' title='" . _EDIT . "'>" . $icones['edit'] . '</a>'; |
|
157 | + $action_delete = "<a href='$baseurl?op=delete" . $objet . '&id=' . $id . "' title='" . _DELETE . "'" . $conf_msg . '>' . $icones['delete'] . '</a>'; |
|
158 | + $category = isset($categories[$item->getVar('article_category_id')]) ? $categories[$item->getVar('article_category_id')] : ''; |
|
159 | + $up = $down = ''; |
|
160 | + echo "<tr class='" . $class . "'>\n"; |
|
161 | + $ordre = $item->getVar('article_weight'); |
|
162 | + if ($counter == 1 && $visibleCountItems > 1) { // Premier ???l???ment |
|
163 | + $down = sprintf($downImg, $id, $ordre); |
|
164 | + } |
|
165 | + if ($counter == $visibleCountItems && $visibleCountItems > 1) { // Dernier ???l???ment |
|
166 | + $up = sprintf($upImg, $id, $ordre); |
|
167 | + } |
|
168 | + if ($counter > 1 & $counter < $visibleCountItems && $visibleCountItems > 1) { // Element dans le milieu |
|
169 | + $up = sprintf($upImg, $id, $ordre); |
|
170 | + $down = sprintf($downImg, $id, $ordre); |
|
171 | + } |
|
172 | + |
|
173 | + echo "<td align='center'>" . $id . '</td>'; |
|
174 | + echo "<td align='left'><a target='_blank' href='" . $item->getUrl() . "'>" . $item->getVar('article_title') . '</a></td>'; |
|
175 | + echo "<td align='center'>" . $item->getVar('article_weight') . " $up $down</td>"; |
|
176 | + echo "<td align='center'>" . $category . '</td>'; |
|
177 | + if ($item->isArticleOnline()) { |
|
178 | + $statusLink = "<a href='$baseurl?op=offline&id=$id' title='" . _AM_REFERENCES_GO_OFFLINE . "'><img src='" . REFERENCES_IMAGES_URL . "status_online.png' alt='" . _AM_REFERENCES_GO_OFFLINE . "' /></a>"; |
|
179 | + } else { |
|
180 | + $statusLink = "<a href='$baseurl?op=online&id=$id' title='" . _AM_REFERENCES_GO_ONLINE . "'><img src='" . REFERENCES_IMAGES_URL . "status_offline.png' alt='" . _AM_REFERENCES_GO_ONLINE . "' /></a>"; |
|
181 | + } |
|
182 | + echo "<td align='center'>" . $statusLink . '</td>'; |
|
183 | + echo "<td align='center'>" . $item->getVar('article_date') . '</td>'; |
|
184 | + echo "<td align='center'>" . $action_edit . ' ' . $action_delete . "</td>\n"; |
|
185 | + echo "<tr>\n"; |
|
186 | + } |
|
187 | + $class = ($class === 'even') ? 'odd' : 'even'; |
|
188 | + echo "<tr class='" . $class . "'>\n"; |
|
189 | + echo "<td colspan='7' align='center'>" . $form . "</td>\n"; |
|
190 | + echo "</tr>\n"; |
|
191 | + echo "</table>\n"; |
|
192 | + echo $referencesFilter->getJavascriptInitCode(); |
|
193 | + if (isset($pagenav) && is_object($pagenav)) { |
|
194 | + echo "<div align='center'>" . $pagenav->renderNav() . '</div>'; |
|
195 | + } |
|
196 | + echo "<br><br>\n"; |
|
197 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
198 | + break; |
|
199 | + |
|
200 | + // **************************************************************************************************************** |
|
201 | + case 'addarticles': // Ajout d'un article |
|
202 | + case 'editarticles': // Edition d'un article |
|
203 | + // **************************************************************************************************************** |
|
204 | + xoops_cp_header(); |
|
205 | + // references_adminMenu(0); |
|
206 | + $object = 'articles'; |
|
207 | + if ($op == 'edit' . $object) { |
|
208 | + $title = _AM_REFERENCES_EDIT_ARTICLE; |
|
209 | + $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
210 | + if (empty($id)) { |
|
211 | + references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
212 | + } |
|
213 | + // Item exits ? |
|
214 | + $item = null; |
|
215 | + $item = $h_references_articles->get($id); |
|
216 | + if (!is_object($item)) { |
|
217 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
218 | + } |
|
219 | + $edit = true; |
|
220 | + $label_submit = _AM_REFERENCES_MODIFY; |
|
221 | + } else { |
|
222 | + $title = _AM_REFERENCES_ADD_ARTICLE; |
|
223 | + $item = $h_references_articles->create(true); |
|
224 | + $item->setVar('article_online', true); |
|
225 | + if (REFERENCES_AUTO_FILL_MANUAL_DATE) { |
|
226 | + $item->setVar('article_date', formatTimestamp(time(), 's')); |
|
227 | + } |
|
228 | + $label_submit = _AM_REFERENCES_ADD; |
|
229 | + $edit = false; |
|
230 | + } |
|
231 | + $sform = new XoopsThemeForm($title, 'frmadd' . $object, $baseurl); |
|
232 | + $sform->setExtra('enctype="multipart/form-data"'); |
|
233 | + $sform->addElement(new XoopsFormHidden('op', 'saveedit' . $object)); |
|
234 | + $sform->addElement(new XoopsFormHidden('article_id', $item->getVar('article_id'))); |
|
235 | + $categories = $h_references_categories->getListArray(); |
|
236 | + $categoriesList = new XoopsFormSelect(_AM_REFERENCES_CATEGORY, 'article_category_id', $item->getVar('article_category_id', 'e')); |
|
237 | + $categoriesList->addOptionArray($categories); |
|
238 | + $sform->addElement($categoriesList, true); |
|
239 | + |
|
240 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_TITLE, 'article_title', 50, 255, $item->getVar('article_title', 'e')), true); |
|
241 | + $sform->addElement(new XoopsFormRadioYN(_AM_REFERENCES_ONLINE, 'article_online', $item->getVar('article_online', 'e')), true); |
|
242 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_MANUAL_DATE, 'article_date', 30, 30, $item->getVar('article_date', 'e')), false); |
|
243 | + $sform->addElement(new XoopsFormTextDateSelect(_AM_REFERENCES_DATE, 'article_timestamp', 15, $item->getVar('article_timestamp', 'e'))); |
|
244 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_WEIGHT, 'article_weight', 5, 5, $item->getVar('article_weight', 'e')), false); |
|
245 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_URL, 'article_externalurl', 50, 255, $item->getVar('article_externalurl', 'e')), false); |
|
246 | + |
|
247 | + $editor = references_utils::getWysiwygForm(_AM_REFERENCES_TEXT, 'article_text', $item->getVar('article_text', 'e'), 15, 60, 'article_text_hidden'); |
|
248 | + if ($editor) { |
|
249 | + $sform->addElement($editor, false); |
|
250 | + } |
|
251 | + |
|
252 | + $editor1 = references_utils::getWysiwygForm(_AM_REFERENCES_TEXT_MORE, 'article_readmore', $item->getVar('article_readmore', 'e'), 15, 60, 'article_readmore_hidden'); |
|
253 | + if ($editor1) { |
|
254 | + $sform->addElement($editor1, false); |
|
255 | + } |
|
256 | + |
|
257 | + if (references_utils::getModuleOption('use_tags') && references_utils::tagModuleExists()) { |
|
258 | + require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
259 | + $sform->addElement(new XoopsFormTag('item_tag', 60, 255, $item->getVar('article_id'), 0)); |
|
260 | + } |
|
261 | + // Images |
|
262 | + for ($i = 1; $i <= 10; ++$i) { |
|
263 | + if ($op == 'edit' . $object && $item->pictureExists($i)) { |
|
264 | + $pictureTray = new XoopsFormElementTray(_AM_REFERENCES_CURRENT_PICTURE . ' ' . $i, '<br>'); |
|
265 | + $pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl($i) . "' alt='' border='0' />")); |
|
266 | + $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture' . $i); |
|
267 | + $deleteCheckbox->addOption(1, _DELETE); |
|
268 | + $pictureTray->addElement($deleteCheckbox); |
|
269 | + $sform->addElement($pictureTray); |
|
270 | + unset($pictureTray, $deleteCheckbox); |
|
271 | + } |
|
272 | + $sform->addElement(new XoopsFormFile(_AM_REFERENCES_IMAGE . ' ' . $i, 'attachedfile' . $i, references_utils::getModuleOption('maxuploadsize')), false); |
|
273 | + $fieldName = 'article_picture' . $i . '_text'; |
|
274 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_PICTURE_TEXT . ' ' . $i, $fieldName, 50, 255, $item->getVar($fieldName)), false); |
|
275 | + } |
|
276 | + |
|
277 | + // Fichier attach??? |
|
278 | + if ($op == 'edit' . $object && $item->attachmentExists()) { |
|
279 | + $attachedTray = new XoopsFormElementTray(_AM_REFERENCES_ATTACHED_FILE, '<br>'); |
|
280 | + $attachedTray->addElement(new XoopsFormLabel('', "<a href='" . $item->getAttachmentUrl() . "' target='_blank'>" . $item->getVar('article_attached_file') . '</a>')); |
|
281 | + $deleteCheckbox = new XoopsFormCheckBox('', 'delattach'); |
|
282 | + $deleteCheckbox->addOption(1, _DELETE); |
|
283 | + $attachedTray->addElement($deleteCheckbox); |
|
284 | + $sform->addElement($attachedTray); |
|
285 | + unset($attachedTray, $deleteCheckbox); |
|
286 | + } |
|
287 | + $sform->addElement(new XoopsFormFile(_AM_REFERENCES_ATTACHED_FILE, 'article_attached_file', references_utils::getModuleOption('maxuploadsize')), false); |
|
288 | + |
|
289 | + $button_tray = new XoopsFormElementTray('', ''); |
|
290 | + $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit'); |
|
291 | + $button_tray->addElement($submit_btn); |
|
292 | + $sform->addElement($button_tray); |
|
293 | + $sform = references_utils::formMarkRequiredFields($sform); |
|
294 | + $sform->display(); |
|
295 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
296 | + break; |
|
297 | + |
|
298 | + // **************************************************************************************************************** |
|
299 | + case 'saveeditarticles': // Sauvegarde d'un article |
|
300 | + // **************************************************************************************************************** |
|
301 | + xoops_cp_header(); |
|
302 | + $id = isset($_POST['article_id']) ? (int)$_POST['article_id'] : 0; |
|
303 | + $opRedirect = 'articles'; |
|
304 | + if (!empty($id)) { |
|
305 | + $edit = true; |
|
306 | + $item = $h_references_articles->get($id); |
|
307 | + if (!is_object($item)) { |
|
308 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
309 | + } |
|
310 | + $item->unsetNew(); |
|
311 | + } else { |
|
312 | + $edit = false; |
|
313 | + $item = $h_references_articles->create(true); |
|
314 | + } |
|
315 | + |
|
316 | + $item->setVars($_POST); |
|
317 | + |
|
318 | + // Images |
|
319 | + for ($i = 1; $i <= 10; ++$i) { |
|
320 | + if (isset($_POST['delpicture' . $i]) && (int)$_POST['delpicture' . $i] == 1) { |
|
321 | + $item->deletePicture($i); |
|
322 | + $item->setVar('article_picture' . $i, ''); |
|
323 | + } |
|
324 | + |
|
325 | + // Upload de l'image et cr???ation de la vignette |
|
326 | + $destname = ''; |
|
327 | + $return = references_utils::uploadFile($i - 1, references_utils::getModuleOption('images_path')); |
|
328 | + if ($return === true) { |
|
329 | + if (references_utils::getModuleOption('images_width') > 0 && references_utils::getModuleOption('images_height') > 0) { |
|
330 | + references_utils::createThumb(references_utils::getModuleOption('images_path') . '/' . basename($destname), references_utils::getModuleOption('images_path') . '/' . basename($destname), references_utils::getModuleOption('images_width'), |
|
331 | + references_utils::getModuleOption('images_height'), true); |
|
332 | + } |
|
333 | + $newDestName = references_utils::getModuleOption('images_path') . DIRECTORY_SEPARATOR . REFERENCES_THUMBS_PREFIX . basename($destname); |
|
334 | + $retval = references_utils::resizePicture(references_utils::getModuleOption('images_path') . '/' . basename($destname), $newDestName, $thumbs_width, $thumbs_height, true); |
|
335 | + if ($retval == 1 || $retval == 3) { |
|
336 | + $item->setVar('article_picture' . $i, $destname); |
|
337 | + } |
|
338 | + } else { |
|
339 | + if ($return !== false) { |
|
340 | + echo $return; |
|
341 | + } |
|
342 | + } |
|
343 | + } |
|
344 | + |
|
345 | + $timestamp = mktime(0, 0, 0, (int)substr($_POST['article_timestamp'], 5, 2), (int)substr($_POST['article_timestamp'], 8, 2), (int)substr($_POST['article_timestamp'], 0, 4)); |
|
346 | + $item->setVar('article_timestamp', $timestamp); |
|
347 | + |
|
348 | + if (!$edit) { |
|
349 | + $item->setVar('article_author', references_utils::getCurrentUserID()); |
|
350 | + } |
|
351 | + |
|
352 | + // Suppression ???ventuelle du fichier attach??? |
|
353 | + if (isset($_POST['delattach']) && (int)$_POST['delattach'] == 1) { |
|
354 | + $item->deleteAttachment(); |
|
355 | + } |
|
356 | + |
|
357 | + $destname = ''; |
|
358 | + // Upload de la pi???ce jointe |
|
359 | + $return = references_utils::uploadFile(10, references_utils::getModuleOption('attached_path')); |
|
360 | + if ($return === true) { |
|
361 | + $item->setVar('article_attached_file', $destname); |
|
362 | + } else { |
|
363 | + if ($return !== false) { |
|
364 | + echo $return; |
|
365 | + } |
|
366 | + } |
|
367 | + |
|
368 | + $res = $h_references_articles->insert($item); |
|
369 | + if ($res) { |
|
370 | + if (references_utils::getModuleOption('use_tags') && references_utils::tagModuleExists()) { |
|
371 | + $tag_handler = xoops_getModuleHandler('tag', 'tag'); |
|
372 | + $tag_handler->updateByItem($_POST['item_tag'], $item->getVar('article_id'), $xoopsModule->getVar('dirname'), 0); |
|
373 | + } |
|
374 | + if (!$edit) { |
|
375 | + $h_references_articles->notifyNewArticle($item); |
|
376 | + } |
|
377 | + references_utils::updateCache(); |
|
378 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
379 | + } else { |
|
380 | + references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); |
|
381 | + } |
|
382 | + break; |
|
383 | + |
|
384 | + // **************************************************************************************************************** |
|
385 | + case 'offline': // Mise hors ligne d'un article |
|
386 | + case 'online': // Mise en ligne d'un article |
|
387 | + // **************************************************************************************************************** |
|
388 | + xoops_cp_header(); |
|
389 | + $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
390 | + if (empty($id)) { |
|
391 | + references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
392 | + } |
|
393 | + $opRedirect = 'articles'; |
|
394 | + $item = null; |
|
395 | + $item = $h_references_articles->get($id); |
|
396 | + if (is_object($item)) { |
|
397 | + if ($op === 'offline') { |
|
398 | + $res = $h_references_articles->offlineArticle($item); |
|
399 | + } else { |
|
400 | + $res = $h_references_articles->onlineArticle($item); |
|
401 | + } |
|
402 | + if ($res) { |
|
403 | + references_utils::updateCache(); |
|
404 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
405 | + } |
|
406 | + } |
|
407 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
408 | + break; |
|
409 | + |
|
410 | + // **************************************************************************************************************** |
|
411 | + case 'deletearticles': // Suppression d'un article |
|
412 | + // **************************************************************************************************************** |
|
413 | + xoops_cp_header(); |
|
414 | + $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
415 | + if (empty($id)) { |
|
416 | + references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
417 | + } |
|
418 | + $opRedirect = 'articles'; |
|
419 | + $item = null; |
|
420 | + $item = $h_references_articles->get($id); |
|
421 | + if (is_object($item)) { |
|
422 | + $res = $h_references_articles->deleteArticle($item, true); |
|
423 | + if ($res) { |
|
424 | + references_utils::updateCache(); |
|
425 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
426 | + } |
|
427 | + } |
|
428 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
429 | + break; |
|
430 | + |
|
431 | + // **************************************************************************************************************** |
|
432 | + case 'instant-zero'; // Publicit??? |
|
433 | + // **************************************************************************************************************** |
|
434 | + xoops_cp_header(); |
|
435 | + // references_adminMenu(4); |
|
436 | + echo "<iframe src='http://www.instant-zero.com/modules/liaise/?form_id=2' width='100%' height='600' frameborder='0'></iframe>"; |
|
437 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
438 | + break; |
|
439 | + |
|
440 | + // **************************************************************************************************************** |
|
441 | + case 'perms'; // Permissions |
|
442 | + // **************************************************************************************************************** |
|
443 | + xoops_cp_header(); |
|
444 | + // references_adminMenu(3); |
|
445 | + require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
446 | + $categories = $handlers->h_references_categories->getCategories(); |
|
447 | + $permissionsForm = new XoopsGroupPermForm(_AM_REFERENCES_VIEWFORM, $xoopsModule->getVar('mid'), REFERENCES_PERM_READ, _AM_REFERENCES_VIEWFORM_DESC, 'admin/index.php?op=perms', 'true'); |
|
448 | + foreach ($categories as $category) { |
|
449 | + $permissionsForm->addItem($category->category_id, $category->category_title, 0); |
|
450 | + } |
|
451 | + echo $permissionsForm->render(); |
|
452 | + echo "<br><br><br><br>\n"; |
|
453 | + unset($permissionsForm); |
|
454 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
455 | + break; |
|
456 | + |
|
457 | + // **************************************************************************************************************** |
|
458 | + case 'texts': // Gestion des textes |
|
459 | + // **************************************************************************************************************** |
|
460 | + xoops_cp_header(); |
|
461 | + // references_adminMenu(2); |
|
462 | + require_once REFERENCES_PATH . 'class/registryfile.php'; |
|
463 | + $registry = new references_registryfile(); |
|
464 | + |
|
465 | + $sform = new XoopsThemeForm(_MI_REFERENCES_ADMENU1, 'frmatxt', $baseurl); |
|
466 | + $sform->addElement(new XoopsFormHidden('op', 'savetexts')); |
|
467 | + // Texte ??? afficher sur la page d'index du module |
|
468 | + $editor1 = references_utils::getWysiwygForm(_AM_REFERENCES_TEXT1, 'text1', $registry->getfile(REFERENCES_TEXTFILE1), 5, 60, 'hometext1_hidden'); |
|
469 | + if ($editor1) { |
|
470 | + $sform->addElement($editor1, false); |
|
471 | + } |
|
472 | + $button_tray = new XoopsFormElementTray('', ''); |
|
473 | + $submit_btn = new XoopsFormButton('', 'post', _AM_REFERENCES_MODIFY, 'submit'); |
|
474 | + $button_tray->addElement($submit_btn); |
|
475 | + $sform->addElement($button_tray); |
|
476 | + $sform = references_utils::formMarkRequiredFields($sform); |
|
477 | + $sform->display(); |
|
478 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
479 | + break; |
|
480 | + |
|
481 | + // **************************************************************************************************************** |
|
482 | + case 'savetexts': // Sauvegarde des textes |
|
483 | + // **************************************************************************************************************** |
|
484 | + xoops_cp_header(); |
|
485 | + require_once REFERENCES_PATH . 'class/registryfile.php'; |
|
486 | + $registry = new references_registryfile(); |
|
487 | + $myts = MyTextSanitizer::getInstance(); |
|
488 | + $registry->savefile($myts->stripSlashesGPC($_POST['text1']), REFERENCES_TEXTFILE1); |
|
489 | + references_utils::updateCache(); |
|
490 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=texts', 2); |
|
491 | + break; |
|
492 | + |
|
493 | + // **************************************************************************************************************** |
|
494 | + case 'maintain': // Maintenance des tables |
|
495 | + // **************************************************************************************************************** |
|
496 | + xoops_cp_header(); |
|
497 | + // references_adminMenu(); |
|
498 | + references_utils::maintainTablesCache(); |
|
499 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl, 2); |
|
500 | + break; |
|
501 | + |
|
502 | + // **************************************************************************************************************** |
|
503 | + case 'categories': // Gestion des cat???gories |
|
504 | + // **************************************************************************************************************** |
|
505 | + xoops_cp_header(); |
|
506 | + // references_adminMenu(1); |
|
507 | + $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
508 | + $objet = 'categories'; |
|
509 | + $items = array(); |
|
510 | + $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='" . _AM_REFERENCES_ADD_ITEM . "' /></form>"; |
|
511 | + echo $form; |
|
512 | + references_utils::htitle(_MI_REFERENCES_ADMENU2, 4); |
|
513 | + |
|
514 | + $itemsCount = $h_references_categories->getCount(); |
|
515 | + if ($itemsCount > $limit) { |
|
516 | + $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start'); |
|
517 | + } |
|
518 | + |
|
519 | + $items = $h_references_categories->getCategories($start, $limit); |
|
520 | + if (isset($pagenav) && is_object($pagenav)) { |
|
521 | + echo "<div align='right'>" . $pagenav->renderNav() . '</div>'; |
|
522 | + } |
|
523 | + echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
|
524 | + |
|
525 | + echo "<tr><th align='center'>" . _AM_REFERENCES_ID . "</th><th align='center'>" . _AM_REFERENCES_TITLE . "</th><th align='center'>" . _AM_REFERENCES_CATEGORY_WEIGHT . "</th><th align='center'>" . _AM_REFERENCES_ACTION . '</th></tr>'; |
|
526 | + |
|
527 | + $class = ''; |
|
528 | + foreach ($items as $item) { |
|
529 | + $class = ($class === 'even') ? 'odd' : 'even'; |
|
530 | + $id = $item->getVar('category_id'); |
|
531 | + $action_edit = "<a href='$baseurl?op=edit" . $objet . '&id=' . $id . "' title='" . _EDIT . "'>" . $icones['edit'] . '</a>'; |
|
532 | + $action_delete = "<a href='$baseurl?op=delete" . $objet . '&id=' . $id . "' title='" . _DELETE . "'" . $conf_msg . '>' . $icones['delete'] . '</a>'; |
|
533 | + |
|
534 | + echo "<tr class='" . $class . "'>\n"; |
|
535 | + echo "<td align='center'>" . $id . '</td>'; |
|
536 | + echo "<td align='left'><a target='_blank' href='" . $item->getUrl() . "'>" . $item->getVar('category_title') . '</a></td>'; |
|
537 | + echo "<td align='right'>" . $item->getVar('category_weight') . '</td>'; |
|
538 | + echo "<td align='center'>" . $action_edit . ' ' . $action_delete . "</td>\n"; |
|
539 | + echo "<tr>\n"; |
|
540 | + } |
|
541 | + $class = ($class === 'even') ? 'odd' : 'even'; |
|
542 | + echo "<tr class='" . $class . "'>\n"; |
|
543 | + echo "<td colspan='4' align='center'>" . $form . "</td>\n"; |
|
544 | + echo "</tr>\n"; |
|
545 | + echo "</table>\n"; |
|
546 | + if (isset($pagenav) && is_object($pagenav)) { |
|
547 | + echo "<div align='center'>" . $pagenav->renderNav() . '</div>'; |
|
548 | + } |
|
549 | + echo "<br><br>\n"; |
|
550 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
551 | + break; |
|
552 | + |
|
553 | + // **************************************************************************************************************** |
|
554 | + case 'addcategories': // Ajout d'une cat???gorie |
|
555 | + case 'editcategories': // Edition d'une categories |
|
556 | + // **************************************************************************************************************** |
|
557 | + xoops_cp_header(); |
|
558 | + // references_adminMenu(1); |
|
559 | + $object = 'categories'; |
|
560 | + if ($op == 'edit' . $object) { |
|
561 | + $title = _AM_REFERENCES_EDIT_CATEGORY; |
|
562 | + $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
563 | + if (empty($id)) { |
|
564 | + references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
565 | + } |
|
566 | + // Item exits ? |
|
567 | + $item = null; |
|
568 | + $item = $h_references_categories->get($id); |
|
569 | + if (!is_object($item)) { |
|
570 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
571 | + } |
|
572 | + $edit = true; |
|
573 | + $label_submit = _AM_REFERENCES_MODIFY; |
|
574 | + } else { |
|
575 | + $title = _AM_REFERENCES_ADD_CATEGORY; |
|
576 | + $item = $h_references_categories->create(true); |
|
577 | + $label_submit = _AM_REFERENCES_ADD; |
|
578 | + $edit = false; |
|
579 | + } |
|
580 | + $sform = new XoopsThemeForm($title, 'frmadd' . $object, $baseurl); |
|
581 | + $sform->addElement(new XoopsFormHidden('op', 'saveedit' . $object)); |
|
582 | + $sform->addElement(new XoopsFormHidden('category_id', $item->getVar('category_id'))); |
|
583 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_TITLE, 'category_title', 50, 255, $item->getVar('category_title', 'e')), true); |
|
584 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_CATEGORY_WEIGHT, 'category_weight', 10, 10, $item->getVar('category_weight', 'e')), true); |
|
585 | + $editor = references_utils::getWysiwygForm(_AM_REFERENCES_DESCRIPTION, 'category_description', $item->getVar('category_description', 'e'), 15, 60, 'category_description_hidden'); |
|
586 | + if ($editor) { |
|
587 | + $sform->addElement($editor, false); |
|
588 | + } |
|
589 | + |
|
590 | + // Permissions |
|
591 | + $membersHandler = xoops_getHandler('member'); |
|
592 | + $allGroupsList = $membersHandler->getGroupList(); |
|
593 | + $permHandler = xoops_getHandler('groupperm'); |
|
594 | + $allGroupsIds = array_keys($allGroupsList); |
|
595 | + |
|
596 | + $groupsIds = array(); |
|
597 | + if ($edit) { |
|
598 | + $groupsIds = $permHandler->getGroupIds(REFERENCES_PERM_READ, $item->getVar('category_id'), $xoopsModule->getVar('mid')); |
|
599 | + $groupsIds = array_values($groupsIds); |
|
600 | + $groupsThatCanViewCheckbox = new XoopsFormCheckBox(_AM_REFERENCES_VIEWFORM, 'groups_references_can_view[]', $groupsIds); |
|
601 | + } else { |
|
602 | + $groupsThatCanViewCheckbox = new XoopsFormCheckBox(_AM_REFERENCES_VIEWFORM, 'groups_references_can_view[]', $allGroupsIds); |
|
603 | + } |
|
604 | + $groupsThatCanViewCheckbox->addOptionArray($allGroupsList); |
|
605 | + $sform->addElement($groupsThatCanViewCheckbox); |
|
606 | + // ***** |
|
607 | + |
|
608 | + $button_tray = new XoopsFormElementTray('', ''); |
|
609 | + $submit_btn = new XoopsFormButton('', 'post', $label_submit, 'submit'); |
|
610 | + $button_tray->addElement($submit_btn); |
|
611 | + $sform->addElement($button_tray); |
|
612 | + $sform = references_utils::formMarkRequiredFields($sform); |
|
613 | + $sform->display(); |
|
614 | + include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
615 | + break; |
|
616 | + |
|
617 | + // **************************************************************************************************************** |
|
618 | + case 'saveeditcategories': // Sauvegarde d'une cat???gorie |
|
619 | + // **************************************************************************************************************** |
|
620 | + xoops_cp_header(); |
|
621 | + $id = isset($_POST['category_id']) ? (int)$_POST['category_id'] : 0; |
|
622 | + $opRedirect = 'categories'; |
|
623 | + if (!empty($id)) { |
|
624 | + $edit = true; |
|
625 | + $item = $h_references_categories->get($id); |
|
626 | + if (!is_object($item)) { |
|
627 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl, 5); |
|
628 | + } |
|
629 | + $item->unsetNew(); |
|
630 | + } else { |
|
631 | + $edit = false; |
|
632 | + $item = $h_references_categories->create(true); |
|
633 | + } |
|
634 | + |
|
635 | + $item->setVars($_POST); |
|
636 | + |
|
637 | + $res = $h_references_categories->insert($item); |
|
638 | + if ($res) { |
|
639 | + // Permissions |
|
640 | + // Suppression des permissions actuelles |
|
641 | + $gperm_handler = xoops_getHandler('groupperm'); |
|
642 | + $criteria = new CriteriaCompo(); |
|
643 | + $criteria->add(new Criteria('gperm_itemid', $item->category_id, '=')); |
|
644 | + $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'), '=')); |
|
645 | + $criteria->add(new Criteria('gperm_name', REFERENCES_PERM_READ, '=')); |
|
646 | + $gperm_handler->deleteAll($criteria); |
|
647 | + // Sauvegarde des nouvelles permissions, si elles existente |
|
648 | + if (isset($_POST['groups_references_can_view'])) { |
|
649 | + foreach ($_POST['groups_references_can_view'] as $groupId) { |
|
650 | + $gperm_handler->addRight(REFERENCES_PERM_READ, $item->category_id, $groupId, $xoopsModule->getVar('mid')); |
|
651 | + } |
|
652 | + } |
|
653 | + // **** |
|
654 | + if (!$edit) { |
|
655 | + $h_references_categories->notifyNewCategory($item); |
|
656 | + } |
|
657 | + references_utils::updateCache(); |
|
658 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
659 | + } else { |
|
660 | + references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); |
|
661 | + } |
|
662 | + break; |
|
663 | + |
|
664 | + // **************************************************************************************************************** |
|
665 | + case 'deletecategories': // Suppression d'une cat???gorie |
|
666 | + // **************************************************************************************************************** |
|
667 | + xoops_cp_header(); |
|
668 | + $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
669 | + if (empty($id)) { |
|
670 | + references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
|
671 | + } |
|
672 | + $opRedirect = 'categories'; |
|
673 | + $item = null; |
|
674 | + $item = $h_references_categories->get($id); |
|
675 | + if (is_object($item)) { |
|
676 | + $res = $h_references_categories->delete($item, true); |
|
677 | + if ($res) { |
|
678 | + references_utils::updateCache(); |
|
679 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
680 | + } |
|
681 | + } |
|
682 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
683 | + break; |
|
684 | + |
|
685 | + // **************************************************************************************************************** |
|
686 | + case 'autocomplete': // Ajax, autocompl???tion |
|
687 | + // **************************************************************************************************************** |
|
688 | + if (!isset($xoopsUser) || !is_object($xoopsUser)) { |
|
689 | + exit; |
|
690 | + } |
|
691 | + if (!references_utils::isAdmin()) { |
|
692 | + exit; |
|
693 | + } |
|
694 | + error_reporting(0); |
|
695 | + @$xoopsLogger->activated = false; |
|
696 | + $handler = isset($_REQUEST['handler']) ? $_REQUEST['handler'] : ''; |
|
697 | + if ($handler != '') { |
|
698 | + switch ($handler) { |
|
699 | + case 'references_articles': |
|
700 | + $referencesFilter = new references_listFilter($h_references_articles, 'op', 'articles', 'start', $limit, $baseurl, 'article_title', 'ASC', true, REFERENCES_JS_URL); |
|
701 | + $referencesFilter->initFilter('article_title', array('dataType' => references_listFilter::FILTER_DATA_TEXT, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 35, 'maxLength' => 255, 'autoComplete' => true)); |
|
702 | + echo utf8_encode($referencesFilter->autoComplete($_REQUEST['q'], $_REQUEST['limit'], $_REQUEST['field'])); |
|
703 | + break; |
|
704 | + } |
|
705 | + } |
|
706 | + exit; |
|
707 | + break; |
|
708 | 708 | } |
709 | 709 | xoops_cp_footer(); |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | * **************************************************************************** |
20 | 20 | */ |
21 | 21 | |
22 | -include_once __DIR__ . '/admin_header.php'; |
|
23 | -require_once __DIR__ . '/../../../include/cp_header.php'; |
|
24 | -require_once __DIR__ . '/../include/common.php'; |
|
22 | +include_once __DIR__.'/admin_header.php'; |
|
23 | +require_once __DIR__.'/../../../include/cp_header.php'; |
|
24 | +require_once __DIR__.'/../include/common.php'; |
|
25 | 25 | |
26 | -require_once REFERENCES_PATH . 'admin/functions.php'; |
|
27 | -require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
28 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
29 | -require_once REFERENCES_PATH . 'class/references_listFilter.php'; |
|
30 | -require_once REFERENCES_PATH . 'admin/dbupdate.php'; |
|
26 | +require_once REFERENCES_PATH.'admin/functions.php'; |
|
27 | +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
28 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
29 | +require_once REFERENCES_PATH.'class/references_listFilter.php'; |
|
30 | +require_once REFERENCES_PATH.'admin/dbupdate.php'; |
|
31 | 31 | |
32 | 32 | if (!isset($op)) { |
33 | 33 | $op = 'default'; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | references_utils::prepareFolder(references_utils::getModuleOption('images_path')); |
48 | 48 | |
49 | 49 | // Lecture de certains param???tres de l'application ******************************************************************** |
50 | -$limit = references_utils::getModuleOption('items_admin_page'); // Nombre maximum d'???l???ments ??? afficher |
|
51 | -$baseurl = REFERENCES_URL . 'admin/' . basename(__FILE__); // URL de ce script |
|
50 | +$limit = references_utils::getModuleOption('items_admin_page'); // Nombre maximum d'???l???ments ??? afficher |
|
51 | +$baseurl = REFERENCES_URL.'admin/'.basename(__FILE__); // URL de ce script |
|
52 | 52 | $conf_msg = references_utils::javascriptLinkConfirm(_AM_REFERENCES_CONF_DELITEM); |
53 | 53 | $defaultSortField = references_utils::getModuleOption('admin_sort_field'); |
54 | 54 | $defaultSortOrder = references_utils::getModuleOption('admin_sort_order'); |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | $objet = 'articles'; |
86 | 86 | $items = array(); |
87 | 87 | if (isset($_GET['move'])) { |
88 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
89 | - $ordre = isset($_GET['ordre']) ? (int)$_GET['ordre'] : 0; |
|
88 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
89 | + $ordre = isset($_GET['ordre']) ? (int) $_GET['ordre'] : 0; |
|
90 | 90 | if ($_GET['move'] === 'up' && $id > 0) { |
91 | 91 | $handlers->h_references_articles->moveUp($id, $ordre); |
92 | 92 | } |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $handlers->h_references_articles->moveDown($id, $ordre); |
95 | 95 | } |
96 | 96 | } |
97 | - $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='" . _AM_REFERENCES_ADD_ITEM . "' /></form>"; |
|
97 | + $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='"._AM_REFERENCES_ADD_ITEM."' /></form>"; |
|
98 | 98 | echo $form; |
99 | 99 | $categoriesList = $h_references_categories->getListArray(); |
100 | 100 | $upText = _AM_REFERENCES_UP; |
101 | 101 | $downText = _AM_REFERENCES_DOWN; |
102 | - $upImg = "<a href='$baseurl?op=articles&move=up&id=%d&ordre=%d' title=\"$upText\"><img src='" . REFERENCES_IMAGES_URL . "up.png' alt=\"$upText\" /></a>"; |
|
103 | - $downImg = "<a href='$baseurl?op=articles&move=down&id=%d&ordre=%d' title=\"$downText\"><img src='" . REFERENCES_IMAGES_URL . "down.png' alt=\"$downText\" /></a>"; |
|
102 | + $upImg = "<a href='$baseurl?op=articles&move=up&id=%d&ordre=%d' title=\"$upText\"><img src='".REFERENCES_IMAGES_URL."up.png' alt=\"$upText\" /></a>"; |
|
103 | + $downImg = "<a href='$baseurl?op=articles&move=down&id=%d&ordre=%d' title=\"$downText\"><img src='".REFERENCES_IMAGES_URL."down.png' alt=\"$downText\" /></a>"; |
|
104 | 104 | |
105 | 105 | $referencesFilter = new references_listFilter($h_references_articles, 'op', 'articles', 'start', $limit, $baseurl, $defaultSortField, $defaultSortOrder, true, REFERENCES_JS_URL); |
106 | 106 | $referencesFilter->initFilter('article_id', array('dataType' => references_listFilter::FILTER_DATA_NUMERIC, 'fieldType' => references_listFilter::FILTER_FIELD_TEXT, 'size' => 5, 'maxLength' => 10)); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $referencesFilter->filter(); |
116 | 116 | $itemsCount = $referencesFilter->getCount(); |
117 | - references_utils::htitle(_MI_REFERENCES_ADMENU0 . ' (' . $itemsCount . ')', 4); |
|
117 | + references_utils::htitle(_MI_REFERENCES_ADMENU0.' ('.$itemsCount.')', 4); |
|
118 | 118 | |
119 | 119 | if ($itemsCount > $limit) { |
120 | 120 | $pagenav = $referencesFilter->getPager(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
128 | 128 | echo "<tr>\n"; |
129 | 129 | echo "<form method='post' action='$baseurl'>\n"; |
130 | - echo "<td colspan='4' align='right'>" . $referencesFilter->getSortPlaceHolderHtmlCode(); |
|
130 | + echo "<td colspan='4' align='right'>".$referencesFilter->getSortPlaceHolderHtmlCode(); |
|
131 | 131 | echo $referencesFilter->getClearFilterbutton(); |
132 | 132 | echo "</td>\n"; |
133 | 133 | echo "<td colspan='2' align='right'>"; |
@@ -136,28 +136,28 @@ discard block |
||
136 | 136 | } |
137 | 137 | echo "</td>\n</tr>\n"; |
138 | 138 | |
139 | - echo "<th align='center'>" . _AM_REFERENCES_ID . "</th><th align='center'>" . _AM_REFERENCES_TITLE . "</th><th align='center'>" . _AM_REFERENCES_WEIGHT . "</th><th align='center'>" . _AM_REFERENCES_CATEGORY . "</th><th align='center'>" . _AM_REFERENCES_ONLINE . "</th><th align='center'>" |
|
140 | - . _AM_REFERENCES_MANUAL_DATE . "</th><th align='center'>" . _AM_REFERENCES_ACTION . '</th></tr>'; |
|
139 | + echo "<th align='center'>"._AM_REFERENCES_ID."</th><th align='center'>"._AM_REFERENCES_TITLE."</th><th align='center'>"._AM_REFERENCES_WEIGHT."</th><th align='center'>"._AM_REFERENCES_CATEGORY."</th><th align='center'>"._AM_REFERENCES_ONLINE."</th><th align='center'>" |
|
140 | + . _AM_REFERENCES_MANUAL_DATE."</th><th align='center'>"._AM_REFERENCES_ACTION.'</th></tr>'; |
|
141 | 141 | // Filtres **************************************** |
142 | 142 | echo "<tr>\n"; |
143 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_id') . "</th>\n"; |
|
144 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_title') . "</th>\n"; |
|
145 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_weight') . "</th>\n"; |
|
146 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_category_id') . "</th>\n"; |
|
147 | - echo "<th align='center'>" . $referencesFilter->getFilterField('article_online') . "</th>\n"; |
|
143 | + echo "<th align='center'>".$referencesFilter->getFilterField('article_id')."</th>\n"; |
|
144 | + echo "<th align='center'>".$referencesFilter->getFilterField('article_title')."</th>\n"; |
|
145 | + echo "<th align='center'>".$referencesFilter->getFilterField('article_weight')."</th>\n"; |
|
146 | + echo "<th align='center'>".$referencesFilter->getFilterField('article_category_id')."</th>\n"; |
|
147 | + echo "<th align='center'>".$referencesFilter->getFilterField('article_online')."</th>\n"; |
|
148 | 148 | echo "<th align='center'> </th>\n"; |
149 | - echo "<th align='center'>" . $referencesFilter->getGoButton() . "</th></form></tr>\n"; |
|
149 | + echo "<th align='center'>".$referencesFilter->getGoButton()."</th></form></tr>\n"; |
|
150 | 150 | // ************************************************ |
151 | 151 | $class = ''; |
152 | 152 | foreach ($items as $item) { |
153 | 153 | ++$counter; |
154 | 154 | $class = ($class === 'even') ? 'odd' : 'even'; |
155 | 155 | $id = $item->getVar('article_id'); |
156 | - $action_edit = "<a href='$baseurl?op=edit" . $objet . '&id=' . $id . "' title='" . _EDIT . "'>" . $icones['edit'] . '</a>'; |
|
157 | - $action_delete = "<a href='$baseurl?op=delete" . $objet . '&id=' . $id . "' title='" . _DELETE . "'" . $conf_msg . '>' . $icones['delete'] . '</a>'; |
|
156 | + $action_edit = "<a href='$baseurl?op=edit".$objet.'&id='.$id."' title='"._EDIT."'>".$icones['edit'].'</a>'; |
|
157 | + $action_delete = "<a href='$baseurl?op=delete".$objet.'&id='.$id."' title='"._DELETE."'".$conf_msg.'>'.$icones['delete'].'</a>'; |
|
158 | 158 | $category = isset($categories[$item->getVar('article_category_id')]) ? $categories[$item->getVar('article_category_id')] : ''; |
159 | 159 | $up = $down = ''; |
160 | - echo "<tr class='" . $class . "'>\n"; |
|
160 | + echo "<tr class='".$class."'>\n"; |
|
161 | 161 | $ordre = $item->getVar('article_weight'); |
162 | 162 | if ($counter == 1 && $visibleCountItems > 1) { // Premier ???l???ment |
163 | 163 | $down = sprintf($downImg, $id, $ordre); |
@@ -165,36 +165,36 @@ discard block |
||
165 | 165 | if ($counter == $visibleCountItems && $visibleCountItems > 1) { // Dernier ???l???ment |
166 | 166 | $up = sprintf($upImg, $id, $ordre); |
167 | 167 | } |
168 | - if ($counter > 1 & $counter < $visibleCountItems && $visibleCountItems > 1) { // Element dans le milieu |
|
168 | + if ($counter > 1&$counter < $visibleCountItems && $visibleCountItems > 1) { // Element dans le milieu |
|
169 | 169 | $up = sprintf($upImg, $id, $ordre); |
170 | 170 | $down = sprintf($downImg, $id, $ordre); |
171 | 171 | } |
172 | 172 | |
173 | - echo "<td align='center'>" . $id . '</td>'; |
|
174 | - echo "<td align='left'><a target='_blank' href='" . $item->getUrl() . "'>" . $item->getVar('article_title') . '</a></td>'; |
|
175 | - echo "<td align='center'>" . $item->getVar('article_weight') . " $up $down</td>"; |
|
176 | - echo "<td align='center'>" . $category . '</td>'; |
|
173 | + echo "<td align='center'>".$id.'</td>'; |
|
174 | + echo "<td align='left'><a target='_blank' href='".$item->getUrl()."'>".$item->getVar('article_title').'</a></td>'; |
|
175 | + echo "<td align='center'>".$item->getVar('article_weight')." $up $down</td>"; |
|
176 | + echo "<td align='center'>".$category.'</td>'; |
|
177 | 177 | if ($item->isArticleOnline()) { |
178 | - $statusLink = "<a href='$baseurl?op=offline&id=$id' title='" . _AM_REFERENCES_GO_OFFLINE . "'><img src='" . REFERENCES_IMAGES_URL . "status_online.png' alt='" . _AM_REFERENCES_GO_OFFLINE . "' /></a>"; |
|
178 | + $statusLink = "<a href='$baseurl?op=offline&id=$id' title='"._AM_REFERENCES_GO_OFFLINE."'><img src='".REFERENCES_IMAGES_URL."status_online.png' alt='"._AM_REFERENCES_GO_OFFLINE."' /></a>"; |
|
179 | 179 | } else { |
180 | - $statusLink = "<a href='$baseurl?op=online&id=$id' title='" . _AM_REFERENCES_GO_ONLINE . "'><img src='" . REFERENCES_IMAGES_URL . "status_offline.png' alt='" . _AM_REFERENCES_GO_ONLINE . "' /></a>"; |
|
180 | + $statusLink = "<a href='$baseurl?op=online&id=$id' title='"._AM_REFERENCES_GO_ONLINE."'><img src='".REFERENCES_IMAGES_URL."status_offline.png' alt='"._AM_REFERENCES_GO_ONLINE."' /></a>"; |
|
181 | 181 | } |
182 | - echo "<td align='center'>" . $statusLink . '</td>'; |
|
183 | - echo "<td align='center'>" . $item->getVar('article_date') . '</td>'; |
|
184 | - echo "<td align='center'>" . $action_edit . ' ' . $action_delete . "</td>\n"; |
|
182 | + echo "<td align='center'>".$statusLink.'</td>'; |
|
183 | + echo "<td align='center'>".$item->getVar('article_date').'</td>'; |
|
184 | + echo "<td align='center'>".$action_edit.' '.$action_delete."</td>\n"; |
|
185 | 185 | echo "<tr>\n"; |
186 | 186 | } |
187 | 187 | $class = ($class === 'even') ? 'odd' : 'even'; |
188 | - echo "<tr class='" . $class . "'>\n"; |
|
189 | - echo "<td colspan='7' align='center'>" . $form . "</td>\n"; |
|
188 | + echo "<tr class='".$class."'>\n"; |
|
189 | + echo "<td colspan='7' align='center'>".$form."</td>\n"; |
|
190 | 190 | echo "</tr>\n"; |
191 | 191 | echo "</table>\n"; |
192 | 192 | echo $referencesFilter->getJavascriptInitCode(); |
193 | 193 | if (isset($pagenav) && is_object($pagenav)) { |
194 | - echo "<div align='center'>" . $pagenav->renderNav() . '</div>'; |
|
194 | + echo "<div align='center'>".$pagenav->renderNav().'</div>'; |
|
195 | 195 | } |
196 | 196 | echo "<br><br>\n"; |
197 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
197 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
198 | 198 | break; |
199 | 199 | |
200 | 200 | // **************************************************************************************************************** |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | xoops_cp_header(); |
205 | 205 | // references_adminMenu(0); |
206 | 206 | $object = 'articles'; |
207 | - if ($op == 'edit' . $object) { |
|
207 | + if ($op == 'edit'.$object) { |
|
208 | 208 | $title = _AM_REFERENCES_EDIT_ARTICLE; |
209 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
209 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
210 | 210 | if (empty($id)) { |
211 | 211 | references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
212 | 212 | } |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | $label_submit = _AM_REFERENCES_ADD; |
229 | 229 | $edit = false; |
230 | 230 | } |
231 | - $sform = new XoopsThemeForm($title, 'frmadd' . $object, $baseurl); |
|
231 | + $sform = new XoopsThemeForm($title, 'frmadd'.$object, $baseurl); |
|
232 | 232 | $sform->setExtra('enctype="multipart/form-data"'); |
233 | - $sform->addElement(new XoopsFormHidden('op', 'saveedit' . $object)); |
|
233 | + $sform->addElement(new XoopsFormHidden('op', 'saveedit'.$object)); |
|
234 | 234 | $sform->addElement(new XoopsFormHidden('article_id', $item->getVar('article_id'))); |
235 | 235 | $categories = $h_references_categories->getListArray(); |
236 | 236 | $categoriesList = new XoopsFormSelect(_AM_REFERENCES_CATEGORY, 'article_category_id', $item->getVar('article_category_id', 'e')); |
@@ -255,29 +255,29 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | if (references_utils::getModuleOption('use_tags') && references_utils::tagModuleExists()) { |
258 | - require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
|
258 | + require_once XOOPS_ROOT_PATH.'/modules/tag/include/formtag.php'; |
|
259 | 259 | $sform->addElement(new XoopsFormTag('item_tag', 60, 255, $item->getVar('article_id'), 0)); |
260 | 260 | } |
261 | 261 | // Images |
262 | 262 | for ($i = 1; $i <= 10; ++$i) { |
263 | - if ($op == 'edit' . $object && $item->pictureExists($i)) { |
|
264 | - $pictureTray = new XoopsFormElementTray(_AM_REFERENCES_CURRENT_PICTURE . ' ' . $i, '<br>'); |
|
265 | - $pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl($i) . "' alt='' border='0' />")); |
|
266 | - $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture' . $i); |
|
263 | + if ($op == 'edit'.$object && $item->pictureExists($i)) { |
|
264 | + $pictureTray = new XoopsFormElementTray(_AM_REFERENCES_CURRENT_PICTURE.' '.$i, '<br>'); |
|
265 | + $pictureTray->addElement(new XoopsFormLabel('', "<img src='".$item->getPictureUrl($i)."' alt='' border='0' />")); |
|
266 | + $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture'.$i); |
|
267 | 267 | $deleteCheckbox->addOption(1, _DELETE); |
268 | 268 | $pictureTray->addElement($deleteCheckbox); |
269 | 269 | $sform->addElement($pictureTray); |
270 | 270 | unset($pictureTray, $deleteCheckbox); |
271 | 271 | } |
272 | - $sform->addElement(new XoopsFormFile(_AM_REFERENCES_IMAGE . ' ' . $i, 'attachedfile' . $i, references_utils::getModuleOption('maxuploadsize')), false); |
|
273 | - $fieldName = 'article_picture' . $i . '_text'; |
|
274 | - $sform->addElement(new XoopsFormText(_AM_REFERENCES_PICTURE_TEXT . ' ' . $i, $fieldName, 50, 255, $item->getVar($fieldName)), false); |
|
272 | + $sform->addElement(new XoopsFormFile(_AM_REFERENCES_IMAGE.' '.$i, 'attachedfile'.$i, references_utils::getModuleOption('maxuploadsize')), false); |
|
273 | + $fieldName = 'article_picture'.$i.'_text'; |
|
274 | + $sform->addElement(new XoopsFormText(_AM_REFERENCES_PICTURE_TEXT.' '.$i, $fieldName, 50, 255, $item->getVar($fieldName)), false); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | // Fichier attach??? |
278 | - if ($op == 'edit' . $object && $item->attachmentExists()) { |
|
278 | + if ($op == 'edit'.$object && $item->attachmentExists()) { |
|
279 | 279 | $attachedTray = new XoopsFormElementTray(_AM_REFERENCES_ATTACHED_FILE, '<br>'); |
280 | - $attachedTray->addElement(new XoopsFormLabel('', "<a href='" . $item->getAttachmentUrl() . "' target='_blank'>" . $item->getVar('article_attached_file') . '</a>')); |
|
280 | + $attachedTray->addElement(new XoopsFormLabel('', "<a href='".$item->getAttachmentUrl()."' target='_blank'>".$item->getVar('article_attached_file').'</a>')); |
|
281 | 281 | $deleteCheckbox = new XoopsFormCheckBox('', 'delattach'); |
282 | 282 | $deleteCheckbox->addOption(1, _DELETE); |
283 | 283 | $attachedTray->addElement($deleteCheckbox); |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | $sform->addElement($button_tray); |
293 | 293 | $sform = references_utils::formMarkRequiredFields($sform); |
294 | 294 | $sform->display(); |
295 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
295 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
296 | 296 | break; |
297 | 297 | |
298 | 298 | // **************************************************************************************************************** |
299 | 299 | case 'saveeditarticles': // Sauvegarde d'un article |
300 | 300 | // **************************************************************************************************************** |
301 | 301 | xoops_cp_header(); |
302 | - $id = isset($_POST['article_id']) ? (int)$_POST['article_id'] : 0; |
|
302 | + $id = isset($_POST['article_id']) ? (int) $_POST['article_id'] : 0; |
|
303 | 303 | $opRedirect = 'articles'; |
304 | 304 | if (!empty($id)) { |
305 | 305 | $edit = true; |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | |
318 | 318 | // Images |
319 | 319 | for ($i = 1; $i <= 10; ++$i) { |
320 | - if (isset($_POST['delpicture' . $i]) && (int)$_POST['delpicture' . $i] == 1) { |
|
320 | + if (isset($_POST['delpicture'.$i]) && (int) $_POST['delpicture'.$i] == 1) { |
|
321 | 321 | $item->deletePicture($i); |
322 | - $item->setVar('article_picture' . $i, ''); |
|
322 | + $item->setVar('article_picture'.$i, ''); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | // Upload de l'image et cr???ation de la vignette |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | $return = references_utils::uploadFile($i - 1, references_utils::getModuleOption('images_path')); |
328 | 328 | if ($return === true) { |
329 | 329 | if (references_utils::getModuleOption('images_width') > 0 && references_utils::getModuleOption('images_height') > 0) { |
330 | - references_utils::createThumb(references_utils::getModuleOption('images_path') . '/' . basename($destname), references_utils::getModuleOption('images_path') . '/' . basename($destname), references_utils::getModuleOption('images_width'), |
|
330 | + references_utils::createThumb(references_utils::getModuleOption('images_path').'/'.basename($destname), references_utils::getModuleOption('images_path').'/'.basename($destname), references_utils::getModuleOption('images_width'), |
|
331 | 331 | references_utils::getModuleOption('images_height'), true); |
332 | 332 | } |
333 | - $newDestName = references_utils::getModuleOption('images_path') . DIRECTORY_SEPARATOR . REFERENCES_THUMBS_PREFIX . basename($destname); |
|
334 | - $retval = references_utils::resizePicture(references_utils::getModuleOption('images_path') . '/' . basename($destname), $newDestName, $thumbs_width, $thumbs_height, true); |
|
333 | + $newDestName = references_utils::getModuleOption('images_path').DIRECTORY_SEPARATOR.REFERENCES_THUMBS_PREFIX.basename($destname); |
|
334 | + $retval = references_utils::resizePicture(references_utils::getModuleOption('images_path').'/'.basename($destname), $newDestName, $thumbs_width, $thumbs_height, true); |
|
335 | 335 | if ($retval == 1 || $retval == 3) { |
336 | - $item->setVar('article_picture' . $i, $destname); |
|
336 | + $item->setVar('article_picture'.$i, $destname); |
|
337 | 337 | } |
338 | 338 | } else { |
339 | 339 | if ($return !== false) { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | - $timestamp = mktime(0, 0, 0, (int)substr($_POST['article_timestamp'], 5, 2), (int)substr($_POST['article_timestamp'], 8, 2), (int)substr($_POST['article_timestamp'], 0, 4)); |
|
345 | + $timestamp = mktime(0, 0, 0, (int) substr($_POST['article_timestamp'], 5, 2), (int) substr($_POST['article_timestamp'], 8, 2), (int) substr($_POST['article_timestamp'], 0, 4)); |
|
346 | 346 | $item->setVar('article_timestamp', $timestamp); |
347 | 347 | |
348 | 348 | if (!$edit) { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | // Suppression ???ventuelle du fichier attach??? |
353 | - if (isset($_POST['delattach']) && (int)$_POST['delattach'] == 1) { |
|
353 | + if (isset($_POST['delattach']) && (int) $_POST['delattach'] == 1) { |
|
354 | 354 | $item->deleteAttachment(); |
355 | 355 | } |
356 | 356 | |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | $h_references_articles->notifyNewArticle($item); |
376 | 376 | } |
377 | 377 | references_utils::updateCache(); |
378 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
378 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl.'?op='.$opRedirect, 2); |
|
379 | 379 | } else { |
380 | - references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); |
|
380 | + references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl.'?op='.$opRedirect, 5); |
|
381 | 381 | } |
382 | 382 | break; |
383 | 383 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | case 'online': // Mise en ligne d'un article |
387 | 387 | // **************************************************************************************************************** |
388 | 388 | xoops_cp_header(); |
389 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
389 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
390 | 390 | if (empty($id)) { |
391 | 391 | references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
392 | 392 | } |
@@ -401,17 +401,17 @@ discard block |
||
401 | 401 | } |
402 | 402 | if ($res) { |
403 | 403 | references_utils::updateCache(); |
404 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
404 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl.'?op='.$opRedirect, 2); |
|
405 | 405 | } |
406 | 406 | } |
407 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
407 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl.'?op='.$opRedirect, 5); |
|
408 | 408 | break; |
409 | 409 | |
410 | 410 | // **************************************************************************************************************** |
411 | 411 | case 'deletearticles': // Suppression d'un article |
412 | 412 | // **************************************************************************************************************** |
413 | 413 | xoops_cp_header(); |
414 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
414 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
415 | 415 | if (empty($id)) { |
416 | 416 | references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
417 | 417 | } |
@@ -422,27 +422,27 @@ discard block |
||
422 | 422 | $res = $h_references_articles->deleteArticle($item, true); |
423 | 423 | if ($res) { |
424 | 424 | references_utils::updateCache(); |
425 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
425 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl.'?op='.$opRedirect, 2); |
|
426 | 426 | } |
427 | 427 | } |
428 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
428 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl.'?op='.$opRedirect, 5); |
|
429 | 429 | break; |
430 | 430 | |
431 | 431 | // **************************************************************************************************************** |
432 | - case 'instant-zero'; // Publicit??? |
|
432 | + case 'instant-zero'; // Publicit??? |
|
433 | 433 | // **************************************************************************************************************** |
434 | 434 | xoops_cp_header(); |
435 | 435 | // references_adminMenu(4); |
436 | 436 | echo "<iframe src='http://www.instant-zero.com/modules/liaise/?form_id=2' width='100%' height='600' frameborder='0'></iframe>"; |
437 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
437 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
438 | 438 | break; |
439 | 439 | |
440 | 440 | // **************************************************************************************************************** |
441 | - case 'perms'; // Permissions |
|
441 | + case 'perms'; // Permissions |
|
442 | 442 | // **************************************************************************************************************** |
443 | 443 | xoops_cp_header(); |
444 | 444 | // references_adminMenu(3); |
445 | - require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
445 | + require_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php'; |
|
446 | 446 | $categories = $handlers->h_references_categories->getCategories(); |
447 | 447 | $permissionsForm = new XoopsGroupPermForm(_AM_REFERENCES_VIEWFORM, $xoopsModule->getVar('mid'), REFERENCES_PERM_READ, _AM_REFERENCES_VIEWFORM_DESC, 'admin/index.php?op=perms', 'true'); |
448 | 448 | foreach ($categories as $category) { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | echo $permissionsForm->render(); |
452 | 452 | echo "<br><br><br><br>\n"; |
453 | 453 | unset($permissionsForm); |
454 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
454 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
455 | 455 | break; |
456 | 456 | |
457 | 457 | // **************************************************************************************************************** |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // **************************************************************************************************************** |
460 | 460 | xoops_cp_header(); |
461 | 461 | // references_adminMenu(2); |
462 | - require_once REFERENCES_PATH . 'class/registryfile.php'; |
|
462 | + require_once REFERENCES_PATH.'class/registryfile.php'; |
|
463 | 463 | $registry = new references_registryfile(); |
464 | 464 | |
465 | 465 | $sform = new XoopsThemeForm(_MI_REFERENCES_ADMENU1, 'frmatxt', $baseurl); |
@@ -475,19 +475,19 @@ discard block |
||
475 | 475 | $sform->addElement($button_tray); |
476 | 476 | $sform = references_utils::formMarkRequiredFields($sform); |
477 | 477 | $sform->display(); |
478 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
478 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
479 | 479 | break; |
480 | 480 | |
481 | 481 | // **************************************************************************************************************** |
482 | 482 | case 'savetexts': // Sauvegarde des textes |
483 | 483 | // **************************************************************************************************************** |
484 | 484 | xoops_cp_header(); |
485 | - require_once REFERENCES_PATH . 'class/registryfile.php'; |
|
485 | + require_once REFERENCES_PATH.'class/registryfile.php'; |
|
486 | 486 | $registry = new references_registryfile(); |
487 | 487 | $myts = MyTextSanitizer::getInstance(); |
488 | 488 | $registry->savefile($myts->stripSlashesGPC($_POST['text1']), REFERENCES_TEXTFILE1); |
489 | 489 | references_utils::updateCache(); |
490 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=texts', 2); |
|
490 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl.'?op=texts', 2); |
|
491 | 491 | break; |
492 | 492 | |
493 | 493 | // **************************************************************************************************************** |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | // **************************************************************************************************************** |
505 | 505 | xoops_cp_header(); |
506 | 506 | // references_adminMenu(1); |
507 | - $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
507 | + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
508 | 508 | $objet = 'categories'; |
509 | 509 | $items = array(); |
510 | - $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='" . _AM_REFERENCES_ADD_ITEM . "' /></form>"; |
|
510 | + $form = "<form method='post' action='$baseurl' name='frmadd$objet' id='frmadd$objet'><input type='hidden' name='op' id='op' value='add$objet' /><input type='submit' name='btngo' id='btngo' value='"._AM_REFERENCES_ADD_ITEM."' /></form>"; |
|
511 | 511 | echo $form; |
512 | 512 | references_utils::htitle(_MI_REFERENCES_ADMENU2, 4); |
513 | 513 | |
@@ -518,36 +518,36 @@ discard block |
||
518 | 518 | |
519 | 519 | $items = $h_references_categories->getCategories($start, $limit); |
520 | 520 | if (isset($pagenav) && is_object($pagenav)) { |
521 | - echo "<div align='right'>" . $pagenav->renderNav() . '</div>'; |
|
521 | + echo "<div align='right'>".$pagenav->renderNav().'</div>'; |
|
522 | 522 | } |
523 | 523 | echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
524 | 524 | |
525 | - echo "<tr><th align='center'>" . _AM_REFERENCES_ID . "</th><th align='center'>" . _AM_REFERENCES_TITLE . "</th><th align='center'>" . _AM_REFERENCES_CATEGORY_WEIGHT . "</th><th align='center'>" . _AM_REFERENCES_ACTION . '</th></tr>'; |
|
525 | + echo "<tr><th align='center'>"._AM_REFERENCES_ID."</th><th align='center'>"._AM_REFERENCES_TITLE."</th><th align='center'>"._AM_REFERENCES_CATEGORY_WEIGHT."</th><th align='center'>"._AM_REFERENCES_ACTION.'</th></tr>'; |
|
526 | 526 | |
527 | 527 | $class = ''; |
528 | 528 | foreach ($items as $item) { |
529 | 529 | $class = ($class === 'even') ? 'odd' : 'even'; |
530 | 530 | $id = $item->getVar('category_id'); |
531 | - $action_edit = "<a href='$baseurl?op=edit" . $objet . '&id=' . $id . "' title='" . _EDIT . "'>" . $icones['edit'] . '</a>'; |
|
532 | - $action_delete = "<a href='$baseurl?op=delete" . $objet . '&id=' . $id . "' title='" . _DELETE . "'" . $conf_msg . '>' . $icones['delete'] . '</a>'; |
|
533 | - |
|
534 | - echo "<tr class='" . $class . "'>\n"; |
|
535 | - echo "<td align='center'>" . $id . '</td>'; |
|
536 | - echo "<td align='left'><a target='_blank' href='" . $item->getUrl() . "'>" . $item->getVar('category_title') . '</a></td>'; |
|
537 | - echo "<td align='right'>" . $item->getVar('category_weight') . '</td>'; |
|
538 | - echo "<td align='center'>" . $action_edit . ' ' . $action_delete . "</td>\n"; |
|
531 | + $action_edit = "<a href='$baseurl?op=edit".$objet.'&id='.$id."' title='"._EDIT."'>".$icones['edit'].'</a>'; |
|
532 | + $action_delete = "<a href='$baseurl?op=delete".$objet.'&id='.$id."' title='"._DELETE."'".$conf_msg.'>'.$icones['delete'].'</a>'; |
|
533 | + |
|
534 | + echo "<tr class='".$class."'>\n"; |
|
535 | + echo "<td align='center'>".$id.'</td>'; |
|
536 | + echo "<td align='left'><a target='_blank' href='".$item->getUrl()."'>".$item->getVar('category_title').'</a></td>'; |
|
537 | + echo "<td align='right'>".$item->getVar('category_weight').'</td>'; |
|
538 | + echo "<td align='center'>".$action_edit.' '.$action_delete."</td>\n"; |
|
539 | 539 | echo "<tr>\n"; |
540 | 540 | } |
541 | 541 | $class = ($class === 'even') ? 'odd' : 'even'; |
542 | - echo "<tr class='" . $class . "'>\n"; |
|
543 | - echo "<td colspan='4' align='center'>" . $form . "</td>\n"; |
|
542 | + echo "<tr class='".$class."'>\n"; |
|
543 | + echo "<td colspan='4' align='center'>".$form."</td>\n"; |
|
544 | 544 | echo "</tr>\n"; |
545 | 545 | echo "</table>\n"; |
546 | 546 | if (isset($pagenav) && is_object($pagenav)) { |
547 | - echo "<div align='center'>" . $pagenav->renderNav() . '</div>'; |
|
547 | + echo "<div align='center'>".$pagenav->renderNav().'</div>'; |
|
548 | 548 | } |
549 | 549 | echo "<br><br>\n"; |
550 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
550 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
551 | 551 | break; |
552 | 552 | |
553 | 553 | // **************************************************************************************************************** |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | xoops_cp_header(); |
558 | 558 | // references_adminMenu(1); |
559 | 559 | $object = 'categories'; |
560 | - if ($op == 'edit' . $object) { |
|
560 | + if ($op == 'edit'.$object) { |
|
561 | 561 | $title = _AM_REFERENCES_EDIT_CATEGORY; |
562 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
562 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
563 | 563 | if (empty($id)) { |
564 | 564 | references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
565 | 565 | } |
@@ -577,8 +577,8 @@ discard block |
||
577 | 577 | $label_submit = _AM_REFERENCES_ADD; |
578 | 578 | $edit = false; |
579 | 579 | } |
580 | - $sform = new XoopsThemeForm($title, 'frmadd' . $object, $baseurl); |
|
581 | - $sform->addElement(new XoopsFormHidden('op', 'saveedit' . $object)); |
|
580 | + $sform = new XoopsThemeForm($title, 'frmadd'.$object, $baseurl); |
|
581 | + $sform->addElement(new XoopsFormHidden('op', 'saveedit'.$object)); |
|
582 | 582 | $sform->addElement(new XoopsFormHidden('category_id', $item->getVar('category_id'))); |
583 | 583 | $sform->addElement(new XoopsFormText(_AM_REFERENCES_TITLE, 'category_title', 50, 255, $item->getVar('category_title', 'e')), true); |
584 | 584 | $sform->addElement(new XoopsFormText(_AM_REFERENCES_CATEGORY_WEIGHT, 'category_weight', 10, 10, $item->getVar('category_weight', 'e')), true); |
@@ -611,14 +611,14 @@ discard block |
||
611 | 611 | $sform->addElement($button_tray); |
612 | 612 | $sform = references_utils::formMarkRequiredFields($sform); |
613 | 613 | $sform->display(); |
614 | - include_once __DIR__ . '/admin_footer.php'; //show_footer(); |
|
614 | + include_once __DIR__.'/admin_footer.php'; //show_footer(); |
|
615 | 615 | break; |
616 | 616 | |
617 | 617 | // **************************************************************************************************************** |
618 | 618 | case 'saveeditcategories': // Sauvegarde d'une cat???gorie |
619 | 619 | // **************************************************************************************************************** |
620 | 620 | xoops_cp_header(); |
621 | - $id = isset($_POST['category_id']) ? (int)$_POST['category_id'] : 0; |
|
621 | + $id = isset($_POST['category_id']) ? (int) $_POST['category_id'] : 0; |
|
622 | 622 | $opRedirect = 'categories'; |
623 | 623 | if (!empty($id)) { |
624 | 624 | $edit = true; |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | $h_references_categories->notifyNewCategory($item); |
656 | 656 | } |
657 | 657 | references_utils::updateCache(); |
658 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
658 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl.'?op='.$opRedirect, 2); |
|
659 | 659 | } else { |
660 | - references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); |
|
660 | + references_utils::redirect(_AM_REFERENCES_SAVE_PB, $baseurl.'?op='.$opRedirect, 5); |
|
661 | 661 | } |
662 | 662 | break; |
663 | 663 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | case 'deletecategories': // Suppression d'une cat???gorie |
666 | 666 | // **************************************************************************************************************** |
667 | 667 | xoops_cp_header(); |
668 | - $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
668 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
669 | 669 | if (empty($id)) { |
670 | 670 | references_utils::redirect(_AM_REFERENCES_ERROR_1, $baseurl, 5); |
671 | 671 | } |
@@ -676,10 +676,10 @@ discard block |
||
676 | 676 | $res = $h_references_categories->delete($item, true); |
677 | 677 | if ($res) { |
678 | 678 | references_utils::updateCache(); |
679 | - references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); |
|
679 | + references_utils::redirect(_AM_REFERENCES_SAVE_OK, $baseurl.'?op='.$opRedirect, 2); |
|
680 | 680 | } |
681 | 681 | } |
682 | - references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); |
|
682 | + references_utils::redirect(_AM_REFERENCES_NOT_FOUND, $baseurl.'?op='.$opRedirect, 5); |
|
683 | 683 | break; |
684 | 684 | |
685 | 685 | // **************************************************************************************************************** |
@@ -34,38 +34,38 @@ discard block |
||
34 | 34 | |
35 | 35 | $xoopsModuleAdminPath = XOOPS_ROOT_PATH . '/' . $module->getInfo('dirmoduleadmin'); |
36 | 36 | if (!file_exists($fileinc = $xoopsModuleAdminPath . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { |
37 | - $fileinc = $xoopsModuleAdminPath . '/language/english/main.php'; |
|
37 | + $fileinc = $xoopsModuleAdminPath . '/language/english/main.php'; |
|
38 | 38 | } |
39 | 39 | include_once $fileinc; |
40 | 40 | |
41 | 41 | $adminmenu[] = array( |
42 | - 'title' => _AM_MODULEADMIN_HOME, |
|
43 | - 'link' => 'admin/index.php', |
|
44 | - 'icon' => $pathIcon32 . '/home.png' |
|
42 | + 'title' => _AM_MODULEADMIN_HOME, |
|
43 | + 'link' => 'admin/index.php', |
|
44 | + 'icon' => $pathIcon32 . '/home.png' |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | $adminmenu[] = array( |
48 | - 'title' => _MI_REFERENCES_ADMENU0, |
|
49 | - 'link' => 'admin/main.php', |
|
50 | - 'icon' => $pathIcon32 . '/index.png' |
|
48 | + 'title' => _MI_REFERENCES_ADMENU0, |
|
49 | + 'link' => 'admin/main.php', |
|
50 | + 'icon' => $pathIcon32 . '/index.png' |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | $adminmenu[] = array( |
54 | - 'title' => _MI_REFERENCES_ADMENU2, |
|
55 | - 'link' => 'admin/main.php?op=categories', |
|
56 | - 'icon' => $pathIcon32 . '/category.png' |
|
54 | + 'title' => _MI_REFERENCES_ADMENU2, |
|
55 | + 'link' => 'admin/main.php?op=categories', |
|
56 | + 'icon' => $pathIcon32 . '/category.png' |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | $adminmenu[] = array( |
60 | - 'title' => _MI_REFERENCES_ADMENU1, |
|
61 | - 'link' => 'admin/main.php?op=texts', |
|
62 | - 'icon' => $pathIcon32 . '/manage.png' |
|
60 | + 'title' => _MI_REFERENCES_ADMENU1, |
|
61 | + 'link' => 'admin/main.php?op=texts', |
|
62 | + 'icon' => $pathIcon32 . '/manage.png' |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | $adminmenu[] = array( |
66 | - 'title' => _MI_REFERENCES_ADMENU3, |
|
67 | - 'link' => 'admin/main.php?op=perms', |
|
68 | - 'icon' => $pathIcon32 . '/permissions.png' |
|
66 | + 'title' => _MI_REFERENCES_ADMENU3, |
|
67 | + 'link' => 'admin/main.php?op=perms', |
|
68 | + 'icon' => $pathIcon32 . '/permissions.png' |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | //$adminmenu[] = array( |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | //); |
76 | 76 | |
77 | 77 | $adminmenu[] = array( |
78 | - 'title' => _AM_MODULEADMIN_ABOUT, |
|
79 | - 'link' => 'admin/about.php', |
|
80 | - 'icon' => $pathIcon32 . '/about.png' |
|
78 | + 'title' => _AM_MODULEADMIN_ABOUT, |
|
79 | + 'link' => 'admin/about.php', |
|
80 | + 'icon' => $pathIcon32 . '/about.png' |
|
81 | 81 | ); |
82 | 82 |
@@ -28,44 +28,44 @@ discard block |
||
28 | 28 | |
29 | 29 | $moduleHandler = xoops_getHandler('module'); |
30 | 30 | $module = $moduleHandler->getByDirname($moduleDirName); |
31 | -$pathIcon32 = '../../' . $module->getInfo('sysicons32'); |
|
32 | -$pathModIcon32 = './' . $module->getInfo('modicons32'); |
|
31 | +$pathIcon32 = '../../'.$module->getInfo('sysicons32'); |
|
32 | +$pathModIcon32 = './'.$module->getInfo('modicons32'); |
|
33 | 33 | xoops_loadLanguage('modinfo', $module->dirname()); |
34 | 34 | |
35 | -$xoopsModuleAdminPath = XOOPS_ROOT_PATH . '/' . $module->getInfo('dirmoduleadmin'); |
|
36 | -if (!file_exists($fileinc = $xoopsModuleAdminPath . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { |
|
37 | - $fileinc = $xoopsModuleAdminPath . '/language/english/main.php'; |
|
35 | +$xoopsModuleAdminPath = XOOPS_ROOT_PATH.'/'.$module->getInfo('dirmoduleadmin'); |
|
36 | +if (!file_exists($fileinc = $xoopsModuleAdminPath.'/language/'.$GLOBALS['xoopsConfig']['language'].'/'.'main.php')) { |
|
37 | + $fileinc = $xoopsModuleAdminPath.'/language/english/main.php'; |
|
38 | 38 | } |
39 | 39 | include_once $fileinc; |
40 | 40 | |
41 | 41 | $adminmenu[] = array( |
42 | 42 | 'title' => _AM_MODULEADMIN_HOME, |
43 | 43 | 'link' => 'admin/index.php', |
44 | - 'icon' => $pathIcon32 . '/home.png' |
|
44 | + 'icon' => $pathIcon32.'/home.png' |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | $adminmenu[] = array( |
48 | 48 | 'title' => _MI_REFERENCES_ADMENU0, |
49 | 49 | 'link' => 'admin/main.php', |
50 | - 'icon' => $pathIcon32 . '/index.png' |
|
50 | + 'icon' => $pathIcon32.'/index.png' |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | $adminmenu[] = array( |
54 | 54 | 'title' => _MI_REFERENCES_ADMENU2, |
55 | 55 | 'link' => 'admin/main.php?op=categories', |
56 | - 'icon' => $pathIcon32 . '/category.png' |
|
56 | + 'icon' => $pathIcon32.'/category.png' |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | $adminmenu[] = array( |
60 | 60 | 'title' => _MI_REFERENCES_ADMENU1, |
61 | 61 | 'link' => 'admin/main.php?op=texts', |
62 | - 'icon' => $pathIcon32 . '/manage.png' |
|
62 | + 'icon' => $pathIcon32.'/manage.png' |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | $adminmenu[] = array( |
66 | 66 | 'title' => _MI_REFERENCES_ADMENU3, |
67 | 67 | 'link' => 'admin/main.php?op=perms', |
68 | - 'icon' => $pathIcon32 . '/permissions.png' |
|
68 | + 'icon' => $pathIcon32.'/permissions.png' |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | //$adminmenu[] = array( |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | $adminmenu[] = array( |
78 | 78 | 'title' => _AM_MODULEADMIN_ABOUT, |
79 | 79 | 'link' => 'admin/about.php', |
80 | - 'icon' => $pathIcon32 . '/about.png' |
|
80 | + 'icon' => $pathIcon32.'/about.png' |
|
81 | 81 | ); |
82 | 82 |
@@ -23,22 +23,22 @@ |
||
23 | 23 | // Nouveau champ article_attached_file_description dans references_articles |
24 | 24 | $tableName = $xoopsDB->prefix('references_articles'); |
25 | 25 | if (!references_utils::fieldExists('article_weight', $tableName)) { |
26 | - references_utils::addField('`article_weight` MEDIUMINT( 8 ) UNSIGNED NOT NULL AFTER `article_timestamp`', $tableName); |
|
27 | - $xoopsDB->queryF('ALTER TABLE ' . $tableName . ' ADD INDEX ( `article_weight` )'); |
|
28 | - $wasUpdated = true; |
|
26 | + references_utils::addField('`article_weight` MEDIUMINT( 8 ) UNSIGNED NOT NULL AFTER `article_timestamp`', $tableName); |
|
27 | + $xoopsDB->queryF('ALTER TABLE ' . $tableName . ' ADD INDEX ( `article_weight` )'); |
|
28 | + $wasUpdated = true; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (!references_utils::fieldExists('article_readmore', $tableName)) { |
32 | - references_utils::addField('article_readmore TEXT NOT NULL', $tableName); |
|
33 | - $wasUpdated = true; |
|
32 | + references_utils::addField('article_readmore TEXT NOT NULL', $tableName); |
|
33 | + $wasUpdated = true; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $tableName = $xoopsDB->prefix('references_categories'); |
37 | 37 | if (!references_utils::fieldExists('category_description', $tableName)) { |
38 | - references_utils::addField('category_description TEXT NOT NULL', $tableName); |
|
39 | - $wasUpdated = true; |
|
38 | + references_utils::addField('category_description TEXT NOT NULL', $tableName); |
|
39 | + $wasUpdated = true; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if ($wasUpdated) { |
43 | - $op = 'maintain'; |
|
43 | + $op = 'maintain'; |
|
44 | 44 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $tableName = $xoopsDB->prefix('references_articles'); |
25 | 25 | if (!references_utils::fieldExists('article_weight', $tableName)) { |
26 | 26 | references_utils::addField('`article_weight` MEDIUMINT( 8 ) UNSIGNED NOT NULL AFTER `article_timestamp`', $tableName); |
27 | - $xoopsDB->queryF('ALTER TABLE ' . $tableName . ' ADD INDEX ( `article_weight` )'); |
|
27 | + $xoopsDB->queryF('ALTER TABLE '.$tableName.' ADD INDEX ( `article_weight` )'); |
|
28 | 28 | $wasUpdated = true; |
29 | 29 | } |
30 | 30 |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | $rootPath = dirname(dirname(dirname(__DIR__))); |
20 | -include_once $rootPath . '/mainfile.php'; |
|
21 | -include_once $rootPath . '/include/cp_functions.php'; |
|
22 | -require_once $rootPath . '/include/cp_header.php'; |
|
20 | +include_once $rootPath.'/mainfile.php'; |
|
21 | +include_once $rootPath.'/include/cp_functions.php'; |
|
22 | +require_once $rootPath.'/include/cp_header.php'; |
|
23 | 23 | |
24 | 24 | global $xoopsModule; |
25 | 25 | |
26 | 26 | //$moduleFolder = $GLOBALS['xoopsModule']->getVar('dirname'); |
27 | 27 | $moduleFolder = dirname(__DIR__); |
28 | -require_once $moduleFolder . '/include/common.php'; |
|
28 | +require_once $moduleFolder.'/include/common.php'; |
|
29 | 29 | |
30 | 30 | //if functions.php file exist |
31 | 31 | //require_once $moduleFolder . '/include/functions.php'; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | xoops_loadLanguage('modinfo', $moduleFolder); |
38 | 38 | xoops_loadLanguage('main', $moduleFolder); |
39 | 39 | |
40 | -$pathIcon16 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('sysicons16')); |
|
41 | -$pathIcon32 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('sysicons32')); |
|
42 | -$xoopsModuleAdminPath = $GLOBALS['xoops']->path('www/' . $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin')); |
|
40 | +$pathIcon16 = $GLOBALS['xoops']->url('www/'.$GLOBALS['xoopsModule']->getInfo('sysicons16')); |
|
41 | +$pathIcon32 = $GLOBALS['xoops']->url('www/'.$GLOBALS['xoopsModule']->getInfo('sysicons32')); |
|
42 | +$xoopsModuleAdminPath = $GLOBALS['xoops']->path('www/'.$GLOBALS['xoopsModule']->getInfo('dirmoduleadmin')); |
|
43 | 43 | require_once "{$xoopsModuleAdminPath}/moduleadmin.php"; |