<?php

/*
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$step = GetDef('step');
$userid = GetDef('userid');
$fio = PostDef('fio');
$post = PostDef('post');
$photo = PostDef('picname');
$code = PostDef('code');
$phone1 = PostDef('phone1');
$phone2 = PostDef('phone2');
$tmpuser = new Tusers();
$tmpuser->GetById($userid);
$tmpuser->fio = $fio;
$tmpuser->jpegphoto = $photo;
$tmpuser->post = $post;
$tmpuser->tab_num = $code;
$tmpuser->telephonenumber = $phone1;
$tmpuser->homephone = $phone2;
$tmpuser->Update();
unset($tmpuser);
echo 'ok';
Пример #2
0
/*
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$id = GetDef('eqid');
$oper = PostDef('oper');
$param = PostDef('param');
$paramidid = PostDef('id');
if ($id == '') {
    $id = PostDef('eqid');
}
if ($oper == '') {
    $responce = new stdClass();
    // получаем группу номенклатуры
    $sql = <<<TXT
SELECT equipment.id,nome.id AS nomeid,nome.groupid AS groupid
FROM   equipment
       INNER JOIN nome
               ON nome.id = equipment.nomeid
WHERE  ( equipment.id = '{$id}' )
       AND ( nome.active = 1 )
TXT;
    $result = $sqlcn->ExecuteSQL($sql) or die('Не получилось найти группу! ' . mysqli_error($sqlcn->idsqlconnection));
    while ($row = mysqli_fetch_array($result)) {
        $groupid = $row['groupid'];
Пример #3
0
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$orgid = GetDef('orgid');
$oper = PostDef('oper');
$id = PostDef('id');
$name = PostDef('name');
$comment = PostDef('comment');
$opgroup = PostDef('opgroup');
if ($oper == '') {
    // Проверяем может ли пользователь просматривать?
    $user->TestRoles('1,3,4,5,6') or die('Недостаточно прав');
    $result = $sqlcn->ExecuteSQL("SELECT COUNT(*) AS cnt FROM places WHERE orgid = '{$orgid}'");
    $row = mysqli_fetch_array($result);
    $count = $row['cnt'];
    $total_pages = $count > 0 ? ceil($count / $limit) : 0;
    if ($page > $total_pages) {
        $page = $total_pages;
    }
    $start = $limit * $page - $limit;
    $sql = "SELECT id, opgroup, name, comment, active FROM places WHERE orgid = '{$orgid}' ORDER BY {$sidx} {$sord} LIMIT {$start}, {$limit}";
    $result = $sqlcn->ExecuteSQL($sql) or die('Не могу выбрать список помещений! ' . mysqli_error($sqlcn->idsqlconnection));
    $responce = new stdClass();
    $responce->page = $page;
Пример #4
0
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$step = GetDef('step');
$id = GetDef('id');
$name = PostDef('name');
$comment = PostDef('comment');
$groupid = PostDef('groupid');
if ($groupid == '') {
    $err[] = 'Не выбрана группа!';
}
$vendorid = PostDef('vendorid');
if ($vendorid == '') {
    $err[] = 'Не задан производитель!';
}
$namenome = PostDef('namenome');
if ($namenome == '') {
    $err[] = 'Не задано наименование!';
}
if (count($err) == 0) {
    if ($step == 'edit') {
        $sql = "UPDATE nome SET groupid = '{$groupid}', vendorid = '{$vendorid}', name = '{$namenome}' WHERE id = '{$id}'";
        $sqlcn->ExecuteSQL($sql) or die('Не смог обновить номенклатуру!: ' . mysqli_error($sqlcn->idsqlconnection));
    }
    if ($step == 'add') {
        $sql = "INSERT INTO nome (id, groupid, vendorid, name, active) VALUES (NULL, '{$groupid}', '{$vendorid}', '{$namenome}', '1')";
        $sqlcn->ExecuteSQL($sql) or die('Не смог добавить номенклатуру!: ' . mysqli_error($sqlcn->idsqlconnection));
    }
}
echo 'ok';
Пример #5
0
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$oper = PostDef('oper');
$id = PostDef('id');
$eqid = GetDef('eqid');
$comment = PostDef('comment');
$dt = PostDef('dt', '10.10.2014 00:00:00');
$dtend = PostDef('dtend', '10.10.2014 00:00:00');
$status = PostDef('status', '1');
$doc = PostDef('doc');
// если не задано ТМЦ по которому показываем перемещения, то тогда просто листаем последние
if ($eqid == '') {
    $where = '';
} else {
    $where = "WHERE repair.eqid = '{$eqid}'";
}
if ($oper == '') {
    $sql = <<<TXT
SELECT     COUNT(*) AS cnt,
           repair.dt,
           repair.dtend,
           repair.kntid,
           knt.name,
           repair.cost,
           repair.comment,
Пример #6
0
<?php

/*
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
// Проверяем: может ли пользователь добавлять файлы?
$user->TestRoles('1,4') or die('Недостаточно прав');
$selectedkey = PostDef('selectedkey');
$orig_file = $_FILES['filedata']['name'];
$dis = array('.htaccess');
// Запрещённые для загрузки файлы
$rs = array('msg' => 'error');
// Ответ по умолчанию, если пойдёт что-то не так
if (!in_array($orig_file, $dis)) {
    $userfile_name = GetRandomId(8) . '.' . pathinfo($orig_file, PATHINFO_EXTENSION);
    $src = $_FILES['filedata']['tmp_name'];
    $dst = WUO_ROOT . '/files/' . $userfile_name;
    $res = move_uploaded_file($src, $dst);
    if ($res) {
        $rs['msg'] = $userfile_name;
        $sz = filesize($dst);
        if ($selectedkey != '') {
            $SQL = <<<TXT
INSERT INTO cloud_files
Пример #7
0
     while ($row = mysqli_fetch_array($result)) {
         $dtz = $row['dt'];
         $responce->rows[$i]['id'] = $row['rpid'];
         $rstatus = $row['rstatus'] == '1' ? 'Ремонт' : 'Сделано';
         $responce->rows[$i]['cell'] = array($row['rpid'], $row['namekont'], $row['namenome'], MySQLDateToDate($row['dt']), MySQLDateToDate($row['dtend']), $row['cost'], $row['comment'], $rstatus);
         $i++;
     }
     jsonExit($responce);
 }
 if ($step == 'edit') {
     if ($oper == 'edit') {
         $dt = DateToMySQLDateTime2(PostDef('dt') . ' 00:00:00');
         $dtend = DateToMySQLDateTime2(PostDef('dtend') . ' 00:00:00');
         $cost = PostDef('cost');
         $comment = PostDef('comment');
         $rstatus = PostDef('rstatus');
         $sql = "UPDATE repair SET dt='{$dt}',dtend='{$dtend}',cost='{$cost}',comment='{$comment}',status='{$rstatus}' WHERE id='{$eqid}'";
         $sqlcn->ExecuteSQL($sql) or die('Не смог обновить статус ремонта! ' . mysqli_error($sqlcn->idsqlconnection));
         ReUpdateRepairEq();
         exit;
     }
     if ($oper == 'del') {
         $sql = "SELECT * FROM repair WHERE id = '{$eqid}'";
         $result = $sqlcn->ExecuteSQL($sql) or die('Не получилось выбрать список ремонтов! ' . mysqli_error($sqlcn->idsqlconnection));
         while ($row = mysqli_fetch_array($result)) {
             $status = $row['status'];
         }
         if ($status != '1') {
             $sql = "DELETE FROM repair WHERE id = '{$eqid}'";
             $sqlcn->ExecuteSQL($sql) or die('Не смог обновить статус ремонта! ' . mysqli_error($sqlcn->idsqlconnection));
         }
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$orgid = GetDef('orgid');
$placesid = GetDef('placesid');
$oper = PostDef('oper');
$id = PostDef('id');
$name = PostDef('name');
$comment = PostDef('comment');
if ($oper == '') {
    // Проверяем может ли пользователь просматривать?
    $user->TestRoles('1,3,4,5,6') or die('Недостаточно прав');
    $result = $sqlcn->ExecuteSQL("SELECT COUNT(*) AS cnt FROM places_users WHERE placesid = '{$placesid}'");
    $row = mysqli_fetch_array($result);
    $count = $row['cnt'];
    $total_pages = $count > 0 ? ceil($count / $limit) : 0;
    if ($page > $total_pages) {
        $page = $total_pages;
    }
    $start = $limit * $page - $limit;
    $sql = <<<TXT
SELECT     places_users.id AS plid,
           placesid,
           userid,
Пример #9
0
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$oper = PostDef('oper');
$id = PostDef('id');
$active = PostDef('active');
if ($oper == '') {
    // Проверяем может ли пользователь просматривать?
    $user->TestRoles('1,3,4,5,6') or die('Недостаточно прав');
    $result = $sqlcn->ExecuteSQL("SELECT COUNT(*) AS cnt FROM config_common WHERE nameparam LIKE 'modulename_%'");
    $row = mysqli_fetch_array($result);
    $count = $row['cnt'];
    $total_pages = $count > 0 ? ceil($count / $limit) : 0;
    if ($page > $total_pages) {
        $page = $total_pages;
    }
    $start = $limit * $page - $limit;
    $responce = new stdClass();
    if ($start < 0) {
        $responce->page = 0;
        $responce->total = 0;
Пример #10
0
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$oper = PostDef('oper');
$id = PostDef('id');
$nomename = PostDef('nomename');
$filters = GetDef('filters');
if ($oper == '') {
    // Проверяем может ли пользователь просматривать?
    $user->TestRoles('1,3,4,5,6') or die('Недостаточно прав');
    $flt = json_decode($filters, true);
    $cnt = count($flt['rules']);
    $where = '';
    for ($i = 0; $i < $cnt; $i++) {
        $field = $flt['rules'][$i]['field'];
        if ($field == 'nomeid') {
            $field = 'nome.id';
        }
        $data = $flt['rules'][$i]['data'];
        $where = $where . "({$field} LIKE '%{$data}%')";
        if ($i < $cnt - 1) {
Пример #11
0
$sorgider = GetDef('sorgider', $cfg->defaultorgid);
$id = PostDef('id');
$ip = PostDef('ip');
$name = PostDef('name');
$comment = PostDef('comment');
$buhname = PostDef('buhname');
$sernum = PostDef('sernum');
$invnum = PostDef('invnum');
$shtrihkod = PostDef('shtrihkod');
$cost = PostDef('cost');
$currentcost = PostDef('currentcost');
$os = PostDef('os');
$tmcgo = PostDef('tmcgo');
$mode = PostDef('mode');
//$mapyet = PostDef('mapyet');
$mapyet = PostDef('eqmapyet');
$orgid = $cfg->defaultorgid;
/////////////////////////////
// вычисляем фильтр
/////////////////////////////
// получаем наложенные поисковые фильтры
$filters = GetDef('filters');
$flt = json_decode($filters, true);
$cnt = count($flt['rules']);
$where = '';
for ($i = 0; $i < $cnt; $i++) {
    $field = $flt['rules'][$i]['field'];
    if ($field == 'org.name') {
        $field = 'org.id';
    }
    $data = $flt['rules'][$i]['data'];
Пример #12
0
<?php

/*
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$contractid = PostDef('contractid');
$uploaddir = WUO_ROOT . '/files/';
$userfile_name = basename($_FILES['filedata']['name']);
$orig_file = $_FILES['filedata']['name'];
$len = strlen($userfile_name);
$ext_file = substr($userfile_name, $len - 4, $len);
$tmp = GetRandomId(5);
$userfile_name = $tmp . $userfile_name;
$uploadfile = $uploaddir . $userfile_name;
$sr = $_FILES['filedata']['tmp_name'];
$dest = $uploadfile;
$res = move_uploaded_file($sr, $dest);
if ($res) {
    $rs = array('msg' => $userfile_name);
    if ($contractid != '') {
        $sql = <<<TXT
INSERT INTO files_contract
            (id,idcontract,filename,userfreandlyfilename)
VALUES      (NULL,'{$contractid}','{$userfile_name}','{$orig_file}')
Пример #13
0
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
include_once WUO_ROOT . '/inc/functions.php';
// Класс работы с БД
$dbhost = PostDef('dbhost');
$dbname = PostDef('dbname');
$dbuser = PostDef('dbuser');
$dbpass = PostDef('dbpass');
$orgname = PostDef('orgname');
$login = PostDef('login');
$pass = PostDef('pass');
$conn = @mysqli_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
    die('<div class="alert alert-danger">Ошибка БД: ' . mysqli_connect_error() . '</div>');
}
$res = mysqli_select_db($conn, $dbname);
if (!$res) {
    $sql = "CREATE DATABASE IF NOT EXISTS {$dbname}";
    if (!mysqli_query($conn, $sql)) {
        die('<div class="alert alert-danger">Ошибка создания базы: ' . mysqli_error($conn) . '</div>');
    }
}
mysqli_select_db($conn, $dbname);
$handle = file_get_contents(WUO_ROOT . '/webuser.sql');
if (!$handle) {
    die('<div class="alert alert-danger">Ошибка открытия файла: webuser.sql</div>');
 // Получаем переменные, проверяем на правильность заполнения
 $step = GetDef('step');
 $orgid = PostDef('orgid');
 if ($orgid == '') {
     $err[] = 'Не выбрана организация!';
 }
 $login = PostDef('login');
 if ($login == '') {
     $err[] = 'Не задан логин!';
 }
 $pass = PostDef('pass');
 $email = PostDef('email');
 if ($email == '') {
     $err[] = 'Не задан E-mail!';
 }
 $mode = PostDef('mode');
 if ($mode == '') {
     $err[] = 'Не задан режим!';
 }
 if (!preg_match('/^[a-zA-Z0-9\\._-]+@[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,4}$/', $email)) {
     $err[] = 'Не верно указан E-mail';
 }
 if ($step == 'add') {
     if ($pass == '') {
         // пароль не может быть пустым при добавлении пользователя
         $err[] = 'Не задан пароль!';
     }
     if (DoubleLogin($login) != 0) {
         $err[] = 'Такой логин уже есть в базе!';
     }
     if (DoubleEmail($email) != 0) {
Пример #15
0
            if ($status != 0) {
                $sql = "UPDATE equipment SET repair = '{$status}' WHERE id = '{$eqid}'";
                $sqlcn->ExecuteSQL($sql) or die('Не смог обновить запись о ремонте!: ' . mysqli_error($sqlcn->idsqlconnection));
            }
        }
    }
    if ($step == 'edit') {
        $dt = DateToMySQLDateTime2(PostDef('dtpost') . ' 00:00:00');
        $dtend = DateToMySQLDateTime2(PostDef('dt') . ' 00:00:00');
        $cost = PostDef('cst');
        $comment = PostDef('comment');
        $rstatus = PostDef('status');
        $doc = PostDef('doc');
        $suserid1 = PostDef('suserid1');
        $suserid2 = PostDef('suserid2');
        $kntid = PostDef('kntid');
        $sql = <<<TXT
UPDATE repair
SET    dt = '{$dt}',dtend = '{$dtend}',cost = '{$cost}',comment = '{$comment}',status = '{$rstatus}',doc = '{$doc}',
       userfrom = '{$suserid1}',
       userto = '{$suserid2}',kntid = '{$kntid}'
WHERE  id = '{$eqid}'
TXT;
        $sqlcn->ExecuteSQL($sql) or die('Не смог обновить статус ремонта! ' . mysqli_error($sqlcn->idsqlconnection));
        ReUpdateRepairEq();
        exit;
    }
}
if ($step != 'list') {
    if (count($err) == 0) {
        echo 'ok';
Пример #16
0
 * Данный код создан и распространяется по лицензии GPL v3
 * Разработчики:
 *   Грибов Павел,
 *   Сергей Солодягин (solodyagin@gmail.com)
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$oper = PostDef('oper');
$id = PostDef('id');
$title = PostDef('title');
$cloud_dirs_id = GetDef('cloud_dirs_id');
if ($oper == '') {
    // Проверяем может ли пользователь просматривать?
    $user->TestRoles('1,3,4,5,6') or die('Недостаточно прав');
    $sql = "SELECT COUNT(*) AS cnt FROM cloud_files WHERE cloud_dirs_id = '{$cloud_dirs_id}'";
    $result = $sqlcn->ExecuteSQL($sql) or die('Не могу выбрать количество записей! ' . mysqli_error($lb->idsqlconnection));
    $row = mysqli_fetch_array($result);
    $count = $row['cnt'];
    $total_pages = $count > 0 ? ceil($count / $limit) : 0;
    if ($page > $total_pages) {
        $page = $total_pages;
    }
    $start = $limit * $page - $limit;
    $sql = <<<TXT
SELECT   *
Пример #17
0
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$oper = PostDef('oper');
$curuserid = GetDef('curuserid');
$curplid = GetDef('curplid');
$curorgid = GetDef('curorgid');
$tpo = GetDef('tpo');
$os = GetDef('os');
$repair = GetDef('repair');
$mode = GetDef('mode');
$id = PostDef('id');
$where = '';
if ($curuserid != '-1') {
    $where .= " AND equipment.usersid = '{$curuserid}'";
}
if ($curplid != '-1') {
    $where .= " AND equipment.placesid = '{$curplid}'";
}
if ($curorgid != '-1') {
    $where .= " AND equipment.orgid = '{$curorgid}'";
}
if ($os == 'true') {
    $where .= " AND equipment.os = 1";
}
if ($repair == 'true') {
    $where .= " AND equipment.repair = 1";
Пример #18
0
    // высота куска изображения
    $px = 0;
    $py = 0;
    // координаты шага "реза"
    for ($y = 0; $y <= $sz; $y++) {
        for ($x = 0; $x <= $sz; $x++) {
            $imgcropped = imagecreatetruecolor($sx, $sy);
            imagecopy($imgcropped, $img, 0, 0, $px, $py, $sx, $sy);
            imagepng($imgcropped, WUO_ROOT . '/photos/maps/' . $zoom . '-' . $y . '-' . $x . '-' . $fn);
            $px = $px + $sx;
        }
        $px = 0;
        $py = $py + $sy;
    }
}
$geteqid = PostDef('geteqid');
$uploaddir = WUO_ROOT . '/photos/maps/';
$userfile_name = strtoupper(basename($_FILES['filedata']['name']));
$len = strlen($userfile_name);
$ext_file = substr($userfile_name, $len - 4, $len);
if ($ext_file == '.PNG') {
    $tmp = GetRandomId(20);
    $userfile_name = $tmp . $ext_file;
    $uploadfile = $uploaddir . '0-0-0-' . $userfile_name;
    $sr = $_FILES['filedata']['tmp_name'];
    $dest = $uploadfile;
    $rs = array('fname' => '', 'msg' => '');
    $res = move_uploaded_file($sr, $dest);
    if ($res) {
        $rs = array('fname' => "0-0-0-{$userfile_name}", 'msg' => '');
        if ($geteqid != '') {
Пример #19
0
 *   (добавляйте себя если что-то делали)
 * http://грибовы.рф
 */
// Запрещаем прямой вызов скрипта.
defined('WUO_ROOT') or die('Доступ запрещён');
$page = GetDef('page', '1');
$limit = GetDef('rows');
$sidx = GetDef('sidx', '1');
$sord = GetDef('sord');
$oper = PostDef('oper');
$id = PostDef('id');
$title = PostDef('title');
if (!empty($title)) {
    $title = ClearMySqlString($sqlcn->idsqlconnection, $title);
}
$stiker = PostDef('stiker');
if ($oper == '') {
    // Проверяем может ли пользователь просматривать?
    $user->TestRoles('1,3,4,5,6') or die('Недостаточно прав');
    $result = $sqlcn->ExecuteSQL("SELECT COUNT(*) AS cnt FROM news");
    $row = mysqli_fetch_array($result);
    $count = $row['cnt'];
    $total_pages = $count > 0 ? ceil($count / $limit) : 0;
    if ($page > $total_pages) {
        $page = $total_pages;
    }
    $start = $limit * $page - $limit;
    $sql = "SELECT * FROM news ORDER BY {$sidx} {$sord} LIMIT {$start}, {$limit}";
    $result = $sqlcn->ExecuteSQL($sql) or die('Не могу выбрать список новостей! ' . mysqli_error($sqlcn->idsqlconnection));
    $responce = new stdClass();
    $responce->page = $page;