mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Expanded on getperms() test.
This commit is contained in:
@@ -1275,7 +1275,7 @@ function check_class($var, $userclass = USERCLASS_LIST, $uid = 0)
|
|||||||
* @param bool|mixed|string $ap
|
* @param bool|mixed|string $ap
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function getperms($arg, $ap = ADMINPERMS)
|
function getperms($arg, $ap = ADMINPERMS, $path = e_SELF)
|
||||||
{
|
{
|
||||||
// $ap = "4"; // Just for testing.
|
// $ap = "4"; // Just for testing.
|
||||||
|
|
||||||
@@ -1294,11 +1294,12 @@ function getperms($arg, $ap = ADMINPERMS)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arg === 'P' && preg_match('#(.*?)/' .e107::getInstance()->getFolder('plugins'). '(.*?)/(.*?)#', e_SELF, $matches))
|
if ($arg === 'P' && preg_match('#(.*?)/' .e107::getInstance()->getFolder('plugins'). '(.*?)/(.*?)#', $path, $matches))
|
||||||
{
|
{
|
||||||
$sql = e107::getDb('psql');
|
$sql = e107::getDb('psql');
|
||||||
|
/* $id = e107::getPlug()->load($matches[2])->getId();
|
||||||
|
$arg = 'P'.$id;*/
|
||||||
|
|
||||||
// FIXME - cache it, avoid sql query here
|
|
||||||
if ($sql->select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' LIMIT 1 "))
|
if ($sql->select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' LIMIT 1 "))
|
||||||
{
|
{
|
||||||
$row = $sql->fetch();
|
$row = $sql->fetch();
|
||||||
|
@@ -12,19 +12,11 @@
|
|||||||
class class2Test extends \Codeception\Test\Unit
|
class class2Test extends \Codeception\Test\Unit
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var ${TESTED_NAME} */
|
|
||||||
protected $ep;
|
|
||||||
|
|
||||||
protected function _before()
|
|
||||||
{
|
|
||||||
|
|
||||||
/*try
|
function testLoadClass2()
|
||||||
{
|
{
|
||||||
$this->ep = $this->make('${TESTED_NAME}');
|
require_once(e_BASE."class2.php"); // already loaded but coverage says otherwise.
|
||||||
} catch(Exception $e)
|
|
||||||
{
|
|
||||||
$this->assertTrue(false, "Couldn't load ${TESTED_NAME} object");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,16 +33,17 @@
|
|||||||
$result = getperms('U1|U2', '0.');
|
$result = getperms('U1|U2', '0.');
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
$pid = e107::getDb()->retrieve('plugin', 'plugin_id', "plugin_path = 'gallery'");
|
$pid = e107::getDb()->retrieve('plugin', 'plugin_id', "plugin_path = 'gallery'");
|
||||||
|
|
||||||
$result = getperms('P', 'P'.$pid);
|
$result = getperms('P', 'P'.$pid);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
|
|
||||||
// define('e_CURRENT_PLUGIN', 'gallery');
|
|
||||||
$result = getperms('P', 'P'.$pid);
|
$result = getperms('P', 'P'.$pid, 'http://localhost/e107v2/e107_plugins/gallery/admin_config.php');
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -461,9 +461,10 @@
|
|||||||
{
|
{
|
||||||
// $this->fixRegistry('before');
|
// $this->fixRegistry('before');
|
||||||
|
|
||||||
|
e107::getUserExt()->init();
|
||||||
$sc = e107::getScBatch('signup');
|
$sc = e107::getScBatch('signup');
|
||||||
|
|
||||||
|
|
||||||
$template = array(
|
$template = array(
|
||||||
'extended-category' => "-- {EXTENDED_CAT_TEXT} --",
|
'extended-category' => "-- {EXTENDED_CAT_TEXT} --",
|
||||||
'extended-user-fields' => "<label>{EXTENDED_USER_FIELD_TEXT}{EXTENDED_USER_FIELD_REQUIRED}</label>" // {EXTENDED_USER_FIELD_EDIT}
|
'extended-user-fields' => "<label>{EXTENDED_USER_FIELD_TEXT}{EXTENDED_USER_FIELD_REQUIRED}</label>" // {EXTENDED_USER_FIELD_EDIT}
|
||||||
|
Reference in New Issue
Block a user