Skip to content

Commit

Permalink
Update for use in XOOPS/XoopsCore25 2.5.11
Browse files Browse the repository at this point in the history
  • Loading branch information
geekwright committed Feb 15, 2021
1 parent 1dbcd95 commit a99c7d6
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 41 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
xWhoops
=======
xWhoops25
=========

A XOOPS 2.6.0 extension that brings [whoops](https://github.com/filp/whoops) error display to XOOPS. It is especially handy for diagnosing failures brought on by unhandled errors, so you can more properly handle them.
A XOOPS 2.5.11+ extension that brings [whoops](https://github.com/filp/whoops) error display to XOOPS. It is especially handy for diagnosing failures brought on by unhandled errors, so you can more properly handle them.

Administrators will always have access to the extended diagnotics, and other groups can also be granted access.

Outside of the control panel, there is no user interface. It will "just work" when needed.

To add *xwhoops* to your XoopsCore use:
```
composer require geekwright/xwhoops
```
To add *xwhoops25* to your XoopsCore25, follow these steps
- download the distribution archive of your choice
- explode the archive into your system's modules directory
- rename the new directory to xwhoops25
- open a terminal into that folder and execute
```composer install```
- install the xwhoops25 module in the system administration module page
2 changes: 1 addition & 1 deletion admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Xmf\Module\Admin;

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
Expand Down
4 changes: 2 additions & 2 deletions admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*/

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/

$xoops->footer();
xoops_cp_footer();
21 changes: 17 additions & 4 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,25 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

use Xmf\Language;

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/

require_once dirname(__DIR__, 3) . '/include/cp_header.php';
$xoops = Xoops::getInstance();
$xoops->header();
$path = dirname(__DIR__, 3);
require_once $path . '/mainfile.php';
require_once $path . '/include/cp_functions.php';
require_once $path . '/include/cp_header.php';

class_exists('\Xmf\Module\Admin') or die('XMF is required.');

global $xoopsModule;

$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname');

Language::load('main', $thisModuleDir);

xoops_cp_header();
2 changes: 1 addition & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Xmf\Module\Admin;

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
Expand Down
14 changes: 7 additions & 7 deletions admin/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
Expand All @@ -36,10 +36,10 @@
'title' => _MI_XWHOOPS_ADMENU2 ,
'link' => 'admin/about.php' ,
'icon' => $pathIcon32.'about.png'
) ;

);
// Permissions
$adminmenu[] = array(
'title' => _MI_XWHOOPS_ADMENU3 ,
'link' => 'admin/permissions.php' ,
'icon' => 'permissions.png'
) ;
'title' => _MI_XWHOOPS_ADMENU3 ,
'link' => 'admin/permissions.php' ,
'icon' => $pathIcon32.'permissions.png'
);
16 changes: 10 additions & 6 deletions admin/permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
Expand All @@ -24,6 +24,8 @@

include_once __DIR__ . '/admin_header.php';

require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';

$moduleAdmin = Admin::getInstance();
$moduleAdmin->displayNavigation('permissions.php');

Expand All @@ -35,14 +37,16 @@
$permissionItemId=0;

// if this is a post operation get our variables
if ('POST'===Request::getMethod()) {
if ('POST' === Request::getMethod()) {
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
}
$name=$permHelper->defaultFieldName($permissionName, $permissionItemId);
$groups=Request::getVar($name, array(), 'POST');
$permHelper->savePermissionForItem($permissionName, $permissionItemId, $groups);
echo $xoops->alert('success', _MA_XWHOOPS_FORM_PROCESSED, _MA_XWHOOPS_PERMISSION_FORM);
xoops_result(_MA_XWHOOPS_FORM_PROCESSED, _MA_XWHOOPS_PERMISSION_FORM);
}

$form = new \Xoops\Form\ThemeForm(_MA_XWHOOPS_PERMISSION_FORM, 'form', '', 'POST');
$form = new XoopsThemeForm(_MA_XWHOOPS_PERMISSION_FORM, 'form', '', 'POST', true);
$permElement = $permHelper->getGroupSelectFormForItem(
$permissionName,
$permissionItemId,
Expand All @@ -52,7 +56,7 @@
);

$form->addElement($permElement);
$form->addElement(new \Xoops\Form\Button('', 'submit', _MA_XWHOOPS_FORM_SUBMIT, 'submit'));
$form->addElement(new XoopsFormButton('', 'submit', _MA_XWHOOPS_FORM_SUBMIT, 'submit'));

echo $form->render();
}
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "geekwright/xwhoops",
"license": "GPL-2.0+",
"type": "xoops-module",
"description": "Whoops for XOOPS",
"description": "Whoops for XoopsCore25",
"require": {
"xoops/module-installer-plugin": "^1.1",
"filp/whoops": "^2.1"
},
"require-dev": {
"roave/security-advisories": "dev-master"
}
}
7 changes: 4 additions & 3 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
v0.1.0
=================================
- Original release of xWhoops
v0.2
================================
- Forked from geekwright/xwhoops
- Adapted to XoopsCore25
2 changes: 1 addition & 1 deletion language/english/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
Expand Down
2 changes: 1 addition & 1 deletion language/english/modinfo.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
Expand Down
12 changes: 8 additions & 4 deletions preloads/core.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php

use Xmf\Module\Helper\Permission;
use Xoops\Core\PreloadItem;


/**
* @copyright 2019 XOOPS Project (https://xoops.org)
* @copyright 2019-2021 XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author Richard Griffith <[email protected]>
*/
class XwhoopsPreload extends PreloadItem
class Xwhoops25CorePreload extends XoopsPreloadItem
{
/**
* eventCoreIncludeCommonAuthSuccess
Expand All @@ -18,7 +17,12 @@ class XwhoopsPreload extends PreloadItem
*/
public static function eventCoreIncludeCommonAuthSuccess()
{
$permissionHelper = new Permission('xwhoops');
$autoloader = dirname(__DIR__) . '/vendor/autoload.php';
if (!file_exists($autoloader)) {
trigger_error("xwhoops25/vendor/autoload.php not found, was 'composer install' done?");
}
require_once $autoloader;
$permissionHelper = new Permission('xwhoops25');
if ($permissionHelper) {
$permissionName = 'use_xwhoops';
$permissionItemId = 0;
Expand Down
5 changes: 3 additions & 2 deletions xoops_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$modversion['nickname'] = 'geekwright';
$modversion['credits'] = 'The XOOPS Project';
$modversion['help'] = 'page=help';
$modversion['website'] = 'https://github.com/geekwright/xwhoops25';
$modversion['license'] = 'GNU GPL 2 or later';
$modversion['license_url'] = 'https://www.gnu.org/licenses/gpl-2.0.html';
$modversion['official'] = 0;
Expand All @@ -39,7 +40,7 @@
// About stuff
$modversion['module_status'] = 'Alpha';
$modversion['status'] = 'Alpha';
$modversion['release_date'] = '02/19/2019';
$modversion['release_date'] = '2021/02/14';

$modversion['min_xoops'] = '2.6.0';
$modversion['min_xoops'] = '2.5.11';
$modversion['min_php'] = '7.1.0';

0 comments on commit a99c7d6

Please sign in to comment.