Beispiel #1
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 #2
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);
}