Beispiel #1
0
function displayUserForm(&$db, &$editor, $message, $action)
{
    $dbList = $db->getDatabases();
    $userList = $editor->getUsersList();
    $privilegeNames = Privileges::getNames();
    $dbPrivilegeNames = DbPrivileges::getNames();
    // current user name is not plaintext in case of 'update' action
    $userName = '';
    if ($action == 'update') {
        $obj = json_decode(v($_REQUEST['query']));
        if (is_object($obj)) {
            $userName = $obj->username . '@' . $obj->hostname;
        }
    } else {
        $userName = v($_REQUEST['query']);
    }
    $currentUser = selectUser($userList, $userName);
    $privileges = array();
    $dbPrivileges = array();
    $userInfo = array();
    if ($currentUser) {
        $privileges = $currentUser->getGlobalPrivileges();
        foreach ($dbList as $db_name) {
            $dbPrivileges[$db_name] = $currentUser->getDbPrivileges($db_name);
        }
        $userInfo = array('username' => $currentUser->userName, 'host' => $currentUser->host);
    }
    $users = userOptions($userList, $currentUser);
    $replace = array('ID' => v($_REQUEST["id"]) ? htmlspecialchars($_REQUEST["id"]) : '', 'MESSAGE' => $message, 'USERS' => $users, 'USER_INFO' => json_encode($userInfo), 'DATABASES' => json_encode($dbList), 'PRIVILEGES' => json_encode($privileges), 'DB_PRIVILEGES' => json_encode($dbPrivileges), 'PRIVILEGE_NAMES' => json_encode($privilegeNames), 'DB_PRIVILEGE_NAMES' => json_encode($dbPrivilegeNames));
    echo view('usermanager', $replace);
}
Beispiel #2
0
function tbxAboutShow()
{
    Privileges::CheckSuper();
    $output = array();
    $link_removal = LIC_POWEREDBY == 'true' ? 'Not Purchased' : 'Purchased';
    $product = LIC_PRODUCT;
    $licensee = LIC_LICENSEE;
    $domain = LIC_DOMAIN;
    $output['html'] = <<<STUFF
    <div id="dialog-header" class="ui-widget-header ui-corner-all">
      <div id="dialog-close"></div>
      About {$product}
    </div>

    <div id="dialog-panel">
      <div style="padding: 8px;">
        <span style="font-size: 130%; font-weight: bold;">
          This is {$product} version 1.0.1 released on August 4th, 2013
        </span>

        <div class="field">
          <label>Licensee:</label>
          <span class="text-container">All</span>
        </div>

        <div class="field">
          <label>Licensed Domain:</label>
          <span class="text-container">{$domain}</span>
        </div>

        <div class="field">
          <label>Link Removal:</label>
          <span class="text-container">Yes</span>
        </div>

      </div>
    </div>

    <div id="dialog-buttons">
      <input type="button" id="dialog-button-cancel" value="Close" style="margin-left: 10px;" />
    </div>
STUFF;
    JSON::Success($output);
}
Beispiel #3
0
 public function __construct($username, $host, $dbName)
 {
     $this->dbName = trim($dbName);
     parent::__construct($username, $host);
 }
Beispiel #4
0
 public static function setDb($dbManager)
 {
     self::$dbManager = $dbManager;
     Privileges::setDb($dbManager);
 }
Beispiel #5
0
function tbxGenericShowSearch($type)
{
    Privileges::Check(Privileges::FromType($type));
    if ($type == 'search-term') {
        Blacklist::FilterSearchTerms();
    }
    $schema = GetDBSchema();
    $table = $schema->el('//database/table[naming/type="' . $type . '"]')->name->val();
    include_once 'cp-global-search.php';
}
Beispiel #6
0
function tbxGenericShowEdit($type)
{
    Privileges::Check(Privileges::FromType($type));
    $DB = GetDB();
    $schema = GetDBSchema();
    $xtable = $schema->el('//table[naming/type="' . $type . '"]');
    $xnaming = $xtable->naming;
    $table = $xtable->name->val();
    $primary_key = $xtable->columns->primaryKey->val();
    $editing = true;
    $output = array();
    $_REQUEST = $DB->Row('SELECT * FROM # WHERE #=?', array($table, $primary_key, Request::Get('id')));
    // Get user defined fields
    if (!empty($xtable->custom)) {
        $custom_data = $DB->Row('SELECT * FROM # WHERE #=?', array($xtable->custom->val(), $primary_key, Request::Get($primary_key)));
        if (is_array($custom_data)) {
            $_REQUEST = array_merge($custom_data, $_REQUEST);
        }
    }
    $original = $_REQUEST;
    $_REQUEST = String::HtmlSpecialChars($_REQUEST);
    ob_start();
    include "cp-{$type}-add-edit.php";
    IncludeJavascript('js/cp-global-edit.js');
    IncludeJavascript("js/cp-{$type}-edit.js");
    $output['html'] = ob_get_clean();
    JSON::Success($output);
}