getPlatform() public method

The name of the platform. All return types are from the class contants
public getPlatform ( ) : string
return string Name of the browser
Exemplo n.º 1
0
 public function run()
 {
     Yii::import('app.addons.Browser');
     $browser = new Browser();
     if ($browser->getBrowser() == Browser::BROWSER_FIREFOX) {
         $browserIcon = 'flaticon-firefox';
     } elseif ($browser->getBrowser() == Browser::BROWSER_SAFARI) {
         $browserIcon = 'flaticon-safari';
     } elseif ($browser->getBrowser() == Browser::BROWSER_OPERA) {
         $browserIcon = 'flaticon-opera';
     } elseif ($browser->getBrowser() == Browser::BROWSER_CHROME) {
         $browserIcon = 'flaticon-chrome';
     } elseif ($browser->getBrowser() == Browser::BROWSER_IE) {
         $browserIcon = 'flaticon-explorer';
     }
     if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
         $platformIcon = 'flaticon-windows';
     } elseif ($browser->getPlatform() == Browser::PLATFORM_WINDOWS_8) {
         //no tested
         $platformIcon = 'flaticon-windows8';
     } elseif ($browser->getPlatform() == Browser::PLATFORM_ANDROID) {
         $platformIcon = 'flaticon-android';
     } elseif ($browser->getPlatform() == Browser::PLATFORM_LINUX) {
         $platformIcon = 'flaticon-linux';
     } elseif ($browser->getPlatform() == Browser::PLATFORM_APPLE) {
         $platformIcon = 'flaticon-apple ';
     }
     $this->render($this->skin, array('platformIcon' => $platformIcon, 'browserIcon' => $browserIcon, 'browser' => $browser));
 }
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 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 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.');
         }
     }
 }
Exemplo n.º 5
0
 public function action_index()
 {
     if (!function_exists('imagetypes')) {
         die("ERROR: GD LIB IS NOT LOADED!");
     }
     //header("Content-type: image/png");
     $this->response->headers('Content-type', 'image/png');
     /*=================*/
     $im = @imagecreatefrompng(APPPATH . "cover.png");
     //读取图片名
     $color = imagecolorallocate($im, 183, 150, 37);
     //文字颜色
     $client_address = $_SERVER["REMOTE_ADDR"];
     //$user_agent = $_SERVER['HTTP_USER_AGENT'];
     //$client_system = $this->_get_system($user_agent);
     //$client_browser = $this->_get_browser($user_agent);
     $browser = new Browser();
     $client_system = $browser->getPlatform();
     $client_browser = $browser->getBrowser();
     imagestring($im, 3, 125, 44, "[ From {$client_address} / {$client_system} / {$client_browser} ]", $color);
     //($im,字大小,左右,上下)
     imagepng($im);
     imagedestroy($im);
     //$this->response->body('');
 }
 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.º 7
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.º 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
 public function set($message, $params = array())
 {
     $browser = new Browser();
     $model = new Timeline();
     $model->user_id = Yii::app()->user->id;
     $model->message = Yii::t('timeline', $message, $params);
     $model->user_agent = $browser->getUserAgent();
     $model->ip = CMS::getip();
     $model->user_platform = $browser->getPlatform();
     $model->save(false, false, false);
 }
Exemplo n.º 11
0
     $level_txt = '<strong>' . $lang_global['level2'] . '</strong>';
 } else {
     $array_mod = array();
     foreach ($list_modules as $row_mod) {
         if (!empty($row_mod['admins']) and in_array($row['admin_id'], explode(',', $row_mod['admins']))) {
             $array_mod[] = $row_mod['custom_title'];
         }
     }
     $level_txt = implode(', ', $array_mod);
 }
 $last_login = intval($row['last_login']);
 $last_login = $last_login ? nv_date('l, d/m/Y H:i', $last_login) : $lang_module['last_login0'];
 $last_agent = $row['last_agent'];
 $_browser = new Browser($last_agent);
 $browser = array('key' => $_browser->getBrowserKey(), 'name' => $_browser->getBrowser());
 $os = array('key' => $_browser->getPlatformKey(), 'name' => $_browser->getPlatform());
 $is_suspend = intval($row['is_suspend']);
 if (empty($is_suspend)) {
     $is_suspend = $lang_module['is_suspend0'];
 } else {
     $last_reason = unserialize($row['susp_reason']);
     $last_reason = array_shift($last_reason);
     list($susp_admin_id, $susp_admin_name) = $db->query('SELECT userid,first_name,last_name FROM ' . NV_USERS_GLOBALTABLE . ' WHERE userid=' . intval($last_reason['start_admin']))->fetch(3);
     $susp_admin_name = "<a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;id=" . $susp_admin_id . "\">" . $susp_admin_name . "</a>";
     $is_suspend = sprintf($lang_module['is_suspend1'], nv_date('d/m/Y H:i', $last_reason['starttime']), $susp_admin_name, $last_reason['info']);
 }
 $thead = array();
 $thead['level'] = $level;
 if (defined('NV_IS_GODADMIN')) {
     $thead['edit'] = 1;
     $thead['chg_is_suspend'] = $row['admin_id'] != $admin_info['admin_id'] ? 1 : 0;
Exemplo n.º 12
0
 public static function isMobile($profile = 'mobile')
 {
     global $CFG;
     if ($profile == 'never') {
         return false;
     }
     if ($profile == 'always') {
         return true;
     }
     $browser = new Browser();
     //check by browser
     switch ($browser->getBrowser()) {
         case Browser::BROWSER_IPAD:
         case Browser::BROWSER_IPOD:
         case Browser::BROWSER_IPHONE:
         case Browser::BROWSER_ANDROID:
         case Browser::BROWSER_WINDOWS_PHONE:
             return true;
     }
     //check by platform
     switch ($browser->getPlatform()) {
         case Browser::PLATFORM_IPHONE:
         case Browser::PLATFORM_IPOD:
         case Browser::PLATFORM_IPAD:
         case Browser::PLATFORM_BLACKBERRY:
         case Browser::PLATFORM_NOKIA:
         case Browser::PLATFORM_ANDROID:
         case Browser::PLATFORM_WINDOWS_CE:
         case Browser::PLATFORM_WINDOWS_PHONE:
             //case Browser::PLATFORM_MICROSOFT_SURFACE:
             return true;
     }
     //end of switch
     //if we are still not mobile, but webkit browwsers count, check that too
     if ($profile == 'webkit') {
         switch ($browser->getBrowser()) {
             case Browser::BROWSER_SAFARI:
             case Browser::BROWSER_ICAB:
             case Browser::BROWSER_OMNIWEB:
             case Browser::BROWSER_NOKIA_S60:
             case Browser::BROWSER_CHROME:
                 return true;
         }
     }
     return false;
 }
Exemplo n.º 13
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;
 }
 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.º 15
0
     //Headers
     foreach ($column_names as $col) {
         $array[0][] = $col;
     }
     foreach ($result as $row) {
         foreach ($columns as $col) {
             $array[$j][] = strip_tags($row[$col]);
         }
         $j++;
     }
     switch ($exportFormat) {
         case 'xls':
             //TODO add date if exists
             $file_name = !empty($action) ? $action : 'company_report';
             $browser = new Browser();
             if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
                 Export::export_table_xls_html($array, $file_name, 'ISO-8859-15');
             } else {
                 Export::export_table_xls_html($array, $file_name);
             }
             break;
         case 'csv':
         default:
             //TODO add date if exists
             $file_name = !empty($action) ? $action : 'company_report';
             Export::arrayToCsv($array, $file_name);
             break;
     }
     exit;
 }
 $i = 0;
Exemplo n.º 16
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.º 17
0
 //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'];
         $target_id = $ra['target_id'];
         $link = $ra['link'];
Exemplo n.º 18
0
 /**
  * Returns the used platform.
  * 
  * @param	string		$userAgent
  * @return	string
  */
 public static function getPlatform($userAgent = '')
 {
     require_once CMS_DIR . 'lib/util/Browser.php';
     $browser = new \Browser($userAgent);
     return $browser->getPlatform();
 }
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;
 }
Exemplo n.º 20
0
}
// verify
if (!isset($cache_id)) {
    exit;
}
/* client browser stats ----------------------------------------------------- */
$browser = new Browser();
// save browser id
$bname = db_select(TBL_PREFIX . TBL_BROWSERS, "id", "name='" . $browser->getBrowser() . "'");
if (!$bname) {
    $browserid = db_insert(TBL_PREFIX . TBL_BROWSERS, "name", "'" . $browser->getBrowser() . "'");
} else {
    $browserid = $bname['id'];
}
// save OS id
$osname = db_select(TBL_PREFIX . TBL_OS, "id", "name='" . $browser->getPlatform() . "'");
if (!$osname) {
    $osid = db_insert(TBL_PREFIX . TBL_OS, "name", "'" . $browser->getPlatform() . "'");
} else {
    $osid = $osname['id'];
}
// save domain id
$domain = url_get_domain($URL);
$d = db_select(TBL_PREFIX . TBL_DOMAINS, "id", "domain='" . $domain . "'");
if (!$d) {
    $did = db_insert(TBL_PREFIX . TBL_DOMAINS, "domain", "'" . $domain . "'");
} else {
    $did = $d['id'];
}
/* create database entry ---------------------------------------------------- */
$fields = "client_id,cache_id,domain_id,os_id,browser_id,browser_ver,user_agent,";
Exemplo n.º 21
0
 private function _checkCompatibility()
 {
     // Compatibility
     $browser = new Browser();
     // Android Chrome
     if ($browser->getPlatform() == Browser::PLATFORM_ANDROID) {
         return true;
     }
     // iPhone
     if ($browser->getPlatform() == Browser::PLATFORM_IPHONE && $browser->getBrowser() == Browser::BROWSER_IPHONE) {
         return true;
     }
     // iPad
     if ($browser->getPlatform() == Browser::PLATFORM_IPAD && $browser->getBrowser() == Browser::BROWSER_IPAD) {
         return true;
     }
     // iPod
     if ($browser->getPlatform() == Browser::PLATFORM_IPOD && $browser->getBrowser() == Browser::BROWSER_IPOD) {
         return true;
     }
     // iPhone Chrome
     if ($browser->getPlatform() == Browser::PLATFORM_IPHONE && $browser->getBrowser() == Browser::BROWSER_CHROME) {
         return true;
     }
     // iPad Chrome
     if ($browser->getPlatform() == Browser::PLATFORM_IPAD && $browser->getBrowser() == Browser::BROWSER_CHROME) {
         return true;
     }
     // iPod Chrome
     if ($browser->getPlatform() == Browser::PLATFORM_IPOD && $browser->getBrowser() == Browser::BROWSER_CHROME) {
         return true;
     }
     // iPhone Safari
     if ($browser->getPlatform() == Browser::PLATFORM_IPHONE && $browser->getBrowser() == Browser::BROWSER_SAFARI) {
         return true;
     }
     // iPad Safari
     if ($browser->getPlatform() == Browser::PLATFORM_IPAD && $browser->getBrowser() == Browser::BROWSER_SAFARI) {
         return true;
     }
     // iPod Safari
     if ($browser->getPlatform() == Browser::PLATFORM_IPOD && $browser->getBrowser() == Browser::BROWSER_SAFARI) {
         return true;
     }
     // MacOSX Chrome
     if ($browser->getPlatform() == Browser::PLATFORM_APPLE && $browser->getBrowser() == Browser::BROWSER_CHROME) {
         return true;
     }
     // MacOSX Firefox
     if ($browser->getPlatform() == Browser::PLATFORM_APPLE && $browser->getBrowser() == Browser::BROWSER_FIREFOX) {
         return true;
     }
     // MacOSX Opera
     if ($browser->getPlatform() == Browser::PLATFORM_APPLE && $browser->getBrowser() == Browser::BROWSER_OPERA) {
         return true;
     }
     // MacOSX Safari
     if ($browser->getPlatform() == Browser::PLATFORM_APPLE && $browser->getBrowser() == Browser::BROWSER_SAFARI) {
         return true;
     }
     // Windows Chrome
     if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS && $browser->getBrowser() == Browser::BROWSER_CHROME) {
         return true;
     }
     // Windows Firefox
     if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS && $browser->getBrowser() == Browser::BROWSER_FIREFOX) {
         return true;
     }
     // Windows IE
     if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS && $browser->getBrowser() == Browser::BROWSER_IE) {
         return true;
     }
     // Windows Opera
     if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS && $browser->getBrowser() == Browser::BROWSER_OPERA) {
         return true;
     }
     // Linux Firefox
     if ($browser->getPlatform() == Browser::PLATFORM_LINUX) {
         return true;
     }
     return false;
 }
    $ptyql = "SELECT * FROM {$assign} WHERE `post_type`='{$posttype}' AND `template`='" . THEME_CODE . "'";
    $pfetch = $wpdb->get_row($ptyql, ARRAY_A);
    $layout = layoutValid($pfetch["layout_id"]);
}
if (!$layout) {
    //none found go with default
    $ttable = $wpdb->prefix . 'ultimatum_themes';
    $sql = "SELECT * FROM {$ttable} WHERE published=1 AND `template`='" . THEME_CODE . "'";
    $theme = $wpdb->get_row($sql, ARRAY_A);
    $defql = "SELECT * FROM {$table} WHERE `default`=1 AND `theme`='" . $theme["id"] . "'";
    $dfetch = $wpdb->get_row($defql, ARRAY_A);
    $layout = layoutValid($dfetch["id"]);
}
require_once THEME_DIR . '/helpers/Browser.php';
$browser = new Browser();
$browsing = $browser->getPlatform();
// Mobile Template codes come here
// Stop Cheating!! Layout is found but the layout does not exixst!
function layoutValid($id)
{
    global $wpdb;
    $table = $wpdb->prefix . 'ultimatum_layout';
    $query = "SELECT * FROM {$table} WHERE id='{$id}' AND type='full'";
    $fetch = $wpdb->get_row($query, ARRAY_A);
    if ($fetch) {
        return $fetch;
    } else {
        return false;
    }
}
if (function_exists('ult_ms_getter')) {
Exemplo n.º 23
0
 /**
  * Detect mobile device
  *
  * @return mixed   Mobile device name or false
  */
 public static function mobile_device_detect()
 {
     $ui = T3Parameter::_getParam('ui');
     if ($ui == 'desktop') {
         return false;
     }
     // Detect mobile
     if (!class_exists('Browser')) {
         t3import('core.libs.browser');
     }
     $browser = new Browser();
     // Bypass
     if ($browser->isRobot()) {
         return false;
     }
     // Consider ipad as normal browser
     if ($browser->getBrowser() == Browser::BROWSER_IPAD) {
         return false;
     }
     // Mobile
     if ($browser->isMobile()) {
         if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) {
             $device = 'iphone';
         } elseif ($browser->getPlatform() == Browser::PLATFORM_ANDROID) {
             $device = 'android';
         } else {
             //$device = strtolower($browser->getBrowser());
             $device = 'handheld';
         }
         $layout = T3Parameter::_getParam($device . "_layout", '');
         if ($layout == -1) {
             return false;
         }
         //disable
         return $device;
         //return 'handheld';
     }
     // Not mobile
     if ($ui == 'mobile') {
         return 'iphone';
     }
     //default for mobile layout on desktop
     return false;
 }
Exemplo n.º 24
0
<?php

//Menu Activation functions
include 'includes/db.php';
include 'includes/lib.php';
include 'includes/Browser.php';
// Browser detection
$browser = new Browser();
$browsername = $browser->getBrowser();
$browserversion = $browser->getVersion();
$browserplatform = $browser->getPlatform();
//Current folder and php script name
$cfolder = curPageFolder();
$scriptname = $_SERVER["SCRIPT_NAME"];
$phpname = substr($scriptname, strripos($scriptname, "/") + 1, strlen($scriptname) - strripos($scriptname, "/") - 1);
function curPageFolder()
{
    $path = curPageURL();
    $last = strripos($path, "/");
    $new = substr($path, 0, $last);
    $start = strripos($new, "/") + 1;
    return substr($path, $start, $last - $start);
}
function curPageURL()
{
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {
        $pageURL .= "s";
    }
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
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;
 }
Exemplo n.º 26
0
}
$ttl = $ExternalCounters->prepare_str(str_replace(" ", "+", $ttl));
$encoding = $ExternalCounters->get_query_param('encoding');
$ttl = $ExternalCounters->fix_ttl_encoding($encoding, $ttl, $rfrr);
$is_robot = '';
$ua = '';
$ua_str = '';
$ua_version = '';
$os = '';
if (!isset($browser) || empty($browser)) {
    $browser = new Browser();
    $is_robot = $browser->isRobot() ? $browser->getBrowser() : '';
    $ua = $browser->getBrowser() ? $browser->getBrowser() : '';
    $ua_str = $browser->getUserAgent() ? $browser->getUserAgent() : 'unknown';
    $ua_version = $browser->getVersion() ? $browser->getVersion() : '';
    $os = $browser->getPlatform() ? $browser->getPlatform() : '';
}
$table_name = $pt_externalcounters_table_name;
$DBH->exec("CREATE TABLE IF NOT EXISTS `" . $table_name . "` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `adddate` int(11) DEFAULT NULL, `random` varchar(50) DEFAULT NULL, `user_login` mediumtext NOT NULL, `referer` mediumtext NOT NULL, `self` mediumtext NOT NULL, `page_title` mediumtext NOT NULL, `browser` mediumtext NOT NULL, `number` mediumtext NOT NULL, `os` mediumtext NOT NULL, `os_number` mediumtext NOT NULL, `host` mediumtext NOT NULL, `ip` mediumtext NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `page_title` (`page_title`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
if (!$is_robot) {
    try {
        /**
         * if table exists
         */
        if ($ExternalCounters->db_table_exists($DBH, $table_name)) {
            $SQL = "INSERT INTO `" . $table_name . "` ";
            $SQL .= "(`adddate`, `random`, `user_login`, `referer`, `self`, `page_title`, `browser`, `number`, `os`, `os_number`, `host`, `ip`) ";
            //$SQL .= "VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
            $SQL .= "VALUES (:adddate, :random, :user_login, :referer, :self, :page_title, :browser, :number, :os, :os_number, :host, :ip);";
            $STH = $DBH->prepare($SQL);
            $a = null;
Exemplo n.º 27
0
 /**
  *
  * @param Application $app
  * @param databox     $databox
  * @param Browser     $browser
  *
  * @return Session_Logger
  */
 public static function create(Application $app, databox $databox, Browser $browser)
 {
     $colls = [];
     if ($app['authentication']->getUser()) {
         $bases = $app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]);
         foreach ($bases as $collection) {
             $colls[] = $collection->get_coll_id();
         }
     }
     $conn = $databox->get_connection();
     $sql = "INSERT INTO log\n              (id, date,sit_session, user, site, usrid, nav,\n                version, os, res, ip, user_agent,appli, fonction,\n                societe, activite, pays)\n            VALUES\n              (null,now() , :ses_id, :usr_login, :site_id, :usr_id\n              , :browser, :browser_version,  :platform, :screen, :ip\n              , :user_agent, :appli, :fonction, :company, :activity, :country)";
     $params = [':ses_id' => $app['session']->get('session_id'), ':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getLogin() : null, ':site_id' => $app['conf']->get(['main', 'key']), ':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->getId() : null, ':browser' => $browser->getBrowser(), ':browser_version' => $browser->getExtendedVersion(), ':platform' => $browser->getPlatform(), ':screen' => $browser->getScreenSize(), ':ip' => $browser->getIP(), ':user_agent' => $browser->getUserAgent(), ':appli' => serialize([]), ':fonction' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getJob() : null, ':company' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCompany() : null, ':activity' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getActivity() : null, ':country' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCountry() : null];
     $stmt = $conn->prepare($sql);
     $stmt->execute($params);
     $log_id = $conn->lastInsertId();
     $stmt->closeCursor();
     $sql = "INSERT INTO log_colls (id, log_id, coll_id) VALUES (null, :log_id, :coll_id)";
     $stmt = $conn->prepare($sql);
     foreach ($colls as $collId) {
         $stmt->execute([':log_id' => $log_id, ':coll_id' => $collId]);
     }
     $stmt->closeCursor();
     unset($stmt, $conn);
     return new Session_Logger($databox, $log_id);
 }
Exemplo n.º 28
0
    /**
     * Output page markup.
     *
     * @since 3.0.0
     */
    public function html()
    {
        ?>
		<div id="simcal-system-status-report">
			<p><?php 
        _e('Please copy and paste this information when contacting support:', 'google-calendar-events');
        ?>
 </p>
			<textarea readonly="readonly" onclick="this.select();"></textarea>
			<p><?php 
        _e('You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events');
        ?>
</p>
			<p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php 
        _e('Download System Report', 'google-calendar-events');
        ?>
</a></p>
		</div>
		<hr>
		<?php 
        global $wpdb;
        $wp_version = get_bloginfo('version');
        $sections = array();
        $panels = array('wordpress' => array('label' => __('WordPress Installation', 'google-calendar-events'), 'export' => 'WordPress Installation'), 'theme' => array('label' => __('Active Theme', 'google-calendar-events'), 'export' => 'Active Theme'), 'plugins' => array('label' => __('Active Plugins', 'google-calendar-events'), 'export' => 'Active Plugins'), 'server' => array('label' => __('Server Environment', 'google-calendar-events'), 'export' => 'Server Environment'), 'client' => array('label' => __('Client Information', 'google-calendar-events'), 'export' => 'Client Information'));
        /**
         * Plugin Information
         * ==================
         */
        // @todo add report information section for current plugin
        /**
         * WordPress Installation
         * ======================
         */
        $debug_mode = $script_debug = __('No', 'google-calendar-events');
        if (defined('WP_DEBUG')) {
            $debug_mode = true === WP_DEBUG ? __('Yes', 'google-calendar-events') : $debug_mode;
        }
        if (defined('SCRIPT_DEBUG')) {
            $script_debug = true === SCRIPT_DEBUG ? __('Yes', 'google-calendar-events') : $script_debug;
        }
        $memory = $this->let_to_num(WP_MEMORY_LIMIT);
        $memory_export = size_format($memory);
        if ($memory < 67108864) {
            $memory = '<mark class="error">' . sprintf(__('%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events'), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>';
        } else {
            $memory = '<mark class="ok">' . $memory_export . '</mark>';
        }
        $permalinks = get_option('permalink_structure');
        $permalinks = empty($permalinks) ? '/?' : $permalinks;
        $is_multisite = is_multisite();
        $sections['wordpress'] = array('name' => array('label' => __('Site Name', 'google-calendar-events'), 'label_export' => 'Site Name', 'result' => get_bloginfo('name')), 'home_url' => array('label' => __('Home URL', 'google-calendar-events'), 'label_export' => 'Home URL', 'result' => home_url()), 'site_url' => array('label' => __('Site URL', 'google-calendar-events'), 'label_export' => 'Site URL', 'result' => site_url()), 'version' => array('label' => __('Version', 'google-calendar-events'), 'label_export' => 'Version', 'result' => $wp_version), 'locale' => array('label' => __('Locale', 'google-calendar-events'), 'label_export' => 'Locale', 'result' => get_locale()), 'wp_timezone' => array('label' => __('Timezone', 'google-calendar-events'), 'label_export' => 'Timezone', 'result' => simcal_get_wp_timezone()), 'multisite' => array('label' => __('Multisite', 'google-calendar-events'), 'label_export' => 'Multisite', 'result' => $is_multisite ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => $is_multisite ? 'Yes' : 'No'), 'permalink' => array('label' => __('Permalinks', 'google-calendar-events'), 'label_export' => 'Permalinks', 'result' => '<code>' . $permalinks . '</code>', 'result_export' => $permalinks), 'memory_limit' => array('label' => 'WP Memory Limit', 'result' => $memory, 'result_export' => $memory_export), 'debug_mode' => array('label' => 'WP Debug Mode', 'result' => $debug_mode), 'script_debug' => array('label' => 'Script Debug', 'result' => $script_debug));
        /**
         * Active Theme
         * ============
         */
        include_once ABSPATH . 'wp-admin/includes/theme-install.php';
        if (version_compare($wp_version, '3.4', '<')) {
            $active_theme = get_theme_data(get_stylesheet_directory() . '/style.css');
            $theme_name = '<a href="' . $active_theme['URI'] . '" target="_blank">' . $active_theme['Name'] . '</a>';
            $theme_version = $active_theme['Version'];
            $theme_author = '<a href="' . $active_theme['AuthorURI'] . '" target="_blank">' . $active_theme['Author'] . '</a>';
            $theme_export = $active_theme['Name'] . ' - ' . $theme_version;
        } else {
            $active_theme = wp_get_theme();
            $theme_name = '<a href="' . $active_theme->ThemeURI . '" target="_blank">' . $active_theme->Name . '</a>';
            $theme_version = $active_theme->Version;
            $theme_author = $active_theme->Author;
            $theme_export = $active_theme->Name . ' - ' . $theme_version;
        }
        $theme_update_version = $theme_version;
        $api = themes_api('theme_information', array('slug' => get_template(), 'fields' => array('sections' => false, 'tags' => false)));
        if ($api && !is_wp_error($api)) {
            $theme_update_version = $api->version;
        }
        if (version_compare($theme_version, $theme_update_version, '<')) {
            $theme_version = '<mark class="error">' . $theme_version . ' (' . sprintf(__('%s is available', 'google-calendar-events'), esc_html($theme_update_version)) . ')</mark>';
        } else {
            $theme_version = '<mark class="ok">' . $theme_version . '</mark>';
        }
        $theme = '<dl>';
        $theme .= '<dt>' . __('Name', 'google-calendar-events') . '</dt>';
        $theme .= '<dd>' . $theme_name . '</dd>';
        $theme .= '<dt>' . __('Author', 'google-calendar-events') . '</dt>';
        $theme .= '<dd>' . $theme_author . '</dd>';
        $theme .= '<dt>' . __('Version', 'google-calendar-events') . '</dt>';
        $theme .= '<dd>' . $theme_version . '</dd>';
        $theme .= '</dl>';
        $is_child_theme = is_child_theme();
        $parent_theme = $parent_theme_export = '-';
        if ($is_child_theme) {
            if (version_compare($wp_version, '3.4', '<')) {
                $parent_theme = $parent_theme_export = $active_theme['Template'];
            } else {
                $parent = wp_get_theme($active_theme->Template);
                $parent_theme = '<dl>';
                $parent_theme .= '<dt>' . __('Name', 'google-calendar-events') . '</dt>';
                $parent_theme .= '<dd>' . $parent->Name . '</dd>';
                $parent_theme .= '<dt>' . __('Author', 'google-calendar-events') . '</dt>';
                $parent_theme .= '<dd>' . $parent->Author . '</dd>';
                $parent_theme .= '<dt>' . __('Version', 'google-calendar-events') . '</dt>';
                $parent_theme .= '<dd>' . $parent->Version . '</dd>';
                $parent_theme .= '</dl>';
                $parent_theme_export = strip_tags($parent->Name) . ' - ' . $parent->Version;
            }
        }
        $sections['theme'] = array('theme' => array('label' => __('Theme Information', 'google-calendar-events'), 'label_export' => 'Theme', 'result' => $theme, 'result_export' => $theme_export), 'theme_child' => array('label' => __('Child Theme', 'google-calendar-events'), 'label_export' => 'Child Theme', 'result' => $is_child_theme ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => $is_child_theme ? 'Yes' : 'No'), 'theme_parent' => array('label' => __('Parent Theme', 'google-calendar-events'), 'label_export' => 'Parent Theme', 'result' => $parent_theme, 'result_export' => $parent_theme_export));
        /**
         * Active Plugins
         * ==============
         */
        include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
        $active_plugins = (array) get_option('active_plugins', array());
        if (is_multisite()) {
            $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
        }
        foreach ($active_plugins as $plugin) {
            $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
            if (!empty($plugin_data['Name'])) {
                $plugin_name = $plugin_data['Title'];
                $plugin_author = $plugin_data['Author'];
                $plugin_version = $plugin_update_version = $plugin_data['Version'];
                // Afraid that querying many plugins may risk a timeout.
                if (count($active_plugins) <= 10) {
                    $api = plugins_api('plugin_information', array('slug' => $plugin_data['Name'], 'fields' => array('version' => true)));
                    if ($api && !is_wp_error($api)) {
                        if (!empty($api->version)) {
                            $plugin_update_version = $api->version;
                            if (version_compare($plugin_version, $plugin_update_version, '<')) {
                                $plugin_version = '<mark class="error">' . $plugin_version . ' (' . sprintf(__('%s is available', 'google-calendar-events'), esc_html($plugin_update_version)) . ')</mark>';
                            } else {
                                $plugin_version = '<mark class="ok">' . $plugin_version . '</mark>';
                            }
                        }
                    }
                }
                $plugin = '<dl>';
                $plugin .= '<dt>' . __('Author', 'google-calendar-events') . '</dt>';
                $plugin .= '<dd>' . $plugin_author . '</dd>';
                $plugin .= '<dt>' . __('Version', 'google-calendar-events') . '</dt>';
                $plugin .= '<dd>' . $plugin_version . '</dd>';
                $plugin .= '</dl>';
                $sections['plugins'][sanitize_key(strip_tags($plugin_name))] = array('label' => $plugin_name, 'label_export' => strip_tags($plugin_data['Title']), 'result' => $plugin, 'result_export' => $plugin_data['Version']);
            }
        }
        if (isset($sections['plugins'])) {
            rsort($sections['plugins']);
        }
        /**
         * Server Environment
         * ==================
         */
        if (version_compare(PHP_VERSION, '5.4', '<')) {
            $php = '<mark class="error">' . sprintf(__('%1$s - It is recomendend to upgrade at least to PHP version 5.4 for security reasons. <a href="%2$s" target="_blank">Read more.</a>', 'google-calendar-events'), PHP_VERSION, 'http://www.wpupdatephp.com/update/') . '</mark>';
        } else {
            $php = '<mark class="ok">' . PHP_VERSION . '</mark>';
        }
        if ($wpdb->use_mysqli) {
            $mysql = @mysqli_get_server_info($wpdb->dbh);
        } else {
            $mysql = @mysql_get_server_info();
        }
        $host = $_SERVER['SERVER_SOFTWARE'];
        if (defined('WPE_APIKEY')) {
            $host .= ' (WP Engine)';
        } elseif (defined('PAGELYBIN')) {
            $host .= ' (Pagely)';
        }
        $default_timezone = $server_timezone_export = date_default_timezone_get();
        if ('UTC' !== $default_timezone) {
            $server_timezone = '<mark class="error">' . sprintf(__('Server default timezone is %s - it should be UTC', 'google-calendar-events'), $default_timezone) . '</mark>';
        } else {
            $server_timezone = '<mark class="ok">UTC</mark>';
        }
        // WP Remote POST test.
        $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array('timeout' => 60, 'body' => array('cmd' => '_notify-validate')));
        if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
            $wp_post_export = 'Yes';
            $wp_post = '<mark class="ok">' . __('Yes', 'google-calendar-events') . '</mark>';
        } else {
            $wp_post_export = 'No';
            $wp_post = '<mark class="error">' . __('No', 'google-calendar-events');
            if (is_wp_error($response)) {
                $error = ' (' . $response->get_error_message() . ')';
                $wp_post .= $error;
                $wp_post_export .= $error;
            } else {
                $error = ' (' . $response['response']['code'] . ')';
                $wp_post .= $error;
                $wp_post_export .= $error;
            }
            $wp_post .= '</mark>';
        }
        // WP Remote GET test.
        $response = wp_safe_remote_get(get_home_url('/?p=1'));
        if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
            $wp_get_export = 'Yes';
            $wp_get = '<mark class="ok">' . __('Yes', 'google-calendar-events') . '</mark>';
        } else {
            $wp_get_export = 'No';
            $wp_get = '<mark class="error">' . __('No', 'google-calendar-events');
            if (is_wp_error($response)) {
                $error = ' (' . $response->get_error_message() . ')';
                $wp_get .= $error;
                $wp_get_export .= $error;
            } else {
                $error = ' (' . $response['response']['code'] . ')';
                $wp_get .= $error;
                $wp_get_export .= $error;
            }
            $wp_get .= '</mark>';
        }
        $php_memory_limit = ini_get('memory_limit');
        $php_max_upload_filesize = ini_get('upload_max_filesize');
        $php_post_max_size = ini_get('post_max_size');
        $php_max_execution_time = ini_get('max_execution_time');
        $php_max_input_vars = ini_get('max_input_vars');
        $sections['server'] = array('host' => array('label' => __('Web Server', 'google-calendar-events'), 'label_export' => 'Web Server', 'result' => $host), 'php_version' => array('label' => __('PHP Version', 'google-calendar-events'), 'label_export' => 'PHP Version', 'result' => $php, 'result_export' => PHP_VERSION), 'mysql_version' => array('label' => __('MySQL Version', 'google-calendar-events'), 'label_export' => 'MySQL Version', 'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">' . $mysql . '</mark>' : $mysql, 'result_export' => $mysql), 'server_timezone' => array('label' => __('Server Timezone', 'google-calendar-events'), 'label_export' => 'Server Timezone', 'result' => $server_timezone, 'result_export' => $server_timezone_export), 'display_errors' => array('label' => 'Display Errors', 'result' => ini_get('display_errors') ? __('Yes', 'google-calendar-events') . ' (' . ini_get('display_errors') . ')' : '-', 'result_export' => ini_get('display_errors') ? 'Yes' : 'No'), 'php_safe_mode' => array('label' => 'Safe Mode', 'result' => ini_get('safe_mode') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => ini_get('safe_mode') ? 'Yes' : 'No'), 'php_memory_limit' => array('label' => 'Memory Limit', 'result' => $php_memory_limit ? $php_memory_limit : '-'), 'upload_max_filesize' => array('label' => 'Upload Max Filesize', 'result' => $php_max_upload_filesize ? $php_max_upload_filesize : '-'), 'post_max_size' => array('label' => 'Post Max Size', 'result' => $php_post_max_size ? $php_post_max_size : '-'), 'max_execution_time' => array('label' => 'Max Execution Time', 'result' => $php_max_execution_time ? $php_max_execution_time : '-'), 'max_input_vars' => array('label' => 'Max Input Vars', 'result' => $php_max_input_vars ? $php_max_input_vars : '-'), 'fsockopen' => array('label' => 'fsockopen', 'result' => function_exists('fsockopen') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => function_exists('fsockopen') ? 'Yes' : 'No'), 'curl_init' => array('label' => 'cURL', 'result' => function_exists('curl_init') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => function_exists('curl_init') ? 'Yes' : 'No'), 'soap' => array('label' => 'SOAP', 'result' => class_exists('SoapClient') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => class_exists('SoapClient') ? 'Yes' : 'No'), 'suhosin' => array('label' => 'SUHOSIN', 'result' => extension_loaded('suhosin') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No'), 'wp_remote_post' => array('label' => 'WP Remote POST', 'result' => $wp_post, 'result_export' => $wp_post_export), 'wp_remote_get' => array('label' => 'WP Remote GET', 'result' => $wp_get, 'result_export' => $wp_get_export));
        /**
         * Client Information
         * ==================
         */
        $user_client = new \Browser();
        $browser = '<dl>';
        $browser .= '<dt>' . __('Name:', 'google-calendar-events') . '</dt>';
        $browser .= '<dd>' . $user_client->getBrowser() . '</dd>';
        $browser .= '<dt>' . __('Version:', 'google-calendar-events') . '</dt>';
        $browser .= '<dd>' . $user_client->getVersion() . '</dd>';
        $browser .= '<dt>' . __('User Agent:', 'google-calendar-events') . '</dt>';
        $browser .= '<dd>' . $user_client->getUserAgent() . '</dd>';
        $browser .= '<dt>' . __('Platform:', 'google-calendar-events') . '</dt>';
        $browser .= '<dd>' . $user_client->getPlatform() . '</dd>';
        $browser .= '</dl>';
        $browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')';
        $sections['client'] = array('user_ip' => array('label' => __('IP Address', 'google-calendar-events'), 'label_export' => 'IP Address', 'result' => $_SERVER['SERVER_ADDR']), 'browser' => array('label' => __('Browser', 'google-calendar-events'), 'result' => $browser, 'result_export' => $browser_export));
        /**
         * Final Output
         * ============
         */
        $panels = apply_filters('simcal_system_status_report_panels', $panels);
        $sections = apply_filters('simcal_system_status_report_sections', $sections);
        foreach ($panels as $panel => $v) {
            if (isset($sections[$panel])) {
                ?>
				<table class="widefat simcal-system-status-report-panel">
					<thead class="<?php 
                echo $panel;
                ?>
">
						<tr>
							<th colspan="3" data-export="<?php 
                echo $v['export'];
                ?>
"><?php 
                echo $v['label'];
                ?>
</th>
						</tr>
					</thead>
					<tbody>
						<?php 
                foreach ($sections[$panel] as $row => $cell) {
                    ?>
							<tr>
								<?php 
                    $label_export = isset($cell['label_export']) ? $cell['label_export'] : $cell['label'];
                    $result_export = isset($cell['result_export']) ? $cell['result_export'] : $cell['result'];
                    ?>
								<td class="tooltip"><?php 
                    echo isset($cell['tooltip']) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . $cell['tooltip'] . '"></i> ' : '';
                    ?>
</td>
								<td class="label" data-export="<?php 
                    echo trim($label_export);
                    ?>
"><?php 
                    echo $cell['label'];
                    ?>
</td>
								<td class="result" data-export="<?php 
                    echo trim($result_export);
                    ?>
"><?php 
                    echo $cell['result'];
                    ?>
</td>
							</tr>
						<?php 
                }
                ?>
					</tbody>
				</table>
				<?php 
            }
        }
        $this->inline_scripts();
    }
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
 /**
  * Save form submission
  *
  * @param   Array  $post    Post form
  * @param   int    $postID  Post ID
  *
  * @return  Messages
  */
 public function save($post, $postID)
 {
     global $wpdb;
     $return = new stdClass();
     $submissionsData = array();
     $validationForm = array();
     $requiredField = array();
     $postFormId = isset($post['form_id']) ? $post['form_id'] : '';
     $dataForms = get_post_meta((int) $postID);
     $formSettings = !empty($dataForms['form_settings'][0]) ? json_decode($dataForms['form_settings'][0]) : '';
     if (empty($formSettings)) {
         return;
     }
     $dataForms['form_id'] = (int) $postFormId;
     $dataContentEmail = '';
     $fileAttach = '';
     $nameFileByIndentifier = '';
     $global_captcha_setting = get_option('wr_contactform_global_captcha_setting', 2);
     if ($global_captcha_setting != 0) {
         if (!empty($formSettings->form_captcha) && $formSettings->form_captcha == 1 && isset($_POST['recaptcha_challenge_field'])) {
             include_once WR_CONTACTFORM_PATH . 'libraries/3rd-party/recaptchalib.php';
             $recaptchaChallenge = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '';
             $recaptchaResponse = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : '';
             $resp = recaptcha_check_answer(WR_CONTACTFORM_CAPTCHA_PRIVATEKEY, $_SERVER['REMOTE_ADDR'], $recaptchaChallenge, $recaptchaResponse);
             if (!$resp->is_valid) {
                 $return->error['captcha'] = __('Incorrect captcha text!', WR_CONTACTFORM_TEXTDOMAIN);
                 return $return;
             }
         } else {
             if (!empty($formSettings->form_captcha) && $formSettings->form_captcha == 2 || $global_captcha_setting == 1) {
                 if (!empty($_POST['form_name']) && !empty($_POST['captcha'])) {
                     $sCaptcha = $_SESSION['securimage_code_value'][$_POST['form_name']] ? $_SESSION['securimage_code_value'][$_POST['form_name']] : '';
                     if (strtolower($sCaptcha) != strtolower($_POST['captcha'])) {
                         $return->error['captcha_2'] = __('Incorrect captcha text!', WR_CONTACTFORM_TEXTDOMAIN);
                         return $return;
                     }
                 } else {
                     $return->error['captcha_2'] = __('Incorrect captcha text!', WR_CONTACTFORM_TEXTDOMAIN);
                     return $return;
                 }
             }
         }
     }
     $columsSubmission = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wr_contactform_fields WHERE form_id = %d ORDER BY field_ordering ASC", (int) $postFormId));
     $fieldClear = array();
     if (isset($dataForms->form_type) && $dataForms->form_type == 1) {
         $dataPages = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wr_contactform_form_pages WHERE form_id = %d ORDER BY page_id ASC", (int) $dataForms['form_id']));
         foreach ($dataPages as $index => $page) {
             if ($index > 0) {
                 $contentPage = isset($page->page_content) ? json_decode($page->page_content) : '';
                 foreach ($contentPage as $item) {
                     $fieldClear[] = $item->id;
                 }
             }
         }
     }
     $postAction = !empty($dataForms['form_post_action'][0]) ? $dataForms['form_post_action'][0] : '';
     $postActionData = !empty($dataForms['form_post_action_data'][0]) ? unserialize($dataForms['form_post_action_data'][0]) : '';
     self::get_action_form($postAction, $postActionData, $return);
     $fieldEmail = array();
     $ip = getenv('REMOTE_ADDR');
     $browser = new Browser();
     $submissionsData[] = array('form_id' => $postFormId, 'submission_data_value' => $browser->getPlatform(), 'field_type' => 'os');
     $submissionsData[] = array('form_id' => $postFormId, 'submission_data_value' => $browser->getBrowser(), 'field_type' => 'browser');
     $submissionsData[] = array('form_id' => $postFormId, 'submission_data_value' => $ip, 'field_type' => 'ip');
     foreach ($columsSubmission as $colum) {
         if (!in_array($colum->field_id, $fieldClear)) {
             $fieldName = '';
             $fieldName = $colum->field_id;
             $fieldSettings = isset($colum->field_settings) ? json_decode($colum->field_settings) : '';
             $value = '';
             $fieldEmail[$colum->field_id] = $colum->field_identifier;
             $formTypeNotSave = array('static-content', 'google-maps');
             $formTypeNotSave = apply_filters('wr_contactform_filter_form_type_not_save', $formTypeNotSave);
             if (isset($colum->field_type) && !in_array($colum->field_type, $formTypeNotSave)) {
                 if (in_array($colum->field_type, array('single-line-text', 'paragraph-text', 'country'))) {
                     $postFieldName = isset($post[$fieldName]) ? $post[$fieldName] : '';
                     $postName = stripslashes($postFieldName);
                     $value = $postName ? $postName : '';
                 } elseif ($colum->field_type == 'choices' || $colum->field_type == 'dropdown') {
                     $value = self::field_others($post, $fieldSettings, $fieldName);
                 } elseif (in_array($colum->field_type, array('checkboxes', 'list'))) {
                     $value = self::field_json($post, $colum->field_type, $fieldName);
                 } else {
                     $getValue = '';
                     $getValue = apply_filters('wr_contactform_get_value_type_' . str_replace('-', '_', $colum->field_type), $post, $fieldName, $colum, $fieldSettings);
                     if (is_array($getValue)) {
                         foreach ($getValue as $idField => $text) {
                             $validationForm[$idField] = $text;
                         }
                     } else {
                         if (is_string($getValue)) {
                             $value = $getValue;
                         }
                     }
                 }
                 // htmlentities to form inputs
                 if (in_array($colum->field_type, array('single-line-text', 'paragraph-text', 'address', 'name', 'password'))) {
                     $value = htmlentities($value);
                 }
                 $submissionsData[] = array('form_id' => $postFormId, 'field_id' => $colum->field_id, 'submission_data_value' => $value, 'field_type' => $colum->field_type);
                 $keyField = $colum->field_id;
                 $submissions = new stdClass();
                 $submissions->{$keyField} = $value;
                 if (isset($colum->field_type)) {
                     $nameFileByIndentifier[$colum->field_identifier] = $colum->field_title;
                     $contentField = WR_Contactform_Helpers_Contactform::get_data_field($colum->field_type, $submissions, $colum->field_id, $postFormId, false, false, 'email');
                     if ($colum->field_type == 'file-upload') {
                         $fileAttach[$colum->field_identifier] = WR_Contactform_Helpers_Contactform::get_data_field($colum->field_type, $submissions, $colum->field_id, $postFormId, false, false, 'fileAttach');
                     }
                     /* Create Filter get file attachment*/
                     $fileAttach = apply_filters('wr_contactform_frontend_file_attachment_email', $fileAttach, $colum, $submissions, $postFormId);
                     $dataContentEmail[$colum->field_identifier] = $contentField ? str_replace('\\n', '<br/>', trim($contentField)) : '<span>N/A</span>';
                     $requiredField[$colum->field_identifier] = $fieldSettings->options->required;
                 }
                 if (!empty($fieldSettings->options->noDuplicates) && (int) $fieldSettings->options->noDuplicates == 1) {
                     WR_CF_Gadget_Contactform_Frontend::check_duplicates($post, $fieldName, $colum->field_title, $validationForm);
                 }
                 if (isset($fieldSettings->options->limitation) && (int) $fieldSettings->options->limitation == 1 && !empty($post[$fieldName])) {
                     if ($fieldSettings->options->limitMin <= $fieldSettings->options->limitMax && $fieldSettings->options->limitMax > 0) {
                         self::check_limit_char($post, $fieldSettings, $fieldName, $colum->field_title, $validationForm);
                     }
                 }
                 if (isset($fieldSettings->options->requiredConfirm) && (int) $fieldSettings->options->requiredConfirm == 1) {
                     $postData = isset($post[$fieldName]) ? $post[$fieldName] : '';
                     $postDataConfirm = isset($post[$fieldName . '_confirm']) ? $post[$fieldName . '_confirm'] : '';
                     if (isset($fieldSettings->options->required) && (int) $fieldSettings->options->required == 1 && $postData != $postDataConfirm) {
                         $error = __('Both %s addresses must be the same.', WR_CONTACTFORM_TEXTDOMAIN);
                         $validationForm[$fieldName] = str_replace('%s', $colum->field_title, $error);
                     } else {
                         if (!empty($postData) && !empty($postDataConfirm) && $postData != $postDataConfirm) {
                             $error = __('Both %s addresses must be the same.', WR_CONTACTFORM_TEXTDOMAIN);
                             $validationForm[$fieldName] = str_replace('%s', $colum->field_title, $error);
                         }
                     }
                 }
                 if (isset($fieldSettings->options->required) && (int) $fieldSettings->options->required == 1 && (int) $fieldSettings->options->hideField != 1) {
                     $checkValidation = array();
                     $checkValidation = apply_filters('wr_contactform_filter_required_type_' . str_replace('-', '_', $colum->field_type), $checkValidation, $post, $fieldName, $colum, $fieldSettings);
                     if (!empty($checkValidation)) {
                         if (is_array($checkValidation)) {
                             $validationForm = array_merge($validationForm, $checkValidation);
                         }
                     } else {
                         if (isset($post[$fieldName]) && $post[$fieldName] == '') {
                             $validationForm[$fieldName] = __('This field can not be empty, please enter required information.', WR_CONTACTFORM_TEXTDOMAIN);
                         }
                     }
                 }
                 do_action('wr_contactform_frontend_action_save_form', $validationForm, $submissions, $postFormId, $fieldSettings, $post, $fieldName, $colum);
                 $validationForm = apply_filters('wr_contactform_frontend_validation_save_form', $validationForm, $colum, $submissions, $postFormId, $fieldSettings, $post, $fieldName);
             } else {
                 $formTypeNotSendEmail = array();
                 $formTypeNotSendEmail[] = 'google-maps';
                 $formTypeNotSendEmail[] = 'file-upload';
                 $formTypeNotSendEmail = apply_filters('wr_contactform_filter_form_type_not_send_email', $formTypeNotSendEmail);
                 if (isset($colum->field_type) && !in_array($colum->field_type, $formTypeNotSendEmail)) {
                     $nameFileByIndentifier[$colum->field_identifier] = $colum->field_title;
                     $dataContentEmail[$colum->field_identifier] = $fieldSettings->options->value;
                 }
             }
         }
     }
     if (!$validationForm) {
         self::_save($dataForms, (int) $postID, $return, $post, $submissionsData, $dataContentEmail, $nameFileByIndentifier, $requiredField, $fileAttach);
         return $return;
     } else {
         $return->error = $validationForm;
         return $return;
     }
 }