本文整理汇总了PHP中checkImage函数的典型用法代码示例。如果您正苦于以下问题:PHP checkImage函数的具体用法?PHP checkImage怎么用?PHP checkImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkImage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _postProcess
private function _postProcess()
{
Configuration::updateValue('WATERMARK_TYPES', implode(',', Tools::getValue('image_types')));
Configuration::updateValue('WATERMARK_Y_ALIGN', Tools::getValue('yalign'));
Configuration::updateValue('WATERMARK_X_ALIGN', Tools::getValue('xalign'));
Configuration::updateValue('WATERMARK_TRANSPARENCY', Tools::getValue('transparency'));
//submited watermark
if (isset($_FILES['PS_WATERMARK']) and !empty($_FILES['PS_WATERMARK']['tmp_name'])) {
/* Check watermark validity */
if ($error = checkImage($_FILES['PS_WATERMARK'], $this->maxImageSize)) {
$this->_errors[] = $error;
} elseif (!copy($_FILES['PS_WATERMARK']['tmp_name'], dirname(__FILE__) . '/watermark.gif')) {
$this->_errors[] = Tools::displayError('an error occurred while uploading watermark: ' . $_FILES['PS_WATERMARK']['tmp_name'] . ' to ' . $dest);
}
}
if ($this->_errors) {
foreach ($this->_errors as $error) {
$this->_html .= '<div class="module_error alert error"><img src="../img/admin/warning.gif" alt="' . $this->l('ok') . '" /> ' . $this->l($error) . '</div>';
}
} else {
$this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('ok') . '" /> ' . $this->l('Settings updated') . '</div>';
}
}
示例2: copyNoPictureImage
/**
* Copy a no-product image
*
* @param string $language Language iso_code for no-picture image filename
*/
public function copyNoPictureImage($language)
{
if (isset($_FILES['no-picture']) and $_FILES['no-picture']['error'] === 0) {
if ($error = checkImage($_FILES['no-picture'], $this->maxImageSize)) {
$this->_errors[] = $error;
} else {
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) or !move_uploaded_file($_FILES['no-picture']['tmp_name'], $tmpName)) {
return false;
}
if (!imageResize($tmpName, _PS_IMG_DIR_ . 'p/' . $language . '.jpg')) {
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your product folder.');
}
if (!imageResize($tmpName, _PS_IMG_DIR_ . 'c/' . $language . '.jpg')) {
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your category folder.');
}
if (!imageResize($tmpName, _PS_IMG_DIR_ . 'm/' . $language . '.jpg')) {
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your manufacturer folder');
} else {
$imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes as $k => $imageType) {
if (!imageResize($tmpName, _PS_IMG_DIR_ . 'p/' . $language . '-default-' . stripslashes($imageType['name']) . '.jpg', $imageType['width'], $imageType['height'])) {
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your product directory.');
}
if (!imageResize($tmpName, _PS_IMG_DIR_ . 'c/' . $language . '-default-' . stripslashes($imageType['name']) . '.jpg', $imageType['width'], $imageType['height'])) {
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your category directory.');
}
if (!imageResize($tmpName, _PS_IMG_DIR_ . 'm/' . $language . '-default-' . stripslashes($imageType['name']) . '.jpg', $imageType['width'], $imageType['height'])) {
$this->_errors[] = Tools::displayError('An error occurred while resizing no-picture image to your manufacturer directory.');
}
}
}
unlink($tmpName);
}
}
}
示例3: pictureUpload
function pictureUpload(Product $product, Cart $cart)
{
global $errors;
if (!($fieldIds = $product->getCustomizationFieldIds())) {
return false;
}
$authorizedFileFields = array();
foreach ($fieldIds as $fieldId) {
if ($fieldId['type'] == _CUSTOMIZE_FILE_) {
$authorizedFileFields[intval($fieldId['id_customization_field'])] = 'file' . intval($fieldId['id_customization_field']);
}
}
$indexes = array_flip($authorizedFileFields);
foreach ($_FILES as $fieldName => $file) {
if (in_array($fieldName, $authorizedFileFields) and isset($file['tmp_name']) and !empty($file['tmp_name'])) {
$fileName = md5(uniqid(rand(), true));
if ($error = checkImage($file, intval(Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE')))) {
$errors[] = $error;
}
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) or !move_uploaded_file($file['tmp_name'], $tmpName)) {
return false;
} elseif (!imageResize($tmpName, _PS_PROD_PIC_DIR_ . $fileName)) {
$errors[] = Tools::displayError('An error occurred during the image upload.');
} elseif (!imageResize($tmpName, _PS_PROD_PIC_DIR_ . $fileName . '_small', intval(Configuration::get('PS_PRODUCT_PICTURE_WIDTH')), intval(Configuration::get('PS_PRODUCT_PICTURE_HEIGHT')))) {
$errors[] = Tools::displayError('An error occurred during the image upload.');
} elseif (!chmod(_PS_PROD_PIC_DIR_ . $fileName, 0777) or !chmod(_PS_PROD_PIC_DIR_ . $fileName . '_small', 0777)) {
$errors[] = Tools::displayError('An error occurred during the image upload.');
} else {
$cart->addPictureToProduct(intval($product->id), $indexes[$fieldName], $fileName);
}
unlink($tmpName);
}
}
return true;
}
示例4: getContent
function getContent()
{
global $cookie;
/* Languages preliminaries */
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages();
$iso = Language::getIsoById($defaultLanguage);
$isoUser = Language::getIsoById(intval($cookie->id_lang));
/* display the module name */
$this->_html = '<h2>' . $this->displayName . ' ' . $this->version . '</h2>';
/* update the editorial xml */
if (isset($_POST['submitUpdate'])) {
// Generate new XML data
$newXml = '<?xml version=\'1.0\' encoding=\'utf-8\' ?>' . "\n";
$newXml .= '<links>' . "\n";
$i = 0;
foreach ($_POST['link'] as $link) {
$newXml .= ' <link>';
foreach ($link as $key => $field) {
if ($line = $this->putContent($newXml, $key, $field)) {
$newXml .= $line;
}
}
/* upload the image */
if (isset($_FILES['link_' . $i . '_img']) and isset($_FILES['link_' . $i . '_img']['tmp_name']) and !empty($_FILES['link_' . $i . '_img']['tmp_name'])) {
Configuration::set('PS_IMAGE_GENERATION_METHOD', 1);
if ($error = checkImage($_FILES['link_' . $i . '_img'], $this->maxImageSize)) {
$this->_html .= $error;
} elseif (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) or !move_uploaded_file($_FILES['link_' . $i . '_img']['tmp_name'], $tmpName)) {
return false;
} elseif (!imageResize($tmpName, dirname(__FILE__) . '/' . $isoUser . $i . '.jpg')) {
$this->_html .= $this->displayError($this->l('An error occurred during the image upload.'));
}
unlink($tmpName);
}
if ($line = $this->putContent($newXml, 'img', $isoUser . $i . '.jpg')) {
$newXml .= $line;
}
$newXml .= "\n" . ' </link>' . "\n";
$i++;
}
$newXml .= '</links>' . "\n";
/* write it into the editorial xml file */
if ($fd = @fopen(dirname(__FILE__) . '/' . $isoUser . 'links.xml', 'w')) {
if (!@fwrite($fd, $newXml)) {
$this->_html .= $this->displayError($this->l('Unable to write to the editor file.'));
}
if (!@fclose($fd)) {
$this->_html .= $this->displayError($this->l('Can\'t close the editor file.'));
}
} else {
$this->_html .= $this->displayError($this->l('Unable to update the editor file.<br />Please check the editor file\'s writing permissions.'));
}
}
/* display the editorial's form */
$this->_displayForm();
return $this->_html;
}
示例5: checkUpload
function checkUpload($upload_name)
{
if(is_uploaded_file($_FILES[$upload_name]['tmp_name']))
{
if(checkImage($upload_name))
{
return true;
}else{
return false;
}
}else{
return true;
}
}
示例6: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitStoreConf')) {
if (isset($_FILES['store_img']) and isset($_FILES['store_img']['tmp_name']) and !empty($_FILES['store_img']['tmp_name'])) {
if ($error = checkImage($_FILES['store_img'], 4000000)) {
return $this->displayError($this->l('invalid image'));
} else {
if (!move_uploaded_file($_FILES['store_img']['tmp_name'], dirname(__FILE__) . '/' . $_FILES['store_img']['name'])) {
return $this->displayError($this->l('an error occurred on uploading file'));
} else {
if (Configuration::get('BLOCKSTORE_IMG') != $_FILES['store_img']['name']) {
@unlink(dirname(__FILE__) . '/' . Configuration::get('BLOCKSTORE_IMG'));
}
Configuration::updateValue('BLOCKSTORE_IMG', $_FILES['store_img']['name']);
return $this->displayConfirmation($this->l('Settings are updated'));
}
}
}
}
return '';
}
示例7: postProcess
public function postProcess()
{
global $currentIndex;
$errors = false;
if (Tools::isSubmit('submitAdvConf')) {
$file = false;
if (isset($_FILES['adv_img']) and isset($_FILES['adv_img']['tmp_name']) and !empty($_FILES['adv_img']['tmp_name'])) {
if ($error = checkImage($_FILES['adv_img'], 4000000)) {
$errors .= $error;
} elseif (!move_uploaded_file($_FILES['adv_img']['tmp_name'], dirname(__FILE__) . '/' . $this->adv_imgname)) {
$errors .= $this->l('Error move uploaded file');
}
$this->adv_img = _MODULE_DIR_ . $this->name . '/' . $this->adv_imgname;
}
if ($link = Tools::getValue('adv_link')) {
Configuration::updateValue('BLOCKADVERT_LINK', $link);
$this->adv_link = htmlentities($link, ENT_QUOTES, 'UTF-8');
}
}
if ($errors) {
echo $this->displayError($errors);
}
}
示例8: addImage
public function addImage()
{
if (isset($_FILES['body_homepage_logo']) and isset($_FILES['body_homepage_logo']['tmp_name']) and !empty($_FILES['body_homepage_logo']['tmp_name'])) {
$name = "homepage_logo_" . $this->id . "." . $this->extension(basename($_FILES['body_homepage_logo']['name']));
$name1 = "homepage_logo_" . $this->id;
$t = 1;
foreach (glob(dirname(__FILE__) . '/img/' . $name1 . '.*') as $fn) {
$t *= unlink($fn);
}
if (!$t) {
$this->errors .= Tools::displayError('An error occurred during the image upload.');
return false;
}
if ($error = checkImage($_FILES['body_homepage_logo'], $this->maxImageSize)) {
$this->errors .= $error;
return false;
} elseif (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) or !move_uploaded_file($_FILES['body_homepage_logo']['tmp_name'], $tmpName)) {
$this->errors .= Tools::displayError('An error occurred during the image upload.');
return false;
} else {
list($width, $height, $t, $s) = getimagesize($tmpName);
$q1 = $this->maxImageWidth / $width;
$q2 = $this->maxImageHeight / $height;
if ($q1 > $q2 && $q1 < 1) {
$t = imageResize($tmpName, dirname(__FILE__) . '/img/' . $name, $this->maxImageWidth, null);
} elseif ($q2 < 1) {
$t = imageResize($tmpName, dirname(__FILE__) . '/img/' . $name, null, $this->maxImageHeight);
} else {
$t = imageResize($tmpName, dirname(__FILE__) . '/img/' . $name, $this->maxImageWidth, $this->maxImageHeight);
}
if (!$t) {
$this->errors .= Tools::displayError('An error occurred during the image upload.');
return false;
}
}
if (isset($tmpName)) {
unlink($tmpName);
}
if (file_exists(dirname(__FILE__) . '/img/' . $name)) {
Db::getInstance()->ExecuteS('UPDATE `' . _DB_PREFIX_ . $this->table . '` set `body_home_logo`="' . $name . '" where id_editorial="' . $this->id . '"');
}
} else {
$this->errors .= Tools::displayError('The image cannot be uploaded.');
}
}
示例9: explode
<?php
if ($urls && checkImage()) {
$urls = str_replace("\r\n", "\n", $urls);
$urls = explode("\n", $urls);
$results = array();
foreach ($urls as $link) {
$link = preg_match("#\\w+://#", $link) ? $link : "http://" . $link;
$start = microtime(true);
$content = @file_get_contents($link);
if ($content === FALSE) {
continue;
}
$result['domain'] = $link;
$result['time'] = sprintf("%01.3f", microtime(true) - $start);
$result['size'] = sprintf("%01.2f", strlen($content) / 1000);
$result['average'] = sprintf("%01.3f", $result['time'] / $result['size']);
$results[] = $result;
}
if ($results) {
echo "<table cellpadding=\"3\" cellspacing=\"3\"><tr bgcolor=\"#E6E6E6\"><td>Size</td><td>Load time (secs)</td><td>Average speed per KB</td></tr>";
foreach ($results as $k => $r) {
echo "<tr bgcolor=\"#FFEAEA\"><td align=\"center\">{$r['size']} KB</td><td align=\"center\">{$r['time']}</td><td align=\"center\">{$r['average']}</td></tr>";
}
echo "</table>";
}
}
?>
</td>
</tr>
示例10: writePostedImageOnDisk
/**
* Write the posted image on disk
*
* @param string $receptionPath
* @param int $destWidth
* @param int $destHeight
* @param array $imageTypes
* @param string $parentPath
* @return boolean
*/
private function writePostedImageOnDisk($receptionPath, $destWidth = null, $destHeight = null, $imageTypes = null, $parentPath = null)
{
if ($this->wsObject->method == 'PUT') {
if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) {
$file = $_FILES['image'];
if ($file['size'] > $this->imgMaxUploadSize) {
throw new WebserviceException(sprintf('The image size is too large (maximum allowed is %d KB)', $this->imgMaxUploadSize / 1000), array(72, 400));
}
// Get mime content type
$mime_type = false;
if (Tools::isCallable('finfo_open')) {
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
$finfo = finfo_open($const);
$mime_type = finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
} elseif (Tools::isCallable('mime_content_type')) {
$mime_type = mime_content_type($file['tmp_name']);
} elseif (Tools::isCallable('exec')) {
$mime_type = trim(exec('file -b --mime-type ' . escapeshellarg($file['tmp_name'])));
}
if (empty($mime_type) || $mime_type == 'regular file') {
$mime_type = $file['type'];
}
if (($pos = strpos($mime_type, ';')) !== false) {
$mime_type = substr($mime_type, 0, $pos);
}
// Check mime content type
if (!$mime_type || !in_array($mime_type, $this->acceptedImgMimeTypes)) {
throw new WebserviceException('This type of image format not recognized, allowed formats are: ' . implode('", "', $this->acceptedImgMimeTypes), array(73, 400));
} elseif ($file['error']) {
throw new WebserviceException('Error while uploading image. Please change your server\'s settings', array(74, 400));
}
// Try to copy image file to a temporary file
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) or !move_uploaded_file($_FILES['image']['tmp_name'], $tmpName)) {
throw new WebserviceException('Error while copying image to the temporary directory', array(75, 400));
} else {
$result = $this->writeImageOnDisk($tmpName, $receptionPath, $destWidth, $destHeight, $imageTypes, $parentPath);
}
@unlink($tmpName);
return $result;
} else {
throw new WebserviceException('Please set an "image" parameter with image data for value', array(76, 400));
}
} elseif ($this->wsObject->method == 'POST') {
if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) {
$file = $_FILES['image'];
if ($file['size'] > $this->imgMaxUploadSize) {
throw new WebserviceException(sprintf('The image size is too large (maximum allowed is %d KB)', $this->imgMaxUploadSize / 1000), array(72, 400));
}
require_once _PS_ROOT_DIR_ . '/images.inc.php';
if ($error = checkImageUploadError($file)) {
throw new WebserviceException('Image upload error : ' . $error, array(76, 400));
}
if (isset($file['tmp_name']) && $file['tmp_name'] != null) {
if ($this->imageType == 'products') {
$product = new Product((int) $this->wsObject->urlSegment[2]);
if (!Validate::isLoadedObject($product)) {
throw new WebserviceException('Product ' . (int) $this->wsObject->urlSegment[2] . ' doesn\'t exists', array(76, 400));
}
$image = new Image();
$image->id_product = (int) $product->id;
$image->position = Image::getHighestPosition($product->id) + 1;
if (!$image->add()) {
throw new WebserviceException('Error while creating image', array(76, 400));
}
if (!Validate::isLoadedObject($product)) {
throw new WebserviceException('Product ' . (int) $this->wsObject->urlSegment[2] . ' doesn\'t exists', array(76, 400));
}
}
// copy image
if (!isset($file['tmp_name'])) {
return false;
}
if ($error = checkImage($file, $this->imgMaxUploadSize)) {
throw new WebserviceException('Bad image : ' . $error, array(76, 400));
}
if ($this->imageType == 'products') {
$image = new Image($image->id);
if (!(Configuration::get('PS_OLD_FILESYSTEM') && file_exists(_PS_PROD_IMG_DIR_ . $product->id . '-' . $image->id . '.jpg'))) {
$image->createImgFolder();
}
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) or !move_uploaded_file($file['tmp_name'], $tmpName)) {
throw new WebserviceException('An error occurred during the image upload', array(76, 400));
} elseif (!imageResize($tmpName, _PS_PROD_IMG_DIR_ . $image->getExistingImgPath() . '.' . $image->image_format)) {
throw new WebserviceException('An error occurred while copying image', array(76, 400));
} else {
$imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes as $imageType) {
if (!imageResize($tmpName, _PS_PROD_IMG_DIR_ . $image->getExistingImgPath() . '-' . stripslashes($imageType['name']) . '.' . $image->image_format, $imageType['width'], $imageType['height'], $image->image_format)) {
$this->_errors[] = Tools::displayError('An error occurred while copying image:') . ' ' . stripslashes($imageType['name']);
//.........这里部分代码省略.........
示例11: getContent
public function getContent()
{
if (Tools::isSubmit('addNewSlide')) {
$this->_createNewSlide();
}
foreach ($this->kinkyslider_output_images as $slideToUpdate) {
if (Tools::isSubmit($this->name . '_deleteslide_' . $slideToUpdate['kinky_id'])) {
$this->_deleteSlide($slideToUpdate['kinky_id']);
}
}
if (Tools::isSubmit('updateSlides')) {
foreach ($this->kinkyslider_output_images as $slideToUpdate) {
$_thisID = $slideToUpdate['kinky_id'];
$_thisLink = $slideToUpdate['kinky_link'];
$_thisImageDir = $slideToUpdate['kinky_imagedir'];
$_thisHeader = $slideToUpdate['kinky_header'];
$_thisPrice = $slideToUpdate['kinky_price'];
$_thisOrder = $slideToUpdate['kinky_order'];
$_thisActive = $slideToUpdate['kinky_active'];
$_thisSlideIsChanged = false;
/* Let's see if the user wanted to upload an image for this slide ID
* If so, we'll create a new directory on the server, move the uploaded image there,
* Scale the image to the width & height given in the configuration and
* Then save it as JPEG image.
*/
if (isset($_FILES[$this->name . '_image' . $_thisID]) and isset($_FILES[$this->name . '_image' . $_thisID]['tmp_name']) and !empty($_FILES[$this->name . '_image' . $_thisID]['tmp_name'])) {
if ($error = @checkImage($_FILES[$this->name . '_image' . $_thisID], 4000000)) {
$this->_postErrors[] = $error;
} else {
$_last_picture_dir = $this->bazinga_last_dir('images');
$_numeric_last_picture_dir = (int) $_last_picture_dir;
$_new_picture_dir = $_numeric_last_picture_dir + 1;
$_target_path = dirname(__FILE__) . '/uploads/images/' . $_new_picture_dir . '/';
mkdir(str_replace('//', '/', $_target_path), 0755, true);
if (move_uploaded_file($_FILES[$this->name . '_image' . $_thisID]['tmp_name'], $_target_path . KINKYSLIDER_DEFAULT_FILE_NAME . '.png')) {
// $this->bazinga_load($_target_path.$_FILES[$this->name.'_image'.$_thisID]['name']);
// $this->bazinga_resizeZoomCrop($this->kinkyslider_calculated_image_width,$this->kinkyslider_calculated_image_height);
//$this->bazinga_save($_target_path.KINKYSLIDER_DEFAULT_FILE_NAME.'.png');
$_thisImageDir = $_new_picture_dir;
$_thisSlideIsChanged = true;
}
}
}
if ($_checkUpdate = Tools::getValue($this->name . '_link' . $_thisID)) {
$this->_linkValidation($_checkUpdate);
if (!sizeof($this->_postErrors)) {
$_thisLink = $_checkUpdate;
$_thisSlideIsChanged = true;
}
}
if ($_checkUpdate = Tools::getValue($this->name . '_order' . $_thisID)) {
$this->_numericValidation($_checkUpdate, 'order');
if (!sizeof($this->_postErrors)) {
$_thisOrder = $_checkUpdate;
$_thisSlideIsChanged = true;
}
}
if ($_checkUpdate = Tools::getValue($this->name . '_header' . $_thisID)) {
$_thisHeader = strip_tags(nl2br2($_checkUpdate));
$_thisSlideIsChanged = true;
}
if ($_checkUpdate = Tools::getValue($this->name . '_price' . $_thisID)) {
$_thisPrice = strip_tags(nl2br2($_checkUpdate));
$_thisSlideIsChanged = true;
}
if ($_checkUpdate = (int) Tools::getValue($this->name . '_active' . $_thisID)) {
if ($_checkUpdate == 1 && $_thisActive == 0) {
$_thisActive = 1;
$_thisSlideIsChanged = true;
}
} elseif ((int) Tools::getValue($this->name . '_active' . $_thisID) != 1 && $_thisActive == 1) {
$_thisActive = 0;
$_thisSlideIsChanged = true;
}
if ($_thisSlideIsChanged == true) {
$this->_updataSlide($_thisID, $_thisLink, $_thisImageDir, $_thisHeader, $_thisPrice, $_thisOrder, $_thisActive);
}
}
/* end foreach */
if (!sizeof($this->_postErrors)) {
$this->_html .= '<div class="conf confirm">' . $this->l('Ustawienia zostały zaktualizowane') . '</div>';
} else {
foreach ($this->_postErrors as $err) {
$this->_html .= '<div class="alert error">' . $err . '</div>';
}
}
}
/*end isSubmit('updateSlider'); */
if (Tools::isSubmit('updateSettings')) {
foreach ($this->kinkyslider_config as $configRowToUpdate) {
if ($_checkUpdate = Tools::getValue($this->name . '_config_' . $configRowToUpdate['kinky_key'])) {
switch ($configRowToUpdate['kinky_validation']) {
case KINKYSLIDER_VALIDATION_STANDARD:
break;
case KINKYSLIDER_VALIDATION_NUMERIC:
$this->_numericValidation($_checkUpdate, $configRowToUpdate['sml_key']);
break;
case KINKYSLIDER_VALIDATION_NUMERIC_OR_NONE:
$this->_numericOrNoneValidation($_checkUpdate, $configRowToUpdate['kinky_label']);
break;
//.........这里部分代码省略.........
示例12: checkImage
echo "\n <li> <a href='cars.php?c=" . $car['c_id'] . "'>" . $car['yr'] . " " . $car['brd'] . " " . $car['mdl'] . "</a><br> </li>\n ";
}
?>
</ul>
</div>
</div>
<div class='sub mid main'>
<?php
if (isset($carID) && $idCheck == 1) {
echo "\n <div class='return-to-list mobile'>\n <div class='left-arrow'></div>\n <a href='suppliers.php' class='return'> Return to list.</a>\n </div>\n ";
}
?>
<?php
if (isset($carID) && $idCheck == 1) {
$img_url = checkImage($carID, "../");
echo "\n <div class='item-details'>\n <h2>" . $car_yr . " " . $car_brd . " " . $car_mdl . "</h2>\n <p class='sub-heading'>" . $car_tran . " " . $car_mke . "</p>\n <img src='../assets/img/cars/" . $img_url . "' alt='Image of car' class='car-image'>\n <p class='details-heading'>Car Details:<p>\n <p class='sub-info'>Price: \$" . $car_price . "</p>\n <p class='sub-info'>Date Listed: " . $car_date . "</p>\n <p class='sub-info'>VIN: " . $car_vin . "</p>\n <p class='sub-info'>Registraion: " . $car_rego . "</p>\n <p class='sub-info'>Condition: " . $car_cond . "</p>\n <p class='sub-info'>Description: " . $car_desr . "</p>\n <p class='sub-info'>No of Views: " . $car_view . "</p>\n <p class='sub-info'>Supplied by: <a href='suppliers.php?s=" . $car_sup_id . "' class='sub-info link'>" . $car_sup_name . "</a> </p>\n </div>\n ";
} elseif (isset($detailErr)) {
echo "{$detailErr}";
} else {
echo "\n <h2 class='desktop no-select-tip'>Please select an item from the left.</h2>\n <h2 class='mobile no-select-tip'>Please select an item from above.</h2>\n ";
}
?>
</div>
<div class='sub right column'>
<div class='tools'>
<ul>
<li> <button class='button create'>Add Car</button> </li>
<?php
if (isset($carID) && $idCheck == 1) {
示例13: checkImage
checkImage($pdf, '11', $this->view->disp[$i][4], 7.1, 11);
$pdf->Cell(3, 0.4, ' Bicarakan dengan saya', 0, 0, 'L');
//$pdf->Image('public/images/check20.png', 10.1, 11, 0.2, 0.2, 'PNG');
checkImage($pdf, '15', $this->view->disp[$i][4], 10.1, 11);
$pdf->Cell(4, 0.4, ' Disiapkan', 'R', 1, 'L');
$pdf->Image('public/images/check20.png', 1.1, 11.4, 0.2, 0.2, 'PNG');
checkImage($pdf, '4', $this->view->disp[$i][4], 1.1, 11.4);
$pdf->Cell(3, 0.4, ' Untuk diketahui', 'L', 0, 'L');
//$pdf->Image('public/images/check20.png', 4.1, 11.4, 0.2, 0.2, 'PNG');
checkImage($pdf, '8', $this->view->disp[$i][4], 4.1, 11.4);
$pdf->Cell(3, 0.4, ' Edarkan', 0, 0, 'L');
//$pdf->Image('public/images/check20.png', 7.1, 11.4, 0.2, 0.2, 'PNG');
checkImage($pdf, '12', $this->view->disp[$i][4], 7.1, 11.4);
$pdf->Cell(3, 0.4, ' Bicarakan bersama', 0, 0, 'L');
//$pdf->Image('public/images/check20.png', 10.1, 11.4, 0.2, 0.2, 'PNG');
checkImage($pdf, '16', $this->view->disp[$i][4], 10.1, 11.4);
$pdf->Cell(4, 0.4, ' Harap dihadiri/diwakili', 'R', 1, 'L');
$pdf->Cell(13, 0.7, 'CATATAN KEPALA KANTOR :', 'RL', 1, 'L');
//$pdf->MultiCell(13, 0.1, $test, 1, 'J');
@$pdf->Cell(13, 0.4, '' . $this->view->disp[$i][5], 'RL', 1, 'L');
$pdf->Cell(13, 0.4, '', 'RL', 1, 'L');
$pdf->Cell(13, 0.4, '', 'RL', 1, 'L');
$pdf->Cell(13, 0, '', 0, 1, 'L');
$pdf->Cell(6.5, 0.4, 'Tgl Penyelesaian :', 'TL', 0, 'L');
$pdf->Cell(6.5, 0.4, 'Diajukan kembali tgl :', 'RTL', 1, 'L');
$pdf->Cell(6.5, 0.4, 'Penerima :', 'BL', 0, 'L');
$pdf->Cell(6.5, 0.4, 'Penerima :', 'RBL', 1, 'L');
$pdf->Cell(13, 0.7, 'DISPOSISI Kasubbag / Kasi :', 'RL', 1, 'L');
$pdf->Cell(13, 0.4, 'Kepada :', 'RL', 1, 'L');
$pdf->Cell(13, 0.4, 'Petunjuk :', 'RL', 1, 'L');
$pdf->Cell(13, 0.4, '', 'RL', 1, 'L');
示例14: _postProcess
/**
* _postProcess()
* Called upon successful module configuration validation
*/
private function _postProcess()
{
$output = "";
if (Tools::isSubmit('updateSubmit')) {
$banners = Tools::getValue('blockadvertmultiId');
if ($banners and is_array($banners) and count($banners)) {
foreach ($banners as $row) {
$bnr = array();
$bnr['id'] = $row;
$bnr['description'] = Tools::getValue('desc_' . $row);
$bnr['image_link'] = Tools::getValue('link_' . $row);
/* Patch by Madman */
if (isset($_FILES['banner_image_' . $row]) and isset($_FILES['banner_image_' . $row]['tmp_name']) and !empty($_FILES['banner_image_' . $row]['tmp_name'])) {
$bnr['image_name'] = $_FILES['banner_image_' . $row]['name'];
} else {
$bnr['image_name'] = Tools::getValue('image_name_' . $row);
}
/* Patch by Madman */
// $bnr['image_name'] = Tools::getValue('image_name_'.$row);
$bnr['block_id'] = Tools::getValue('block_' . $row);
$bnr['order'] = Tools::getValue('order_' . $row);
$bnr['blank'] = Tools::getValue('blank_' . $row) ? '1' : '0';
$bnr['active'] = Tools::getValue('active_' . $row) ? '1' : '0';
$bnr['rotate'] = Tools::getValue('rotate_' . $row) ? '1' : '0';
$bnrs[] = $bnr;
/* Patch by Madman */
if (isset($_FILES['banner_image_' . $row]) and isset($_FILES['banner_image_' . $row]['tmp_name']) and !empty($_FILES['banner_image_' . $row]['tmp_name'])) {
Configuration::set('PS_IMAGE_GENERATION_METHOD', 1);
$name = $_FILES['banner_image_' . $row]['name'];
$ext = strtolower(substr($name, strrpos($name, ".") + 1));
$path = $this->img_fpath . basename($_FILES['banner_image_' . $row]['name']);
if (stripos('/png/gif/jpg/jpeg/bmp/', $ext) === false) {
$errors .= $this->displayError($this->l('Incorrect file type.'));
}
if (_PS_VERSION_ < "1.5.4") {
/* If version is less then 1.5.4 */
if ($error = checkImage($_FILES['banner_image_' . $row], $this->maxImageSize)) {
$errors .= $this->displayError($error);
} elseif (!move_uploaded_file($_FILES['banner_image_' . $row]['tmp_name'], $path)) {
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
}
} else {
/* 1.5.4x */
if ($error = ImageManager::validateUpload($_FILES['banner_image_' . $row], $this->maxImageSize)) {
$errors .= $this->displayError($error);
} elseif (!move_uploaded_file($_FILES['banner_image_' . $row]['tmp_name'], $path)) {
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
}
}
if (isset($errors) && $errors) {
$errors .= $this->displayError($this->l('Error creating banner.'));
} elseif (!$this->updateBanner($bnr)) {
$errors .= $this->displayError($this->l('Error creating banner on database.'));
}
} else {
$errors .= $this->displayError($this->l('An error occurred during the banner image update.'));
}
/* Patch by Madman */
}
if ($this->saveBanners($bnrs)) {
$output .= $this->displayConfirmation($this->l('Banners updated successfully.'));
} else {
$output .= $this->displayError($this->l('There were problems updating banners.'));
}
}
} elseif (Tools::isSubmit('addSubmit')) {
$bnr['description'] = Tools::getValue('banner_description');
$bnr['image_link'] = Tools::getValue('banner_link');
$bnr['image_name'] = $_FILES['banner_image']['name'];
$bnr['block_id'] = Tools::getValue('banner_block_id');
$bnr['order'] = Tools::getValue('banner_order');
$bnr['blank'] = Tools::getValue('banner_blank') ? '1' : '0';
$bnr['active'] = Tools::getValue('banner_active') ? '1' : '0';
$bnr['rotate'] = Tools::getValue('banner_rotate') ? '1' : '0';
/* upload the image */
if (isset($_FILES['banner_image']) and isset($_FILES['banner_image']['tmp_name']) and !empty($_FILES['banner_image']['tmp_name'])) {
Configuration::set('PS_IMAGE_GENERATION_METHOD', 1);
$name = $_FILES['banner_image']['name'];
$ext = strtolower(substr($name, strrpos($name, ".") + 1));
$path = $this->img_fpath . basename($_FILES['banner_image']['name']);
if (stripos('/png/gif/jpg/jpeg/bmp/', $ext) === false) {
$errors .= $this->displayError($this->l('Incorrect file type.'));
}
if (_PS_VERSION_ < "1.5.4") {
/* If version is less then 1.5.4 */
if ($error = checkImage($_FILES['banner_image'], $this->maxImageSize)) {
$errors .= $this->displayError($error);
} elseif (!move_uploaded_file($_FILES['banner_image']['tmp_name'], $path)) {
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
}
} else {
/* 1.5.4x */
if ($error = ImageManager::validateUpload($_FILES['banner_image'], $this->maxImageSize)) {
$errors .= $this->displayError($error);
} elseif (!move_uploaded_file($_FILES['banner_image']['tmp_name'], $path)) {
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
//.........这里部分代码省略.........
示例15: postProcess
protected function postProcess()
{
$languages = Language::getLanguages(false);
$default_language = Configuration::get('PS_LANG_DEFAULT');
$max_image_size = 2 * 1024 * 1024;
// 2 Mb
$errors = array();
$res = 1;
for ($i = 1; $i < 6; $i++) {
$image_name = $_FILES['images']['name'][$i];
if ($image_name != null) {
$new_image_name = md5($image_name) . '.jpg';
$file = array();
$file['name'] = $_FILES['images']['name'][$i];
$file['tmp_name'] = $_FILES['images']['tmp_name'][$i];
$file['type'] = $_FILES['images']['type'][$i];
$file['error'] = $_FILES['images']['error'][$i];
$file['size'] = $_FILES['images']['size'][$i];
if ($error = checkImage($file, $max_image_size)) {
$errors[] = $error;
} elseif (!move_uploaded_file($file['tmp_name'], dirname(__FILE__) . '/img/' . $new_image_name)) {
$errors[] = $this->l('An error occurred during the image upload.');
}
if (!sizeof($errors)) {
// Clear old rows
$res &= $this->cleanDb($i);
// New rows
$res &= Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'reinsurance` (`id_reinsurance`, `filename`)
VALUES (\'' . (int) $i . '\', \'' . (isset($new_image_name) ? pSQL($new_image_name) : '') . '\')
');
}
}
}
foreach ($_POST['texts'] as $key => $text) {
$res &= $this->cleanTxt($key);
if ($text[$default_language] != null && Validate::isCleanHtml($text[$default_language])) {
if (!sizeof($errors)) {
foreach ($languages as $lang) {
if ($text[$lang['id_lang']] == '' || !Validate::isCleanHtml($text[$lang['id_lang']])) {
$text[$lang['id_lang']] = $text[$default_language];
}
$res &= Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'reinsurance_lang` (`id_reinsurance`, `id_lang`, `text`)
VALUES (\'' . (int) $key . '\', \'' . (int) $lang['id_lang'] . '\', \'' . pSQL($text[$lang['id_lang']]) . '\')
');
}
if (!$res) {
$errors[] = $this->l('An error occured on save');
}
}
} else {
if ($key == 1) {
$errors[] = $this->l('The block 1 is required');
} else {
// check if another language aren't empty
foreach ($text as $id_lang => $val) {
if ($id_lang != $default_language) {
if ($val != null) {
$errors[] = $this->l('The text for the block number') . ' ' . $key . ' ' . $this->l('is incorrect, the default language information is required ');
}
}
}
}
}
}
if (!sizeof($errors)) {
$this->_html .= $this->displayConfirmation($this->l('Configuration updated'));
} else {
$this->_html .= $this->displayError(implode('<br />', $errors));
}
}