Ejemplo n.º 1
0
        }
    }
    function handle_event($ev)
    {
        editor_generic::handle_event($ev);
    }
}
$tests_m_array['complex']['test_xml_viewer_test'] = 'test_xml_viewer_test';
#--------------------------------------------------------------------------------------------------------------
//$tbl(id,nodeid,parent,nodename,textvalue)
//$atbl(id,nodeid,attrname,textvalue)
$ddc_tables['xml_editor_nodes'] = (object) array('name' => 'xml_editor_nodes', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Ид'), array('name' => 'nodeid', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'parent', 'sql_type' => 'int(10)', 'sql_null' => 1, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'nodename', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'узел'), array('name' => 'textvalue', 'sql_type' => 'mediumtext', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Текст')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'nodeid', 'sub' => NULL), array('key' => 'parent', 'name' => 'parent', 'sub' => NULL), array('key' => 'nodename', 'name' => 'nodename', 'sub' => NULL)));
$ddc_tables['xml_editor_attributes'] = (object) array('name' => 'xml_editor_attributes', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Ид'), array('name' => 'nodeid', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'attrname', 'sql_type' => 'varchar(200)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Имя'), array('name' => 'textvalue', 'sql_type' => 'mediumtext', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Текст')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'nodeid', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'attrname', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables['xml_editor_nodes'], $sql);
    ddc_gentable_o($ddc_tables['xml_editor_attributes'], $sql);
}
class test_xml_loader extends dom_any
{
    function __construct()
    {
        dom_any::__construct('div');
        $this->etype = get_class($this);
    }
    function bootstrap()
    {
        $this->long_name = editor_generic::long_name();
        $this->attributes['title'] = $this->long_name;
    }
}
class test_xml_loader_test extends dom_any
Ejemplo n.º 2
0
<?php

$ddc_tables['samples_raw'] = (object) array('name' => 'samples_raw', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 1, 'sql_comment' => NULL, 'hname' => 'Идентификатор', 'editor' => 'editor_statictext'), array('name' => 'manufacturer', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Предприятие'), array('name' => 'code', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Обозначение'), array('name' => 'name', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Наименование'), array('name' => 'decoration', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Отделка'), array('name' => 'ordered_by', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Заказчик'), array('name' => 'stored', 'sql_type' => 'varchar(200)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Место хранения'), array('name' => 'comment', 'sql_type' => 'text', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Примечания'), array('name' => 'man_date', 'sql_type' => 'date', 'sql_null' => 0, 'sql_default' => '2010-01-01', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Дата изготовления'), array('name' => 'mtime', 'sql_type' => 'timestamp', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Дата изменения', 'editor' => 'editor_statictext')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'name', 'name' => 'name', 'sub' => NULL), array('key' => 'code', 'name' => 'code', 'sub' => NULL)));
$ddc_tables['samples_attachments'] = (object) array('name' => 'samples_attachments', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Объект'), array('name' => 'aid', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 1, 'sql_comment' => NULL, 'hname' => 'Идентификатор'), array('name' => 'type', 'sql_type' => 'varchar(100)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Тип'), array('name' => 'description', 'sql_type' => 'varchar(255)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Описание'), array('name' => 'filename', 'sql_type' => 'varchar(255)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Имя файла'), array('name' => 'thumb', 'sql_type' => 'varchar(255)', 'sql_null' => 1, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Файл предпросмотра')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'aid', 'sub' => NULL), array('key' => 'filename', 'name' => 'filename', 'sub' => NULL)));
$ddc_tables['samples_tags'] = (object) array('name' => 'samples_tags', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Объект'), array('name' => 'tagid', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_sequence' => 1, 'hname' => 'id'), array('name' => 'tagname', 'sql_type' => 'varchar(200)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0, 'hname' => 'Имя'), array('name' => 'tagvalue', 'sql_type' => 'varchar(255)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0, 'hname' => 'Значение')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'tagid', 'sub' => NULL), array('key' => 'tagname', 'name' => 'tagname', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables['samples_raw'], $sql);
    ddc_gentable_o($ddc_tables['samples_attachments'], $sql);
    ddc_gentable_o($ddc_tables['samples_tags'], $sql);
}
class samples_db_list extends dom_div
{
    function __construct()
    {
        parent::__construct();
        $this->etype = get_class($this);
        editor_generic::addeditor('ed_filters', new sdb_filters());
        editor_generic::addeditor('ed_filters_tags', new sdb_filters_tags());
        editor_generic::addeditor('ed_order', new sdb_order());
        editor_generic::addeditor('ed_filters_count', new sdb_filters_count());
        editor_generic::addeditor('ed_filters_tags_count', new sdb_filters_count());
        editor_generic::addeditor('ed_order_count', new sdb_filters_count());
        editor_generic::addeditor('ed_pager', new util_small_pager());
        editor_generic::addeditor('ed_row_num', new sdb_QNUM());
        editor_generic::addeditor('ed_list', new sdb_QR());
        if ($_SESSION['interface'] != 'samples_view') {
            editor_generic::addeditor('ed_new', new editor_button());
            $this->editors['ed_new']->attributes['value'] = 'Добавить';
        }
        editor_generic::addeditor('ed_download', new sdb_DL());
        $this->link_nodes();
Ejemplo n.º 3
0
<?php

set_include_path($_SERVER['DOCUMENT_ROOT']);
require_once 'lib/ddc_meta.php';
require_once 'lib/settings.php';
require_once 'lib/commctrls.php';
$ddc_tables[TABLE_META_TREE_TMP] = clone $ddc_tables[TABLE_META_TREE];
$ddc_tables[TABLE_META_TREE_TMP]->name = TABLE_META_TREE_TMP;
$ddc_tables[TABLE_META_TREE_SELECTIONS] = (object) array('name' => TABLE_META_TREE_SELECTIONS, 'cols' => array(array('name' => 'id', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'uid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'folded', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'selected', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables[TABLE_META_TREE_SELECTIONS], $sql);
    ddc_gentable_o($ddc_tables[TABLE_META_TREE_TMP], $sql);
}
class editor_meta_tree extends dom_div
{
    function __construct()
    {
        parent::__construct();
        $this->etype = get_class($this);
        $this->global_actions = new dom_div();
        $this->append_child($this->global_actions);
        $tbl = new dom_table_x(2, 1);
        $this->append_child($tbl);
        editor_generic::addeditor('state_view', new EMT_state_view());
        $tbl->cells[0][0]->append_child($this->editors['state_view']);
        editor_generic::addeditor('nodes', new container_resize_scroll());
        $tbl->cells[0][0]->append_child($this->editors['nodes']);
        //$this->editors['nodes']->css_style['vertical-align']='top';
        $tbl->cells[0][0]->css_style['vertical-align'] = 'top';
        $this->nodes_container = new dom_div();
        $this->editors['nodes']->append_child($this->nodes_container);
Ejemplo n.º 4
0
<?php

$ddc_tables['keyboard_test'] = (object) array('name' => 'keyboard_test', 'cols' => array(array('name' => 'user-agent', 'sql_type' => 'varchar(100)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0), array('name' => 'testn', 'sql_type' => 'smallint(2)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0), array('name' => 'keypress-result', 'sql_type' => 'text', 'sql_null' => 0), array('name' => 'keydown-result', 'sql_type' => 'text', 'sql_null' => 0), array('name' => 'keyup-result', 'sql_type' => 'text', 'sql_null' => 0), array('name' => 'result', 'sql_type' => 'text', 'sql_null' => 0)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'user-agent', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'testn', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables['keyboard_test'], $sql);
}
class keyboard_test extends dom_div
{
    const TEST_NUM = 4;
    function __construct()
    {
        parent::__construct();
        $this->etype = get_class($this);
        $this->btn = new dom_any('button');
        $this->append_child($this->btn);
        $this->btn->append_child(new dom_statictext('---'));
        $this->append_child(new dom_statictext("Press and hold 'n',Enter,Shift,Arrow down"));
        $this->tbl = new dom_table_x(4, 5);
        $this->tbl->css_class = 'keyboard_test';
        $this->append_child($this->tbl);
        $this->tbl->cells[0][0]->append_child(new dom_statictext('test'));
        $this->tbl->cells[0][1]->append_child(new dom_statictext('keydown'));
        $this->tbl->cells[0][2]->append_child(new dom_statictext('keypress'));
        $this->tbl->cells[0][3]->append_child(new dom_statictext('keyup'));
        $this->tbl->cells[1][0]->append_child(new dom_statictext('alfa'));
        $this->tbl->cells[2][0]->append_child(new dom_statictext('shift'));
        $this->tbl->cells[3][0]->append_child(new dom_statictext('enter'));
        $this->tbl->cells[4][0]->append_child(new dom_statictext('arrow'));
        for ($y = 1; $y <= keyboard_test::TEST_NUM; $y++) {
            for ($x = 1; $x <= 3; $x++) {
                $this->tbl->cells[$y][$x]->append_child(new dom_statictext('did not fire'));
Ejemplo n.º 5
0
<?php

require_once "etc/dbsettings.php";
require_once "sql/my.php";
require_once "lib/base_connect.php";
require_once "lib/ddc_raw.php";
require_once "lib/i18n.php";
require_once "lib/query_select.php";
//settings
//keys: object,setting,uid/gid,presetid
//values: val
//table definition
//	function addcol($name,$type,$null,$default,$extra,$comment)
$ddc_tables[TABLE_META_SETTINGS] = (object) array('name' => TABLE_META_SETTINGS, 'cols' => array(array('name' => 'oid', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0), array('name' => 'setting', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0), array('name' => 'uid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'dsql_efault' => -1, 'sql_sequence' => 0), array('name' => 'preset', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0), array('name' => 'val', 'sql_type' => 'mediumtext', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'oid', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'setting', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'preset', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables[TABLE_META_SETTINGS], $sql);
}
class settings_tool
{
    function single_query($oid, $setting, $uid, $preset, $flags = '')
    {
        global $active_locale;
        if (!isset($active_locale)) {
            $active_locale = 'RU';
        }
        $q = new query_select();
        $q->add_from('`' . TABLE_META_SETTINGS . '`', 'sets');
        $q->add_what('`sets`.`val`', '');
        if ($flags != '') {
            $q->add_what('`i18n`.`val`', 'name');
            $q->add_from('`' . TABLE_META_I18N . '`', 'i18n');
Ejemplo n.º 6
0
<?php

#require_once('lib/uncommctrls.php');
require_once 'lib/ipp/PrintIPP.php';
$ddc_tables['barcodes_raw'] = (object) array('name' => 'barcodes_raw', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 1, 'sql_comment' => NULL, 'hname' => 'Идентификатор'), array('name' => 'name', 'sql_type' => 'varchar(600)', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Наименование'), array('name' => 'code', 'sql_type' => 'varchar(13)', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Код', 'editor' => 'editor_text_ean13'), array('name' => 'isown', 'sql_type' => 'int(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Собственный', 'editor' => 'editor_checkbox')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'name', 'name' => 'name', 'sub' => 100), array('key' => 'code', 'name' => 'code', 'sub' => NULL), array('key' => 'isown', 'name' => 'isown', 'sub' => NULL)));
$ddc_tables['barcodes_print'] = (object) array('name' => 'barcodes_print', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'task', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'count', 'sql_type' => 'int(10)', 'sql_null' => 1, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'printed', 'sql_type' => 'int(10)', 'sql_null' => 1, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'task', 'sub' => NULL)));
$ddc_tables['barcodes_counters'] = (object) array('name' => 'barcodes_counters', 'cols' => array(array('name' => 'uid', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'init', 'sql_type' => 'int(10)', 'sql_null' => 1, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'current', 'sql_type' => 'int(10)', 'sql_null' => 1, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL)));
$ddc_tables['barcodes_printed'] = (object) array('name' => 'barcodes_printed', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'when', 'sql_type' => 'timestamp', 'sql_null' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'count', 'sql_type' => 'int(10)', 'sql_null' => 1, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'id', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'when', 'sub' => NULL)));
$ddc_tables['barcodes_mapping'] = (object) array('name' => 'barcodes_mapping', 'cols' => array(array('name' => 'id', 'sql_type' => 'int(10)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'name', 'sql_type' => 'varchar(200)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL, 'hname' => 'Наименование')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'name', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables['barcodes_raw'], $sql);
    ddc_gentable_o($ddc_tables['barcodes_print'], $sql);
    ddc_gentable_o($ddc_tables['barcodes_counters'], $sql);
    ddc_gentable_o($ddc_tables['barcodes_printed'], $sql);
    ddc_gentable_o($ddc_tables['barcodes_mapping'], $sql);
}
class query_result_viewer_single extends dom_any
{
    function __construct()
    {
        dom_any::__construct('span');
        $this->etype = 'query_result_viewer_single';
        $this->txt = new dom_statictext();
        $this->append_child($this->txt);
        $this->main = $this;
    }
    function bootstrap()
    {
        $this->long_name = editor_generic::long_name();
        if (!isset($this->attributes['title'])) {
            $this->attributes['title'] = $this->long_name;
Ejemplo n.º 7
0
<?php

require_once "etc/dbsettings.php";
require_once "sql/my.php";
require_once "lib/base_connect.php";
require_once "lib/ddc_raw.php";
$ddc_tables[TABLE_META_I18N] = (object) array('name' => TABLE_META_I18N, 'cols' => array(array('name' => 'object', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0), array('name' => 'var', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0), array('name' => 'loc', 'sql_type' => 'varchar(10)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0), array('name' => 'val', 'sql_type' => 'mediumtext', 'sql_null' => 1, 'sql_default' => NULL, 'sql_sequence' => 0)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'object', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'var', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'loc', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables[TABLE_META_I18N], $sql);
}
function loc_get_val($oid, $var, $fallback)
{
    global $sql;
    //implement string cache????
    $res = $sql->query('SELECT val FROM `' . TABLE_META_I18N . '` WHERE object=\'' . $sql->esc($oid) . '\' AND var=\'' . $sql->esc($var) . '\' AND loc=\'' . $sql->esc($_SESSION['lang']) . '\'');
    if ($row = $sql->fetcha($res)) {
        $sql->free($res);
        return $row['val'];
    } else {
        return $fallback;
    }
}
Ejemplo n.º 8
0
require_once "lib/base_connect.php";
require_once "lib/ddc_raw.php";
require_once 'lib/dom.php';
require_once 'lib/settings.php';
//$_SESSION['sql_design']=true;
$_SESSION['lang'] = 'ru';
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$ddc_tables[TABLE_META_USERS] = (object) array('name' => TABLE_META_USERS, 'cols' => array(array('name' => 'uid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 1, 'sql_comment' => NULL), array('name' => 'name', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => 'dummy', 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'pass', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => md5('dummy'), 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_password_md5'), array('name' => 'reflink', 'sql_type' => 'bigint(20)', 'sql_null' => 1, 'sql_default' => NULL), array('name' => 'interface', 'sql_type' => 'varchar(100)', 'sql_null' => 0, 'sql_default' => ''), array('name' => 'isgroup', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox'), array('name' => 'isactive', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL)));
$ddc_tables[TABLE_META_GROUPS] = (object) array('name' => TABLE_META_GROUPS, 'cols' => array(array('name' => 'uid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'gid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'gid', 'sub' => NULL)));
$ddc_tables[TABLE_META_PERMISSIONS] = (object) array('name' => TABLE_META_PERMISSIONS, 'cols' => array(array('name' => 'uid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'oid', 'sql_type' => 'varchar(64)', 'sql_null' => 0, 'sql_default' => 'dummy', 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'read', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox_st1'), array('name' => 'write', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox_st1'), array('name' => 'update', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox_st1'), array('name' => 'insert', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox_st1'), array('name' => 'delete', 'sql_type' => 'tinyint(1)', 'sql_null' => 0, 'sql_default' => 0, 'sql_sequence' => 0, 'sql_comment' => NULL, 'editor' => 'editor_checkbox_st1')), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'oid', 'sub' => NULL)));
$ddc_tables[TABLE_META_AUTHLOG] = (object) array('name' => TABLE_META_AUTHLOG, 'cols' => array(array('name' => 'uid', 'sql_type' => 'bigint(20)', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'date_in', 'sql_type' => 'timestamp', 'sql_null' => 0, 'sql_default' => NULL, 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'ip', 'sql_type' => 'varchar(16)', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL), array('name' => 'useragent', 'sql_type' => 'text', 'sql_null' => 0, 'sql_default' => '', 'sql_sequence' => 0, 'sql_comment' => NULL)), 'keys' => array(array('key' => 'PRIMARY', 'name' => 'uid', 'sub' => NULL), array('key' => 'PRIMARY', 'name' => 'date_in', 'sub' => NULL)));
if ($_GET['init'] == 'init') {
    ddc_gentable_o($ddc_tables[TABLE_META_USERS], $sql);
    ddc_gentable_o($ddc_tables[TABLE_META_GROUPS], $sql);
    ddc_gentable_o($ddc_tables[TABLE_META_PERMISSIONS], $sql);
    ddc_gentable_o($ddc_tables[TABLE_META_AUTHLOG], $sql);
    $sql->query("DELETE FROM `*users` WHERE name='root'");
    $sql->query("INSERT INTO `*users` SET uid='0', name='root', pass='******', isgroup=0, isactive=1");
    $sql->query("UPDATE `*users` SET uid=0 WHERE name='root'");
    $sql->query("INSERT INTO `*users` SET uid='1000', name='test', pass='******', isgroup=0, isactive=1");
}
class auth_handler
{
    function login($user, $pass)
    {
        global $sql;
        //simple auth
        $euser = $sql->esc($user);
        $epass = md5($pass);
        $res = $sql->query("SELECT uid, `interface` FROM `" . TABLE_META_USERS . "` WHERE name='" . $euser . "' AND pass='******' AND isactive=1");
        if ($row = $sql->fetcha($res)) {