示例#1
0
 /**
  * @static
  * @return ErrorMessages
  */
 public static function Instance()
 {
     if (self::$_instance == null) {
         self::$_instance = new ErrorMessages();
     }
     return self::$_instance;
 }
示例#2
0
 public static function insertToDB($kodas, $pavadinimas, $kryptis)
 {
     $kodas = repairSqlInjection($kodas);
     $pavadinimas = repairSqlInjection($pavadinimas);
     $kryptis = repairSqlInjection($kryptis);
     if (!ParamosPriemonesValidation::validateKodas($kodas)) {
         ParamosPriemones::$error = "Neteisingas kodo formatas!";
         return false;
     }
     if (!ParamosPriemonesValidation::validatePavadinimas($pavadinimas)) {
         ParamosPriemones::$error = "Neteisingas pavadinimo formatas!";
         return false;
     }
     if (!ParamosPriemonesValidation::validateKryptis($kryptis)) {
         ParamosPriemones::$error = "Neteisingas krypties formatas!";
         return false;
     }
     $result = mysql_query("INSERT INTO `PPOS`.`ParamosPriemones` (`idParamosPriemones`, `Kodas`, `Pavadinimas`, `Kryptis`) VALUES (null, '" . $kodas . "', '" . $pavadinimas . "', '" . $kryptis . "')");
     if (!$result) {
         if (mysql_errno() != 1062) {
             ErrorMessages::setError(7, "insertToDB('" . $kodas . "', '" . $pavadinimas . "', '" . $kryptis . "')", "ParamosPriemones.php", "ParamosPriemones", mysql_error());
         }
         ParamosPriemones::$error = mysql_error();
         return false;
     } else {
         return true;
     }
 }
示例#3
0
 public static function insertToDB($paramosPriemone, $nuo, $iki, $paraiskuKiekis)
 {
     $paramosPriemone = repairSqlInjection($paramosPriemone);
     $nuo = repairSqlInjection($nuo);
     $iki = repairSqlInjection($iki);
     $paraiskuKiekis = repairSqlInjection($paraiskuKiekis);
     if (!ParamosKiekiaiValidation::validateParamosPriemone($paramosPriemone)) {
         ParamosKiekiai::$error = "Neteisingas priemones formatas formatas!";
         return false;
     }
     if (!ParamosKiekiaiValidation::validateNuo($nuo)) {
         ParamosKiekiai::$error = "Neteisingas datos Nuo formatas!";
         return false;
     }
     if (!ParamosKiekiaiValidation::validateIki($iki)) {
         ParamosKiekiai::$error = "Neteisingas datos Iki formatas!";
         return false;
     }
     if (!ParamosKiekiaiValidation::validateParaiskuKiekis($paraiskuKiekis)) {
         ParamosKiekiai::$error = "Neteisingas paraisku kiekio formatas!";
         return false;
     }
     $result = mysql_query("INSERT INTO `PPOS`.`ParamosKiekiai` (`idParamosKiekiai`, `ParamosPriemone`, `Nuo`, `Iki`, `ParaiskuKiekis`) \n                              VALUES (null, '" . $paramosPriemone . "', '" . $nuo . "','" . $iki . "', '" . $paraiskuKiekis . "')");
     if (!$result) {
         if (mysql_errno() != 1062) {
             ErrorMessages::setError(7, "insertToDB('" . $paramosPriemone . "', '" . $nuo . "','" . $iki . "', '" . $paraiskuKiekis . "')", "ParamosKiekiai.php", "ParamosKiekiai", mysql_error());
         }
         ParamosKiekiai::$error = mysql_error();
         return false;
     } else {
         return true;
     }
 }
示例#4
0
 static function throwException($code, $data = null)
 {
     $message = ErrorMessages::getMessage($code);
     $rcpCode = ErrorMessages::getRpcCode($code);
     $httpStatus = ErrorMessages::getHttpStatus($code);
     throw (new ApplicationException($message, $code))->setData($data)->setHttpStatus($httpStatus)->setRpcErrorCode($rcpCode);
 }
示例#5
0
 /**
  * @return null|string
  */
 public function getMessage()
 {
     if (!isset($this->error)) {
         return '';
     }
     if ($this->errorMessages->has($this->g('code'))) {
         return $this->errorMessages->get($this->g('code'));
     }
     if ($this->g('code') === 0 && preg_match('/^token `[_0-9a-zA-Z]+` has already been used\\.$/i', $this->g('message'))) {
         return "すでにカード情報は使われています";
     }
     if ($this->g('message')) {
         return $this->g('message');
     }
     return '支払い処理中にエラーが起こりました';
 }
示例#6
0
 public function delete($id1, $id2)
 {
     $result = mysql_query("DELETE FROM `PPOS`.`" . $this->tableName . "` WHERE " . $this->tableName . "." . $this->var1 . " = " . (int) $id1 . " AND " . $this->tableName . "." . $this->var2 . " = " . (int) $id2);
     if ($result) {
         return true;
     } else {
         ErrorMessages::setError(5, "delete('" . $id1 . "', '" . $id2 . "')", "LinkTable.php", "LinkTable");
         return false;
     }
 }
示例#7
0
 public static function validateRepeatingDays($repeatingDays)
 {
     if (!isset($repeatingDays)) {
         throw new Exception("At least one day is required.");
     }
     foreach ($repeatingDays as $repeatingDay) {
         if (!preg_match("/^[1-5]\$/", $repeatingDay)) {
             throw new Exception(ErrorMessages::getHacking());
         }
     }
 }
 public static function update($valandos, $paramosPriemone, $padalinys)
 {
     $query = "UPDATE  `PPOS`.`ParamosAdministravimas` SET  `Valandos` =  '" . (int) $valandos . "' WHERE  `ParamosPriemone` = " . $paramosPriemone . " AND `Padalinys` = " . (int) $padalinys;
     $result = mysql_query($query);
     if ($result) {
         return true;
     } else {
         ErrorMessages::setError(6, "update('" . $valandos . "', '" . $paramosPriemone . "', '" . $padalinys . "')", "ParamosAdministravimas.php", "ParamosAdministravimas", mysql_error());
         return false;
     }
 }
示例#9
0
 public function PageLoad()
 {
     $returnUrl = $this->server->GetQuerystring(QueryStringKeys::REDIRECT);
     if (empty($returnUrl)) {
         $returnUrl = "index.php";
     }
     $errorMessageKey = ErrorMessages::Instance()->GetResourceKey($this->server->GetQuerystring(QueryStringKeys::MESSAGE_ID));
     //TODO: Log
     $this->Set('ReturnUrl', urldecode($returnUrl));
     $this->Set('ErrorMessage', $errorMessageKey);
     $this->Display('error.tpl');
 }
示例#10
0
文件: db.php 项目: remarco-mif/ppos
 public static function select($query)
 {
     $result = mysql_query($query);
     $data = array();
     $info = array();
     if ($result) {
         while ($row = mysql_fetch_assoc($result)) {
             $data[] = $row;
         }
         $info = array('error' => mysql_error(), 'bool' => true, 'data' => $data);
     } else {
         $info = array('error' => mysql_error(), 'bool' => false, 'data' => array());
         ErrorMessages::setError(3, "select(" . $query . ")", "db.php", "db");
     }
     return $info;
 }
示例#11
0
 public function index()
 {
     $data = $this->init_view_data();
     $flows = VBX_Flow::search();
     $numbers = array();
     try {
         $numbers = $this->vbx_incoming_numbers->get_numbers();
     } catch (VBX_IncomingNumberException $e) {
         $this->error_message = ErrorMessages::message('twilio_api', $e->getCode());
     }
     $incoming_numbers = array();
     // now generate table
     if (count($numbers) > 0) {
         $flows = VBX_Flow::search();
         foreach ($numbers as $item) {
             $item_msg = '';
             if (is_object($this->new_number) && $this->new_number->id == $item->id) {
                 $item_msg = 'New';
             }
             $flow_name = '(Not Set)';
             foreach ($flows as $flow) {
                 if ($flow->id == $item->flow_id) {
                     $flow_name = '';
                 }
             }
             $incoming_numbers[] = array('id' => $item->id, 'name' => $item->name, 'trial' => isset($item->trial) && $item->trial == 1 ? 1 : 0, 'phone' => format_phone($item->phone), 'status' => $item_msg, 'flow_id' => $item->flow_id, 'flow_name' => $flow_name, 'flows' => $flows);
         }
     }
     $data['numbers'] = $incoming_numbers;
     $data['flows'] = $flows;
     $data['twilio_sid'] = $this->twilio_sid;
     if (empty($this->error_message)) {
         $error_message = $this->session->flashdata('error');
         if (!empty($error_message)) {
             $this->error_message = $this->session->flashdata('error');
         }
     }
     if (!empty($this->error_message)) {
         $data['error'] = CI_Template::literal($this->error_message);
     }
     $data['counts'] = $this->message_counts();
     return $this->respond('', 'connect', $data);
 }
示例#12
0
文件: User.php 项目: remarco-mif/ppos
 public static function insertToDB($username, $password, $admin)
 {
     if (!UserValidation::validateUsername($username)) {
         User::$error = "Incorect username.";
         return false;
     }
     if (!UserValidation::validatePassword($password)) {
         User::$error = "Incorect password";
         return false;
     }
     $username = repairSqlInjection($username);
     $password = repairSqlInjection($password);
     $admin = (int) $admin;
     $result = mysql_query("INSERT INTO `PPOS`.`User` (`idUser`, `username`, `password`, `Admin`) VALUES (null, '" . $username . "', '" . $password . "', '" . $admin . "')");
     if (!$result) {
         ErrorMessages::setError(9, "insertToDB('" . $username . "', '" . $password . "', '" . $admin . "')", "User.php", "User");
         User::$error = mysql_error();
         return false;
     } else {
         return true;
     }
 }
示例#13
0
文件: IS.php 项目: remarco-mif/ppos
 public static function insertToDB($kodas, $pavadinimas)
 {
     $kodas = repairSqlInjection($kodas);
     $pavadinimas = repairSqlInjection($pavadinimas);
     if (!ISValidation::validateKodas($kodas)) {
         IS::$error = "Neteisingas kodo formatas!";
         return false;
     }
     if (!ISValidation::validatePavadinimas($pavadinimas)) {
         IS::$error = "Neteisingas pavadinimo formatas!";
         return false;
     }
     $result = mysql_query("INSERT INTO `PPOS`.`IS` (`idIS`, `Kodas`, `Pavadinimas`) VALUES (null, '" . $kodas . "', '" . $pavadinimas . "')");
     if (!$result) {
         if (mysql_errno() != 1062) {
             ErrorMessages::setError(7, "insertToDB('" . $kodas . "', '" . $pavadinimas . "')", "IS.php", "IS", mysql_error());
         }
         IS::$error = mysql_error();
         return false;
     } else {
         return true;
     }
 }
示例#14
0
 private function get_outgoingcallerid()
 {
     $numbers = array();
     try {
         $numbers = $this->vbx_incoming_numbers->get_numbers();
     } catch (VBX_IncomingNumberException $e) {
         $this->error_message = ErrorMessages::message('twilio_api', $e->getCode());
         throw new NumbersException($this->error_message, $e->getCode());
     }
     return $numbers;
 }
示例#15
0
 protected static function update($id, $data, $class)
 {
     $id = repairSqlInjection($id);
     $class = repairSqlInjection($class);
     $dbTables = db::getTables();
     $query = "UPDATE `PPOS`.`" . $class . "` SET ";
     $set = "";
     foreach ($data as $key => $value) {
         if (in_array($key, $dbTables[$class])) {
             $value = repairSqlInjection($value);
             $key = repairSqlInjection($key);
             $set .= $key . " = '" . $value . "', ";
         }
     }
     $query .= substr($set, 0, -2);
     $query .= " WHERE id" . $class . " = " . (int) $id;
     $result = mysql_query($query);
     if ($result) {
         return true;
     } else {
         ErrorMessages::setError(6, "update('" . $id . "', array, '" . $class . "')", "MysqlObject.php", $class);
         MysqlObject::$error = mysql_error();
         return false;
     }
 }
示例#16
0
<?php

session_start();
require_once "../Includes.php";
//print("<img src=\"../Utilities/Charts.php?chart=padaliniu_paraiskos&menuo=2008-01-01\">");
$graph = new PHPGraphLib(650, 200);
$data1 = array(0);
$data2 = array(8, 15, 4, 12);
$data3 = array(1, 2, 3, 4);
$graph->addData($data2);
$graph->setTitle('PPM Per Container');
$graph->setBars(false);
$graph->setLine(true);
$graph->setLineColor('#FF0000', 'green', 'red');
$graph->setDataPoints(true);
$graph->setDataPointColor('maroon');
$graph->setDataValues(true);
$graph->setDataValueColor('maroon');
$graph->setLegend(true);
$graph->setLegendTitle("PA1", "PA2", "PA3");
$graph->createGraph();
p(ErrorMessages::getErrors());