Exemplo n.º 1
0
 public static function GetServerDate()
 {
     $sqlCommand = " SELECT NOW() AS NOW ";
     $result = DA_Helper::ExecuteNonParametricQuery($sqlCommand);
     $row = mysql_fetch_assoc($result);
     return $row['NOW'];
 }
Exemplo n.º 2
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;
 }
 public static function PasswordRecovery_Execute()
 {
     $response = new WebServiceClass();
     try {
         $parameters = WebServiceClass::collectParameters();
         $account = da_account::GetAccountByID($parameters->AccountID);
         if ($account != NULL) {
             if ($account->email != "" && $parameters->Email == $account->email) {
                 if ($account->confirmation_guid == $parameters->ConfirmationCode) {
                     $accountModificationTime = new DateTime($account->modified_datetime);
                     $currentDateTime = new DateTime(DA_Helper::GetServerDate());
                     $difference = $currentDateTime->diff($accountModificationTime);
                     if ($difference->d == 0) {
                         $account->pwd_hash = sha1($parameters->Password);
                         $savedAccount = da_account::UpdateAccount($account);
                         if ($savedAccount != NULL && $savedAccount->account_id == $account->account_id) {
                             $response->status = "OK";
                             $response->message = "Contraseña Actualizada Satisfactoriamente";
                             WebServiceClass::sendPWRecoveryEmail($account);
                         } else {
                             $response->status = "ERROR";
                             $response->message = "Solicitud Inválida";
                         }
                     } else {
                         $response->status = "ERROR";
                         $response->message = "Solicitud Expirada";
                     }
                 } else {
                     $response->status = "ERROR";
                     $response->message = "Solicitud Inválida";
                 }
             } else {
                 $response->status = "ERROR";
                 $response->message = "Solicitud Inválida";
             }
         } else {
             $response->status = "ERROR";
             $response->message = "Solicitud Inválida";
         }
     } catch (Exception $ex) {
         $response->status = "EXCEPTION";
         $response->message = $ex->getMessage();
     }
     return $response;
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 /**
  * 
  * @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;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
0
 /**
  * 
  * 
  * @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;
 }
Exemplo n.º 8
0
 /**
  * 
  * @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;
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
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;
 }
Exemplo n.º 12
0
 /**
  * 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;
 }
Exemplo n.º 13
0
echo $_SERVER["HTTP_HOST"];
?>
/wp-content/plugins/downloadarea/downloadarea/js/dropzone.js"></script>
<script src="http://<?php 
echo $_SERVER["HTTP_HOST"];
?>
/wp-content/plugins/downloadarea/downloadarea/js/jquery-ui.min.js"></script>
<script src="/wp-content/plugins/downloadarea/downloadarea/js/mydropzone.js"></script>
<form method="post" id="my-awesome-dropzone" action="admin-ajax.php" class="dropzone">
  <div class="dropzone-previews"></div>
  <div class="dz-message" data-dz-message><span>Drop the files or folders here. Filesize-limit per upload: <?php 
echo DA_Helper::getServerFilesizeLimit();
?>
</span></div>
  <span id="filesizelimit" data="<?php 
echo preg_replace("/M/", "", DA_Helper::getServerFilesizeLimit());
?>
"></span>
  <div class="fallback"> <!-- this is the fallback if JS isn't working -->
    <input name="file" type="file" multiple />
    <input name="submitted" value="1" type="hidden"/>
  </div>
</form>
<button type="submit" id="submit-all" class="btn btn-primary btn-xs">Upload the file</button>
<div class="create-folder">
  <form action="javascript:;" id="new_folder">
    <input id="create-folder-val" name="new_folder_name" placeholder="Your new folder name"></input>
  </form>
  <button id="create-folder-button" class="btn btn-primary btn-xs">Create the folder</button>
  <div class="create-results"></div>
</div>
Exemplo n.º 14
0
 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;
 }