crm-rush/index.php

25 lines
1.1 KiB
PHP

<?php
session_start();
ini_set('display_errors', 1);
require_once 'api/php/sql.php';
require_once 'api/php/api.php';
define ( 'SMARTY_DIR', 'api/soft/smarty/4.5.2/libs/' );
require_once SMARTY_DIR . 'Smarty.class.php';
$smarty = new \Smarty();
$smarty->compile_dir = '/tmp/cache';
$smarty->config_dir = 'int/config/';
$smarty->cache_dir = '/tmp/cache';
DB::$dsn = 'mysql:dbname=crm;host=localhost';
DB::$user = 'admin';
DB::$pass = '25Pfujhtks[Gcb[bfnhjd';
if (!@$_GET['mod'])$_GET['mod']='main';
$global_mod=(@$_SESSION['user_id'])?$_GET['mod']:'login';
require_once 'api/modules/' . $global_mod . '/index.php';
$smarty->assign('header', 'skin/header.html');
$smarty->assign('footer', 'skin/footer.html');
$smarty->assign('mod', $global_mod);
//Получаем количество новых задач
$global_taskCount=DB::getAll("SELECT COUNT(*) FROM `content` WHERE `content_type`=? AND `status`<>? AND `json` LIKE '%\"target_user\":\"" . $_SESSION['user_id'] . "\"%'", [2, 0])[0]['COUNT(*)'];
$smarty->assign('global_taskCount', $global_taskCount);
$smarty->display('api/modules/' . $global_mod . '/index.html', @$_GET['id']);
?>