本文整理汇总了PHP中Client::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::exists方法的具体用法?PHP Client::exists怎么用?PHP Client::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::exists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
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);
}
示例2: create
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');
}
示例3: Client
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);
示例4: User
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)) {
示例5: has
/**
* Check whether a file exists.
*
* @param string $path
*
* @return array|bool|null
*/
public function has($path)
{
return $this->client->exists($path) === 1;
}
示例6: testRequestError
/**
* 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);
}
示例7: Encryption
$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);