function get() { $id = $this->input->post("id"); if ($id > 0) { $clientObject = new Client($id); if (!$clientObject->exists()) { $data["error"] = TRUE; $data["message"] = "Couldn't find in DB"; } else { $data = $clientObject->to_array(); $data["error"] = FALSE; } } else { $data["error"] = TRUE; $data["message"] = "ID not greater than 0"; } echo json_encode($data); }
public static function create() { // TODO: Remplacer 'root' par '' en prod absolument !! $public_key = $_SERVER['HTTP_X_PUBLIC_KEY'] ?? 'root'; // TODO: Remplacer 'hash_hmac(...)' par '' en prod absolument !! $received_hash = $_SERVER['HTTP_X_HASH'] ?? hash_hmac('sha256', 'root', 'root'); if (Client::exists('public_key', $public_key)) { $client = Client::getBy('public_key', $public_key); $expected_hash = hash_hmac('sha256', $client->name, $client->private_key); if ($received_hash == $expected_hash) { $token = Token::generate(); $ttl = 600; Token::insertIntoDb([$token, Utils::time(), $ttl, $client->id]); Data::get()->add('token', $token); return null; } } Data::get()->add('error', 'Wrong keypair'); }
along with Webfinance; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ include "../../inc/main.php"; must_login(); if (!isset($_GET['id_client']) or !isset($_GET['id_invoice'])) { echo "Missing arguments"; exit; } if (!is_numeric($_GET['id_client']) or !is_numeric($_GET['id_invoice'])) { echo "Wrong arguments"; exit; } $Client = new Client(); # check client and invoice if (!$Client->exists($_GET['id_client'])) { echo _("This client doesn't exist"); exit; } $Invoice = new Facture(); if ($Invoice->exists($_GET['id_invoice'])) { $inv = $Invoice->getInfos($_GET['id_invoice']); if ($inv->id_client != $_GET['id_client']) { echo _("This invoice isn't yours!"); exit; } $Client = new Client($_GET['id_client']); } #site $result = mysql_query("SELECT value FROM webfinance_pref WHERE type_pref='societe' AND owner=-1") or wf_mysqldie(); list($value) = mysql_fetch_array($result);
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Webfinance; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "../inc/main.php"; $User = new User(); if (!$User->isAuthorized("manager")) { $_SESSION['came_from'] = $_SERVER['REQUEST_URI']; header("Location: /login.php"); exit; } if (isset($_GET['action']) && $_GET['action'] == "delete") { $Client = new Client($_GET['id']); if ($Client->exists()) { $q = mysql_query("SELECT id_facture FROM webfinance_invoices WHERE id_client=" . $_GET['id']) or die(mysql_error()); $clause = "WHERE ("; while (list($id_inv) = mysql_fetch_array($q)) { $clause .= " id_invoice={$id_inv} OR"; } $clause = preg_replace('/OR$/', ") AND type<>'real'", $clause); if (mysql_num_rows($q) > 0) { mysql_query("DELETE FROM webfinance_transactions {$clause}") or die(mysql_error()); } mysql_free_result($q); mysql_query("DELETE FROM webfinance_clients WHERE id_client=" . $_GET['id']) or die(mysql_error()); $User->delete($Client->id_user); # Remove each document $q = mysql_query("SELECT md5 FROM document WHERE provider_id=" . $_GET['id']) or die(mysql_error()); while (list($md5) = mysql_fetch_array($q)) {
/** * Check whether a file exists. * * @param string $path * * @return array|bool|null */ public function has($path) { return $this->client->exists($path) === 1; }
/** * Tests a malfunctional server. */ public function testRequestError() { $this->setExpectedException('\\Jyxo\\Webdav\\Exception'); $client = new Client(array('127.0.0.1:5555')); $client->exists($this->file); }
$converter = new Encryption(); $decoded = $converter->decode($_GET['id']); $chain = explode('|', $decoded); $id_invoice = $chain[0]; $id_client = $chain[1]; if (!isset($id_client) or !isset($id_invoice)) { echo "Missing arguments"; exit; } if (!is_numeric($id_client) or !is_numeric($id_invoice)) { echo "Wrong arguments"; exit; } $Client = new Client(); # check client and invoice if (!$Client->exists($id_client)) { echo _("This client doesn't exist"); exit; } $Invoice = new Facture(); if ($Invoice->exists($id_invoice)) { $inv = $Invoice->getInfos($id_invoice); if ($inv->id_client != $id_client) { echo _("This invoice isn't yours!"); exit; } if ($inv->is_paye > 0) { echo _("This invoice is already paid."); exit; } $Client = new Client($id_client);