예제 #1
0
 protected function getAdminSessionForPartner($partnerId)
 {
     $partner = PartnerPeer::retrieveByPK($partnerId);
     if (!$partner) {
         throw new Exception('Partner not found when trying to start session');
     }
     $sessionService = new SessionService();
     $sessionService->initService('session', 'session', 'start');
     return $sessionService->startAction($partner->getAdminSecret(), "", KalturaSessionType::ADMIN, $partnerId);
 }
예제 #2
0
 public function __construct()
 {
     if (!SessionService::getInstance()->get('modelName')) {
         URLService::redirect(\GLOBALVAR\ROOT . "?core=models");
     }
     $this->dir = \GLOBALVAR\USERDEPO_PATH . "/" . SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName');
     parent::__construct($this);
 }
예제 #3
0
 public static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new self();
         self::startUp();
     }
     return self::$instance;
 }
예제 #4
0
 public static function getError($text = '')
 {
     ErrorLogHandling::register("Error is occured." . $text . " USER ID:" . SessionService::getInstance()->get('userId') . " DATE: " . date("F j, Y, g:i a"));
     if (file_exists(\GLOBALVAR\CONTROLLERS_PATH . '/errorControl.php')) {
         header("HTTP/1.1 301 Moved Permanently");
         header("Location: " . \GLOBALVAR\ROOT . "/?core=error");
         header("Connection: close");
     }
 }
예제 #5
0
 /**
  * CheckoutService constructor.
  * @param array $config
  */
 public function __construct(array $config)
 {
     parent::__construct($config);
     $orderDetail = new OrderDetailService($config);
     $orderCustomer = new OrderCustomerService($config);
     $orderProducts = new OrderProductsService($config);
     $order = new OrderService($config);
     $order->setOrderDetail($orderDetail);
     $order->setOrderCustomer($orderCustomer);
     $order->setOrderProducts($orderProducts);
     $this->setOrder($order);
 }
예제 #6
0
 public function action_setWaterConf()
 {
     $path = \GLOBALVAR\USERDEPO_PATH . "/" . SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName');
     $mssubmit = new WaterConf();
     $mssubmit->initFromForm($this->post);
     $record = $mssubmit->printConf();
     $mssubmit->cleanConfig($path . ConfFile::$configFile['water']);
     if ($mssubmit->saveConfig($path . ConfFile::$configFile['water'], $record, FILE_APPEND)) {
         $this->msg = 'configuration was saved successfully';
     }
     return [];
 }
예제 #7
0
 public function action_main()
 {
     $dir = $this->dir;
     $confPath = array('global' => array('dir' => $dir . "drutes.conf/", 'file' => 'global.conf'), 'mesh1d' => array('dir' => $dir . "drutes.conf/mesh/", 'file' => 'drumesh1d.conf'), 'mesh2d' => array('dir' => $dir . "drutes.conf/mesh/", 'file' => 'drumesh2d.conf'), 'water' => array("dir" => $dir . "drutes.conf/water.conf/", "file" => 'matrix.conf'));
     $status = array();
     foreach ($confPath as $key => $value) {
         if (!resultData::validConfigData($value['dir'], $value['file'])) {
             $status[$key]['val'] = false;
             $status[$key]['msg'] = "Config file is empty";
         } else {
             $status[$key]['val'] = true;
             $status[$key]['msg'] = "";
         }
     }
     $report = $this->action_processReport();
     return ["status" => $status, "dim_problem" => SessionService::getInstance()->get('dimension'), "dir" => $this->dir, "report" => json_encode($report['report'])];
 }
예제 #8
0
 public function action_main()
 {
     $this->idLoc = SessionService::getInstance()->get('idLocation');
     if (!$this->idLoc) {
         echo 'Chyba: vyberte lokalizaci.';
         exit;
     }
     $loc = $this->doctrine->entityManager->getRepository('Lokalizace')->find($this->idLoc);
     $nameLoc = empty($this->request['nameLoc']) ? $loc->getNazev() : $this->request['nameLoc'];
     $descLoc = empty($this->request['descLoc']) ? $loc->getPoznamka() : $this->request['descLoc'];
     $BBOX = reportData::getBbox($this->idLoc);
     $idLpisUser = empty($this->request['idLpisUser']) ? $loc->getUzivatelLpisId() : $this->request['idLpisUser'];
     $compName = empty($this->request['compName']) ? '' : $this->request['compName'];
     $skupinaEnt = $this->doctrine->entityManager->getRepository('Skupina')->findBy(array('id_lokalizace' => $this->idLoc), array('skupina_cislo' => 'ASC'));
     $skupina = [];
     for ($key = 0; $key < count($skupinaEnt); $key++) {
         if ($skupinaEnt[$key]->getUzivPostup()) {
             $osevIsUser = true;
             $nameOsev = $skupinaEnt[$key]->getUzivPostup()->getNazev();
             $idOsev = $skupinaEnt[$key]->getUzivPostup()->getId();
             $zvo = $skupinaEnt[$key]->getZvoOblast();
             $osevTable = $this->renderOsevTable($idOsev, $osevIsUser, $zvo, $nameOsev);
             $DPBTable = $this->renderDPBTable($skupinaEnt[$key]->getSkupina(), true);
         } else {
             if ($skupinaEnt[$key]->getModelPostup()) {
                 $osevIsUser = false;
                 $nameOsev = $skupinaEnt[$key]->getModelPostup()->getNazev();
                 $idOsev = $skupinaEnt[$key]->getModelPostup()->getId();
                 $zvo = $skupinaEnt[$key]->getZvoOblast();
                 $osevTable = $this->renderOsevTable($idOsev, $osevIsUser, $zvo, $nameOsev);
                 $DPBTable = $this->renderDPBTable($skupinaEnt[$key]->getSkupina(), true);
             } else {
                 $osevIsUser = false;
                 $nameOsev = '';
                 $zvo = false;
                 $idOsev = false;
                 $osevTable = "<div>Pro skupinu DPB není definován osevní postup.</div>";
                 $DPBTable = $this->renderDPBTable($skupinaEnt[$key]->getSkupina());
             }
         }
         $BBOX_sk = reportData::getBbox($this->idLoc, $skupinaEnt[$key]->getSkupina());
         array_push($skupina, ['nameOsev' => $nameOsev, 'skupinaCislo' => $skupinaEnt[$key]->getSkupina(), 'osevIsUser' => $osevIsUser, 'idOsev' => $idOsev, 'zvo' => $zvo, 'osevTable' => $osevTable, 'DPBTable' => $DPBTable, 'BBOX' => $BBOX_sk]);
     }
     return ['info' => ['idUser' => $this->user->getId(), 'emailUser' => '', 'idLpisUser' => $idLpisUser, 'compName' => $compName], 'lokalizace' => ['nameLoc' => $nameLoc, 'idLoc' => $this->idLoc, 'descLoc' => $descLoc, 'BBOX' => $BBOX], 'skupina' => $skupina, 'style' => $this->getStyle()];
 }
예제 #9
0
 public static function callAction($controller)
 {
     $response = array();
     try {
         if (isset($_GET['action']) && !empty($_GET['action'])) {
             if (method_exists($controller, 'action_' . $_GET['action'])) {
                 $response = call_user_func(array($controller, 'action_' . $_GET['action']));
             }
         }
         if (method_exists($controller, 'action_main') && !$controller->stopPropagation()) {
             $response = array_merge($response, call_user_func(array($controller, 'action_main')));
         }
     } catch (Exception $e) {
         ErrorLogHandling::register("Exception is occured." . $e->getMessage() . " USER ID:" . SessionService::getInstance()->get('userId') . " DATE: " . date("F j, Y, g:i a"));
         ErrorLogHandling::getException($e->getMessage());
     }
     return $response;
 }
예제 #10
0
 public function __construct()
 {
     if (isset($_GET['core'])) {
         if (file_exists(\GLOBALVAR\CONTROLLERS_PATH . '/' . $_GET['core'] . 'Control.php')) {
             SessionService::getInstance();
             require_once \GLOBALVAR\CONTROLLERS_PATH . '/' . $_GET['core'] . 'Control.php';
             $class = $_GET['core'] . "Control";
             $this->control = new $class();
             $this->view = $this->control->getViewer();
             //  Detect An Ajax Request
             if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
                 echo json_encode($this->control->getResponse());
                 exit;
             }
         } else {
             URLService::getError('Controller not exist. CLASS: ' . __CLASS__);
         }
     } else {
         URLService::redirect(\GLOBALVAR\ROOT . '/?core=account');
     }
 }
예제 #11
0
 public function initFromForm($post)
 {
     $key = 0;
     $this->arrayData[$key][0] = $post['model'];
     $key++;
     $this->arrayData[$key][0] = $post['dimension'];
     $key++;
     $this->arrayData[$key][0] = $post['meshGen'];
     if ($post['meshGen'] == "3") {
         //ulozit do: mesh/mesh.gmsh
         $name = "mesh.gmsh";
         $dir = SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName') . ConfFile::$configDir['mesh'];
         modelsData::createConfig($dir, $name);
         if (!empty($_FILES["gmsh_mesh"]['tmp_name'])) {
             $fileContent = file_get_contents($_FILES["gmsh_mesh"]['tmp_name']);
             parametersData::writeContent(parametersData::$userDepo . '/' . $dir . $name, $fileContent);
         }
     }
     $key++;
     $this->arrayData[$key][0] = $post['maxIteration'];
     $key++;
     $this->arrayData[$key][0] = $post['iteration'];
     $key++;
     $this->arrayData[$key][0] = $post['timeUnits'];
     $key++;
     $this->arrayData[$key][0] = $post['dtUnit'];
     $key++;
     $this->arrayData[$key][0] = $post['endTime'];
     $key++;
     $this->arrayData[$key][0] = $post['minTime'];
     $key++;
     $this->arrayData[$key][0] = $post['maxTime'];
     $key++;
     $this->arrayData[$key][0] = $post['obserTimeSetting'];
     /*
      $key++;
      $this->arrayData[$key][0] = $post['constRelate'];
     
      if ($post['constRelate'] == '1') {
     
      $key++;
      $this->arrayData[$key][0] = $post['stepConst'];
      }
     */
     $key++;
     $this->arrayData[$key][0] = $post['numberObservationTimes'];
     $observationTime = $key;
     $key++;
     for ($edge = 0; $edge < $this->arrayData[$observationTime][0]; $edge++) {
         $this->arrayData[$key][0] = $post["observationTime_" . $edge];
         $key++;
     }
     $this->arrayData[$key][0] = $post['observationPoints'];
     $observationPoints = $key;
     $key++;
     for ($edge = 0; $edge < $this->arrayData[$observationPoints][0]; $edge++) {
         $this->arrayData[$key][0] = $post["observationPoint_" . $edge . "_0"];
         $this->arrayData[$key][1] = $post["observationPoint_" . $edge . "_1"];
         $key++;
     }
     $this->arrayData[$key][0] = $post['nonlinear'];
     $this->initGlobal();
 }
예제 #12
0
 public function updateSession($params = '{"sid":"xxx","user":{} }')
 {
     if (is_string($params)) {
         $params = json_decode($params, true);
     }
     $params = $params['params'];
     //print_r( $params );
     $sdk = \SessionService::getInstance($this->config);
     $final = $sdk->updateUserBySid($params['sid'], $params['user']);
     //var_dump( $final );
     return $final;
 }
예제 #13
0
파일: navi.php 프로젝트: jHolub/new_drutes
?>

                    <?php 
$this->write($this->user->getUserName());
?>
</p> 

                <?php 
if (SessionService::getInstance()->get('modelName')) {
    ?>
 
                    <li>                     
                        <a>
                            Model: 
                            <?php 
    echo htmlspecialchars(SessionService::getInstance()->get('modelName'));
    ?>
                        </a>
                    </li>
                <?php 
}
?>

                <?php 
if ($this->user->isLogged()) {
    ?>

                    <li><a href="<?php 
    $this->link(['core' => 'account', 'action' => 'logout']);
    ?>
"><span class="glyphicon glyphicon-log-out"></span> Sign out</a></li> 
예제 #14
0
 public function handle_setParametrs($post)
 {
     $this->setConfPatch();
     if (!ParametersData::writeconfig($post, $this->input[$this->type], $this->dir . $this->file, $this->type)) {
         SessionService::getInstance()->clear('config_' . $this->type);
         $this->msg = "Error can't save config file.";
     } else {
         SessionService::getInstance()->set('config_' . $this->type, 'true');
         $this->msg = "Parametrization succeed.";
     }
 }
예제 #15
0
 public function getProcessId($model)
 {
     $res = modelsData::getProccesIdDAta(SessionService::getInstance()->get('userName'), $model);
     return $res;
 }
예제 #16
0
 public function getCurrentZvo()
 {
     $this->STOP_PROPAGATION = true;
     $zvo = osevData::getZvoInLocation(SessionService::getInstance()->get('idLocation'));
     $area = 0;
     $idZvo = false;
     if ($zvo) {
         foreach ($zvo as $key => $value) {
             if ($area < $value['area']) {
                 $idZvo = $value['id'];
             }
         }
     }
     return $idZvo;
 }
예제 #17
0
파일: sdk.php 프로젝트: weichaoduo/zeromore
 /**
  * 创建一个自身的单例对象
  *
  * @return self
  */
 public static function getInstance($config, $prefix = 'REDISSESSID_')
 {
     if (!isset(self::$_instance) || !is_object(self::$_instance)) {
         self::$_instance = new self($config, $prefix);
     }
     return self::$_instance;
 }
예제 #18
0
 public function action_logOut()
 {
     SessionService::getInstance()->destroy();
     $dev = SessionService::getInstance()->getDefault();
     return ["success" => true, 'id' => $dev['id'], 'jmeno_uzivatel' => $dev['name'], 'skupina' => $dev['role'], 'msg' => 'Odhlášení'];
 }
예제 #19
0
 public function action_logOut()
 {
     SessionService::getInstance()->destroy();
     URLService::redirect();
 }
예제 #20
0
 /**
  * 
  * @return type
  * DELENI DBP
  */
 public function action_splitGeom()
 {
     $this->STOP_PROPAGATION = true;
     if (!$this->idLocation) {
         return ["success" => false, "msg" => "Vyberte lokalizaci."];
     }
     $res = lokalizaceData::splitGeomData($this->request['lineGeom'], $this->request['polygonGeom']);
     if (count($res) === 2) {
         $skupina = $this->doctrine->entityManager->getRepository('Skupina')->findOneBy(array('id_lokalizace' => $this->idLocation, 'skupina_cislo' => $this->request['skupina']));
         // vymazani puvodnich DPB
         $delPd = lokalizaceData::delLpisGeom(SessionService::getInstance()->get('idLocation'), $this->request['idGeom']);
         $id_lpis = $delPd['id_lpis'];
         $ctverec = $delPd['ctverec'];
         // identifikator deleni pb, ke kodu zkodfb je pridan identifikator &1 nebo &2
         $splitId = explode("&", $delPd['zkodfb']);
         if (isset($splitId[1])) {
             $zkodfb1 = $splitId[0] . "&" . $splitId[1] . "1";
             $zkodfb2 = $splitId[0] . "&" . $splitId[1] . "2";
         } else {
             $zkodfb1 = $splitId[0] . "&" . "1";
             $zkodfb2 = $splitId[0] . "&" . "2";
         }
         //saveLpisGeom($idloc, $skupina, $hon, $id_lpis, $geom, $id_lpisUser, $nkodfb, $ctverec, $zkodfb)      $id_lpisUser, $nkodfb, $ctverec, $zkodfb
         $id = lokalizaceData::saveLpisGeom(SessionService::getInstance()->get('idLocation'), $skupina->getId(), self::$HON, $id_lpis, $res[0]['geom'], $delPd['id_uz'], $delPd['nkodfb'], $ctverec, $zkodfb1);
         $res[0]['id_geom'] = $id;
         $res[0]['id_lpis'] = $id_lpis;
         $res[0]['ctverec'] = $ctverec;
         $res[0]['zkodfb'] = $zkodfb1;
         $res[0]['hon'] = self::$HON;
         $res[0]['skupina'] = $skupina->getSkupina();
         $id = lokalizaceData::saveLpisGeom(SessionService::getInstance()->get('idLocation'), $skupina->getId(), self::$HON, $id_lpis, $res[1]['geom'], $delPd['id_uz'], $delPd['nkodfb'], $ctverec, $zkodfb2);
         $res[1]['id_geom'] = $id;
         $res[1]['id_lpis'] = $id_lpis;
         $res[1]['ctverec'] = $ctverec;
         $res[1]['zkodfb'] = $zkodfb2;
         $res[1]['hon'] = self::$HON;
         $res[1]['skupina'] = $skupina->getSkupina();
         return ["success" => true, "dividedGeom" => $res, "msg" => "OK"];
     } else {
         return ["success" => false, "msg" => "Řez nevhodně proveden, opakujte akci."];
     }
 }
예제 #21
0
 public function initFromForm($post)
 {
     $key = 0;
     $this->arrayData[$key][0] = $post['constRelate'];
     $key++;
     if ($post['constRelate'] == '1') {
         $this->arrayData[$key][0] = $post['lengthInterval'];
         $key++;
         $this->arrayData[$key][0] = $post['stepConst'];
         $key++;
     } else {
         $this->arrayData[$key][0] = $this->lengthInterval;
         $key++;
         $this->arrayData[$key][0] = $this->stepConst;
         $key++;
     }
     $this->arrayData[$key][0] = $post['timeInter'];
     $key++;
     $this->arrayData[$key][0] = $post['layers'];
     $param1 = $key;
     $key++;
     for ($edge = 0; $edge < $this->arrayData[$param1][0]; $edge++) {
         $this->arrayData[$key][0] = $post["param1_" . $edge . "_0"];
         $this->arrayData[$key][1] = $post["param1_" . $edge . "_1"];
         $this->arrayData[$key][2] = $post["param1_" . $edge . "_2"];
         $this->arrayData[$key][3] = $post["param1_" . $edge . "_3"];
         $this->arrayData[$key][4] = $post["param1_" . $edge . "_4"];
         $this->arrayData[$key][5] = $post["param1_" . $edge . "_5"];
         $key++;
     }
     for ($edge = 0; $edge < $this->arrayData[$param1][0]; $edge++) {
         if (SessionService::getInstance()->get('dimension') == 2) {
             $this->arrayData[$key][0] = $post["param2_" . $edge . "_0"];
         } else {
             $this->arrayData[$key][0] = 0;
         }
         $this->arrayData[$key][1] = $post["param2_" . $edge . "_1"];
         if (SessionService::getInstance()->get('dimension') == 2) {
             $this->arrayData[$key][2] = $post["param2_" . $edge . "_2"];
         }
         $key++;
     }
     for ($edge = 0; $edge < $this->arrayData[$param1][0]; $edge++) {
         $this->arrayData[$key][0] = $post['param3_' . $edge . "_0"];
         $this->arrayData[$key][1] = $post["param3_" . $edge . "_1"];
         $key++;
     }
     $this->arrayData[$key][0] = $post['boundaries'];
     $boundaries = $key;
     $key++;
     for ($edge = 0; $edge < $this->arrayData[$boundaries][0]; $edge++) {
         $this->arrayData[$key][0] = $post["boundary_" . $edge . "_0"];
         $this->arrayData[$key][1] = $post["boundary_" . $edge . "_1"];
         if ($post["boundary_" . $edge . "_2"] == "n") {
             $this->arrayData[$key][2] = "n";
         } else {
             $this->arrayData[$key][2] = "y";
             $name = $edge + 101 . ".bc";
             $dir = SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName') . ConfFile::$configDir['water'];
             modelsData::createConfig($dir, $name);
             if (!empty($_FILES["boundary_" . $edge . "_rain"]['tmp_name'])) {
                 $fileContent = file_get_contents($_FILES["boundary_" . $edge . "_rain"]['tmp_name']);
                 parametersData::writeContent(parametersData::$userDepo . '/' . $dir . $name, $fileContent);
             }
         }
         $this->arrayData[$key][3] = $post["boundary_" . $edge . "_3"];
         $this->arrayData[$key][4] = $post["boundary_" . $edge . "_4"];
         $key++;
     }
     $this->initWater();
 }
예제 #22
0
 public function __construct()
 {
     $this->doctrine = new DoctrineInit();
     $this->idLocation = SessionService::getInstance()->get('idLocation');
     parent::__construct($this);
 }
예제 #23
0
 public function action_execT3d()
 {
     $model = \GLOBALVAR\USERDEPO_PATH . "/" . SessionService::getInstance()->get('userName') . "/" . SessionService::getInstance()->get('modelName');
     exec("/var/www/drutes.org/scripts/genmesh.sh {$model}");
     return ['success' => true];
 }
예제 #24
0
    /**
     * get session expired time
     */
    public function get_expired()
    {
        return $_SESSION['expired_' . $this->session_name];
    }
    /**
     * refresh session
     * @param int $add_time, time addition in second
     */
    public function refresh($add_time = '')
    {
        if ($add_time) {
            if ($_SESSION['expired_' . $this->session_name] && $_SESSION['expired_' . $this->session_name] > time()) {
                $_SESSION['expired_' . $this->session_name] = time() + $add_time;
            } else {
                $this->destroy();
            }
        }
    }
}
/**
 * start session class
 * @var object $session
 */
$session = new SessionService();
/**
 * start session
 */
$session->start_session();
예제 #25
0
 public function getRole()
 {
     return SessionService::getInstance()->get('userRole');
 }
예제 #26
0
 public static function getError($text = '')
 {
     ErrorLogHandling::register("Error is occured." . $text . " USER ID:" . SessionService::getInstance()->get('userId') . " DATE: " . date("F j, Y, g:i a"));
     ErrorLogHandling::getErrorPage();
 }
예제 #27
0
 /**
  *
  * @return type
  * smazani skupiny -> prirazeni do 1. skupiny, u 1. skupiny nelze
  */
 public function action_deleteSkupina()
 {
     $this->STOP_PROPAGATION = true;
     if ($this->request['skupina'] == 0 || $this->request['skupina'] == 1) {
         return ["success" => false, "msg" => "Zvolená skupina nelze smazat."];
     }
     $res = skupinaData::deleteSkupina(lokalizaceControl::$SKUPINA, $this->request['skupina'], SessionService::getInstance()->get('idLocation'), lokalizaceControl::$HON);
     if ($res) {
         return ["success" => true, "msg" => "OK", "hon" => lokalizaceControl::$HON, "skupina" => lokalizaceControl::$SKUPINA];
     } else {
         return ["success" => false, "msg" => "Interní chyba, opakujte akci."];
     }
 }