/home
/deploy
/EHungry-2-joel
/Web
/classes
/Restaurant.class.php
return false;
}
break;
case PAYMENT_CREDIT:
case PAYMENT_DEBIT:
case PAYMENT_PREPAID:
case PAYMENT_UNKNOWN_CARD:
case PAYMENT_APPLE_PAY:
case PAYMENT_GOOGLE_PAY:
if (!($this->pay_with_credit & @constant($cart->getBaseOrderType()))) {
return false;
}
//if mercury/vantiv and adding new card
if ($account->getEffectivePaymentProcessorId() == PaymentProcessor\Vantiv::$processorId && $handler->params['credit~card'] == -1) {
return true;
}
//Google Pay (Authorize.net and CardConnect)
<<<<<<< HEAD
if ((!empty($handler->params['googlePayToken']) || !empty($handler->params['applePayToken'])) && $account->canUseDigitalWallets()) {
=======
if (!empty($handler->params['google~pay~token']) && $account->canUseGooglePay()) {
>>>>>>> origin/Release/PHP7
return true;
}
$card = new CustomerPaymentInfo($handler->params['credit~card']);
//credit card must match the delivery address it was created for
if ($cart->getBaseOrderType() == 'DELIVERY'
&& ($card->delivery_address_id && $card->delivery_address_id != $cart->getDeliveryAddressId())
&& ($card->delivery_address_id != -1 || $card->saved)) {
return false;
}
$cardTypeName = $card->getShortTypeName();
$cart->setHouseAccountId(null);
$cart->setCustomPaymentTypeId(null);
Arguments
"syntax error, unexpected '<<' (T_SL), expecting case (T_CASE) or default (T_DEFAULT) or '}'"
/home
/deploy
/EHungry-2-joel
/PHP
/vendor
/composer
/ClassLoader.php
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
Arguments
"/home/deploy/EHungry-2-joel/PHP/vendor/composer/../../../Web/classes/Restaurant.class.php"
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
if (is_array($restaurants)) {
return count($restaurants);
}
return 0;
}
/**
* All restaurants for the given account which are not deleted and, optionally, not locked ($activeOnly)
* @param int $aid
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
* @see Restaurant::clearCacheByAccountId() so you can clean up the cache keys
*/
public static function getAllRestaurantsByAccountId($aid, $orderBy = 'display_name', $activeOnly = false) {
$cacheKey = "restaurants_{$aid}_{$orderBy}_".($activeOnly? 1 : 0);
return Cache::RememberArray($cacheKey, function () use ($aid, $orderBy, $activeOnly) {
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
if ($activeOnly) {
$list->where('is_locked', false);
}
if (in_array($orderBy, ['position', 'id', 'display_name'])) {
$list->orderBy($orderBy);
}
return $list->get()->all()?: null;
}, true);
}
/**
* All restaurants for the current account which are not deleted and, optionally, not locked ($activeOnly)
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
*/
public function getAllRestaurants($orderBy = 'display_name', $activeOnly = false) {
return self::getAllRestaurantsByAccountId($this->id, $orderBy, $activeOnly);
}
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Cache.class.php
}
private static function RememberType($type, $allowNull, $key, callable $generator, $expire = 86400) {
if (!static::getInstance()) {
return false;
}
if ($type) {
$notFound = $type == 'bool'? null : false;
$value = static::GetType($type, $key, $allowNull, $notFound);
if ($value !== $notFound) {
return $value;
}
} else {
if ($value = static::Get($key)) {
return $value;
}
}
$value = $generator();
if (is_null($value) && !$allowNull) { //skips saving a null value if these are forbidden
return null;
}
static::Set($key, $type? serialize($value) : $value, $expire);
return $value;
}
/**
* If the value for $key is not found, it's generated using $generator and then, stored for further uses.
* @param string $key
* @param callable $generator
* @param int $expire
* @return array|bool|mixed|string
*/
public static function Remember($key, callable $generator, $expire = 86400) {
return static::RememberType(null, null, $key, $generator, $expire);
}
/**
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Cache.class.php
* @param string $key
* @param callable $generator
* @param bool $allowNull
* @param int $expire
* @return null|bool|object
*/
public static function RememberObject($key, callable $generator, $allowNull = false, $expire = 86400) {
return static::RememberType('object', $allowNull, $key, $generator, $expire);
}
/**
* If the value for $key is not found, it's generated using $generator and then, stored for further uses.
* @param string $key
* @param callable $generator
* @param bool $allowNull
* @param int $expire
* @return null|bool|array
*/
public static function RememberArray($key, callable $generator, $allowNull = false, $expire = 86400) {
return static::RememberType('array', $allowNull, $key, $generator, $expire);
}
/**
* If the value for $key is not found, it's generated using $generator and then, stored for further uses.
* @param string $key
* @param callable $generator
* @param int $expire
* @return null|bool
*/
public static function RememberBoolean($key, callable $generator, $expire = 86400) {
return static::RememberType('array', false, $key, $generator, $expire);
}
}
Arguments
"array"
true
"restaurants_8980_display_name_1"
Closure {
class: "Account"
use: {
$aid: 8980
$orderBy: "display_name"
$activeOnly: true
}
}
86400
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
* @param int $aid
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
* @see Restaurant::clearCacheByAccountId() so you can clean up the cache keys
*/
public static function getAllRestaurantsByAccountId($aid, $orderBy = 'display_name', $activeOnly = false) {
$cacheKey = "restaurants_{$aid}_{$orderBy}_".($activeOnly? 1 : 0);
return Cache::RememberArray($cacheKey, function () use ($aid, $orderBy, $activeOnly) {
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
if ($activeOnly) {
$list->where('is_locked', false);
}
if (in_array($orderBy, ['position', 'id', 'display_name'])) {
$list->orderBy($orderBy);
}
return $list->get()->all()?: null;
}, true);
}
/**
* All restaurants for the current account which are not deleted and, optionally, not locked ($activeOnly)
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
*/
public function getAllRestaurants($orderBy = 'display_name', $activeOnly = false) {
return self::getAllRestaurantsByAccountId($this->id, $orderBy, $activeOnly);
}
public static function checkIfRestaurantPhoneNumberExistsWithinAReseller($rid, $phone) {
// We start by validating and formatting the given phone number
$pv = new PhoneValidator($phone);
// If the phone number is not valid, we return
if ($phone == '' || !$pv->validate()) {
return '';
}
Arguments
"restaurants_8980_display_name_1"
Closure {
class: "Account"
use: {
$aid: 8980
$orderBy: "display_name"
$activeOnly: true
}
}
true
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
$list = Restaurant::isDeleted(false)->where('account_id', $aid);
if ($activeOnly) {
$list->where('is_locked', false);
}
if (in_array($orderBy, ['position', 'id', 'display_name'])) {
$list->orderBy($orderBy);
}
return $list->get()->all()?: null;
}, true);
}
/**
* All restaurants for the current account which are not deleted and, optionally, not locked ($activeOnly)
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
*/
public function getAllRestaurants($orderBy = 'display_name', $activeOnly = false) {
return self::getAllRestaurantsByAccountId($this->id, $orderBy, $activeOnly);
}
public static function checkIfRestaurantPhoneNumberExistsWithinAReseller($rid, $phone) {
// We start by validating and formatting the given phone number
$pv = new PhoneValidator($phone);
// If the phone number is not valid, we return
if ($phone == '' || !$pv->validate()) {
return '';
}
// Otherwise, we get the formatted number
$formattedPhone = $pv->getPrettyNumber();
$db_conn = DB::conn();
$sql = "SELECT r.display_name FROM ".Restaurant::getTableName()." AS r INNER JOIN account AS a ON r.account_id = a.id WHERE a.reseller_user_id = ? AND TRIM(r.primary_phone) = ? LIMIT 1";
$db_conn->bindParameter($sql, 1, $rid, "string");
$db_conn->bindParameter($sql, 1, $formattedPhone, "string");
$result = $db_conn->query($sql);
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
*/
public function getPublicOrderingStatus() {
$restaurant = $this->getDefaultRestaurant();
if (!$restaurant) {
return false;
}
if (!$restaurant->getPublicOrderingIsClosed()) {
return 'ACTIVE';
}
if ($restaurant->getPublicOrderingIsClosedForever()) {
return 'DISABLE';
}
return 'TEMP DISABLE';
}
public function getActiveRestaurants($order_by = 'display_name') {
return $this->getAllRestaurants($order_by, true);
}
public function getRestaurantCount() {
$restaurants = $this->getAllRestaurants('display_name', true);
if (is_array($restaurants)) {
return count($restaurants);
}
return 0;
}
/**
* All restaurants for the given account which are not deleted and, optionally, not locked ($activeOnly)
* @param int $aid
* @param string $orderBy One of: position, id, display_name
* @param bool $activeOnly
* @return Restaurant[]|null
* @see Restaurant::clearCacheByAccountId() so you can clean up the cache keys
*/
public static function getAllRestaurantsByAccountId($aid, $orderBy = 'display_name', $activeOnly = false) {
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Account.class.php
public function getPaymentAggregatorMessage($type, $isSpringroll = false) {
if ($this->payment_aggregator_messaging_enabled) {
$config = Configuration::getDefault();
if ($config->{"payment_aggregator_{$type}_message"}) {
$paymentAggregatorId = isSpringroll() || $isSpringroll ? PaymentAggregator::PAYMENT_AGGREGATOR_SPRINGROLL : $this->payment_aggregator_id;
$paymentAggregator = new PaymentAggregator($paymentAggregatorId);
$message = str_replace('{PAYMENT_AGGREGATOR}', $paymentAggregator->descriptor, $config->{"payment_aggregator_{$type}_message"});
$link = $paymentAggregator->url ? ('<a href="' . $paymentAggregator->url .'" target="_blank">' . $paymentAggregator->descriptor . '</a>') : $paymentAggregator->descriptor;
return str_replace('{PAYMENT_LINK}', ($link), $message);
}
}
return '';
}
public function isShipdayOn() {
return $this->shipday_enabled_status == Account::SHIPDAY_ENABLED_STATUS_ENABLED || $this->shipday_enabled_status == Account::SHIPDAY_ENABLED_STATUS_DISABLE_REQUESTED;
}
public function isOnSpringroll() {
foreach ($this->getActiveRestaurants() as $restaurant) {
if ($restaurant->is_on_springroll) {
return true;
}
}
return false;
}
public function getContextualAnnouncementsEnabled() {
return isSpringroll() ? $this->springroll_announcements_enabled : $this->announcements_enabled;
}
public function getContextualAnnouncementsPlace() {
return isSpringroll() ? $this->springroll_announcements_place : $this->announcements_place;
}
public function getContextualAnnouncementsHtml() {
return isSpringroll() ? $this->springroll_announcements_html : $this->announcements_html;
}
/**
/home
/deploy
/EHungry-2-joel
/Web
/controllers
/customer.php
if ($customDomain) {
$a = new Account($customDomain->getAccountId());
if ($a->hasPermission(WHITELABEL)) {
//adjust query string to match what the system expects without a custom domain
$_REQUEST["aid"] = $a->getUrlTag();
if (strpos($_SERVER['QUERY_STRING'], "aid=".$_REQUEST["aid"]) === false) {
parse_str($_SERVER['QUERY_STRING'], $qs);
$qs['aid'] = $a->getUrlTag();
$_SERVER['QUERY_STRING'] = http_build_query($qs);
}
$customDomainSet = true;
}
}
if (!$customDomainSet) {
$_REQUEST['aid'] = array_shift($tokens);
}
$account = getAccountForRequest();
if (!$account || (isSpringroll() && !$account->isOnSpringroll())) {
http_response_code(404);
include(App_Path.'/Web/noaccount.php');
exit(0);
}
/**
* Used mainly for restricting queries with {@link BaseClass::$globalAccountScope} enabled.
* The original $_SESSION['account_id'] holds the logged in Admin's account - which should be the same in most cases,
* but you never know if they're browsing rival restaurants... And in the customer pages, that is used to identify the
* admin is browsing its own pages.
* @see isLoggedAsCustomerAdmin()
*/
$_SESSION['customer_account_id'] = $account->id;
//if user isn't on a custom domain and they're browsing an account on a URL other than the URL Tag, redirect to the URL Tag
if (!$customDomainSet && $_REQUEST['aid'] != $account->getUrlTag()) {
$uri = str_ireplace($_REQUEST['aid'], $account->getUrlTag(), $_SERVER['REQUEST_URI']);
header('Location: '.$uri, true, 301);
exit(0);
}
/home
/deploy
/EHungry-2-joel
/Web
/index.php
App::startTime();
ErrorHandlers::register();
// Global.php is the core setup file for the application
App::debugbarTime('Global.php');
require(dirname(__DIR__) . '/PHP/Global.php');
App::debugbarTime('Global.php');
/** @var string $controller The main controller - defined at /PHP/Global.php */
App::debugbarTime('Sentry - controller');
ErrorHandlers::sentryInit($controller); //doesn't always do much - not every controller has a Sentry project
App::debugbarTime('Sentry - controller');
App::debugbarTime("controller: $controller");
apache_note('AppController', $controller);
if (file_exists(CORE_PATH."lib/helpers/$controller.php")) {
require CORE_PATH."lib/helpers/$controller.php";
}
require CORE_PATH."controllers/$controller.php";
App::debugbarTime("controller: $controller");
Arguments
"/home/deploy/EHungry-2-joel/Web/controllers/customer.php"