Skip to content

Commit 7bc6789

Browse files
committed
Merge pull request #11 from mambax7/master
1.51 RC 3
2 parents e365eee + 075ccd4 commit 7bc6789

21 files changed

+85
-88
lines changed

.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
7+
# Standard to msysgit
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
10+
*.docx diff=astextplain
11+
*.DOCX diff=astextplain
12+
*.dot diff=astextplain
13+
*.DOT diff=astextplain
14+
*.pdf diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

mymenus/admin/admin_header.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
22+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
2223
include_once $GLOBALS['xoops']->path('www/include/cp_functions.php');
2324
// Include xoops admin header
2425
include_once $GLOBALS['xoops']->path('www/include/cp_header.php');
@@ -35,7 +36,6 @@
3536
$xoopsModuleAdminPath = $GLOBALS['xoops']->path('www/' . $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'));
3637
require_once "{$xoopsModuleAdminPath}/moduleadmin/moduleadmin.php";
3738

38-
3939
$myts =& MyTextSanitizer::getInstance();
4040
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
4141
include_once $GLOBALS['xoops']->path("/class/template.php");
@@ -55,7 +55,6 @@
5555
include_once $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/class/registry.php");
5656
include_once $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/class/plugin.php");
5757

58-
5958
//Module specific elements
6059
//include_once $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/include/functions.php");
6160
//include_once $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/include/config.php");

mymenus/admin/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* @version $Id: index.php
1919
*/
2020

21-
$currentFile = basename(__FILE__);
2221
include_once __DIR__ . '/admin_header.php';
22+
$currentFile = basename(__FILE__);
2323

2424
// admin navigation
2525
xoops_cp_header();

mymenus/admin/links.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
* @version $Id: links.php
1919
*/
2020

21-
$currentFile = basename(__FILE__);
2221
include_once __DIR__ . '/admin_header.php';
2322

23+
$currentFile = basename(__FILE__);
24+
2425
$mymenusTpl = new XoopsTpl(); // will be removed???
2526
$mymenusAdminPage = 'links.php'; // will be removed???
2627
@@ -170,14 +171,12 @@
170171
break;
171172
}
172173

173-
174174
/**
175175
* Class MymenusLinksUtilities
176176
*/
177177
class MymenusLinksUtilities
178178
{
179179

180-
181180
/**
182181
* Display the links in a menu
183182
*
@@ -198,7 +197,7 @@ public static function mymenusAdminList($start = 0, $mid)
198197
$linksCriteria->setSort('weight');
199198
$linksCriteria->setOrder('ASC');
200199
//
201-
$menusArray = array();
200+
// $menusArray = array();
202201
if (($linksCount > 0) && ($linksCount >= (int)$start)) {
203202
$linksCriteria->setStart((int)$start);
204203
$linksArrays = $mymenus->getHandler('links')->getObjects($linksCriteria, false, false); // as array
@@ -306,7 +305,7 @@ public static function mymenusAdminSave($id, $mid)
306305
* @param null $id
307306
* @param null $pid
308307
*
309-
* @param null $mid
308+
* @param null $mid
310309
* @return string
311310
*/
312311
public static function mymenusAdminForm($id = null, $pid = null, $mid = null)
@@ -319,10 +318,10 @@ public static function mymenusAdminForm($id = null, $pid = null, $mid = null)
319318
$xoopsLogger->activated = false;
320319
error_reporting(0);
321320

322-
global $pathIcon16;
321+
$pathIcon16 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('systemIcons16'));
323322

324-
$registry =& MymenusRegistry::getInstance();
325-
$plugin =& MymenusPlugin::getInstance();
323+
// $registry =& MymenusRegistry::getInstance();
324+
// $plugin =& MymenusPlugin::getInstance();
326325

327326
$linksObj = $mymenus->getHandler('links')->get((int)$id);
328327

@@ -352,7 +351,7 @@ public static function mymenusAdminForm($id = null, $pid = null, $mid = null)
352351
if (count($menusList) > 1) {
353352
// display menu options (if more than 1 menu available
354353
if (!($linksObj->getVar('mid'))) { // initial menu value not set
355-
$menuValues = array_flip($menusList);
354+
// $menuValues = array_flip($menusList);
356355
$formmid = new XoopsFormSelect(_AM_MYMENUS_MENU_MENU, 'mid', $mid);//array_shift($menuValues));
357356
} else {
358357
$formmid = new XoopsFormSelect(_AM_MYMENUS_MENU_MENU, 'mid', $linksObj->getVar('mid'));
@@ -432,7 +431,7 @@ public static function mymenusAdminForm($id = null, $pid = null, $mid = null)
432431
*
433432
* Update the {@see MymenusLinks} weight (order)
434433
*
435-
* @param integer $id of links object
434+
* @param integer $id of links object
436435
* @param integer $weight
437436
*/
438437
public static function mymenusAdminMove($id, $weight)

mymenus/admin/menu.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
* @version $Id: menu.php
1919
*/
2020

21-
if(!defined('XOOPS_ROOT_PATH')) {
22-
throw new Exception('XOOPS root path not defined');
23-
}
21+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
2422

2523
$moduleDirName = basename(dirname(__DIR__));
2624
$moduleHandler = &xoops_gethandler("module");

mymenus/blocks/mymenus_block.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
* @version $Id: mymenus_block.php
1818
*/
1919

20-
if (!defined('XOOPS_ROOT_PATH')) {
21-
throw new Exception('XOOPS root path not defined');
22-
}
20+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
21+
2322
include_once dirname(__DIR__) . '/include/common.php';
2423

2524
/**
@@ -165,6 +164,7 @@ function mymenus_block_show($options)
165164
$registry->unsetAll();
166165
unset($registry, $plugin);
167166
$xoopsLogger->stopTime('My Menus Block');
167+
168168
return $block;
169169
}
170170

@@ -187,6 +187,7 @@ function mymenus_block_edit($options)
187187
unset($menusCriteria);
188188
if (0 == count($menusList)) {
189189
$form = "<a href='" . $GLOBALS['xoops']->url("modules/{$mymenus->dirname}/admin/menus.php") . "'>" . _AM_MYMENUS_MSG_NOMENUS . "</a>\n";
190+
190191
return $form;
191192
}
192193
$form = "<b>" . _MB_MYMENUS_SELECT_MENU . "</b>&nbsp;";
@@ -196,7 +197,7 @@ function mymenus_block_edit($options)
196197
$form .= "</select>\n&nbsp;<i>" . _MB_MYMENUS_SELECT_MENU_DSC . "</i>\n<br /><br />\n";
197198
// option 1: moduleSkin
198199
xoops_load('XoopsLists');
199-
$tempModuleSkinsList = XoopsLists::getDirListAsArray($GLOBALS['xoops']->path("/modules/{$mymenus->dirname}/skins/"), '');
200+
$tempModuleSkinsList = XoopsLists::getDirListAsArray($GLOBALS['xoops']->path("modules/{$mymenus->dirname}/skins/"), '');
200201
$moduleSkinsList = array();
201202
foreach ($tempModuleSkinsList as $key => $moduleSkin) {
202203
if (file_exists($GLOBALS['xoops']->path("modules/{$mymenus->dirname}/skins/{$moduleSkin}/skin_version.php"))) {

mymenus/class/links.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
* @version $Id: links.php 12944 2015-01-23 13:05:09Z beckmi $
1919
*/
2020

21-
if(!defined('XOOPS_ROOT_PATH')) {
22-
throw new Exception('XOOPS root path not defined');
23-
}
21+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
22+
2423
include_once dirname(__DIR__) . '/include/common.php';
2524

2625
/**

mymenus/class/menus.php

+7-9
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
* @version $Id: menus.php 0 2010-07-21 18:47:04Z trabis $
1919
*/
2020

21-
if(!defined('XOOPS_ROOT_PATH')) {
22-
throw new Exception('XOOPS root path not defined');
23-
}
21+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
2422

2523
include_once dirname(__DIR__) . '/include/common.php';
2624

@@ -50,22 +48,22 @@ public function __construct()
5048
/**
5149
* Get {@link XoopsThemeForm} for adding/editing items
5250
*
53-
* @param bool $action
54-
* @return object {@link XoopsThemeForm}
51+
* @param bool $action
52+
* @return object {@link XoopsThemeForm}
5553
*/
5654
public function getForm($action = false)
5755
{
58-
$grouppermHandler = xoops_gethandler('groupperm');
56+
// $grouppermHandler = xoops_gethandler('groupperm');
5957
//
6058
xoops_load('XoopsFormLoader');
6159
//
6260
if ($action === false) {
6361
// $action = $_SERVER['REQUEST_URI'];
64-
$action = XoopsRequest::getString('REQUEST_URI','', 'SERVER');
62+
$action = XoopsRequest::getString('REQUEST_URI', '', 'SERVER');
6563
}
6664
//
67-
$isAdmin = mymenusUserIsAdmin();
68-
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
65+
// $isAdmin = mymenusUserIsAdmin();
66+
// $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
6967
//
7068
$title = $this->isNew() ? _AM_MYMENUS_MENUS_ADD : _AM_MYMENUS_MENUS_EDIT;
7169
//

mymenus/class/mymenus.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
* @version svn:$id$
2020
*/
2121

22-
if(!defined('XOOPS_ROOT_PATH')) {
23-
throw new Exception('XOOPS root path not defined');
24-
}
22+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
2523

2624
/**
2725
* Class MymenusMymenus

mymenus/class/plugin.php

+12-10
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
* @version $Id: plugin.php 12944 2015-01-23 13:05:09Z beckmi $
1919
*/
2020

21-
if (!defined('XOOPS_ROOT_PATH')) {
22-
throw new Exception('XOOPS root path not defined');
23-
}
21+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
22+
2423
include_once dirname(__DIR__) . '/include/common.php';
2524
xoops_load('XoopsLists');
2625
include_once $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/class/registry.php");
@@ -65,7 +64,7 @@ public static function &getInstance()
6564
public function setPlugins()
6665
{
6766
if (is_dir($dir = $GLOBALS['xoops']->path("modules/{$this->mymenus->dirname}/plugins/"))) {
68-
$pluginsList = XoopsLists::getDirListAsArray($dir, '');
67+
$pluginsList = XoopsLists::getDirListAsArray($dir);
6968
foreach ($pluginsList as $plugin) {
7069
if (file_exists($GLOBALS['xoops']->path("modules/{$this->mymenus->dirname}/plugins/{$plugin}/{$plugin}.php"))) {
7170
$this->plugins[] = $plugin;
@@ -77,7 +76,7 @@ public function setPlugins()
7776
public function setEvents()
7877
{
7978
foreach ($this->plugins as $plugin) {
80-
include_once $GLOBALS['xoops']->path("/modules/{$this->mymenus->dirname}/plugins/{$plugin}/{$plugin}.php");
79+
include_once $GLOBALS['xoops']->path("modules/{$this->mymenus->dirname}/plugins/{$plugin}/{$plugin}.php");
8180
$className = ucfirst($plugin) . 'MymenusPluginItem';
8281
if (!class_exists($className)) {
8382
continue;
@@ -123,11 +122,14 @@ public function loadLanguage($name)
123122
{
124123
$mymenus = MymenusMymenus::getInstance();
125124
$language = $GLOBALS['xoopsConfig']['language'];
126-
$path = $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/plugins/{$name}/language");
127-
if (!($ret = @include_once "{$path}/{$language}/{$name}.php")) {
128-
$ret = @include_once "{$path}/english/{$name}.php";
129-
}
125+
// $path = $GLOBALS['xoops']->path("modules/{$mymenus->dirname}/plugins/{$name}/language");
126+
// if (!($ret = @include_once "{$path}/{$language}/{$name}.php")) {
127+
// $ret = @include_once "{$path}/english/{$name}.php";
128+
// }
129+
// return $ret;
130130

131-
return $ret;
131+
$path2 = "{$mymenus->dirname}/plugins/{$name}/{$language}/";
132+
xoops_loadLanguage($name, $path2);
133+
return true;
132134
}
133135
}

mymenus/class/registry.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
* @version $Id: registry.php 12944 2015-01-23 13:05:09Z beckmi $
1919
*/
2020

21-
if(!defined('XOOPS_ROOT_PATH')) {
22-
throw new Exception('XOOPS root path not defined');
23-
}
21+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
2422

2523
/**
2624
* Class MymenusRegistry

mymenus/docs/changelog.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<u>Version 1.51 RC 3 (2015-02-27)</u>
2+
- reverting "throw new Exception" for XOOPS_ROOT_PATH check (zyspec/mamba)
3+
14
<u>Version 1.51 RC 2 (2015-02-27)</u>
25
- added check for empty $options[5] element (mamba)
36
- more PSR-2 updates (mamba)

mymenus/include/common.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
* @version svn:$id$
2020
*/
2121

22-
if(!defined('XOOPS_ROOT_PATH')) {
23-
throw new Exception('XOOPS root path not defined');
24-
}
22+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
2523

2624
// This must contain the name of the folder in which reside mymenus
2725
define("MYMENUS_DIRNAME", basename(dirname(__DIR__)));

mymenus/include/config.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22

3-
if(!defined('XOOPS_ROOT_PATH')) {
4-
throw new Exception('XOOPS root path not defined');
5-
}
3+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
64

75
// module information
86
$moduleImageUrl = MYMENUS_URL . "/assets/images/mymenus.png";

mymenus/include/functions.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
* @version $Id: functions.php 0 2010-07-21 18:47:04Z trabis $
1919
*/
2020

21-
if(!defined('XOOPS_ROOT_PATH')) {
22-
throw new Exception('XOOPS root path not defined');
23-
}
21+
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
22+
2423
include_once __DIR__ . '/common.php';
2524

2625
/**
@@ -38,6 +37,7 @@ function mymenusUserIsAdmin()
3837
}
3938

4039
$mymenusIsAdmin = (!is_object($GLOBALS['xoopsUser'])) ? false : $GLOBALS['xoopsUser']->isAdmin($mymenus->getModule()->getVar('mid'));
40+
4141
return $mymenusIsAdmin;
4242
}
4343

@@ -52,7 +52,7 @@ function mymenusGetSkinInfo($moduleSkin = 'default', $useThemeSkin = false, $the
5252
{
5353
include_once __DIR__ . '/common.php';
5454
$mymenus = MymenusMymenus::getInstance();
55-
$error = false;
55+
$error = false;
5656
if ($useThemeSkin) {
5757
$path = "themes/" . $GLOBALS['xoopsConfig']['theme_set'] . "/menu";
5858
if (!file_exists($GLOBALS['xoops']->path("{$path}/skin_version.php"))) {

0 commit comments

Comments
 (0)