Esempio n. 1
0
        $httpsUrl = $host . $_SERVER['REQUEST_URI'];
        header('Location: ' . $httpsUrl);
        exit;
    }
}
$users = getUsers();
$currentUserInfo = getCurrentUserInfo($users);
// Cache buster
$git = __DIR__ . '/.git';
$cacheBuster = Directus\Util\Git::getCloneHash($git);
$tableSchema = TableSchema::getAllSchemas($currentUserInfo['group']['id'], $cacheBuster);
// $tabPrivileges = getTabPrivileges(($currentUserInfo['group']['id']));
$groupId = $currentUserInfo['group']['id'];
$groups = getGroups();
$currentUserGroup = array();
if (isset($groups['rows']) && count($groups['rows'] > 0)) {
    foreach ($groups['rows'] as $group) {
        if ($group['id'] === $groupId) {
            $currentUserGroup = $group;
            break;
        }
    }
}
$statusMapping = array('active_num' => STATUS_ACTIVE_NUM, 'deleted_num' => STATUS_DELETED_NUM, 'status_name' => STATUS_COLUMN_NAME);
$statusMapping['mapping'] = $config['statusMapping'];
$data = array('cacheBuster' => $cacheBuster, 'nonces' => getNonces(), 'storage_adapters' => getStorageAdapters(), 'path' => DIRECTUS_PATH, 'page' => '#tables', 'tables' => parseTables($tableSchema), 'preferences' => parsePreferences($tableSchema), 'users' => $users, 'groups' => $groups, 'settings' => getSettings(), 'active_files' => getActiveFiles(), 'authenticatedUser' => $authenticatedUser, 'extensions' => getExtensions($currentUserGroup), 'privileges' => getPrivileges($groupId), 'ui' => getUI(), 'listViews' => getListViews(), 'messages' => getInbox(), 'bookmarks' => getBookmarks(), 'extendedUserColumns' => getExtendedUserColumns($tableSchema), 'statusMapping' => $statusMapping);
$templateVars = array('cacheBuster' => $cacheBuster, 'data' => json_encode($data), 'path' => DIRECTUS_PATH, 'customFooterHTML' => getCusomFooterHTML(), 'cssFilePath' => getCSSFilePath(), 'cms_color' => '#89c33d');
if (isset($data['settings']) && isset($data['settings'][0]) && isset($data['settings'][0]['cms_color'])) {
    $templateVars['cms_color'] = $data['settings'][0]['cms_color'];
}
echo template(file_get_contents('main.html'), $templateVars);
Esempio n. 2
0
<?php

require_once 'preload.inc';
$Json = array();
$Json['Extensions'] = MustacheReformatExtensions(getExtensions());
$Json['NoExtensionErrorMessage'] = getNoExtensionErrorMessage();
$Json['RingGroups'] = getRingGroups();
$Json['Queues'] = getQueues();
$Json['DeletedExtensions'] = getDeletedExtensions();
$Json['License'] = $fonb->getTotalUsersAllowed();
echo json_encode($Json);
Esempio n. 3
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
function getExtensions()
{
    global $LANG;
    global $dbh;
    global $auth_session;
    $sql = "SELECT * FROM si_extensions WHERE domain_id = 0 OR domain_id = :domain_id ORDER BY name";
    $sth = dbQuery($sql, ':domain_id', $auth_session->domain_id) or die(htmlsafe(end($dbh->errorInfo())));
    $exts = null;
    for ($i = 0; $ext = $sth->fetch(); $i++) {
        $exts[$i] = $ext;
    }
    return $exts;
}
isset($_GET['id']) && ($extension_id = $_GET['id']);
isset($_GET['action']) && ($action = $_GET['action']);
if ($action == 'toggle') {
    setStatusExtension($extension_id) or die(htmlsafe("Something went wrong with the status change!"));
}
$smarty->assign("exts", getExtensions());
$smarty->assign('pageActive', 'setting');
$smarty->assign('active_tab', '#setting');
$smarty->assign('subPageActive', 'setting_extensions');
Esempio n. 4
0
// @NOTE: if the user doesn't have permission to view users
// it should be log out
// see: https://github.com/directus/directus/issues/1268
if (!$users) {
    AuthProvider::logout();
    $_SESSION['error_message'] = 'Your user doesn\'t have permission to log in';
    header('Location: ' . DIRECTUS_PATH . 'login.php');
    exit;
}
$currentUserInfo = getCurrentUserInfo($users);
// Cache buster
$git = __DIR__ . '/.git';
$cacheBuster = Directus\Util\Git::getCloneHash($git);
$tableSchema = TableSchema::getAllSchemas($currentUserInfo['group']['id'], $cacheBuster);
// $tabPrivileges = getTabPrivileges(($currentUserInfo['group']['id']));
$groupId = $currentUserInfo['group']['id'];
$groups = getGroups();
$currentUserGroup = [];
if (isset($groups['rows']) && count($groups['rows'] > 0)) {
    foreach ($groups['rows'] as $group) {
        if ($group['id'] === $groupId) {
            $currentUserGroup = $group;
            break;
        }
    }
}
$statusMapping = ['active_num' => STATUS_ACTIVE_NUM, 'deleted_num' => STATUS_DELETED_NUM, 'status_name' => STATUS_COLUMN_NAME];
$statusMapping['mapping'] = $config['statusMapping'];
$data = ['cacheBuster' => $cacheBuster, 'nonces' => getNonces(), 'storage_adapters' => getStorageAdapters(), 'path' => DIRECTUS_PATH, 'page' => '#tables', 'tables' => parseTables($tableSchema), 'preferences' => parsePreferences($tableSchema), 'users' => $users, 'groups' => $groups, 'settings' => getSettings(), 'active_files' => getActiveFiles(), 'authenticatedUser' => $authenticatedUser, 'extensions' => getExtensions($currentUserGroup), 'privileges' => getPrivileges($groupId), 'ui' => getUI(), 'locale' => get_user_locale(), 'localesAvailable' => parseLocalesAvailable(get_locales_available()), 'phrases' => get_phrases(get_user_locale()), 'timezone' => get_user_timezone(), 'timezones' => get_timezone_list(), 'listViews' => getListViews(), 'messages' => getInbox(), 'user_notifications' => getLoginNotification(), 'bookmarks' => getBookmarks(), 'extendedUserColumns' => getExtendedUserColumns($tableSchema), 'statusMapping' => $statusMapping];
$templateVars = ['cacheBuster' => $cacheBuster, 'data' => json_encode($data), 'path' => DIRECTUS_PATH, 'locale' => get_user_locale(), 'dir' => 'ltr', 'customFooterHTML' => getCusomFooterHTML(), 'cssFilePath' => getCSSFilePath()];
echo template(file_get_contents('main.html'), $templateVars);
Esempio n. 5
0
<?php

require_once 'preload.inc';
$data = getExtensions() + getRingGroups() + getQueues() + getDeletedExtensions();
// Save the file
$data = removeNonIntSections($data);
$data = removeEmptyPasswords($data);
prepareContext();
//print_r($data);exit;
$fonb->write_users($data);
// Exit with a seccess
exit(DONE);