Beispiel #1
0
 function test_options()
 {
     $payments = Appconf::options('payments');
     $this->assertEquals(true, is_array($payments));
     $acl = Appconf::options('acl');
     $this->assertEquals(true, in_array('filemanager', array_keys($acl)));
     $this->assertEquals('Upload and manage files', $acl['filemanager']);
     $this->assertEquals(true, in_array('user/roles', array_keys($acl)));
     $commands = Appconf::options('cli', 'commands');
     $expected_commands = array('api/create-token' => 'Generate or reset an API token and secret key for a user.', 'api/get-token' => 'Fetch or generate an API token and secret key for a user.', 'blog/publish-queue' => 'Publish scheduled blog posts.');
     foreach ($expected_commands as $command => $name) {
         $this->assertEquals(true, in_array($command, array_keys($commands)));
         $this->assertEquals($name, $commands[$command]);
     }
 }
Beispiel #2
0
/**
 * Returns a list of pages that are not in the navigation.
 */
function navigation_get_other_pages($ids)
{
    $pages = array();
    $res = DB::fetch("select id, title, menu_title, access from #prefix#webpage where access != 'private'");
    //Adds apps to Navigation, the new way
    $nav = Appconf::options('nav');
    foreach ($nav as $id => $title) {
        $appObj = new StdClass();
        $appObj->id = $id;
        $appObj->title = $title;
        $res[] = $appObj;
    }
    // Add apps to Navigation, the old way
    $apps = glob('apps/*');
    foreach ($apps as $app) {
        $app = str_replace('apps/', '', $app);
        $ini = Appconf::get($app);
        foreach ($ini as $section) {
            if (array_key_exists('include_in_nav', $section) && $section['include_in_nav'] && array_key_exists('title', $section) && $section['title'] != '') {
                $appObj = new stdClass();
                if (!in_array($section['include_in_nav'], array('1', 1, true), true)) {
                    $appObj->id = ltrim($section['include_in_nav'], '/');
                } else {
                    $appPath = explode('/', $app);
                    $appObj->id = $appPath[0];
                }
                $appObj->title = $section['title'];
                $appObj->menu_title = array_key_exists('menu_title', $section) ? $section['menu_title'] : $section['title'];
                $res[] = $appObj;
                break;
            }
        }
    }
    foreach ($res as $p) {
        if (in_array($p->id, $ids)) {
            // skip if in tree
            continue;
        }
        if (!empty($p->menu_title)) {
            $pages[$p->id] = $p->menu_title;
        } else {
            $pages[$p->id] = $p->title;
        }
    }
    uasort($pages, function ($a, $b) {
        if ($a === $b) {
            return 0;
        }
        return $a < $b ? -1 : 1;
    });
    return $pages;
}
Beispiel #3
0
$page->layout = 'admin';

$this->require_acl ('admin', 'user');

if (! isset ($_GET['id'])) {
	$this->redirect ('/user/admin');
}

$user = new User ($_GET['id']);
if ($user->error) {
	$page->title = __ ('Account not found');
	printf ('<p><a href="/user/admin">&laquo; %s</a></p>', __ ('Back'));
	return;
}

$user = $user->orig ();

$tabs = Appconf::options ('user');
foreach ($tabs as $handler => $name) {
	$user->tabs[$name] = $this->run ($handler, array ('user' => $user->id));
}

$page->title = Template::sanitize ($user->name);
$page->add_style ('/apps/user/css/details.css');
$page->add_script ('/js/jquery-ui/jquery-ui.min.js');
$page->add_script ('/apps/user/js/jquery.tools.min.js');
$page->add_script ('/apps/user/js/react/react.js');
$page->add_script ('/apps/user/js/build/links.js');
$page->add_script ('/apps/user/js/build/notes.js');
echo $tpl->render ('user/details', $user);