function tweet_post()
{
    $args = func_get_args();
    $cate = $args[2];
    $content = format_str($_POST['text'], false);
    if (!$cate or !$content) {
        die("Invalid argument!");
    }
    include_once 'sinaoauth.inc.php';
    $c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
    if ($_FILES['upload']['tmp_name']) {
        $msg = $c->upload($content, $_FILES['upload']['tmp_name']);
    } else {
        $msg = $c->update($content);
    }
    if ($msg === false || $msg === null) {
        echo "Error occured";
        return false;
    }
    if (isset($msg['error_code']) && isset($msg['error'])) {
        echo 'Error_code: ' . $msg['error_code'] . ';  Error: ' . $msg['error'];
        return false;
    }
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    connect_db();
    $add = "INSERT INTO pending_tweets (\r\n                     site_id, tweet_id, user_site_id, content, post_datetime,\r\n                     type, tweet_site_id,\r\n                     post_screenname, profile_image_url, source)\r\n                     VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n                     {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "')";
    if ($msg['thumbnail_pic']) {
        $add = "INSERT INTO pending_tweets (\r\n                     site_id, tweet_id, user_site_id, content, post_datetime,\r\n                     type, tweet_site_id,\r\n                     post_screenname, profile_image_url, source, thumbnail)\r\n                     VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n                     {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "', '" . $msg['thumbnail_pic'] . "')";
    }
    $added = mysql_query($add) or die("Could not add entry!");
    echo "0";
}
Пример #2
0
 /**
  * Update the sign-in credentials for the specific user.
  *
  * @param UserRecord $user The user to update the credentials for
  * @return Boolean True on success
  */
 public function assignCredentials(UserRecord $user)
 {
     $db = new DatabaseConnection();
     // Generate a new salt and hash the password
     $salt = $this->generateSalt();
     // What hashing algorithm to use
     $ha = config::get('lepton.user.hashalgorithm', 'md5');
     $ps = $user->password . $salt;
     $hp = hash($ha, $ps);
     if ($user->userid == null) {
         $uuid = UUID::v4();
         try {
             $id = $db->insertRow("REPLACE INTO " . LEPTON_DB_PREFIX . "users (username,salt,password,email,flags,registered,uuid) VALUES (%s,%s,%s,%s,%s,NOW(),%s)", $user->username, $salt, $hp, $user->email, $user->flags, $uuid);
             $user->userid = $id;
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     } else {
         try {
             $db->updateRow("UPDATE " . LEPTON_DB_PREFIX . "users SET username=%s,salt=%s,password=%s,email=%s,flags=%s WHERE id=%d", $user->username, $salt, $hp, $user->email, $user->flags, $user->userid);
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     }
     return true;
 }
 public function indexAction()
 {
     if ($this->request->isPost()) {
         $register = new Users();
         $register->id = UUID::v4();
         $register->password = $this->security->hash($this->request->getPost('password'));
         $register->phonenumber = $this->request->getPost('phonenumber');
         $register->email = $this->request->getPost('email');
         $register->name = $this->request->getPost('name');
         $register->created_date = Carbon::now()->now()->toDateTimeString();
         $register->updated_date = Carbon::now()->now()->toDateTimeString();
         $user = Users::findFirstByEmail($register->email);
         if ($user) {
             $this->flash->error("can not register, User " . $register->email . " Alredy Registerd! ");
             return true;
         }
         if ($register->save() === true) {
             $this->session->set('user_name', $register->name);
             $this->session->set('user_email', $register->email);
             $this->session->set('user_id', $register->id);
             $this->flash->success("Your " . $register->email . " has been registered Please Login for booking court");
             $this->response->redirect('dashboard');
         }
     }
 }
Пример #4
0
 /**
  * Do general tasks used application whide
  */
 protected function doBaseTasks()
 {
     $this->showTestHeadline("Checking application base structure");
     if (HSetting::Get('secret') == "" || HSetting::Get('secret') == null) {
         HSetting::Set('secret', UUID::v4());
         $this->showFix('Setting missing application secret!');
     }
 }
Пример #5
0
 function Write($head, $message)
 {
     self::DeleteOld();
     $guid = UUID::v4();
     $date = date("Y-m-d H:i:s");
     $user = Session::GetUserId($this->session);
     $this->db->Exec("INSERT INTO `Logs`(`id`,`UserId`,`DateTime`,`Head`,`Message`)\n          VALUE ('{$guid}','{$user}','{$date}','{$head}','{$message}'); ");
 }
Пример #6
0
 /**
  * Before Save Addons
  *
  * @return type
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         // Create GUID for new files
         $this->guid = UUID::v4();
     }
     return parent::beforeSave();
 }
Пример #7
0
 public function beforeValidate($event)
 {
     if ($this->getOwner()->isNewRecord) {
         if ($this->getOwner()->guid == "") {
             $this->getOwner()->guid = UUID::v4();
         }
     }
     return parent::beforeValidate($event);
 }
Пример #8
0
 public static function create($type, $name)
 {
     //get or create namespace uuid for Group-Office
     $namespace = \GO::config()->get_setting('uuid_namespace');
     if (!$namespace) {
         $namespace = UUID::v4();
         \GO::config()->save_setting('uuid_namespace', $namespace);
     }
     return UUID::v5($namespace, $type . $name);
 }
Пример #9
0
 public static function GenId($userid)
 {
     global $db;
     $guid = UUID::v4();
     $date = date("Y-m-d H:i:s");
     $dateExt = new DateTime();
     $dateExt->modify('+15 minutes');
     $def = $dateExt->format("Y-m-d H:i:s");
     $db->Exec("INSERT INTO `Session`(`id`,`UserId`,`CreateDate`,`ExpireDate`)\n                      VALUE ('{$guid}','{$userid}','{$date}','{$def}'); ");
     return $guid;
 }
 public function insertHeadInRequest()
 {
     $prefix = $this->doc->documentElement->prefix;
     $dateTime = date('d.m.Y') . 'T' . date('H:i:s');
     $header = new DOMElement("{$prefix}:Zaglavlje", '', $this->doc->documentElement->namespaceURI);
     $reqDateTime = new DOMElement("{$prefix}:DatumVrijeme", $dateTime, $this->doc->documentElement->namespaceURI);
     $reqUUID = new DOMElement("{$prefix}:IdPoruke", UUID::v4(), $this->doc->documentElement->namespaceURI);
     $refElem = $this->doc->documentElement->firstChild;
     $this->doc->documentElement->insertBefore($header, $refElem);
     $header->appendChild($reqUUID);
     $header->appendChild($reqDateTime);
 }
Пример #11
0
 public function createUid($app_id, $device_id)
 {
     $uuid = new DreamDeviceUuid();
     $uuid->app_id = $app_id;
     $uuid->uuid = UUID::v4();
     $uuid->device_id = $device_id;
     $uuid->setIsNewRecord(true);
     if ($uuid->save(false)) {
         return $uuid->id;
     }
     return false;
 }
 public function register()
 {
     // デバイストークンとプラットフォームを取得
     $deviceToken = $this->request->data('device_token');
     $platform = $this->request->data('platform');
     // UUIDを第4生成アルゴリズムで生成する
     $uuid = UUID::v4();
     $data = array('uuid' => $uuid, 'device_token' => $deviceToken ? $deviceToken : null, 'platform' => $platform);
     if ($this->User->save($data)) {
         return $this->succeed(array('uuid' => $uuid));
     } else {
         return $this->validationError('User', $this->User->validationErrors);
     }
 }
Пример #13
0
 public static function StartLog(\Puzzlout\Framework\Core\Application $app, $source, $type = null)
 {
     if (is_null($source)) {
         throw new \Exception("Log must have a source, e.g. __CLASSNAME__.__METHOD__", 0, null);
         //todo: create the error code.
     }
     $log = new \Puzzlout\Framework\BO\F_log();
     $log->setF_log_guid(UUID::v4());
     $log->setF_log_level($type);
     $log->setF_log_request_id($app->request()->requestId());
     $log->setF_log_start(Logger::GetTime());
     $log->setF_log_source($source);
     self::SetLog($app->user(), $log);
     return $log->F_log_guid();
 }
 /**
  * Sends this user a new password by E-Mail
  *
  */
 public function recoverPassword()
 {
     $user = User::model()->findByAttributes(array('email' => $this->email));
     // Switch to users language - if specified
     if ($user->language !== "") {
         Yii::app()->language = $user->language;
     }
     $token = UUID::v4();
     $user->setSetting('passwordRecoveryToken', $token . '.' . time(), 'user');
     $message = new HMailMessage();
     $message->view = "application.modules_core.user.views.mails.RecoverPassword";
     $message->addFrom(HSetting::Get('systemEmailAddress', 'mailing'), HSetting::Get('systemEmailName', 'mailing'));
     $message->addTo($this->email);
     $message->subject = Yii::t('UserModule.forms_AccountRecoverPasswordForm', 'Password Recovery');
     $message->setBody(array('user' => $user, 'linkPasswordReset' => Yii::app()->createAbsoluteUrl("//user/auth/resetPassword", array('token' => $token, 'guid' => $user->guid))), 'text/html');
     Yii::app()->mail->send($message);
 }
 public function checkoutAction()
 {
     $id = $this->session->get('user_id');
     $orderList = TempOrder::find("user_id = '{$this->session->get('user_id')}'");
     foreach ($orderList as $key => $value) {
         $order = new Orders();
         $order->id = UUID::v4();
         $order->stadium = $value->stadium;
         $order->start_hour = $value->start_hour;
         $order->end_hour = $value->end_hour;
         $order->user_id = $value->user_id;
         $order->date_created = Carbon::now()->toDateString();
         $order->save();
         $value->delete();
     }
     $this->response->redirect('/dashboard');
 }
Пример #16
0
function createUser($conn, $email, $password, $firstname, $lastname, $birthday)
{
    // Insert data
    $ret = array();
    $hashed_passwd = password_hash($password, PASSWORD_BCRYPT);
    $timestamp = strtotime($birthday);
    $sql = "insert into `user` (`email`, `password`, `firstname`, `lastname`, `birthday`, `uuid`, `status`) values ('" . mysqli_real_escape_string($conn, $email) . "', '" . $hashed_passwd . "', '" . mysqli_real_escape_string($conn, $firstname) . "', '" . mysqli_real_escape_string($conn, $lastname) . "', '" . date("Y-m-d H:i:s", $timestamp) . "', '" . UUID::v4() . "', '" . 1 . "' )";
    if (!mysqli_query($conn, $sql)) {
        $ret['IsSuccess'] = false;
        $ret['Msg'] = mysqli_error($conn);
    } else {
        $ret['IsSuccess'] = true;
        $ret['ID'] = mysqli_insert_id($conn);
        $ret['email'] = $email;
        $ret['password'] = $password;
    }
    return $ret;
}
function feedback_post($query)
{
    include_once 'login.inc.php';
    if (user_is_authenticated()) {
        $id1 = ', user_id';
        $id2 = ', \'' . get_current_user_id() . '\'';
    } else {
        $id1 = $id2 = "";
    }
    $question = get_post('question');
    $description = get_post('description');
    $email = get_post('email');
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    connect_db();
    $add = "INSERT INTO feedback (\r\n\t\t\t\t\t feedback_id, question, description, post_datetime, email{$id1})\r\n\t\t\t\t     VALUES ('{$v4uuid}', '{$question}', '{$description}', '" . date('Y-m-d H:i:s') . "', '{$email}'{$id2})";
    $added = mysql_query($add) or die("Could not add entry!");
    echo "0";
}
Пример #18
0
 public function salvarAluno(modelben $o)
 {
     $id = @$o->get('idFun');
     if (empty($id)) {
         // recebe um id gerado
         $o->set('idFun', UUID::v4());
         $exec = "insert into Aluno(id, nome, endereco, data_nasc, sexo)\n\t\t\tvalues('" . $o->get('idFun') . "', '" . $o->get('funnome') . "', '" . $o->get('funend') . "', '" . $o->get('funadm') . "', '" . $o->get('sexo') . "')";
         //echo "$exec";
         // $exec="insert into Aluno(id)
         // values('".$o->get('idFun')."')";
     } else {
         $exec = "update funcionarios set funnome='" . $o->get('funnome') . "',\n\t\t\tfuntel='" . $o->get('funtel') . "',\n\t\t\tfunend='" . $o->get('funend') . "',\n\t\t\tfunadm='" . $o->get('funadm') . "',\n\t\t\tfunfuncao='" . $o->get('funfuncao') . "'\n\t\t\twhere funcod={$id}";
     }
     try {
         $this->o_db->exec($exec);
     } catch (PDOException $e) {
         throw $e;
     }
 }
Пример #19
0
 private function updateVicFloraImageMetadata()
 {
     foreach ($this->csvArray as $row) {
         $rec = $this->createImageRecord($row);
         $flrec = $this->findRecord($row['CumulusRecordID']);
         if ($flrec) {
             $imageID = $flrec->ImageID;
             $rec->TimestampCreated = $flrec->TimestampCreated;
             $rec->TimestampModified = date('Y-m-d H:i:s');
             $rec->GUID = $flrec->GUID;
             $rec->Version = $flrec->Version + 1;
             $this->updateImage($rec, $imageID);
         } else {
             $rec->TimestampCreated = date('Y-m-d H:i:s');
             $rec->TimestampModified = date('Y-m-d H:i:s');
             $rec->GUID = UUID::v4();
             $rec->Version = 1;
             $this->insertImage($rec);
         }
     }
     $this->deleteOldRecords();
 }
 /**
  * Create a content and activity records for each `Question`
  * extend_search/admin/load&module=questionanswer&model=Question
  */
 public function actionLoad()
 {
     $module = Yii::app()->request->getParam('module');
     $model_str = Yii::app()->request->getParam('model');
     $model = new $model_str();
     echo "Creating content and activity records for " . $module . " -> " . $model_str;
     // Loop through all
     foreach ($model::model()->findAll() as $record) {
         if (empty(Activity::model()->findByAttributes(array('object_model' => $model_str, 'object_id' => $record->id)))) {
             // Create activity record
             $sql = "INSERT INTO activity (type,module,object_model,object_id,created_at,created_by,updated_at,updated_by)\n                                VALUES (:type,:module,:object_model,:object_id,:created_at,:user_id,:updated_at,:user_id);";
             $parameters = array(":type" => $model_str . "Created", ":module" => $module, ":object_model" => 'Question', ":object_id" => $record->id, ":user_id" => $record->created_by, ":created_at" => $record->created_at, ":updated_at" => $record->updated_at);
             Yii::app()->db->createCommand($sql)->execute($parameters);
         }
         // Create content record
         if (!$record->content) {
             $sql = "INSERT INTO content (guid,object_model,object_id,visibility,sticked,archived,space_id,user_id,created_at,created_by,updated_at,updated_by)\n                                VALUES (:guid, :object_model, :object_id, 1, 0, '0', NULL, :user_id, :created_at, :user_id, :updated_at, :user_id);";
             $parameters = array(":guid" => UUID::v4(), ":object_model" => $model_str, ":object_id" => $record->id, ":user_id" => $record->created_by, ":created_at" => $record->created_at, ":updated_at" => $record->updated_at);
             Yii::app()->db->createCommand($sql)->execute($parameters);
         }
     }
 }
Пример #21
0
     if (!$db->Exec($sql)) {
         die("Error add user!");
     }
     die("ok");
     break;
 case "Edit":
     $userid = $_REQUEST["userid"];
     $login = $_REQUEST["login"];
     $pas = $_REQUEST["password"];
     $fir = $_REQUEST["firstname"];
     $las = $_REQUEST["lastname"];
     $per = $_REQUEST["permission"];
     $mail = $_REQUEST["mail"];
     $log->Write(basename(__FILE__, ".php"), "Изменение пользователя:" . $login);
     $hpass = crypt($pas, "mc05wBF&IТПШРnw4ton*R +-*/ ☺");
     $guid = UUID::v4();
     // permission: 0-admin,1-uploader,2-searcher
     $sql = " update `Users` set `Login`='{$login}'," . ($pas == "" ? "" : "`Password`='{$hpass}',") . " `Hash`='1',`FirstName`='{$fir}',`LastName`='{$las}' ,`Permission`='{$per}',`Mail`='{$mail}'  where `id`='{$userid}'";
     if (!$db->Exec($sql)) {
         die("Error update user!");
     }
     die("ok");
     break;
 case "Delete":
     $userid = $_REQUEST["userid"];
     $r = $db->QueryOne("select Login from Users where id='{$userid}' ");
     $log->Write(basename(__FILE__, ".php"), "Удаление пользователя:" . $r["Login"]);
     // permission: 0-admin,1-uploader,2-searcher
     $sql = " delete from `Users` where `id`='{$userid}'";
     if (!$db->Exec($sql)) {
         die("Error delete user!");
date_default_timezone_set('America/Caracas');
include_once "../clases/clase_docente.php";
include_once "../clases/clase_diagnostico.php";
ob_end_clean();
require_once "../libreria/fpdf/clsFpdf.php";
require_once "../clases/clase_bitacora.php";
require_once '../libreria/utilidades.php';
require_once '../libreria/uuid.php';
$lobjPdf = new clsFpdf();
$lobjBitacora = new clsBitacora();
$lobjUtil = new clsUtil();
$ObjDocente = new clsDocente();
$ObjDiagnostico = new clsDiagnostico();
$lobjPdf->AliasNbPages();
$lobjPdf->codigo = UUID::v4();
$lobjPdf->AddPage("P", "Letter");
$lcReal_ip = $lobjUtil->get_real_ip();
$ldFecha = date('Y-m-d h:m');
$lobjBitacora->set_Datos($_SERVER['HTTP_REFERER'], $ldFecha, $lcReal_ip, 'Reporte', '-', 'id_diagnostico', '-', $lobjPdf->codigo, $_GET['id_diagnostico'], $_SESSION['usuario'], 'listado_docentes_diagnostico');
//envia los datos a la clase bitacora
$lobjBitacora->registrar_bitacora();
//registra los datos en la tabla tbitacora.
$ObjDocente->set_Diagnostico($_GET['id_diagnostico']);
$ObjDiagnostico->set_Diagnostico($_GET['id_diagnostico']);
$row_detalle = $ObjDocente->listado_docente_diagnostico();
$row_consulta = $ObjDiagnostico->consultar_diagnostico();
$lobjPdf->SetFont("arial", "B", 12);
$lobjPdf->Ln(10);
$lobjPdf->Cell(0, 6, utf8_decode("DOCENTES POR TIPO DE CONDICION VISUAL"), 0, 1, "C");
$lobjPdf->Cell(0, 6, utf8_decode("TIPO DE CONDICION: " . $row_consulta[1]), 0, 1, "C");
Пример #23
0
/*
Uploadify
Copyright (c) 2012 Reactive Apps, Ronnie Garcia
Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
header("Content-Type:text/json;charset='utf-8'");
// Define a destination
$targetFolder = '/uploads/image';
// Relative to the root
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $fileExt = pathinfo($_FILES['Filedata']['name']);
    $targetFile = rtrim($targetPath, '/') . '/' . UUID::v4() . "." . $fileExt['extension'];
    // Validate the file type
    $fileTypes = array('jpg', 'jpeg', 'gif', 'png');
    // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);
    if (in_array($fileParts['extension'], $fileTypes)) {
        move_uploaded_file($tempFile, $targetFile);
        $ret = ["error" => 0, "message" => "Success", 'localurl' => $targetFile, 'aliurl' => "http://www.baidu.com/" . $targetFile, "id" => 100];
        echo json_encode($ret, true);
    } else {
        echo 'Invalid file type.';
    }
}
class UUID
{
    /**
Пример #24
0
 public function updateReference($data, $id = FALSE)
 {
     $updArray = array();
     foreach ($data as $key => $value) {
         if (substr($key, 0, 4) == 'ref_') {
             $keybits = explode('_', $key);
             $field = '';
             for ($i = 1; $i < count($keybits); $i++) {
                 $field .= $keybits[$i] == 'id' ? strtoupper($keybits[$i]) : ucfirst($keybits[$i]);
             }
             $updArray[$field] = $value ? $value : NULL;
         }
     }
     $updArray['TimestampModified'] = date('Y-m-d H:i:s');
     $updArray['ModifiedByID'] = $this->session->userdata('id');
     if ($id) {
         $updArray['Version']++;
         $this->db->where('ReferenceID', $id);
         $this->db->update('vicflora_reference', $updArray);
     } else {
         $newID = $this->getNewReferenceID();
         $updArray['ReferenceID'] = $newID;
         $updArray['Author'] = str_replace('|', '; ', $updArray['Author']);
         $updArray['TimestampCreated'] = $updArray['TimestampModified'];
         $updArray['CreatedByID'] = $updArray['ModifiedByID'];
         $updArray['Version'] = 1;
         $updArray['GUID'] = UUID::v4();
         $updArray['Subject'] = 'reference';
         $this->db->insert('vicflora_reference', $updArray);
         return $newID;
     }
 }
function following_add()
{
    include_once 'login.php';
    $id = get_current_user_id();
    $args = func_get_args();
    $cat = $args[2];
    $key = get_post('search');
    if (!$key) {
        die('Invalid Argument!');
    }
    connect_db();
    $view = "SELECT COUNT(*) FROM followings WHERE user_id='{$id}' AND deleted='0'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row[0] >= 20) {
        die('Too many followings!');
    }
    $view = "SELECT * FROM followings WHERE cat_id='{$cat}' AND user_id='{$id}' AND search='{$key}' AND deleted='0'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row) {
        following_delete("", "", $row['following_id']);
    }
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    $current_datetime = date('Y-m-d H:i:s');
    $view = "INSERT INTO followings(following_id, search, user_id, deleted, add_time, cat_id) VALUES ('{$v4uuid}', '{$key}', '{$id}', '0', '{$current_datetime}', '{$cat}')";
    $list = mysql_query($view) or die("Insert error!");
}
Пример #26
0
 /**
  * Method setEncountersSection() TODO
  */
 private function setEncountersSection()
 {
     $encounters = ['section' => ['templateId' => ['@attributes' => ['root' => $this->requiredEncounters ? '2.16.840.1.113883.10.20.22.2.22.1' : '2.16.840.1.113883.10.20.22.2.22']], 'code' => ['@attributes' => ['code' => '46240-8', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1']], 'title' => 'Encounters', 'text' => '']];
     $encountersData = [];
     if (!empty($encountersData)) {
         $encounters['text'] = ['table' => ['@attributes' => ['border' => '1', 'width' => '100%'], 'thead' => ['tr' => [['th' => [['@value' => 'Functional Condition'], ['@value' => 'Effective Dates'], ['@value' => 'Condition Status']]]]], 'tbody' => ['tr' => []]]];
         $encounters['entry'] = [];
         foreach ($encountersData as $item) {
             $encounters['text']['table']['tbody']['tr'][] = ['td' => [['@value' => 'Functional Condition Data'], ['@value' => 'Effective Dates Data'], ['@value' => 'Condition Status Data']]];
             $encounters['entry'][] = $order = ['encounter' => ['@attributes' => ['classCode' => 'ENC', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.49']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '99200', 'codeSystem' => $this->codes('CPT4')]], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['xsi:type' => 'IVL_TS'], 'low' => ['@attributes' => ['value' => '19320924']], 'high' => ['@attributes' => ['value' => '19320924']]], 'entryRelationship' => [['@attributes' => ['typeCode' => 'SUBJ'], 'observation' => ['@attributes' => ['classCode' => 'ACT', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.80']], 'code' => ['@attributes' => ['code' => '29308-4', 'codeSystem' => '2.16.840.1.113883.6.1']], 'entryRelationship' => [['@attributes' => ['typeCode' => 'SUBJ'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.4']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '282291009', 'codeSystem' => '2.16.840.1.113883.6.96'], 'originalText' => 'Original text'], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'value' => '20150123']], 'entryRelationship' => [['@attributes' => ['typeCode' => 'REFR'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.6']], 'code' => ['@attributes' => ['code' => '33999-4', 'codeSystem' => '2.16.840.1.113883.6.1']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'code' => '413322009']]]], ['@attributes' => ['typeCode' => 'REFR'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.5']], 'code' => ['@attributes' => ['code' => '11323-3', 'codeSystem' => '2.16.840.1.113883.6.1']], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'code' => '81323004']]]]]]]]]]]]];
         }
     }
     if ($this->requiredEncounters || !empty($encounters['entry'])) {
         $this->addSection(['section' => $encounters]);
     }
     unset($encountersData, $encounters);
 }
Пример #27
0
 /**
  * Tests UUID::v4()
  *
  * @test
  * @covers UUID::v4
  */
 public function test_v4_random()
 {
     $this->assertNotEquals('6ba7b810-9dad-11d1-80b4-00c04fd430c8', UUID::v4());
 }
Пример #28
0
 public function run()
 {
     DB::table('commands')->delete();
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'notify-host-by-email', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\nHost: $HOSTNAME$\\nState: $HOSTSTATE$\\nAddress: $HOSTADDRESS$\\nInfo: $HOSTOUTPUT$\\n\\nDate/Time: $LONGDATETIME$\\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'notify-service-by-email', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$\\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check-host-alive', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_disk', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_load', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_load -w $ARG1$ -c $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_procs', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_users', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_users -w $ARG1$ -c $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_swap', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_swap -w $ARG1$ -c $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_local_mrtgtraf', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_ftp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_hpjd', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_snmp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_http', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_http -I $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_ssh', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_dhcp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_dhcp $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_ping', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_pop', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_pop -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_imap', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_imap -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_smtp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_tcp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_udp', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'check_nt', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'process-host-perfdata', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "$LASTHOSTCHECK$\\t$HOSTNAME$\\t$HOSTSTATE$\\t$HOSTATTEMPT$\\t$HOSTSTATETYPE$\\t$HOSTEXECUTIONTIME$\\t$HOSTOUTPUT$\\t$HOSTPERFDATA$\\n" >> /var/log/nagios/host-perfdata.out']);
     $uuid = UUID::v4();
     Object::create(['uuid' => $uuid, 'object_type' => '12', 'first_name' => 'process-service-perfdata', 'second_name' => '', 'is_active' => '1']);
     Command::create(['object_uuid' => $uuid, 'command_line' => '/usr/bin/printf "%b" "$LASTSERVICECHECK$\\t$HOSTNAME$\\t$SERVICEDESC$\\t$SERVICESTATE$\\t$SERVICEATTEMPT$\\t$SERVICESTATETYPE$\\t$SERVICEEXECUTIONTIME$\\t$SERVICELATENCY$\\t$SERVICEOUTPUT$\\t$SERVICEPERFDATA$\\n" >> /var/log/nagios/service-perfdata.out']);
 }
Пример #29
0
/**
* 
*  getTempFilename - HelperFunction
* 
* @param string $url
* @param string $NS
* 
* @return
*/
function getTempFilename($url, $NS = '09c8637d-64f7-5eed-a80a-07a59059c47c')
{
    //1.3.6.1.4.1.37553.8.1.8.8.5.65.1
    return sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'download.zip.' . mt_rand(1000, 9999) . '.' . UUID::v3($NS, $url) . '.' . UUID::v5($NS, $url) . '.' . UUID::v4() . '.' . 'zip';
}
function search_history_add()
{
    include_once 'login.inc.php';
    $id = get_current_user_id();
    $args = func_get_args();
    $cat = $args[2];
    if (!$cat) {
        $cat = 0;
    }
    $key = get_post('search');
    if (!$key) {
        die('Invalid Argument!');
    }
    connect_db();
    $view = "SELECT * FROM searchhistory WHERE cat_id='{$cat}' AND user_id='{$id}' AND search='{$key}' AND deleted='0'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row) {
        search_history_delete("", "", $row['history_id']);
    }
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    $current_datetime = date('Y-m-d H:i:s');
    $view = "INSERT INTO searchhistory(history_id, search, user_id, deleted, add_time, cat_id) VALUES ('{$v4uuid}', '{$key}', '{$id}', '0', '{$current_datetime}', '{$cat}')";
    $list = mysql_query($view) or die("Insert error!");
    $view = "SELECT * FROM searches WHERE search='{$key}' AND cat_id='{$cat}'";
    $list = mysql_query($view);
    $row = mysql_fetch_array($list);
    if ($row) {
        $currentnum = intval($row['count']) + 1;
        $view = "UPDATE searches SET count = '{$currentnum}' WHERE search='{$key}' AND cat_id='{$cat}'";
        #echo $currentnum.$key.$cat;
        $list = mysql_query($view) or die("Update count error!");
    } else {
        $view = "INSERT INTO searches(search, cat_id, count) VALUES('{$key}', '{$cat}', '1')";
        $list = mysql_query($view) or die("Insert count error!");
    }
}