本文整理汇总了PHP中FWValidator::isUri方法的典型用法代码示例。如果您正苦于以下问题:PHP FWValidator::isUri方法的具体用法?PHP FWValidator::isUri怎么用?PHP FWValidator::isUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWValidator
的用法示例。
在下文中一共展示了FWValidator::isUri方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSources
public function setSources(array $sources, array $sourceNames = null)
{
foreach ($sources as $langId => $source) {
if ($this->type == 'url') {
$source = \FWValidator::getUrl($source);
if (preg_match('#^[a-z]+://([^/]+)#i', $source, $arrMatch)) {
$this->source_names[$langId] = $arrMatch[1];
} else {
$this->source_names[$langId] = $source;
}
$this->fileTypes[$langId] = \FWValidator::isUri($source) ? 'HTML' : null;
} else {
$this->fileTypes[$langId] = pathinfo($source, PATHINFO_EXTENSION);
$this->source_names[$langId] = isset($sourceNames[$langId]) ? $sourceNames[$langId] : basename($source);
}
// set source of interface language
if ($langId == LANG_ID) {
$this->source = $source;
$this->source_name = $this->source_names[$langId];
$this->fileType = $this->fileTypes[$langId];
}
}
$this->sources = $sources;
}
示例2: saveCam
/**
* Save the cam's settings
*
*/
function saveCam()
{
global $objDatabase;
$id = intval($_POST['id']);
if (!$id) {
return false;
}
$currentImagePath = \Cx\Lib\FileSystem\FileSystem::sanitizePath(contrexx_input2raw($_POST['currentImagePath']));
if (!\FWValidator::isUri($currentImagePath) && strpos($currentImagePath, '/') !== 0) {
$currentImagePath = '/' . $currentImagePath;
}
$maxImageWidth = intval($_POST['maxImageWidth']);
$archivePath = \Cx\Lib\FileSystem\FileSystem::sanitizePath(contrexx_input2raw($_POST['archivePath']));
if (!\FWValidator::isUri($archivePath) && strpos($archivePath, '/') !== 0) {
$archivePath = '/' . $archivePath;
}
$thumbnailPath = \Cx\Lib\FileSystem\FileSystem::sanitizePath(contrexx_input2raw($_POST['thumbnailPath']));
if (!\FWValidator::isUri($thumbnailPath) && strpos($thumbnailPath, '/') !== 0) {
$thumbnailPath = '/' . $thumbnailPath;
}
$thumbMaxSize = intval($_POST['thumbMaxSize']);
$shadowboxActivate = intval($_POST['shadowboxActivate']);
$hourFrom = intval($_POST['hourFrom']);
$hourTill = intval($_POST['hourTill']);
$minuteFrom = intval($_POST['minuteFrom']);
$minuteTill = intval($_POST['minuteTill']);
$showFrom = mktime($hourFrom, $minuteFrom);
$showTill = mktime($hourTill, $minuteTill);
$query = " UPDATE " . DBPREFIX . "module_livecam\n SET currentImagePath = '" . contrexx_raw2db($currentImagePath) . "',\n maxImageWidth = " . $maxImageWidth . ",\n archivePath = '" . contrexx_raw2db($archivePath) . "',\n thumbnailPath = '" . contrexx_raw2db($thumbnailPath) . "',\n thumbMaxSize = " . $thumbMaxSize . ",\n shadowboxActivate = '" . $shadowboxActivate . "',\n showFrom = {$showFrom},\n showTill = {$showTill}\n WHERE id = " . $id;
if ($objDatabase->Execute($query) === false) {
// return a 500 or so
header("HTTP/1.0 500 Internal Server Error");
die;
}
die;
}
示例3: getDetails
//.........这里部分代码省略.........
if (strlen($strSource) > 40) {
$strSource = substr($strSource, 0, 26) . '...' . substr($strSource, strrpos($strSource, '.'));
}
$newsSource = $_ARRAYLANG['TXT_NEWS_SOURCE'] . '<br /><a target="_blank" href="' . $sourceHref . '" title="' . $source . '">' . $strSource . '</a><br />';
}
if (!empty($lastUpdate)) {
$newsLastUpdate = $_ARRAYLANG['TXT_LAST_UPDATE'] . '<br />' . date(ASCMS_DATE_FORMAT, $objResult->fields['changelog']);
}
$this->newsTitle = $objResult->fields['title'];
$newstitle = $this->newsTitle;
$newsTeaser = nl2br($objResult->fields['teaser_text']);
\LinkGenerator::parseTemplate($newsTeaser);
$objSubResult = $objDatabase->Execute('SELECT count(`id`) AS `countComments` FROM `' . DBPREFIX . 'module_news_comments` WHERE `newsid` = ' . $newsid);
//Get the Category list
$newsCategories = $this->getCategoriesByNewsId($newsid);
if (!empty($newsCategories) && $this->_objTpl->blockExists('news_category_list')) {
foreach ($newsCategories as $catId => $catTitle) {
$this->_objTpl->setVariable(array('NEWS_CATEGORY_TITLE' => contrexx_raw2xhtml($catTitle), 'NEWS_CATEGORY_ID' => contrexx_input2int($catId)));
$this->_objTpl->parse('news_category');
}
}
$this->_objTpl->setVariable(array('NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => $newstitle, 'NEWS_TEASER_TEXT' => $newsTeaser, 'NEWS_LASTUPDATE' => $newsLastUpdate, 'NEWS_SOURCE' => $newsSource, 'NEWS_URL' => $newsUrl, 'NEWS_CATEGORY_NAME' => implode(', ', contrexx_raw2xhtml($newsCategories)), 'NEWS_COUNT_COMMENTS' => $newsCommentActive && $this->arrSettings['news_comments_activated'] ? contrexx_raw2xhtml($objSubResult->fields['countComments'] . ' ' . $_ARRAYLANG['TXT_NEWS_COMMENTS']) : ''));
if (!$newsCommentActive || !$this->arrSettings['news_comments_activated']) {
if ($this->_objTpl->blockExists('news_comments_count')) {
$this->_objTpl->hideBlock('news_comments_count');
}
}
if ($this->arrSettings['news_use_teaser_text'] != '1' && $this->_objTpl->blockExists('news_use_teaser_text')) {
$this->_objTpl->hideBlock('news_use_teaser_text');
}
// parse author
self::parseUserAccountData($this->_objTpl, $objResult->fields['authorid'], $objResult->fields['author'], 'news_author');
// parse publisher
self::parseUserAccountData($this->_objTpl, $objResult->fields['publisherid'], $objResult->fields['publisher'], 'news_publisher');
// show comments
$this->parseMessageCommentForm($newsid, $newstitle, $newsCommentActive);
$this->parseCommentsOfMessage($newsid, $newsCommentActive);
// Show related_messages
$this->parseRelatedMessagesOfMessage($newsid, 'category', array_keys($newsCategories));
$this->parseRelatedMessagesOfMessage($newsid, 'type', $objResult->fields['typeid']);
$this->parseRelatedMessagesOfMessage($newsid, 'publisher', $objResult->fields['publisherid']);
$this->parseRelatedMessagesOfMessage($newsid, 'author', $objResult->fields['authorid']);
/*
* save the teaser text.
* purpose of this: @link news::getTeaser()
*/
$this->_teaser = contrexx_raw2xhtml($newsTeaser);
if (!empty($this->arrSettings['news_use_tags']) && !empty($objResult->fields['enableTags'])) {
$this->parseNewsTags($this->_objTpl, $newsid);
}
if (!empty($this->arrSettings['use_related_news']) && !empty($objResult->fields['enableRelatedNews'])) {
$this->parseRelatedNews($this->_objTpl, $newsid, FRONTEND_LANG_ID, 'related_news', 3);
}
if (!empty($objResult->fields['newsimage'])) {
$this->_objTpl->setVariable(array('NEWS_IMAGE' => '<img src="' . $objResult->fields['newsimage'] . '" alt="' . $newstitle . '" />', 'NEWS_IMAGE_SRC' => $objResult->fields['newsimage'], 'NEWS_IMAGE_ALT' => $newstitle));
if ($this->_objTpl->blockExists('news_image')) {
$this->_objTpl->parse('news_image');
}
} else {
if ($this->_objTpl->blockExists('news_image')) {
$this->_objTpl->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTpl, $objResult->fields['newsThumbImg'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTpl, $objResult->fields['newsimage'], $newstitle, $newsUrl, 'image_detail');
//previous next newslink
if ($this->_objTpl->blockExists('previousNextLink')) {
$this->parseNextAndPreviousLinks($this->_objTpl);
}
if (empty($redirect)) {
$text = preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $text);
$newsTeaser = preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $newsTeaser);
\LinkGenerator::parseTemplate($text);
$this->_objTpl->setVariable('NEWS_TEXT', $text);
if ($this->_objTpl->blockExists('news_text')) {
$this->_objTpl->parse('news_text');
}
if ($this->_objTpl->blockExists('news_redirect')) {
$this->_objTpl->hideBlock('news_redirect');
}
} else {
if (\FWValidator::isUri($redirect)) {
$redirectName = preg_replace('#^https?://#', '', $redirect);
//} elseif (\FWValidator::isEmail($redirect)) {
//$redirectName
} else {
$redirectName = basename($redirect);
}
$this->_objTpl->setVariable(array('TXT_NEWS_REDIRECT_INSTRUCTION' => $_ARRAYLANG['TXT_NEWS_REDIRECT_INSTRUCTION'], 'NEWS_REDIRECT_URL' => $redirect, 'NEWS_REDIRECT_NAME' => $redirectName));
if ($this->_objTpl->blockExists('news_redirect')) {
$this->_objTpl->parse('news_redirect');
}
if ($this->_objTpl->blockExists('news_text')) {
$this->_objTpl->hideBlock('news_text');
}
}
$this->countNewsMessageView($newsid);
$objResult->MoveNext();
return $this->_objTpl->get();
}
示例4: resolvePage
//.........这里部分代码省略.........
$module = $this->page->getTargetModule();
$cmd = $this->page->getTargetCmd();
$qs = $this->page->getTargetQueryString();
$langId = $lId ? $lId : $this->lang;
// try to find the redirection target page
if ($nId) {
$targetPage = $this->pageRepo->findOneBy(array('node' => $nId, 'lang' => $langId));
// revert to default language if we could not retrieve the specified langauge by the redirection.
// so lets try to load the redirection of the current language
if (!$targetPage) {
if ($langId != 0) {
//make sure we weren't already retrieving the default language
$targetPage = $this->pageRepo->findOneBy(array('node' => $nId, 'lang' => $this->lang));
$langId = $this->lang;
}
}
} else {
$targetPage = $this->pageRepo->findOneByModuleCmdLang($module, $cmd, $langId);
// in case we were unable to find the requested page, this could mean that we are
// trying to retrieve a module page that uses a string with an ID (STRING_ID) as CMD.
// therefore, lets try to find the module by using the string in $cmd and INT in $langId as CMD.
// in case $langId is really the requested CMD then we will have to set the
// resolved language back to our original language $this->lang.
if (!$targetPage) {
$targetPage = $this->pageRepo->findOneBymoduleCmdLang($module, $cmd . '_' . $langId, $this->lang);
if ($targetPage) {
$langId = $this->lang;
}
}
// try to retrieve a module page that uses only an ID as CMD.
// lets try to find the module by using the INT in $langId as CMD.
// in case $langId is really the requested CMD then we will have to set the
// resolved language back to our original language $this->lang.
if (!$targetPage) {
$targetPage = $this->pageRepo->findOneByModuleCmdLang($module, $langId, $this->lang);
$langId = $this->lang;
}
// revert to default language if we could not retrieve the specified langauge by the redirection.
// so lets try to load the redirection of the current language
if (!$targetPage) {
if ($langId != 0) {
//make sure we weren't already retrieving the default language
$targetPage = $this->pageRepo->findOneByModuleCmdLang($module, $cmd, $this->lang);
$langId = $this->lang;
}
}
}
//check whether we have a page now.
if (!$targetPage) {
$this->page = null;
return;
}
// the redirection page is located within a different language.
// therefore, we must set $this->lang to the target's language of the redirection.
// this is required because we will next try to resolve the redirection target
if ($langId != $this->lang) {
$this->lang = $langId;
$this->url->setLangDir(\FWLanguage::getLanguageCodeById($langId));
$this->pathOffset = ASCMS_INSTANCE_OFFSET;
}
$targetPath = substr($targetPage->getPath(), 1);
$this->url->setTargetPath($targetPath . $qs);
$this->url->setPath($targetPath . $qs);
$this->isRedirection = true;
$this->resolvePage(true);
} else {
//external target - redirect via HTTP 302
if (\FWValidator::isUri($target)) {
header('Location: ' . $target);
exit;
} else {
if ($target[0] == '/') {
$target = substr($target, 1);
}
$langDir = '';
if (!file_exists(ASCMS_INSTANCE_PATH . ASCMS_INSTANCE_OFFSET . '/' . $target)) {
$langCode = \FWLanguage::getLanguageCodeById($this->lang);
if (!empty($langCode)) {
$langDir = '/' . $langCode;
}
}
header('Location: ' . ASCMS_INSTANCE_OFFSET . $langDir . '/' . $target);
exit;
}
}
}
//if we followed one or more redirections, the user shall be redirected by 302.
if ($this->isRedirection && !$this->forceInternalRedirection) {
$params = $this->url->getSuggestedParams();
header('Location: ' . $this->page->getURL($this->pathOffset, $params));
exit;
}
// in case the requested page is of type fallback, we will now handle/load this page
$this->handleFallbackContent($this->page, !$internal);
// set legacy <section> and <cmd> in case the requested page is an application
if ($this->page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION || $this->page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK) {
$this->command = $this->page->getCmd();
$this->section = $this->page->getModule();
}
}
示例5: _store
/**
* Save an entry
*
* @global ADONewConnection
* @global array
* @return string $status
*/
function _store()
{
global $objDatabase, $_ARRAYLANG;
$error = '';
if (!empty($_POST['forename']) and !empty($_POST['name'])) {
$forename = contrexx_addslashes(strip_tags($_POST['forename']));
$name = contrexx_addslashes(strip_tags($_POST['name']));
$gender = contrexx_addslashes(strip_tags($_POST['malefemale']));
$mail = isset($_POST['email']) ? contrexx_addslashes($_POST['email']) : '';
$url = isset($_POST['url']) && strlen($_POST['url']) > 7 ? contrexx_addslashes(strip_tags($_POST['url'])) : '';
$comment = contrexx_addslashes(nl2br($this->addHyperlinking(strip_tags($_POST['comment']))));
$location = contrexx_addslashes(strip_tags($_POST['location']));
$ip = empty($_POST['ip']) ? $_SERVER['REMOTE_ADDR'] : contrexx_addslashes(strip_tags($_POST['ip']));
if (!empty($url)) {
if (!\FWValidator::isUri($url)) {
$error .= $_ARRAYLANG['TXT_INVALID_INTERNET_ADDRESS'] . "<br />";
}
}
if (!\FWValidator::isEmail($mail)) {
$error .= $_ARRAYLANG['TXT_INVALID_EMAIL_ADDRESS'] . "<br />";
}
if (empty($error)) {
$query = "\n INSERT INTO " . DBPREFIX . "module_guestbook (\n forename, name, gender,\n url, datetime, email, comment,\n ip, location, lang_id\n ) VALUES (\n '{$forename}', '{$name}', '{$gender}',\n '{$url}', '" . date('Y-m-d H:i:s') . "', '{$mail}', '{$comment}',\n '{$ip}', '{$location}', '{$this->langId}'\n )";
$objDatabase->Execute($query);
$this->strOkMessage = $_ARRAYLANG['TXT_GUESTBOOK_RECORD_STORED_SUCCESSFUL'];
} else {
$this->strErrMessage = $error;
}
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_FILL_OUT_ALL_REQUIRED_FIELDS'];
}
}
示例6: _getIcon
/**
* Gets the icon for the file
*
* @param string $file The File Path
* @param string $fileType (optional) The File type
*
* @return string The Icon name
*/
public static function _getIcon($file, $fileType = null)
{
$icon = '';
if (isset($fileType)) {
$icon = strtoupper($fileType);
} elseif (is_file($file)) {
$info = pathinfo($file);
$icon = strtoupper($info['extension']);
}
$arrImageExt = array('JPEG', 'JPG', 'TIFF', 'GIF', 'BMP', 'PNG');
$arrVideoExt = array('3GP', 'AVI', 'DAT', 'FLV', 'FLA', 'M4V', 'MOV', 'MPEG', 'MPG', 'OGG', 'WMV', 'SWF');
$arrAudioExt = array('WAV', 'WMA', 'AMR', 'MP3', 'AAC');
$arrPresentationExt = array('ODP', 'PPT', 'PPTX');
$arrSpreadsheetExt = array('CSV', 'ODS', 'XLS', 'XLSX');
$arrDocumentsExt = array('DOC', 'DOCX', 'ODT', 'RTF');
$arrWebDocumentExt = array('HTML', 'HTM');
switch (true) {
case $icon == 'TXT':
$icon = 'Text';
break;
case $icon == 'PDF':
$icon = 'Pdf';
break;
case in_array($icon, $arrImageExt):
$icon = 'Image';
break;
case in_array($icon, $arrVideoExt):
$icon = 'Video';
break;
case in_array($icon, $arrAudioExt):
$icon = 'Audio';
break;
case in_array($icon, $arrPresentationExt):
$icon = 'Presentation';
break;
case in_array($icon, $arrSpreadsheetExt):
$icon = 'Spreadsheet';
break;
case in_array($icon, $arrDocumentsExt):
$icon = 'TextDocument';
break;
case in_array($icon, $arrWebDocumentExt):
case \FWValidator::isUri($file):
$icon = 'WebDocument';
break;
default:
$icon = 'Unknown';
break;
}
if (is_dir($file)) {
$icon = 'Folder';
}
if (!file_exists(self::_getIconPath() . $icon . '.png') or !isset($icon)) {
$icon = '_blank';
}
return $icon;
}
示例7: OpenTag
//.........这里部分代码省略.........
if (isset($attr['STYLE'])) {
$properties = $this->readInlineCSS($attr['STYLE']);
}
//Look for name in the $this->CSS array
if (!empty($properties)) {
$this->setCSS($properties);
}
//name found in the CSS array!
}
break;
case 'IMG':
if (!empty($this->textbuffer) and !$this->tablestart) {
//Output previously buffered content and output image below
//Set some default values
$olddivwidth = $this->divwidth;
$olddivheight = $this->divheight;
if ($this->divwidth == 0) {
$this->divwidth = $this->pgwidth - $this->x + $this->lMargin;
}
if ($this->divheight == 0) {
$this->divheight = $this->lineheight;
}
//Print content
$this->printbuffer($this->textbuffer, true);
$this->textbuffer = array();
//Reset values
$this->divwidth = $olddivwidth;
$this->divheight = $olddivheight;
$this->textbuffer = array();
$this->Ln($this->lineheight);
}
if (isset($attr['SRC'])) {
$srcpath = html_entity_decode($attr['SRC'], ENT_QUOTES, CONTREXX_CHARSET);
if (!FWValidator::isUri($srcpath)) {
// Set absolute path of image source
/*if (strpos($srcpath, ASCMS_DOCUMENT_ROOT) === 0) {
// probably impossible that the $srcpath would contain ASCMS_DOCUMENT_ROOT, therefore we can ignore this case
} else*/
if (ASCMS_PATH_OFFSET && strpos($srcpath, ASCMS_PATH_OFFSET) === 0) {
$srcpath = ASCMS_PATH . $srcpath;
} elseif (strpos($srcpath, '/') === 0) {
$srcpath = ASCMS_DOCUMENT_ROOT . $srcpath;
} else {
$srcpath = ASCMS_DOCUMENT_ROOT . '/' . $srcpath;
}
}
if (isset($attr['STYLE'])) {
$inlineCSSProperties = $this->readInlineCSS($attr['STYLE']);
if (isset($inlineCSSProperties['WIDTH'])) {
//$attr['WIDTH'] = ConvertSize($inlineCSSProperties['WIDTH'],$this->pgwidth);
$attr['WIDTH'] = intval($inlineCSSProperties['WIDTH']);
}
if (isset($inlineCSSProperties['HEIGHT'])) {
//$attr['HEIGHT'] = ConvertSize($inlineCSSProperties['HEIGHT'],$this->pgwidth);
$attr['HEIGHT'] = intval($inlineCSSProperties['HEIGHT']);
}
}
if (!isset($attr['WIDTH'])) {
$attr['WIDTH'] = 0;
} else {
$attr['WIDTH'] = ConvertSize($attr['WIDTH'], $this->pgwidth);
}
//$attr['WIDTH'] /= 4;
if (!isset($attr['HEIGHT'])) {
$attr['HEIGHT'] = 0;
} else {
示例8: isUrl
/**
* Checks the url
*
* @param string $string
* @return boolean result
*/
function isUrl($string)
{
return \FWValidator::isUri($string);
}
示例9: _parsejpg
function _parsejpg($file)
{
$width = 0;
$height = 0;
$colspace = 'DeviceRGB';
$bpc = 8;
$data = null;
if (FWValidator::isUri($file)) {
// Image is a remote ressource
require_once ASCMS_LIBRARY_PATH . '/PEAR/HTTP/Request2.php';
try {
$request = new HTTP_Request2($file);
$data = $request->send()->getBody();
$img = imagecreatefromstring($data);
$width = imagesx($img);
$height = imagesy($img);
unset($img);
} catch (Exception $e) {
DBG::msg($e->getMessage());
return false;
}
} else {
// Image is a local ressource
$imageInfo = getimagesize($file);
if (!$imageInfo) {
DBG::msg('Missing or incorrect image file: ' . $file);
return false;
}
list($width, $height, $imageType) = $imageInfo;
if ($imageType != IMAGETYPE_JPEG) {
DBG::msg('Not a JPEG file: ' . $file);
return false;
}
if (!isset($imageInfo['channels']) || $imageInfo['channels'] == 3) {
$colspace = 'DeviceRGB';
} elseif ($imageInfo['channels'] == 4) {
$colspace = 'DeviceCMYK';
} else {
$colspace = 'DeviceGray';
}
if (isset($imageInfo['bits'])) {
$bpc = $imageInfo['bits'];
}
//Read whole file
$f = fopen($file, 'rb');
$data = '';
while (!feof($f)) {
$data .= fread($f, 4096);
}
fclose($f);
}
return array('w' => $width, 'h' => $height, 'cs' => $colspace, 'bpc' => $bpc, 'f' => 'DCTDecode', 'data' => $data);
}
示例10: foreach
$ipn = false;
foreach ($_POST as $name => $value) {
if ($name == 'cancel_return') {
if (!FWValidator::isUri($value)) {
continue;
}
$paypalUriNok = $value;
continue;
} elseif ($name == 'return') {
if (!FWValidator::isUri($value)) {
continue;
}
$paypalUriOk = $value;
continue;
} elseif ($name == 'notify_url') {
if (!FWValidator::isUri($value)) {
continue;
}
$paypalUriIpn = $value;
continue;
} elseif ($name == 'cmd') {
if ($value == '_notify-validate') {
die("VERIFIED");
}
continue;
}
addParam($name, $value);
}
function addParam($name, $value)
{
global $strForm;
示例11: 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);
}
示例12: loadFile
function loadFile($lpszFileName, $iIndex)
{
if ($iIndex < 0) {
return false;
}
// READ FILE
if (FWValidator::isUri($lpszFileName)) {
// Image is a remote ressource
require_once ASCMS_LIBRARY_PATH . '/PEAR/HTTP/Request2.php';
try {
$request = new HTTP_Request2($lpszFileName);
$contents = $request->send()->getBody();
} catch (Exception $e) {
DBG::msg($e->getMessage());
return false;
}
} elseif (!($fh = @fOpen($lpszFileName, "rb"))) {
return false;
} else {
$contents = @fread($fh, @filesize($lpszFileName));
fClose($fh);
//echo($contents);
}
$this->m_lpData = $contents;
// $this->m_lpData = @fRead($fh, @fileSize($lpszFileName));
//header ("Content-type: image/gif");
//echo($this->m_lpData);
// GET FILE HEADER
if (!$this->m_gfh->load($this->m_lpData, $len)) {
return false;
}
$this->m_lpData = substr($this->m_lpData, $len);
do {
if (!$this->m_img->load($this->m_lpData, $imgLen)) {
return false;
}
$this->m_lpData = substr($this->m_lpData, $imgLen);
} while ($iIndex-- > 0);
$this->m_bLoaded = true;
return true;
}