getVersion() public method

The version of the browser.
public getVersion ( ) : string
return string Version of the browser (will only contain alpha-numeric characters and a period)
 function index()
 {
     include ROOT . "/library/browser/Browser.php";
     $browser = new Browser();
     if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 7) {
         flash_error(lang("ie browser outdated"));
     }
     if (is_ajax_request()) {
         $timezone = array_var($_GET, 'utz');
         if ($timezone && $timezone != '') {
             $usu = logged_user();
             if ($usu instanceof Contact && $usu->isUser() && !$usu->getDisabled()) {
                 $usu->setTimezone($timezone);
                 $usu->save();
             }
         }
         $this->redirectTo('dashboard', 'main_dashboard');
     } else {
         if (!(logged_user() instanceof Contact && logged_user()->isUser())) {
             $this->redirectTo('access', 'login');
         }
         $this->setLayout("website");
         $this->setTemplate(get_template_path("empty"));
     }
 }
Exemplo n.º 2
0
 private function recordVisit()
 {
     $internal = false;
     $referer = @$_SERVER['HTTP_REFERER'];
     $referer_url = parse_url($referer);
     if (strtolower(@$referer_url['host']) === strtolower(@$_SERVER['HTTP_HOST'])) {
         $referer = @$referer_url['path'] . (@$referer_url['query'] ? '?' . @$referer_url['query'] : '');
         $internal = true;
     }
     $browser = new \Browser();
     $visitor_table = $this->curator->tableName(SchemaCurator::VISIT_TABLE);
     $unique = false;
     $this->db->insert($visitor_table, ['datetime' => new \DateTime(), 'verb' => @$_SERVER['REQUEST_METHOD'], 'generate' => $this->generated, 'port' => @$_SERVER['SERVER_PORT'], 'memory' => $this->memory, 'status' => http_response_code(), 'address_id' => $this->getLinkedResourceId(SchemaCurator::ADDRESS_TABLE, 'address', @$_SERVER['REMOTE_ADDR']), 'host_id' => $this->getLinkedResourceId(SchemaCurator::HOST_TABLE, 'host', @$_SERVER['HTTP_HOST']), 'path_id' => $this->getLinkedResourceId(SchemaCurator::PATH_TABLE, 'path', @$_SERVER['REQUEST_URI']), 'referer_id' => $this->getLinkedResourceId(SchemaCurator::REFERER_TABLE, 'referer', $referer), 'browser_id' => $this->getLinkedResourceId(SchemaCurator::BROWSER_TABLE, 'browser', $browser->getBrowser() === \Browser::BROWSER_UNKNOWN ? '' : $browser->getBrowser()), 'browser_version_id' => $this->getLinkedResourceId(SchemaCurator::BROWSER_VERSION_TABLE, 'browser_version', $browser->getVersion() === \Browser::VERSION_UNKNOWN ? '' : $browser->getVersion()), 'platform_id' => $this->getLinkedResourceId(SchemaCurator::PLATFORM_TABLE, 'platform', $browser->getPlatform() === \Browser::PLATFORM_UNKNOWN ? '' : $browser->getPlatform()), 'session_id' => $this->getLinkedResourceId(SchemaCurator::SESSION_TABLE, 'session', $this->session_id, $unique), 'is_secure' => isset($_SERVER['HTTPS']), 'is_unique' => $unique, 'is_internal' => $internal], [Type::DATETIME]);
 }
 public function do_help()
 {
     $user = Sentry::getUser();
     $subject = "Newsletter Help: " . Input::get('subject');
     $emailbody = Input::get('message');
     $from_name = $user->first_name . ' ' . $user->last_name;
     $from_email = $user->email;
     $admin = User::first();
     $to_name = $admin->first_name . ' ' . $admin->last_name;
     $to_email = $admin->email;
     $rules = array('subject' => 'required|max:128', 'message' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('dashboard/help')->withErrors($validator);
     } else {
         $browser = new Browser();
         $userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion();
         $userplatform = $browser->getPlatform();
         $userIP = $_SERVER["REMOTE_ADDR"];
         $page = URL::current();
         $data = array('emailbody' => $emailbody, 'userbrowser' => $userbrowser, 'userplatform' => $userplatform, 'userIP' => $userIP, 'page' => $page);
         $issent = Mail::send('emails.help-email', $data, function ($message) use($from_email, $from_name, $subject, $to_name, $to_email) {
             $message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject);
         });
         if ($issent) {
             return Redirect::to('dashboard/help')->with('success', 'Success! You will be contacted soon regarding your issue.');
         } else {
             return Redirect::to('dashboard/help')->with('error', 'An error was encountered sending the email. Please try again.');
         }
     }
 }
 public function updateStats($manufacturer_id, $customer_id)
 {
     $this->load->library('browser');
     $browser = new Browser();
     $this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET viewed = viewed + 1 WHERE manufacturer_id = '" . (int) $manufacturer_id . "'");
     $this->db->query("INSERT " . DB_PREFIX . "stat SET \n        `object_id`     = '" . (int) $manufacturer_id . "',\n        `store_id`      = '" . (int) STORE_ID . "',\n        `customer_id`   = '" . (int) $customer_id . "',\n        `object_type`   = 'manufacturer',\n        `server`        = '" . $this->db->escape(serialize($_SERVER)) . "',\n        `session`       = '" . $this->db->escape(serialize($_SESSION)) . "',\n        `request`       = '" . $this->db->escape(serialize($_REQUEST)) . "',\n        `store_url`     = '" . $this->db->escape($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . "',\n        `ref`           = '" . $this->db->escape($_SERVER['HTTP_REFERER']) . "',\n        `browser`       = '" . $this->db->escape($browser->getBrowser()) . "',\n        `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\n        `os`            = '" . $this->db->escape($browser->getPlatform()) . "',\n        `ip`            = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\n        `date_added`    = NOW()");
 }
 public static function log($logType, $user = false, $data1 = false)
 {
     $browser = new Browser();
     $text = '';
     $timestamp = time();
     if ($user !== false) {
         $userId = $user->get('id');
     } else {
         $userId = 0;
     }
     $data = '';
     switch ($logType) {
         case 3:
             foreach ($data1 as $key => $value) {
                 $data .= ' ' . $key . ': ' . $value . '|';
             }
             break;
         case 4:
             $data = 'Plattform: ' . $browser->getPlatform() . ' | Browser: ' . $browser->getBrowser() . ' | Version: ' . $browser->getVersion() . ' | UserAgent: ' . $browser->getUserAgent();
             break;
         default:
             break;
     }
     $text = Texter::get('log|' . $logType);
     database::Query('INSERT INTO log (`type`, `text`, `data`, `userId`, `timestamp`) VALUES (' . $logType . ', :var1, :var2, :var3, :var4);', array('var1' => $text, 'var2' => $data, 'var3' => $userId, 'var4' => $timestamp));
 }
Exemplo n.º 6
0
 /**
  * {@inheritDoc}
  */
 public function __construct(array $attributes = array())
 {
     $browser = new Browser();
     $attributes['version'] = $browser->getVersion();
     $attributes['platform'] = $browser->getPlatform();
     $attributes['browser'] = $browser->getBrowser();
     parent::__construct($attributes);
 }
 public function __construct()
 {
     $browser = new Browser();
     /* browser name */
     $browser_name = null;
     switch ($browser->getBrowser()) {
         case Browser::BROWSER_CHROME:
             $browser_name = 'chrome';
             $this->addClass('webkit');
             break;
         case Browser::BROWSER_FIREFOX:
             $browser_name = 'firefox';
             break;
         case Browser::BROWSER_IE:
             $browser_name = 'ie';
             break;
         case Browser::BROWSER_SAFARI:
             $browser_name = 'safari';
             $this->addClass('webkit');
             break;
         case Browser::BROWSER_OPERA:
             $browser_name = 'opera';
             $this->addClass('webkit');
             break;
         default:
             $browser_name = strtolower(str_replace(' ', '', $browser->getBrowser()));
     }
     /* browser version */
     $version = explode('.', $browser->getVersion());
     $version = is_array($version) && count($version) ? $version[0] : '';
     /* browser platform */
     $platform = null;
     switch ($browser->getPlatform()) {
         case Browser::PLATFORM_ANDROID:
             $platform = 'android';
             break;
         case Browser::PLATFORM_APPLE:
             $platform = 'mac';
             break;
         case Browser::PLATFORM_IPAD:
             $platform = 'ipad';
             break;
         case Browser::PLATFORM_IPHONE:
             $platform = 'iphone';
             break;
         case Browser::PLATFORM_LINUX:
             $platform = 'linux';
             break;
         case Browser::PLATFORM_WINDOWS:
             $platform = 'win';
             break;
     }
     /* add classes */
     $this->addClass($browser_name);
     $this->addClass($browser_name . $version);
     $this->addClass($platform);
 }
Exemplo n.º 8
0
function ie_version($output)
{
    $browser = new Browser();
    if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 10) {
        return $output . ' class="ie"';
    } else {
        return $output;
    }
}
Exemplo n.º 9
0
 public function add()
 {
     $this->load->library('browser');
     $browser = new Browser();
     if ($browser->getBrowser() != 'GoogleBot') {
         $sql = "INSERT INTO " . DB_PREFIX . "search SET \r\n                `customer_id`   = '" . (int) $this->customer->getId() . "',\r\n                store_id   = '" . (int) STORE_ID . "', \r\n                `request`       = '" . $this->db->escape(serialize($_REQUEST)) . "',\r\n                `urlQuery`      = '" . $this->db->escape($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . "',\r\n                `browser`       = '" . $this->db->escape($browser->getBrowser()) . "',\r\n                `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\r\n                `os`            = '" . $this->db->escape($browser->getPlatform()) . "',\r\n                `ip`            = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\r\n                `date_added`    = NOW()";
         $this->db->query($sql);
         return $this->db->getLastId();
     }
 }
Exemplo n.º 10
0
 private function initCanvas($data)
 {
     $data = json_decode($data);
     $this->ip = $this->validateInput($_SERVER['REMOTE_ADDR']);
     $this->message = filter_var($data->note, FILTER_SANITIZE_STRING);
     $browser = new Browser();
     $this->browser = "Name of browser " . $browser->getBrowser() . " Version " . $browser->getVersion();
     $this->isBrowserMobile = $browser->isMobile();
     $this->url = is_null($data->url) ? null : $data->url;
     if (!is_null($data->img)) {
         $this->img = $data->img;
     }
 }
Exemplo n.º 11
0
function isSupportedVersion()
{
    $BrowserInfo = new Browser();
    switch ($BrowserInfo->getBrowser()) {
        case Browser::BROWSER_SAFARI:
            return $BrowserInfo->getVersion() >= 5;
            break;
        case Browser::BROWSER_FIREFOX:
            return $BrowserInfo->getVersion() >= 4;
            break;
        case Browser::BROWSER_IE:
            return $BrowserInfo->getVersion() >= 10;
            break;
        case Browser::BROWSER_CHROME:
            return $BrowserInfo->getVersion() >= 10;
            break;
        case Browser::BROWSER_OPERA:
            return intval($BrowserInfo->getVersion()) >= 12;
            break;
    }
    return true;
}
Exemplo n.º 12
0
 function getLogLogin($q)
 {
     $queris = "SELECT * FROM t_loglogin_bnc where uname = '" . $this->db->amanin($q) . "' order by id DESC LIMIT 5";
     $data = $this->db->selectData($queris);
     $h = "";
     for ($i = 0; $i < count($data); $i++) {
         $browser = new Browser($data[$i]["user_agent"]);
         $h .= '<li class="collection-item dismissable">';
         $h .= '<label for="task1">' . $browser->getOS() . '/' . $browser->getBrowser() . ' ' . $browser->getVersion() . '<a href="javascript:void(0);" class="secondary-content"><span class="ultra-small">' . $this->ubahTimeStamp($data[$i]["tgl"]) . '</span></a></label>';
         $h .= '<span class="task-cat teal">' . $data[$i]["ip"] . '</span>';
         $h .= '</li>';
     }
     return $h;
 }
 public function readResourceMap()
 {
     if (!$this->resoure_map) {
         $context = \CADB\Model\Context::instance();
         $map_file = CADB_PATH . "/config/resources.map.json";
         if (file_exists($map_file)) {
             $fp = fopen($map_file, "r");
             $json = trim(fread($fp, filesize($map_file)));
             fclose($fp);
             $this->resource_map = json_decode($json, true);
         }
         $browser = new \Browser();
         if ($browser->getBrowser() == \Browser::BROWSER_IE && $browser->getVersion() <= 9) {
             $fallback_map_file = CADB_PATH . "/config/resources.map.fallback.json";
             $this->mergeMap($fallback_map_file, "", true);
         }
     }
     return $this->resource_map;
 }
Exemplo n.º 14
0
 /**
  * ControllerCommonHeader::index()
  * 
  * @return
  */
 protected function index()
 {
     if ($this->request->hasQuery('hl')) {
         $this->session->set('language', $this->request->getQuery('hl'));
         if ($this->session->has('redirect')) {
             $this->redirect($this->session->get('redirect'));
         } else {
             $this->redirect(Url::createAdminUrl('common/home'));
         }
     }
     $this->load->language('common/header');
     $this->data['title'] = $this->document->title . " | NecoTienda";
     $this->data['breadcrumbs'] = $this->document->breadcrumbs;
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->load->library('browser');
     $browser = new Browser();
     if ($browser->getBrowser() == 'Internet Explorer' && $browser->getVersion() <= 8) {
         $this->redirect(Url::createUrl("page/deprecated", null, 'NONSSL', HTTP_CATALOG));
     }
     if (!$this->user->validSession()) {
         $this->data['logged'] = '';
         $this->data['home'] = Url::createAdminUrl('common/login');
     } else {
         $this->data['logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
         if ($this->session->has('success')) {
             $this->data['success'] = $this->session->get('success');
             $this->session->clear('success');
         }
         if ($this->session->has('error')) {
             $this->data['error'] = $this->session->get('error');
             $this->session->clear('error');
         }
         $this->load->auto("setting/store");
         $this->data['stores'] = $this->modelStore->getAll();
     }
     $this->loadCss();
     $this->id = 'header';
     $this->template = 'common/header.tpl';
     $this->render();
 }
Exemplo n.º 15
0
 /**
  * Get browser major version
  *
  * @return string
  */
 public static function getBrowserMajorVersion()
 {
     if (!class_exists('Browser')) {
         t3import('core.libs.browser');
     }
     $browser = new Browser();
     $bver = explode('.', $browser->getVersion());
     return $bver[0];
     //Major version only
 }
Exemplo n.º 16
0
 /**
  * Определение браузера
  * @return string браузер и версия браузера
  */
 public static function getUserAgent($userAgent = null)
 {
     $browser = new Browser();
     if ($userAgent) {
         $browser->setUserAgent($userAgent);
     }
     $brow = $browser->getBrowser();
     $version = implode('.', array_slice(explode('.', $browser->getVersion()), 0, 2));
     return $version == 'unknown' ? $brow : $brow . ' ' . $version;
 }
Exemplo n.º 17
0
template_repository_path($template_folder . get_lang());
template_load_dictionnary('translations.xml');
//
// Login/logout
//
// Saves the URL used to access the website
if (!isset($_SESSION['first_input']) && isset($input['action']) && $input['action'] != 'logout' && $input['action'] != 'login' && $input['action'] != 'client_trace') {
    $_SESSION['first_input'] = array_merge($_GET, $_POST);
}
// Saves user's web browser information
if (!isset($_SESSION['browser_name']) || !isset($_SESSION['browser_version']) || !isset($_SESSION['user_os'])) {
    Autoloader::register();
    $browser = new Browser();
    $os = new Os();
    $_SESSION['browser_name'] = $browser->getName();
    $_SESSION['browser_version'] = $browser->getVersion();
    $user_agent = $browser->getUserAgent();
    $_SESSION['browser_full'] = $user_agent->getUserAgentString();
    $_SESSION['user_os'] = $os->getName();
}
// If we're not logged in, we try to log in or display the login form
if (!user_logged_in()) {
    // if the url contains the parameter 'anon' the session is assumed as anonymous
    if (isset($input['anon']) && $input['anon'] == true) {
        user_anonymous_session();
    } else {
        if (isset($input['action']) && $input['action'] == 'login') {
            // The user continues without any authentication
            if (isset($_POST['anonymous_session'])) {
                user_anonymous_session();
                // The user want to authenticate
Exemplo n.º 18
0
/**
 * Check browser support for type files
 * This function check if the users browser support a file format or
 * return the current browser and major ver when $format=check_browser
 * @param string $format
 *
 * @return bool, or return text array if $format=check_browser
 * @author Juan Carlos Raña Trabado
 */
function api_browser_support($format = "")
{
    $browser = new Browser();
    $current_browser = $browser->getBrowser();
    $a_versiontemp = explode('.', $browser->getVersion());
    $current_majorver = $a_versiontemp[0];
    // Native svg support
    if ($format == 'svg') {
        if ($current_browser == 'Internet Explorer' && $current_majorver >= 9 || $current_browser == 'Firefox' && $current_majorver > 1 || $current_browser == 'Safari' && $current_majorver >= 4 || $current_browser == 'Chrome' && $current_majorver >= 1 || $current_browser == 'Opera' && $current_majorver >= 9) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'pdf') {
        //native pdf support
        if ($current_browser == 'Chrome' && $current_majorver >= 6) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'tif' || $format == 'tiff') {
        //native tif support
        if ($current_browser == 'Safari' && $current_majorver >= 5) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'ogg' || $format == 'ogx' || $format == 'ogv' || $format == 'oga') {
        //native ogg, ogv,oga support
        if ($current_browser == 'Firefox' && $current_majorver >= 3 || $current_browser == 'Chrome' && $current_majorver >= 3 || $current_browser == 'Opera' && $current_majorver >= 9) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'mpg' || $format == 'mpeg') {
        //native mpg support
        if ($current_browser == 'Safari' && $current_majorver >= 5) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'mp4') {
        //native mp4 support (TODO: Android, iPhone)
        if ($current_browser == 'Android' || $current_browser == 'iPhone') {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'mov') {
        //native mov support( TODO:check iPhone)
        if ($current_browser == 'Safari' && $current_majorver >= 5 || $current_browser == 'iPhone') {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'avi') {
        //native avi support
        if ($current_browser == 'Safari' && $current_majorver >= 5) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'wmv') {
        //native wmv support
        if ($current_browser == 'Firefox' && $current_majorver >= 4) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'webm') {
        //native webm support (TODO:check IE9, Chrome9, Android)
        if ($current_browser == 'Firefox' && $current_majorver >= 4 || $current_browser == 'Opera' && $current_majorver >= 9 || $current_browser == 'Internet Explorer' && $current_majorver >= 9 || $current_browser == 'Chrome' && $current_majorver >= 9 || $current_browser == 'Android') {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'wav') {
        //native wav support (only some codecs !)
        if ($current_browser == 'Firefox' && $current_majorver >= 4 || $current_browser == 'Safari' && $current_majorver >= 5 || $current_browser == 'Opera' && $current_majorver >= 9 || $current_browser == 'Internet Explorer' && $current_majorver >= 9 || $current_browser == 'Chrome' && $current_majorver > 9 || $current_browser == 'Android' || $current_browser == 'iPhone') {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'mid' || $format == 'kar') {
        //native midi support (TODO:check Android)
        if ($current_browser == 'Opera' && $current_majorver >= 9 || $current_browser == 'Android') {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'wma') {
        //native wma support
        if ($current_browser == 'Firefox' && $current_majorver >= 4) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'au') {
        //native au support
        if ($current_browser == 'Safari' && $current_majorver >= 5) {
            return true;
        } else {
            return false;
        }
    } elseif ($format == 'mp3') {
        //native mp3 support (TODO:check Android, iPhone)
        if ($current_browser == 'Safari' && $current_majorver >= 5 || $current_browser == 'Chrome' && $current_majorver >= 6 || $current_browser == 'Internet Explorer' && $current_majorver >= 9 || $current_browser == 'Android' || $current_browser == 'iPhone' || $current_browser == 'Firefox') {
            return true;
        } else {
            return false;
        }
    } elseif ($format == "check_browser") {
        $array_check_browser = array($current_browser, $current_majorver);
        return $array_check_browser;
    } else {
        return false;
    }
}
Exemplo n.º 19
0
 /**
  * record login
  * @param integer $account_id
  * @param integer $attempt 0 for failed, 1 for success
  * @param string $attempt_text attempt text
  * @return boolean
  */
 public function recordLogin($account_id = '', $attempt = '0', $attempt_text = '')
 {
     if (!is_numeric($account_id) || !is_numeric($attempt)) {
         return false;
     }
     if ($attempt_text == null) {
         $attempt_text = null;
     }
     $site_id = \Model_Sites::getSiteId(false);
     // get browser class for use instead of fuelphp agent which is does not work.
     include_once APPPATH . 'vendor' . DS . 'browser' . DS . 'lib' . DS . 'Browser.php';
     $browser = new Browser();
     // set data for insertion
     $data['account_id'] = $account_id;
     $data['site_id'] = $site_id;
     $data['login_ua'] = \Input::user_agent();
     $data['login_os'] = $browser->getPlatform();
     $data['login_browser'] = $browser->getBrowser() . ' ' . $browser->getVersion();
     $data['login_ip'] = \Input::real_ip();
     $data['login_time'] = time();
     $data['login_time_gmt'] = \Extension\Date::localToGmt();
     $data['login_attempt'] = $attempt;
     $data['login_attempt_text'] = $attempt_text;
     \DB::insert(static::$_table_name)->set($data)->execute();
     unset($browser, $data, $site_id);
     return true;
 }
 public function unsubscribe($id)
 {
     $browser = new Browser();
     $userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion();
     $userplatform = $browser->getPlatform();
     $userIP = $_SERVER["REMOTE_ADDR"];
     $tracker = Tracker::find($id);
     $tracker->unsubscribed = 1;
     if ($tracker->IP_address == '') {
         $tracker->IP_address = $userIP;
     }
     if ($tracker->browser == '') {
         $tracker->browser = $userbrowser;
     }
     if ($tracker->platform == '') {
         $tracker->platform = $userplatform;
     }
     if ($tracker->read == 0) {
         $tracker->read = 1;
     }
     if ($tracker->read_at == '0000-00-00 00:00:00') {
         $tracker->read_at = new Datetime();
     }
     $tracker->save();
     $sub_id = $tracker->subscriber_id;
     $subscriber = Subscriber::find($sub_id);
     $subscriber->active = 0;
     $subscriber->save();
     echo "You have been successfully unsubscribed.";
 }
Exemplo n.º 21
0
     exit;
 }
 //set response id session
 $_SESSION['response_id'] = $response_id;
 //get the ip address
 $target_ip = $_SERVER['REMOTE_ADDR'];
 //get the time when the link was clicked
 $link_time = date('Y-m-d H:i:s');
 //get browser info
 //pull in browser script
 include "../includes/browser.php";
 //put browser info into variable
 $browser_info = new Browser();
 //get browser type and version
 $browser_type = $browser_info->getBrowser();
 $browser_version = $browser_info->getVersion();
 //get OS
 $os = $browser_info->getPlatform();
 //connect to the database
 include "../spt_config/mysql_config.php";
 //validate that the response id is legit
 $r = mysql_query("SELECT response_id FROM campaigns_responses WHERE response_id = '{$response_id}'");
 if (mysql_num_rows($r) > 0) {
     $match = 1;
 }
 //if a match happened record that they clicked the link
 if (isset($match) && $match == 1) {
     //get campaign id for this response
     $r = mysql_query("SELECT campaign_id, target_id, link, sent, sent_time, java, flash, url, response_log FROM campaigns_responses WHERE response_id = '{$response_id}'");
     while ($ra = mysql_fetch_assoc($r)) {
         $campaign_id = $ra['campaign_id'];
Exemplo n.º 22
0
 private function browserCheck()
 {
     include_once APPPATH . 'vendor' . DS . 'browser' . DS . 'lib' . DS . 'Browser.php';
     $browser = new Browser();
     if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() >= 8 || $browser->getBrowser() == Browser::BROWSER_OPERA && $browser->getVersion() >= 10 || $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 3 || $browser->getBrowser() == Browser::BROWSER_SAFARI && $browser->getVersion() >= 4 || $browser->getBrowser() == Browser::BROWSER_CHROME && $browser->getVersion() >= 8 || $browser->getBrowser() == Browser::BROWSER_ANDROID || $browser->getBrowser() == Browser::BROWSER_IPAD || $browser->getBrowser() == Browser::BROWSER_IPHONE) {
         return 'yes';
     } elseif ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 8) {
         return 'no';
     } else {
         return 'unknow';
     }
 }
Exemplo n.º 23
0
 public function registerActivity($id, $type, $desc, $action = 'update', $event = 'click')
 {
     if (file_exists(__DIR__ . '/browser.php')) {
         include_once 'browser.php';
         $browser = new Browser();
     }
     $actions = array('login', 'logout', 'create', 'read', 'update', 'delete', 'import', 'export');
     $events = array('load', 'click', 'keydown');
     if ($browser && in_array($action, $actions) && in_array($event, $events)) {
         $this->db->query("INSERT " . DB_PREFIX . "user_activity SET \n            `user_id`       = '" . (int) $this->getId() . "',\n            `object_id`     = '" . (int) $id . "',\n            `object_type`   = '" . $this->db->escape($type) . "',\n            `description`   = '" . $this->db->escape($desc) . "',\n            `session`        = '" . $this->db->escape(serialize($_SESSION)) . "',\n            `browser`       = '" . $this->db->escape($browser->getBrowser()) . "',\n            `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\n            `os`            = '" . $this->db->escape($browser->getPlatform()) . "',\n            `ip`            = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\n            `date_added`    = NOW()");
     }
 }
Exemplo n.º 24
0
 public function index()
 {
     $this->document->setTitle('Journal Control Panel');
     $this->document->addStyle('//fonts.googleapis.com/css?family=Oswald');
     if (!Front::$IS_OC2) {
         $this->document->addStyle('view/journal2/lib/bootstrap/css/bootstrap.css');
         $this->document->addScript('view/journal2/lib/bootstrap/js/bootstrap.min.js');
     }
     $this->document->addScript('view/journal2/lib/css_browser_selector.js');
     $this->document->addScript('//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
     $this->document->addScript('view/journal2/lib/ckeditor/ckeditor.js');
     $this->document->addStyle('view/journal2/lib/css-toggle-switch/toggle-switch.css');
     $this->document->addStyle('view/journal2/lib/select2/select2.css');
     $this->document->addStyle('view/journal2/lib/angular-table/ng-table.min.css');
     $this->document->addStyle('view/journal2/lib/simple-slider/css/simple-slider.css');
     $this->document->addStyle('view/journal2/css/hint.min.css');
     $this->document->addStyle('view/journal2/css/main.css');
     $this->document->addScript('view/journal2/lib/spectrum/spectrum.js');
     $this->document->addStyle('view/journal2/lib/spectrum/spectrum.css');
     $this->document->addScript('view/journal2/js/colors.js');
     $this->document->addStyle('../catalog/view/theme/journal2/css/icons/style.css');
     if (Front::$IS_OC2) {
         $this->data['header'] = $this->load->controller('common/header');
         $this->data['column_left'] = $this->load->controller('common/column_left');
         $this->data['footer'] = $this->load->controller('common/footer');
     } else {
         $this->children = array('common/header', 'common/footer');
     }
     /* check browser */
     $browser = new Browser();
     if ($browser->isBrowser('Internet Explorer') && version_compare($browser->getVersion(), '8.0', '<=')) {
         $this->template = '../journal2/tpl/error' . (Front::$IS_OC2 ? '_oc2' : '') . '.tpl';
         $this->data['journal_error_title'] = 'Browser Error';
         $this->data['journal_error_message'] = 'It seems you are using an outdated browser. <br />We recommend you update your browser to the latest version.';
         $this->response->setOutput($this->render());
         return;
     }
     /* tables does not exist*/
     if (!$this->db->query(str_replace('_', '\\_', 'show tables like "' . DB_PREFIX . 'journal2_config"'))->num_rows) {
         $this->template = '../journal2/tpl/error' . (Front::$IS_OC2 ? '_oc2' : '') . '.tpl';
         $this->data['journal_error_title'] = 'Database Error';
         $this->data['journal_error_message'] = 'Uninstalling and reinstalling this module may solve this issue.';
         $this->response->setOutput($this->render());
         return;
     }
     /* check if files are replaced correctly */
     if (!defined('JOURNAL_VERSION')) {
         $this->template = '../journal2/tpl/error' . (Front::$IS_OC2 ? '_oc2' : '') . '.tpl';
         $this->data['journal_error_title'] = 'Journal Installation Error';
         $this->data['journal_error_message'] = 'Make sure you have uploaded all Journal files to your server and successfully replaced <b>system/engine/front.php</b> file.<br /> You can find more information <a href="http://docs.digital-atelier.com/opencart/journal/#/settings/install" target="_blank">here</a>.';
         $this->response->setOutput($this->render());
         return;
     }
     if (!Front::$IS_OC2) {
         $this->load->model('setting/extension');
         if (!method_exists($this->model_setting_extension, 'uninstallJ2Extension')) {
             $this->template = '../journal2/tpl/error' . (Front::$IS_OC2 ? '_oc2' : '') . '.tpl';
             $this->data['journal_error_title'] = 'Journal Installation Error';
             $this->data['journal_error_message'] = 'Make sure you have uploaded all Journal files to your server and successfully replaced <b>admin/model/setting/extension.php</b> file.<br /> You can find more information <a href="http://docs.digital-atelier.com/opencart/journal/#/settings/install" target="_blank">here</a>.';
             $this->response->setOutput($this->render());
             return;
         }
     }
     /* check if vqmod is installed */
     if (!Front::$IS_OC2 && !class_exists('VQMod')) {
         $this->template = '../journal2/tpl/error' . (Front::$IS_OC2 ? '_oc2' : '') . '.tpl';
         $this->data['journal_error_title'] = 'VQMod Error';
         $this->data['journal_error_message'] = 'It seems you do not have the latest VQMod version installed. Click <a href="https://github.com/vqmod/vqmod/releases" target="_blank">here</a> to download it.';
         $this->response->setOutput($this->render());
         return;
     }
     /* check if blog is installed */
     $this->load->model('journal2/blog');
     if (!$this->model_journal2_blog->isInstalled()) {
         $this->model_journal2_blog->install();
     }
     /* get success message */
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     /* get warning message */
     if (isset($this->session->data['warning'])) {
         $this->data['warning'] = $this->session->data['warning'];
         unset($this->session->data['warning']);
     } else {
         $this->data['warning'] = '';
     }
     /* get stores */
     $this->load->model('setting/store');
     $stores = $this->model_setting_store->getStores();
     array_unshift($stores, array('store_id' => "0", 'name' => $this->config->get('config_name')));
     $this->data['journal2_config']['stores'] = $stores;
     /* get active skin */
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "journal2_config WHERE store_id = '0' AND `key` = 'active_skin'");
     $this->data['journal2_config']['active_skin'] = $query->num_rows ? $query->row['value'] : 1;
     /* get languages */
     $this->load->model('localisation/language');
     $languages = $this->model_localisation_language->getLanguages();
     $default_language = null;
     foreach ($languages as $language) {
         if ($language['language_id'] == $this->config->get('config_language_id')) {
             $default_language = $language['language_id'];
             break;
         }
     }
     $this->data['journal2_config']['languages'] = array('languages' => $languages, 'default' => $default_language);
     /* get layouts */
     $this->load->model('design/layout');
     $this->data['journal2_config']['layouts'] = $this->model_design_layout->getLayouts();
     /* img folder */
     $this->data['journal2_config']['img_folder'] = isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1') ? HTTPS_CATALOG . 'image/' : HTTP_CATALOG . 'image/';
     /* render template */
     $this->template = '../journal2/tpl/cp_index.tpl';
     $this->response->setOutput($this->render());
 }
Exemplo n.º 25
0
 /**
  * Save data
  *
  * @param   Array   $dataForms                Data form
  * @param   Array   &$return                  Return
  * @param   Array   $post                     Post form
  * @param   String  $submissionsData          Submission Data
  * @param   String  $fieldId                  Field Id
  * @param   String  $dataContentEmail         Data content Email
  * @param   Strig   $nameFileByIndentifier    Get name Field by Indentifier
  * @param   String  $requiredField            required field
  * @param   String  $fileAttach               Email File Attach
  *
  * @return boolean
  */
 private function _save($dataForms, &$return, $post, $submissionsData, $dataContentEmail, $nameFileByIndentifier, $requiredField, $fileAttach, $recepientEmail)
 {
     $user = JFactory::getUser();
     $ip = getenv('REMOTE_ADDR');
     $country = $this->countryCityFromIP($ip);
     $browser = new Browser();
     $checkSaveSubmission = true;
     $formSettings = !empty($dataForms->form_settings) ? json_decode($dataForms->form_settings) : "";
     $plgName = JSNUniformHelper::getPluginUniform();
     if (isset($plgName) && !empty($plgName)) {
         if (is_array($plgName)) {
             foreach ($plgName as $k => $v) {
                 $v = (array) $v;
                 $name = form_ . '' . $v['value'];
                 $data[$v['value']] = $formSettings->{$name};
                 $data['post'] = $post;
                 $data['sub'] = $submissionsData;
                 if ($v['value'] == 'mailchimp') {
                     if (isset($post['mailchimp_subcriber']) && $post['mailchimp_subcriber'] == 'on') {
                         JPluginHelper::importPlugin('uniform', $v['value']);
                         $dispatcher = JDispatcher::getInstance();
                         $dispatcher->trigger('saveFrontEnd', array($data));
                     }
                 }
             }
         }
     }
     if (!empty($formSettings->action_save_submissions) && $formSettings->action_save_submissions == "No") {
         $checkSaveSubmission = false;
     }
     if ($checkSaveSubmission) {
         $dateTime = JHtml::_('date', 'now', JText::_('Y-m-d H:i:s'));
         $table = JTable::getInstance('JsnSubmission', 'JSNUniformTable');
         $table->bind(array('form_id' => (int) $post['form_id'], 'user_id' => $user->id, 'submission_ip' => $ip, 'submission_country' => $country['country'], 'submission_country_code' => $country['country_code'], 'submission_browser' => $browser->getBrowser(), 'submission_browser_version' => $browser->getVersion(), 'submission_browser_agent' => $browser->getUserAgent(), 'submission_os' => $browser->getPlatform(), 'submission_created_by' => $user->id, 'submission_created_at' => $dateTime, 'submission_state' => 1));
         if (!$table->store()) {
             $return->error = $table->getError();
             return false;
         }
     }
     $this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_templates')->where("form_id = " . (int) $dataForms->form_id));
     $dataTemplates = $this->_db->loadObjectList();
     $this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_emails')->where("form_id = " . (int) $dataForms->form_id));
     $dataEmails = $this->_db->loadObjectList();
     if (count($recepientEmail)) {
         $recepientEmail = json_decode($recepientEmail);
         foreach ($recepientEmail as $recepient) {
             $recepient = explode('|', $recepient);
             $emailName = trim($recepient[0]);
             $email = trim(end($recepient));
             $dataRecepient = (object) array('email_id' => '', 'form_id' => '', 'user_id' => '0', 'email_name' => $emailName, 'email_address' => $email, 'email_state' => '1');
             $dataEmails = array_merge($dataEmails, array($dataRecepient));
         }
     }
     $formSubmitter = isset($dataForms->form_submitter) ? json_decode($dataForms->form_submitter) : '';
     $checkEmailSubmitter = true;
     $defaultSubject = isset($dataForms->form_title) ? $dataForms->form_title : '';
     if ($dataTemplates) {
         foreach ($dataTemplates as $emailTemplate) {
             if (!empty($emailTemplate->template_message)) {
                 $emailTemplate->template_message = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_message);
             } else {
                 $htmlMessage = array();
                 if ($dataContentEmail) {
                     $htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
                 }
                 $emailTemplate->template_message = $htmlMessage;
             }
             $emailTemplate->template_subject = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_subject);
             $emailTemplate->template_subject = !empty($emailTemplate->template_subject) ? $emailTemplate->template_subject : $defaultSubject;
             $emailTemplate->template_from = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_from);
             $emailTemplate->template_reply_to = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_reply_to);
             $emailTemplate->template_subject = strip_tags($emailTemplate->template_subject);
             $emailTemplate->template_from = strip_tags($emailTemplate->template_from);
             $emailTemplate->template_reply_to = strip_tags($emailTemplate->template_reply_to);
             if ($emailTemplate->template_notify_to == 0 && count($formSubmitter)) {
                 $checkEmailSubmitter = false;
                 $listEmailSubmitter = array();
                 foreach ($formSubmitter as $item) {
                     if (!empty($item)) {
                         $emailSubmitter = new stdClass();
                         $emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
                         if (!empty($emailSubmitter->email_address)) {
                             $listEmailSubmitter[] = $emailSubmitter;
                         }
                     }
                 }
                 $sent = $this->_sendEmailList($emailTemplate, $listEmailSubmitter, $fileAttach);
                 // Set the success message if it was a success
                 if (!JError::isError($sent)) {
                     $msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
                 }
             }
             if ($emailTemplate->template_notify_to == 1) {
                 $sent = $this->_sendEmailList($emailTemplate, $dataEmails, $fileAttach);
                 // Set the success message if it was a success
                 if (!JError::isError($sent)) {
                     $msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
                 }
             }
         }
     }
     if ($checkEmailSubmitter && count($formSubmitter)) {
         $emailTemplate = new stdClass();
         $htmlMessage = array();
         if ($dataContentEmail) {
             $htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
         }
         $emailTemplate->template_message = $htmlMessage;
         $listEmailSubmitter = array();
         foreach ($formSubmitter as $item) {
             if (!empty($item)) {
                 $emailSubmitter = new stdClass();
                 $emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
                 if (!empty($emailSubmitter->email_address)) {
                     $listEmailSubmitter[] = $emailSubmitter;
                 }
             }
         }
         $sent = $this->_sendEmailList($emailTemplate, $listEmailSubmitter);
         // Set the success message if it was a success
         if (!JError::isError($sent)) {
             $msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
         }
     }
     if ($checkSaveSubmission) {
         foreach ($submissionsData as $submission) {
             if (!empty($submission)) {
                 $submission['submission_id'] = $table->submission_id;
                 if ($post['use_payment_gateway'] == 1) {
                     $dispatcher = JEventDispatcher::getInstance();
                     JPluginHelper::importPlugin('uniform', (string) $dataForms->form_payment_type);
                     if ($submission['field_type'] == 'choices' || $submission['field_type'] == 'list' || $submission['field_type'] == 'dropdown' || $submission['field_type'] == 'checkboxes' || $submission['field_type'] == 'currency' || $submission['field_type'] == 'number') {
                         $fieldValue = $submission['submission_data_value'];
                         if ($submission['field_type'] == 'list' || $submission['field_type'] == 'checkboxes') {
                             $fieldValue = json_decode($fieldValue);
                             $submissionValue = array();
                             foreach ($fieldValue as $itemValue) {
                                 $tmpMoney = explode('|', $itemValue);
                                 $moneyValue = trim($tmpMoney[1]);
                                 $moneyValue = $dispatcher->trigger('displayCurrency', $moneyValue);
                                 $qty = trim(end($tmpMoney));
                                 $tmpMoney = trim($tmpMoney[0]) . ' (' . strip_tags($moneyValue[0]) . ' x ' . $qty . ')';
                                 $submissionValue[] = json_encode($tmpMoney);
                             }
                             if (!empty($submissionValue)) {
                                 $submission['submission_data_value'] = '[' . implode(',', $submissionValue) . ']';
                             }
                         } else {
                             $tmpMoney = explode('|', $fieldValue);
                             $moneyValue = trim($tmpMoney[1]);
                             if ($moneyValue != '') {
                                 $moneyValue = $dispatcher->trigger('displayCurrency', $moneyValue);
                                 $qty = trim(end($tmpMoney));
                                 $submission['submission_data_value'] = trim($tmpMoney[0]) . ' (' . strip_tags($moneyValue[0]) . ' x ' . $qty . ')';
                             } else {
                                 $submission['submission_data_value'] = $fieldValue;
                             }
                         }
                         if ($submission['field_type'] == 'currency') {
                             if (!empty($fieldValue)) {
                                 $fieldValue = str_replace(',', '.', $fieldValue);
                                 $currecyValue = $dispatcher->trigger('displayCurrency', $fieldValue);
                                 $currecyValue = strip_tags($currecyValue[0]);
                                 $submission['submission_data_value'] = $currecyValue;
                             }
                         }
                     }
                 }
                 $tableSubmission = JTable::getInstance('JsnSubmissiondata', 'JSNUniformTable');
                 $tableSubmission->bind($submission);
                 if (!$tableSubmission->store()) {
                     $return->error = $tableSubmission->getError();
                     return false;
                 }
             }
         }
         $this->_db->setQuery($this->_db->getQuery(true)->select('count(submission_id)')->from("#__jsn_uniform_submissions")->where("form_id=" . (int) $post['form_id']));
         $countSubmission = $this->_db->loadResult();
         $edition = defined('JSN_UNIFORM_EDITION') ? strtolower(JSN_UNIFORM_EDITION) : "free";
         if ($countSubmission == 250 && $edition == "free") {
             $templateEmail = new stdClass();
             $templateEmail->template_subject = $defaultSubject;
             $templateEmail->template_message = "<p>Hello there,</p>\n\t    <p>This is a quick message to let you know you're getting lots of submissions of your form which will soon exceed limit. Please upgrade to PRO edition to accept unlimited number of submissions. <a href=\"http://www.joomlashine.com/joomla-extensions/jsn-uniform-download.html\" target=\"_blank\">Upgrade now</a>.</p>\n\t    <p>Thank you and all the best,</p>\n\t    <p>The JoomlaShine Team</p>";
             $app = JFactory::getApplication();
             $mailfrom = $app->getCfg('mailfrom');
             $emailMaster = new stdClass();
             $emailMaster->email_address = $mailfrom;
             $this->_sendEmailList($templateEmail, array($emailMaster));
         }
         $table = JTable::getInstance('JsnForm', 'JSNUniformTable');
         $table->bind(array('form_id' => (int) $post['form_id'], 'form_last_submitted' => date('Y-m-d H:i:s'), 'form_submission_cout' => $countSubmission));
         if (!$table->store()) {
             $return->error = $table->getError();
             return false;
         }
     }
     if (!empty($_SESSION['securimage_code_value'][$_POST['form_name']])) {
         unset($_SESSION['securimage_code_value'][$_POST['form_name']]);
         unset($_SESSION['securimage_code_disp'][$_POST['form_name']]);
         unset($_SESSION['securimage_code_ctime'][$_POST['form_name']]);
     }
     return true;
 }
 function __validateBrowser()
 {
     App::import('Vendor', 'Install.browser');
     $browser = new Browser();
     if ($browser->getBrowser() == Browser::BROWSER_CHROME && $browser->getVersion() >= 5) {
         $results['message'] = $this->appLicationName . ' dan instalasi ' . $this->appLicationName . ' berjalan sempurna di chrome 5.0 atau lebih.';
         $results['status'] = 1;
     } else {
         $results['message'] = $this->appLicationName . ' dan instalasi ' . $this->appLicationName . ' membutuhkan chrome versi 5 atau lebih, silahkan install terlebih dahulu';
         $results['status'] = 0;
     }
     return $results;
 }
Exemplo n.º 27
0
 public function signature_input($input, $field, $value, $lead_id, $form_id)
 {
     if ($field['type'] != 'signature') {
         return $input;
     }
     $unique_id = IS_ADMIN || $form_id == 0 ? "input_{$field['id']}" : 'input_' . $form_id . "_{$field['id']}";
     $supports_canvas = true;
     require_once 'super_signature/Browser.php';
     $browser = new Browser();
     if ($browser->getBrowser() == Browser::BROWSER_IE) {
         $supports_canvas = $browser->getVersion() >= 9;
     }
     $bgcolor = rgempty('backgroundColor', $field) ? '#FFFFFF' : rgar($field, 'backgroundColor');
     $bordercolor = rgempty('borderColor', $field) ? '#DDDDDD' : rgar($field, 'borderColor');
     $pencolor = rgempty('penColor', $field) ? '#000000' : rgar($field, 'penColor');
     $boxwidth = rgblank(rgget('boxWidth', $field)) ? '300' : rgar($field, 'boxWidth');
     $borderstyle = rgempty('borderStyle', $field) ? 'Dashed' : rgar($field, 'borderStyle');
     $borderwidth = rgblank(rgget('borderWidth', $field)) ? '2' : rgar($field, 'borderWidth');
     $pensize = rgblank(rgget('penSize', $field)) ? '2' : rgar($field, 'penSize');
     if (RG_CURRENT_VIEW != 'entry' && is_admin()) {
         //box width is hardcoded in the admin
         $input = '<style>' . ".top_label .gf_signature_container {width: 460px;} " . ".left_label .gf_signature_container, .right_label .gf_signature_container {width: 300px;} " . "</style>" . "<div style='display:-moz-inline-stack; display: inline-block; zoom: 1; *display: inline;'><div class='gf_signature_container' style='height:180px; border: {$borderwidth}px {$borderstyle} {$bordercolor}; background-color:{$bgcolor};'></div></div>";
         // if frontend OR entry detail
     } else {
         $input = '';
         if (RG_CURRENT_VIEW == 'entry') {
             //include super signature script when viewing the entry in the admin
             $input = "<script src='" . $this->get_base_url() . '/super_signature/ss.js?ver=' . $this->_version . "' type='text/javascript'></script>";
         }
         $signature_filename = !empty($value) ? $value : rgpost("{$unique_id}_signature_filename");
         if (!empty($signature_filename)) {
             $input .= "<div id='{$unique_id}_signature_image'>" . "<img src='" . $this->get_signature_url($signature_filename) . "' width='{$boxwidth}px'/>" . "   <div>";
             if (RG_CURRENT_VIEW == 'entry' && $value) {
                 //include the links to download/delete image
                 $input .= "       <a href='" . $this->get_signature_url($signature_filename) . "' target='_blank' alt='" . __('Download file', 'gravityformssignature') . "' title='" . __('Download file', 'gravityformssignature') . "'><img src='" . GFCommon::get_base_url() . '/images/download.png' . "' /></a>" . "       <a href='javascript:void(0);' alt='" . __('Delete file', 'gravityformssignature') . "' title='" . __('Delete file', 'gravityformssignature') . "' onclick='deleteSignature(" . $lead_id . ', ' . $field['id'] . ");' ><img src='" . GFCommon::get_base_url() . '/images/delete.png' . "' style='margin-left:8px;'/></a>";
             } else {
                 $input .= "       <a href='#' onclick='jQuery(\"#{$unique_id}_signature_filename\").val(\"\"); jQuery(\"#{$unique_id}_signature_image\").hide(); jQuery(\"#{$unique_id}_Container\").show(); jQuery(\"#{$unique_id}_resetbutton\").show(); return false;'>" . __('sign again', 'gravityformssignature') . '</a>';
             }
             $input .= '   </div>' . "</div>" . "<input type='hidden' value='{$signature_filename}' name='{$unique_id}_signature_filename' id='{$unique_id}_signature_filename'/>" . "<style type='text/css'>#{$unique_id}_resetbutton {display:none}</style>";
         }
         $display = !empty($signature_filename) ? 'display:none;' : '';
         $form = RGFormsModel::get_form_meta($form_id);
         $container_style = $form['labelPlacement'] == 'top_label' ? '' : "style='display:-moz-inline-stack; display: inline-block; zoom: 1; *display: inline;'";
         $input .= "<div {$container_style}>\n\t\t\t\t\t<div id='{$unique_id}_Container' style='height:180px; width: {$boxwidth}px; {$display}' >\n\t\t\t\t\t\t<input type='hidden' class='gform_hidden' name='{$unique_id}_valid' id='{$unique_id}_valid' />";
         if ($supports_canvas) {
             $input .= "<canvas id='{$unique_id}' width='{$boxwidth}' height='180'></canvas>";
         } else {
             $input .= "<div id='{$unique_id}' style='width:{$boxwidth}px; height:180px; border:{$borderstyle} {$borderwidth}px {$bordercolor}; background-color:{$bgcolor};'></div>";
         }
         $input .= "\n\t\t\t\t\t</div>\n\t\t\t\t  </div>\n\t\t\t\t  <script type='text/javascript'>" . "if(typeof SuperSignature != 'undefined'){" . "var obj{$unique_id} = new SuperSignature({IeModalFix: false, SignObject:'{$unique_id}',BackColor: '{$bgcolor}', PenSize: '{$pensize}', PenColor: '{$pencolor}',SignWidth: '{$boxwidth}',SignHeight: '180' ,BorderStyle:'{$borderstyle}',BorderWidth: '{$borderwidth}px',BorderColor: '{$bordercolor}', RequiredPoints: '15',ClearImage:'" . $this->get_base_url() . "/super_signature/refresh.png', PenCursor:'" . $this->get_base_url() . "/super_signature/pen.cur', Visible: 'true', ErrorMessage: '', StartMessage: '', SuccessMessage: ''});" . "obj{$unique_id}.Init();" . "jQuery('#gform_{$form_id}').submit(function(){" . "       jQuery('#{$unique_id}_valid').val(obj{$unique_id}.IsValid() || jQuery('#{$unique_id}_signature_filename').val() ? '1' : '');" . "});" . "}" . "</script>";
     }
     return $input;
 }
Exemplo n.º 28
0
 /**
  * Save data
  *
  * @param   Array   $dataForms                Data form
  * @param   Array   &$return                  Return
  * @param   Array   $post                     Post form
  * @param   String  $submissionsData          Submission Data
  * @param   String  $fieldId                  Field Id
  * @param   String  $dataContentEmail         Data content Email
  * @param   Strig   $nameFileByIndentifier    Get name Field by Indentifier
  * @param   String  $requiredField            required field
  * @param   String  $fileAttach               Email File Attach
  *
  * @return boolean
  */
 private function _save($dataForms, &$return, $post, $submissionsData, $dataContentEmail, $nameFileByIndentifier, $requiredField, $fileAttach)
 {
     $user = JFactory::getUser();
     $ip = getenv('REMOTE_ADDR');
     $country = $this->countryCityFromIP($ip);
     $browser = new Browser();
     $checkSaveSubmission = true;
     $formSettings = !empty($dataForms->form_settings) ? json_decode($dataForms->form_settings) : "";
     if (!empty($formSettings->action_save_submissions) && $formSettings->action_save_submissions == "No") {
         $checkSaveSubmission = false;
     }
     if ($checkSaveSubmission) {
         $table = JTable::getInstance('Submission', 'JSNUniformTable');
         $table->bind(array('form_id' => (int) $post['form_id'], 'user_id' => $user->id, 'submission_ip' => $ip, 'submission_country' => $country['country'], 'submission_country_code' => $country['country_code'], 'submission_browser' => $browser->getBrowser(), 'submission_browser_version' => $browser->getVersion(), 'submission_browser_agent' => $browser->getUserAgent(), 'submission_os' => $browser->getPlatform(), 'submission_created_by' => $user->id, 'submission_created_at' => date('Y-m-d H:i:s'), 'submission_state' => 1));
         if (!$table->store()) {
             $return->error = $table->getError();
             return false;
         }
     }
     $this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_templates')->where("form_id = " . (int) $dataForms->form_id));
     $dataTemplates = $this->_db->loadObjectList();
     $this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_emails')->where("form_id = " . (int) $dataForms->form_id));
     $dataEmails = $this->_db->loadObjectList();
     $formSubmitter = isset($dataForms->form_submitter) ? json_decode($dataForms->form_submitter) : '';
     $checkEmailSubmitter = true;
     $defaultSubject = isset($dataForms->form_title) ? $dataForms->form_title . " [" . $dataForms->form_id . "]" : '';
     if ($dataTemplates) {
         foreach ($dataTemplates as $emailTemplate) {
             if (!empty($emailTemplate->template_message)) {
                 $emailTemplate->template_message = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_message);
             } else {
                 $htmlMessage = array();
                 if ($dataContentEmail) {
                     $htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
                 }
                 $emailTemplate->template_message = $htmlMessage;
             }
             $emailTemplate->template_subject = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_subject);
             $emailTemplate->template_subject = !empty($emailTemplate->template_subject) ? $emailTemplate->template_subject : $defaultSubject;
             $emailTemplate->template_from = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_from);
             $emailTemplate->template_reply_to = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_reply_to);
             $emailTemplate->template_subject = strip_tags($emailTemplate->template_subject);
             $emailTemplate->template_from = strip_tags($emailTemplate->template_from);
             $emailTemplate->template_reply_to = strip_tags($emailTemplate->template_reply_to);
             if ($emailTemplate->template_notify_to == 0 && count($formSubmitter)) {
                 $checkEmailSubmitter = false;
                 $listEmailSubmitter = array();
                 foreach ($formSubmitter as $item) {
                     if (!empty($item)) {
                         $emailSubmitter = new stdClass();
                         $emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
                         if (!empty($emailSubmitter->email_address)) {
                             $listEmailSubmitter[] = $emailSubmitter;
                         }
                     }
                 }
                 $sent = $this->_sendEmailList($emailTemplate, $listEmailSubmitter, $fileAttach);
                 // Set the success message if it was a success
                 if (!JError::isError($sent)) {
                     $msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
                 }
             }
             if ($emailTemplate->template_notify_to == 1) {
                 $sent = $this->_sendEmailList($emailTemplate, $dataEmails, $fileAttach);
                 // Set the success message if it was a success
                 if (!JError::isError($sent)) {
                     $msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
                 }
             }
         }
     }
     if ($checkEmailSubmitter && count($formSubmitter)) {
         $emailTemplate = new stdClass();
         $htmlMessage = array();
         if ($dataContentEmail) {
             $htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
         }
         $emailTemplate->template_message = $htmlMessage;
         $listEmailSubmitter = array();
         foreach ($formSubmitter as $item) {
             if (!empty($item)) {
                 $emailSubmitter = new stdClass();
                 $emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
                 if (!empty($emailSubmitter->email_address)) {
                     $listEmailSubmitter[] = $emailSubmitter;
                 }
             }
         }
         $sent = $this->_sendEmailList($emailTemplate, $listEmailSubmitter);
         // Set the success message if it was a success
         if (!JError::isError($sent)) {
             $msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
         }
     }
     if ($checkSaveSubmission) {
         foreach ($submissionsData as $submission) {
             if (!empty($submission)) {
                 $submission['submission_id'] = $table->submission_id;
                 $tableSubmission = JTable::getInstance('Submissiondata', 'JSNUniformTable');
                 $tableSubmission->bind($submission);
                 if (!$tableSubmission->store()) {
                     $return->error = $tableSubmission->getError();
                     return false;
                 }
             }
         }
         $this->_db->setQuery($this->_db->getQuery(true)->select('count(submission_id)')->from("#__jsn_uniform_submissions")->where("form_id=" . (int) $post['form_id']));
         $countSubmission = $this->_db->loadResult();
         $edition = defined('JSN_UNIFORM_EDITION') ? strtolower(JSN_UNIFORM_EDITION) : "free";
         if ($countSubmission == 250 && $edition == "free") {
             $templateEmail = new stdClass();
             $templateEmail->template_subject = $defaultSubject;
             $templateEmail->template_message = "<p>Hello there,</p>\n\t    <p>This is a quick message to let you know you're getting lots of submissions of your form which will soon exceed limit. Please upgrade to PRO edition to accept unlimited number of submissions. <a href=\"http://www.joomlashine.com/joomla-extensions/jsn-uniform-download.html\" target=\"_blank\">Upgrade now</a>.</p>\n\t    <p>Thank you and all the best,</p>\n\t    <p>The JoomlaShine Team</p>";
             $app = JFactory::getApplication();
             $mailfrom = $app->getCfg('mailfrom');
             $emailMaster = new stdClass();
             $emailMaster->email_address = $mailfrom;
             $this->_sendEmailList($templateEmail, array($emailMaster));
         }
         $table = JTable::getInstance('Form', 'JSNUniformTable');
         $table->bind(array('form_id' => (int) $post['form_id'], 'form_last_submitted' => date('Y-m-d H:i:s'), 'form_submission_cout' => $countSubmission));
         if (!$table->store()) {
             $return->error = $table->getError();
             return false;
         }
     }
     if (!empty($_SESSION['securimage_code_value'][$_POST['form_name']])) {
         unset($_SESSION['securimage_code_value'][$_POST['form_name']]);
         unset($_SESSION['securimage_code_disp'][$_POST['form_name']]);
         unset($_SESSION['securimage_code_ctime'][$_POST['form_name']]);
     }
     return true;
 }
Exemplo n.º 29
0
 public static function compileSystemStatus($json_output = false, $remote_checks = false)
 {
     global $wpdb;
     $sysinfo = array();
     $sysinfo['home_url'] = home_url();
     $sysinfo['site_url'] = site_url();
     $sysinfo['redux_ver'] = esc_html(ReduxFramework::$_version);
     $sysinfo['redux_data_dir'] = ReduxFramework::$_upload_dir;
     $f = 'fo' . 'pen';
     // Only is a file-write check
     $sysinfo['redux_data_writeable'] = self::makeBoolStr(@$f(ReduxFramework::$_upload_dir . 'test-log.log', 'a'));
     $sysinfo['wp_content_url'] = WP_CONTENT_URL;
     $sysinfo['wp_ver'] = get_bloginfo('version');
     $sysinfo['wp_multisite'] = is_multisite();
     $sysinfo['permalink_structure'] = get_option('permalink_structure') ? get_option('permalink_structure') : 'Default';
     $sysinfo['front_page_display'] = get_option('show_on_front');
     if ($sysinfo['front_page_display'] == 'page') {
         $front_page_id = get_option('page_on_front');
         $blog_page_id = get_option('page_for_posts');
         $sysinfo['front_page'] = $front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset';
         $sysinfo['posts_page'] = $blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset';
     }
     $sysinfo['wp_mem_limit']['raw'] = self::let_to_num(WP_MEMORY_LIMIT);
     $sysinfo['wp_mem_limit']['size'] = size_format($sysinfo['wp_mem_limit']['raw']);
     $sysinfo['db_table_prefix'] = 'Length: ' . strlen($wpdb->prefix) . ' - Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable');
     $sysinfo['wp_debug'] = 'false';
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $sysinfo['wp_debug'] = 'true';
     }
     $sysinfo['wp_lang'] = get_locale();
     if (!class_exists('Browser')) {
         require_once ReduxFramework::$_dir . 'inc/browser.php';
     }
     $browser = new Browser();
     $sysinfo['browser'] = array('agent' => $browser->getUserAgent(), 'browser' => $browser->getBrowser(), 'version' => $browser->getVersion(), 'platform' => $browser->getPlatform());
     $sysinfo['server_info'] = esc_html($_SERVER['SERVER_SOFTWARE']);
     $sysinfo['localhost'] = self::makeBoolStr(self::isLocalHost());
     $sysinfo['php_ver'] = function_exists('phpversion') ? esc_html(phpversion()) : 'phpversion() function does not exist.';
     $sysinfo['abspath'] = ABSPATH;
     if (function_exists('ini_get')) {
         $sysinfo['php_mem_limit'] = size_format(self::let_to_num(ini_get('memory_limit')));
         $sysinfo['php_post_max_size'] = size_format(self::let_to_num(ini_get('post_max_size')));
         $sysinfo['php_time_limit'] = ini_get('max_execution_time');
         $sysinfo['php_max_input_var'] = ini_get('max_input_vars');
         $sysinfo['php_display_errors'] = self::makeBoolStr(ini_get('display_errors'));
     }
     $sysinfo['suhosin_installed'] = extension_loaded('suhosin');
     $sysinfo['mysql_ver'] = $wpdb->db_version();
     $sysinfo['max_upload_size'] = size_format(wp_max_upload_size());
     $sysinfo['def_tz_is_utc'] = 'true';
     if (date_default_timezone_get() !== 'UTC') {
         $sysinfo['def_tz_is_utc'] = 'false';
     }
     $sysinfo['fsockopen_curl'] = 'false';
     if (function_exists('fsockopen') || function_exists('curl_init')) {
         $sysinfo['fsockopen_curl'] = 'true';
     }
     //$sysinfo['soap_client'] = 'false';
     //if ( class_exists( 'SoapClient' ) ) {
     //    $sysinfo['soap_client'] = 'true';
     //}
     //
     //$sysinfo['dom_document'] = 'false';
     //if ( class_exists( 'DOMDocument' ) ) {
     //    $sysinfo['dom_document'] = 'true';
     //}
     //$sysinfo['gzip'] = 'false';
     //if ( is_callable( 'gzopen' ) ) {
     //    $sysinfo['gzip'] = 'true';
     //}
     if ($remote_checks == true) {
         $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'ReduxFramework/' . ReduxFramework::$_version, 'body' => array('cmd' => '_notify-validate')));
         if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
             $sysinfo['wp_remote_post'] = 'true';
             $sysinfo['wp_remote_post_error'] = '';
         } else {
             $sysinfo['wp_remote_post'] = 'false';
             $sysinfo['wp_remote_post_error'] = $response->get_error_message();
         }
         $response = wp_remote_get('http://reduxframework.com/wp-admin/admin-ajax.php?action=get_redux_extensions');
         if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
             $sysinfo['wp_remote_get'] = 'true';
             $sysinfo['wp_remote_get_error'] = '';
         } else {
             $sysinfo['wp_remote_get'] = 'false';
             $sysinfo['wp_remote_get_error'] = $response->get_error_message();
         }
     }
     $active_plugins = (array) get_option('active_plugins', array());
     if (is_multisite()) {
         $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
     }
     $sysinfo['plugins'] = array();
     foreach ($active_plugins as $plugin) {
         $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
         $plugin_name = esc_html($plugin_data['Name']);
         $sysinfo['plugins'][$plugin_name] = $plugin_data;
     }
     $redux = ReduxFrameworkInstances::get_all_instances();
     $sysinfo['redux_instances'] = array();
     if (!empty($redux) && is_array($redux)) {
         foreach ($redux as $inst => $data) {
             Redux::init($inst);
             $sysinfo['redux_instances'][$inst]['args'] = $data->args;
             $sysinfo['redux_instances'][$inst]['sections'] = $data->sections;
             foreach ($sysinfo['redux_instances'][$inst]['sections'] as $sKey => $section) {
                 if (isset($section['fields']) && is_array($section['fields'])) {
                     foreach ($section['fields'] as $fKey => $field) {
                         if (isset($field['validate_callback'])) {
                             unset($sysinfo['redux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['validate_callback']);
                         }
                         if ($field['type'] == "js_button") {
                             if (isset($field['script']) && isset($field['script']['ver'])) {
                                 unset($sysinfo['redux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['script']['ver']);
                             }
                         }
                     }
                 }
             }
             $sysinfo['redux_instances'][$inst]['extensions'] = Redux::getExtensions($inst);
             if (isset($data->extensions['metaboxes'])) {
                 $data->extensions['metaboxes']->init();
                 $sysinfo['redux_instances'][$inst]['metaboxes'] = $data->extensions['metaboxes']->boxes;
             }
             if (isset($data->args['templates_path']) && $data->args['templates_path'] != '') {
                 $sysinfo['redux_instances'][$inst]['templates'] = self::getReduxTemplates($data->args['templates_path']);
             }
         }
     }
     $active_theme = wp_get_theme();
     $sysinfo['theme']['name'] = $active_theme->Name;
     $sysinfo['theme']['version'] = $active_theme->Version;
     $sysinfo['theme']['author_uri'] = $active_theme->{'Author URI'};
     $sysinfo['theme']['is_child'] = self::makeBoolStr(is_child_theme());
     if (is_child_theme()) {
         $parent_theme = wp_get_theme($active_theme->Template);
         $sysinfo['theme']['parent_name'] = $parent_theme->Name;
         $sysinfo['theme']['parent_version'] = $parent_theme->Version;
         $sysinfo['theme']['parent_author_uri'] = $parent_theme->{'Author URI'};
     }
     //if ( $json_output ) {
     //    $sysinfo = json_encode( $sysinfo );
     //}
     //print_r($sysinfo);
     //exit();
     return $sysinfo;
 }
Exemplo n.º 30
0
 public static function isOldIE()
 {
     $browser = new Browser();
     if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 10) {
         return true;
     } else {
         return false;
     }
 }