Example #1
0
/** Cut any prefix 0's of an string */
function cutZeroPrefix($string)
{
    $prefix = '0';
    if (substr($string, 0, strlen($prefix)) == $prefix) {
        $string = substr($string, strlen($prefix));
        return cutZeroPrefix($string);
    } else {
        return $string;
    }
}
Example #2
0
     /**
      *		Attempt to create a new contact to the WhatsSpy Public Database (39512f5ea29c597f25483697471ac0b00cbb8088359c219e98fa8bdaf7e079fa)
      *		@notice This user is not verified as a WhatsApp user, the tracker verifies the contacts.
      */
 /**
  *		Attempt to create a new contact to the WhatsSpy Public Database (39512f5ea29c597f25483697471ac0b00cbb8088359c219e98fa8bdaf7e079fa)
  *		@notice This user is not verified as a WhatsApp user, the tracker verifies the contacts.
  */
 case 'addContact':
     requireAuth();
     if (isset($_GET['number']) && isset($_GET['countrycode'])) {
         // Name is optional
         $name = isset($_GET['name']) ? $_GET['name'] : null;
         // cut any prefix zero's of the number and country code.
         $number = cutZeroPrefix($_GET['number']);
         $countrycode = cutZeroPrefix($_GET['countrycode']);
         $groups = explode(',', $_GET['groups'] == '' ? null : $_GET['groups']);
         $account = preg_replace('/\\D/', '', $countrycode . $number);
         echo json_encode(addAccount($name, $account, $groups, true));
     } else {
         echo json_encode(['error' => 'No phone number supplied!', 'code' => 400]);
     }
     break;
     /**
      *		Set a contact to inactive, causing the user will not be tracked anymore but all data will be retained.
      */
 /**
  *		Set a contact to inactive, causing the user will not be tracked anymore but all data will be retained.
  */
 case 'setContactInactive':
     requireAuth();