%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/www/src/Controller/ |
Upload File : |
<?php
namespace App\Controller;
use Cake\Core\Configure;
use Cake\Network\Exception\ForbiddenException;
use Cake\Network\Exception\NotFoundException;
use Cake\View\Exception\MissingTemplateException;
use Cake\Event\Event;
use Cake\Network\Session\DatabaseSession;
use Cake\Validation\Validator;
use App\Model\Validation\SellValidator;
use App\Model\Validation\ContactValidator;
use Cake\Utility\Security;
use Cake\ORM\Table;
use Cake\ORM\Entity;
use Cake\Auth\DefaultPasswordHasher;
use Cake\Mailer\Email;
class PagesController extends AppController
{
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->loadModel("cities");
$querycities = $this->cities->find('all', ['conditions' => ['action' => 'YES'], 'order' => 'name'])->enableHydration(false);
$this->set('querycities', $querycities);
$this->loadModel('citybanner');
$querycitybanner = $this->citybanner->find('all', ['conditions' => ['action' => 'YES'], 'order' => 'city'])->enableHydration(false);
$this->set('querycitybanner', $querycitybanner);
$this->loadModel("homelisting");
$queryhomelisting = $this->homelisting->find('all', ['conditions' => ['action' => 'YES'], 'order' => 'treatment'])->enableHydration(false);
$this->set('queryhomelisting', $queryhomelisting);
$this->loadModel("treatments");
$treatmentsvalue = $this->treatments->find('all', ['conditions' => ['action' => 'YES'], 'order' => 'name'])->enableHydration(false);
$this->set(compact('treatmentsvalue'));
$treatmentsoptions = $this->treatments->find('list', ['keyField' => 'name', 'valueField' => 'name', 'conditions' => ['action' => 'YES'], 'order' => 'treatments.name']);
$this->set(compact('treatmentsoptions'));
}
public function home()
{
$this->loadModel("centres");
$homecentres = $this->centres->find('all', ['conditions' => ['featured' => 'YES', 'action' => 'YES']])->enableHydration(false);
$this->set(compact('homecentres'));
$this->loadModel("citybanner");
$querycitybanner = $this->citybanner->find('all', ['conditions' => ['action' => 'YES', 'city' => $city]])->toArray();
$this->set(compact('querycitybanner'));
$this->loadModel("homelisting");
$deaddication = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES', 'treatment' => 'Drug De-Addiction Centre']])->toArray();
$detoxtreatment = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES', 'treatment' => 'Detox Treatment Centre']])->toArray();
$nashakkendra = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES', 'treatment' => 'Nasha Mukti Kendra']])->toArray();
$nashakmedicine = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES', 'treatment' => 'Nasha Mukti Medicine']])->toArray();
$sexologist = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES', 'treatment' => 'Sexologist(Gupt Rog Doctor)']])->toArray();
$smokingcentre = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES', 'treatment' => 'Smoking De-Addiction Centre']])->toArray();
// pr($deaddication);die;
$homehomelisting = $this->homelisting->find('all', ['conditions' => ['featured' => 'NO', 'action' => 'YES']])->enableHydration(false);
$this->set(compact('homehomelisting', 'deaddication', 'detoxtreatment', 'nashakkendra', 'nashakmedicine', 'sexologist', 'smokingcentre'));
}
public function all($value)
{
// pr($value);die;
$this->loadModel("centres");
$this->loadModel("homelisting");
$this->loadModel("citybanner");
$value = str_replace("-", " ", $value);
if (strpos($value, ' in ') !== false) {
$name = explode(' in ', $value);
$this->paginate = array('all', 'conditions' => ['city' => $name[1], 'treatment LIKE' => "%" . $name[0] . "%", 'action' => 'YES'], 'limit' => 100);
$this->set('homecentres', $this->paginate('centres'));
$this->set('name', explode(' in ', $value));
}
else {
$this->paginate = array('all', 'conditions' => ['treatment LIKE' => "%" . $value . "%", 'action' => 'YES'], 'limit' => 100);
$this->set('homecentres', $this->paginate('centres'));
}
$this->set('value', $value);
$this->set('title', $value);
$querycitybanner = $this->citybanner->find('all', ['conditions' => ['city' => $name[1], 'treatment LIKE' => "%" . $name[0] . "%", 'action' => 'YES']])->enableHydration(false);
$this->set(compact('querycitybanner'));
}
public function profile($name)
{
$value = explode('--', $name);
$this->loadModel("centres");
$centerdetails = $this->centres->find('all', ['conditions' => ['city' => $value[1], 'name LIKE' => "%" . str_replace("-", " ", $value['0']) . "%", 'action' => 'YES']])->enableHydration(false);
$this->set(compact('centerdetails'));
$this->set('name', explode('--', $name));
$this->set('title', str_replace("-", " ", $name));
}
public function profiles($name)
{
$value = explode('--', $name);
$this->loadModel("homelisting");
$homelistingdetails = $this->homelisting->find('all', ['conditions' => ['city' => $value[1], 'name LIKE' => "%" . str_replace("-", " ", $value['0']) . "%", 'action' => 'YES']])->enableHydration(false);
$this->set(compact('homelistingdetails'));
$this->set('name', explode('--', $name));
$this->set('title', str_replace("-", " ", $name));
}
public function search()
{
if (!empty($this->request->getQuery('city'))) {
$this->loadModel("centres");
$this->paginate = array('all', 'conditions' => ['city' => $this->request->getQuery('city'), 'treatment LIKE' => "%" . $this->request->getQuery('treatment') . "%", 'action' => 'YES'], 'limit' => 100);
$this->set('homecentres', $this->paginate('centres'));
if (!empty($this->request->getQuery('treatment'))) {
$this->set('title', $this->request->getQuery('treatment') . ' in ' . $this->request->getQuery('city'));
}
else {
$this->set('title', 'Nasha mukti kendra in ' . $this->request->getQuery('city'));
}
}
}
public function thanks()
{
if ($this->request->is('post')) {
$this->loadModel("leads");
$mykey = hash('gost', strtotime(date('m/d/Y h:i:s a', time())) * rand(10, 200) . '864/*7%^0fedy');
$saveleads = $this->leads->newEntity();
$saveleads = $this->leads->patchEntity($saveleads, ['mykey' => $mykey, 'heading' => $this->request->getData('heading'), 'treatment' => $this->request->getData('treatment'), 'name' => $this->request->getData('name'), 'email' => $this->request->getData('email'), 'phone' => $this->request->getData('phone'), 'city' => $this->request->getData('city'), 'message' => $this->request->getData('message'), 'date' => date('Y-m-d')]);
$this->leads->save($saveleads);
$msg = "Addiction Free India Portal Lead Generated";
$msg = $msg . "<table border='1' width='100%'>";
$msg = $msg . "<tr><td>TREATMENT</td><td>" . $this->request->getData('treatment') . "</td></tr>";
$msg = $msg . "<tr><td>NAME</td><td>" . $this->request->getData('name') . "</td></tr>";
$msg = $msg . "<tr><td>PHONE</td><td>" . $this->request->getData('phone') . "</td></tr>";
$msg = $msg . "<tr><td>CITY</td><td>" . $this->request->getData('city') . "</td></tr>";
$msg = $msg . "<tr><td colspan='2'>" . $this->request->getData('message') . "</td></tr>";
$msg = $msg . "</table>";
$email = new Email('default');
$email
->transport('webmail')
->from('enquiry@addictionfreeindia.in')
->to("nashamuktiportal@gmail.com")
->subject('Addiction Free India Portal Lead Generated')
->emailFormat('html')
->viewVars(array('msg' => $msg))
->send($msg);
}
}
public function thanku()
{
if ($this->request->is('post')) {
$this->loadModel("homelisting");
$data = $this->homelisting->find('all', ['conditions' => ['id' => $this->request->getData('id')]])->first();
$this->loadModel("leads");
$mykey = hash('gost', strtotime(date('m/d/Y h:i:s a', time())) * rand(10, 200) . '864/*7%^0fedy');
$saveleads = $this->leads->newEntity();
$saveleads = $this->leads->patchEntity($saveleads, ['mykey' => $mykey, 'centrename' => $data->name, 'heading' => $this->request->getData('heading'), 'treatment' => $this->request->getData('treatment'), 'names' => $this->request->getData('names'), 'email' => $this->request->getData('email'), 'phone' => $this->request->getData('phone'), 'city' => $this->request->getData('city'), 'message' => $this->request->getData('message'), 'date' => date('Y-m-d')]);
$this->leads->save($saveleads);
$this->set(compact('data'));
$msg = "Addiction Free India Portal Lead Generated";
$msg = $msg . "<table border='1' width='100%'>";
$msg = $msg . "<tr><td>CENTRE ID</td><td>" . $this->request->getData('id') . "</td></tr>";
$msg = $msg . "<tr><td>TREATMENT</td><td>" . $this->request->getData('treatment') . "</td></tr>";
$msg = $msg . "<tr><td>NAME</td><td>" . $this->request->getData('names') . "</td></tr>";
$msg = $msg . "<tr><td>PHONE</td><td>" . $this->request->getData('phone') . "</td></tr>";
$msg = $msg . "<tr><td>CITY</td><td>" . $this->request->getData('city') . "</td></tr>";
$msg = $msg . "<tr><td colspan='2'>" . $this->request->getData('message') . "</td></tr>";
$msg = $msg . "</table>";
$email = new Email('default');
$email
->transport('webmail')
->from('enquiry@addictionfreeindia.in')
->to("nashamuktiportal@gmail.com")
->subject('Addiction Free India Portal Lead Generated')
->emailFormat('html')
->viewVars(array('msg' => $msg))
->send($msg);
}
$value = explode('--', $name);
$this->loadModel("homelisting");
$homelistingdetails = $this->homelisting->find('all', ['conditions' => ['city' => $value[1], 'name LIKE' => "%" . str_replace("-", " ", $value['0']) . "%", 'action' => 'YES']])->enableHydration(false);
$this->set(compact('homelistingdetails'));
$this->set('name', explode('--', $name));
$this->set('title', str_replace("-", " ", $name));
}
public function thankyou()
{
if ($this->request->is('post')) {
$this->loadModel("centres");
$data = $this->centres->find('all', ['conditions' => ['id' => $this->request->getData('id')]])->first();
$this->loadModel("leads");
$mykey = hash('gost', strtotime(date('m/d/Y h:i:s a', time())) * rand(10, 200) . '864/*7%^0fedy');
$saveleads = $this->leads->newEntity();
$saveleads = $this->leads->patchEntity($saveleads, ['mykey' => $mykey, 'centrename' => $data->name, 'heading' => $this->request->getData('heading'), 'treatment' => $this->request->getData('treatment'), 'names' => $this->request->getData('names'), 'email' => $this->request->getData('email'), 'phone' => $this->request->getData('phone'), 'city' => $this->request->getData('city'), 'message' => $this->request->getData('message'), 'date' => date('Y-m-d')]);
$this->leads->save($saveleads);
$this->set(compact('data'));
$msg = "Addiction Free India Portal Lead Generated";
$msg = $msg . "<table border='1' width='100%'>";
$msg = $msg . "<tr><td>CENTRE ID</td><td>" . $this->request->getData('id') . "</td></tr>";
$msg = $msg . "<tr><td>TREATMENT</td><td>" . $this->request->getData('treatment') . "</td></tr>";
$msg = $msg . "<tr><td>NAME</td><td>" . $this->request->getData('names') . "</td></tr>";
$msg = $msg . "<tr><td>PHONE</td><td>" . $this->request->getData('phone') . "</td></tr>";
$msg = $msg . "<tr><td>CITY</td><td>" . $this->request->getData('city') . "</td></tr>";
$msg = $msg . "<tr><td colspan='2'>" . $this->request->getData('message') . "</td></tr>";
$msg = $msg . "</table>";
$email = new Email('default');
$email
->transport('webmail')
->from('enquiry@addictionfreeindia.in')
->to("nashamuktiportal@gmail.com")
->subject('Addiction Free India Portal Lead Generated')
->emailFormat('html')
->viewVars(array('msg' => $msg))
->send($msg);
}
$value = explode('--', $name);
$this->loadModel("centres");
$centerdetails = $this->centres->find('all', ['conditions' => ['city' => $value[1], 'name LIKE' => "%" . str_replace("-", " ", $value['0']) . "%", 'action' => 'YES']])->enableHydration(false);
$this->set(compact('centerdetails'));
$this->set('name', explode('--', $name));
$this->set('title', str_replace("-", " ", $name));
}
public function aboutus()
{
}
public function listingform($id)
{
$this->set(compact('id'));
}
public function homelistingform($id)
{
$this->set(compact('id'));
}
public function faq()
{
$this->loadModel("faq");
$faqs = $this->faq->find('all');
// echo "<pre>";
// foreach ($faqs as $faq){
// echo $faq->name;
// }
// print_r($faqs);
// echo "</pre>";
$this->set(compact('faqs'));
}
public function privacy()
{
}
public function termsconditions()
{
}
public function exploreleads()
{
$this->loadModel("leads");
$this->paginate = array('all', 'conditions' => ['approved' => 'YES', 'visible' => 'YES', 'purchased' => ''], 'order' => (['date' => 'DESC']), 'limit' => 100);
$this->set('exploreleads', $this->paginate('leads'));
}
}