Esempio n. 1
0
 function getMimeType()
 {
     if (isset($_SERVER['X-Mime-Type']) && is_mimetype_format($_SERVER['X-Mime-Type'])) {
         return $_SERVER['X-Mime-Type'];
     } else {
         return get_mimetype_by_extension(which_ext($_GET['qqfile']));
     }
 }
             $file_keys .= ($file_keys ? ":" : "") . $key . "_" . intval($value);
             $file_keywords[$key] = intval($value);
         } else {
             $file_error["keywords"][$key] = 1;
         }
     }
 }
 //starts upload of file
 if (!is_uploaded_file($_FILES["file"]["tmp_name"])) {
     $file_error["file"] = $BL['be_fprivup_err1'];
 } elseif ($_FILES["file"]["size"] > $phpwcms["file_maxsize"]) {
     $file_error["file"] = $BL['be_fprivup_err2'] . " " . number_format($phpwcms["file_maxsize"] / 1024, 2, ',', '.') . " kB";
 } else {
     $fileName = sanitize_filename($_FILES["file"]["name"]);
     $fileExt = check_image_extension($_FILES["file"]["tmp_name"], $fileName);
     $fileExt = $fileExt === false ? which_ext($fileName) : $fileExt;
     $fileHash = md5($fileName . microtime());
     $fileType = is_mimetype_format($_FILES["file"]["type"]) ? $_FILES["file"]["type"] : get_mimetype_by_extension($fileExt);
     $fileSize = intval($_FILES["file"]["size"]);
     // Check against forbidden file names
     $forbiddenUploadName = array('.htaccess', 'web.config', 'lighttpd.conf', 'nginx.conf');
     if (in_array(strtolower($fileName), $forbiddenUploadName)) {
         $file_error["file"] = sprintf($BL['be_fprivup_err7'], $fileName);
     }
     // Only allowed file extensions
     if (empty($file_error["file"])) {
         if (is_string($phpwcms['allowed_upload_ext'])) {
             $phpwcms['allowed_upload_ext'] = convertStringToArray(strtolower($phpwcms['allowed_upload_ext']));
         }
         if ($fileExt === '') {
             $file_error["file"] = sprintf($BL['be_fprivup_err9'], implode(', ', $phpwcms['allowed_upload_ext']));
Esempio n. 3
0
            $fileinfo['mimetype'] = $download["f_type"];
            $fileinfo['file'] = $fileinfo['path'] . $fileinfo['filename'];
            $fileinfo['extension'] = $download["f_ext"];
            $fileinfo['realfname'] = $phpwcms['sanitize_dlname'] ? phpwcms_remove_accents($download["f_name"]) : $download["f_name"];
            // start download
            $success = dl_file_resume($fileinfo['file'], $fileinfo, true);
        }
    }
    // we hack in the stream.php here
} elseif ($file = isset($_GET['file']) ? clean_slweg($_GET['file'], 40) : '') {
    $filename = basename($file);
    $file = PHPWCMS_ROOT . '/' . PHPWCMS_FILES . $filename;
    if (is_file($file)) {
        $mime = empty($_GET['type']) ? '' : clean_slweg($_GET['type'], 100);
        if (!is_mimetype_format($mime)) {
            $mime = get_mimetype_by_extension(which_ext($file));
        }
        header('Content-Type: ' . $mime);
        if (BROWSER_OS == 'iOS') {
            require_once PHPWCMS_ROOT . '/include/inc_lib/functions.file.inc.php';
            rangeDownload($file);
        } else {
            header('Content-Transfer-Encoding: binary');
            if (!isset($_GET['ios'])) {
                header('Content-Disposition: inline; filename="' . ($phpwcms['sanitize_dlname'] ? phpwcms_remove_accents($filename) : $filename) . '"');
            }
            header('Content-Length: ' . filesize($file));
            readfile($file);
        }
        $success = true;
    }
$handle = @opendir(PHPWCMS_ROOT . $phpwcms["ftp_path"]);
$fx = 0;
$fxsg = 0;
while ($file = @readdir($handle)) {
    if ($file != "." && $file != ".." && $file[0] != '.') {
        if (!is_dir($file) && ($fxs = filesize(PHPWCMS_ROOT . $phpwcms["ftp_path"] . $file))) {
            // test if the file should be deleted
            $file_base64 = base64_encode($file);
            if (isset($deleteFiles[$file_base64])) {
                if (@unlink(PHPWCMS_ROOT . $phpwcms["ftp_path"] . $file)) {
                    continue;
                }
            }
            $fxb = $fx % 2 ? " bgColor=\"#F9FAFB\"" : "";
            $fxsg += $fxs;
            $fxe = extimg(which_ext($file));
            // there is a big problem with special chars on Mac OS X and seems Windows too
            $filename = PHPWCMS_CHARSET != 'utf-8' && phpwcms_seems_utf8($file) ? str_replace('?', '', utf8_decode($file)) : $file;
            $filename = html($filename);
            ?>
          <tr<?php 
            echo $fxb;
            ?>
>
            <td align="center"><input name="ftp_mark[<?php 
            echo $fx;
            ?>
]" type="checkbox" id="ftp_mark_<?php 
            echo $fx;
            ?>
" value="1" class="ftp_mark" /></td>
Esempio n. 5
0
function saveUploadedFile($file, $target, $exttype = '', $imgtype = '', $rename = 0, $maxsize = 0)
{
    // imgtype can be all exif_imagetype supported by your PHP install
    // see http://www.php.net/exif_imagetype
    $file_status = array('status' => false, 'error' => '', 'name' => '', 'tmp_name' => '', 'size' => 0, 'path' => '', 'ext' => '', 'rename' => '', 'maxsize' => intval($maxsize), 'error_num' => 0, 'type' => '');
    if (!isset($_FILES[$file]) || !is_uploaded_file($_FILES[$file]['tmp_name'])) {
        $file_status['error'] = 'Upload not defined';
        return $file_status;
    }
    $file_status['name'] = sanitize_filename($_FILES[$file]['name']);
    $file_status['ext'] = which_ext($file_status['name']);
    $file_status['tmp_name'] = $_FILES[$file]['tmp_name'];
    $file_status['size'] = $_FILES[$file]['size'];
    $file_status['type'] = empty($_FILES[$file]['type']) || !is_mimetype_format($_FILES[$file]['type']) ? get_mimetype_by_extension($file_status['ext']) : $_FILES[$file]['type'];
    $file_status['path'] = $target;
    $file_status['rename'] = $file_status['name'];
    $file_status['maxsize'] = empty($file_status['maxsize']) ? $GLOBALS['phpwcms']['file_maxsize'] : $file_status['maxsize'];
    if (intval($file_status['size']) > $file_status['maxsize']) {
        $file_status['error'] = 'File is too large';
        $file_status['error_num'] = 400;
        return $file_status;
    }
    if (empty($target)) {
        $file_status['error'] = 'Target directory not defined';
        $file_status['error_num'] = 412;
        return $file_status;
    }
    if (!@_mkdir($target)) {
        $file_status['error'] = 'The target directory "' . $target . '" can not be found or generated';
        $file_status['error_num'] = 412;
        return $file_status;
    }
    if ($_FILES[$file]['error']) {
        $file_status['error'] = $_FILES[$file]['error'];
        $file_status['error_num'] = 409;
        return $file_status;
    }
    if ($imgtype) {
        $imgtype = convertStringToArray(strtolower($imgtype));
        if (count($imgtype)) {
            $data = @getimagesize($_FILES[$file]['tmp_name']);
            $exif_imagetype = array(1 => 'gif', 2 => 'jpeg', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tif', 8 => 'tiff', 9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm');
            if (!$data && !$exttype) {
                $file_status['error'] = 'Format' . ($file_status['ext'] ? ' *.' . $file_status['ext'] : '') . ' not supported (';
                $allowed = array();
                foreach ($imgtype as $value) {
                    $allowed[] = '*.' . $exif_imagetype[$value];
                }
                $file_status['error'] .= implode(', ', $allowed) . ')';
                $file_status['error_num'] = 415;
                @unlink($_FILES[$file]['tmp_name']);
                return $file_status;
            } elseif ($data) {
                if (empty($exif_imagetype[$data[2]]) || !in_array($data[2], $imgtype)) {
                    $file_status['error'] = 'File type ';
                    $file_status['error'] .= empty($exif_imagetype[$data[2]]) ? $data[2] : $exif_imagetype[$data[2]];
                    $file_status['error'] .= ' is not supported for this upload (';
                    foreach ($imgtype as $imgt) {
                        $file_status['error'] .= empty($exif_imagetype[$imgt]) ? $imgt : $exif_imagetype[$imgt];
                        $file_status['error'] .= ', ';
                    }
                    $file_status['error'] = trim(trim($file_status['error']), ',');
                    $file_status['error'] .= ' only)';
                    $file_status['error_num'] = 415;
                    @unlink($_FILES[$file]['tmp_name']);
                    return $file_status;
                }
                $file_status['image'] = $data;
                $exttype = '';
            }
        }
    }
    if ($exttype) {
        $exttype = convertStringToArray(strtolower($exttype));
        if (!in_array($file_status['ext'], $exttype)) {
            $file_status['error'] = 'File type *.' . $file_status['ext'] . ' is not supported for this upload (*.' . implode(', *.', $exttype) . ' only)';
            $file_status['error_num'] = 415;
            @unlink($_FILES[$file]['tmp_name']);
            return $file_status;
        }
    }
    if (!is_writable($target)) {
        $file_status['error'] = 'Target directory <b>' . str_replace(PHPWCMS_ROOT, '', $target) . '</b> is not writable';
        $file_status['error_num'] = 412;
        @unlink($_FILES[$file]['tmp_name']);
        return $file_status;
    }
    $rename = convertStringToArray($rename);
    if (count($rename)) {
        $_temp_name = cut_ext($file_status['rename']);
        foreach ($rename as $value) {
            switch ($value) {
                case 1:
                    $_temp_name = str_replace(array(':', '/', "\\", ' '), array('-', '-', '-', '_'), phpwcms_remove_accents($_temp_name));
                    $_temp_name = preg_replace('/[^0-9a-z_\\-\\.]/i', '', $_temp_name);
                    break;
                case 2:
                    $_temp_name = time() . '_' . $_temp_name;
                    break;
                case 3:
                    $_temp_name = date('Ymd-His') . '_' . $_temp_name;
                    break;
                case 4:
                    $_temp_name = date('Ymd') . '_' . $_temp_name;
                    break;
                case 5:
                    $_temp_name = generic_string(6) . '_' . $_temp_name;
                    break;
                case 6:
                    $_temp_name = md5($_temp_name . ($file_status['ext'] ? '.' . $file_status['ext'] : ''));
                    break;
                case 7:
                    $_temp_name = shortHash($_temp_name . ($file_status['ext'] ? '.' . $file_status['ext'] : ''));
                    break;
            }
        }
        $file_status['rename'] = $_temp_name . ($file_status['ext'] ? '.' . $file_status['ext'] : '');
    }
    @umask(0);
    if (!@move_uploaded_file($_FILES[$file]['tmp_name'], $target . $file_status['rename'])) {
        if (!copy($_FILES[$file]['tmp_name'], $target . $file_status['rename'])) {
            $file_status['error'] = 'Saving uploaded file <b>' . html($file_status['name']) . '</b> to <b>' . html(str_replace(PHPWCMS_ROOT, '', $target . $file_status['rename'])) . '</b> failed';
            $file_status['error_num'] = 412;
            @unlink($_FILES[$file]['tmp_name']);
            return $file_status;
        }
    }
    @chmod($target . $file_status['rename'], 0644);
    $file_status['status'] = true;
    return $file_status;
}
Esempio n. 6
0
    ?>
<p><img src="../../img/symbole/rotation.gif" alt="" width="15" height="15"><strong class="title">&nbsp;selected files uploaded via ftp will be taken over!</strong></p><?php 
    echo "<p class=\"v10\">";
    flush();
    foreach ($ftp["mark"] as $key => $value) {
        if (!ini_get('safe_mode') && function_exists('set_time_limit')) {
            set_time_limit(60);
        }
        $file = $ftp["file"][$key];
        $file_path = PHPWCMS_ROOT . $phpwcms["ftp_path"] . $file;
        if (is_file($file_path)) {
            $file_type = '';
            $file_error["upload"] = 0;
            $file_size = filesize($file_path);
            $file_ext = check_image_extension($file_path);
            $file_ext = false === $file_ext ? which_ext($file) : $file_ext;
            $file_name = sanitize_filename($ftp["filename"][$key]);
            $file_hash = md5($file_name . microtime());
            if (trim($file_type) === '') {
                //check file_type
                if (is_mimetype_by_extension($file_ext)) {
                    $file_type = get_mimetype_by_extension($file_ext);
                } else {
                    $file_check = getimagesize($file_path);
                    if (version_compare("4.3.0", phpversion(), ">=") && $file_check) {
                        $file_type = image_type_to_mime_type($file_check[2]);
                    }
                    if (!is_mimetype_format($file_type)) {
                        $file_type = get_mimetype_by_extension($file_ext);
                    }
                }
     $guestbook['c'] = render_cnt_template($guestbook['c'], 'NAME', html_specialchars($guestbook['row']['guestbook_name']));
     $guestbook['c'] = render_cnt_template($guestbook['c'], 'MSG', nl2br($guestbook['row']['guestbook_msg']));
     $guestbook['c'] = preg_replace_callback('/{TIMESTAMP:(.*)}/', 'guestbook_date_callback', $guestbook['c']);
     // do gb image ;-)
     $guestbook['entry_image'] = '';
     if (isset($guestbook['imgdata']) && !empty($guestbook['row']['guestbook_image'])) {
         if (file_exists($guestbook['image_dir'] . '/' . $guestbook['row']['guestbook_image'])) {
             $thumb_image = false;
             $thumb_img = '';
             $thumb_image = get_cached_image(array("target_ext" => which_ext($guestbook['row']['guestbook_image']), "image_name" => $guestbook['row']['guestbook_image'], "image_dir" => $guestbook['image_dir'] . '/', "max_width" => $guestbook['imgdata'][0], "max_height" => $guestbook['imgdata'][1], "thumb_name" => md5($guestbook['row']['guestbook_image'] . $guestbook['imgdata'][0] . $guestbook['imgdata'][1] . $phpwcms["sharpen_level"] . $phpwcms['colorspace'])));
             if ($thumb_image != false) {
                 $guestbook['entry_image'] = '<img src="' . PHPWCMS_IMAGES . $thumb_image[0] . '" ' . $thumb_image[3];
                 $guestbook['entry_image'] .= ' alt="' . html_specialchars($guestbook['row']['guestbook_imagename']) . '" />';
                 //zoom
                 if ($guestbook['imgdata'][2]) {
                     $zoominfo = get_cached_image(array("target_ext" => which_ext($guestbook['row']['guestbook_image']), "image_name" => $guestbook['row']['guestbook_image'], "image_dir" => $guestbook['image_dir'] . '/', "max_width" => $phpwcms["img_prev_width"], "max_height" => $phpwcms["img_prev_height"], "thumb_name" => md5($guestbook['row']['guestbook_image'] . $phpwcms["img_prev_width"] . $phpwcms["img_prev_height"] . $phpwcms["sharpen_level"] . $phpwcms['colorspace'])));
                     if ($zoominfo != false) {
                         $popup_img = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]);
                         $guestbook['entry_image'] = '<a href="' . $popup_img . '" onclick="window.open(\'' . $popup_img . "','previewpic','width=" . $zoominfo[1] . ",height=" . $zoominfo[2] . "');return false;" . '">' . $guestbook['entry_image'] . '</a>';
                     }
                 }
             }
         }
     }
     $guestbook['c'] = render_cnt_template($guestbook['c'], 'IMAGE', $guestbook['entry_image']);
     $guestbook['entry_list'] .= $guestbook['c'];
     $guestbook['counter']++;
 }
 mysql_free_result($guestbook['result']);
 // initialize lightbox
 if ($thumb_image != false) {
Esempio n. 8
0
     $rss['items'][$c] = render_cnt_template($rss['template_ITEM'], 'LINK', $rssvalue->get_permalink());
     $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'TITLE', $rssvalue->get_title());
     $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'DESCRIPTION', $rssvalue->get_description());
     $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'CONTENT', $rssvalue->get_content());
     // author
     $rss['item_author'] = $rssvalue->get_author();
     $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'AUTHOR', $rss['item_author'] ? $rss['item_author']->get_name() : '');
     // item date
     $rss['items'][$c] = render_cnt_date($rss['items'][$c], $rssvalue->get_date('U'));
     // Thumbnail
     $rss['item_thumbnail'] = '';
     if ($rss['enclosure'] = $rssvalue->get_enclosure()) {
         $rss['item_thumbnail'] = $rss['enclosure']->get_thumbnail();
         if (!$rss['item_thumbnail'] && $rss['enclosure']->get_link()) {
             $rss['item_thumbnail'] = $rss['enclosure']->get_link();
             if ($rss['item_thumbnail'] && ($rss['item_thumbnail_ext'] = which_ext($rss['item_thumbnail']))) {
                 if (!in_array($rss['item_thumbnail_ext'], array('jpg', 'jpeg', 'png', 'gif'))) {
                     $rss['item_thumbnail'] = '';
                 }
             } else {
                 $rss['item_thumbnail'] = '';
             }
         }
     }
     $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'IMAGE', $rss['item_thumbnail']);
     $c++;
     if ($rssfeed["item"] && $rssfeed["item"] == $c) {
         break;
     }
 }
 // whole rss feed
     $content['opengraph']['title'] = $value['cnt_title'];
     if ($value['cnt_opengraph_teasertext']) {
         $content['opengraph']['description'] = $value['cnt_opengraph_teasertext'];
     }
     if (!$value['cnt_opengraph']) {
         $content['opengraph']['support'] = false;
     }
 }
 // Image
 if (empty($value['cnt_object']['cnt_image']['id'])) {
     $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'IMAGE', '');
     $value['cnt_object']['cnt_image']['id'] = '';
     $value['cnt_object']['cnt_image']['ext'] = '';
 } else {
     $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'IMAGE', html_specialchars($value['cnt_object']['cnt_image']['name']));
     $value['cnt_object']['cnt_image']['ext'] = which_ext($value['cnt_object']['cnt_image']['name']);
     if (!isset($content['images']['news'])) {
         $content['images']['news'] = array();
     }
     $content['images']['news'][$value['cnt_object']['cnt_image']['id']] = array('name' => $value['cnt_object']['cnt_image']['name'], 'id' => $value['cnt_object']['cnt_image']['id'], 'ext' => $value['cnt_object']['cnt_image']['ext'], 'list' => $news['list_mode']);
     if ($value['cnt_object']['cnt_image']['ext']) {
         $value['cnt_object']['cnt_image']['ext'] = '.' . $value['cnt_object']['cnt_image']['ext'];
     }
 }
 $news['entries'][$key] = str_replace('{IMAGE_ID}', $value['cnt_object']['cnt_image']['id'], $news['entries'][$key]);
 $news['entries'][$key] = str_replace('{IMAGE_EXT}', $value['cnt_object']['cnt_image']['ext'], $news['entries'][$key]);
 // Zoom Image
 if (empty($value['cnt_object']['cnt_image']['zoom'])) {
     $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'ZOOM', '');
 } else {
     $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'ZOOM', 'zoom');
Esempio n. 10
0
/**
 * render <!-- JS: PluginName|my.js //Whatever text -->
 */
function renderHeadJS($js)
{
    if (is_array($js) && isset($js[1])) {
        $js = $js[1];
    }
    $js = trim($js);
    if (empty($js)) {
        return '';
    }
    $remote = substr($js, 0, 4) == 'http' ? true : false;
    if (!$remote && (strpos($js, ';') !== false || strpos($js, '//') !== false || strpos($js, '/*') !== false)) {
        $key = md5($js);
        // add the same section only once
        if (empty($GLOBALS['block']['custom_htmlhead'][$key])) {
            $GLOBALS['block']['custom_htmlhead'][$key] = '  <script' . SCRIPT_ATTRIBUTE_TYPE . '>' . LF . SCRIPT_CDATA_START . LF . '	';
            $GLOBALS['block']['custom_htmlhead'][$key] .= $js;
            $GLOBALS['block']['custom_htmlhead'][$key] .= LF . SCRIPT_CDATA_END . LF . '  </script>';
        }
    } elseif ($js == 'initJSLib') {
        initJSLib();
    } elseif ($remote || which_ext($js) == 'js') {
        // decide if plugin or script
        // replace {TEMPLATE}
        $js = str_replace('{TEMPLATE}', TEMPLATE_PATH, $js);
        $GLOBALS['block']['custom_htmlhead'][md5($js)] = getJavaScriptSourceLink(html_specialchars($js));
    } else {
        initJSLib();
        if (strtolower($js) != 'initlib') {
            initJSPlugin($js);
        }
    }
    return '';
}
Esempio n. 11
0
/**
 * Render CSS related template code
 *
 * relative or absolute external css file
 * <!-- CSS: file.css -->
 *
 * put as inline CSS in separate <style> section in head
 * <!-- CSS: img {} -->
 */
function renderHeadCSS($css)
{
    if (is_array($css) && isset($css[1])) {
        $css = $css[1];
    }
    $css = trim($css);
    if (empty($css)) {
        return '';
    }
    // test for .css as file extension
    $ext = which_ext($css);
    $key = md5($css);
    // if it is a css file register it as external css file
    if ($ext == 'css') {
        $css = str_replace(' ', '%20', str_replace('{TEMPLATE}', TEMPLATE_PATH, html_specialchars($css)));
        if (strpos($css, '/') !== false) {
            $GLOBALS['block']['custom_htmlhead'][$key] = '  <link rel="stylesheet" type="text/css" href="' . $css . '"' . HTML_TAG_CLOSE;
        } else {
            $GLOBALS['block']['css'][$css] = $css;
        }
        // otherwise create a CSS <style> section
    } else {
        // add the same section only once
        if (isset($GLOBALS['block']['custom_htmlhead'][$key])) {
            return '';
        }
        $GLOBALS['block']['custom_htmlhead'][$key] = '  <style type="text/css">' . LF . SCRIPT_CDATA_START . LF . '	';
        $GLOBALS['block']['custom_htmlhead'][$key] .= str_replace('{TEMPLATE}', TEMPLATE_PATH, $css);
        $GLOBALS['block']['custom_htmlhead'][$key] .= LF . SCRIPT_CDATA_END . LF . '  </style>';
    }
    return '';
}
Esempio n. 12
0
function check_image_extension($file, $filename = '')
{
    // only checks against correct image extension
    $image_info = getimagesize($file);
    $result = false;
    if (false != $image_info) {
        switch ($image_info[2]) {
            case 1:
                $result = 'gif';
                break;
            case 2:
                $result = 'jpg';
                break;
            case 3:
                $result = 'png';
                break;
            case 4:
                $result = 'swf';
                break;
            case 5:
                $result = 'psd';
                break;
            case 6:
                $result = 'bmp';
                break;
            case 7:
                $result = 'tif';
                break;
                //(intel byte order),
            //(intel byte order),
            case 8:
                $result = 'tif';
                break;
                //(motorola byte order),
            //(motorola byte order),
            case 9:
                $result = 'jpc';
                break;
            case 10:
                $result = 'jp2';
                break;
            case 11:
                $result = 'jpx';
                break;
            case 12:
                $result = 'jb2';
                break;
            case 13:
                // there is a problem in some cases swf -> swc ? why ever!
                // do an additional extension check and compare against swf
                $result = strtolower(which_ext($filename)) == 'swf' ? 'swf' : 'swc';
                break;
            case 14:
                $result = 'iff';
                break;
            case 15:
                // there seems to be a problem with getimagesize and Quicktime VR
                // mov -> wmbf ? why ever!
                // do an additional extension check and compare against mov
                $result = strtolower(which_ext($filename)) == 'mov' ? 'mov' : 'wbmp';
                break;
            case 16:
                $result = 'xbm';
                break;
        }
    }
    return $result;
}
Esempio n. 13
0
function parse_downloads($match)
{
    if (isset($match[1])) {
        $value = array();
        $value['cnt_object']['cnt_files']['id'] = convertStringToArray($match[1]);
        if (isset($value['cnt_object']['cnt_files']['id']) && is_array($value['cnt_object']['cnt_files']['id']) && count($value['cnt_object']['cnt_files']['id'])) {
            global $phpwcms;
            $value['cnt_object']['cnt_files']['caption'] = isset($match[3]) ? @html_entity_decode(trim($match[3]), ENT_QUOTES, PHPWCMS_CHARSET) : '';
            $value['files_direct_download'] = 0;
            $value['files_template'] = 'download-inline';
            if (!empty($match[2])) {
                $match[2] = explode('=', trim($match[2]));
                if (!empty($match[2][1])) {
                    $value['files_template'] = trim($match[2][1]);
                    if (which_ext($value['files_template']) == '') {
                        $value['files_template'] .= '.tmpl';
                    }
                }
            }
            $IS_NEWS_CP = true;
            $crow = array();
            $news = array('files_result' => '');
            // include content part files renderer
            include PHPWCMS_ROOT . '/include/inc_front/content/cnt7.article.inc.php';
            if ($news['files_result']) {
                return $news['files_result'];
            }
        }
    }
    return isset($match[3]) ? $match[3] : '';
}
Esempio n. 14
0
		hr {margin:0;padding:0;height:1px;border:0;border-bottom:1px solid #666666;page-break-after:always;}
		td {font-size: 10pt;}
	</style>' . LF;
    echo '</head>' . LF;
    echo '<body>' . LF;
    $elements = array();
    for ($x = 1; $x < $row; $x++) {
        echo '<p style="font-weight:bold">page ' . $x . ' of ' . ($row - 1) . '</p>' . LF;
        echo '<table border="0" cellspacing="0" cellpadding="0" summary="ID:' . $fid . '">' . LF;
        foreach ($export[0] as $key => $value) {
            echo '<tr>' . LF;
            echo '	<td valign="top" style="padding:0 5px 0 0;"><strong>' . ucfirst($key) . '</strong></td>' . LF;
            echo '	<td valign="top" style="padding:0 0 3px 0;">';
            if (isset($export[$x][$key])) {
                if (strpos($export[$x][$key], '/' . $phpwcms["content_path"] . 'form/')) {
                    $ext = which_ext($export[$x][$key]);
                    $export[$x][$key] = html($export[$x][$key]);
                    if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png') {
                        echo '<img src="' . $export[$x][$key] . '" border="0" alt="" />';
                    } else {
                        echo '<a href="' . $export[$x][$key] . '">' . $export[$x][$key] . '</a>';
                    }
                } else {
                    echo html($export[$x][$key]);
                }
            } else {
                echo '&nbsp;';
            }
            echo '</td>' . LF . '</tr>' . LF;
        }
        echo '</table>' . LF . '<hr />' . LF;
Esempio n. 15
0
 $img_thumb_ext = 'jpg';
 if (!empty($row["article_image"]["hash"])) {
     $thumb_image = get_cached_image(array("target_ext" => $row["article_image"]['ext'], "image_name" => $row["article_image"]['hash'] . '.' . $row["article_image"]['ext'], "max_width" => $row["article_image"]['width'], "max_height" => $row["article_image"]['height'], "thumb_name" => md5($row["article_image"]['hash'] . $row["article_image"]['width'] . $row["article_image"]['height'] . $phpwcms["sharpen_level"] . $phpwcms['colorspace'])));
     if ($thumb_image != false) {
         $thumb_img = '<img src="' . PHPWCMS_IMAGES . $thumb_image[0] . '" ' . $thumb_image[3];
         $thumb_img .= ' alt="' . html_specialchars($caption[1]) . '"';
         if ($caption[3]) {
             $thumb_img .= ' title="' . html_specialchars($caption[3]) . '"';
         }
         $thumb_img .= ' class="' . $template_default['classes']['image-thumb'] . '" />';
         $img_thumb_name = $thumb_image[0];
         $img_thumb_rel = PHPWCMS_IMAGES . $thumb_image[0];
         $img_thumb_abs = PHPWCMS_URL . PHPWCMS_IMAGES . $thumb_image[0];
         $img_thumb_width = $thumb_image[1];
         $img_thumb_height = $thumb_image[2];
         $img_thumb_ext = which_ext($thumb_image[0]);
         $content['images']['article'] = array('name' => $row["article_image"]["name"], 'hash' => $row["article_image"]["hash"], 'ext' => $img_thumb_ext, 'image' => array('width' => $img_thumb_width, 'height' => $img_thumb_height, 'src' => $img_thumb_rel));
         if ($row["article_image"]["zoom"]) {
             $zoominfo = get_cached_image(array("target_ext" => $row["article_image"]['ext'], "image_name" => $row["article_image"]['hash'] . '.' . $row["article_image"]['ext'], "max_width" => $phpwcms["img_prev_width"], "max_height" => $phpwcms["img_prev_height"], "thumb_name" => md5($row["article_image"]['hash'] . $phpwcms["img_prev_width"] . $phpwcms["img_prev_height"] . $phpwcms["sharpen_level"] . $phpwcms['colorspace'])));
             if ($zoominfo != false) {
                 $img_zoom_name = $zoominfo[0];
                 $img_zoom_rel = PHPWCMS_IMAGES . $zoominfo[0];
                 $img_zoom_abs = PHPWCMS_URL . PHPWCMS_IMAGES . $zoominfo[0];
                 $img_zoom_width = $zoominfo[1];
                 $img_zoom_height = $zoominfo[2];
                 $content['images']['article']['zoom'] = array('width' => $img_zoom_width, 'height' => $img_zoom_height, 'src' => $img_zoom_rel);
                 $popup_img = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]);
                 if (!empty($caption[2][0])) {
                     $open_link = $caption[2][0];
                     $return_false = '';
                 } else {
Esempio n. 16
0
         if ($cat->term) {
             $article_categories[$key] = $cat->term;
         } else {
             unset($article_categories[$key]);
         }
     }
     $article_categories = implode(', ', $article_categories);
 }
 $feedimport_result['image'] = array('tmpllist' => $feedimport_result['cnt_object']['article_template_list'], 'tmplfull' => $feedimport_result['cnt_object']['article_template_detail'], 'name' => '', 'id' => '', 'caption' => '', 'hash' => '', 'width' => '', 'ext' => '', 'list_usesummary' => 0, 'list_name' => '', 'list_id' => 0, 'list_width' => '', 'list_height' => '', 'list_zoom' => 0, 'list_caption' => '', "list_hash" => '', 'zoom' => 0);
 // Thumbnail
 $article_thumbnail = '';
 if ($article_enclosure = $rssvalue->get_enclosure()) {
     $article_thumbnail = $article_enclosure->get_thumbnail();
     if (!$article_thumbnail && $article_enclosure->get_link()) {
         $article_thumbnail = $article_enclosure->get_link();
         if ($article_thumbnail && ($article_thumbnail_ext = which_ext($article_thumbnail)) && in_array($article_thumbnail_ext, array('jpg', 'jpeg', 'png', 'gif'))) {
             if ($feedimport_result['cnt_object']['image_url_replace'][0] !== '') {
                 $article_thumbnail = str_replace($feedimport_result['cnt_object']['image_url_replace'][0], $feedimport_result['cnt_object']['image_url_replace'][1], $article_thumbnail);
             }
             $article_thumbnail_name = basename($article_thumbnail);
             $article_thumbnail_hash = md5($article_thumbnail_name . microtime());
             $article_thumbnail_store = PHPWCMS_STORAGE . $article_thumbnail_hash . '.' . $article_thumbnail_ext;
             $oldmask = umask(0);
             $insert = false;
             if ($dir = @opendir(PHPWCMS_STORAGE) && copy($article_thumbnail, $article_thumbnail_store)) {
                 if ($article_thumbnail_size = filesize($article_thumbnail_store)) {
                     // yeah, we have it
                     $data = array('f_pid' => $feedimport_result['cnt_object']['image_folder_id'], 'f_uid' => $feedimport_result['cnt_object']['author_id'], 'f_kid' => 1, 'f_aktiv' => 1, 'f_public' => 1, 'f_name' => $article_thumbnail_name, 'f_created' => now(), 'f_size' => $article_thumbnail_size, 'f_type' => get_mimetype_by_extension($article_thumbnail_ext), 'f_ext' => $article_thumbnail_ext, 'f_longinfo' => $article_title, 'f_hash' => $article_thumbnail_hash, 'f_copyright' => '', 'f_tags' => $article_categories);
                     if (PHPWCMS_CHARSET != 'utf-8') {
                         $data['f_name'] = makeCharsetConversion($data['f_name'], 'utf-8', PHPWCMS_CHARSET);
                         $data['f_longinfo'] = makeCharsetConversion($data['f_longinfo'], 'utf-8', PHPWCMS_CHARSET);
Esempio n. 17
0
                    }
                }
                $basis = floor($value["max_width"] / $grid);
                if (!$basis) {
                    $basis = 1;
                }
                $value["max_width"] = $basis * $grid;
                $basis = floor($value["max_height"] / $grid);
                if (!$basis) {
                    $basis = 1;
                }
                $value["max_height"] = $basis * $grid;
            }
            if (($image = get_cached_image($value, false, false)) && !empty($image[0])) {
                // Redirect, the "old" way
                if (!empty($phpwcms['cmsimage_redirect'])) {
                    headerRedirect(PHPWCMS_URL . PHPWCMS_IMAGES . $image[0], 301);
                }
                if (empty($image['type'])) {
                    $image['type'] = get_mimetype_by_extension(which_ext($image[0]));
                }
                header('Content-Type: ' . $image['type']);
                header('Content-Disposition: inline');
                @readfile(PHPWCMS_THUMB . $image[0]);
                exit;
            }
        }
    }
}
// uncached transparent GIF
phpwcms_empty_gif();