function db_connect()
{
    try {
        $db = new db_class();
        $Connection = $db->connect();
    } catch (Exception $e) {
        echo "Database Connection class not found";
    }
    return $Connection;
}
Ejemplo n.º 2
0
 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
Ejemplo n.º 3
0
 public function si_select($columns = '*', $conditions = '')
 {
     //echo "test0";
     //获取站点信息
     $SiteInfo = parent::db_select('t_siteinfo', $columns = '*', $conditions = '');
     //echo "test";
     //print_r( $SiteInfo );
     return $SiteInfo;
 }
Ejemplo n.º 4
0
 function LoadItems($class, &$db_records)
 {
     $db = db_class::get_instance();
     for ($i = 0; $i < count($db_records); $i++) {
         $collection_item = new $class();
         $collection_item->LoadItem($db_records[$i]);
         $this->_collection[] = $collection_item;
     }
 }
Ejemplo n.º 5
0
 public function Delete()
 {
     if ($this->_v['item_id'] > 0 && $this->_v['file_id'] > 0 && $this->_v['type'] != '') {
         $db = db_class::get_instance();
         $query = 'DELETE FROM "' . TABLE_FILE_ATTACH . '" WHERE "item_id"=\'' . $db->str2base($this->_v['item_id']) . '\' AND "file_id"=\'' . $db->str2base($this->_v['file_id']) . '\' AND "type"=\'' . $db->str2base($this->_v['type']) . '\'';
         $db->query($query);
         return true;
     }
     return false;
 }
Ejemplo n.º 6
0
 public function seli_user($columns = '*', $conditions = '')
 {
     /*
     echo $conditions;
     echo "<br/>";
     */
     //查询用户信息
     $UserInfo = parent::db_select('t_member', $columns, $conditions);
     return $UserInfo;
 }
Ejemplo n.º 7
0
 public function Delete()
 {
     if ($this->_v['id_module_action'] > 0) {
         $db = db_class::get_instance();
         $query = 'DELETE FROM "' . TABLE_MODULE_ACTION . '" WHERE "id_module_action"=\'' . $db->str2base($this->_v['id_module_action']) . '\'';
         $db->query($query);
         return true;
     }
     return false;
 }
Ejemplo n.º 8
0
 public function Delete()
 {
     if ($this->_v['role_id'] > 0 && $this->_v['file_id'] > 0) {
         $db = db_class::get_instance();
         $query = 'DELETE FROM "' . TABLE_FILE_ROLE . '" WHERE "role_id"=\'' . $db->str2base($this->_v['role_id']) . '\' AND "file_id"=\'' . $db->str2base($this->_v['file_id']) . '\'';
         $db->query($query);
         return true;
     }
     return false;
 }
Ejemplo n.º 9
0
 public function Delete()
 {
     if ($this->_v['last_active_date'] > 0 && $this->_v['employee_id'] > 0) {
         $db = db_class::get_instance();
         $query = 'DELETE FROM "' . TABLE_EMPLOYEE_ONLINE . '" WHERE "last_active_date"=\'' . $db->str2base($this->_v['last_active_date']) . '\' AND "employee_id"=\'' . $db->str2base($this->_v['employee_id']) . '\'';
         $db->query($query);
         return true;
     }
     return false;
 }
Ejemplo n.º 10
0
 public function __construct()
 {
     $db = db_class::get_instance();
     $sql = 'SELECT id_module, module FROM ' . TABLE_MODULE;
     $db->query($sql);
     $resources = $db->value;
     $sql = 'SELECT id_role, name FROM ' . TABLE_ROLE;
     $db->query($sql);
     $roles = $db->value;
     $sql = 'SELECT module_action_id, auto_enabled_action_id FROM ' . TABLE_MODULE_AUTO_ACTION;
     $db->query($sql);
     $auto_actions = $db->value;
     $enable_action = array();
     foreach ($auto_actions as $a) {
         $enable_action[$a['module_action_id']][] = $a['auto_enabled_action_id'];
     }
     $res = array();
     foreach ($resources as $r) {
         $resource = new Zend_Acl_Resource($r['module']);
         $this->add($resource);
         $res[$r['id_module']] = $resource;
     }
     foreach ($roles as $r) {
         $role = new Zend_Acl_Role($r['name']);
         $this->addRole($role);
         $this->allow($role, 'news', 'view');
         //Разрешение на просмотр объявлений всем
         $sql = '
                     SELECT id_module_action, action, module_id
                     FROM ' . TABLE_MODULE_ACTION . '
                     RIGHT JOIN ' . TABLE_ROLE_ACTION . ' ON module_action_id=id_module_action
                     WHERE role_id = ' . $r['id_role'] . ' AND public_flag=\'yes\'
                  ';
         $db->query($sql);
         $actions = $db->value;
         foreach ($actions as $a) {
             $this->allow($role, $res[$a['module_id']], $a['action']);
             if (array_key_exists($a['id_module_action'], $enable_action) && count($enable_action[$a['id_module_action']]) > 0) {
                 $sql = '
                             SELECT action, module_id
                             FROM ' . TABLE_MODULE_ACTION . '
                             WHERE id_module_action IN (' . join(',', $enable_action[$a['id_module_action']]) . ') AND public_flag=\'no\'
                         ';
                 $db->query($sql);
                 $auto_actions = $db->value;
                 foreach ($auto_actions as $action) {
                     $this->allow($role, $res[$action['module_id']], $action['action']);
                 }
             }
         }
     }
     $this->allow('Администратор', null, null);
 }
Ejemplo n.º 11
0
 /**
  * class_save_data::save_now()
  * 
  * @param mixed $rdata
  * @return void
  */
 public function save_now($rdata, $reload = "")
 {
     mysql_ping();
     $db = new db_class(EZSQL_DB_USER, EZSQL_DB_PASSWORD, EZSQL_DB_NAME, EZSQL_DB_HOST, true);
     //$db->query("SET NAMES 'utf8'");
     $db->query("SET sql_mode=''");
     mysql_ping();
     #print_r($rdata);
     #exit();
     //durchloopen
     if (is_array($rdata)) {
         foreach ($rdata as $key => $value) {
             //Nur wenn auch ein Dokument vorhanden ist Dann speichern
             if (is_numeric($value['id_int']) && $value['id_int'] > 0) {
                 mysql_ping();
                 //Die Daten aufbereiten
                 $idat = $this->create_basis_daten($value);
                 #debug::print_d($idat);
                 //checken ob schon vorhanden
                 $insert_id = $this->check_vorhanden($idat, $db);
                 //schon vorhanden
                 if (is_numeric($insert_id)) {
                     $this->update_db($idat, $db);
                 } else {
                     $insert_id = $this->insert_db($idat, $db);
                 }
                 //Jetzt die Lookups befüllen
                 $this->insert_lookups($value, $insert_id, $db);
             }
         }
     }
     //DB Page eins raufzählen
     //$this->update_counter($db);
     //Seite neu laden
     if (empty($reload)) {
         $this->reload_page();
     }
     #print_r($rdata);
 }
Ejemplo n.º 12
0
 public function CheckActionEnable(&$STORAGE, $action)
 {
     if (check_current_employee_admin($STORAGE)) {
         return true;
     }
     $db = db_class::get_instance();
     switch ($action) {
         case 'view':
         case 'edit':
         case 'delete':
             return true;
         default:
             return false;
     }
     return false;
 }
Ejemplo n.º 13
0
 public function IsValidData()
 {
     $errors = array();
     if (!is_numeric($this->_v['id_module'])) {
         $errors[] = '[SYSTEM] id_module должно быть числом';
     }
     if (!trim($this->_v['name'])) {
         $errors[] = 'Название роли обязательно к заполнению';
     } else {
         $db = db_class::get_instance();
         $query = 'SELECT "id_module" FROM "' . TABLE_MODULE . '" WHERE ';
         if ($this->_v['id_module'] > 0) {
             $query .= ' id_module!=' . $this->_v['id_module'] . ' AND ';
         }
         $query .= ' "name"=\'' . $this->_v['name'] . '\'';
         $db->query($query);
         if (count($db->value) > 0) {
             $errors[] = 'Роль с таким названием уже существует';
         }
     }
     return $errors;
 }
Ejemplo n.º 14
0
<?php

if (!hasPopedom("database")) {
    exit(_LANG($_AL['admin.nopopedom'], array($_AL['index.data.man'])));
}
$database = new db_class($_DB['hostname'], $_DB['username'], $_DB['password'], $_DB['database']);
$backdir = "backup/" . md5($cache_settings['salt']);
mysql_query("set names utf8");
if (!file_exists($backdir)) {
    create($backdir);
}
echo "<script>var links={}; " . "links.t1='admin.php?inc=database&action=backupform';" . "links.t2='admin.php?inc=database&action=restoreform';" . "links.t3='admin.php?inc=database&action=sqllist';" . "</script>";
switch ($action) {
    /************************************** backupform BEGIN ************************************************/
    case "backupform":
        $tablesopt = '';
        $database->query("show table status from `{$_DB['database']}`");
        while ($database->nextrecord()) {
            if (strpos($database->f('Name'), $_DB['prefix']) === 0) {
            } else {
                continue;
            }
            $tablesopt .= "<option value='" . $database->f('Name') . "'>" . $database->f('Name') . "</option>";
        }
        $_AL['database.b.tips'] = _LANG($_AL['database.b.tips'], array($backdir));
        echo <<<EOT
\t<style>
\t\t.td_1{width:400px; line-height:200%;}
\t</style>
\t<div id="smalltab_container"></div>
\t<div class="smalltab_line"></div>
Ejemplo n.º 15
0
}
if (array_search($sort_dir, $convert_sort_dirs) === false) {
    $sort_dir = 'asc';
}
$additional_vars = 'sort/' . urlencode($sort) . '/sort_dir/' . urlencode($sort_dir);
$pattern = get_request_variable('pattern', '');
if ($pattern != '') {
    $query = 'SELECT COUNT(*) AS num FROM iogetlog(' . $id . ') WHERE date(insert_time) \'' . db_class::escape_like($pattern) . '\';';
} else {
    $query = 'SELECT COUNT(*) AS num  FROM iogetlog(' . $id . ');';
}
$db->query($query);
$all_num = $db->value[0]['num'];
$coms = array();
if ($all_num > 0) {
    if ($pattern != '') {
        $query = 'SELECT * FROM iogetlog(' . $id . ') WHERE date(insert_time) = \'' . db_class::escape_like($pattern) . '\';';
    } else {
        $query = 'SELECT * FROM iogetlog(' . $id . ') ;';
    }
    $db->query($query);
    $coms = $db->value;
}
//TO DO - load operation type from bd
$cats = new collection();
$cats->Load(TABLE_CATEGORIES, false, $where, 'name ASC');
$cats = $cats->_collection;
$page_break = get_page_break(SITE_URI_ROOT . $STORAGE['module'] . '/' . $STORAGE['action'] . '/', $all_num, $from, LIMIT_COMPANY_ON_PAGE, LIMIT_PAGE_ON_PAGE, $additional_vars);
include SITE_FILE_ROOT . 'template/header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/logs.php';
include SITE_FILE_ROOT . 'template/footer.php';
Ejemplo n.º 16
0
<?php

require_once "config.php";
require_once "db.class.php";
$db = new db_class();
$db->connect('localhost', $config['db_user'], $config['db_pwd'], $config['db_name']);
$r = $db->insert_sql('CREATE TABLE IF NOT EXISTS `foaf` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(255) NOT NULL,
  `rdf` blob NOT NULL,
  `rdf2` blob NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1000 ;');
echo "foaf table created in db {$config['db_name']}";
Ejemplo n.º 17
0
<?php

$page_title = 'Выбор информационного объекта';
include SITE_FILE_ROOT . 'template/simple_header.php';
$sort = 'name';
$sort_dir = 'asc';
$pattern = get_request_variable('pattern', '');
$letter = get_request_variable('letter', '');
$_REQUEST['callback'] = get_request_variable('callback', '');
$where = array();
if ($pattern != '') {
    $where[] = '"name" LIKE \'%' . db_class::escape_like($pattern) . '%\'';
    $letter = '';
} elseif ($letter != '') {
    $where[] = '"name" LIKE \'' . db_class::escape_like($letter) . '%\' OR  "name" LIKE \'' . db_class::escape_like(_strtoupper($letter)) . '%\' ';
}
$contact_persons = new collection();
$contact_persons->Load(TABLE_OBJECTS, false, join(' AND ', $where), '"' . $sort . '" ' . $sort_dir);
$contact_persons = $contact_persons->_collection;
$additional_vars = ($letter != '' ? 'letter/' . urlencode($letter) . '/' : '') . ($pattern != '' ? 'letter/' . urlencode($pattern) . '/' : '') . 'callback/' . urlencode($_REQUEST['callback']);
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php';
include SITE_FILE_ROOT . 'template/simple_footer.php';
Ejemplo n.º 18
0
 public function GetNextOrder()
 {
     $db = db_class::get_instance();
     $query = 'SELECT MAX(order) AS next FROM "' . TABLE_VARIABLE . '" WHERE "module"=\'' . $db->str2base($this->_v['module']) . '\'';
     $db->query($query);
     return intval($db->value[0]['next']) + 1;
 }
Ejemplo n.º 19
0
function naming_authority($config, $webid)
{
    // set up db
    $db = new db_class();
    $db->connect('localhost', $config['db_user'], $config['db_pwd'], $config['db_name']);
    $sql = 'select webid, mbox from passwords where webid="' . $webid . '" and active = 1 and publish_mbox_sha1sum = 1 and verified_mbox=1 ';
    //print $sql . "<br/>";
    $results = $db->select($sql);
    if ($row = mysql_fetch_assoc($results)) {
        /*
        if (detect_ie() or detect_safari()) {
        
            header('Content-Type: application/xml');
        
        } else {
        
            header('Content-Type: application/rdf+xml');
        }
        
        print '<?xml version="1.0" encoding="ISO-8859-1"?>'. "\n";
        
        print '<rdf:RDF' . "\n";
        print 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' . "\n" ;
        print 'xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"' . "\n";
        print 'xmlns:foaf="http://xmlns.com/foaf/0.1/">'. "\n";
        
        print '<rdf:Description rdf:about="">' . "\n";
        print '<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/PersonalProfileDocument"/>'. "\n";
        print '<foaf:maker rdf:resource="http://webid4.me/#agent"/>' . "\n";
        print '<foaf:primaryTopic rdf:resource="http://webid4.me/#agent"/>' . "\n";
        print '</rdf:Description>'. "\n";
        
        print '<foaf:Agent rdf:about="http://webid4.me/#agent">' . "\n";
        print '<foaf:knows>' . "\n";
        print '<foaf:Agent rdf:about="' . $row['webid'] . '">' . "\n";
        print '<foaf:mbox_sha1sum>' . sha1($row['mbox']). '</foaf:mbox_sha1sum>' . "\n";
        print '</foaf:Agent>' . "\n";
        print '</foaf:knows>' . "\n";
        print '</foaf:Agent>' . "\n";
            
        print '</rdf:RDF>' . "\n";
        */
        head("knows");
        print '<table border="0" cellspacing="10">';
        print "<tr><td>webid: </td><td>" . $row['webid'] . "</td></tr>";
        print "<tr><td>mbox_sha1sum: </td><td>" . sha1($row['mbox']) . "</td></tr>";
        print "</table>";
        print "Signature: <a href='https://" . $_SERVER["SERVER_NAME"] . "/gpg.php?sign=https://" . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI'] . "'>" . $_GET['webid'] . "</a>";
        //        print "Export to: <a href='http://www.w3.org/2007/08/pyRdfa/extract?uri=https://webid4.me/?webid=" . $row['webid'] . "&amp;format=pretty-xml&amp;warnings=false&amp;parser=lax&amp;space-preserve=true&amp;submit=Go!&amp;text='>RDF/XML</a>";
        print '<div typeof="foaf:PersonalProfileDocument" about="">' . "\n";
        print '<div rel="foaf:primaryTopic" href="http://' . $_SERVER["SERVER_NAME"] . '/#agent"/>' . "\n";
        print '</div>' . "\n";
        print '<div about="http://' . $_SERVER["SERVER_NAME"] . '/#agent" typeof="foaf:Agent">' . "\n";
        print '<div rel="foaf:knows">' . "\n";
        print '<div about="' . $row['webid'] . '" typeof="foaf:Agent">' . "\n";
        print '<div property="foaf:mbox_sha1sum" content="' . sha1($row['mbox']) . '"/>' . "\n";
        print '</div>' . "\n";
        print '</div>' . "\n";
        print '</div>' . "\n";
        print '<div about="#key" typeof="wot:PubKey">' . "\n";
        print '<div rel="wot:identity" href="#agent"></div>' . "\n";
        print '<div rel="wot:pubkeyAddress" href="http://' . $_SERVER["SERVER_NAME"] . '/' . $_SERVER["SERVER_NAME"] . '-pgp.asc"></div>' . "\n";
        print '<div property="wot:hex_id" content="2E899F21"></div>' . "\n";
        print '<div property="wot:length" content="2048"></div>' . "\n";
        print '<div property="wot:fingerprint" content="DCBE32FC0BD85797360BE1D27757B1562E899F21"></div>' . "\n";
        print '</div>' . "\n";
        print '<div typeof="rdf:Description" about="">' . "\n";
        print '<div rel="wot:assurance" href="http://' . $_SERVER["SERVER_NAME"] . '/' . $_SERVER["SCRIPT_NAME"] . '.htm.asc"></div>' . "\n";
        print '</div>' . "\n";
    } else {
        main();
    }
}
Ejemplo n.º 20
0
$additional_vars = 'sort/' . urlencode($sort) . '/sort_dir/' . urlencode($sort_dir);
$pattern = get_request_variable('pattern', '');
$pattern_flag = true;
//ГГГГ-ММ-ДД
if (empty($pattern_flag)) {
    $pattern_flag = false;
}
if (!ereg("[0-9]{4}-[0-9]{2}-[0-9]{2}", $pattern)) {
    $pattern_flag = false;
}
if ($pattern != '' && $pattern_flag == true) {
    $query = 'SELECT count(DISTINCT ID) as num from jGetOutCmds( ' . $cur_dls . ',\'' . db_class::escape_like($pattern) . '\', FALSE, FALSE, FALSE);';
} else {
    $query = 'SELECT count(DISTINCT ID) as num from jGetOutCmds(' . $cur_dls . ', NULL, FALSE, FALSE, FALSE);';
}
$db->query($query);
$all_num = $db->value[0]['num'];
$coms = array();
if ($all_num > 0) {
    if ($pattern != '' && $pattern_flag == true) {
        $query = 'SELECT DISTINCT * from jGetOutCmds(' . $cur_dls . ', \'' . db_class::escape_like($pattern) . '\', FALSE, FALSE, FALSE);';
    } else {
        $query = 'SELECT DISTINCT * from jGetOutCmds(' . $cur_dls . ', NULL, FALSE, FALSE, FALSE);';
    }
    $db->query($query);
    $coms = $db->value;
}
$page_break = get_page_break(SITE_URI_ROOT . $STORAGE['module'] . '/' . $STORAGE['action'] . '/', $all_num, $from, LIMIT_COMPANY_ON_PAGE, LIMIT_PAGE_ON_PAGE, $additional_vars);
include SITE_FILE_ROOT . 'template/header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/view_out.php';
include SITE_FILE_ROOT . 'template/footer.php';
Ejemplo n.º 21
0
 function MoveSource($source, $destination)
 {
     $from = dirname(preg_replace('/[\\/]{2,}/', '/', $source . '/')) . '/';
     $to = preg_replace('/[\\/]{2,}/', '/', $destination . '/');
     $db = db_class::get_instance();
     $query = '
             UPDATE "' . TABLE_FILE . '"
             SET
                 path = CONCAT(\'' . $db->str2base($to) . '\', SUBSTRING(path, CHAR_LENGTH(\'' . $db->str2base($from) . '\')+1))
             WHERE LOCATE(\'' . $db->str2base($from) . '\', path)=1
          ';
     $db->query($query);
 }
Ejemplo n.º 22
0
<?php

include 'head.php';
?>

<body>

<div id="wrap"><?php 
include 'header.php';
?>
 <?php 
require_once "config.php";
require_once "db.class.php";
require_once 'lib/libAuthentication.php';
$db = new db_class();
$db->connect('localhost', $config['db_user'], $config['db_pwd'], $config['db_name']);
function printrdf($str)
{
    global $rdf;
    $rdf .= $str;
}
$subjectAltName = openssl_get_subjectAltName();
$certrsakey = openssl_pkey_get_public_hex();
$rdf = $_POST['rdf'];
if (empty($rdf) || $rdf == '0') {
    $rdf = '<rdf:RDF';
    printrdf('	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"');
    printrdf('	xmlns:cert="http://www.w3.org/ns/auth/cert#"');
    printrdf('	xmlns:rsa="http://www.w3.org/ns/auth/rsa#">');
    printrdf('<rsa:RSAPublicKey>');
    $foaffile = $subjectAltName['URI'] ? $subjectAltName['URI'] : 'TYPE YOUR WEBID HERE';
Ejemplo n.º 23
0
 public function sele_dairy_config($columns = '*', $conditions = '')
 {
     /*
     echo $conditions;
     echo "<br/>";
     */
     //查询用户信息
     $ConfInfo = parent::db_select('t_dryconfig', $columns, $conditions);
     return $ConfInfo;
 }
Ejemplo n.º 24
0
}
if (!ereg("[0-9]{4}-[0-9]{2}-[0-9]{2}", $pattern)) {
    $pattern_flag = false;
}
if ($pattern != '' && $pattern_flag == true) {
    $query = 'select count(*) as num from jGetMsgsEx(date(NOW()) -7, date(NOW()));';
} else {
    $query = 'select count(*) as num from jGetMsgsEx(date(NOW()) - 7, date(NOW()));';
}
//echo $query;
$db->query($query);
$all_num = $db->value[0]['num'];
$coms = array();
if ($all_num > 0) {
    if ($pattern != '' && $pattern_flag == true) {
        $query = 'SELECT * FROM jGetMsgsEx( \'' . db_class::escape_like($pattern) . '\', date(NOW()));';
    } else {
        $query = 'SELECT * FROM jGetMsgsEx( date(NOW())-7, date(NOW()))';
    }
    $db->query($query);
    $coms = $db->value;
}
$empl = new collection();
$empl->Load(TABLE_DLS, false, $where, 'name ASC');
$empl = $empl->_collection;
$cats = new collection();
$cats->Load(TABLE_OBJECTS, false, $where, 'name ASC');
$cats = $cats->_collection;
$page_break = get_page_break(SITE_URI_ROOT . $STORAGE['module'] . '/' . $STORAGE['action'] . '/', $all_num, $from, LIMIT_COMPANY_ON_PAGE, LIMIT_PAGE_ON_PAGE, $additional_vars);
include SITE_FILE_ROOT . 'template/header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/view.php';
Ejemplo n.º 25
0
}
if (!ereg("[0-9]{4}-[0-9]{2}-[0-9]{2}", $pattern)) {
    $pattern_flag = false;
}
if ($pattern != '' && $pattern_flag == true) {
    $query = 'SELECT COUNT(*) AS num FROM io_objects WHERE date(insert_time) =  \'' . db_class::escape_like($pattern) . '\';';
} else {
    $query = 'SELECT COUNT(*) AS num  FROM io_objects;';
}
//echo $query;
$db->query($query);
$all_num = $db->value[0]['num'];
$coms = array();
if ($all_num > 0) {
    if ($pattern != '' && $pattern_flag == true) {
        $query = 'SELECT * FROM io_objects WHERE date(insert_time) = \'' . db_class::escape_like($pattern) . '\' ORDER BY "' . $sort . '" ' . $sort_dir . ' LIMIT ' . LIMIT_COMPANY_ON_PAGE . ';';
    } else {
        $query = 'SELECT * FROM io_objects ORDER BY "' . $sort . '" ' . $sort_dir . ' LIMIT ' . LIMIT_COMPANY_ON_PAGE . ' OFFSET ' . $from . ';';
    }
    $db->query($query);
    $coms = $db->value;
}
$cats = new collection();
$cats->Load(TABLE_CATEGORIES, false, $where, 'name ASC');
$cats = $cats->_collection;
$users = new collection();
$users->Load(TABLE_USERS, false, $where, 'fio ASC');
$users = $users->_collection;
$page_break = get_page_break(SITE_URI_ROOT . $STORAGE['module'] . '/' . $STORAGE['action'] . '/', $all_num, $from, LIMIT_COMPANY_ON_PAGE, LIMIT_PAGE_ON_PAGE, $additional_vars);
include SITE_FILE_ROOT . 'template/header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/view.php';
Ejemplo n.º 26
0
<script>
	parent.init();
</script>
<?php 
require_once 'loadws.class.php';
require_once 'db.class.php';
if (empty($_GET['q'])) {
    print '<title>Need a WSDL File</title>';
    echo "<script>document.write('<br>'+document.title);</script>";
    die;
} else {
    if ($_GET['q'] == "BDLOAD") {
        $db = new db_class();
        $ret = $db->db_query("SELECT url FROM webservice WHERE status IS NULL ORDER BY id LIMIT 10;");
        $retOK = $db->db_query("SELECT count(*) as cont FROM webservice WHERE status = '1';", 1);
        $retNot = $db->db_query("SELECT count(*) as cont FROM webservice WHERE status IS NOT NULL;", 1);
        $contOK = $retOK->cont;
        echo "<script>parent.document.title = 'Sucess Load: {$contOK}/{$retNot->cont}';</script>";
        flush();
        foreach ($ret as $row) {
            echo "</br>" . $row->url;
            flush();
            $loadWS = new load_ws($row->url);
            echo " Affect::" . $loadWS->db->affected_rows . " Status:: " . $loadWS->status;
            if ($loadWS->status == 1) {
                $contOK++;
                echo "<script>parent.document.title = 'Success Load: {$contOK}/{$retNot->cont}';</script>";
            }
            flush();
        }
        echo "<script>parent.document.title = parent.document.title + ' Done!';</script>";
Ejemplo n.º 27
0
<?php

header("Content-type:text/xml");
$id = get_request_variable('id', 'root');
if ($id != 'root') {
    $id = intval($id);
}
$db = db_class::get_instance();
if ($id === 0) {
    echo '<?xml version="1.0" ?>' . "\n";
}
if ($id === 'root') {
    $categories = new io_categories();
    $categories->id = null;
    $childs = $categories->ChildExists();
    echo '<tree id="root">' . "\n";
    echo '<item text="ККС СИТО" id="0" child="' . ($childs ? 1 : 0) . '"></item>';
    echo '</tree>' . "\n";
} else {
    $type_collection = new collection();
    $type_collection->Load(TABLE_CATEGORIES, false, $id > 0 ? 'id=' . $id . ' AND is_main=TRUE' : 'is_main=TRUE', ' name ASC');
    echo '<tree id="' . $id . '">' . "\n";
    for ($i = 0; $i < count($type_collection->_collection); $i++) {
        $childs = $type_collection->_collection[$i]->ChildExists();
        if ($id == 0) {
            echo '<item child="' . ($childs ? 1 : 0) . '" id="' . $type_collection->_collection[$i]->id . '" text="' . escape($type_collection->_collection[$i]->name) . '" im0="folderOpen.gif" im1="folderOpen.gif" im2="folderClosed.gif">';
        }
        if ($childs == true) {
            $child = $type_collection->_collection[$i]->id_child;
            if ($child > 0 && $id > 0) {
                $type_coll = new collection();
Ejemplo n.º 28
0
 public function DeleteRoleVariables()
 {
     if ($this->_v['id_role'] > 0) {
         $db = db_class::get_instance();
         $query = 'DELETE FROM "' . TABLE_ROLE_VARIABLE . '" WHERE "role_id"=' . $this->_v['id_role'];
         $db->query($query);
         return true;
     }
     return false;
 }
Ejemplo n.º 29
0
<?php

/*  Micah's MySQL Database Class - Sample Usage 
 *  4.17.2005 - Micah Carrick, email@micahcarrick.com
 *
 *  This is a sample file on using my database class.  Hopefully it will provide
 *  you with enough information to use the class.  You should also look through
 *  the comments in the db.class.php file to get additional information about
 *  any specific function.
*/
require_once 'db.class.php';
$db = new db_class();
// Open up the database connection.  You can either setup your database login
// information in the db.class.php file or you can overide the defaults here.
// If you setup the default values, you just have to call $db->connect() without
// any parameters-- which is much easier.
if (!$db->connect('localhost', 'user', 'password', 'database_name', true)) {
    $db->print_last_error(false);
}
// Create the table (if it doesn't exist) by executing the external sql
// file with the create table SQL statement.
echo "Executing SQL commands in external file test_data.sql...<br>";
if (!$db->execute_file('test_data.sql')) {
    $db->print_last_error(false);
}
$db->print_last_query();
// This I find very handy.  You can build an array as you are working through,
// for example, POST variables and validating the data or formatting the data
// etc.  By defaul, the class will add slashes (addslashes()) to all string data
// being input using this function.  you can override that by doing:
// $db->auto_slashes = false;
Ejemplo n.º 30
0
<?php

$page_title = 'Выбор сотрудника';
include SITE_FILE_ROOT . 'template/simple_header.php';
$sort = 'name';
$sort_dir = 'asc';
$pattern = get_request_variable('pattern', '');
$letter = get_request_variable('letter', '');
$dept_id = get_request_variable('dept_id', '');
$_REQUEST['callback'] = get_request_variable('callback', '');
$where = array();
if ($pattern != '') {
    $where[] = '"name" LIKE \'%' . db_class::escape_like($pattern) . '%\'';
    $letter = '';
} elseif ($letter != '') {
    $where[] = '"name" LIKE \'' . db_class::escape_like($letter) . '%\'';
} elseif ($dept_id != '') {
    $where[] = '"department_id" = ' . $dept_id;
    $letter = '';
}
$where[] = '"active_flag"=\'yes\'';
$contact_persons = new collection();
$contact_persons->Load(TABLE_EMPLOYEE, false, join(' AND ', $where), '"' . $sort . '" ' . $sort_dir);
$contact_persons = $contact_persons->_collection;
$additional_vars = ($letter != '' ? 'letter/' . urlencode($letter) . '/' : '') . ($pattern != '' ? 'letter/' . urlencode($pattern) . '/' : '') . 'callback/' . urlencode($_REQUEST['callback']);
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php';
include SITE_FILE_ROOT . 'template/simple_footer.php';