function SitepresenterAddForm() { parent::MailForm(); global $page, $cgi; $this->parseSettings('inc/app/sitepresenter/forms/add/settings.php'); page_title(intl_get('Adding Presentation')); loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); // include formhelp, edit panel init, and cancel handler page_add_script(site_prefix() . '/js/formhelp.js'); page_add_script(CMS_JS_FORMHELP_INIT); page_onload('cms_init_edit_panels ()'); page_add_script(' function cms_cancel (f) { if (arguments.length == 0) { window.location.href = "/index/cms-app"; } else { if (f.elements["_return"] && f.elements["_return"].value.length > 0) { window.location.href = f.elements["_return"].value; } else { window.location.href = "/index/sitepresenter-app"; } } return false; } '); // add cancel handler $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"'; }
function CmsAddSitellite_filesystemForm() { parent::MailForm(); global $page, $cgi; $this->parseSettings('inc/app/cms/forms/add/sitellite_filesystem/settings.php'); page_title(intl_get('Adding File')); loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); // include formhelp, edit panel init, and cancel handler page_add_script(site_prefix() . '/js/formhelp-compressed.js'); page_add_script(CMS_JS_FORMHELP_INIT); page_add_script(' function cms_cancel (f) { onbeforeunload_form_submitted = true; if (arguments.length == 0) { window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem"; } else { if (f.elements["_return"] && f.elements["_return"].value.length > 0) { window.location.href = f.elements["_return"].value; } else { window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem"; } } return false; } function cms_preview_action (f) { cms_copy_values (f); return cms_preview (f); } function cms_cancel_action (f) { cms_copy_values (f); if (confirm (\'Are you sure you want to cancel?\')) { return cms_cancel (f); } return false; } '); if (session_pref('form_help') == 'off') { page_add_script(' formhelp_disable = true; '); } $this->widgets['sitellite_owner']->setValue(session_username()); $this->widgets['sitellite_team']->setValue(session_team()); // add cancel handler $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"'; }
/** * Метод, предназначенный для получения информации о клиенте, создания COOKIE файла сроком на сутки и * записи в БД, если данного клиента еще нет. * * @param int $id - идентификатор счетчика */ function counterClientNew($id) { global $AVE_DB; // Определяем IP адрес клиента if (!empty($_SERVER['REMOTE_ADDR'])) { $ip = $_SERVER['REMOTE_ADDR']; } else { $ip = $_SERVER['HTTP_CLIENT_IP']; } // Получаем количестко записей из БД о данном клиенте $exist = $AVE_DB->Query("\r\n\t\t\tSELECT 1\r\n\t\t\tFROM " . PREFIX . "_modul_counter_info\r\n\t\t\tWHERE counter_client_ip = '" . addslashes($ip) . "'\r\n\t\t\tAND counter_id = '" . $id . "'\r\n\t\t\tAND counter_expire_time > '" . time() . "'\r\n\t\t\tLIMIT 1\r\n\t\t")->NumRows(); // Устанавливаем срок жизни COOKIE файла $counter_expire_time = mktime(23, 59, 59); setcookie('counter_' . $id, '1', $counter_expire_time); // Если информации о данном клиенте не найдено в БД if (!$exist) { $referer = ''; // Опреляем реферал if (isset($_SERVER['HTTP_REFERER'])) { $referer = urldecode(trim($_SERVER['HTTP_REFERER'])); } // Подключаем классы, предназначенные для получения детальной информации о пользователе // (операционная система, браузер и т.д.) include_once BASE_DIR . '/modules/counter/phpSniff.core.php'; include_once BASE_DIR . '/modules/counter/phpSniff.class.php'; $settings = array('check_cookies' => '', 'default_language' => '', 'allow_masquerading' => ''); $client = new phpSniff('', $settings); // Выполняем запрос к БД на запись полученной информации $AVE_DB->Query("\r\n\t\t\t\tINSERT\r\n\t\t\t\tINTO " . PREFIX . "_modul_counter_info\r\n\t\t\t\tSET\r\n\t\t\t\t\tcounter_id = '" . $id . "',\r\n\t\t\t\t\tcounter_client_ip = '" . addslashes($ip) . "',\r\n\t\t\t\t\tcounter_client_os = '" . $client->property('platform') . ' ' . $client->property('os') . "',\r\n\t\t\t\t\tcounter_client_browser = '" . $client->property('long_name') . ' ' . $client->property('version') . "',\r\n\t\t\t\t\tcounter_client_referer = '" . addslashes($referer) . "',\r\n\t\t\t\t\tcounter_visit_time = '" . time() . "',\r\n\t\t\t\t\tcounter_expire_time = '" . $counter_expire_time . "'\r\n\t\t\t"); } }
function NewsEditForm() { parent::MailForm(); $this->autosave = true; $this->parseSettings('inc/app/news/forms/edit/settings.php'); global $page, $cgi; page_title(intl_get('Editing News Story') . ': ' . $cgi->_key); loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); // include formhelp, edit panel init, and cancel handler page_add_script(site_prefix() . '/js/formhelp-compressed.js'); page_add_script(CMS_JS_FORMHELP_INIT); page_add_script(' function cms_cancel_unlock (f, collection, key) { onbeforeunload_form_submitted = true; if (arguments.length == 0) { window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=' . site_prefix() . '/index/cms-app"; } else { if (f.elements[\'_return\'] && f.elements[\'_return\'].value.length > 0) { window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=" + f.elements[\'_return\'].value; } else { window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=' . site_prefix() . '/index/news-app"; } } return false; } '); if (session_pref('form_help') == 'off') { page_add_script(' formhelp_disable = true; '); } // add cancel handler $this->widgets['submit_button']->buttons[0]->extra = 'onclick="onbeforeunload_form_submitted = true;"'; $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel_unlock (this.form, \'' . $cgi->_collection . '\', \'' . $cgi->_key . '\')"'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); $_document = $rex->getCurrent($cgi->_key); // set values from repository entry foreach (get_object_vars($_document) as $k => $v) { if (is_object($this->widgets[$k])) { $this->widgets[$k]->setValue($v); } } }
function NewsAddForm() { parent::MailForm(); global $page, $cgi; $this->parseSettings('inc/app/news/forms/add/settings.php'); page_title(intl_get('Adding News Story')); loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); // include formhelp, edit panel init, and cancel handler page_add_script(site_prefix() . '/js/formhelp-compressed.js'); page_add_script(CMS_JS_FORMHELP_INIT); page_add_script(' function cms_cancel (f) { onbeforeunload_form_submitted = true; if (arguments.length == 0) { window.location.href = "/index/cms-app"; } else { if (f.elements["_return"] && f.elements["_return"].value.length > 0) { window.location.href = f.elements["_return"].value; } else { window.location.href = "/index/news-app"; } } return false; } '); if (session_pref('form_help') == 'off') { page_add_script(' formhelp_disable = true; '); } // add cancel handler $this->widgets['submit_button']->buttons[0]->extra = 'onclick="onbeforeunload_form_submitted = true;"'; $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"'; }
function CmsAddSitellite_sidebarForm() { parent::MailForm(); page_title(intl_get('Adding Sidebar')); global $page, $cgi; loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"'; // include formhelp page_add_script(site_prefix() . '/js/formhelp-compressed.js'); page_add_script(' formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\'; formhelp_append = \'</td></tr></table>\'; function cms_preview_action (f) { cms_copy_values (f); return cms_preview (f); } function cms_cancel_action (f) { cms_copy_values (f); if (confirm (\'Are you sure you want to cancel?\')) { return cms_cancel (f); } return false; } '); if (session_pref('form_help') == 'off') { page_add_script(' formhelp_disable = true; '); } $w =& $this->addWidget('tab', 'tab1'); $w->title = intl_get('Edit'); // edit widgets go here $w =& $this->addWidget('text', 'id'); $w->alt = intl_get('Sidebar ID'); $w->addRule('not empty', 'You must enter an ID for your sidebar.'); $w->addRule('not regex "[^a-zA-Z0-9_-]"', 'Your ID contains invalid characters.'); $w->addRule('unique "sitellite_sidebar/id"', 'A sidebar with this ID already exists.'); $help = addslashes(intl_get('Must contain only letters, numbers, underscores, and dashes (ie. product_info).')); $w->extra = 'onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $w->length = 32; $w =& $this->addWidget('hidden', 'collection'); $w =& $this->addWidget('hidden', '_return'); $w =& $this->addWidget('text', 'title'); $w->alt = intl_get('Sidebar Title'); //$w->addRule ('not empty', 'You must enter a title for your sidebar.'); $w->extra = 'size="40"'; $w->length = 72; $w =& $this->addWidget('xed.Widget.Xeditor', 'body'); if (appconf('tidy_path')) { $w->tidy_path = appconf('tidy_path'); } //$w->addRule ('not empty', 'You must enter content into your sidebar body.'); $w->length = 65535; $w =& $this->addWidget('tab', 'tab2'); $w->title = intl_get('Properties'); // property widgets go here //$t =& $this->addWidget ('section', 'section1'); //$t->title = intl_get ('Display Settings'); $res = db_fetch('select * from sitellite_sidebar_position order by id asc'); if (!$res) { $res = array('left' => intl_get('Left')); } elseif (is_object($res)) { $res = array($res->id => ucwords($res->id)); } else { $n = array(); foreach ($res as $row) { $n[$row->id] = ucwords($row->id); } $res = $n; } $t =& $this->addWidget('cms.Widget.Position', 'position'); $t->alt = intl_get('Position'); $t->setValues($res); $help = addslashes(intl_get('Choose the position where you want this sidebar to appear.')); $t->extra = 'id="position" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('text', 'sorting_weight'); $t->alt = intl_get('Sorting Order'); global $cgi; if ($cgi->position) { $t->setDefault((string) db_shift('select sorting_weight + 1 from sitellite_sidebar where position = ? order by sorting_weight desc limit 1', $cgi->position)); } else { $t->setDefault((string) db_shift('select sorting_weight + 1 from sitellite_sidebar order by sorting_weight desc limit 1')); } $help = addslashes(intl_get('The larger the number, the further down the list of sidebars in the same position the current sidebar will appear.')); $t->extra = 'id="sorting_weight" style="width: 50px" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->advanced = true; loader_box('sitellite/nav/init'); $t =& $this->addWidget('multiple', 'show_on_pages'); $t->alt = intl_get('Show in Sections'); $t->setValues(array_merge(array('all' => intl_get('All')), menu_get_sections())); $help = addslashes(intl_get('Choose the web site sections where you want this sidebar to appear. Ctrl-click to select more than one section.')); $t->extra = 'id="show_on_pages" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->size = 5; $t =& $this->addWidget('boxchooser.Widget.Boxchooser', 'alias'); $t->alt = intl_get('Alias of (a box name)'); $help = addslashes(intl_get('This allows you to specify the name of a box that will provide the contents of this sidebar.')); $t->extra = 'id="alias" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->length = 255; $t->advanced = true; $w =& $this->addWidget('tab', 'tab3'); $w->title = intl_get('State'); // state widgets go here $t =& $this->addWidget('status', 'sitellite_status'); $t->alt = intl_get('Status'); $t->setValue('draft'); $help = addslashes(intl_get('The status determines what stage of its lifecycle that your document is in. Only Approved items can be viewed on the live site. Queued items are set to be approved on the specified Publish On date (below) by the scheduler.')); $t->extra = 'id="sitellite_status" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('access', 'sitellite_access'); $t->alt = intl_get('Access Level'); $t->setValue('public'); $help = addslashes(intl_get('The access level of a document determines who is allowed to view it. This allows you to make portions of your site completely private, or only available to specific user roles (ie. members-only).')); $t->extra = 'id="sitellite_access" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('calendar', 'sitellite_startdate'); $t->alt = intl_get('Publish On (If Status is "Queued")'); $t->nullable = true; $t->showsTime = true; $t->format = '%Y-%m-%d %H:%M:%S'; $t->displayFormat = '%a, %e %b, %Y - %l:%M%P'; $t->advanced = true; $t =& $this->addWidget('calendar', 'sitellite_expirydate'); $t->alt = intl_get('Archive On (If Status is "Approved")'); $t->nullable = true; $t->showsTime = true; $t->format = '%Y-%m-%d %H:%M:%S'; $t->displayFormat = '%a, %e %b, %Y - %l:%M%P'; $t->advanced = true; $t =& $this->addWidget('owner', 'sitellite_owner'); $t->alt = intl_get('Created By'); $t->setValue(session_username()); $t->advanced = true; $t =& $this->addWidget('team', 'sitellite_team'); $t->alt = intl_get('Owned by Team'); $t->setValue(session_team()); $t->extra = 'id="sitellite_team"'; $t->advanced = true; $t =& $this->addWidget('textarea', 'changelog'); $t->alt = intl_get('Change Summary'); $t->rows = 3; $t->labelPosition = 'left'; $help = addslashes(intl_get('The change summary helps give other site editors, including yourself, a more complete history of the changes that have been made to this item.')); $t->extra = 'id="changelog" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->setValue('Sidebar added.'); $w =& $this->addWidget('tab', 'tab-end'); // submit buttons $w =& $this->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Create')); $b->extra = 'onclick="onbeforeunload_form_submitted = true"'; //$b =& $w->addButton ('submit_button', intl_get ('Preview')); //$b->extra = 'onclick="return cms_preview (this.form)"'; $b =& $w->addButton('submit_button', intl_get('Cancel')); $b->extra = 'onclick="return cms_cancel (this.form)"'; $this->error_mode = 'all'; }
/** * Generate a form for editing items in this list. * * @return object saf.MailForm object */ function &getEditForm($item) { loader_import('saf.MailForm'); $form = new MailForm(); $form->action = site_prefix() . '/index/usradm-edit-user-action'; $form->error_mode = 'all'; loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $form->_browser = $sniffer->property('browser'); $user = session_user_get($item); $form->addWidget('hidden', '_list'); page_add_script(' formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\'; formhelp_append = \'</td></tr></table>\'; '); $w =& $form->addWidget('tab', 'tab1'); $w->title = intl_get('Account'); $w =& $form->addWidget('info', '_key'); $w->alt = intl_get('Username'); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('password', 'passwd'); $w->alt = intl_get('Password'); $w =& $form->addWidget('password', 'password_verify'); $w->alt = intl_get('Verify Password'); $w->addRule('equals "passwd"', intl_get('Passwords do not match.')); $w->ignoreEmpty = false; $w =& $form->addWidget('text', 'firstname'); $w->alt = intl_get('First Name'); //$w->addRule ('not empty', intl_get ('First name must not be empty.')); $w->setValue($user->firstname); $w->extra = 'maxlength="32"'; $w =& $form->addWidget('text', 'lastname'); $w->alt = intl_get('Last Name'); //$w->addRule ('not empty', intl_get ('Last name must not be empty.')); $w->setValue($user->lastname); $w->extra = 'maxlength="32"'; $w =& $form->addWidget('text', 'email'); $w->alt = intl_get('Email'); //$w->addRule ('not empty', intl_get ('Email must not be empty.')); //$w->addRule ('contains "@"', intl_get ('Email does not appear to be valid.')); $w->setValue($user->email); $w->extra = 'maxlength="42"'; $snm =& session_get_manager(); $list = assocify(array_keys($snm->role->getList())); unset($list['anonymous']); unset($list['']); $w =& $form->addWidget('select', 'role'); $w->alt = intl_get('Role'); $w->setValues($list); $w->setValue($user->role); $w->extra = 'id="role"'; $w =& $form->addWidget('select', 'team'); $w->alt = intl_get('Team'); $w->setValues(assocify(array_keys($snm->team->getList()))); $w->setValue($user->team); $w->extra = 'id="team"'; $w =& $form->addWidget('select', 'disabled'); $w->alt = intl_get('Disabled'); $w->setValues(array('yes' => 'Yes', 'no' => 'No')); $w->setValue($user->disabled); $w->extra = 'id="disabled"'; $w =& $form->addWidget('select', 'public'); $w->alt = intl_get('Public'); $w->setValues(array('yes' => 'Yes', 'no' => 'No')); $w->setValue($user->public); $w->extra = 'id="public"'; $w =& $form->addWidget('textarea', 'profile'); $w->alt = intl_get('Profile'); $w->setValue($user->profile); $w->labelPosition = 'left'; $w->rows = 5; $w->extra = 'id="profile"'; $w =& $form->addWidget('textarea', 'sig'); $w->alt = intl_get('Signature (for comments)'); $w->setValue($user->sig); $w->labelPosition = 'left'; $w->rows = 3; $w->extra = 'id="sig"'; $w =& $form->addWidget('info', 'registered'); $w->alt = intl_get('Date Registered'); $w->setValue(loader_call('saf.Date', 'Date::timestamp', $user->registered, 'F jS, Y - g:i A')); $w =& $form->addWidget('info', 'modified'); $w->alt = intl_get('Date Last Modified'); $w->setValue(loader_call('saf.Date', 'Date::timestamp', $user->modified, 'F jS, Y - g:i A')); $w =& $form->addWidget('tab', 'tab2'); $w->title = intl_get('Contact'); $w =& $form->addWidget('text', 'company'); $w->alt = intl_get('Company'); $w->setValue($user->company); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'position'); $w->alt = intl_get('Position'); $w->setValue($user->position); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'website'); $w->alt = intl_get('Web Site'); if (!empty($user->website)) { $w->setValue($user->website); } else { $w->setValue('http://'); } $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'phone'); $w->alt = intl_get('Phone #'); $w->setValue($user->phone); $w->extra = 'maxlength="24"'; $w =& $form->addWidget('text', 'cell'); $w->alt = intl_get('Cell #'); $w->setValue($user->cell); $w->extra = 'maxlength="24"'; $w =& $form->addWidget('text', 'fax'); $w->alt = intl_get('Fax #'); $w->setValue($user->fax); $w->extra = 'maxlength="24"'; $w =& $form->addWidget('text', 'sms_address'); $w->alt = intl_get('SMS #'); $w->setValue($user->sms_address); $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'jabber_id'); $w->alt = intl_get('Jabber ID'); $w->setValue($user->jabber_id); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'address1'); $w->alt = intl_get('Address'); $w->setValue($user->address1); $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'address2'); $w->alt = intl_get('Address Line 2'); $w->setValue($user->address2); $w->extra = 'maxlength="72"'; $w =& $form->addWidget('text', 'city'); $w->alt = intl_get('City'); $w->setValue($user->city); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'province'); $w->alt = intl_get('Province/State'); $w->setValue($user->province); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('text', 'postal_code'); $w->alt = intl_get('Postal/Zip Code'); $w->setValue($user->postal_code); $w->extra = 'maxlength="16"'; $w =& $form->addWidget('text', 'country'); $w->alt = intl_get('Country'); $w->setValue($user->country); $w->extra = 'maxlength="48"'; $w =& $form->addWidget('tab', 'tab3'); $w->title = intl_get('Access'); $w =& $form->addWidget('usradm.Widget.Allowedbox', 'teams'); $w->alt = 'Allowed Teams'; $w->headers[] = ' '; $w->headers[] = intl_get('Read'); $w->headers[] = intl_get('Write'); $b =& $w->addButton('all', array('r' => '', 'w' => '')); $b->alt = '<strong>All</strong>'; $teams = unserialize($user->teams); if (isset($teams['all'])) { $b->setValue(assocify(preg_split('//', $teams['all'], -1, PREG_SPLIT_NO_EMPTY))); } foreach (session_get_teams() as $value) { $b =& $w->addButton($value, array('r' => '', 'w' => '')); $b->alt = ucwords(str_replace('_', ' ', $value)); $b->setValue(assocify(preg_split('//', $teams[$value], -1, PREG_SPLIT_NO_EMPTY))); } $w =& $form->addWidget('tab', 'tab-end'); $w =& $form->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Save')); $b =& $w->addButton('cancel_button'); $b->setValues(intl_get('Cancel')); $b->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/usradm-browse-action?list=users\'; return false"'; return $form; }
function onApplicationStarted() { if ($this->isStatisticsEnable() == false) { return; } global $zone; if ($zone == 'CustomerZone') { loadCoreFile('phpSniff.class.php'); $client = new phpSniff(); $session_id = $this->__getUniqueVisitorMarker(); $os = trim($client->property('platform') . ' ' . $client->property('os')); $browser = trim($client->property('long_name') . ' ' . $client->property('version')); $agent = @$_SERVER['HTTP_USER_AGENT']; // user-agent param can be empty. So that is why @ silencer sign is added $r = $this->__getVisitorTypeByAgent($agent); //C - customer browser; R - robot; ... list($referer_host, $referer) = $this->__getReferer(); $remote_ip = $this->__getRemoteIP(); $remote_host = $this->__getRemoteHost($remote_ip); $page_url = $this->__getCurrentURL(); if ($r['type'] != "C") { $browser = $r['crawler_name']; $type = $r['type']; //$visit_time = date('Y-m-d H:i:s', $this->getTimestamp()); $pages = array(); # check if this bot crawled store before today $from = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); $to = date("Y-m-d H:i:s", mktime(23, 23, 59, date("m"), date("d"), date("Y"))); $params = array('from' => $from, 'to' => $to, 'name' => $r['crawler_name'], 'visitor_id' => null, 'limits' => null); $cvisits = execQuery('SELECT_CRAWLER_VISITS', $params); if (count($cvisits) != 0) { $pages = unserialize(stripslashes($cvisits[0]['scanned_pages'])); $pages[] = array("visit_time" => $this->getTimestamp(), "url" => $page_url); $scanned_pages = serialize($pages); $this->setCrawlerVisit($cvisits[0]['visitor_id'], $agent, $browser, $type, $remote_ip, $remote_host, $referer, $pages[0]['url'], $scanned_pages); } else { $pages[] = array("visit_time" => $this->getTimestamp(), "url" => $page_url); $scanned_pages = serialize($pages); $this->setCrawlerVisit(null, $agent, $browser, $type, $remote_ip, $remote_host, $referer, $page_url, $scanned_pages); } } else { $type = "C"; // visitor_id session_id $visitor_id = $this->getVisitorIdBySessionId($session_id); if ($visitor_id == null) { $visitor_id = $this->createVisitorInfo($session_id, $os, $browser, $agent, $type); } // $seance_data = $this->findCurrentSeanceId($visitor_id); if ($seance_data == null) { // , $last_seance_id = $this->findLastSeanceId($visitor_id); if ($last_seance_id === null) { // $prev_seance_id = 0; // - . $visit_number = 1; $seance_id = $this->createSeance($visitor_id, $referer_host, $referer, $remote_ip, $remote_host, $page_url, $prev_seance_id, $visit_number); } else { $prev_seance_id = $last_seance_id; $seance_info = execQuery('SELECT_SEANCE_BY_ID', array('seance_id' => $prev_seance_id)); if (!empty($seance_info) && isset($seance_info[0]) && isset($seance_info[0]['visit_number'])) { $visit_number = $seance_info[0]['visit_number'] + 1; } else { $visit_number = 1; } $seance_id = $this->createSeance($visitor_id, $referer_host, $referer, $remote_ip, $remote_host, $page_url, $prev_seance_id, $visit_number); } // $this->addSeanceInfo($seance_id, $page_url); } else { // list($seance_id, $last_page_url) = $seance_data; if ($last_page_url !== $page_url) { // $this->addSeanceInfo($seance_id, $page_url); } } } } }
protected function setSystemAccessLog(&$data) { if ($this->_logAccess === 0 || !$data->use_id || isset($data->access_id)) { return $this; } require_once realpath(APPLICATION_PATH . '/../vendor/phpsniff-2.1.3/phpSniff.class.php'); $_sniff = new phpSniff(); $clientInfo = $_sniff->property(); /** * @see Ht/Utils/Generater.php */ try { Zend_Loader::loadClass("Ht_Utils_Generater"); Zend_Loader::loadClass("Ht_Utils_Generater_Id"); $generator = new Ht_Utils_Generater_Id(array(Ht_Utils_Generater::GENERATED_DIGIT32, Ht_Utils_Generater::GENERATED_INCLUDE_NUMBER, Ht_Utils_Generater::GENERATED_USE_LOWERLETTER, Ht_Utils_Generater::GENERATED_USE_UPPERLETTER)); $access_id = $generator->getGeneratedId(); } catch (Exception $exc) { echo $exc->getMessage(), "<hr />"; echo $exc->getTraceAsString(); } $row = array("access_id" => $access_id, "acc_id" => $data->u_id, "login_time" => new Zend_Db_Expr("NOW()"), "acc_ip" => $clientInfo["ip"], "acc_agent" => $clientInfo["ua"], "acc_browser" => $clientInfo["long_name"], "acc_os" => $clientInfo["os"]); unset($_sniff, $clientInfo); try { $sysaccess = new Default_Model_DbTable_SysAccess(); $sysaccess->insert($row); $user = new Zend_Db_Table('ht_user'); $where = $user->getAdapter()->quoteInto("use_id =?", $data->use_id); $user->update(array("use_lastlogin" => new Zend_Db_Expr("NOW()")), $where); } catch (Exception $exc) { $data->access_id = $access_id; return $this; } $data->access_id = $access_id; return $this; }
$GET_VARS = isset($_GET) ? $_GET : $HTTP_GET_VARS; $POST_VARS = isset($_POST) ? $_GET : $HTTP_POST_VARS; if (!isset($GET_VARS['UA'])) { $GET_VARS['UA'] = ''; } if (!isset($GET_VARS['cc'])) { $GET_VARS['cc'] = ''; } if (!isset($GET_VARS['dl'])) { $GET_VARS['dl'] = ''; } if (!isset($GET_VARS['am'])) { $GET_VARS['am'] = ''; } $sniffer_settings = array('check_cookies' => $GET_VARS['cc'], 'default_language' => $GET_VARS['dl'], 'allow_masquerading' => $GET_VARS['am']); $client = new phpSniff($GET_VARS['UA'], $sniffer_settings); $client->get_property('UA'); $tmpArray = array(); $tmpArray['ip'] = $client->property('ip'); $tmpArray['ua'] = $client->property('ua'); $tmpArray['browser'] = $client->property('browser'); $tmpArray['long_name'] = $client->property('long_name'); $tmpArray['version'] = $client->property('version'); $tmpArray['maj_ver'] = $client->property('maj_ver'); $tmpArray['min_ver'] = $client->property('min_ver'); $tmpArray['letter_ver'] = $client->property('letter_ver'); $tmpArray['javascript'] = $client->property('javascript'); $tmpArray['platform'] = $client->property('platform'); $tmpArray['os'] = $client->property('os'); $tmpArray['language'] = $client->property('language'); $tmpArray['gecko'] = $client->property('gecko');
/** * Will return a full-blown array, containing the browser information. This method will return both features, quirks and the * browser properties of the client. You can use this method if you need to retrieve all the stats from it; * * @return A Will return an array with the user agent properties * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 10_TPL.php 315 2009-10-11 07:11:31Z catalin.zamfir $ * @since Version 1.0 * @access protected * @static * @final */ protected static final function getUserAgentStats() { if (count(self::$objUserAgentCapability) == 0) { // Set the PHPUserAgentSniffer object; $userAgentPHPCapabilityObject = new phpSniff(); // Get information back from it! self::$objUserAgentCapability['browser_properties'] = $userAgentPHPCapabilityObject->property(); self::$objUserAgentCapability['browser_features'] = $userAgentPHPCapabilityObject->_feature_set; self::$objUserAgentCapability['browser_quirks'] = $userAgentPHPCapabilityObject->_quirks; // Do return ... return self::$objUserAgentCapability; } else { // Do return ... return self::$objUserAgentCapability; } }
function testSafariBrowser() { $sniffer = new phpSniff('Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/48 (like Gecko) Safari/48'); $this->assertTrue($sniffer->browser_is('sf')); $this->assertFalse($sniffer->browser_is('kq')); $this->assertFalse($sniffer->browser_is('ns4')); $this->assertFalse($sniffer->browser_is('fx')); $this->assertFalse($sniffer->browser_is('ie')); }
$data['title'] = 'License'; $data['next'] = 'Requirements'; $data['body'] = '<div style="font-size: 11px; height: 350px; width: 548px; overflow: auto; border: 1px solid #eee"><pre>' . htmlentities_compat(@join('', @file('inc/LICENSE'))) . '</pre></div>' . '<p style="float: right; padding-right: 30px; padding-top: 5px"><input type="radio" name="agree" value="yes" /> I agree<br />' . '<input type="radio" name="agree" value="no" checked="checked" /> I do not agree</p>'; if ($cgi->agree == 'no') { $data['body'] .= '<script language="javascript" type="text/javascript"> alert (\'You must agree to the license to continue the installation.\'); </script>'; } break; case 2: if ($cgi->agree == 'no') { header('Location: ?step=1&agree=no'); exit; } loader_import('ext.phpsniff'); $ua = new phpSniff(); if (PHP_VERSION < '4.2') { // requires php 4.2+ $data['error'] = true; $data['body'] = '<p class="notice">Sitellite requires PHP version 4.2 or 4.3.</p>' . '<h2>Solution:</h2>' . '<ul><li>Upgrade PHP to a newer release</li></ul>'; //} elseif (PHP_VERSION >= '5.0') { // requires php < 5.0 // $data['error'] = true; // $data['body'] = '<p class="notice">Please Note: PHP5 support is still in beta, and not recommended for production use.</p>'; } elseif (strpos(php_sapi_name(), 'apache') === false) { // requires apache $data['error'] = true; $data['body'] = '<p class="notice">Sitellite requires PHP to be installed as an Apache module.</p>' . '<h2>Solutions:</h2>' . '<ul><li>Recompile PHP with the flag --with-apxs</li><li>Continue the installation and follow the workaround steps for the appropriate web server <a href="http://cookbook.sitellite.org/index/sitewiki-app/show.TroubleShooting" target="_blank">found here</a></ul>'; } elseif (!is_writeable('../inc/conf/config.ini.php')) { $data['error'] = true; $data['body'] = '<p class="notice">Can\'t write to the Sitellite configuration file</p>' . '<h2>Solution:</h2>' . '<ul><li>In your document root, execute the command `chmod -R 0777 inc/conf`</li></ul>';
$UA = ''; } if (!isset($cc)) { $cc = ''; } if (!isset($dl)) { $dl = ''; } if (!isset($am)) { $am = ''; } $timer = new phpTimer(); $timer->start('main'); $timer->start('client1'); $sniffer_settings = array('check_cookies' => $cc, 'default_language' => $dl, 'allow_masquerading' => $am); $client = new phpSniff($UA, $sniffer_settings); $timer->stop('client1'); $c1_bg = '#cccccc'; $c2_bg = '#ffffff'; $c3_bg = '#000000'; function makeSelectOption($link, $text) { global $client; $o = "<option value=\"{$link}\""; $o .= $client->property('ua') == strtolower($link) ? ' selected' : ''; $o .= ">{$text}</option>"; print $o; } function example($search, $output) { global $c2_bg, $c1_bg, $client;
<?php include_once "./lib/phpsniff/phpSniff.class.php"; phpinfo(); $phpSniffer = new phpSniff(); print_r($phpSniffer->property());
function configNew(&$bn, &$bv, &$f, $i, &$uid) { global $HTTP_USER_AGENT; global $REMOTE_ADDR; # We disable the error reporting, because Konqueror 3.0.3 causes a runtime error output that stops the program. # could be a bug in phpsniff .. hmmm? $old_err_rep = error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR); # Function rewritten by Thomas Wiedmann to use phpSniff class # initialize some vars if (!isset($UA)) { $UA = ''; } if (!isset($cc)) { $cc = ''; } if (!isset($dl)) { $dl = ''; } if (!isset($am)) { $am = ''; } //$timer = new phpTimer(); //$timer->start('main'); //$timer->start('client1'); $sniffer_settings = array('check_cookies' => $cc, 'default_language' => $dl, 'allow_masquerading' => $am); $client = new phpSniff($UA, $sniffer_settings); # get phpSniff result $i = $client->get_property('ip'); $bv = $client->get_property('version'); $bn = $client->get_property('browser'); # translate some browsernames for "Care2x" if ($bn == 'moz') { $bn = 'mozilla'; } else { if ($bn == 'op') { $bn = 'opera'; } else { if ($bn == 'ns') { $bn = 'netscape'; } else { if ($bn == 'ie') { $bn = 'msie'; } } } } $uid = uniqid(''); $f = 'CFG' . $uid . microtime() . '.cfg'; # Return previous error reporting error_reporting($old_err_rep); }
function CmsEditSitellite_pageForm() { parent::MailForm(); $this->autosave = true; global $page, $cgi; loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"'; // include formhelp page_add_script(site_prefix() . '/js/formhelp-compressed.js'); page_add_script(' formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\'; formhelp_append = \'</td></tr></table>\'; function cms_preview_action (f) { cms_copy_values (f); return cms_preview (f); } function cms_cancel_action (f) { cms_copy_values (f); if (confirm (\'Are you sure you want to cancel?\')) { return cms_cancel (f); } return false; } function page_id () { f = document.forms[0]; if (f.elements[\'id\'].value.length == 0) { sugg_id = f.elements[\'title\'].value.toLowerCase (); sugg_id = sugg_id.replace (/[àáâäå]/g, \'a\'); sugg_id = sugg_id.replace (/[çč]/g, \'c\'); sugg_id = sugg_id.replace (/[éèêëě]/g, \'e\'); sugg_id = sugg_id.replace (/[íìîï]/g, \'i\'); sugg_id = sugg_id.replace (/[ñ]/g, \'n\'); sugg_id = sugg_id.replace (/[óòôöø]/g, \'o\'); sugg_id = sugg_id.replace (/[úùûüů]/g, \'u\'); sugg_id = sugg_id.replace (/[ÿ]/g, \'y\'); sugg_id = sugg_id.replace (/[š]/g, \'s\'); sugg_id = sugg_id.replace (/[ř]/g, \'r\'); sugg_id = sugg_id.replace (/[ž]/g, \'z\'); sugg_id = sugg_id.replace (/[ý]/g, \'y\'); sugg_id = sugg_id.replace (/[á]/g, \'a\'); sugg_id = sugg_id.replace (/[ť]/g, \'t\'); sugg_id = sugg_id.replace (/[í]/g, \'i\'); sugg_id = sugg_id.replace (/[ď]/g, \'d\'); sugg_id = sugg_id.replace (/[ň]/g, \'n\'); sugg_id = sugg_id.replace (/^[^a-z0-9_-]+/g, \'\'); sugg_id = sugg_id.replace (/[^a-z0-9_-]+$/g, \'\'); sugg_id = sugg_id.replace (/[^a-z0-9_-]+/g, \'-\'); sugg_id = sugg_id.replace (/-+/g, \'-\'); f.elements[\'id\'].value = sugg_id; } } function page_id_to_lower () { f = document.forms[0]; f.elements[\'id\'].value = f.elements[\'id\'].value.toLowerCase (); } '); if (session_pref('form_help') == 'off') { page_add_script(' formhelp_disable = true; '); } // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); // default: database, database $_document = $rex->getCurrent($cgi->_key); $w =& $this->addWidget('tab', 'tab1'); $w->title = intl_get('Edit'); // edit widgets go here $w =& $this->addWidget('hidden', '_key'); $w =& $this->addWidget('hidden', '_collection'); $w =& $this->addWidget('hidden', '_return'); $w =& $this->addWidget('text', 'title'); $w->alt = intl_get('Page Title'); //$w->addRule ('not empty', 'You must enter a title for your page.'); $help = addslashes(intl_get('The standard title of the web page, usually used in the content body as a top-level heading.')); $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide (); page_id ()"'; $w->setValue($_document->title); $w->length = 128; $w =& $this->addWidget('text', 'id'); $w->alt = intl_get('Page ID'); $w->addRule('not empty', 'You must enter an ID for your page.'); $w->addRule('not regex "[^a-zA-Z0-9_-]"', 'Your page ID contains invalid characters.'); $w->addRule('func "rex_unique_id_rule"', 'Your modified page ID already exists.'); $w->addRule('func "cms_rule_no_actions"', 'Your page ID cannot end in -action, -app, or -form.'); $help = addslashes(intl_get('The unique page identifier, used in the URL to request this page (ie. /index/page_id). Must contain only letters, numbers, dashes, and underscores (ie. product_info).')); $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide (); page_id_to_lower ()"'; $w->setValue($cgi->_key); $w->length = 72; $w =& $this->addWidget('text', 'nav_title'); $w->alt = intl_get('Title in Navigation'); $help = addslashes(intl_get('This allows you to specify an alternate title to use when linking to this page.')); $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $w->setValue($_document->nav_title); $w->length = 128; $w->advanced = true; $w =& $this->addWidget('text', 'head_title'); $w->alt = intl_get('Window Title'); $help = addslashes(intl_get('This allows you to specify an alternate title to use in the header of the document, which will appear in the top bar of the browser window.')); $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $w->setValue($_document->head_title); $w->length = 128; $w->advanced = true; $w =& $this->addWidget('xed.Widget.Xeditor', 'body'); if (appconf('tidy_path')) { $w->tidy_path = appconf('tidy_path'); } $w->addRule('not empty', 'You must enter content into your page body.'); $w->setValue($_document->body); //$w->length = 65535; // set page title if (empty($_document->title)) { page_title(intl_get('Editing Page') . ': ' . $_document->id); } else { page_title(intl_get('Editing Page') . ': ' . $_document->title); } $w =& $this->addWidget('tab', 'tab2'); $w->title = intl_get('Properties'); // property widgets go here $t =& $this->addWidget('section', 'section1'); $t->title = intl_get('Display Settings'); $t =& $this->addWidget('pagebrowser.Widget.Pagebrowser', 'below_page'); $t->alt = intl_get('Location in Web Site'); $t->setValue($_document->below_page); $help = addslashes(intl_get('Choose the page that this page should appear under in the hierarchy of the web site.')); $t->extra = 'id="below_page" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('cms.Widget.Templates', 'template'); $t->alt = intl_get('Display with Template'); $t->setValue($_document->template); $help = addslashes(intl_get('Choose which template you want this page to be displayed with. This changes the look and feel of the page.')); $t->extra = 'id="template" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('select', 'include'); $t->alt = intl_get('Include in Site Navigation?'); $t->setValues(array('yes' => 'Yes', 'no' => 'No')); $t->setValue($_document->include); $help = addslashes(intl_get('This determines whether or not you want the page to appear in the web site menus and site maps.')); $t->extra = 'id="include" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->advanced = true; $t =& $this->addWidget('select', 'include_in_search'); $t->alt = intl_get('Include in Search?'); $t->setValues(array('yes' => 'Yes', 'no' => 'No')); $t->setValue($_document->include_in_search); $help = addslashes(intl_get('This determines whether or not you want the page to be indexed to appear in search results.')); $t->extra = 'id="include_in_search" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->advanced = true; $t =& $this->addWidget('text', 'sort_weight'); $t->alt = intl_get('Sorting Weight'); $t->setValue($_document->sort_weight); $help = addslashes(intl_get('This determines the position of the page within the web site menus and site maps. Pages with a higher value appear closer to the top. Pages with the same value are sorted alphabetically.')); $t->extra = 'id="sort_weight" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->advanced = true; $t =& $this->addWidget('select', 'is_section'); $t->alt = intl_get('Is This a Section Index?'); $t->setValues(array('yes' => 'Yes', 'no' => 'No')); $t->setValue($_document->is_section); $help = addslashes(intl_get('If you make this page a section index, then pages below it will adopt its template settings if theirs is not specified explicitly. This allows you to give a consistent look and feel to entire sections of your web site.')); $t->extra = 'id="is_section" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->advanced = true; $t =& $this->addWidget('xed.Widget.Linker', 'external'); $t->alt = intl_get('Forward to (URL)'); $t->setValue($_document->external); $help = addslashes(intl_get('If you provide a link to an external web page or file (ie. a PDF or Word document), then this page can act as an alias for that resource within your web site navigation.')); $t->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t->length = 128; $t->advanced = true; $t->files = false; $t->anchors = false; $t->email = false; $t =& $this->addWidget('section', 'section3'); $t->title = intl_get('Page Attributes'); $t =& $this->addWidget('cms.Widget.Keywords', 'keywords'); $t->alt = intl_get('Keywords'); $t->setValue($_document->keywords); $help = addslashes(intl_get('Type in or select the keywords from the global list that describe the current page. Keywords help target your page to its intended audience in search engines and site searches.')); $t->extra = 'id="keywords" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('textarea', 'description'); $t->alt = intl_get('Description'); $t->setValue($_document->description); $t->rows = 3; $t->labelPosition = 'left'; $help = addslashes(intl_get('A description helps target your page to its intended audience in search engines and site searches performed by visitors.')); $t->extra = 'id="description" style="overflow: hidden" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $w =& $this->addWidget('tab', 'tab3'); $w->title = intl_get('State'); // state widgets go here $t =& $this->addWidget('status', 'sitellite_status'); $t->collection = 'sitellite_page'; $t->alt = intl_get('Status'); $t->setDefault('draft'); $t->setValue($_document->sitellite_status); $help = addslashes(intl_get('The status determines what stage of its lifecycle that your document is in. Only Approved pages can be viewed on the live site. Queued pages are set to be approved on the specified Publish On date (below) by the scheduler.')); $t->extra = 'id="sitellite_status" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('access', 'sitellite_access'); $t->alt = intl_get('Access Level'); $t->setValue($_document->sitellite_access); $help = addslashes(intl_get('The access level of a document determines who is allowed to view it. This allows you to make portions of your site completely private, or only available to specific user roles (ie. members-only).')); $t->extra = 'id="sitellite_access" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $t =& $this->addWidget('calendar', 'sitellite_startdate'); $t->alt = intl_get('Publish On (If Status is "Queued")'); $t->nullable = true; $t->showsTime = true; $t->format = '%Y-%m-%d %H:%M:%S'; $t->displayFormat = '%a, %e %b, %Y - %l:%M%P'; $t->setValue($_document->sitellite_startdate); $t->advanced = true; $t =& $this->addWidget('calendar', 'sitellite_expirydate'); $t->alt = intl_get('Archive On (If Status is "Approved")'); $t->nullable = true; $t->showsTime = true; $t->format = '%Y-%m-%d %H:%M:%S'; $t->displayFormat = '%a, %e %b, %Y - %l:%M%P'; $t->setValue($_document->sitellite_expirydate); $t->advanced = true; $t =& $this->addWidget('owner', 'sitellite_owner'); $t->alt = intl_get('Created By'); $t->setValue($_document->sitellite_owner); $t->advanced = true; $t =& $this->addWidget('team', 'sitellite_team'); $t->alt = intl_get('Owned by Team'); $t->setValue($_document->sitellite_team); $t->extra = 'id="sitellite_team"'; $t->advanced = true; $t =& $this->addWidget('textarea', 'changelog'); $t->alt = intl_get('Change Summary'); $t->rows = 3; $t->labelPosition = 'left'; $help = addslashes(intl_get('The change summary helps give other site editors, including yourself, a more complete history of the changes that have been made to this page.')); $t->extra = 'id="changelog" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"'; $w =& $this->addWidget('tab', 'tab-end'); // submit buttons $w =& $this->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Save')); $b->extra = 'onclick="onbeforeunload_form_submitted = true"'; $b =& $w->addButton('submit_button', intl_get('Preview')); $b->extra = 'onclick="return cms_preview (this.form)"'; $b =& $w->addButton('submit_button', intl_get('Cancel')); $b->extra = 'onclick="return cms_cancel_unlock (this.form, \'' . urlencode($cgi->_collection) . '\', \'' . urlencode($cgi->_key) . '\')"'; $this->error_mode = 'all'; }
function CmsEditSitellite_filesystemForm() { parent::MailForm(); $this->autosave = true; $this->parseSettings('inc/app/cms/forms/edit/sitellite_filesystem/settings.php'); global $page, $cgi; page_title(intl_get('Editing File') . ': ' . $cgi->_key); loader_import('ext.phpsniff'); $sniffer = new phpSniff(); $this->_browser = $sniffer->property('browser'); // include formhelp, edit panel init, and cancel handler page_add_script(site_prefix() . '/js/formhelp-compressed.js'); page_add_script(CMS_JS_FORMHELP_INIT); page_add_script(' function cms_cancel_unlock (f, collection, key) { onbeforeunload_form_submitted = true; if (arguments.length == 0) { window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=' . site_prefix() . '/index/cms-app"; } else { if (f.elements[\'_return\'] && f.elements[\'_return\'].value.length > 0) { window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=" + f.elements[\'_return\'].value; } else { window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=' . site_prefix() . '/index/news-app"; } } return false; } function cms_preview_action (f) { cms_copy_values (f); return cms_preview (f); } function cms_cancel_action (f) { cms_copy_values (f); if (confirm (\'Are you sure you want to cancel?\')) { return cms_cancel (f); } return false; } '); if (session_pref('form_help') == 'off') { page_add_script(' formhelp_disable = true; '); } // add cancel handler $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel_unlock (this.form, \'' . $cgi->_collection . '\', \'' . $cgi->_key . '\')"'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); $_document = $rex->getCurrent($cgi->_key); // set values from repository entry $info = pathinfo($_document->name); if ($info['dirname'] == '.') { $info['dirname'] = ''; } $_document->folder = $info['dirname']; $_document->file = $_document->name; unset($_document->name); foreach (get_object_vars($_document) as $k => $v) { if (is_object($this->widgets[$k])) { $this->widgets[$k]->setValue($v); } } /*if ($rex->determineAction ($cgi->_key) != 'modify') { // turn name field into hidden w/ _key's value $this->widgets['name'] =& $this->widgets['name']->changeType ('info'); $this->widgets['name']->setValue (basename ($cgi->_key)); $this->widgets['folder'] =& $this->widgets['folder']->changeType ('info'); $this->widgets['folder']->setValue (dirname ($cgi->_key)); }*/ }
$GET_VARS = isset($_GET) ? $_GET : $HTTP_GET_VARS; $POST_VARS = isset($_POST) ? $_GET : $HTTP_POST_VARS; if (!isset($GET_VARS['UA'])) { $GET_VARS['UA'] = ''; } if (!isset($GET_VARS['cc'])) { $GET_VARS['cc'] = ''; } if (!isset($GET_VARS['dl'])) { $GET_VARS['dl'] = ''; } if (!isset($GET_VARS['am'])) { $GET_VARS['am'] = ''; } $sniffer_settings = array('check_cookies' => $GET_VARS['cc'], 'default_language' => $GET_VARS['dl'], 'allow_masquerading' => $GET_VARS['am']); $client = new phpSniff($GET_VARS['UA'], $sniffer_settings); $client->get_property('UA'); if (isset($_GET['showbrowser']) && $_GET['showbrowser'] == 1) { ?> Browser: <?php print $client->property('browser'); ?> <br /> longname: <?php print $client->property('long_name'); ?> <br /> version: <?php print $client->property('version'); ?> <br />
<?php // browser check loader_import('ext.phpsniff'); $sniff = new phpSniff(); $supported = false; if ($sniff->property('platform') == 'win' && $sniff->property('browser') == 'ie' && version_compare($sniff->property('version'), '5.5', '>=')) { $supported = true; } elseif ($sniff->property('browser') == 'mz' && version_compare($sniff->property('version'), '1.3', '>=')) { $supported = true; } elseif ($sniff->property('browser') == 'ns' && version_compare($sniff->property('version'), '5.0', '>=')) { $supported = true; } elseif ($sniff->property('browser') == 'ca' && version_compare($sniff->property('version'), '1.0', '>=')) { $supported = true; } elseif ($sniff->property('browser') == 'sf' && version_compare($sniff->property('version'), '522', '>=')) { $supported = true; //} elseif ($sniff->property ('browser') == 'op' && version_compare ($sniff->property ('version'), '9', '>=')) { // $supported = true; } elseif (strpos($sniff->property('ua'), 'adobeair')) { $supported = true; /*} elseif ($sniff->property ('browser') == 'fb' && version_compare ($sniff->property ('version'), '0.7', '>=')) { $supported = true;*/ } if (!$supported) { // not compatible page_title(intl_get('Unsupported Browser')); echo '<p>' . intl_get('The browser you are using does not support the required features necessary to use') . ' ' . PRODUCT_SHORTNAME . '</p>'; echo '<p>' . intl_get('Please use one of the following browsers to access this software') . ':</p>'; echo '<ul> <li><a href="http://www.mozilla.org/" target="_blank">Mozilla</a>, version 1.3 or greater</li> <li><a href="http://channels.netscape.com/ns/browsers/download.jsp" target="_blank">Netscape</a>, version 7.1 or greater</li>
/** * Returns the display HTML for this widget. The optional * parameter determines whether or not to automatically display the widget * nicely, or whether to simply return the widget (for use in a template). * * @access public * @param boolean $generate_html * @return string * */ function display($generate_html = 0) { global $simple; $this->options_formatted = ''; foreach ($this->options as $k => $v) { $this->options_formatted .= $k . '=' . $v . ';'; } // this next line relies on a properly configured browscap.ini file, // which can be found at http://www.cyscape.com/browscap/ global $loader, $intl; $loader->import('saf.Ext.phpsniff'); $ua = new phpSniff(); if ($ua->property('browser') == 'ie' && $ua->property('platform') == 'win' && $ua->property('version') >= '5.5') { if ($generate_html) { return "\t" . '<tr>' . "\n\t\t" . '<td colspan="2" class="label"><label for="' . $this->name . '"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t" . '</tr>' . "\n\t" . '<tr>' . "\n\t\t" . '<td colspan="2" class="field"><textarea name="' . $this->name . '" ' . $this->extra . ' style="display:none">' . htmlentities($this->data_value) . '</textarea>' . '<object id="rt_' . $this->name . '" style="BACKGROUND-COLOR: buttonface" data="' . $this->directory . '/richedit.html" width="' . $this->width . '" height="' . $this->height . '" type="text/x-scriptlet" VIEWASTEXT></object></td>' . "\n\t" . '</tr>' . $simple->fill($this->js, $this) . "\n"; } else { return '<textarea name="' . $this->name . '" ' . $this->extra . ' style="display:none">' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '</textarea>' . '<object id="rt_' . $this->name . '" style="BACKGROUND-COLOR: buttonface" data="' . $this->directory . '/richedit.html" width="' . $this->width . '" height="' . $this->height . '" type="text/x-scriptlet" VIEWASTEXT></object>' . $simple->fill($this->js, $this); } } else { if ($this->cols == '') { $this->cols = 40; } if ($this->rows == '') { $this->rows = 8; } if ($generate_html) { return "\t" . '<tr>' . "\n\t\t" . '<td colspan="2" class="label"><label for="' . $this->name . '"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t" . '</tr>' . "\n\t" . '<tr>' . "\n\t\t" . '<td colspan="2" class="field"><textarea name="' . $this->name . '" rows="' . $this->rows . '" cols="' . $this->cols . '" ' . $this->extra . ' >' . htmlentities($this->data_value) . '</textarea></td>' . "\n\t" . '</tr>' . "\n"; } else { return '<textarea name="' . $this->name . '" rows="' . $this->rows . '" cols="' . $this->cols . '" ' . $this->extra . ' >' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '</textarea>'; } } }
function display($generate_html = 0) { parent::display($generate_html); global $intl, $simple, $cgi; // needs browser check to display textarea as alternative $this->initial_value = $this->formatValue($this->data_value); $this->scroller_data = $this->formatValue($this->scroller_data); if ($this->reference !== false) { if (empty($this->reference)) { $this->reference = '<br />'; } $this->reference = $this->formatValue($this->reference); } loader_import('ext.phpsniff'); $ua = new phpSniff(); if ($ua->property('browser') == 'ie' && $ua->property('platform') == 'win' && $ua->property('version') >= '5.5' || $ua->property('browser') == 'mz' && $ua->property('version') >= '1.3' || $ua->property('browser') == 'ns' && $ua->property('version') >= '5.0' || $ua->property('browser') == 'fb' && $ua->property('version') >= '0.7' || $ua->property('browser') == 'ca' && $ua->property('version') >= '1.0' || $ua->property('browser') == 'sf' && $ua->property('version') >= '522' || strpos($ua->property('ua'), 'adobeair')) { // go xed if ($ua->property('browser') == 'ie') { $this->msie = true; if ($ua->property('version') >= '7.0') { $this->msie7 = 'true'; } } if ($ua->property('browser') == 'sf') { $this->safari = 'true'; } elseif (strpos($ua->property('ua'), 'adobeair')) { $this->safari = 'true'; $this->adobeair = 'true'; } if (@file_exists('inc/html/' . conf('Server', 'default_template_set') . '/images.php')) { if ($cgi->_collection) { $collection = $cgi->_collection; } elseif ($cgi->collection) { $collection = $cgi->collection; } else { $collection = false; } if ($collection) { $images = ini_parse('inc/html/' . conf('Server', 'default_template_set') . '/images.php'); if (isset($images[$collection])) { $this->max_height = $images[$collection]['max_height']; $this->max_width = $images[$collection]['max_width']; if ($images[$collection]['popup']) { $this->img_popup = 'true'; } else { $this->img_popup = 'false'; } } else { $this->max_height = 'false'; $this->max_width = 'false'; $this->img_popup = 'false'; } } else { $this->max_height = 'false'; $this->max_width = 'false'; $this->img_popup = 'false'; } } else { $this->max_height = 'false'; $this->max_width = 'false'; $this->img_popup = 'false'; } // initialize modal dialog event handlers page_onload('xed_init (\'' . $this->name . '\')'); page_onclick('checkModal ()'); page_onfocus('return checkModal ()'); template_bind('/html/body', ' <form style="display: inline" id="xed-' . $this->name . '-fsform" method="post" action="' . site_prefix() . '/index/xed-fullscreen-form" target="xedFullscreenWindow"> <input type="hidden" name="ifname" value="' . $this->name . '" /> <input type="hidden" name="xeditor" value="" /> </form>'); $this->templates = db_fetch_array('select * from xed_templates'); foreach ($this->templates as $k => $t) { $this->templates[$k]->body = $this->formatValue($t->body); } $this->source_height = $this->height + 2; loader_import('saf.GUI.Prompt'); $template = join('', file('inc/app/xed/html/xed.spt')); return template_simple($template, $this); } else { // return a textarea return '<tr><td class="field" colspan="2"><textarea name="' . $this->name . '" cols="50" rows="10">' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '</textarea></td></tr>'; } }