MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/sb_web/b744/kanevskylaw.com/classes/
File Upload :
Current < : /hermes/sb_web/b744/kanevskylaw.com/classes/class.template.php

<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

if (!defined("RIGHT_LS")) {
    die("Direct Access to this location is not allowed.");
}

class Module
{
    var $title;
    var $data;
    var $header;
    var $curModule;
    var $jRequest;
    var $contactEmails;
    var $socialIcons = "";
    var $meta;
    var $dynamicContent;
    var $subMenuAreas;
    var $subMenuProfile;
    var $seoURL;

    function Init()
    {
        global $CLASSDB;


        $this->meta           = ["title" => "", "description" => "", "canonicalLink" => ''];
        $this->dynamicContent = array();

        $this->redirectIfNeed();

        $settings = $CLASSDB->fetch_array($CLASSDB->query("SELECT * FROM {$CLASSDB->dbPrefix}settings WHERE (set_id = '1')"));

        $websiteActive = 0;
        if (!strcmp($settings["set_website_active"], "N")) {
            if (!empty($settings["set_allowed_ips"])) {
                $ipsArr = explode("\n", $settings["set_allowed_ips"]);
                foreach ($ipsArr as $key => $value) {
                    $ipsArr[$key] = trim($value);
                }

                if (in_array($_SERVER["REMOTE_ADDR"], $ipsArr)) {
                    $websiteActive = 1;
                }
            }
        } else {
            $websiteActive = 1;
        }

        if (!$websiteActive) {
            $this->jRequest      = 1;
            $this->meta["title"] = $settings["set_website_title"];
            $this->GetTemplate("inactive");
        } else {
            $this->jRequest = $redirect = 0;

            $this->topMenu       = array(
                "home",
                "profile",
                "claim",
                "blog",
                "blog-category",
                "blog-search",
                "blog-rss",
                "links",
                "contact",
                "subservice-page",
                "service-splash",
            );
            $this->contactEmails = explode("\n", $settings["set_contact_emails"] . "\naseo@vestrainet.com");

            if (isset($settings["set_link_facebook"]) && !empty($settings["set_link_facebook"])) {
                $this->socialIcons .= '<a class="fts-item" href="' . $settings["set_link_facebook"] . '" title="Facebook" target="_blank">';
                $this->socialIcons .= '<img src="/images/social-icons/facebook-icon.png" alt="Facebook"/></a>' . PHP_EOL;
            }

            if (isset($settings["set_link_twitter"]) && !empty($settings["set_link_twitter"])) {
                $this->socialIcons .= '<a class="fts-item" href="' . $settings["set_link_twitter"] . '" title="Twitter" target="_blank">';
                $this->socialIcons .= '<img src="/images/social-icons/twitter-icon.png" alt="Twitter"/></a>' . PHP_EOL;
            }

            if (isset($settings["set_link_linkedin"]) && !empty($settings["set_link_linkedin"])) {
                $this->socialIcons .= '<a class="fts-item" href="' . $settings["set_link_linkedin"] . '" title="Linkedin" target="_blank">';
                $this->socialIcons .= '<img src="/images/social-icons/linkedin-icon.png" alt="Linkedin"/></a>' . PHP_EOL;
            }

            $this->curModule = (isset($_GET["ext"])) ? preg_replace("/[^a-zA-Z\-]/", "", $_GET["ext"]) : "";

            $this->seoURL = $seo = array();
            foreach ($this->topMenu as $menu) {
                $this->seoURL[$menu] = $menu;
            }

            $res = $CLASSDB->query("SELECT seo_title, seo_description, seo_section, seo_url FROM {$CLASSDB->dbPrefix}seo");
            while ($row = $CLASSDB->fetch_array($res)) {
                if (in_array($row["seo_section"], $this->topMenu)) {
                    $this->seoURL[$row["seo_section"]] = empty($row["seo_url"]) ? $row["seo_section"] : $row["seo_url"];
                    if (!strcmp($row["seo_section"], $this->curModule) && !empty($row["seo_url"]) && strcmp($row["seo_url"], $this->curModule)) {
                        $redirect = 1;
                    }
                }
                if (!strcmp($this->curModule, $row["seo_url"])) {
                    $this->curModule = $row["seo_section"];
                    $seo             = $row;
                }
                if (!strcmp("home", $row["seo_section"])) {
                    $seoDefault = $row;
                }
            }

            if ($redirect) {
                header("Location: /");
                die();
            }

            $sql      = array();
            $sql[]    = "SELECT ar_url, ar_title";
            $sql[]    = "FROM {$CLASSDB->dbPrefix}areas";
            $areasUrl = $CLASSDB->fetch_column($CLASSDB->query(implode(' ', $sql)), 'ar_url');
            if (in_array($this->curModule, $areasUrl)) {
                $this->curModule = "areas";
            }

            switch ($this->curModule) {
                case "about":
                case "profile":
                    $this->title = "Company Profile";
                    $this->GetProfilePage();
                    break;
                case "links":
                    $this->title = "Links";
                    $this->GetLinksPage();
                    break;
                case "service-splash":
                    $this->title = "Service Splash";
                    $this->GetServicesplashPage();
                    break;
                case "service-inner":
                    $this->title = "Inner Page";
                    $this->GetInnerPage();
                    break;
                case "areas":
                    $this->GetAreaPage();
                    break;
                case "blog-inner-page":
                    $this->title = "Blog Inner Page";
                    $this->GetBloginnerPage();
                    break;
                case "subservice-page":
                    $this->title = "Sub Service Page";
                    $this->GetSubservicePage();
                    break;
                case "blog":
                case "blog-category":
                case "blog-search":
                    $this->title = "Blog";
                    $this->GetBlogPage();
                    $this->curModule = "blog";
                    break;
                case "blog-rss":
                    $this->GetBlogRSS();
                    break;
                case "contact":
                    $this->title = "Contact Us";
                    $this->GetContactPage();
                    break;
                case "disclaimer":
                    $this->title = "Disclaimer";
                    $this->GetDisclaimerPage();
                    break;
                case "terms-of-use":
                    $this->title = "Terms Of Use";
                    $this->GetTermsOfUsePage();
                    break;
                case "privacy-policy":
                    $this->title = "Privacy Policy";
                    $this->GetPrivacyPolicyPage();
                    break;
                case "quote":
                    $this->SendQuoteEmail();
                    break;
                case "request-consultation":
                    $this->SendConsultationEmail();
                    break;
                case "contact-email":
                    $this->SendContactEmail();
                    break;
                case "SetCaptchaValue":
                    $this->SetCaptchaValue();
                    break;
                default:
                    $this->curModule = "home";
                    $this->GetHomePage();
            }

            if (!$seo) {
                $seo = isset($seoDefault) ? $seoDefault : array();
            }

            if (!$this->jRequest) {
                $this->GetMetaData($settings["set_website_title"], $seo);
            }
        }

        $this->subMenuAreas = $this->getTopMenuAreas();

        $sql = "SELECT sv_title, sv_url, file_src
				FROM {$CLASSDB->dbPrefix}services
				LEFT JOIN {$CLASSDB->dbPrefix}files ON (file_module = 'SV') AND (file_parent = sv_id)
				WHERE (sv_active = 'Y' AND sv_parent = 'profile') ORDER BY sv_position ASC";

        $res = $CLASSDB->query($sql);

        while ($row = $CLASSDB->fetch_array($res)) {
            $this->subMenuProfile .= '<div><a class="sm-item" href="/' . $row['sv_url'] . '/' . $this->seoURL['profile'] . '.html" title="' . $row['sv_title'] . '">';
            $this->subMenuProfile .= '<img class="sm-img" alt="Auto Insurance" src="/images/services/' . $row['file_src'] . '" border="0">';
            $this->subMenuProfile .= '<span class="smi-title">' . $row['sv_title'] . '</span>';
            $this->subMenuProfile .= '</a></div>';
        }
    }

    public function redirectIfNeed()
    {
        $currentUri = $_SERVER['REQUEST_URI'];

        $host = 'https://melekhovetslaw.com';
        $redirectUrls = [
            '/terms-and-conditions-of-use/' => $host . '/terms-of-use.html',
            '/site-map/' => $host . '/sitemap.xml',
            '/site-map/feed/' => $host . '/sitemap.xml',
            '/privacy_policy.html' => $host . '/privacy-policy.html',
            '/privacy-policy/feed/' => $host . '/privacy-policy.html',
            '/privacy-policy' => $host . '/privacy-policy.html',
            '/privacy-policy/' => $host . '/privacy-policy.html',
            '/resources/' => $host . '/links.html',
            '/demo/resources/' => $host . '/links.html',
            '/resources' => $host . '/links.html',
            '/resources/feed/' => $host . '/links.html',
            '/areas-practice/criminal-law/' => $host . '/criminalLaw.html',
            '/areas-practice/criminal-law/feed/' => $host . '/criminalLaw.html',
            '/contact-us/' => $host . '/contact.html',
            '/contact-us/feed/' => $host . '/contact.html',
            '/contact-us' => $host . '/contact.html',
            '/company-profile/' => $host . '/company-profile.html',
            '/company-profile' => $host . '/company-profile.html',
            '/demo/company-profile/' => $host . '/company-profile.html',
            '/company-profile/feed/' => $host . '/company-profile.html',
            '/areas-practice/civil-litigation' => $host . '/civilLitigation.html',
            '/areas-practice/civil-litigation/' => $host . '/civilLitigation.html',
            '/areas-practice/civil-litigation/feed/' => $host . '/civilLitigation.html',
            '/immigration-news/canadas-citizenship-and-immigration-minister-visits-china/' => $host . '/',
            '/immigration-news/parent-and-grandparent-sponsorship-program-gearing-up-for-relaunch/feed/' => $host . '/',
            '/immigration-news/category/december-2013/feed/' => $host . '/',
            '/immigration-news/parent-and-grandparent-sponsorship-program-gearing-up-for-relaunch/' => $host . '/',
            '/immigration-news/citizenship-test-guide-now-available-as-an-audio-ebook/' => $host . '/',
            '/immigration-news/special-measures-for-temporary-and-permanent-residents-affected-by-the-flooding-in-alberta/' => $host . '/',
            '/immigration-news/temporary-suspension-of-removals-lifted-for-haiti-and-zimbabwe/feed/' => $host . '/',
            '/ottawa-to-welcome-older-immigrants-to-clear-family-backlog-2/' => $host . '/',
            '/immigration-news/new-citizenship-judge-appointed-in-montreal/feed/' => $host . '/',
            '/immigration-news/new-interactive-map-for-citizenship-ceremonies/feed/' => $host . '/',
            '/immigration-news/parent-and-grand-parent-sponsorship-re-opening-in-january-2015/feed/' => $host . '/',
            '/immigration-news/category/june-2013/feed/' => $host . '/',
            '/immigration-news/streamlining-the-passport-process-for-canadian-abroad/feed/' => $host . '/',
            '/immigration-news/new-interactive-map-for-citizenship-ceremonies/' => $host . '/',
            '/immigration-news/cic-stops-accepting-applications-from-ebola-affected-countries/feed/' => $host . '/',
            '/immigration-news/citizenship-judge-appointment-in-halifax/feed/' => $host . '/',
            '/immigration-news/immigration-law/call-for-proposals-for-settlement-services-in-bc/' => $host . '/',
            '/immigration-news/new-labour-market-opinion-application-forms/feed/' => $host . '/',
            '/immigration-news/streamlining-the-passport-process-for-canadian-abroad/' => $host . '/',
            '/immigration-news/category/june-2013/' => $host . '/',
            '/areas-practice/personal-injury-law/wrongful-death' => $host . '/',
            '/immigration-news/category/june-2014/feed/' => $host . '/',
            '/immigration-news/new-regulations-for-international-students-as-of-june-1-2014/' => $host . '/',
            '/immigration-news/new-labour-market-opinion-application-forms/' => $host . '/',
            '/immigration-news/category/december-2013/' => $host . '/',
            '/immigration-news/update-on-fee-returns-for-federal-skilled-worker-applicants-affected-by-the-backlog-elimination/feed/' => $host . '/',
            '/immigration-news/active-immigrant-recruitment/feed/' => $host . '/',
            '/immigration-news/canada-and-u-s-cross-border-business-efficient-simple-and-secure/feed/' => $host . '/',
            '/immigration-news/cic-consulting-canadians-on-immigration/feed/' => $host . '/',
            '/immigration-news/federal-investor-program-to-close/feed/' => $host . '/',
            '/immigration-news/canadas-start-up-visa-program/feed/' => $host . '/',
            '/immigration-news/world-refugee-day/feed/' => $host . '/',
            '/immigration-news/category/immigration-law/feed/' => $host . '/',
            '/immigration-news/category/august-2014/feed/' => $host . '/',
            '/immigration-news/new-citizens/feed/' => $host . '/',
            '/immigration-news/canadian-citizenship-and-the-armed-forces/' => $host . '/',
            '/immigration-news/new-citizens/' => $host . '/',
            '/immigration-news/category/february-2014/feed/' => $host . '/',
            '/immigration-news/canada-and-u-s-cross-border-business-efficient-simple-and-secure/' => $host . '/',
            '/immigration-news/cic-consulting-canadians-on-immigration/' => $host . '/',
            '/immigration-news/federal-investor-program-to-close/' => $host . '/',
            '/immigration-news/canadas-start-up-visa-program/' => $host . '/',
            '/immigration-news/changes-to-the-intra-company-transfer-program/feed/' => $host . '/',
            '/immigration-news/world-refugee-day/' => $host . '/',
            '/immigration-news/category/immigration-law/' => $host . '/',
            '/immigration-news/category/august-2014/' => $host . '/',
            '/immigration-news/category/march-2013/' => $host . '/',
            '/immigration-news/category/january-2015/' => $host . '/',
            '/immigration-news/express-entry-to-launch-soon/feed/' => $host . '/',
            '/immigration-news/category/november-2014/feed/' => $host . '/',
            '/immigration-news/minister-of-health-unveils-collaborative-action-to-address-tuberculosis-in-canada/feed/' => $host . '/',
            '/immigration-news/category/november-2014/' => $host . '/',
            '/immigration-news/category/december-2014/feed/' => $host . '/',
            '/immigration-news/category/may-2014/' => $host . '/',
            '/immigration-news/minister-kenney-launches-videos-to-help-newcomers-settle/feed/' => $host . '/',
            '/immigration-news/harper-government-announces-reforms-to-temporary-foreign-worker-program/feed/' => $host . '/',
            '/immigration-news/minister-kenney-promotes-canadas-new-start-up-visa-in-silicon-valley/feed/' => $host . '/',
            '/immigration-news/category/april-2013/feed/' => $host . '/',
            '/immigration-news/harper-government-announces-reforms-to-temporary-foreign-worker-program/' => $host . '/',
            '/immigration-news/minister-kenney-launches-videos-to-help-newcomers-settle/' => $host . '/',
            '/immigration-news/changes-to-canadian-passport/feed/' => $host . '/',
            '/immigration-news/can-program-mexico/feed/' => $host . '/',
            '/immigration-news/calgary-welcomes-more-new-canadians/feed/' => $host . '/',
            '/immigration-news/temporary-foreign-worker-program-overhauled/feed/' => $host . '/',
            '/immigration-news/minister-kenney-promotes-canadas-new-start-up-visa-in-silicon-valley/' => $host . '/',
            '/immigration-news/new-parent-and-grandparent-program-re-opens-january-2-2014/feed/' => $host . '/',
            '/immigration-news/category/january-2015/feed/' => $host . '/',
            '/immigration-news/category/april-2013/' => $host . '/',
            '/immigration-news/changes-to-the-age-of-dependency/feed/' => $host . '/',
            '/immigration-news/changes-to-international-student-program/feed/' => $host . '/',
            '/immigration-news/ontario-language-training-certificates-now-accepted-by-citizenship-and-immigration-canada/feed/' => $host . '/',
            '/immigration-news/new-parent-and-grandparent-program-re-opens-january-2-2014/' => $host . '/',
            '/immigration-news/call-for-proposals-for-settlement-services-in-bc/' => $host . '/',
            '/immigration-news/call-for-proposals-for-settlement-services-in-bc/feed/' => $host . '/',
            '/immigration-news/new-senior-citizenship-judge/feed/' => $host . '/',
            '/immigration-news/special-measures-for-those-affected-by-the-tragedy-in-lac-megantic/feed/' => $host . '/',
            '/immigration-news/can-program-mexico/' => $host . '/',
            '/immigration-news/changes-to-the-cec-program/feed/' => $host . '/',
            '/immigration-news/changes-to-the-age-of-dependency/' => $host . '/',
            '/temporary-foreign-worker-program-will-be-reformed/' => $host . '/',
            '/immigration-news/multiple-entry-visa/feed/' => $host . '/',
            '/immigration-news/come-to-canada-wizard-a-success/feed/' => $host . '/',
            '/immigration-news/ottawa-welcomes-more-new-canadians/feed/' => $host . '/',
            '/immigration-news/wild-horse-port-of-entry-opens/feed/' => $host . '/',
            '/immigration-news/six-citizenship-ceremonies-in-montreal/feed/' => $host . '/',
            '/immigration-news/category/may-2014/feed/' => $host . '/',
            '/immigration-news/work-permits-for-spouses-and-common-law-partners/' => $host . '/',
            '/immigration-news/calgary-welcomes-more-new-canadians/' => $host . '/',
            '/immigration-news/wild-horse-port-of-entry-opens/' => $host . '/',
            '/immigration-news/feed/' => $host . '/',
            '/immigration-news/canada-welcomes-first-immigrants-under-the-new-federal-skilled-trades-program/feed/' => $host . '/',
            '/where-are-canadas-temporary-foreign-workers-going/' => $host . '/',
            '/immigration-news/category/may-2013/feed/' => $host . '/',
            '/immigration-news/new-citizenship-judge-appointed-in-montreal/' => $host . '/',
            '/immigration-news/category/october-2014/feed/' => $host . '/',
            '/immigration-news/temporary-foreign-worker-program-moratorium/feed/' => $host . '/',
            '/immigration-news/immigration-from-india-continues-to-grow/feed/' => $host . '/',
            '/immigration-news/preparing-newcomers-for-life-in-canada/' => $host . '/',
            '/immigration-news/mississauga-welcomes-more-new-citizens/' => $host . '/',
            '/immigration-news/category/april-2014/' => $host . '/',
            '/immigration-news/new-start-up-visa-opens-for-applications-on-april-1-2013/' => $host . '/',
            '/immigration-news/changes-to-the-live-in-caregiver-program/' => $host . '/',
            '/immigration-news/category/july-2014/' => $host . '/',
            '/immigration-news/citizenship-fraud/' => $host . '/',
            '/immigration-news/scarborough-welcomes-more-new-canadians/' => $host . '/',
            '/immigration-news/category/july-2013/' => $host . '/',
            '/immigration-news/changes-to-the-intra-company-transfer-program/' => $host . '/',
            '/canada-imposes-a-visa-requirement-on-antigua-and-bermuda/' => $host . '/',
            '/areas-practice/personal-injury-law/short-and-long-term-disability-claims' => $host . '/',
            '/areas-practice/personal-injury-law/sliptrip-and-fall-accidents/' => $host . '/',
            '/immigration-news/cic-stops-accepting-applications-from-ebola-affected-countries/' => $host . '/',
            '/supreme-court-of-canada-restored-a-multi-million-damages-award-to-a-severely-disabled-girl/' => $host . '/',
            '/immigration-news/category/december-2014/' => $host . '/',
            '/immigration-news/faster-removal-of-foreign-criminal-act-becomes-law/' => $host . '/',
            '/immigration-news/three-appointments-to-the-immigration-and-refugee-board/' => $host . '/',
            '/immigration-news/express-entry-to-launch-soon/' => $host . '/',
            '/immigration-news/immigration-law/new-citizenship-judge-appointed-in-montreal/' => $host . '/',
            '/immigration-news/new-caps-for-federal-skilled-worker-federal-skilled-trades-and-canadian-experience-class-programs/' => $host . '/',
            '/immigration-news/citizenship-judge-appointment-in-halifax/' => $host . '/',
            '/immigration-news/international-experience-class-moving-to-cic/' => $host . '/',
            '/areas-practice/personal-injury-law/nursing-home-negligence/' => $host . '/',
            '/police-can-look-through-a-password-less-phone/' => $host . '/',
            '/how-one-becomes-canadianized/' => $host . '/',
            '/immigration-news/live-in-caregivers-now-have-two-new-pathways-to-permanent-residence/' => $host . '/',
            '/immigration-news/category/february-2014/' => $host . '/',
            '/immigration-news/four-citizenship-judge-appointments-for-the-greater-toronto-area/' => $host . '/',
            '/areas-practice/personal-injury-law/nursing-home-negligence' => $host . '/',
            '/immigration-news/temporary-suspension-of-removals-lifted-for-haiti-and-zimbabwe/' => $host . '/',
            '/immigration-news/new-citizenship-judge-appointment-for-the-greater-toronto-area/' => $host . '/',
            '/areas-practice/immigration-law/permanent-residence/' => $host . '/',
            '/areas-practice/personal-injury-law' => $host . '/',
            '/immigration-news/changes-to-the-cec-program/' => $host . '/',
            '/ontario-labour-market-bulletin-march-2014/' => $host . '/',
            '/immigration-news/citizenship-judge-appointment-in-fredericton/' => $host . '/',
            '/category/immigration-law/' => $host . '/',
            '/immigration-news/ontario-language-training-certificates-now-accepted-by-citizenship-and-immigration-canada/' => $host . '/',
            '/canadian-government-will-tighten-rules-on-temporary-foreign-worker-program/' => $host . '/',
            '/areas-practice/' => $host . '/',
            '/immigration-to-canada-from-belarus' => $host . '/',
            '/areas-practice/immigration-law' => $host . '/',
            '/areas-practice/immigration-law/temporary-resident-visas' => $host . '/',
            '/areas-practice/immigration-law/permanent-residence' => $host . '/',
            '/areas-practice/immigration-law/temporary-resident-visas/' => $host . '/',
            '/immigration-news/new-immigrant-investor-venture-capital-pilot-program/' => $host . '/',
            '/areas-practice/immigration-law/appeals-hearings-and-interviews' => $host . '/',
            '/areas-practice/immigration-law/appeals-hearings-and-interviews/' => $host . '/',
            '/areas-practice/personal-injury-law/wrongful-death/' => $host . '/',
            '/immigration-news/come-to-canada-wizard-a-success/' => $host . '/',
            '/areas-practice/personal-injury-law/short-and-long-term-disability-claims/' => $host . '/',
            '/immigration-in-canada-from-russia' => $host . '/',
            '/areas-practice/immigration-law/appeals-hearings-and-interviews/feed/' => $host . '/',
            '/police-can-look-through-a-password-less-phone/feed/' => $host . '/',
            '/ottawa-to-welcome-older-immigrants-to-clear-family-backlog-2/feed/' => $host . '/',
            '/immigration-in-canada-from-russia/feed/' => $host . '/',
            '/areas-practice/personal-injury-law/short-and-long-term-disability-claims/feed/' => $host . '/',
            '/areas-practice/immigration-law/feed/' => $host . '/',
            '/areas-practice/personal-injury-law/feed/' => $host . '/',
            '/areas-practice/personal-injury-law/sliptrip-and-fall-accidents/feed/' => $host . '/',
            '/canada-imposes-a-visa-requirement-on-antigua-and-bermuda/feed/' => $host . '/',
            '/areas-practice/personal-injury-law/wrongful-death/feed/' => $host . '/',
            '/areas-practice/immigration-law/temporary-resident-visas/feed/' => $host . '/',
            '/areas-practice/personal-injury-law/medical-malpractice-claims/feed/' => $host . '/',
            '/2017/' => $host . '/',
            '/home/feed/' => $host . '/',
            '/temporary-foreign-worker-program-will-be-reformed/feed/' => $host . '/',
            '/ontario-labour-market-bulletin-march-2014/feed/' => $host . '/',
            '/where-are-canadas-temporary-foreign-workers-going/feed/' => $host . '/',
            '/2013/01/' => $host . '/',
            '/comments/feed/' => $host . '/',
            '/2017/06/' => $host . '/',
            '/2013/03/' => $host . '/',
            '/2014/04/' => $host . '/',
            '/2013/12/' => $host . '/',
            '/?utm_source=hootsuite&utm_campaign=hootsuite' => $host . '/',
            '/areas-practice/personal-injury-law/sliptrip-and-fall-accidents' => $host . '/',
            '/areas-practice/immigration-law/citizenship' => $host . '/',
            '/areas-practice/personal-injury-law/motor-vehicle-collisions' => $host . '/',
            '/areas-practice/personal-injury-law/animal-bites' => $host . '/',
            '/immigration-news' => $host . '/',
            '/areas-practice/personal-injury-law/defective-products' => $host . '/',
            '/wp-content/themes/Julia-Melekhovets-Law-Firm/captcha-contact.php' => $host . '/',
            '/immigration-news/wp-content/themes/Julia-Melekhovets-Law-Firm/verify-captcha-info.php' => $host . '/',
            '/wp-content/themes/Julia-Melekhovets-Law-Firm/captcha-request-info.php' => $host . '/',
            '/wp-content/themes/Julia-Melekhovets-Law-Firm/verify-captcha-info.php' => $host . '/',
            '/immigration-news/wp-content/themes/Julia-Melekhovets-Law-Firm/captcha-request-info.php' => $host . '/',
            '/wp-content/themes/Julia-Melekhovets-Law-Firm/verify-captcha-contact.php' => $host . '/',
            '/wp-content/themes/Julia-Melekhovets-Law-Firm/captcha-book-free-conslt.php' => $host . '/',
            '/wp-content/themes/Julia-Melekhovets-Law-Firm/verify-captcha-book-free-conslt.php' => $host . '/',
            '/immigration-news/category/october-2014/' => $host . '/',
            '/immigration-news/category/may-2013/' => $host . '/',
            '/immigration-news/category/august-2013/' => $host . '/',
            '/areas-practice/immigration-law/' => $host . '/',
            '/areas-practice/immigration-law/citizenship/' => $host . '/',
            '/immigration-news/parent-and-grand-parent-sponsorship-re-opening-in-january-2015/' => $host . '/',
            '/index.php?ext=corporateLaw&id=melekhovetslaw.com&var=https:/' => $host . '/corporateLaw.html',
            '/index.php?ext=civilLitigation&id=melekhovetslaw.com&var=https:/' => $host . '/civilLitigation.html',
            '/index.php?ext=familyLaw&id=melekhovetslaw.com&var=https:/' => $host . '/familyLaw.html',
            '/index.php?ext=blog&id=blog.html&var=https://melekhovetslaw.com/your-views-on-pandemic-can-affect-your-family-law-case' => $host . '/your-views-on-pandemic-can-affect-your-family-law-case/blog.html',
            '/index.php?ext=blog&id=blog.html&var=https://melekhovetslaw.com/can-the-police-sue-crown-attorneys' => $host . '/can-the-police-sue-crown-attorneys/blog.html',
        ];

        if (isset($redirectUrls[$currentUri])) {
            // 301 Moved Permanently
            header("Location: " . $redirectUrls[$currentUri], true, 301);
            exit();
        }
    }

    //===== Home Page =====//

    function GetHomePage()
    {
        global $CLASSDB;

        //$this->AddJavaScript('/js/slider.js');
        //$this->AddJavaScript('/js/jquery.bxslider.min.js');
        //$this->AddStyleSheet('/css/jquery.bxslider.css');

        $this->meta["title"] = "Kanevsky Law Office";
        $this->meta["description"] = "Looking for the best family & divorce lawyer in Toronto? Work with Kanevsky Law on all matters related to family law, corporate law, media law, and more.";

        /*$slider = "";
        $sql    = "SELECT {$CLASSDB->dbPrefix}slider.*, file_src";
        $sql    .= " FROM {$CLASSDB->dbPrefix}slider";
        $sql    .= " LEFT JOIN {$CLASSDB->dbPrefix}files ON file_module = 'SL' AND file_type = 'S' AND file_parent = sl_id";
        $sql    .= " WHERE (sl_active = 'Y')";
        $sql    .= " ORDER BY sl_position";

        $res = $CLASSDB->query($sql);

        while ($row = $CLASSDB->fetch_array($res)) {
            $background  = empty($row["file_src"]) ? '/images/home-slider/img-slider1.jpg' : '/images/slider/' . $row["file_src"];
            $title       = empty($row["sl_title"]) ? '' : '<h2>' . $row['sl_title'] . '</h2>';
            $description = empty($row["sl_description"]) ? '' : '<p>' . $row['sl_description'] . '</p>';
            if (!empty($row["sl_link"])) {
                $description .= '<div class="home-btn"><a href="' . $row["sl_link"] . '" target="_blank" class="button transform common-link">';
                $description .= '<span class="lbl">Learn More</span>';
                $description .= '<span class="icn transform"><i class="transform"></i></span>';
                $description .= '</a></div>';
            }

            $tempBlock = $this->Template("./tpl/home-slider-item");
            eval("\$slider .= \"$tempBlock\";");
        }

        if (!empty($slider)) {
            $tempBlock = $this->Template("./tpl/home-slider");
            eval("\$this->data = \"$tempBlock\";");
        }*/

        $this->AddStyleSheet('/css/blog.css');
        $areasPractice = $this->renderAreasPractice();
        $mainHomeBlock  = $this->getInfoBlock('home_a');
        // $homeMenuAreas   = $this->getHomeMenuAreas();
        // $recentBlogPosts = $this->getRecentBlogPosts();
        //
        // $infoBlockHomeB  = $this->getInfoBlock('home_b');

        $tempBlock = $this->Template("./tpl/home");
        eval("\$this->data .= \"$tempBlock\";");
    }

    private function renderAreasPractice()
    {
        global $CLASSDB;
        $result = '';
        $query = $CLASSDB->query('
            select a.*, GROUP_CONCAT(asp.ars_title) as areas,f.* from tb_areas a 
            left join tb_areas_specifics asp on a.ar_id=asp.ars_area
            left join tb_files f on a.ar_id=f.file_parent and f.file_module=\'AR\'
            where a.ar_active=\'Y\'
            GROUP BY a.ar_id ORDER BY a.ar_position
        ');
        $rows = $CLASSDB->fetch_all($query);
        foreach ($rows as $row) {
            $areas = !empty($row['areas']) ? explode(',', $row['areas']) : [];
            $row['areas_list'] = '';
            foreach ($areas as $area) {
                $row['areas_list'] .= "<li>$area</li>";
            }
            $areas = $this->Template("./tpl/home-areas-block");
            eval("\$result .= \"$areas\";");
        }

        return $result;
    }

    function GetProfilePage()
    {
        $this->meta['title'] = 'Company Profile';
        $this->meta['description'] = "At Kanevsky Law, we can assist you in choosing the optimum resolution to your particular and often complex law related problem. Contact us to know more.";

        $professionalAssociationsBlock = $this->getProfessionalAssociationsBlock();
        $leftMenuAreas                 = $this->getLeftMenuAreas();
        $leftMenuContactRequest        = $this->getLeftMenuContactRequest();
        $abilitiesBlock                = $this->getAbilitiesBlock();

        $infoBlockCompany     = $this->getInfoBlock('company');
        $infoBlockMelekhovets = $this->getInfoBlock('melekhovets');
        $infoBlockMelekhovets2 = $this->getInfoBlock('melekhovets2');
        $infoBlockWeAreHere = $this->getInfoBlock('wearehere');

        $tempBlock = $this->Template("./tpl/company-profile");
        eval("\$this->data = \"$tempBlock\";");
    }

    // function GetClaimPage() {
    // 	$tempBlock = $this->Template("./tpl/claim");
    //     eval("\$this->data = \"$tempBlock\";");
    // }

    function GetLinksPage()
    {
        global $CLASSDB;

        $this->meta['title'] = 'Professional Associations - Links';
        $this->meta['description'] = "Kanevsky Law is known to be one of the very best law firms in Toronto.  Please feel free to check out some useful legal resources here.";

        $rows       = "";
        $rowClasses = array(
            'W' => ' li-web',
            'P' => ' li-pdf',
        );

        $sql = "SELECT * FROM {$CLASSDB->dbPrefix}links WHERE ln_active = 'Y' ORDER BY ln_position";

        $res = $CLASSDB->query($sql);

        while ($row = $CLASSDB->fetch_array($res)) {
            $rowClass = $rowClasses[$row['ln_type']];

            $tempBlock = $this->Template("./tpl/links-row");
            eval("\$rows .= \"$tempBlock\";");
        }
        $leftMenuContactRequest        = $this->getLeftMenuContactRequest();
        $areasMnu = $this->generateFooterAreas();
        $tempBlock = $this->Template("./tpl/links");
        eval("\$this->data = \"$tempBlock\";");
    }

    public function generateFooterAreas()
    {
        global $CLASSDB;
        $html = '';
        $current = filter_input(INPUT_GET, 'ext');
        $query = $CLASSDB->query("select ar_title, ar_url from tb_areas where ar_active='Y' ORDER BY ar_position ASC");
        while ($row = $CLASSDB->fetch_array($query)) {
            $active = $current == $row['ar_url'] ? 'class="active"' : '';
            $html .= '<li><a href="'.$row['ar_url'].'.html" '.$active.'>'.$row['ar_title'].'</a></li>';
        }

        return $html;
    }

    function GetServicesplashPage()
    {
        $tempBlock = $this->Template("./tpl/service-page-splash");
        eval("\$this->data = \"$tempBlock\";");
    }

    function GetInnerPage()
    {
        $tempBlock = $this->Template("./tpl/service-page-inner");
        eval("\$this->data = \"$tempBlock\";");
    }

    function GetAreaPage()
    {
        global $CLASSDB;

        $url = preg_replace("/[^0-9a-zA-Z\-]/", "", $_GET["ext"]);

        $sql   = array();
        $sql[] = "SELECT *";
        $sql[] = "FROM {$CLASSDB->dbPrefix}areas";
        $sql[] = "WHERE ar_url LIKE '$url'";
        $sql[] = "LIMIT 1";

        $row = $CLASSDB->fetch_assoc($CLASSDB->query(implode(" ", $sql)));

        $sqlSpecialAreas = "SELECT * FROM {$CLASSDB->dbPrefix}areas_specifics WHERE ars_area = {$row['ar_id']} AND ars_active = 'Y' ORDER BY ars_position ASC";

        $specificAreas = "";
        $rowItems = $CLASSDB->fetch_all($CLASSDB->query($sqlSpecialAreas));
        foreach ($rowItems as $rowItem) {
            $specificAreas .= '<li class="accordion-list__item">
                <div class="accordion-list__item-title">' . $rowItem['ars_title'] . '</div>';

            $description = $rowItem['ars_descr'];
            if (!empty($description)) {
                $specificAreas .= '<div class="accordion-list__item-content">
                                    <p>
                                        ' . $description . '
                                    </p>
                                </div>
                                <span class="accordion-list__item-trigger js-toggleAccordion">Read more</span>';
            }
            $specificAreas .= '</li>';
        }

//        $specificAreas = "";
//        foreach (explode("\n", $row['ar_specific']) as $specificArea) {
//            $specificAreas .= '<li>' . $specificArea . '</li>';
//        }

        $paragraphs                    = $this->GetParagraph($row['ar_id'], $row['ar_title'], "AR", "PA", "paragraph-areas");
        $professionalAssociationsBlock = $this->getProfessionalAssociationsBlock();
        $leftMenuAreas                 = $this->getLeftMenuAreas();
        $leftMenuContactRequest        = $this->getLeftMenuContactRequest();

        $this->meta["title"] = $row["ar_meta_title"];
        $this->meta["description"] = $row["ar_meta_description"];

        $tempBlock = $this->Template("./tpl/area-page");
        eval("\$this->data = \"$tempBlock\";");
    }


    function GetSubservicePage()
    {
        $tempBlock = $this->Template("./tpl/service-page-inner-underpage");
        eval("\$this->data = \"$tempBlock\";");
    }

    function GetBloginnerPage()
    {
        $tempBlock = $this->Template("./tpl/blog-inner-page");
        eval("\$this->data = \"$tempBlock\";");
    }

    //===== Blog Page =====//

    function GetBlogPage()
    {
        global $CLASSDB;

        $this->AddStyleSheet('/css/blog.css');
        $searchVal = $isGridClass = "";

        if (strcmp($this->curModule, "blog-category") && isset($_GET["id"])) {
            $url = preg_replace("/[^0-9a-zA-Z\-]/", "", $_GET["id"]);

            $sql = "SELECT bl_id, bl_meta_title, bl_title, bl_meta_descr, bl_descr, DATE_FORMAT(bl_date, '%M %d, %Y') AS date, bl_url, file_src, file_type";
            $sql .= " FROM {$CLASSDB->dbPrefix}blog";
            $sql .= " LEFT JOIN {$CLASSDB->dbPrefix}files ON (file_module = 'BL') AND (file_parent = bl_id) AND file_type = 'MI'";
            $sql .= " WHERE (bl_active = 'Y') AND (bl_date <= '" . date("Y-m-d") . "') AND (bl_url = '{$url}') LIMIT 1";

            if ($res = $CLASSDB->fetch_array($CLASSDB->query($sql))) {
                if (!empty($res["bl_meta_title"])) {
                    $this->meta["title"] = $res["bl_meta_title"];
                }

                if (!empty($res["bl_meta_descr"])) {
                    $this->meta["description"] = $res["bl_meta_descr"];
                }

                if (!empty($res["file_src"])) {
                    $alt             = html_entity_decode($res["bl_title"]);
                    /* $res["bl_descr"] = '<div class="bl-img"><img src="/images/blog/' . $res["file_src"] . '" border="0" alt="' . $alt . '" title="' . $alt . '" /></div>' . $res["bl_descr"]; */
                }
                $this->data .= '<div class="bl-ttl">' . $res['bl_title'] . '</div>';
                $this->data .= '<div class="bl-date">' . $res['date'] . '</div>';
                if (!empty($res["file_src"])) {
                    $this->data .= '<div class="bl-inner"><img src="/images/blog/' . $res['file_src'] . '"/></div>';
                }
                $this->data .= '<div class="bl-inner">' . $res['bl_descr'] . '</div>';

//                $tempBlock = $this->Template("./tpl/blog-inner");
//                eval("\$this->data = \"$tempBlock\";");

                $paragraphs = $this->GetParagraph($res['bl_id'], $res['bl_title'], "BL", "PB", "paragraph-blog");
                if (!empty($paragraphs)) {
                    $this->data .= $paragraphs;
                }
            } else {
                $this->data = '<p class="no-articles">Sorry, article not found...</p>';
            }
        } else {
            $where       = array();
            $isGridClass = " blog-grid";

            $this->meta['title'] = 'Blogs';
            $this->meta['description'] = "Kanevsky Law brings you the best informational blog articles related to family law, business law, media law and much more.";
            $this->meta['canonicalLink'] = '';

            if (!strcmp($this->curModule, "blog-search")) {
                if (isset($_POST["search"]) && !empty($_POST["search"])) {
                    $_SESSION["search"] = $_POST["search"];

                    header("Location: /blog-search.html");
                    die();
                } elseif (isset($_SESSION["search"])) {
                    $search = $_SESSION["search"];
                }

                if (isset($search)) {
                    $searchVal = $search;
                    $search    = preg_replace("/[^0-9a-zA-Z\-\.\,\?\!\s\_\:\,\(\)]/", "", $search);

                    $where[] = "(bl_title LIKE '%{$search}%')";
                    $where[] = "(bl_descr_short LIKE '%{$search}%')";
                    $where[] = "(bl_descr LIKE '%{$search}%')";
                }
            } elseif (!strcmp($this->curModule, "blog-category") && isset($_GET["id"])) {
                $search = preg_replace("/[^0-9a-zA-Z\-]/", "", $_GET["id"]);

                $sql = "SELECT cat_id, cat_meta_title, cat_meta_descr FROM {$CLASSDB->dbPrefix}blog_categories WHERE (cat_active = 'Y') AND (cat_url = '{$search}') LIMIT 1";
                $res = $CLASSDB->fetch_array($CLASSDB->query($sql));
                if ($res) {
                    if (!empty($res['cat_meta_title'])){
                        $this->meta['title'] = $res['cat_meta_title'];
                    }
                    if (!empty($res['cat_meta_descr'])){
                        $this->meta['description'] = $res['cat_meta_descr'];
                    }

                    $where[] = "(bl_parent = '{$res["cat_id"]}')";
                }
            }

            $sql = "SELECT bl_title, bl_descr_short, DATE_FORMAT(bl_date, '%M %d, %Y') AS date, bl_url, file_src
					FROM {$CLASSDB->dbPrefix}blog
					LEFT JOIN {$CLASSDB->dbPrefix}files ON (file_module = 'BL') AND (file_parent = bl_id) AND (file_type = 'S')
					WHERE (bl_active = 'Y') AND (bl_date <= '" . date("Y-m-d") . "')" . ($where ? " AND (" . implode(" OR ", $where) . ")" : "") . " ORDER BY bl_featured DESC, bl_date DESC";

            $res = $CLASSDB->query($sql);
            while ($row = $CLASSDB->fetch_array($res)) {
                $alt   = html_entity_decode($row["bl_title"]);
                $check = trim($row["bl_descr_short"]);
                if (!empty($check)) {
                    $row["bl_descr_short"] = '<p>' . $check . '</p>';
                }

                if (empty($row["file_src"])) {
                    $dataClass = $image = "";
                } else {
                    $dataClass = " bl-full";
                    $image     = '<div class="bl-thumb"><img src="/images/blog/' . $row["file_src"] . '" border="0" alt="' . $alt . '" title="' . $alt . '" /></div>';
                }

                $tempBlock = $this->Template("./tpl/blog-row");
                eval("\$this->data .= \"$tempBlock\";");
            }
        }

        $data = "";
        $sql  = "SELECT bl_title, bl_descr_short, DATE_FORMAT(bl_date, '%M %d, %Y') AS date, bl_url FROM {$CLASSDB->dbPrefix}blog WHERE (bl_active = 'Y') AND (bl_date <= '" . date("Y-m-d") . "') ORDER BY bl_featured DESC, bl_date DESC LIMIT 5";
        $res  = $CLASSDB->query($sql);
        while ($row = $CLASSDB->fetch_array($res)) {
            $alt  = html_entity_decode($row["bl_title"]);
            $data .= '<li><a href="/' . $row["bl_url"] . '/' . $this->seoURL["blog"] . '.html" title="' . $alt . '">' . $row["bl_title"] . '</a></li>';
        }

        // if (!empty($data)) {
        //     $data = '<div class="br-lbl">Recent Posts<a href="/' . $this->seoURL["blog-rss"] . '.html" target="blank"><img src="/images/rss.png" alt="RSS" title="RSS" border="0" /></a></div><ul>' . $data . '</ul>';
        // }
        if (!empty($data)) {
            $data = '<div class="br-lbl">Recent Articles</div><ul>' . $data . '</ul>';
        }
        $categories = "";

        $sql = "SELECT cat_title, cat_url FROM {$CLASSDB->dbPrefix}blog_categories WHERE (cat_active = 'Y') ORDER BY cat_position ASC";
        $res = $CLASSDB->query($sql);
        while ($row = $CLASSDB->fetch_array($res)) {
            $categories .= '<div class="br-category"><a href="/' . $row["cat_url"] . '/' . $this->seoURL["blog-category"] . '.html">' . $row["cat_title"] . '</a></div>';
        }

        if (!empty($categories)) {
            $data .= '<div class="br-lbl">Categories</div>' . $categories;
        }

        if (empty($this->data)) {
            $this->data = '<p class="no-articles">No articles found...</p>';
        }

        $tempBlock = $this->Template("./tpl/blog");
        eval("\$this->data = \"$tempBlock\";");
    }

    function GetBlogRSS()
    {
        global $CLASSDB;

        $this->jRequest = 1;

        $sql = "SELECT bl_title, bl_descr_short, DATE_FORMAT(bl_date, '%M %d, %Y') AS date, bl_url FROM {$CLASSDB->dbPrefix}blog WHERE (bl_active = 'Y') AND (bl_date <= '" . date("Y-m-d") . "') ORDER BY bl_featured DESC, bl_date DESC";
        $res = $CLASSDB->query($sql);
        while ($row = $CLASSDB->fetch_array($res)) {
            $tempBlock = $this->Template("./tpl/blog-rss-item");
            eval("\$this->data .= \"$tempBlock\";");
        }

        if (empty($this->data)) {
            $this->data = '<h1>NO ARTICLES FOUND...</h1>';
        } else {
            $year = date("Y");

            $tempBlock = $this->Template("./tpl/blog-rss");
            eval("\$this->data = \"$tempBlock\";");
        }
    }


    function GetContactPage()
    {
        $this->AddStyleSheet('/css/form.css');
        $this->AddStyleSheet('/css/jquery-filestyle.css');
        $this->AddJavaScript('/js/jquery.filestyle.js');
//        $this->AddJavaScript('/js/form.js');

        global $CLASSDB;

        $formURL = isset($this->seoURL[$this->curModule]) ? $this->seoURL[$this->curModule] : $this->curModule;


        $this->meta["title"] = "Contact Us";
        $this->meta["description"] = "Kanevsky Law provides the best family and divorce law services in all of Toronto. Contact us right now to get top notch law related services.";

        $error      = array();
        $formFields = array("c_name" => "", "c_phone" => "", "c_company" => "", "c_email" => "", "c_comments" => "", "sendMsg" => "", "showError" => "");

        foreach ($formFields as $key => $value) {
            $$key = $value;
        }
//        if ($_POST) {
//            $error = $this->SendContactMail();
//
//            if ($error) {
//                $this->data = $error;
//                return $error;
//            }
//        }

        if ($error) {
            $this->AddStyleSheet('/css/form-error.css');

            foreach ($error as $value) {
                $showError .= '<div class="fe-label">' . $value . '</div>';
            }

            $tempBlock = $this->Template("./tpl/form-error");
            eval("\$showError = \"$tempBlock\";");
        } elseif (isset($_GET["id"]) && !strcmp(preg_replace("/[^a-z]/", "", $_GET["id"]), "sent")) {
            $tempBlock = $this->Template("./tpl/form-sent");
            eval("\$sendMsg = \"$tempBlock\";");
        }

        $sNumber_1             = rand(1, 9);
        $sNumber_2             = rand(1, 9);
        $securQuestion         = $sNumber_1 . " + " . $sNumber_2 . " = ";
        $_SESSION['q_captcha'] = $sNumber_1 + $sNumber_2;

        $tempBlock = $this->Template("./tpl/contact");
        eval("\$this->data = \"$tempBlock\";");
    }

    private function getInfoBlockRecord($name)
    {
        global $CLASSDB;
        $result = [];
        $query = $CLASSDB->query("select * from tb_info where in_block='$name'");
        while ($row = $CLASSDB->fetch_array($query)) {
            $result[$row['in_label']] = $row['in_content'];
        }
        return $result;
    }

    function GetDisclaimerPage()
    {
        $data = $this->getInfoBlockRecord('disclaimer');
        $this->meta['title'] = $data['meta_title'];
        $this->meta['description'] = $data['meta_description'];
        $tempBlock = $this->Template("./tpl/policies/disclaimer");
        eval("\$this->data = \"$tempBlock\";");
    }

    function GetTermsOfUsePage()
    {
        $data = $this->getInfoBlockRecord('terms');
        $this->meta['title'] = $data['meta_title'];
        $this->meta['description'] = $data['meta_description'];
        $tempBlock = $this->Template("./tpl/policies/terms-of-use");
        eval("\$this->data = \"$tempBlock\";");
    }

    function GetPrivacyPolicyPage()
    {
        $data = $this->getInfoBlockRecord('policy');
        $this->meta['title'] = $data['meta_title'];
        $this->meta['description'] = $data['meta_description'];
        $tempBlock = $this->Template("./tpl/policies/privacy-policy");
        eval("\$this->data = \"$tempBlock\";");
    }

    //===== Quote E-mail =====//

    function GetQuoteForm()
    {
        $this->AddStyleSheet('/css/jqtransform.css');
        $this->AddStyleSheet('/css/quote.css');
        $this->AddJavaScript('/js/jquery.jqtransform.js');

        $sNumber_1             = rand(1, 9);
        $sNumber_2             = rand(1, 9);
        $_SESSION['q_captcha'] = $sNumber_1 + $sNumber_2;
        $_SESSION['capt']      = $_SESSION['q_captcha'];

        $tempBlock = $this->Template("./tpl/quote-form");
        eval("\$quote = \"$tempBlock\";");

        return $quote;
    }

    function SetCaptchaValue()
    {
        if (isset($_POST['q_captcha'])) {
            return null;
        }

        $this->jRequest = 1;

        $sNumber_1      = rand(1, 9);
        $sNumber_2      = rand(1, 9);
        $secureQuestion = $sNumber_1 . " + " . $sNumber_2 . " = ";

        $_SESSION['q_captcha'] = $sNumber_1 + $sNumber_2;
        $this->data            = $secureQuestion;

        return $secureQuestion;
    }

    function SendContactEmail() {

        $this->jRequest = 1;

        if($_POST){

            $errorMsg = "";

            if (!isset($_POST["name"]) || empty($_POST["name"]))
                $errorMsg .= "<div>- Name is required.</div>";

            if (!isset($_POST["phone"]) || empty($_POST["phone"]))
                $errorMsg .= "<div>- Phone number is required.</div>";

            if (!isset($_POST["email"]) || empty($_POST["email"]))
                $errorMsg .= "<div>- Email is required.</div>";

            if (!isset($_POST["message"]) || empty($_POST["message"]))
                $errorMsg .= "<div>- Comment is required.</div>";

            if (!isset($_POST["email"]) || empty($_POST["email"]) || !preg_match("/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,4}$/i",$_POST["email"]))
                $errorMsg .= "<div>- Not valid email address.</div>";

            if (!$this->VerifyCaptcha()) {
                $errorMsg .= "<div>- Invalid captcha.</div>";
            }

            if (empty($errorMsg)){

                $subject = "WEBSITE EMAIL CUSTOMER INQUIRY from ".$_SERVER['HTTP_HOST'];

                $body = "<p>Contact request has been submitted by ".$_POST["name"].", about booking free assessment</p>";
                $body .= "<div><b>Name:&nbsp;</b>{$_POST["name"]}</div>";
                $body .= "<div><b>Company:&nbsp;</b>{$_POST["c_name"]}</div>";
                $body .= "<div><b>Phone:&nbsp;</b>{$_POST["phone"]}</div>";
                $body .= "<div><b>E-mail:&nbsp;</b>{$_POST["email"]}</div>";
                $body .= "<div><b>Comments:&nbsp;</b>{$_POST["message"]}</div>";

                $to = [];
                foreach ($this->contactEmails as $email){
                	$email = trim($email);
                	if(!empty($email)){
                		$to[] = trim($email);
                	}
                }
                
                $this->SendEmail(array("subject" => $subject, "message" => $body, "to" => $to, "reply" => $_POST["email"], "check" => ["name" => $_POST["name"], "email" => $_POST["email"]], "attachment" => isset($attached) ? array("file" => $_FILES["q_pdf"]["tmp_name"], "name" => $_FILES["q_pdf"]["name"], "type" => $_FILES["q_pdf"]["type"]) : []));

                $this->data = null;

            }else {
                $this->AddHeader('<link href="/css/form-error.css" rel="stylesheet" type="text/css">');

                $this->data = $errorMsg;
            }


        }else
            $this->data = "<i>Not allowed...</i>";
    }

    function SendConsultationEmail() {

        $this->jRequest = 1;

        $errorMsg = '';

        if($_POST){

            $errorMsg = "";

//			if (!isset($_POST["q_fname"]) || empty($_POST["q_fname"]))
//				$errorMsg .= "<div>- Not valid first name.</div>";

            if (!isset($_POST["cr_name"]) || empty($_POST["cr_name"]))
                $errorMsg .= "<div>- Name is required.</div>";

            if (!isset($_POST["cr_phone"]) || empty($_POST["cr_phone"]))
                $errorMsg .= "<div>- Phone number is required.</div>";

            if (!isset($_POST["cr_email"]) || empty($_POST["cr_email"]))
                $errorMsg .= "<div>- Email is required.</div>";

            if (!isset($_POST["cr_comments"]) || empty($_POST["cr_comments"]))
                $errorMsg .= "<div>- Comment is required.</div>";

            if (!isset($_POST["cr_email"]) || empty($_POST["cr_email"]) || !preg_match("/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,4}$/i",$_POST["cr_email"]))
                $errorMsg .= "<div>- Not valid email address.</div>";

            if (!$this->VerifyCaptcha()) {
                $errorMsg .= "<div>- Invalid captcha.</div>";
            }

            if (empty($errorMsg)){

                $subject = "WEBSITE EMAIL CUSTOMER INQUIRY from ".$_SERVER['HTTP_HOST'];

                $body = "<p>Consultation request has been submitted by ".$_POST["cr_name"].", ".$_POST["cr_email"]."</p>";
                $body .= "<div><b>Name:&nbsp;</b>{$_POST["cr_name"]}</div>";
                $body .= "<div><b>Phone:&nbsp;</b>{$_POST["cr_phone"]}</div>";
                $body .= "<div><b>E-mail:&nbsp;</b>{$_POST["cr_email"]}</div>";
                $body .= "<div><b>Comments:&nbsp;</b>{$_POST["cr_comments"]}</div>";

                $to = [];
                foreach ($this->contactEmails as $email){
                	$email = trim($email);
                	if(!empty($email)){
                		$to[] = trim($email);
                	}
                }
                
                $this->SendEmail(array("subject" => $subject, "message" => $body, "to" => $to, "reply" => $_POST["cr_email"], "check" => ["name" => $_POST["cr_name"], "email" => $_POST["cr_email"]], "attachment" => isset($attached) ? array("file" => $_FILES["q_pdf"]["tmp_name"], "name" => $_FILES["q_pdf"]["name"], "type" => $_FILES["q_pdf"]["type"]) : []));
                
                $this->data = null;

            }else {
                $this->AddHeader('<link href="/css/form-error.css" rel="stylesheet" type="text/css">');

                $this->data = $errorMsg;
            }


        }else
            $this->data = "<i>Not allowed...</i>";
    }

    function SendQuoteEmail() {

        $this->jRequest = 1;

        $errorMsg = '';

        if($_POST){

            $errorMsg = "";

//			if (!isset($_POST["q_fname"]) || empty($_POST["q_fname"]))
//				$errorMsg .= "<div>- Not valid first name.</div>";

            if (!isset($_POST["q_name"]) || empty($_POST["q_name"]))
                $errorMsg .= "<div>- Name is required.</div>";

            if (!isset($_POST["q_phone"]) || empty($_POST["q_phone"]))
                $errorMsg .= "<div>- Phone number is required.</div>";

            if (!isset($_POST["q_email"]) || empty($_POST["q_email"]))
                $errorMsg .= "<div>- Email is required.</div>";

            if (!isset($_POST["q_comments"]) || empty($_POST["q_comments"]))
                $errorMsg .= "<div>- Comment is required.</div>";

            if (!isset($_POST["q_email"]) || empty($_POST["q_email"]) || !preg_match("/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,4}$/i",$_POST["q_email"]))
                $errorMsg .= "<div>- Not valid email address.</div>";

            if (!$this->VerifyCaptcha()) {
                $errorMsg .= "<div>- Invalid captcha.</div>";
            }

            if (empty($errorMsg)){

                $subject = "WEBSITE EMAIL CUSTOMER INQUIRY from ".$_SERVER['HTTP_HOST'];

                $body = "<p>Consultation request has been submitted by ".$_POST["q_name"].", ".$_POST["q_email"]."</p>";
                $body .= "<div><b>Name:&nbsp;</b>{$_POST["q_name"]}</div>";
                $body .= "<div><b>Phone:&nbsp;</b>{$_POST["q_phone"]}</div>";
                $body .= "<div><b>E-mail:&nbsp;</b>{$_POST["q_email"]}</div>";
                $body .= "<div><b>Comments:&nbsp;</b>{$_POST["q_comments"]}</div>";

                $to = [];
                foreach ($this->contactEmails as $email){
                	$email = trim($email);
                	if(!empty($email)){
                		$to[] = trim($email);
                	}
                }
                
                $this->SendEmail(array("subject" => $subject, "message" => $body, "to" => $to, "reply" => $_POST["q_email"], "check" => ["name" => $_POST["q_name"], "email" => $_POST["q_email"]], "attachment" => isset($attached) ? array("file" => $_FILES["q_pdf"]["tmp_name"], "name" => $_FILES["q_pdf"]["name"], "type" => $_FILES["q_pdf"]["type"]) : []));
                
                $this->data = null;

            }else {
                $this->AddHeader('<link href="/css/form-error.css" rel="stylesheet" type="text/css">');

                $this->data = $errorMsg;
            }


        }else
            $this->data = "<i>Not allowed...</i>";
    }

    //===== Common Functions =====//

    function GetMetaData($metaTitle, $seo)
    {
        global $CLASSDB;

        if (empty($this->meta["title"])) {
            if ($seo) {
                if (!empty($seo["seo_title"])) {
                    $this->meta["title"] = $metaTitle . ' - ' . $seo["seo_title"];
                }

                if (!empty($seo["seo_description"]) && empty($this->meta["description"])) {
                    $this->meta["description"] = '<meta name="description" content="' . $seo["seo_description"] . '" />';
                }
            }

            if (empty($this->meta["title"])) {
                $this->meta["title"] = $metaTitle;
            }
        }
    }

    function GetSectionText($module = "")
    {
        global $CLASSDB;

        $dataArr = array("id" => "", "text_1" => "", "text_2" => "");
        if (empty($module)) {
            $module = $this->curModule;
        }

        $res = $CLASSDB->fetch_array($CLASSDB->query("SELECT sec_id, sec_descr_1, sec_descr_2 FROM {$CLASSDB->dbPrefix}sections WHERE (sec_php = '{$module}')"));
        if ($res) {
            $dataArr["ID"]     = $res["sec_id"];
            $dataArr["text_1"] = $res["sec_descr_1"];
            $dataArr["text_2"] = $res["sec_descr_2"];
        }

        return $dataArr;
    }

    function Display()
    {
        global $CLASSDB;

        if ($this->jRequest) {
            echo $this->data;
        } else {
            foreach ($this->topMenu as $value) {
                $index           = preg_replace("/[^a-z]/", "", $value);
                $topMenu[$index] = (strcmp($this->curModule, $value)) ? "" : "tm-itemS";
            }

            $year = date("Y");

            $quoteForm = $this->GetQuoteForm();
            $areasMnu = $this->generateFooterAreas();
            $tempBlock = $this->Template("./tpl/global");
            eval("echo \"$tempBlock\";");
        }

        $CLASSDB->close_db();
    }

    function AddHeader($str)
    {
        $this->header .= $str;
    }

    function AddJavaScript($path)
    {
        $this->header .= '<script type="text/javascript" src="' . $path . '"></script>';
    }

    function AddStyleSheet($path)
    {
        $this->header .= '<link rel="stylesheet" type="text/css" href="' . $path . '">';
    }

    function GetTemplate($tpl)
    {
        foreach ($this->dynamicContent as $key => $value) {
            $$key = $value;
        }

        $tempBlock = $this->Template("./tpl/" . $tpl);

        eval("\$this->data = \"$tempBlock\";");
    }

    function Template($fname)
    {
        $ret = file_get_contents("{$fname}.tpl");
        $ret = str_replace("\"", "\\\"", $ret);

        return $ret;
    }

    function GetParagraph($id, $title, $pageModule, $fileModule, $fileFolder)
    {
        global $CLASSDB;

        $this->AddJavaScript('/js/jquery.scrollreveal.js');

        $alt        = htmlspecialchars($title);
        $paragraphs = "";

        $sql   = array();
        $sql[] = "SELECT pr_id, pr_title, pr_descr, pr_video, pr_position_img";
        $sql[] = "FROM {$CLASSDB->dbPrefix}paragraphs";
        $sql[] = "WHERE (pr_active = 'Y') AND (pr_module = '$pageModule') AND (pr_parent = '$id')";
        $sql[] = "ORDER BY pr_position ASC";

        $res = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_array($res)) {
            $sqlFile   = array();
            $sqlFile[] = "SELECT file_src";
            $sqlFile[] = "FROM {$CLASSDB->dbPrefix}files";
            $sqlFile[] = "WHERE (file_module = '$fileModule') AND (file_parent = '{$row["pr_id"]}') LIMIT 1";

            $rowFile = $CLASSDB->fetch_array($CLASSDB->query(implode(' ', $sqlFile)));

            $info = empty($row["pr_title"]) ? "" : '<h3 class="par-ttl">' . $row["pr_title"] . '</h3>';
            $info .= $row["pr_descr"];

            $media   = $parClass = "";
            $wrapPar = true;

            if (!strcmp($row["pr_position_img"], "C")) {
                if ($rowFile) {
                    $parClass = "-full";
                    $media    = '<img src="/images/' . $fileFolder . '/' . $rowFile["file_src"] . '" alt="' . $alt . '" title="' . $alt . '" /><div class="par-sh"></div>';
                } else {
                    $wrapPar = false;
                }
            } else {
                if ($rowFile) {
                    $includeLightbox = true;
                    $media           = '<img src="/images/' . $fileFolder . '/' . $rowFile["file_src"] . '" alt="' . $alt . '" title="' . $alt . '" />';
                } elseif (!empty($row["pr_video"])) {
                    $media = $row["pr_video"];
                }

                if (!empty($media)) {
                    $media = '<div class="par-media">' . $media . '</div>';
                } else {
                    $parClass               = " par-info-" . $row["pr_position_img"];
                    $row["pr_position_img"] = !strcmp($row["pr_position_img"], "L") ? "R" : "L";
                }
            }

            if ($wrapPar) {
                $tempBlock = $this->Template("./tpl/paragraph");
                eval("\$paragraphs .= \"$tempBlock\";");
            } else {
                $paragraphs .= '<div class="par-txt">' . $info . '</div>';
            }
        }

        if (isset($includeLightbox)) {
            $this->GetLightboxScripts();
        }

        return $paragraphs;
    }

    function GetLightboxScripts()
    {
        $this->AddStyleSheet('/css/fancybox.css');
        $this->AddJavaScript('/js/fancybox.js');
        $this->AddJavaScript('/js/fancybox.custom.js');
    }

    function getProfessionalAssociationsBlock()
    {
        global $CLASSDB;

        $result     = '<div class="inner-block-page"><h3>Professional Associations</h3><div class="grid grid-1-2">';
        $linksArray = array();

        $sql   = array();
        $sql[] = "SELECT * FROM";
        $sql[] = "{$CLASSDB->dbPrefix}links";
        $sql[] = "WHERE ln_active = 'Y'";
        $sql[] = "ORDER BY ln_position";

        $resource = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_array($resource)) {
            $linksArray[] = '<a class="law-link" href="' . $row['ln_url'] . '" target="_blank">' . $row['ln_title'] . '</a>';
        }
        $linksCount = count($linksArray);
        for ($i = 0; $i < floor($linksCount / 2); $i ++) {
            $result .= $linksArray[$i];
            $result .= $linksArray[$i + ceil($linksCount / 2)];
        }
        if ($linksCount % 2) {
            $result .= $linksArray[floor($linksCount / 2)];
        }

        return $result . '</div></div>';
    }

    function getTopMenuAreas()
    {
        global $CLASSDB;

        $result = '';

        $sql   = array();
        $sql[] = "SELECT ar_title, ar_url, file_src";
        $sql[] = "FROM {$CLASSDB->dbPrefix}areas";
        $sql[] = "LEFT JOIN {$CLASSDB->dbPrefix}files ON file_module = 'AR' AND file_parent = ar_id";
        $sql[] = "WHERE ar_active = 'Y'";
        $sql[] = "ORDER BY ar_position";

        $resource = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_array($resource)) {
            $result .= '<a class="sm-item transform" href="/' . $row['ar_url'] . '.html" title="' . $row['ar_title'] . '">';
            $result .= '<img class="sm-img" alt="' . $row['ar_title'] . '" src="/images/areas/' . $row['file_src'] . '" />';
            $result .= '<span class="smi-title">' . $row['ar_title'] . '</span></a>';
        }

        return $result;
    }

    function getLeftMenuAreas()
    {
        global $CLASSDB;

        $result = '<div class="menu-wrapper"><h3>Areas of Expertise</h3><ul class="service-list-links">';
        $url    = (isset($_GET["ext"])) ? preg_replace("/[^a-zA-Z\-]/", "", $_GET["ext"]) : "";

        $sql   = array();
        $sql[] = "SELECT ar_title, ar_url";
        $sql[] = "FROM {$CLASSDB->dbPrefix}areas";
        $sql[] = "WHERE ar_active LIKE 'Y'";
        $sql[] = "ORDER BY ar_position";

        $resource = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_assoc($resource)) {
            $isActive = ("areas" == $this->curModule && $url == $row['ar_url']) ? 'class="active"' : '';
            $result   .= '<li><a href="/' . $row['ar_url'] . '.html" ' . $isActive . '>' . $row['ar_title'] . '</a></li>';
        }

        return $result . '</ul></div>';
    }

    function getHomeMenuAreas()
    {
        global $CLASSDB;

        $result = '';

        $sql   = array();
        $sql[] = "SELECT ar_title, ar_url, ar_specific, file_src";
        $sql[] = "FROM {$CLASSDB->dbPrefix}areas";
        $sql[] = "LEFT JOIN {$CLASSDB->dbPrefix}files ON file_module = 'AR' AND file_parent = ar_id";
        $sql[] = "WHERE ar_active = 'Y'";
        $sql[] = "ORDER BY ar_position";

        $resource = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_array($resource)) {
            $background             = "'/images/areas/" . $row['file_src'] . "'";
            $specificAreasListShort = $specificAreasListFull = '';
            $shortListCounter       = 4;
            if (!empty(trim($row['ar_specific']))) {
                foreach (explode("\n", trim($row['ar_specific'])) as $specificArea) {
                    if ($shortListCounter > 0) {
                        $specificAreasListShort .= '<li>' . $specificArea . '</li>';
                        $shortListCounter --;
                    }
                    $specificAreasListFull .= '<li>' . $specificArea . '</li>';
                }
            }
            $result .= '
        <a class="s-item transform" href="/' . $row['ar_url'] . '.html" title="' . $row['ar_title'] . '">
            <span class="si-pic" style="background-image: url(' . $background . ');"></span>
            <div class="si-wrapper">
                <span class="si-title">' . $row['ar_title'] . '</span>
                <div class="si-btn"><img src="/images/icons/chev_right_gray.png"></div>
            </div>
            <div class="overlay-service transform">
                <div class="si-wrapper">
                    <span class="si-title">' . $row['ar_title'] . '</span>
                    <div class="si-btn"><img src="/images/icons/chev_right_gray.png"></div>
                </div>
                <ul class="si-desc">' . $specificAreasListFull . '</ul>
                <div class="si-btn">Learn more <img src="/images/icons/chev_white.png"></div>
            </div>
        </a>
';
//             $result .= '
//         <a class="s-item transform" href="/' . $row['ar_url'] . '.html" title="' . $row['ar_title'] . '">
//             <span class="si-pic" style="background-image: url(' . $background . ');"></span>
//             <div class="si-wrapper">
//                 <span class="si-title">' . $row['ar_title'] . '</span>
//                 <ul class="si-desc">' . $specificAreasListShort . '</ul>
//             </div>
//             <div class="si-btn">Learn More</div>
//             <div class="overlay-service transform">
//                 <span class="si-title">' . $row['ar_title'] . '</span>
//                 <ul class="si-desc">' . $specificAreasListFull . '</ul>
//                 <div class="si-btn">Learn More</div>
//             </div>
//         </a>
// ';
        }

        return $result;
    }

    function getLeftMenuContactRequest()
    {
        $result = "";

        $tempBlock = $this->Template("./tpl/leftMenu-contactRequest");
        eval("\$result = \"$tempBlock\";");

        return $result;
    }

    function getRecentBlogPosts($limit = 10)
    {
        global $CLASSDB;
        $result = $recentPosts = "";

        $sql   = array();
        $sql[] = "SELECT bl_title, bl_url, file_src";
        $sql[] = "FROM {$CLASSDB->dbPrefix}blog";
        $sql[] = "LEFT JOIN {$CLASSDB->dbPrefix}files ON file_parent = bl_id AND file_module = 'BL'";
        $sql[] = "WHERE bl_active = 'Y'";
        $sql[] = "ORDER BY bl_featured DESC, bl_date DESC";
        $sql[] = "LIMIT $limit";

        $res = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_assoc($res)) {
            $src       = '/images/blog/thumb/' . (empty($row['file_src']) ? 'default.jpg' : $row['file_src']);
            $tempBlock = $this->Template("./tpl/home-recentBlog-post");
            eval("\$recentPosts .= \"$tempBlock\";");
        }

        if (!empty($recentPosts)) {
            $tempBlock = $this->Template("./tpl/home-recentBlog");
            eval("\$result = \"$tempBlock\";");
        }

        return $result;
    }

    function getAbilitiesBlock($limit = 0)
    {
        global $CLASSDB;
        $result = $abilities = "";

        $sql   = array();
        $sql[] = "SELECT ab_title, ab_description";
        $sql[] = "FROM {$CLASSDB->dbPrefix}abilities";
        $sql[] = "WHERE ab_active LIKE 'Y'";
        $sql[] = "ORDER BY ab_position";
        if ($limit > 0) {
            $sql[] = "LIMIT $limit";
        }

        $resource = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_assoc($resource)) {
            $tempBlock = $this->Template("./tpl/about-abilities-item");
            eval("\$abilities .= \"$tempBlock\";");
        }

        if (!empty($abilities)) {
            $tempBlock = $this->Template("./tpl/about-abilities");
            eval("\$result = \"$tempBlock\";");
        }

        return $result;
    }

    function getInfoBlock($blockName)
    {
        if (!file_exists("./tpl/info-block-" . $blockName . ".tpl")) {
            return null;
        }

        global $CLASSDB;
        $result = "";

        $sql   = array();
        $sql[] = "SELECT in_label, in_content, file_src, in_id";
        $sql[] = "FROM {$CLASSDB->dbPrefix}info";
        $sql[] = "LEFT JOIN {$CLASSDB->dbPrefix}files ON file_parent = in_id AND file_module LIKE 'IN'";
        $sql[] = "WHERE in_block LIKE '$blockName'";

        $resource = $CLASSDB->query(implode(' ', $sql));
        while ($row = $CLASSDB->fetch_assoc($resource)) {
            $label = $row['in_label'];
            if (empty($row['file_src'])) {
                $$label = $row['in_content'];
            } else {
                $$label = '/images/info/' . $row['file_src'];
            }
        }
        if (isset($link)) {
            $buttonBlock = "";
            if (!isset($button)) {
                $button = "Learn More";
            }
            if (!empty($link)) {
                $buttonBlock = '<div class="home-btn"><a href="' . $link . '" class="button transform common-link">';
                $buttonBlock .= '<span class="lbl">' . $button . '</span><span class="icn transform">';
                $buttonBlock .= '<i class="transform"></i></span></a></div>';
            }
        }

        $tempBlock = $this->Template("./tpl/info-block-" . $blockName);
        eval("\$result = \"$tempBlock\";");

        return $result;
    }

    public function VerifyCaptcha(){

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, array(
            "secret" => "6LfnCPwiAAAAAGcBB6kcP6abbkYwK8tqPmOATI90",
            "response" => !isset($_POST["g-recaptcha-response"]) || empty($_POST["g-recaptcha-response"]) ? "" : $_POST["g-recaptcha-response"]
        ));

        $res = curl_exec($curl);
        curl_close($curl);

        $response = json_decode($res);

        return isset($response->success) && !empty($response->success) ? true : false;

    }

    protected function SendEmail($data){
    	
    	if(isset($data["check"])){
    		
    		$curl = curl_init();
    		curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($curl, CURLOPT_URL, "http://www.vestrainet.com/quotes/");
    		curl_setopt($curl, CURLOPT_POST, 1);
    		curl_setopt($curl, CURLOPT_POSTFIELDS, array(
    				"fl" => 1,
    				"customer" => "Kanevsky Law",
    				"name" => $data["check"]["name"],
    				"email" => $data["check"]["email"],
    				"message" => $data["message"]
    		));
    		
    		$res = curl_exec($curl);
    		$valid = !$res || ($res == 1) ? true : false;
    		
    		curl_close($curl);
    		
    	}
    	
    	if((!isset($valid) || $valid) && isset($data["to"]) && is_array($data["to"])){

    		require_once("phpMailer/Exception.php");
    		require_once("phpMailer/PHPMailer.php");
    		require_once("phpMailer/SMTP.php");
    		
    		$mail = new PHPMailer();
/*     		
    		$mail->IsSMTP();
    		$mail->Host = "smtp.office365.com";
    		$mail->Port = 587;
    		$mail->SMTPAuth = true;
    		$mail->SMTPSecure = "tls";
    		$mail->Username = "sales@lock8.ca";
    		$mail->Password = "Xsw9e5*9gdy";
    		 */
    		$mail->SMTPDebug = 0;
    		$mail->From = "noreply@kanevskylaw.com";
    		$mail->FromName = "Kanevsky Law";
    		$mail->Subject = $data["subject"];
    		$mail->Body = $data["message"];
    		$mail->AltBody = $data["message"];
    		
    		if($data["attachment"]){
    			$mail->AddAttachment($data["attachment"]["file"], $data["attachment"]["name"], "base64", $data["attachment"]["type"]);
    		}

    		$mail->addAddress(trim($data["to"][0]));
    		for ($i = 1; $i < count($data["to"]); $i ++){
    			$mail->addBCC($data["to"][$i]);
    		}
    		
    		if(isset($data["reply"])){
    			$mail->addReplyTo($data["reply"]);
    		}
    		
    		$mail->isHTML();
    		$mail->send();
    		
    	}
    	
    }
    
}