コード例 #1
0
 public static function AddRequest($requester_account_id, $requested_account_id)
 {
     $sqlCommand = "INSERT INTO accounts_network(requester_account_id, requested_account_id, created_datetime)" . "VALUES (?,?, NOW())";
     $paramTypeSpec = "ii";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $requester_account_id, $requested_account_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $insertedID = $mysqli->insert_id;
     $retrievedRecord = da_account::GetAccountNetworkEntry($insertedID);
     return $retrievedRecord;
 }
コード例 #2
0
ファイル: da_content.php プロジェクト: JulioOrdonezV/pvcloud
 /**
  * Returns the list of all content documents 
  * @param N/A
  * return Array
  */
 public static function GetListOfContents()
 {
     $sqlCommand = "SELECT document_id,title,description,Content FROM docs_and_drivers";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
     }
     if (!$stmt->execute()) {
         echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
     }
     $contentEntry = new be_content();
     $stmt->bind_result($contentEntry->content_id, $contentEntry->title, $contentEntry->description, $contentEntry->Content);
     $arrayResult = [];
     while ($stmt->fetch()) {
         $arrayResult[] = json_decode(json_encode($contentEntry));
     }
     $stmt->close();
     return $arrayResult;
 }
コード例 #3
0
ファイル: da_widgets.php プロジェクト: rfrancoch/pvcloud
 /**
  * 
  * @param int $widget_id
  * @return \be_widget
  */
 public static function RemoveWidget($widget_id)
 {
     $sqlCommand = "UPDATE widgets " . " SET deleted_datetime = NOW() " . " WHERE widget_id = ? ";
     $paramTypeSpec = "i";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->connect_errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, widget_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $retrievedWidget = da_widgets::GetWidget($widget_id);
     return $retrievedWidget;
 }
コード例 #4
0
 public static function GetWidgetConfigListByID($widget_id)
 {
     $sqlCommand = "SELECT widget_config_id, widget_id, vse_label, simple_object_property, friendly_label, options_json" . " FROM widget_config " . " WHERE widget_id = ?" . " AND deleted_datetime IS NULL";
     $paramTypeSpec = "i";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $widget_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $result = new be_widget_config();
     $stmt->bind_result($result->widget_config_id, $result->widget_id, $result->vse_label, $result->simple_object_property, $result->friendly_label, $result->options_json);
     $arrayResult = [];
     while ($stmt->fetch()) {
         $arrayResult[] = json_decode(json_encode($result));
     }
     // if (!$stmt->fetch()) {
     //     $result = NULL;
     // }
     $stmt->close();
     return $arrayResult;
 }
コード例 #5
0
ファイル: da_widgets.php プロジェクト: JulioOrdonezV/pvcloud
 /**
  * 
  * 
  * @return \be_widgettype
  */
 public static function GetWidgetsTypes()
 {
     $sqlCommand = "SELECT widget_type_id, widget_type_name, description" . " FROM widget_types " . " WHERE deleted_datetime is null ";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->connect_errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $widgetTypeEntry = new be_widgettype();
     $stmt->bind_result($widgetTypeEntry->widget_type_id, $widgetTypeEntry->widget_type_name, $widgetTypeEntry->description);
     $arrayResult = [];
     while ($stmt->fetch()) {
         $arrayResult[] = json_decode(json_encode($widgetTypeEntry));
     }
     $stmt->close();
     return $arrayResult;
 }
コード例 #6
0
ファイル: da_vse_data.php プロジェクト: JulioOrdonezV/pvcloud
 /**
  * 
  * @param int $entry_id
  * @return \be_vse_data
  */
 private static function getSpecificEntry($entry_id)
 {
     $sqlCommand = "SELECT  entry_id,app_id,vse_label,vse_value,vse_type,vse_annotations,captured_datetime,created_datetime " . " FROM vse_data WHERE entry_id = ? ";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->connect_errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param("i", $entry_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $result = new be_vse_data();
     $stmt->bind_result($result->entry_id, $result->app_id, $result->vse_label, $result->vse_value, $result->vse_type, $result->vse_annotations, $result->captured_datetime, $result->created_datetime);
     if (!$stmt->fetch()) {
         $result = NULL;
     }
     $stmt->close();
     return $result;
 }
コード例 #7
0
 public static function GetInvitationAvailability($account_id)
 {
     $sqlCommand = "SELECT COUNT(DISTINCT app_registry.app_id) AS app_number" . "FROM app_registry" . "INNER JOIN vse_data ON vse_data.app_id = app_registry.app_id" . "WHERE account_id=?";
     $paramTypeSpec = "i";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $invitation_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $app_count = 0;
     $result = false;
     $stmt->bind_result($app_count);
     if (!$stmt->fetch()) {
         $result = false;
     } else {
         if ($app_count > 0) {
             $result = true;
         }
     }
     $stmt->close();
     return $result;
 }
コード例 #8
0
 /**
  * 
  * @param be_generic_value_entry $valueEntry
  * @return be_generic_value_entry
  */
 public static function AddNewEntry($valueEntry)
 {
     $created_datetime = DA_Helper::GetServerDate();
     $sqlCommand = "INSERT INTO generic_value_log (" . "app_id," . "value_label," . "value," . "value_type_code," . "captured_datetime," . "created_datetime " . ")" . " VALUES(?,?,?,?,?,?)";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
     }
     if (!$stmt->bind_param("isssss", $valueEntry->app_id, $valueEntry->value_label, $valueEntry->value, $valueEntry->value_type_code, $valueEntry->captured_datetime, $created_datetime)) {
         echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
     }
     if (!$stmt->execute()) {
         echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
     }
     $insertedID = $mysqli->insert_id;
     $stmt->close();
     $retrievedValue = da_generic_value::GetEntry($insertedID);
     print_r($retrievedValue);
     return $retrievedValue;
 }
コード例 #9
0
 /**
  * Deletes a app by updating its deleted_datetime
  * @param int $app_id
  * @return be_app
  */
 public static function DeleteApp($app_id)
 {
     $sqlCommand = "UPDATE app_registry " . " SET  deleted_datetime = NOW() " . " WHERE app_id = ? ";
     $paramTypeSpec = "i";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $app_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $retrievedApp = da_apps_registry::GetApp($app_id);
     return $retrievedApp;
 }
コード例 #10
0
ファイル: da_account.php プロジェクト: JulioOrdonezV/pvcloud
 /**
  * Updates the data of an account
  * @param be_account $account
  * @return be_account
  */
 public static function UpdateAccount($account)
 {
     $sqlCommand = "UPDATE accounts " . " SET confirmation_guid = ?," . " confirmed = ?," . " deleted_datetime = ?," . " email = ?," . " nickname = ?," . " pwd_hash = ?" . " WHERE account_id = ? ";
     $paramTypeSpec = "sissssi";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->connect_errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $account->confirmation_guid, $account->confirmed, $account->deleted_datetime, $account->email, $account->nickname, $account->pwd_hash, $account->account_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $savedAccount = da_account::GetAccount($account->email);
     return $savedAccount;
 }
コード例 #11
0
ファイル: da_session.php プロジェクト: JulioOrdonezV/pvcloud
 private static function getValidSession($account_id, $token)
 {
     $sqlCommand = "SELECT s.account_id, s.token, s.expiration_datetime, s.created_datetime, s.modified_datetime " . " FROM sessions s " . " WHERE s.account_id=? AND s.token=? AND NOW() < s.expiration_datetime ";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param("is", $account_id, $token)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $result = new be_session();
     $stmt->bind_result($result->account_id, $result->token, $result->expiration_datetime, $result->created_datetime, $result->modified_datetime);
     if (!$stmt->fetch()) {
         $result = NULL;
     }
     $stmt->close();
     return $result;
 }