本文整理汇总了PHP中FWValidator::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP FWValidator::getUrl方法的具体用法?PHP FWValidator::getUrl怎么用?PHP FWValidator::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWValidator
的用法示例。
在下文中一共展示了FWValidator::getUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchSubmittedData
private function fetchSubmittedData()
{
// set default values
$data['newsText'] = '';
$data['newsTeaserText'] = '';
$data['newsTitle'] = '';
$data['newsRedirect'] = 'http://';
$data['newsSource'] = 'http://';
$data['newsUrl1'] = 'http://';
$data['newsUrl2'] = 'http://';
$data['newsCat'] = '';
$data['newsType'] = '';
$data['newsTypeRedirect'] = 0;
if (!isset($_POST['submitNews'])) {
return array(false, $data);
}
$objValidator = new \FWValidator();
// set POST data
$data['newsTitle'] = contrexx_input2raw(html_entity_decode($_POST['newsTitle'], ENT_QUOTES, CONTREXX_CHARSET));
$data['newsTeaserText'] = contrexx_input2raw(html_entity_decode($_POST['newsTeaserText'], ENT_QUOTES, CONTREXX_CHARSET));
$data['newsRedirect'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsRedirect'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsText'] = contrexx_remove_script_tags($this->filterBodyTag(contrexx_input2raw(html_entity_decode($_POST['newsText'], ENT_QUOTES, CONTREXX_CHARSET))));
$data['newsSource'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsSource'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsUrl1'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsUrl1'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsUrl2'] = $objValidator->getUrl(contrexx_input2raw(html_entity_decode($_POST['newsUrl2'], ENT_QUOTES, CONTREXX_CHARSET)));
$data['newsCat'] = !empty($_POST['newsCat']) ? contrexx_input2raw($_POST['newsCat']) : array();
$data['newsType'] = !empty($_POST['newsType']) ? intval($_POST['newsType']) : 0;
$data['newsTypeRedirect'] = !empty($_POST['newsTypeRedirect']) ? true : false;
$data['enableRelatedNews'] = !empty($this->arrSettings['use_related_news']) ? 1 : 0;
$data['relatedNews'] = !empty($_POST['relatedNews']) ? contrexx_input2raw($_POST['relatedNews']) : array();
$data['enableTags'] = !empty($this->arrSettings['news_use_tags']) ? 1 : 0;
$data['newsTags'] = !empty($_POST['newsTags']) ? contrexx_input2raw($_POST['newsTags']) : array();
return array(true, $data);
}
示例2: setWebsite
public function setWebsite($website)
{
$this->website = \FWValidator::getUrl($website);
}
示例3: parseRegistrationPlaceholders
/**
* Parse the registration related palceholders
* $hostUri and $hostTarget should be set before calling this method
*
* @param \Cx\Core\Html\Sigma $objTpl Template instance
* @param \Cx\Modules\Calendar\Controller\CalendarEvent $event Event instance
* @param string $hostUri Host uri of the event(internal/external)
* @param string $hostTarget Host uri target type (_blank/null)
*
* @return null
*/
public function parseRegistrationPlaceholders(\Cx\Core\Html\Sigma $objTpl, CalendarEvent $event, $hostUri = '', $hostTarget = '')
{
global $_ARRAYLANG;
$numRegistrations = contrexx_input2int($event->getRegistrationCount());
$numDeregistration = contrexx_input2int($event->getCancellationCount());
$objEscortManager = new \Cx\Modules\Calendar\Controller\CalendarRegistrationManager($event, true, false);
$objTpl->setVariable(array($this->moduleLangVar . '_EVENT_COUNT_REG' => $numRegistrations, $this->moduleLangVar . '_EVENT_COUNT_SIGNOFF' => $numDeregistration, $this->moduleLangVar . '_EVENT_COUNT_SUBSCRIBER' => $objEscortManager->getEscortData(), $this->moduleLangVar . '_REGISTRATIONS_SUBSCRIBER' => $event->numSubscriber));
// Only link to registration form if event registration is set up and event lies in the future
if (!$event->registration || time() > $event->startDate->getTimestamp()) {
$objTpl->hideBlock('calendarEventRegistration');
return;
}
// Only show registration form if event accepts registrations.
// Event accepts registrations, if
// - no attendee limit is set
// - or if there are still free places available
$registrationOpen = true;
$regLinkTarget = '_self';
if ($event->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL && !$event->registrationExternalFullyBooked || $event->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && (empty($event->numSubscriber) || !\FWValidator::isEmpty($event->getFreePlaces()))) {
if ($event->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL) {
$regLinkSrc = \FWValidator::getUrl($event->registrationExternalLink);
$regLinkTarget = '_blank';
} elseif ($hostUri) {
$regLinkSrc = $hostUri . '/' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '&cmd=register&id=' . $event->id . '&date=' . $event->startDate->getTimestamp();
} else {
$params = array('id' => $event->id, 'date' => $event->startDate->getTimestamp());
$regLinkSrc = \Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, 'register', FRONTEND_LANG_ID, $params)->toString();
}
$regLink = '<a href="' . $regLinkSrc . '" ' . $hostTarget . '>' . $_ARRAYLANG['TXT_CALENDAR_REGISTRATION'] . '</a>';
} else {
$regLink = '<i>' . $_ARRAYLANG['TXT_CALENDAR_EVENT_FULLY_BLOCKED'] . '</i>';
$regLinkSrc = '';
$registrationOpen = false;
}
$objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_LINK' => $regLink, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_SRC' => $regLinkSrc, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_TARGET' => $regLinkTarget));
if ($objTpl->blockExists('calendarEventRegistrationOpen')) {
if ($registrationOpen) {
$objTpl->touchBlock('calendarEventRegistrationOpen');
} else {
$objTpl->hideBlock('calendarEventRegistrationOpen');
}
}
if ($objTpl->blockExists('calendarEventRegistrationClosed')) {
if (!$registrationOpen) {
$objTpl->touchBlock('calendarEventRegistrationClosed');
} else {
$objTpl->hideBlock('calendarEventRegistrationClosed');
}
}
$objTpl->parse('calendarEventRegistration');
}
示例4: updateNetwork
/**
* Updates the values for an existing network.
*
* @global ADONewConnection
* @global array
*/
function updateNetwork()
{
global $objDatabase, $_ARRAYLANG;
$intNetworkId = intval($_POST['frmEditNetwork_Id']);
$strName = contrexx_addslashes($_POST['frmEditNetwork_Name']);
$strWWW = contrexx_addslashes($_POST['frmEditNetwork_WWW']);
$strSubmitUrl = contrexx_addslashes($_POST['frmEditNetwork_SubmitUrl']);
$strIcon = contrexx_addslashes($_POST['frmEditNetwork_Icon']);
$arrLanguages = $_POST['frmAddNetwork_Languages'];
if ($intNetworkId > 0 && !empty($strName) && !empty($strSubmitUrl)) {
$objValidator = new \FWValidator();
$strWWW = $objValidator->getUrl($strWWW);
$strSubmitUrl = $objValidator->getUrl($strSubmitUrl);
$objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_blog_networks
SET name="' . $strName . '",
url="' . $strWWW . '",
url_link="' . $strSubmitUrl . '",
icon="' . $strIcon . '"
WHERE network_id=' . $intNetworkId . '
LIMIT 1
');
$objDatabase->Execute(' DELETE
FROM ' . DBPREFIX . 'module_blog_networks_lang
WHERE `network_id` = ' . $intNetworkId . '
');
if (is_array($arrLanguages) && count($arrLanguages) > 0) {
foreach ($arrLanguages as $intLanguageId) {
$objDatabase->Execute(' INSERT
INTO ' . DBPREFIX . 'module_blog_networks_lang
SET network_id=' . $intNetworkId . ',
lang_id=' . $intLanguageId . '
');
}
}
$this->_strOkMessage = $_ARRAYLANG['TXT_BLOG_NETWORKS_UPDATE_SUCCESSFULL'];
} else {
$this->_strErrMessage = $_ARRAYLANG['TXT_BLOG_NETWORKS_UPDATE_ERROR'];
}
}
示例5: update
/**
* Update news
*
* @global ADONewConnection
* @global array
* @global array
* @param integer $newsid
* @return boolean result
*/
function update()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
if (!$this->hasCategories()) {
return $this->manageCategories();
}
if (isset($_POST['newsId'])) {
$objFWUser = \FWUser::getFWUserObject();
$id = intval($_POST['newsId']);
$userId = $objFWUser->objUser->getId();
$changelog = mktime();
$date = $this->dateFromInput($_POST['newsDate']);
$redirect = !empty($_POST['newsRedirect']) && $_POST['newsTypeRadio'] == 'redirect' ? contrexx_strip_tags($_POST['newsRedirect']) : '';
$source = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsSource']));
$url1 = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsUrl1']));
$url2 = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsUrl2']));
$newsPublisherName = !empty($_POST['newsPublisherName']) ? contrexx_input2raw($_POST['newsPublisherName']) : '';
$newsAuthorName = !empty($_POST['newsAuthorName']) ? contrexx_input2raw($_POST['newsAuthorName']) : '';
$newsPublisherId = !empty($_POST['newsPublisherId']) ? contrexx_input2raw($_POST['newsPublisherId']) : '0';
$newsAuthorId = !empty($_POST['newsAuthorId']) ? contrexx_input2raw($_POST['newsAuthorId']) : '0';
$newsCategories = !empty($_POST['newsCat']) ? contrexx_input2raw($_POST['newsCat']) : array();
$typeId = !empty($_POST['newsType']) ? intval($_POST['newsType']) : 0;
$newsScheduledActive = !empty($_POST['newsScheduled']) ? intval($_POST['newsScheduled']) : 0;
$status = empty($_POST['status']) ? $status = 0 : intval($_POST['status']);
$newsTeaserOnly = isset($_POST['newsUseOnlyTeaser']) ? intval($_POST['newsUseOnlyTeaser']) : 0;
$newsTeaserShowLink = isset($_POST['newsTeaserShowLink']) ? intval($_POST['newsTeaserShowLink']) : 0;
$newsTeaserImagePath = contrexx_addslashes($_POST['newsTeaserImagePath']);
$newsTeaserImageThumbnailPath = contrexx_addslashes($_POST['newsTeaserImageThumbnailPath']);
$newsTeaserFrames = '';
$newsComments = !empty($_POST['allowComment']) ? intval($_POST['allowComment']) : 0;
if (isset($_POST['newsTeaserFramesAsso']) && count($_POST['newsTeaserFramesAsso']) > 0) {
foreach ($_POST['newsTeaserFramesAsso'] as $frameId) {
intval($frameId) > 0 ? $newsTeaserFrames .= ';' . intval($frameId) : false;
}
}
$startDate = $this->dateFromInput($_POST['startDate']);
$endDate = $this->dateFromInput($_POST['endDate']);
$newsFrontendAccess = !empty($_POST['news_read_access']);
$newsFrontendGroups = $newsFrontendAccess && isset($_POST['news_read_access_associated_groups']) && is_array($_POST['news_read_access_associated_groups']) ? array_map('intval', $_POST['news_read_access_associated_groups']) : array();
$newsBackendAccess = !empty($_POST['news_modify_access']);
$newsBackendGroups = $newsBackendAccess && isset($_POST['news_modify_access_associated_groups']) && is_array($_POST['news_modify_access_associated_groups']) ? array_map('intval', $_POST['news_modify_access_associated_groups']) : array();
$objResult = $objDatabase->SelectLimit('SELECT `frontend_access_id`, `backend_access_id`, `userid` FROM `' . DBPREFIX . 'module_news` WHERE `id` = ' . $id, 1);
if ($objResult && $objResult->RecordCount() == 1) {
$newsFrontendAccessId = $objResult->fields['frontend_access_id'];
$newsBackendAccessId = $objResult->fields['backend_access_id'];
$newsUserId = $objResult->fields['userid'];
} else {
$newsFrontendAccessId = 0;
$newsBackendAccessId = 0;
$newsUserId = 0;
}
if ($this->arrSettings['news_message_protection'] == '1') {
if ($newsBackendAccessId && !\Permission::hasAllAccess() && !\Permission::checkAccess($newsBackendAccessId, 'dynamic', true) && $newsUserId != $objFWUser->objUser->getId()) {
return false;
}
if ($newsFrontendAccess) {
if ($newsFrontendAccessId) {
$objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $newsFrontendAccessId));
$arrFormerFrontendGroupIds = $objGroup ? $objGroup->getLoadedGroupIds() : array();
$arrNewGroups = array_diff($newsFrontendGroups, $arrFormerFrontendGroupIds);
$arrRemovedGroups = array_diff($arrFormerFrontendGroupIds, $newsFrontendGroups);
if ($this->arrSettings['news_message_protection_restricted'] == '1' && !\Permission::hasAllAccess()) {
$arrUserGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
$arrUnknownNewGroups = array_diff($arrNewGroups, $arrUserGroupIds);
foreach ($arrUnknownNewGroups as $groupId) {
if (!in_array($groupId, $arrFormerFrontendGroupIds)) {
unset($arrNewGroups[array_search($groupId, $arrNewGroups)]);
}
}
$arrUnknownRemovedGroups = array_diff($arrRemovedGroups, $arrUserGroupIds);
foreach ($arrUnknownRemovedGroups as $groupId) {
if (in_array($groupId, $arrFormerFrontendGroupIds)) {
unset($arrRemovedGroups[array_search($groupId, $arrRemovedGroups)]);
}
}
}
if (count($arrRemovedGroups)) {
\Permission::removeAccess($newsFrontendAccessId, 'dynamic', $arrRemovedGroups);
}
if (count($arrNewGroups)) {
\Permission::setAccess($newsFrontendAccessId, 'dynamic', $arrNewGroups);
}
} else {
if ($this->arrSettings['news_message_protection_restricted'] == '1' && !\Permission::hasAllAccess()) {
$arrUserGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
$newsFrontendGroups = array_intersect($newsFrontendGroups, $arrUserGroupIds);
}
$newsFrontendAccessId = \Permission::createNewDynamicAccessId();
if (count($newsFrontendGroups)) {
\Permission::setAccess($newsFrontendAccessId, 'dynamic', $newsFrontendGroups);
}
//.........这里部分代码省略.........
示例6: addComment
/**
* Insert a new comment for a message into database, if the function is activated. Furthermore, all input values are validated.
* Sends also the notification mail to the administrator, if it is enabled in options.
*
* @global ADONewConnection
* @global array
* @global array
*/
function addComment()
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
\Cx\Core\Csrf\Controller\Csrf::check_code();
$this->initUserId();
//Check for activated function
if (!$this->_arrSettings['blog_comments_activated']) {
$this->_strErrorMessage = $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_ERROR_ACTIVATED'];
return;
}
if ($this->hasUserJustCommented()) {
$this->_strErrorMessage = str_replace('[SECONDS]', intval($this->_arrSettings['blog_comments_timeout']), $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_ERROR_TIMEOUT']);
return;
}
//Create validator-object
$objValidator = new \FWValidator();
//Get general-input
$intMessageId = intval($_POST['frmAddComment_MessageId']);
$strSubject = contrexx_addslashes(strip_tags($_POST['frmAddComment_Subject']));
$strComment = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForDb($_POST['frmAddComment_Comment']);
//Get specified-input
if ($this->_intCurrentUserId == 0) {
$intUserId = 0;
$strName = contrexx_addslashes(strip_tags($_POST['frmAddComment_Name']));
$strEMail = contrexx_addslashes(strip_tags($_POST['frmAddComment_EMail']));
$strWWW = contrexx_addslashes(strip_tags($objValidator->getUrl($_POST['frmAddComment_WWW'])));
} else {
$intUserId = $this->_intCurrentUserId;
$strName = '';
$strEMail = '';
$strWWW = '';
}
//Get options
$intIsActive = intval($this->_arrSettings['blog_comments_autoactivate']);
$intIsNotification = intval($this->_arrSettings['blog_comments_notification']);
//Validate general-input
if ($intMessageId <= 0) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_MID']);
}
if (empty($strSubject)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_SUBJECT']);
}
if (empty($strComment)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_COMMENT']);
}
//Validate specified-input
if ($this->_intCurrentUserId == 0) {
if (empty($strName)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_NAME']);
}
if (!$objValidator->isEmail($strEMail)) {
$this->_strErrorMessage .= $this->getFormError($_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_EMAIL']);
}
}
$captchaCheck = true;
if (!\FWUser::getFWUserObject()->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
$captchaCheck = false;
}
//Now check error-string
if (empty($this->_strErrorMessage) && $captchaCheck) {
//No errors, insert entry
$objDatabase->Execute(' INSERT INTO ' . DBPREFIX . 'module_blog_comments
SET message_id = ' . $intMessageId . ',
lang_id = ' . $this->_intLanguageId . ',
is_active = "' . $intIsActive . '",
time_created = ' . time() . ',
ip_address = "' . $_SERVER['REMOTE_ADDR'] . '",
user_id = ' . $intUserId . ',
user_name = "' . $strName . '",
user_mail = "' . $strEMail . '",
user_www = "' . $strWWW . '",
subject = "' . $strSubject . '",
comment = "' . $strComment . '"
');
//Set a cookie with the current timestamp. Avoids flooding.
setcookie('BlogCommentLast', time(), 0, ASCMS_PATH_OFFSET . '/');
$this->_strStatusMessage = $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_INSERT_SUCCESS'];
$this->writeCommentRSS();
if ($intIsNotification) {
//Send notification to administrator
if (\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) {
$objMail = new \phpmailer();
if ($_CONFIG['coreSmtpServer'] > 0) {
if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
$objMail->IsSMTP();
$objMail->Host = $arrSmtp['hostname'];
$objMail->Port = $arrSmtp['port'];
$objMail->SMTPAuth = true;
$objMail->Username = $arrSmtp['username'];
$objMail->Password = $arrSmtp['password'];
}
}
//.........这里部分代码省略.........
示例7: store
/**
* Stores a Manufacturer
* @param string $name The Manufacturer name
* @param string $url The Manufacturer URL
* @param integer $id The optional Manufacturer ID
* @return boolean True on success, false otherwise
* @static
*
*/
static function store($name, $url, $id = null)
{
global $objDatabase, $_ARRAYLANG;
// Make sure that only a valid URL is stored
if ($url != '') {
$url = \FWValidator::getUrl($url);
if (!\FWValidator::isUri($url)) {
return \Message::error($_ARRAYLANG['TXT_SHOP_MANUFACTURER_ERROR_URL_INVALID']);
}
}
if (self::record_exists($id)) {
return self::update($name, $url, $id);
}
return self::insert($name, $url);
}