in 2.3.x-and-above/upload/catalog/controller/extension/module/facebook_business.php [99:137]
public function appStoreConnect() {
$json = array();
$this->load->model('extension/module/facebook_business');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['store_url']) && isset($this->request->post['username']) && isset($this->request->post['password'])) {
if (strpos(HTTPS_SERVER, $this->request->post['store_url']) !== false && $this->model_extension_module_facebook_business->isVerifiedAdminUser($this->request->post['username'], $this->request->post['password'])) {
if ($this->model_extension_module_facebook_business->isExtensionInstalled()) {
if ($this->config->get('facebook_fbe_v2_installed')) {
$json['error'] = 'Your store is already connected to a Facebook Business Page.';
} elseif (!$this->model_extension_module_facebook_business->isVerifiedAdminUser($this->request->post['username'], $this->request->post['password'], 'extension/module/facebook_business')) {
$json['error'] = 'OpenCart Admin user does not have the correct permissions to perform this action!';
}
} elseif (!$this->model_extension_module_facebook_business->isVerifiedAdminUser($this->request->post['username'], $this->request->post['password'], 'extension/extension/module', true)) {
$json['error'] = 'OpenCart Admin user does not have the correct permissions to perform this action!';
}
if (!$json) {
$json['success'] = true;
$json['fbe_params'] = array(
'external_business_id' => HTTPS_SERVER,
'business_name' => $this->config->get('config_name') ? $this->config->get('config_name') : 'My Business',
'feed_url' => $this->url->link('extension/module/facebook_business/genFeed', '', true),
'feed_ping_url' => $this->url->link('extension/module/facebook_business/genFeedPing', '', true),
'timezone' => date_default_timezone_get(),
'currency' => strtoupper(addslashes($this->config->get('config_currency'))),
'version' => $this->model_extension_module_facebook_business->getPluginVersion()
);
}
} else {
$json['error'] = 'OpenCart Store verification failed!';
}
} else {
$json['error'] = 'Invalid parameters provided! Please contact OpenCart support for assistance.';
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}