Ejemplo n.º 1
0
/**
 * 图片上传
 * @param array $file 图片文件数组
 * @param int $maxSize 允许最大尺寸
 * @param array $allowExtension 允许上传图片的扩展名数组
 * @param int $is_thumbnail 是否生成缩略图
 * @param array $thumbnail_size 缩略图的尺寸和后缀(该参数和$is_thumbnail同时出现同时消失)
 * @return array
 */
function upload(array $file, $maxSize, array $allowExtension, $is_thumbnail = 0, array $thumbnail_size)
{
    $year = date("Y");
    $month = date("m");
    $day = date("d");
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . "/uploads/{$year}/{$month}/{$day}";
    if (!file_exists($targetPath)) {
        mkdir($targetPath, 0755, true);
    }
    if ($file['files']['size'][0] > $maxSize) {
        return array('status' => false, 'msg' => '图片文件过大,请选择另外的图片');
    } else {
        $fileParts = pathinfo($file['files']['name'][0]);
        $tempFile = $file['files']['tmp_name'][0];
        if (in_array(strtolower($fileParts['extension']), $allowExtension)) {
            $uploadFileName = generateTargetFileName($fileParts['extension']);
            $targetFile = rtrim($targetPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $uploadFileName;
            move_uploaded_file($tempFile, $targetFile);
            if ($is_thumbnail) {
                foreach ($thumbnail_size as $v) {
                    thumbnail($targetFile, $v[0], $v[1], $v[2]);
                }
            }
            return array('status' => true, 'src' => 'http://' . $_SERVER['HTTP_HOST'] . "/uploads/{$year}/{$month}/{$day}/" . $uploadFileName, 'filename' => "/uploads/{$year}/{$month}/{$day}/" . $uploadFileName);
        } else {
            return array('status' => false, 'msg' => '不支持的图片格式');
        }
    }
}
Ejemplo n.º 2
0
 function thumb_url($type = '', $filename = '', $thumb_width = 0, $thumb_height = 0, $is_create = false, $is_crop = true, $crop_mode = 'center', $is_sharpen = false, $um_value = '80/0.5/3', $create_animate_thumb = false)
 {
     if (empty($type) or empty($filename)) {
         $filename = 'noimage.gif';
         $thumb = thumbnail('', $filename, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value, $create_animate_thumb);
         return site_url($thumb);
     }
     $thumb = thumbnail($type, $filename, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value, $create_animate_thumb);
     return site_url($thumb);
 }
Ejemplo n.º 3
0
function images($params)
{
    global $template_file;
    $template_file = '';
    $data = array();
    //
    $data['path'] = implode('/', $params);
    $files_path = STATIC_FILES_ROOT . $data['path'] . '/';
    if (!is_dir($files_path)) {
        mkdir($files_path, 0775, true);
    }
    //
    if (isset($_FILES['file']) && isset($_FILES['file']['tmp_name']) && $_FILES['file']['tmp_name'] != '') {
        include 'interfaces/image_magic.php';
        move_uploaded_file($_FILES['file']['tmp_name'], $files_path . $_FILES['file']['name']);
        $new_name = time() . '.jpg';
        $image = load_image($files_path . $_FILES['file']['name']);
        save_image($image, $files_path . $new_name, 'jpg');
        //
        $thumbnail = thumbnail($image, 160);
        save_image($thumbnail, $files_path . 'thumb_' . $new_name, 'jpg');
        //
        unlink($files_path . $_FILES['file']['name']);
        imagedestroy($image);
        imagedestroy($thumbnail);
    }
    //
    $data['files'] = array();
    if ($dh = opendir($files_path)) {
        while (($file = readdir($dh)) !== false) {
            if ($file == '.' || $file == '..' || is_dir($files_path . '/' . $file)) {
            } else {
                if (substr($file, 0, 6) == 'thumb_') {
                    $filemtime = filemtime($files_path . '/' . $file);
                    $type = strtolower(substr($file, strrpos($file, '.') + 1));
                    $file_size = filesize($files_path . '/' . $file);
                    $data['files'][] = array('type' => $type, 'file_size' => intval($file_size / 10.24) / 100, 'created_at' => $filemtime, 'thumb' => $file, 'name' => substr($file, 6));
                }
            }
        }
        closedir($dh);
    }
    return $data;
}
Ejemplo n.º 4
0
    $this->date('c');
    ?>
" itemprop="datePublished"><?php 
    $this->date('Y-m-d');
    ?>
</time> | 
								<span class="glyphicon glyphicon-comment"></span><a href="<?php 
    $this->permalink();
    ?>
#comments"><?php 
    $this->commentsNum('没有评论', '1 条评论', '%d 条评论');
    ?>
</a>
							</dd>
							<dd	class="thumbnail"><img src="<?php 
    @thumbnail($this);
    ?>
" alt="<?php 
    $this->title();
    ?>
"></dd>
							<dd class="article_list_txt">
								<?php 
    @summary($this);
    ?>
							</dd>
						</dl>
					</article>
				<?php 
}
?>
Ejemplo n.º 5
0
        ?>



            <li class="media">
            <div class="mw-ui-row-nodrop">
                <?php 
        if (!isset($show_fields) or $show_fields == false or in_array('thumbnail', $show_fields)) {
            ?>
                  <div class="mw-ui-col" style="width: 80px;">
                    <div class="mw-ui-col-container">
                        <a href="<?php 
            print $item['link'];
            ?>
" class="pull-left bgimg" style="background-image: url(<?php 
            print thumbnail($item['image'], $tn[0], $tn[1]);
            ?>
);"></a>
                    </div>
                  </div>
                <?php 
        }
        ?>
                <div class="mw-ui-col">
                    <div class="mw-ui-col-container">
                        <div class="media-body extra-wrap">
              <?php 
        if (!isset($show_fields) or $show_fields == false or in_array('title', $show_fields)) {
            ?>
               <a href="<?php 
            print $item['link'];
session_start();
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
ini_set('error_prepend_string', "<p class=text-error>");
ini_set('error_append_string', "</p>");
if (!isset($_SESSION["uid"])) {
    die("Oups");
}
include_once dirname(__FILE__) . "/ressources/class.templates.inc";
include_once dirname(__FILE__) . "/ressources/class.users.menus.inc";
include_once dirname(__FILE__) . "/ressources/class.miniadm.inc";
include_once dirname(__FILE__) . "/ressources/class.user.inc";
include_once dirname(__FILE__) . "/ressources/class.squid.youtube.inc";
if (isset($_GET["thumbnail"])) {
    thumbnail();
    exit;
}
if (!$_SESSION["AsWebStatisticsAdministrator"]) {
    die("oups");
}
if (isset($_GET["content"])) {
    content();
    exit;
}
if (isset($_GET["master-content"])) {
    master_content();
    exit;
}
if (isset($_GET["categories-list"])) {
    categories_list();
Ejemplo n.º 7
0
    for ($i = 0; $i < sizeof($cart_items); $i++) {
        ?>
            <?php 
        $p = get_picture($cart_items[$i]['rel_id']);
        ?>
            <?php 
        if ($p != false) {
            ?>
            <span data-index="<?php 
            print $i;
            ?>
" class="bgimage mw-order-item-image mw-order-item-image-<?php 
            print $i;
            ?>
" style="width: 70px;height:70px;background-image:url(<?php 
            print thumbnail($p, 120, 120);
            ?>
);"></span>
            <?php 
        }
        ?>
            <?php 
    }
    ?>
          </div>
          <table class="mw-ui-table mw-ui-table-basic" cellspacing="0" cellpadding="0" width="100%" id="order-information-table">
            <thead>
              <tr>
                <th><?php 
    _e("Product Name");
    ?>
Ejemplo n.º 8
0
        ?>
" href="<?php 
        print mw()->url_manager->link_to_file($item);
        ?>
"  onclick="mw.url.windowHashParam('select-file', '<?php 
        print mw()->url_manager->link_to_file($item);
        ?>
'); return false;">
          <?php 
        $ext = strtolower(get_file_extension($item));
        ?>
          <?php 
        if ($ext == 'jpg' or $ext == 'png' or $ext == 'gif' or $ext == 'jpeg' or $ext == 'bmp') {
            ?>
          <img data-src="<?php 
            print thumbnail(mw()->url_manager->link_to_file($item), 48, 48);
            ?>
" class="image-item image-item-not-ready" />
          <?php 
        } else {
            ?>
          <span class="mw-fileico mw-fileico-<?php 
            print $ext;
            ?>
"><?php 
            print $ext;
            ?>
</span>
          <?php 
        }
        ?>
Ejemplo n.º 9
0
function get_view_thumbnail($contents, $thumb_width = 0)
{
    global $board, $config;
    if (!$thumb_width) {
        $thumb_width = $board['bo_image_width'];
    }
    // $contents 중 img 태그 추출
    $matches = get_editor_image($contents, true);
    if (empty($matches)) {
        return $contents;
    }
    for ($i = 0; $i < count($matches[1]); $i++) {
        $img = $matches[1][$i];
        preg_match("/src=[\\'\"]?([^>\\'\"]+[^>\\'\"]+)/i", $img, $m);
        $src = $m[1];
        preg_match("/style=[\"\\']?([^\"\\'>]+)/i", $img, $m);
        $style = $m[1];
        preg_match("/width:\\s*(\\d+)px/", $style, $m);
        $width = $m[1];
        preg_match("/height:\\s*(\\d+)px/", $style, $m);
        $height = $m[1];
        preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $img, $m);
        $alt = get_text($m[1]);
        // 이미지 path 구함
        $p = parse_url($src);
        if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) {
            $data_path = preg_replace('/^\\/.*\\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']);
        } else {
            $data_path = $p['path'];
        }
        $srcfile = G5_PATH . $data_path;
        if (is_file($srcfile)) {
            $size = @getimagesize($srcfile);
            if (empty($size)) {
                continue;
            }
            // jpg 이면 exif 체크
            if ($size[2] == 2 && function_exists('exif_read_data')) {
                $degree = 0;
                $exif = @exif_read_data($srcfile);
                if (!empty($exif['Orientation'])) {
                    switch ($exif['Orientation']) {
                        case 8:
                            $degree = 90;
                            break;
                        case 3:
                            $degree = 180;
                            break;
                        case 6:
                            $degree = -90;
                            break;
                    }
                    // 세로사진의 경우 가로, 세로 값 바꿈
                    if ($degree == 90 || $degree == -90) {
                        $tmp = $size;
                        $size[0] = $tmp[1];
                        $size[1] = $tmp[0];
                    }
                }
            }
            // 원본 width가 thumb_width보다 작다면
            if ($size[0] <= $thumb_width) {
                continue;
            }
            // Animated GIF 체크
            $is_animated = false;
            if ($size[2] == 1) {
                $is_animated = is_animated_gif($srcfile);
            }
            // 썸네일 높이
            $thumb_height = round($thumb_width * $size[1] / $size[0]);
            $filename = basename($srcfile);
            $filepath = dirname($srcfile);
            // 썸네일 생성
            if (!$is_animated) {
                $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false);
            } else {
                $thumb_file = $filename;
            }
            if (!$thumb_file) {
                continue;
            }
            if ($width) {
                $thumb_tag = '<img src="' . G5_URL . str_replace($filename, $thumb_file, $data_path) . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"/>';
            } else {
                $thumb_tag = '<img src="' . G5_URL . str_replace($filename, $thumb_file, $data_path) . '" alt="' . $alt . '"/>';
            }
            // $img_tag에 editor 경로가 있으면 원본보기 링크 추가
            $img_tag = $matches[0][$i];
            if (strpos($img_tag, G5_DATA_DIR . '/' . G5_EDITOR_DIR) && preg_match("/\\.({$config['cf_image_extension']})\$/i", $filename)) {
                $imgurl = str_replace(G5_URL, "", $src);
                $thumb_tag = '<a href="' . G5_BBS_URL . '/view_image.php?fn=' . urlencode($imgurl) . '" target="_blank" class="view_image">' . $thumb_tag . '</a>';
            }
            $contents = str_replace($img_tag, $thumb_tag, $contents);
        }
    }
    return $contents;
}
Ejemplo n.º 10
0
function getThumb($path, $filename, $regen = false)
{
    global $thumbnailPrefix;
    if (!permForPath($path, 'read')) {
        jsonStart();
        error('You do not have permission for this action.');
        return false;
    }
    $srcImagePath = $path . '/' . $filename;
    if (file_exists($srcImagePath)) {
        $file = explode('.', $filename);
        if (count($file) === 1) {
            // Handle no extension
            return false;
        }
        $extension = strtolower(array_pop($file));
        $filenameBase = implode('.', $file);
        $thumbPath = $path . '/' . $thumbnailPrefix . $filenameBase . '.' . $extension . '.jpg';
        if (!file_exists($thumbPath)) {
            thumbnail($path, $filename);
        }
        if ($regen) {
            return;
        }
        $thumb = file_get_contents($thumbPath);
        header("Content-type:image/jpeg");
        echo $thumb;
    } else {
        // FIXME: error condition
    }
}
Ejemplo n.º 11
0
                            $strCategoria = filter_var($strTags[$xf], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
                            $strCategoria = urldecode($strTags[$xf]);
                            while (false !== ($file = readdir($handle))) {
                                $fechaRss = gmdate("D, d M Y H:i:s O", (int) filectime($file));
                                if (filemtime($file) !== FALSE) {
                                    $fechaRss = gmdate("D, d M Y H:i:s O", (int) filemtime($file));
                                }
                                $fecha = gmdate("<b>d-M-Y</b> G:i", (int) filectime($file));
                                if (filemtime($file) !== FALSE) {
                                    $fecha = gmdate("<b>d-M-Y</b> G:i", (int) filemtime($file));
                                }
                                $posVarTag = strrpos($file, "_T_");
                                if ($file != $w . ".xml" && $file != "cache" && $file != "." && $file != ".." && strtolower(substr($file, strrpos($file, '.') + 1)) == 'xml' && strlen($file) > 6 && strpos($strFilesT, utf8_encode($file) . ";", 0) === false && ($posVarTag === false || ($_SESSION['iduserx'] == $cnfAdm || $_SESSION['iduserx'] == $forumMod))) {
                                    //die($strCategoria);
                                    if (strpos(strtolower(utf8_encode($file)), $strCategoria, 0) !== false) {
                                        $thumbnail = thumbnail($file, $cnfHome, $cnfLogo, $cnfThumbnail);
                                        /*echo "<div class='boxForum2in'>";						*/
                                        echo '<a href="' . $cnfHome . $pathForumTotal . $auxBlog . $strLink . utf8_encode(basename($file, ".xml") . PHP_EOL) . $strLinkEnd . '"><div class="boxRelated">						
						<div class="hexagon75" style="background-image:url(' . $thumbnail . ');">
						<div class="hexTop75"></div>			
						<div class="hexBottom75"></div>
						</div>
						&nbsp;&nbsp;&nbsp;' . str_replace("-", " ", utf8_encode(basename($file, ".xml") . PHP_EOL)) . '
						</div></a>';
                                        /*                    echo "<a class='aFloatMessage'
                                        href='" . $cnfHome . $pathForumTotal . $auxBlog . $strLink . utf8_encode(basename($file, ".xml") . PHP_EOL) . $strLinkEnd . "'><div class='boxRelated'><h5 class='h5Left'>". str_replace("-", " ", utf8_encode(basename($file, ".xml") . PHP_EOL)) . " </h5>&nbsp;&nbsp;Última respuesta:&nbsp;&nbsp;<time class='entry-date' datetime='" . $fechaRss . "'>" . $fecha . "</time></div></a>";*/
                                        $xtag++;
                                        //echo $xtag.">".intval($cnfRelatedSubject)."<br>";
                                        if ($xtag > intval($cnfRelatedSubject)) {
                                            break 2;
                                        }
Ejemplo n.º 12
0
    ?>
    <div class="well mw-module-images">
        <div class=" mw-rotator mw-rotator-template-slider" id="<?php 
    print $id;
    ?>
">
            <div class=" mw-gallery-holder">
                <?php 
    foreach ($data as $item) {
        ?>
                    <div class=" mw-gallery-item mw-gallery-item-<?php 
        print $item['id'];
        ?>
">
                        <img src="<?php 
        print thumbnail($item['filename'], 700);
        ?>
" alt=""/>
                        <?php 
        if ($item['title'] != '') {
            ?>
<i class="mw-rotator-description"><i
                                class="mw-rotator-description-content"><?php 
            print $item['title'];
            ?>
</i></i><?php 
        }
        ?>
                    </div>
                <?php 
    }
Ejemplo n.º 13
0
function get_itemuselist_thumbnail($it_id, $contents, $thumb_width, $thumb_height, $is_create = false, $is_crop = true, $crop_mode = 'center', $is_sharpen = true, $um_value = '80/0.5/3')
{
    global $g5, $config;
    $img = $filename = $alt = "";
    if ($contents) {
        $matches = get_editor_image($contents, false);
        for ($i = 0; $i < count($matches[1]); $i++) {
            // 이미지 path 구함
            $p = parse_url($matches[1][$i]);
            if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) {
                $data_path = preg_replace('/^\\/.*\\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']);
            } else {
                $data_path = $p['path'];
            }
            $srcfile = G5_PATH . $data_path;
            if (preg_match("/\\.({$config['cf_image_extension']})\$/i", $srcfile) && is_file($srcfile)) {
                $size = @getimagesize($srcfile);
                if (empty($size)) {
                    continue;
                }
                $filename = basename($srcfile);
                $filepath = dirname($srcfile);
                preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $matches[0][$i], $malt);
                $alt = get_text($malt[1]);
                break;
            }
        }
        if ($filename) {
            $thumb = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
            if ($thumb) {
                $src = G5_URL . str_replace($filename, $thumb, $data_path);
                $img = '<img src="' . $src . '" width="' . $thumb_width . '" height="' . $thumb_height . '" alt="' . $alt . '">';
            }
        }
    }
    if (!$img) {
        $img = get_it_image($it_id, $thumb_width, $thumb_height);
    }
    return $img;
}
Ejemplo n.º 14
0
            ?>
" class="bgimage-fader">

      
      <span class="<?php 
            print isset($pictures[1]) ? 'multiple-thumbnails' : 'single-thumbnail';
            ?>
" style="background-image: url(<?php 
            print thumbnail($item['image'], $tn[0], $tn[1]);
            ?>
);"></span>
      <?php 
            if (isset($pictures[1])) {
                ?>
      <span style="background-image: url(<?php 
                print thumbnail($pictures[1]['filename'], $tn[0], $tn[1]);
                ?>
);"></span>

     <?php 
            }
            ?>

      </a>
      <?php 
        }
        ?>
      <div class="module-products-template-slider-item-container">
      <?php 
        if ($show_fields == false or in_array('title', $show_fields)) {
            ?>
Ejemplo n.º 15
0
echo form_textarea('blog_blog', $locale['blog_0425'], $data['blog_blog'], $snippetSettings);
$extendedSettings = array();
if (!fusion_get_settings("tinymce_enabled")) {
    $extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['blog_0426b'], "form_name" => "inputform");
} else {
    $extendedSettings = array("type" => "tinymce", "tinymce" => "advanced");
}
echo form_textarea('blog_extended', $locale['blog_0426'], $data['blog_extended'], $extendedSettings);
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
openside('');
if ($data['blog_image'] != "" && $data['blog_image_t1'] != "") {
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-6'>\n";
    $image_thumb = get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2']);
    echo "<label>" . thumbnail($image_thumb, '100px');
    echo "<input type='checkbox' name='del_image' value='y' /> " . $locale['delete'] . "</label>\n";
    echo "</div>\n";
    echo "<div class='col-xs-12 col-sm-6'>\n";
    $alignOptions = array('pull-left' => $locale['left'], 'blog-img-center' => $locale['center'], 'pull-right' => $locale['right']);
    echo form_select('blog_ialign', $locale['blog_0442'], $data['blog_ialign'], array("options" => $alignOptions, "inline" => FALSE));
    echo "</div>\n</div>\n";
    echo "<input type='hidden' name='blog_image' value='" . $data['blog_image'] . "' />\n";
    echo "<input type='hidden' name='blog_image_t1' value='" . $data['blog_image_t1'] . "' />\n";
    echo "<input type='hidden' name='blog_image_t2' value='" . $data['blog_image_t2'] . "' />\n";
} else {
    $file_input_options = array('upload_path' => IMAGES_B, 'max_width' => $blog_settings['blog_photo_max_w'], 'max_height' => $blog_settings['blog_photo_max_h'], 'max_byte' => $blog_settings['blog_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $blog_settings['blog_thumb_w'], 'thumbnail_h' => $blog_settings['blog_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $blog_settings['blog_photo_w'], 'thumbnail2_h' => $blog_settings['blog_photo_h'], 'type' => 'image');
    echo form_fileinput("blog_image", $locale['blog_0439'], "", $file_input_options);
    echo "<div class='small m-b-10'>" . sprintf($locale['blog_0440'], parsebytesize($blog_settings['blog_photo_max_b'])) . "</div>\n";
    $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
    echo form_select('blog_ialign', $locale['blog_0442'], $data['blog_ialign'], array("options" => $alignOptions));
Ejemplo n.º 16
0
                            <span></span> </label>
        <span class="mw-icon-drag mw_admin_posts_sortable_handle"
              onmousedown="mw.manage_content_sort()"></span></div>
                    <div class="mw-ui-col manage-post-item-col-2">
                    


                        <?php 
            $pic = get_picture($item['id']);
            ?>
                        <?php 
            if ($pic == true) {
                ?>
                            <a class="manage-post-image"
                               style="background-image: url('<?php 
                print thumbnail($pic, 108);
                ?>
');"
                               onClick="mw.url.windowHashParam('action','editpage:<?php 
                print $item['id'];
                ?>
');return false;"></a>
                        <?php 
            } else {
                ?>
                            <a
                                class="manage-post-image manage-post-image-no-image <?php 
                if (isset($item['content_type'])) {
                    print ' manage-post-image-' . $item['content_type'];
                }
                if (isset($item['is_shop']) and $item['is_shop'] == 1) {
Ejemplo n.º 17
0
function items_BeforeShow()
{
    //items_BeforeShow @4-10DCF469
    //Custom Code @7-2A29BDB7
    global $Tpl;
    global $itemvars;
    global $items;
    global $newvars;
    global $currency;
    global $emails1;
    global $joinJS;
    global $admingroup;
    global $editorCSS;
    global $PHP_SELF;
    if (CCGetFromGet("ItemNum", "") || CCGetFromGet("PreviewNum", "")) {
        $db = new clsDBNetConnect();
        $db->connect();
        $SQL = "SELECT * FROM items WHERE ItemNum=" . CCGetFromGet("ItemNum", "");
        if (CCGetFromGet("PreviewNum", "")) {
            $SQL = "SELECT * FROM items_preview WHERE ItemNum=" . CCGetFromGet("PreviewNum", "");
        }
        $db->query($SQL);
        $Result = $db->next_record();
        if ($Result) {
            $itemvars = array("ItemNum" => $db->f(ItemNum), "category" => $db->f(category), "user_id" => $db->f(user_id), "title" => $db->f(title), "status" => $db->f(status), "end_reason" => $db->f(end_reason), "started" => $db->f(started), "closes" => $db->f(closes), "image_preview" => $db->f(image_preview), "slide_show" => $db->f(slide_show), "counter" => $db->f(counter), "added_description" => $db->f("added_description"), "dateadded" => $db->f("dateadded"), "make_offer" => $db->f(make_offer), "image_one" => $db->f(image_one), "image_two" => $db->f(image_two), "image_three" => $db->f(image_three), "image_four" => $db->f(image_four), "image_five" => $db->f(image_five), "asking_price" => $db->f(asking_price), "quantity" => $db->f(quantity), "city_town" => $db->f(city_town), "state_province" => $db->f(state_province), "country" => $db->f("country"), "ship1" => $db->f("ship1"), "shipfee1" => $db->f("shipfee1"), "ship2" => $db->f("ship2"), "shipfee2" => $db->f("shipfee2"), "ship3" => $db->f("ship3"), "shipfee3" => $db->f("shipfee3"), "ship4" => $db->f("ship4"), "shipfee4" => $db->f("shipfee4"), "ship5" => $db->f("ship5"), "shipfee5" => $db->f("shipfee5"), "item_paypal" => $db->f("item_paypal"), "hits" => $db->f(hits));
            if (!CCGetUserID()) {
                $mustbe = "<table class=\"ct\" width=\"80%\" cellspacing=\"1\" cellpadding=\"1\">\n\n        <tr>\n\n          <td bgcolor=\"#ffffff\" align=\"middle\" valign=\"bottom\">\n            <form method=\"post\" action=\"login.php?ret_link=" . $_SERVER["REQUEST_URI"] . "&type=notLogged&ccsForm=Login\" name=\"Login\">\n\n              <font class=\"fhf\">Login To Ask A Question</font>\n\n              <table cellpadding=\"5\" cellspacing=\"1\" class=\"ft\">\n                <tr>\n\n                  <td></td>\n\n                </tr>\n\n                <tr>\n\n                  <td align=\"right\"><b>Username:</b>&nbsp;</td>\n\n                  <td align=\"left\"><input name=\"login\" value=\"\" maxlength=\"100\" class=\"input\">&nbsp;</td>\n\n                </tr>\n\n                <tr>\n\n                  <td align=\"right\"><b>Password:</b>&nbsp;</td>\n\n                  <td align=\"left\"><input type=\"password\" name=\"password\" value=\"\" maxlength=\"100\" class=\"input\">&nbsp;<a href=\"login.php\">Forgot Password</a></td>\n\n                </tr>\n\n                <tr>\n\n                  <td align=\"middle\" colspan=\"2\">\n\n                    <input name=\"DoLogin\" type=\"submit\" value=\"Login\" class=\"button\">&nbsp;</td>\n\n                </tr>\n\n                <tr>\n\n                   <td align=\"middle\" colspan=\"2\">\n\n                   New Users:&nbsp;<a href=\"register.php\">Register</a>\n\n                   </td>\n\n                </tr>\n\n              </table>\n\n            </form>\n\n           </td>\n\n        </tr>\n\n      </table>";
            }
            if (!CCGetUserID() && $itemvars["make_offer"] == 1) {
                $mustbeoffer = "<b>You must be logged in to make an offer</b>";
            }
            if (CCGetUserID() && $itemvars["status"] == 1 && $itemvars["item_paypal"] != "") {
                $Tpl->SetVar("item_paypal", "&nbsp;&nbsp;<a href=\"confirm.php?what=buynowPayPal&ItemNum=" . $itemvars["ItemNum"] . "\"><B>Buy Now</b></a>");
            }
            if (!CCGetUserID() && $itemvars["make_offer"] == 1 && $itemvars["status"] == 1 && $itemvars["item_paypal"] == "") {
                $Tpl->SetVar("makeoffer", "&nbsp;&nbsp;<a href=\"login.php?ret_link=ViewItem.php?ItemNum=" . $itemvars["ItemNum"] . "&type=notLogged\">Login to Make an Offer<a>");
                $Tpl->SetVar("item_paypal", "");
            }
            if (!CCGetUserID() && $itemvars["make_offer"] == 1 && $itemvars["status"] == 1 && $itemvars["item_paypal"] != "") {
                $Tpl->SetVar("makeoffer", "&nbsp;&nbsp;<a href=\"login.php?ret_link=ViewItem.php?ItemNum=" . $itemvars["ItemNum"] . "&type=notLogged\">Login to Buy this Item Or Make an Offer<a>");
                $Tpl->SetVar("item_paypal", "");
            }
            $Tpl->SetVar("NotLogged", $mustbe);
            $Tpl->SetVar("NotLogged2", $mustbeoffer);
            $ldb = new clsDBNetConnect();
            $ldb->connect();
            $ldb2 = new clsDBNetConnect();
            $ldb2->connect();
            $ldb3 = new clsDBNetConnect();
            $ldb3->connect();
            $ldb4 = new clsDBNetConnect();
            $ldb4->connect();
            $ldb5 = new clsDBNetConnect();
            $ldb5->connect();
            $ldb->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $itemvars["category"]);
            if ($ldb->next_record()) {
                $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb->f("cat_id") . "\">" . $ldb->f("name") . "</a>";
                $ldb2->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb->f("sub_cat_id"));
                if ($ldb2->next_record()) {
                    $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb2->f("cat_id") . "\">" . $ldb2->f("name") . "</a> > " . $newvars["catlist"];
                    $ldb3->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb2->f("sub_cat_id"));
                    if ($ldb3->next_record()) {
                        $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb3->f("cat_id") . "\">" . $ldb3->f("name") . "</a> > " . $newvars["catlist"];
                        $ldb4->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb3->f("sub_cat_id"));
                        if ($ldb4->next_record()) {
                            $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb4->f("cat_id") . "\">" . $ldb4->f("name") . "</a> > " . $newvars["catlist"];
                            $ldb5->query("SELECT name, sub_cat_id, cat_id FROM categories WHERE cat_id=" . $ldb4->f("sub_cat_id"));
                            if ($ldb5->next_record()) {
                                $newvars["catlist"] = "<a href=\"ViewCat.php?CatID=" . $ldb5->f("cat_id") . "\">" . $ldb5->f("name") . "</a> > " . $newvars["catlist"];
                            }
                        }
                    }
                }
            }
            $newvars["category"] = CCDLookUP("name", "categories", "cat_id=" . $itemvars["category"], $db);
            $newvars["categoryid"] = CCDLookUP("sub_cat_id", "categories", "cat_id=" . $itemvars["category"], $db);
            $newvars["categoryparent"] = CCDLookUP("name", "categories", "cat_id=" . $newvars["categoryid"], $db);
            if ($newvars["categoryparent"]) {
                $newvars["categoryparent"] = "<a href=\"ViewCat.php?CatID=" . $newvars["categoryid"] . "\">" . $newvars["categoryparent"] . "</a> >> ";
            }
            $newvars["sellerid"] = $itemvars["user_id"];
            $newvars["seller"] = CCDLookUP("user_login", "users", "user_id=" . $itemvars["user_id"], $db);
            if ($itemvars["status"] == 1) {
                $newvars["status"] = "Open";
            }
            if ($itemvars["status"] == 2) {
                $newvars["status"] = "Closed";
            }
            if ($itemvars["status"] == 0) {
                $newvars["status"] = "This Item has not been started yet";
            }
            $newvars["preview_image"] = "<img src=\"images/blank.jpg\">";
            $newvars["cellbreaker2"] = "";
            $newvars["cellbreaker1"] = "</td><td class=\"data\">";
            //if(itemvars["image_preview"] == 1){
            if ($itemvars["image_five"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_five"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageFive"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_five"] . "\"></td></tr>";
            }
            if ($itemvars["image_four"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_four"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageFour"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_four"] . "\"></td></tr>";
            }
            if ($itemvars["image_three"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_three"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageThree"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_three"] . "\"></td></tr>";
            }
            if ($itemvars["image_two"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_two"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageTwo"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_two"] . "\"></td></tr>";
            }
            if ($itemvars["image_one"] != "") {
                $newvars["preview_image"] = thumbnail($itemvars["image_one"], 225, 225, 0, 0);
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["imageOne"] = "<tr><td align=\"center\"><img src=\"" . $itemvars["image_one"] . "\"></td></tr>";
            }
            //}
            $javafirst = 0;
            $javalast = 0;
            if ($itemvars["image_five"] != "") {
                $imreturn = thumbnail($itemvars["image_five"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_five"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_five"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_four"] != "") {
                $imreturn = thumbnail($itemvars["image_four"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_four"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_four"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_three"] != "") {
                $imreturn = thumbnail($itemvars["image_three"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_three"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_three"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_two"] != "") {
                $imreturn = thumbnail($itemvars["image_two"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_two"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_two"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["image_one"] != "") {
                $imreturn = thumbnail($itemvars["image_one"], 225, 225, 0, 1);
                $imreturn2 = thumbnail($itemvars["image_one"], 100, 100, 0, 1);
                $imreturn3 = thumbnail($itemvars["image_one"], 350, 350, 0, 1);
                $sone = explode("^", $imreturn);
                $sone2 = explode("^", $imreturn2);
                $sone3 = explode("^", $imreturn3);
                if ($javalast == 0) {
                    $endatt = "\n";
                    $javalast = 1;
                } elseif ($javalast == 1) {
                    $endatt = ",\n";
                }
                $newvars["slidesrc"] = "\"{$sone['0']}\"" . $endatt . $newvars["slidesrc"];
                $newvars["slideht"] = "\"{$sone['1']}\"" . $endatt . $newvars["slideht"];
                $newvars["slidewt"] = "\"{$sone['2']}\"" . $endatt . $newvars["slidewt"];
                $newvars["slideht2"] = "\"{$sone2['1']}\"" . $endatt . $newvars["slideht2"];
                $newvars["slidewt2"] = "\"{$sone2['2']}\"" . $endatt . $newvars["slidewt2"];
                $newvars["slideht3"] = "\"{$sone3['1']}\"" . $endatt . $newvars["slideht3"];
                $newvars["slidewt3"] = "\"{$sone3['2']}\"" . $endatt . $newvars["slidewt3"];
                unset($imreturn);
                unset($sone);
            }
            if ($itemvars["slide_show"] == 1) {
                $sliderun = "1";
                $newvars["cellbreaker2"] = "</td><td class=\"data\">";
                $newvars["cellbreaker1"] = "";
                $newvars["preview_image"] = "<table width=\"235\" align=\"center\" valign=\"middle\" class=\"ct\" height=\"235\" border=\"1\"><tr><td align=\"center\" valign=\"middle\" class=\"ltdt\">" . $newvars["preview_image"] . "\n</td></tr>\n</table>\n<table class=\"ct\" width=\"235\"><tr bgcolor=\"#FFFFFF\">\n<td align=\"center\" width=\"33%\"><a href=\"javascript:chgImg(-1)\"><img src=\"images/prev.gif\" border=\"0\"></a></td>\n<td align=\"center\" width=\"33%\"><a href=\"javascript:auto()\"><img src=\"images/play.gif\" border=\"0\"></a></td>\n<td align=\"center\" width=\"33%\"><a href=\"javascript:chgImg(1)\"><img src=\"images/next.gif\" border=\"0\"></a></td>\n</tr>\n</table>";
            } elseif ($itemvars["image_preview"] == 1) {
                $sliderun = "0";
                $newvars["preview_image"] = "<table width=\"235\" align=\"center\" valign=\"middle\" class=\"ct\" height=\"235\" border=\"1\"><tr><td align=\"center\" valign=\"middle\" class=\"ltdt\">" . $newvars["preview_image"] . "\n</td></tr>\n</table>\n<table width=\"235\"><tr>\n<td align=\"right\"></td>\n<td align=\"center\"></td>\n<td align=\"left\"></td>\n</tr>\n</table>";
            } else {
                $sliderun = "0";
                $newvars["preview_image"] = "<img src=\"images/blank.jpg\">";
            }
            $theday = getdate($itemvars["started"]);
            $startdate = $theday["weekday"] . ", " . $theday["month"] . " " . $theday["mday"] . ", " . $theday["year"];
            $newvars["started"] = $startdate;
            unset($theday);
            $theday = getdate($itemvars["closes"]);
            $enddate = $theday["weekday"] . ", " . $theday["month"] . " " . $theday["mday"] . ", " . $theday["year"];
            $newvars["closes"] = $enddate;
            if ($itemvars["city_town"] != "") {
                $newvars["city_town"] = $itemvars["city_town"] . ", ";
            }
            if ($itemvars["make_offer"] == 0 || $itemvars["make_offer"] == "" || $itemvars["make_offer"] == NULL) {
                $emails1->Visible = false;
            }
            $newvars["thiscat"] = "<a href=\"ViewCat.php?CatID=" . $itemvars["category"] . "\">" . $newvars["category"] . "</a>";
            $hits = "";
            if ($itemvars["counter"] == 1) {
                $hits = $itemvars["hits"];
            }
            if ($itemvars["dateadded"] != "" and $itemvars["added_description"] != "") {
                $newvars["dateadded"] = "<b>On " . date("F j, Y", $itemvars["dateadded"]) . ", " . $newvars["seller"] . " added:";
            }
            if ($itemvars["country"] != "") {
                $cnt = new clsDBNetConnect();
                $cnt->connect();
                $countryi = CCDLookUP("country_desc", "lookup_countries", "country_id=" . $itemvars["country"], $cnt);
            }
            //*********************************//
            //Get Custom Category template Vars//
            //*********************************//
            $cats = "(";
            $db = new clsDBNetConnect();
            $query = "select * from categories where cat_id='" . $itemvars["category"] . "'";
            $db->query($query);
            $db->next_record();
            $cats .= "cat_id=" . $db->f("cat_id");
            if ($db->f("sub_cat_id") > 0) {
                $cats .= " or ";
                $sub = $db->f("sub_cat_id");
                $query = "select * from categories where cat_id={$sub}";
                $db->query($query);
                $db->next_record();
                $cats .= "cat_id=" . $db->f("cat_id");
                if ($db->f("sub_cat_id") > 0) {
                    $cats .= " or ";
                    $sub = $db->f("sub_cat_id");
                    $query = "select * from categories where cat_id={$sub}";
                    $db->query($query);
                    $db->next_record();
                    $cats .= "cat_id=" . $db->f("cat_id");
                    if ($db->f("sub_cat_id") > 0) {
                        $cats .= " or ";
                        $sub = $db->f("sub_cat_id");
                        $query = "select * from categories where cat_id={$sub}";
                        $db->query($query);
                        $db->next_record();
                        $cats .= "cat_id=" . $db->f("cat_id");
                        if ($db->f("sub_cat_id") > 0) {
                            $cats .= " or ";
                            $sub = $db->f("sub_cat_id");
                            $query = "select * from categories where cat_id={$sub}";
                            $db->query($query);
                            $db->next_record();
                            $cats .= "cat_id=" . $db->f("cat_id");
                            if ($db->f("sub_cat_id") > 0) {
                                $cats .= " or ";
                                $sub = $db->f("sub_cat_id");
                                $query = "select * from categories where cat_id={$sub}";
                                $db->query($query);
                                $db->next_record();
                                $cats .= "cat_id=" . $db->f("cat_id");
                                if ($db->f("sub_cat_id") > 0) {
                                    $cats .= " or ";
                                    $sub = $db->f("sub_cat_id");
                                    $query = "select * from categories where cat_id={$sub}";
                                    $db->query($query);
                                    $db->next_record();
                                    $cats .= "cat_id=" . $db->f("cat_id");
                                } else {
                                    $cats .= ")";
                                }
                            } else {
                                $cats .= ")";
                            }
                        } else {
                            $cats .= ")";
                        }
                    } else {
                        $cats .= ")";
                    }
                } else {
                    $cats .= ")";
                }
            } else {
                $cats .= ")";
            }
            /////////////////////////////////
            //Send Custom TextArea Plugins //
            /////////////////////////////////
            $custtxt = new clsDBNetConnect();
            $query = "select * from custom_textarea where {$cats}";
            $custtxt->query($query);
            $queryfields = "(";
            $count = 0;
            while ($custtxt->next_record()) {
                if ($count > 0) {
                    $queryfields .= " or ";
                }
                $queryfields .= "field_id='" . $custtxt->f("id") . "'";
                $fields[$custtxt->f("id")] = $custtxt->f("template_var");
                $count++;
            }
            $queryfields .= ") and";
            if ($queryfields != "() and") {
                $query = "select * from custom_textarea_values where {$queryfields} ItemNum=" . $itemvars["ItemNum"];
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    //AdminEdit	abilities section
                    if ($admingroup) {
                        $editorCSS .= "\n#ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $joinJS .= "join(\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_\", true)\n";
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], "\n<DIV id=\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View\">\n" . stripslashes($custtxt->f("value")) . "\n</div>\n" . "<textarea id=\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\" class=\"inplace\" tabindex=\"1\" name=\"ta_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\"></textarea>\n");
                    } else {
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], stripslashes($custtxt->f("value")));
                    }
                }
            }
            /////////////////////////////////
            //Send Custom TextBox Plugins  //
            /////////////////////////////////
            $fields = "";
            $custtxt = new clsDBNetConnect();
            $query = "select * from custom_textbox where {$cats}";
            $custtxt->query($query);
            $queryfields = "(";
            $count = 0;
            while ($custtxt->next_record()) {
                if ($count > 0) {
                    $queryfields .= " or ";
                }
                $queryfields .= "field_id='" . $custtxt->f("id") . "'";
                $fields[$custtxt->f("id")] = $custtxt->f("template_var");
                $count++;
            }
            $queryfields .= ") and";
            if ($queryfields != "() and") {
                $query = "select * from custom_textbox_values where {$queryfields} ItemNum=" . $itemvars["ItemNum"];
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    //AdminEdit	abilities section
                    if ($admingroup) {
                        $editorCSS .= "\n#tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $joinJS .= "join(\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_\", true)\n";
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], "\n<DIV id=\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_View\">\n" . stripslashes($custtxt->f("value")) . "\n</div>\n" . "<textarea id=\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\" class=\"inplace\" tabindex=\"1\" name=\"tb_" . $fields[$custtxt->f("field_id")] . "_" . $custtxt->f("field_id") . "_Edit\"></textarea>\n");
                    } else {
                        $Tpl->SetVar($fields[$custtxt->f("field_id")], stripslashes($custtxt->f("value")));
                    }
                }
            }
            //////////////////////////////////
            //Send Custom DropDown Plugins  //
            //////////////////////////////////
            $fields = "";
            $custtxt = new clsDBNetConnect();
            $query = "select * from custom_dropdown where {$cats}";
            $custtxt->query($query);
            $queryfields = "(";
            $count = 0;
            while ($custtxt->next_record()) {
                if ($count > 0) {
                    $queryfields .= " or ";
                }
                $queryfields .= "field_id='" . $custtxt->f("id") . "'";
                $fields[$custtxt->f("id")] = $custtxt->f("template_var");
                $count++;
            }
            $queryfields .= ")";
            if ($queryfields != "()") {
                $query = "select * from custom_dropdown_options where {$queryfields}";
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    $value[$custtxt->f("id")] = $custtxt->f("option");
                }
                $queryfields .= " and";
                $query = "select * from custom_dropdown_values where {$queryfields} ItemNum=" . $itemvars["ItemNum"];
                $custtxt->query($query);
                while ($custtxt->next_record()) {
                    $Tpl->SetVar($fields[$custtxt->f("field_id")], stripslashes($value[$custtxt->f("option_id")]));
                }
            }
            if ($itemvars["ship1"]) {
                $Tpl->SetBlockVar("shipping", "");
                $i = 1;
                $ship = "";
                while ($itemvars["ship{$i}"]) {
                    $ship .= "\t\t\t<tr>\n";
                    //ADMIN EDIT ABILITY SECTION
                    if ($admingroup) {
                        $editorCSS .= "\n#ship" . $i . "View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#ship" . $i . "View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#ship" . $i . "Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $editorCSS .= "\n#shipfee" . $i . "View {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#shipfee" . $i . "View:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#shipfee" . $i . "Edit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                        $joinJS .= "join(\"shipfee" . $i . "\", true)\n";
                        $joinJS .= "join(\"ship" . $i . "\", true)\n";
                        $ship .= "\t\t\t\t<td width=\"20%\">";
                        $ship .= "\n<DIV id=\"ship" . $i . "View\">\n" . $itemvars["ship{$i}"] . "\n</div>\n" . "<textarea id=\"ship" . $i . "Edit\" class=\"inplace\" tabindex=\"1\" name=\"ship" . $i . "Edit\"></textarea>\n";
                        $ship .= "</td>\n";
                        $ship .= "\t\t\t\t<td width=\"80%\">";
                        $ship .= "\n<DIV id=\"shipfee" . $i . "View\">\n" . $itemvars["shipfee{$i}"] . "\n</div>\n" . "<textarea id=\"shipfee" . $i . "Edit\" class=\"inplace\" tabindex=\"1\" name=\"shipfee" . $i . "Edit\"></textarea>\n";
                        $ship .= "</td>\n";
                    } else {
                        ///NOT ADMIN EDITABLE
                        $ship .= "\t\t\t\t<td width=\"20%\">" . $itemvars["ship{$i}"] . "</td>\n";
                        $ship .= "\t\t\t\t<td width=\"80%\">" . $itemvars["shipfee{$i}"] . "</td>\n";
                    }
                    $ship .= "\t\t\t</tr>\n";
                    $i++;
                }
                $Tpl->setVar("shippingoptions", $ship);
                $Tpl->parse("shipping", "");
            }
            $subsc_memb = subscription_membership($newvars["sellerid"], "icontext", "&nbsp;&nbsp;");
            if ($_GET["PreviewNum"]) {
                $Tpl->setblockvar("Preview", "");
                $Tpl->setvar("finalcat", $itemvars["category"]);
                $Tpl->setvar("ItemNum", $itemvars["ItemNum"]);
                $Tpl->parse("Preview", True);
            }
            if ($admingroup) {
                //Title AdminEdit
                $editorCSS .= "\n.inspector {\n\tfont-size: 11px;\n}\n\n#titleView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#titleView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#titleEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"title\", true)\n";
                $itemvars["title2"] = "\n<DIV id=\"titleView\">\n" . $itemvars["title"] . "\n</div>\n" . "<textarea id=\"titleEdit\" class=\"inplace\" tabindex=\"1\" name=\"titleEdit\"></textarea>\n";
                //Added Description AdminEdit
                if ($itemvars["added_description"]) {
                    $editorCSS .= "\n#added_descriptionView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#added_descriptionView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#added_descriptionEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                    $joinJS .= "join(\"added_description\", true)\n";
                    $itemvars["added_description"] = "\n<DIV id=\"added_descriptionView\">\n" . $itemvars["added_description"] . "\n</div>\n" . "<textarea id=\"added_descriptionEdit\" class=\"inplace\" tabindex=\"1\" name=\"added_descriptionEdit\"></textarea>\n";
                }
                //Asking Price AdminEdit
                $editorCSS .= "\n#asking_priceView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#asking_priceView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#asking_priceEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"asking_price\", true)\n";
                $itemvars["asking_price"] = "\n<DIV id=\"asking_priceView\">\n" . $itemvars["asking_price"] . "\n</div>\n" . "<textarea id=\"asking_priceEdit\" class=\"inplace\" tabindex=\"1\" name=\"asking_priceEdit\"></textarea>\n";
                //City_Town AdminEdit
                $editorCSS .= "\n#city_townView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#city_townView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#city_townEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"city_town\", true)\n";
                $newvars["city_town"] = "\n<DIV id=\"city_townView\">\n" . $itemvars["city_town"] . "\n</div>\n" . "<textarea id=\"city_townEdit\" class=\"inplace\" tabindex=\"1\" name=\"city_townEdit\"></textarea>\n";
                //State_Province AdminEdit
                $editorCSS .= "\n#state_provinceView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#state_provinceView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#state_provinceEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"state_province\", true)\n";
                $itemvars["state_province"] = "\n<DIV id=\"state_provinceView\">\n" . $itemvars["state_province"] . "\n</div>\n" . "<textarea id=\"state_provinceEdit\" class=\"inplace\" tabindex=\"1\" name=\"state_provinceEdit\"></textarea>\n";
                //quantity AdminEdit
                $editorCSS .= "\n#quantityView {\n\nborder: 1px solid #fff;\n\npadding: top:8px;\n\nwidth: 500px;\n\nmax-width: 100%;\n\nvalign: center;\n\n}\n\n\n\n#quantityView:hover {\n\n\tbackground-color: #ffcccc;\n\n\tborder-color: #ccc;\n\n}\n\n#quantityEdit {\n\n\twidth: 100%;\n\n\tborder: 1px solid #fff;\n\n\tpadding: 1px;\n\n\tbackground-color: #eeeeee;\n\n\tvalign: center;\n\n}\n";
                $joinJS .= "join(\"quantity\", true)\n";
                $itemvars["quantity"] = "\n<DIV id=\"quantityView\">\n" . $itemvars["quantity"] . "\n</div>\n" . "<textarea id=\"quantityEdit\" class=\"inplace\" tabindex=\"1\" name=\"quantityEdit\"></textarea>\n";
                $catoptions = "";
                $catlist = new clsDBNetConnect();
                $catlist->query("select * from categories where sub_cat_id=1");
                while ($catlist->next_record()) {
                    if ($itemvars["category"] == $catlist->f("cat_id")) {
                        $selected = " selected";
                    }
                    $catoptions .= "<option value=\"" . $catlist->f("cat_id") . "\"{$selected}>" . $catlist->f("name") . "</option>";
                    $selected = "";
                    $catlist2 = new clsDBNetConnect();
                    $catlist2->query("select * from categories where sub_cat_id=" . $catlist->f("cat_id"));
                    while ($catlist2->next_record()) {
                        if ($itemvars["category"] == $catlist2->f("cat_id")) {
                            $selected = " selected";
                        }
                        $catoptions .= "<option value=\"" . $catlist2->f("cat_id") . "\"{$selected}>--" . $catlist2->f("name") . "</option>";
                        $selected = "";
                        $catlist3 = new clsDBNetConnect();
                        $catlist3->query("select * from categories where sub_cat_id=" . $catlist2->f("cat_id"));
                        while ($catlist3->next_record()) {
                            if ($itemvars["category"] == $catlist3->f("cat_id")) {
                                $selected = " selected";
                            }
                            $catoptions .= "<option value=\"" . $catlist3->f("cat_id") . "\"{$selected}>----" . $catlist3->f("name") . "</option>";
                            $selected = "";
                            $catlist4 = new clsDBNetConnect();
                            $catlist4->query("select * from categories where sub_cat_id=" . $catlist3->f("cat_id"));
                            while ($catlist4->next_record()) {
                                if ($itemvars["category"] == $catlist4->f("cat_id")) {
                                    $selected = " selected";
                                }
                                $catoptions .= "<option value=\"" . $catlist4->f("cat_id") . "\"{$selected}>------" . $catlist4->f("name") . "</option>";
                                $selected = "";
                                $catlist5 = new clsDBNetConnect();
                                $catlist5->query("select * from categories where sub_cat_id=" . $catlist4->f("cat_id"));
                                while ($catlist5->next_record()) {
                                    if ($itemvars["category"] == $catlist5->f("cat_id")) {
                                        $selected = " selected";
                                    }
                                    $catoptions .= "<option value=\"" . $catlist5->f("cat_id") . "\"{$selected}>--------" . $catlist5->f("name") . "</option>";
                                    $selected = "";
                                    $catlist6 = new clsDBNetConnect();
                                    $catlist6->query("select * from categories where sub_cat_id=" . $catlist5->f("cat_id"));
                                    while ($catlist6->next_record()) {
                                        if ($itemvars["category"] == $catlist6->f("cat_id")) {
                                            $selected = " selected";
                                        }
                                        $catoptions .= "<option value=\"" . $catlist6->f("cat_id") . "\"{$selected}>----------" . $catlist6->f("name") . "</option>";
                                        $selected = "";
                                    }
                                }
                            }
                        }
                    }
                }
                $QueryString = CCGetQueryString("QueryString", array());
                $AdminMenu = <<<EOD
    
<script>
\t\tfunction toggleDisplayadminrow() {
\t\t\tif (document.getElementById) {
\t\t\t\tif(document.getElementById("adminrow").style.display=="block") {
\t\t\t\t\tdocument.getElementById("adminrow").style.display="none";
\t\t\t\t\tdocument.getElementById("adminrow_icon").src="images/expand.gif";
\t\t\t\t}
\t\t\t\telse {
\t\t\t\t\tdocument.getElementById("adminrow").style.display="block";
\t\t\t\t\tdocument.getElementById("adminrow_icon").src="images/minimize.gif";
\t\t\t\t}
\t\t\t}
\t\t}
\t</script>
\t<table width="100%" border="0">
\t<tr><td>
\t<img id="adminrow_icon" src="images/expand.gif" width="16" height="16" onclick="javascript:toggleDisplayadminrow();" onmouseover="javascript:this.style.cursor='hand';"><b> -- Expand FrontEnd Admin Menu</b>
\t</td></tr>
\t<table id="adminrow" style="display:none;" width="100%">
\t<tr><td>
\t<form name="AdminMenu" method="POST" action="ViewItem.php?{$QueryString}">
\tMove Item to Categories: <select name="movecategory">{$catoptions}</select><br>
\t<br><input class="inspector" type="submit" value="Move to Selected Category" name="saveMoveCats"/>
\t</form>
\tOther 'In Place' edits on this page:  Most Fields on this Page can be Double Clicked and Edited.
\t<ul><li><b>Edit-In-Place - </b>The majority of the text fields on this page can be edited in place, just double click on them, then click 'Save Changes'<br>
\tThe 'Title', 'Quantity', 'Asking Price', 'Location', 'Description', 'Added Description', 'Shipping Options', and 'Custom Text Area/Box' fields can be edited here, any other fileds must be edited from the Listings section in siteadmin.</li>
\t</ul><hr>
\t</td></tr></table>
\t</table>
EOD;
                $savebutton = <<<EOD
\t<tr>
      <td align="center" colspan="2">
  \t  <input type="submit" name="SaveChanges" title="Save Changes" value="Save Changes">
  \t  </td>
  \t</tr>
EOD;
                if ($itemvars["status"] == 99) {
                    $approve = <<<EOD
\t\t<tr>
      \t\t<td align="center" colspan="2" bgcolor="lightgrey">
  \t  \t\t<a href="ViewItem.php?{$QueryString}&approved=1">CLICK HERE TO MARK THIS LISTING AS 'APPROVED' AND START IT</a>
  \t  \t\t</td>
  \t\t</tr>
EOD;
                }
                $Tpl->SetVar("approve", $approve);
                $Tpl->SetVar("SaveButton", $savebutton);
                $Tpl->SetVar("AdminMenu", $AdminMenu);
            }
            $Tpl->SetVar("make_offer_form", $outform);
            $Tpl->SetVar("added_description", $itemvars["added_description"]);
            $Tpl->SetVar("dateadded", $newvars["dateadded"]);
            $Tpl->SetVar("title", $itemvars["title"]);
            $Tpl->SetVar("title2", $itemvars["title2"]);
            $Tpl->SetVar("categoryparent", $newvars["catlist"]);
            $Tpl->SetVar("ItemNum", $itemvars["ItemNum"]);
            $Tpl->SetVar("category", $newvars["category"]);
            $Tpl->SetVar("thiscat", "");
            $Tpl->SetVar("askingprice", $itemvars["asking_price"]);
            $Tpl->SetVar("quantity", $itemvars["quantity"]);
            $Tpl->SetVar("seller", $newvars["seller"]);
            $Tpl->SetVar("sellerid", $newvars["sellerid"]);
            $Tpl->SetVar("UserRating", "<a href=\"Feedback.php?user_id=" . $newvars["sellerid"] . "\">(" . Getfeedbacktotal($newvars["sellerid"]) . ")</a>");
            $Tpl->SetVar("subscriptions", $subsc_memb);
            $Tpl->SetVar("end_reason", $itemvars["end_reason"]);
            $Tpl->SetVar("started", $newvars["started"]);
            $Tpl->SetVar("closes", $newvars["closes"]);
            $Tpl->SetVar("initial_image", $newvars["preview_image"]);
            $Tpl->SetVar("cellbreaker1", $newvars["cellbreaker1"]);
            $Tpl->SetVar("cellbreaker2", $newvars["cellbreaker2"]);
            $Tpl->SetVar("city_town", $newvars["city_town"]);
            $Tpl->SetVar("state_province", $itemvars["state_province"]);
            $Tpl->SetVar("country", $countryi);
            $Tpl->SetVar("hits", $hits);
            $Tpl->SetVar("status", $newvars["status"]);
            $Tpl->SetVar("imageOne", $newvars["imageOne"]);
            $Tpl->SetVar("imageTwo", $newvars["imageTwo"]);
            $Tpl->SetVar("imageThree", $newvars["imageThree"]);
            $Tpl->SetVar("imageFour", $newvars["imageFour"]);
            $Tpl->SetVar("imageFive", $newvars["imageFive"]);
            $Tpl->SetVar("imgarray", $newvars["slidesrc"]);
            $Tpl->SetVar("imgarrayht", $newvars["slideht"]);
            $Tpl->SetVar("imgarraywd", $newvars["slidewt"]);
            $Tpl->SetVar("imgarrayht2", $newvars["slideht2"]);
            $Tpl->SetVar("imgarraywd2", $newvars["slidewt2"]);
            $Tpl->SetVar("imgarrayht3", $newvars["slideht3"]);
            $Tpl->SetVar("imgarraywd3", $newvars["slidewt3"]);
            $Tpl->SetVar("Loader", $sliderun);
            //{imageOne}{imageTwo}{imageThree}{imageFour}{imageFive} //HTML Usage
            unset($db);
            unset($SQL);
            unset($Result);
            $itemvars["hits"]++;
            $db = new clsDBNetConnect();
            $db->connect();
            if (CCGetFromGet("ItemNum", "")) {
                $SQL = "UPDATE items SET hits=" . $itemvars["hits"] . " WHERE ItemNum=" . $itemvars["ItemNum"];
                $db->query($SQL);
            }
            unset($db);
            unset($SQL);
        }
    }
    //End Custom Code
}
Ejemplo n.º 18
0
function import_tad_gallery($csn_menu = array(), $new_csn = "", $all = array(), $import = array())
{
    global $xoopsDB, $xoopsUser, $xoopsModuleConfig, $type_to_mime;
    krsort($csn_menu);
    foreach ($csn_menu as $cate_sn) {
        if (empty($cate_sn)) {
            continue;
        } else {
            $csn = $cate_sn;
            break;
        }
    }
    if (!empty($new_csn)) {
        $csn = add_tad_gallery_cate($csn, $new_csn);
    }
    $uid = $xoopsUser->getVar('uid');
    if (!empty($csn)) {
        $_SESSION['tad_gallery_csn'] = $csn;
    }
    //處理上傳的檔案
    $sort = 0;
    foreach ($all as $i => $source_file) {
        if ($import[$i]['upload'] != '1') {
            unlink($source_file);
            continue;
        }
        $orginal_file_name = strtolower(basename($import[$i]['filename']));
        //get lowercase filename
        $file_ending = substr(strtolower($orginal_file_name), -3);
        //file extension
        $sql = "insert into " . $xoopsDB->prefix("tad_gallery") . " (\n      `csn`, `title`, `description`, `filename`, `size`, `type`, `width`, `height`, `dir`, `uid`, `post_date`, `counter`, `exif`, `tag`, `good`, `photo_sort`) values('{$csn}','','','{$import[$i]['filename']}','{$import[$i]['size']}','{$import[$i]['type']}','{$import[$i]['width']}','{$import[$i]['height']}','{$import[$i]['dir']}','{$uid}','{$import[$i]['post_date']}','0','{$import[$i]['exif']}','','0',{$sort})";
        $sort++;
        $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 10, mysql_error() . $sql);
        //取得最後新增資料的流水編號
        $sn = $xoopsDB->getInsertId();
        set_time_limit(0);
        mk_dir(_TADGAL_UP_FILE_DIR . $import[$i]['dir']);
        mk_dir(_TADGAL_UP_FILE_DIR . "small/" . $import[$i]['dir']);
        mk_dir(_TADGAL_UP_FILE_DIR . "medium/" . $import[$i]['dir']);
        $filename = photo_name($sn, "source", 1);
        if (rename($source_file, $filename)) {
            $m_thumb_name = photo_name($sn, "m", 1);
            $s_thumb_name = photo_name($sn, "s", 1);
            if (!empty($xoopsModuleConfig['thumbnail_b_width']) and ($import[$i]['width'] > $xoopsModuleConfig['thumbnail_b_width'] or $import[$i]['height'] > $xoopsModuleConfig['thumbnail_b_width'])) {
                thumbnail($filename, $filename, $type_to_mime[$file_ending], $xoopsModuleConfig['thumbnail_b_width']);
            }
            if ($import[$i]['width'] > $xoopsModuleConfig['thumbnail_m_width'] or $import[$i]['height'] > $xoopsModuleConfig['thumbnail_m_width']) {
                thumbnail($filename, $m_thumb_name, $type_to_mime[$file_ending], $xoopsModuleConfig['thumbnail_m_width']);
            }
            if ($import[$i]['width'] > $xoopsModuleConfig['thumbnail_s_width'] or $import[$i]['height'] > $xoopsModuleConfig['thumbnail_s_width']) {
                thumbnail($filename, $s_thumb_name, $type_to_mime[$file_ending], $xoopsModuleConfig['thumbnail_s_width']);
            }
        } else {
            $sql = "delete from " . $xoopsDB->prefix("tad_gallery") . " where sn='{$sn}'";
            $xoopsDB->query($sql);
            redirect_header($_SERVER['PHP_SELF'], 5, sprintf(_MD_TADGAL_IMPORT_IMPORT_ERROR, $source_file, $filename));
        }
    }
    rrmdir(_TADGAL_UP_IMPORT_DIR);
    return $csn;
}
Ejemplo n.º 19
0
Archivo: view.php Proyecto: azuya/Wi3
<div class='component_imageshop relativepositioning'>
    <?php 
$this->css("style.css");
$this->javascript("imageshop.js");
// Load wi3 plugin, so we can do wi3 requests
Wi3::inst()->plugins->load("plugin_jquery_wi3");
// depends on JQuery Core, so no need to include it separately
$leftbar = "<div class='mediumpadding leftbar mediumtransparentbackground paddingmarginwithinbox'>";
foreach ($files as $file) {
    $leftbar .= thumbnail($file);
}
$leftbar .= "</div>";
echo $leftbar;
echo "<button class='orderbutton paddingmarginwithinbox'>Bestel</button>";
$rightbar = "<div class='mediumpadding rightbar mediumtransparentbackground paddingmarginwithinbox'>";
$rightbar .= "<div class='largeimage'></div>";
$rightbar .= "<div class='cart'>Klik op de <button>+</button> onder een product om het toe te voegen aan de winkelmand.</div>";
//<button data-buttontype='increase'>+</button><button data-buttontype='decrease'>-</button><span class='smallpadding' data-amount='0'>0</span>
$rightbar .= "</div>";
echo $rightbar;
echo "<div class='clearfix'>.</div>";
function thumbnail($file)
{
    $ret = "";
    $ret .= "<div class='smallmargin thumbnail hoverable smallpadding'>";
    $ret .= "<div class='imagecontainer'><img src='" . Wi3::inst()->urlof->sitefiles . "data/uploads/50/" . $file->filename . "' fullSRC='" . Wi3::inst()->urlof->sitefiles . "data/uploads/" . $file->filename . "'></img></div>";
    $ret .= "<div class='productbuttons'><button class='smallpadding paddingmarginwithinbox' data-buttontype='addtocart' data-productid='" . $file->id . "'>+</button></div>";
    $ret .= "</div>";
    return $ret;
}
?>
Ejemplo n.º 20
0
      <div class="carousel-inner">
        <?php 
    $count = -1;
    foreach ($data as $item) {
        ?>
         <?php 
        $count++;
        ?>
          <div class="<?php 
        if ($count == 0) {
            print 'active ';
        }
        ?>
item">
            <img src="<?php 
        print thumbnail($item['filename'], 1900, 1000);
        ?>
"  />
            <?php 
        if (isset($item['title']) and $item['title'] != '') {
            ?>
            <div class="carousel-caption">
                <p><?php 
            print $item['title'];
            ?>
</p>
            </div>
            <?php 
        }
        ?>
Ejemplo n.º 21
0
    $count = 0;
    foreach ($data as $item) {
        ?>
        <?php 
        $count++;
        ?>
      <div class="col-md-6" itemscope itemtype="<?php 
        print $schema_org_item_type_tag;
        ?>
">
        <div class="magazine-news-img">
            <a href="<?php 
        print $item['link'];
        ?>
"><img class="img-responsive" src="<?php 
        print thumbnail($item['image'], 400, 260);
        ?>
" alt="<?php 
        print addslashes($item['title']);
        ?>
 - <?php 
        _e("image");
        ?>
"></a>
            <span class="magazine-badge label-<?php 
        print $color;
        ?>
 edit" field="<?php 
        print $params['id'] . $item['id'] . $count;
        ?>
" rel="<?php 
Ejemplo n.º 22
0
        } else {
            ?>
          <?php 
            $p = get_picture($item['rel_id']);
            ?>
          <?php 
        }
        ?>
          <?php 
        if ($p != false) {
            ?>
          <img height="70" class="img-polaroid img-rounded mw-order-item-image mw-order-item-image-<?php 
            print $item['id'];
            ?>
" src="<?php 
            print thumbnail($p, 70, 70);
            ?>
"  />
          <?php 
        }
        ?>
</td>
        <td class="mw-cart-table-product"><?php 
        print $item['title'];
        ?>
          <?php 
        if (isset($item['custom_fields'])) {
            ?>
          <?php 
            print $item['custom_fields'];
            ?>
Ejemplo n.º 23
0
/**
 * Show the 'Daily' page.
 *
 * @param PageBuilder $pageBuilder Template engine wrapper.
 */
function showDaily($pageBuilder)
{
    $LINKSDB = new LinkDB($GLOBALS['config']['DATASTORE'], isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'], $GLOBALS['redirector']);
    $day = Date('Ymd', strtotime('-1 day'));
    // Yesterday, in format YYYYMMDD.
    if (isset($_GET['day'])) {
        $day = $_GET['day'];
    }
    $days = $LINKSDB->days();
    $i = array_search($day, $days);
    if ($i === false) {
        $i = count($days) - 1;
        $day = $days[$i];
    }
    $previousday = '';
    $nextday = '';
    if ($i !== false) {
        if ($i >= 1) {
            $previousday = $days[$i - 1];
        }
        if ($i < count($days) - 1) {
            $nextday = $days[$i + 1];
        }
    }
    try {
        $linksToDisplay = $LINKSDB->filter(LinkFilter::$FILTER_DAY, $day);
    } catch (Exception $exc) {
        error_log($exc);
        $linksToDisplay = array();
    }
    // We pre-format some fields for proper output.
    foreach ($linksToDisplay as $key => $link) {
        $taglist = explode(' ', $link['tags']);
        uasort($taglist, 'strcasecmp');
        $linksToDisplay[$key]['taglist'] = $taglist;
        $linksToDisplay[$key]['formatedDescription'] = format_description($link['description'], $GLOBALS['redirector']);
        $linksToDisplay[$key]['thumbnail'] = thumbnail($link['url']);
        $linksToDisplay[$key]['timestamp'] = linkdate2timestamp($link['linkdate']);
    }
    /* We need to spread the articles on 3 columns.
          I did not want to use a JavaScript lib like http://masonry.desandro.com/
          so I manually spread entries with a simple method: I roughly evaluate the
          height of a div according to title and description length.
       */
    $columns = array(array(), array(), array());
    // Entries to display, for each column.
    $fill = array(0, 0, 0);
    // Rough estimate of columns fill.
    foreach ($linksToDisplay as $key => $link) {
        // Roughly estimate length of entry (by counting characters)
        // Title: 30 chars = 1 line. 1 line is 30 pixels height.
        // Description: 836 characters gives roughly 342 pixel height.
        // This is not perfect, but it's usually OK.
        $length = strlen($link['title']) + 342 * strlen($link['description']) / 836;
        if ($link['thumbnail']) {
            $length += 100;
        }
        // 1 thumbnails roughly takes 100 pixels height.
        // Then put in column which is the less filled:
        $smallest = min($fill);
        // find smallest value in array.
        $index = array_search($smallest, $fill);
        // find index of this smallest value.
        array_push($columns[$index], $link);
        // Put entry in this column.
        $fill[$index] += $length;
    }
    $data = array('linksToDisplay' => $linksToDisplay, 'linkcount' => count($LINKSDB), 'cols' => $columns, 'day' => linkdate2timestamp($day . '_000000'), 'previousday' => $previousday, 'nextday' => $nextday);
    $pluginManager = PluginManager::getInstance();
    $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
    foreach ($data as $key => $value) {
        $pageBuilder->assign($key, $value);
    }
    $pageBuilder->renderPage('daily');
    exit;
}
Ejemplo n.º 24
0
 public function icon_with_title($module_name, $link = true)
 {
     $params = array();
     $to_print = '';
     $params['module'] = $module_name;
     $params['ui'] = 'any';
     $params['limit'] = 1;
     $data = $this->get($params);
     $info = false;
     if (isset($data[0])) {
         $info = $data[0];
     }
     if ($link == true and $info != false) {
         $href = admin_url() . 'view:modules/load_module:' . module_name_encode($info['module']);
     } else {
         $href = '#';
     }
     if (isset($data[0])) {
         $info = $data[0];
         $tn_ico = thumbnail($info['icon'], 32, 32);
         $to_print = '<a style="background-image:url(' . $tn_ico . ')" class="module-icon-title" href="' . $href . '">' . $info['name'] . '</a>';
     }
     print $to_print;
 }
Ejemplo n.º 25
0
        <?php 
        }
        ?>
        <span><i class="color-green"></i>Created <?php 
        print $item['created_at'];
        ?>
/Created by: <?php 
        print $item['created_by'];
        ?>
</span>
        <div class="magazine-posts-img">
        <a href="<?php 
        print $item['link'];
        ?>
"><img class="img-responsive" src="<?php 
        print thumbnail($item['image'], 300, 300);
        ?>
" alt=""></a>
            <span class="magazine-badge label-<?php 
        print $color;
        ?>
 edit" rel="badge" field="badge">Badge</span>
        </div>
    </div>

    <?php 
        if ($count % 3 == 0 or $len == $count) {
            print '</div>';
        }
    }
}
Ejemplo n.º 26
0
    function index($params, $config)
    {
        $current_page = $current_page = 1;
        $post_params = $params;
        if (isset($post_params['id'])) {
            $paging_param = 'current_page' . crc32($post_params['id']);
            unset($post_params['id']);
        }
        $cat_from_url = url_param('category');
        $posts_parent_related = false;
        if (isset($params['current_page'])) {
            // $params['current_page'] = $params['current_page'];
        } elseif (isset($params['curent-page'])) {
            $params['current_page'] = $params['curent-page'];
        } elseif (isset($params['current-page'])) {
            $params['current_page'] = $params['current-page'];
        } elseif (isset($params['curent-page'])) {
            $params['current_page'] = $params['curent-page'];
        }
        if (isset($params['paging_param'])) {
            if (isset($params[$params['paging_param']])) {
                $current_page = $current_page = $params['current_page'] = $params[$params['paging_param']];
                $paging_param = $params['paging_param'];
            }
        }
        if (isset($params['current_page'])) {
            $current_page = $params['current_page'] = $params['current_page'];
        } else {
            $current_page_from_url = url_param($paging_param);
            if ($current_page_from_url != false) {
                $current_page = $current_page_from_url;
            }
        }
        if (isset($post_params['data-page-number'])) {
            $post_params['current_page'] = $post_params['data-page-number'];
            unset($post_params['data-page-number']);
        }
        if (isset($post_params['data-category-id'])) {
            $post_params['category'] = $post_params['data-category-id'];
            unset($post_params['data-category-id']);
        }
        if (isset($params['data-paging-param'])) {
            $paging_param = $params['data-paging-param'];
        }
        $show_fields = false;
        if (isset($post_params['data-show'])) {
            $show_fields = $post_params['data-show'];
        }
        if (isset($post_params['show'])) {
            $show_fields = $post_params['show'];
        }
        $set_content_type_from_opt = get_option('data-content-type', $params['id']);
        $show_fields1 = get_option('data-show', $params['id']);
        if ($show_fields1 != false and is_string($show_fields1) and trim($show_fields1) != '') {
            $show_fields = $show_fields1;
        }
        if ($show_fields != false and is_string($show_fields)) {
            $show_fields = explode(',', $show_fields);
        }
        if (isset($post_params['limit'])) {
            $post_params['limit'] = $post_params['limit'];
        }
        if (isset($post_params['data-limit'])) {
            $post_params['limit'] = $post_params['data-limit'];
        }
        if (!isset($post_params['data-limit'])) {
            $posts_limit = get_option('data-limit', $params['id']);
            if ($posts_limit != false) {
                $post_params['limit'] = $posts_limit;
            }
        }
        $posts_parent_category = $posts_parent_category_cfg = get_option('data-category-id', $params['id']);
        if ($posts_parent_category == '') {
            $posts_parent_category = false;
        }
        $set_category_for_posts = false;
        $posts_limit = get_option('data-limit', $params['id']);
        if ($posts_limit != false) {
            $post_params['data-limit'] = $post_params['limit'] = $posts_limit;
        }
        $cfg_page_id = $cfg_page_id_force = get_option('data-page-id', $params['id']);
        if ($cfg_page_id == false and isset($post_params['data-page-id'])) {
            $cfg_page_id = intval($post_params['data-page-id']);
        } else {
            if ($cfg_page_id == false and isset($post_params['content_id'])) {
                $cfg_page_id = intval($post_params['content_id']);
            } else {
                if ($cfg_page_id == false and isset($post_params['content-id'])) {
                    $cfg_page_id = intval($post_params['content-id']);
                } elseif ($cfg_page_id == false and isset($post_params['current_page'])) {
                    $cfg_page_id = 'current_page';
                }
            }
        }
        if ($posts_parent_category == false and isset($post_params['category_id'])) {
            $posts_parent_category = $post_params['category_id'];
        }
        if ($posts_parent_category == false and isset($post_params['related'])) {
            if (defined('CATEGORY_ID') and CATEGORY_ID > 0) {
                $posts_parent_category = $posts_parent_related = CATEGORY_ID;
            }
        }
        if ($posts_parent_category_cfg == 'related') {
            $posts_parent_related = true;
            $posts_parent_category = $posts_parent_related = CATEGORY_ID;
        }
        if ($posts_parent_category == false and $cfg_page_id == 'current_page') {
            if (defined('PAGE_ID') and PAGE_ID > 0) {
                $cfg_page_id = PAGE_ID;
            }
        }
        if ($posts_parent_category_cfg == false) {
            if (defined('CATEGORY_ID') and CATEGORY_ID > 0) {
                $posts_parent_category = CATEGORY_ID;
            }
        }
        if ($cfg_page_id == false and isset($post_params['related']) and $post_params['related'] != false and (!isset($post_params['parent']) or $post_params['parent'] == false)) {
            if (defined('PAGE_ID') and PAGE_ID > 0) {
                $cfg_page_id = PAGE_ID;
                $post_params['parent'] = $cfg_page_id;
            }
        }
        if (isset($post_params['most_ordered'])) {
            //
            $str0 = 'table=cart&limit=30&rel_type=content&fields=rel_id&order_by=id desc';
            $orders = db_get($str0);
            if (!empty($orders)) {
                $ids = array();
                foreach ($orders as $order) {
                    $ids[] = $order['rel_id'];
                }
                $post_params['ids'] = $ids;
            }
        }
        if (isset($post_params['recently_viewed'])) {
            if (defined("MAIN_PAGE_ID") and defined("CONTENT_ID")) {
                $str0 = 'table=stats_pageviews&limit=30&main_page_id=' . MAIN_PAGE_ID . '&page_id=[neq]' . CONTENT_ID . '&fields=page_id&order_by=id desc&no_cache=true';
                $orders = db_get($str0);
                if (!empty($orders)) {
                    $ids = array();
                    foreach ($orders as $order) {
                        $ids[] = $order['page_id'];
                    }
                    $post_params['ids'] = $ids;
                }
            }
        }
        if ($posts_parent_related == false) {
            if (intval($cfg_page_id_force) or !isset($params['global'])) {
                if ($cfg_page_id != false and intval($cfg_page_id) > 0) {
                    $sub_categories = array();
                    $page_categories = false;
                    if (intval($cfg_page_id) != 0 and $cat_from_url == false) {
                        $str0 = 'table=categories&limit=1000&data_type=category&what=categories&' . 'parent_id=0&rel_id=' . $cfg_page_id;
                        $page_categories = db_get($str0);
                        $str0 = 'table=categories&limit=1000&data_type=category&what=categories&' . 'parent_id=0&rel_id=' . $cfg_page_id;
                        $page_categories = db_get('table=categories&limit=1&data_type=category&' . 'parent_id=0&rel_id=' . $cfg_page_id);
                        if (is_array($page_categories)) {
                            foreach ($page_categories as $item_cat) {
                                $sub_categories[] = $item_cat['id'];
                                $more = get_category_children($item_cat['id']);
                                if ($more != false and is_array($more)) {
                                    foreach ($more as $item_more_subcat) {
                                        $sub_categories[] = $item_more_subcat;
                                    }
                                }
                            }
                        }
                    }
                    if ($posts_parent_category != false and intval($posts_parent_category) > 0 and $cat_from_url == false) {
                        if ($page_categories != false and is_array($page_categories) and !empty($page_categories)) {
                            // $sub_categories = array();
                            foreach ($page_categories as $item_cat) {
                                if (intval($item_cat['id']) == intval($posts_parent_category)) {
                                    $sub_categories[] = $item_cat['id'];
                                }
                            }
                        } elseif ($posts_parent_category_cfg != false) {
                            $post_params['category'] = $posts_parent_category_cfg;
                        }
                        if (is_array($sub_categories) and !empty($sub_categories) and isset($post_params['related']) and $post_params['related'] != false) {
                            $post_params['category'] = $sub_categories;
                        } elseif ($cfg_page_id != false) {
                            $post_params['parent'] = $cfg_page_id;
                        }
                    } else {
                        $post_params['parent'] = $cfg_page_id;
                        if (($cfg_page_id == PAGE_ID or $cfg_page_id == MAIN_PAGE_ID) and (!isset($post_params['category']) or $post_params['category'] == false) and $cat_from_url != false) {
                            $post_params['category'] = $cat_from_url;
                        }
                    }
                } elseif ($cat_from_url != false) {
                    $post_params['category'] = $cat_from_url;
                } elseif ($posts_parent_category != false and intval($posts_parent_category) > 0 and $cfg_page_id != false) {
                    $post_params['category'] = $posts_parent_category;
                }
            }
            if ($posts_parent_category_cfg != false and intval($posts_parent_category_cfg) > 0 and $cfg_page_id_force != false and intval($cfg_page_id_force) > 0) {
                $post_params['category'] = $posts_parent_category_cfg;
            }
        } else {
            $post_params['category'] = $posts_parent_related;
        }
        $tn_size = array('150');
        $tn = $tn_size;
        if (isset($post_params['data-thumbnail-size'])) {
            $temp = explode('x', strtolower($post_params['data-thumbnail-size']));
            if (!empty($temp)) {
                $tn_size = $temp;
            }
        } else {
            $cfg_page_item = get_option('data-thumbnail-size', $params['id']);
            if ($cfg_page_item != false) {
                $temp = explode('x', strtolower($cfg_page_item));
                if (!empty($temp)) {
                    $tn_size = $temp;
                }
            }
        }
        if (!isset($tn[0]) or $tn[0] == 150) {
            $tn[0] = 350;
        }
        if (!isset($tn[1])) {
            $tn[1] = $tn[0];
        }
        $character_limit = 120;
        $cfg_character_limit = get_option('data-character-limit', $params['id']);
        if ($cfg_character_limit != false and trim($cfg_character_limit) != '') {
            $character_limit = intval($cfg_character_limit);
        } else {
            if (isset($params['description-length'])) {
                $character_limit = intval($params['description-length']);
            }
        }
        $title_character_limit = 200;
        $cfg_character_limit1 = get_option('data-title-limit', $params['id']);
        if ($cfg_character_limit1 != false and trim($cfg_character_limit1) != '') {
            $title_character_limit = intval($cfg_character_limit1);
        } else {
            if (isset($params['title-length'])) {
                $title_character_limit = intval($params['title-length']);
            }
        }
        if ($show_fields == false) {
            //$show_fields = array('thumbnail', 'title', 'description', 'read_more');
        }
        if (is_array($show_fields)) {
            $show_fields = array_trim($show_fields);
        }
        if (isset($current_page) and intval($current_page) > 0) {
            $post_params['current_page'] = intval($current_page);
        }
        if (!isset($post_params['global'])) {
            if (!isset($post_params['content_type'])) {
                $post_params['content_type'] = 'post';
            }
        }
        if (isset($params['is_shop'])) {
            $post_params['content_type'] = 'product';
            unset($post_params['is_shop']);
        }
        if (!isset($post_params['content_type']) and !isset($post_params['global'])) {
            $post_params['content_type'] = 'post';
        }
        if (!isset($params['order_by']) and isset($params['order-by'])) {
            $params['orderby'] = $post_params['orderby'] = $params['order-by'];
        }
        if (isset($params['subtype_value'])) {
            $post_params['subtype_value'] = $params['subtype_value'];
        }
        $schema_org_item_type = false;
        $schema_org_item_type_tag = false;
        if (isset($post_params['content_type']) and $post_params['content_type'] == 'page') {
            $schema_org_item_type = 'WebPage';
        } else {
            if (isset($post_params['content_type']) and $post_params['content_type'] == 'post') {
                if (isset($post_params['subtype']) and $post_params['subtype'] != $post_params['content_type']) {
                    $schema_org_item_type = $post_params['subtype'];
                } else {
                    $schema_org_item_type = 'Article';
                }
            }
        }
        if ($schema_org_item_type != false) {
            $schema_org_item_type = ucfirst($schema_org_item_type);
            $schema_org_item_type_tag = ' itemtype="http://schema.org/' . $schema_org_item_type . '" ';
            $schema_org_item_type_tag = 'http://schema.org/' . $schema_org_item_type;
        }
        $ord_by = get_option('data-order-by', $params['id']);
        if ($ord_by != false and trim($ord_by) != '') {
            $post_params['orderby'] = $ord_by;
        }
        $date_format = get_option('date_format', 'website');
        if ($date_format == false) {
            $date_format = "Y-m-d H:i:s";
        }
        if (isset($params['title'])) {
            unset($post_params['title']);
        }
        $post_params['is_active'] = 1;
        $post_params['is_deleted'] = 0;
        if ((!isset($post_params['parent']) and !isset($post_params['category']) or isset($post_params['category']) and empty($post_params['category'])) and $cat_from_url != false and trim($cat_from_url) != '') {
            $post_params['category'] = $cat_from_url;
        }
        if (isset($params['content_type']) and $params['content_type'] == 'all') {
            unset($post_params['content_type']);
            unset($post_params['subtype']);
        }
        if (isset($params['search-parent'])) {
            $sub_content = get_content_children($params['search-parent']);
            if (!empty($sub_content)) {
                $post_params['ids'] = $sub_content;
                unset($post_params['parent']);
            }
        }
        if (isset($params['data-id'])) {
            unset($post_params['data-id']);
        }
        if ($posts_parent_related == false) {
            if (isset($post_params['category']) and is_string($post_params['category'])) {
                $sub_categories = array();
                $sub_categories[] = $post_params['category'];
                $more = get_category_children($post_params['category']);
                if ($more != false and is_array($more)) {
                    foreach ($more as $item_more_subcat) {
                        $sub_categories[] = $item_more_subcat;
                    }
                }
                //$post_params['category']
                $post_params['category'] = $sub_categories;
                //$post_params['category'] = $post_params['category'];
            } else {
                if (isset($post_params['category']) and is_array($post_params['category']) and empty($post_params['category']) and isset($post_params['related']) and $post_params['related'] != false) {
                    if (defined('CATEGORY_ID') and CATEGORY_ID > 0) {
                        $post_params['category'] = CATEGORY_ID;
                    }
                }
            }
        }
        if (defined('POST_ID') and isset($posts_parent_category) and $posts_parent_category != false or isset($post_params['related'])) {
            $post_params['exclude_ids'] = POST_ID;
        }
        if (!isset($params['order_by'])) {
            //            if(isset($post_params['content_type']) and $post_params['content_type'] == 'page'){
            //                $post_params['order_by'] = 'position asc';
            //            } else {
            //
            //            }
            $post_params['order_by'] = 'position desc';
        }
        if (isset($params['search_in_fields']) and $params['search_in_fields'] != false) {
            $post_params['search_in_fields'] = $params['search_in_fields'];
        }
        $content = get_content($post_params);
        if ($posts_parent_related != false and empty($content) and isset($post_params['category'])) {
            unset($post_params['category']);
            $content = get_content($post_params);
        }
        $data = array();
        if (!empty($content)) {
            foreach ($content as $item) {
                $iu = get_picture($item['id'], $for = 'post', $full = false);
                if ($iu != false) {
                    $item['image'] = $iu;
                } else {
                    $item['image'] = false;
                }
                if ($item['image'] != false) {
                    $item['tn_image'] = thumbnail($item['image'], $tn[0], $tn[1]);
                } else {
                    $item['tn_image'] = false;
                }
                $item['content'] = htmlspecialchars_decode($item['content']);
                if (isset($item['created_at']) and trim($item['created_at']) != '') {
                    $item['created_at'] = date($date_format, strtotime($item['created_at']));
                }
                if (isset($item['updated_at']) and trim($item['updated_at']) != '') {
                    $item['updated_at'] = date($date_format, strtotime($item['updated_at']));
                }
                $item['link'] = content_link($item['id']);
                $item['full_description'] = '';
                if (!isset($item['description']) or $item['description'] == '') {
                    if (isset($item['content']) and $item['content'] != '') {
                        $item['description'] = character_limiter(strip_tags($item['content']), $character_limit);
                        $item['full_description'] = strip_tags($item['content']);
                    } elseif (isset($item['content_body']) and $item['content_body'] != '') {
                        $item['full_description'] = strip_tags($item['content']);
                        $item['description'] = character_limiter(strip_tags($item['content_body']), $character_limit);
                    }
                } else {
                    $item['full_description'] = trim($item['description']);
                    $item['description'] = character_limiter(strip_tags($item['description']), $character_limit);
                }
                if (isset($item['title']) and $item['title'] != '') {
                    $item['full_title'] = $item['title'];
                    $item['title'] = character_limiter($item['title'], $title_character_limit);
                }
                if (isset($post_params['content_type']) and $post_params['content_type'] == 'product') {
                    $item['prices'] = get_custom_fields("field_type=price&for=content&for_id=" . $item['id']);
                } else {
                    $item['prices'] = false;
                }
                if (isset($item['prices']) and is_array($item['prices']) and !empty($item['prices'])) {
                    $vals2 = array_values($item['prices']);
                    $val1 = array_shift($vals2);
                    $item['price'] = $val1;
                } else {
                    $item['price'] = false;
                }
                if (isset($show_fields) and is_array($show_fields) and !empty($show_fields)) {
                    if (!in_array('title', $show_fields)) {
                        $item['title'] = false;
                    }
                    if (!in_array('description', $show_fields)) {
                        $item['description'] = false;
                    }
                    if (!in_array('created_at', $show_fields)) {
                        $item['created_at'] = false;
                    }
                    if (!in_array('read_more', $show_fields)) {
                        $item['read_more'] = false;
                    }
                    if (!in_array('thumbnail', $show_fields)) {
                        $item['thumbnail'] = false;
                    }
                }
                $data[] = $item;
            }
        } else {
            if (isset($params['is_shop'])) {
                print lnotif('Your products module is empty');
            } elseif (isset($params['global'])) {
                print lnotif('Your content module is empty');
            } else {
                print lnotif('Your posts module is empty');
            }
        }
        $post_params_paging = $post_params;
        $post_params_paging['page_count'] = true;
        $cfg_data_hide_paging = get_option('data-hide-paging', $params['id']);
        if ($cfg_data_hide_paging === false) {
            if (isset($post_params['hide_paging']) and trim($post_params['hide_paging']) != 'false') {
                $post_params['hide-paging'] = $post_params['hide_paging'];
                unset($post_params['hide_paging']);
            }
            if (isset($post_params['hide-paging']) and trim($post_params['hide-paging']) != 'false') {
                $cfg_data_hide_paging = 'y';
                unset($post_params['hide-paging']);
            }
        }
        if ($cfg_data_hide_paging != 'y') {
            $pages_of_posts = get_content($post_params_paging);
            $pages_count = intval($pages_of_posts);
        } else {
            $pages_count = 0;
        }
        $paging_links = false;
        if (intval($pages_count) > 1) {
            //$paging_links = mw()->content_manager->paging_links(false, $pages_count, $paging_param, $keyword_param = 'keyword');
        }
        $read_more_text = get_option('data-read-more-text', $params['id']);
        $add_cart_text = get_option('data-add-to-cart-text', $params['id']);
        if ($add_cart_text == false or $add_cart_text == "Add to cart") {
            $add_cart_text = _e("Add to cart", true);
        }
        if (!isset($params['return'])) {
            $module_template = get_option('data-template', $params['id']);
            if ($module_template == false and isset($params['template'])) {
                $module_template = $params['template'];
            }
            if ($module_template != false) {
                if (strtolower($module_template) == 'none') {
                    if (isset($params['template'])) {
                        $module_template = $params['template'];
                    }
                }
                $template_file = module_templates($config['module'], $module_template);
            } else {
                $template_file = module_templates($config['module'], 'default');
            }
            if ($template_file == false) {
                $template_file = module_templates($config['module'], 'default');
            }
            if (isset($template_file) and is_file($template_file) != false) {
                include $template_file;
                ?>
                <?php 
                if (isset($params['ajax_paging']) or isset($params['ajax-paging'])) {
                    ?>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            mw.$('#<?php 
                    print $params['id'];
                    ?>
').find('a[data-page-number]').unbind('click');
                            mw.$('#<?php 
                    print $params['id'];
                    ?>
').find('a[data-page-number]').click(function (e) {
                                var pn = $(this).attr('data-page-number');
                                mw.$('#<?php 
                    print $params['id'];
                    ?>
').attr('paging_param', 'current_page');
                                mw.$('#<?php 
                    print $params['id'];
                    ?>
').attr('current_page', pn)
                                mw.reload_module('#<?php 
                    print $params['id'];
                    ?>
');
                                return false;
                            });
                        });
                    </script>
                <?php 
                }
                ?>
                <?php 
                if (isset($params['is_shop'])) {
                    ?>
                    <script type="text/javascript">
                        mw.require("shop.js");
                    </script>
                <?php 
                }
                ?>
            <?php 
            } else {
                print lnotif('No default template for ' . $config['module'] . ' is found');
            }
        }
    }
Ejemplo n.º 27
0
<?php

only_admin_access();
$data = array('content_id' => $params['content_id']);
$comments = get_comments($data);
$item = get_content_by_id($params['content_id']);
$content_id = $params['content_id'];
$moderation_is_required = get_option('require_moderation', 'comments') == 'y';
?>

<div class="comment-post">
  <div class="comment-info-holder" content-id="<?php 
print $item['id'];
?>
" onclick="mw.adminComments.toggleMaster(this, event)"> <span class="img"> <img src="<?php 
print thumbnail(get_picture($content_id), 67, 67);
?>
" alt="" />
    <?php 
// $new = get_comments('count=1&is_moderated=n&rel=content&rel_id='.$content_id);
$new = get_comments('count=1&is_new=y&rel=content&rel_id=' . $content_id);
?>
    <?php 
if ($new > 0) {
    ?>
    <span class="comments_number"><?php 
    print $new;
    ?>
</span>
    <?php 
}
Ejemplo n.º 28
0
    Boston, MA 02111-1307
    USA

    You may contact the author/development team at:

    Chaos Networks
    c/o Werner Ammon
    Lerchenstr. 11c

    86343 K�nigsbrunn

    URL: http://www.chaos.de
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($cfg["fileed"]["right"] == "" || $rechte[$cfg["fileed"]["right"]] == -1) {
    $ausgaben["thumbnail"] = thumbnail();
    if ($ausgaben["thumbnail"] == "") {
        header("Location: " . $cfg["fileed"]["basis"] . "/list.html");
    }
    // page basics
    // ***
    #if ( count($HTTP_POST_VARS) == 0 ) {
    #} else {
    $form_values = $HTTP_POST_VARS;
    #}
    // form options holen
    $form_options = form_options(eCRC($environment["ebene"]) . ".modify");
    // form elememte bauen
    $element = form_elements($cfg["fileed"]["db"]["file"]["entries"], $form_values);
    // form elemente erweitern
    #$element["extension1"] = "";
Ejemplo n.º 29
0
 /**
  * Print nested tree of pages
  *
  * @example
  * <pre>
  * // Example Usage:
  * $pt_opts = array();
  * $pt_opts['link'] = "{title}";
  * $pt_opts['list_tag'] = "ol";
  * $pt_opts['list_item_tag'] = "li";
  * pages_tree($pt_opts);
  * </pre>
  *
  * @example
  * <pre>
  * // Example Usage to make <select> with <option>:
  * $pt_opts = array();
  * $pt_opts['link'] = "{title}";
  * $pt_opts['list_tag'] = " ";
  * $pt_opts['list_item_tag'] = "option";
  * $pt_opts['active_ids'] = $data['parent'];
  * $pt_opts['active_code_tag'] = '   selected="selected"  ';
  * $pt_opts['ul_class'] = 'nav';
  * $pt_opts['li_class'] = 'nav-item';
  *  pages_tree($pt_opts);
  * </pre>
  * @example
  * <pre>
  * // Other options
  * $pt_opts['parent'] = "8";
  * $pt_opts['include_first'] =  true; //includes the parent in the tree
  * $pt_opts['id_prefix'] = 'my_id';
  * </pre>
  *
  *
  *
  * @package Content
  * @param int $parent
  * @param bool $link
  * @param bool $active_ids
  * @param bool $active_code
  * @param bool $remove_ids
  * @param bool $removed_ids_code
  * @param bool $ul_class_name
  * @param bool $include_first
  * @return sting Prints the pages tree
  */
 public function pages_tree($parent = 0, $link = false, $active_ids = false, $active_code = false, $remove_ids = false, $removed_ids_code = false, $ul_class_name = false, $include_first = false)
 {
     $params2 = array();
     $params = false;
     $output = '';
     if (is_integer($parent)) {
     } else {
         $params = $parent;
         if (is_string($params)) {
             $params = parse_str($params, $params2);
             $params = $params2;
             extract($params);
         }
         if (is_array($params)) {
             $parent = 0;
             extract($params);
         }
     }
     if (!defined('CONTENT_ID')) {
         $this->define_constants();
     }
     $function_cache_id = false;
     $args = func_get_args();
     foreach ($args as $k => $v) {
         $function_cache_id = $function_cache_id . serialize($k) . serialize($v);
     }
     $function_cache_id = __FUNCTION__ . crc32($function_cache_id) . PAGE_ID . $parent;
     if ($parent == 0) {
         $cache_group = 'content/global';
     } else {
         $cache_group = 'categories/global';
     }
     if (isset($include_categories) and $include_categories == true) {
         $cache_group = 'categories/global';
     }
     $nest_level = 0;
     if (isset($params['nest_level'])) {
         $nest_level = $params['nest_level'];
     }
     $nest_level_orig = $nest_level;
     //$params['no_cache'] = 1;
     if ($nest_level_orig == 0) {
         $cache_content = $this->app->cache_manager->get($function_cache_id, $cache_group);
         if (isset($params['no_cache'])) {
             $cache_content = false;
         }
         //      $cache_content = false;
         if ($cache_content != false) {
             if (isset($params['return_data'])) {
                 return $cache_content;
             } else {
                 print $cache_content;
             }
             return;
         }
     }
     $nest_level = 0;
     if (isset($params['nest_level'])) {
         $nest_level = $params['nest_level'];
     }
     $max_level = false;
     if (isset($params['max_level'])) {
         $max_level = $params['max_level'];
     } else {
         if (isset($params['maxdepth'])) {
             $max_level = $params['max_level'] = $params['maxdepth'];
         } else {
             if (isset($params['depth'])) {
                 $max_level = $params['max_level'] = $params['depth'];
             }
         }
     }
     if ($max_level != false) {
         if (intval($nest_level) >= intval($max_level)) {
             print '';
             return;
         }
     }
     $is_shop = '';
     if (isset($params['is_shop'])) {
         if ($params['is_shop'] == 'y') {
             $params['is_shop'] = 1;
         } else {
             if ($params['is_shop'] == 'n') {
                 $params['is_shop'] = 0;
             }
         }
         $is_shop = $this->app->database_manager->escape_string($params['is_shop']);
         $is_shop = " and is_shop='{$is_shop} '";
         $include_first = false;
     }
     $ul_class = 'pages_tree';
     if (isset($params['ul_class'])) {
         $ul_class_name = $ul_class = $params['ul_class'];
     }
     $content_link_class = 'mw-tree-content-link';
     if (isset($params['content_link_class'])) {
         $content_link_class = $params['content_link_class'];
     }
     $li_class = 'pages_tree_item';
     if (isset($params['li_class'])) {
         $li_class = $params['li_class'];
     }
     if (isset($params['ul_tag'])) {
         $list_tag = $params['ul_tag'];
     }
     if (isset($params['li_tag'])) {
         $list_item_tag = $params['li_tag'];
     }
     if (isset($params['include_categories'])) {
         $include_categories = $params['include_categories'];
     }
     ob_start();
     $table = $this->tables['content'];
     $par_q = '';
     if ($parent == false) {
         $parent = 0;
     } else {
         $par_q = " parent={$parent}    and  ";
     }
     if ($include_first == true) {
         $sql = "SELECT * from {$table} where  id={$parent}    and   is_deleted=0 and content_type='page' " . $is_shop . "  order by position desc  limit 0,1";
     } else {
         $sql = "SELECT * from {$table} where  " . $par_q . "  content_type='page' and   is_deleted=0 {$is_shop}  order by position desc limit 0,100";
     }
     $cid = __FUNCTION__ . crc32($sql);
     $cidg = 'content/' . $parent;
     if (!is_array($params)) {
         $params = array();
     }
     if (isset($append_to_link) == false) {
         $append_to_link = '';
     }
     if (isset($id_prefix) == false) {
         $id_prefix = '';
     }
     if (isset($link) == false) {
         $link = '<span data-page-id="{id}" class="pages_tree_link {nest_level} {active_class} {active_parent_class}" href="{link}' . $append_to_link . '">{title}</span>';
     }
     if (isset($list_tag) == false) {
         $list_tag = 'ul';
     }
     if (isset($active_code_tag) == false) {
         $active_code_tag = '';
     }
     if (isset($list_item_tag) == false) {
         $list_item_tag = 'li';
     }
     if (isset($params['remove_ids'])) {
         $remove_ids = $params['remove_ids'];
     }
     if (isset($remove_ids) and is_string($remove_ids)) {
         $remove_ids = explode(',', $remove_ids);
     }
     if (isset($active_ids)) {
         $active_ids = $active_ids;
     }
     if (isset($active_ids) and is_string($active_ids)) {
         $active_ids = explode(',', $active_ids);
     }
     $the_active_class = 'active';
     if (isset($params['active_class'])) {
         $the_active_class = $params['active_class'];
     }
     $params['content_type'] = 'page';
     $include_first_set = false;
     if ($include_first == true) {
         $include_first_set = 1;
         $include_first = false;
         $include_first_set = $parent;
         if (isset($params['include_first'])) {
             unset($params['include_first']);
         }
     } else {
         $params['parent'] = $parent;
     }
     if (isset($params['is_shop']) and $params['is_shop'] == 1) {
         if (isset($params['parent']) and $params['parent'] == 0) {
             unset($params['parent']);
         }
         if (isset($params['parent']) and $params['parent'] == 'any') {
             unset($params['parent']);
         }
     } else {
         if (isset($params['parent']) and $params['parent'] == 'any') {
             $params['parent'] = 0;
         }
     }
     $params['limit'] = 500;
     $params['orderby'] = 'position desc';
     $params['curent_page'] = 1;
     $params['is_deleted'] = 0;
     $params['cache_group'] = false;
     $params['no_cache'] = true;
     $skip_pages_with_no_categories = false;
     $skip_pages_from_tree = false;
     if (isset($params['skip_sub_pages']) and $params['skip_sub_pages'] != '') {
         $skip_pages_from_tree = $params['skip_sub_pages'];
     }
     if (isset($params['skip-static-pages']) and $params['skip-static-pages'] != false) {
         $skip_pages_with_no_categories = 1;
     }
     $params2 = $params;
     if (isset($params2['id'])) {
         unset($params2['id']);
     }
     if (isset($params2['link'])) {
         unset($params2['link']);
     }
     if ($include_first_set != false) {
         $q = $this->get("id=" . $include_first_set);
     } else {
         $q = $this->get($params2);
     }
     $result = $q;
     if (is_array($result) and !empty($result)) {
         $nest_level++;
         if (trim($list_tag) != '') {
             if ($ul_class_name == false) {
                 print "<{$list_tag} class='pages_tree depth-{$nest_level}'>";
             } else {
                 print "<{$list_tag} class='{$ul_class_name} depth-{$nest_level}'>";
             }
         }
         $res_count = 0;
         foreach ($result as $item) {
             if (is_array($item) != false and isset($item['title']) and $item['title'] != null) {
                 $skip_me_cause_iam_removed = false;
                 if (is_array($remove_ids) == true) {
                     if (in_array($item['id'], $remove_ids)) {
                         $skip_me_cause_iam_removed = true;
                     }
                 }
                 if ($skip_pages_with_no_categories == true) {
                     if (isset($item['subtype']) and $item['subtype'] != 'dynamic') {
                         $skip_me_cause_iam_removed = true;
                     }
                 }
                 if ($skip_me_cause_iam_removed == false) {
                     $output = $output . $item['title'];
                     $content_type_li_class = false;
                     switch ($item['subtype']) {
                         case 'dynamic':
                             $content_type_li_class = 'have_category';
                             break;
                         case 'module':
                             $content_type_li_class = 'is_module';
                             break;
                         default:
                             $content_type_li_class = 'is_page';
                             break;
                     }
                     if (isset($item['layout_file']) and stristr($item['layout_file'], 'blog')) {
                         $content_type_li_class .= ' is_blog';
                     }
                     if ($item['is_home'] == 1) {
                         $content_type_li_class .= ' is_home';
                     }
                     $st_str = '';
                     $st_str2 = '';
                     $st_str3 = '';
                     if (isset($item['subtype']) and trim($item['subtype']) != '') {
                         $st_str = " data-subtype='{$item['subtype']}' ";
                     }
                     if (isset($item['subtype_value']) and trim($item['subtype_value']) != '') {
                         $st_str2 = " data-subtype-value='{$item['subtype_value']}' ";
                     }
                     if (isset($item['is_shop']) and trim($item['is_shop']) == 1) {
                         $st_str3 = " data-is-shop=true ";
                         $content_type_li_class .= ' is_shop';
                     }
                     $iid = $item['id'];
                     $to_pr_2 = "<{$list_item_tag} class='{$li_class} {$content_type_li_class} {active_class} {active_parent_class} depth-{$nest_level} item_{$iid} {exteded_classes} menu-item-id-{$item['id']}' data-page-id='{$item['id']}' value='{$item['id']}'  data-item-id='{$item['id']}'  {active_code_tag} data-parent-page-id='{$item['parent']}' {$st_str} {$st_str2} {$st_str3}  title='" . addslashes($item['title']) . "' >";
                     if ($link != false) {
                         $active_parent_class = '';
                         if (intval($item['parent']) != 0 and intval($item['parent']) == intval(MAIN_PAGE_ID)) {
                             $active_parent_class = 'active-parent';
                         } elseif (intval($item['id']) == intval(MAIN_PAGE_ID)) {
                             $active_parent_class = 'active-parent';
                         } else {
                             $active_parent_class = '';
                         }
                         if ($item['id'] == CONTENT_ID) {
                             $active_class = 'active';
                         } elseif (isset($active_ids) and !is_array($active_ids) and $item['id'] == $active_ids) {
                             $active_class = 'active';
                         }
                         if (isset($active_ids) and is_array($active_ids) and in_array($item['id'], $active_ids)) {
                             $active_class = 'active';
                         } elseif ($item['id'] == PAGE_ID) {
                             $active_class = 'active';
                         } elseif ($item['id'] == POST_ID) {
                             $active_class = 'active';
                         } elseif (CATEGORY_ID != false and intval($item['subtype_value']) != 0 and $item['subtype_value'] == CATEGORY_ID) {
                             $active_class = 'active';
                         } else {
                             $active_class = '';
                         }
                         $ext_classes = '';
                         if ($res_count == 0) {
                             $ext_classes .= ' first-child ';
                             $ext_classes .= ' child-' . $res_count . '';
                         } else {
                             if (!isset($result[$res_count + 1])) {
                                 $ext_classes .= ' last-child';
                                 $ext_classes .= ' child-' . $res_count . '';
                             } else {
                                 $ext_classes .= ' child-' . $res_count . '';
                             }
                         }
                         if (isset($item['parent']) and intval($item['parent']) > 0) {
                             $ext_classes .= ' have-parent';
                         }
                         if (isset($item['subtype_value']) and intval($item['subtype_value']) != 0) {
                             $ext_classes .= ' have-category';
                         }
                         if (isset($item['is_active']) and $item['is_active'] == 'n') {
                             $ext_classes = $ext_classes . ' content-unpublished ';
                         }
                         $ext_classes = trim($ext_classes);
                         $the_active_class = $active_class;
                         $to_print = str_replace('{id}', $item['id'], $link);
                         $to_print = str_replace('{active_class}', $active_class, $to_print);
                         $to_print = str_replace('{active_parent_class}', $active_parent_class, $to_print);
                         $to_print = str_replace('{exteded_classes}', $ext_classes, $to_print);
                         $to_pr_2 = str_replace('{exteded_classes}', $ext_classes, $to_pr_2);
                         $to_pr_2 = str_replace('{active_class}', $active_class, $to_pr_2);
                         $to_pr_2 = str_replace('{active_parent_class}', $active_parent_class, $to_pr_2);
                         $to_print = str_replace('{title}', $item['title'], $to_print);
                         $to_print = str_replace('{nest_level}', 'depth-' . $nest_level, $to_print);
                         $to_print = str_replace('{content_link_class}', $content_link_class, $to_print);
                         if (strstr($to_print, '{link}')) {
                             $to_print = str_replace('{link}', page_link($item['id']), $to_print);
                         }
                         $empty1 = intval($nest_level);
                         $empty = '';
                         for ($i1 = 0; $i1 < $empty1; $i1++) {
                             $empty = $empty . '&nbsp;&nbsp;';
                         }
                         $to_print = str_replace('{empty}', $empty, $to_print);
                         if (strstr($to_print, '{tn}')) {
                             $to_print = str_replace('{tn}', thumbnail($item['id'], 'original'), $to_print);
                         }
                         foreach ($item as $item_k => $item_v) {
                             $to_print = str_replace('{' . $item_k . '}', $item_v, $to_print);
                         }
                         $res_count++;
                         if (isset($active_ids) and is_array($active_ids) == true) {
                             $is_there_active_ids = false;
                             foreach ($active_ids as $active_id) {
                                 if (intval($item['id']) == intval($active_id)) {
                                     $is_there_active_ids = true;
                                     $to_print = str_ireplace('{active_code}', $active_code, $to_print);
                                     $to_print = str_ireplace('{active_class}', $the_active_class, $to_print);
                                     $to_pr_2 = str_ireplace('{active_class}', $the_active_class, $to_pr_2);
                                     $to_pr_2 = str_ireplace('{active_code_tag}', $active_code_tag, $to_pr_2);
                                 }
                             }
                         } else {
                             if (isset($active_ids) and !is_array($active_ids)) {
                                 if (intval($item['id']) == intval($active_ids)) {
                                     $is_there_active_ids = true;
                                     $to_print = str_ireplace('{active_code}', $active_code, $to_print);
                                     $to_print = str_ireplace('{active_class}', $the_active_class, $to_print);
                                     $to_pr_2 = str_ireplace('{active_class}', $the_active_class, $to_pr_2);
                                     $to_pr_2 = str_ireplace('{active_code_tag}', $active_code_tag, $to_pr_2);
                                 }
                             }
                         }
                         $to_print = str_ireplace('{active_code}', '', $to_print);
                         $to_print = str_ireplace('{active_class}', '', $to_print);
                         $to_pr_2 = str_ireplace('{active_class}', '', $to_pr_2);
                         $to_pr_2 = str_ireplace('{active_code_tag}', '', $to_pr_2);
                         $to_pr_2 = str_ireplace('{content_link_class}', '', $to_pr_2);
                         $to_print = str_replace('{exteded_classes}', '', $to_print);
                         $to_print = str_replace('{content_link_class}', '', $to_print);
                         if ($item['id'] == $item['parent']) {
                             $remove_ids[] = $item['id'];
                         }
                         if (is_array($remove_ids) == true) {
                             if (in_array($item['id'], $remove_ids)) {
                                 if ($removed_ids_code == false) {
                                     $to_print = false;
                                 } else {
                                     $remove_ids[] = $item['id'];
                                     $to_print = str_ireplace('{removed_ids_code}', $removed_ids_code, $to_print);
                                 }
                             } else {
                                 $to_print = str_ireplace('{removed_ids_code}', '', $to_print);
                             }
                         }
                         $to_pr_2 = str_replace('{active_class}', '', $to_pr_2);
                         $to_pr_2 = str_replace('{exteded_classes}', '', $to_pr_2);
                         print $to_pr_2;
                         $to_pr_2 = false;
                         print $to_print;
                     } else {
                         $to_pr_2 = str_ireplace('{active_class}', '', $to_pr_2);
                         $to_pr_2 = str_replace('{exteded_classes}', '', $to_pr_2);
                         $to_pr_2 = str_replace('{active_parent_class}', '', $to_pr_2);
                         print $to_pr_2;
                         $to_pr_2 = false;
                         print $item['title'];
                     }
                     if (is_array($params)) {
                         $params['parent'] = $item['id'];
                         if ($max_level != false) {
                             $params['max_level'] = $max_level;
                         }
                         if (isset($params['is_shop'])) {
                             unset($params['is_shop']);
                         }
                         //   $nest_level++;
                         $params['nest_level'] = $nest_level;
                         $params['ul_class_name'] = false;
                         $params['ul_class'] = false;
                         if (isset($include_categories)) {
                             $params['include_categories'] = $include_categories;
                         }
                         if (isset($params['ul_class_deep'])) {
                             $params['ul_class'] = $params['ul_class_deep'];
                         }
                         if (isset($maxdepth)) {
                             $params['maxdepth'] = $maxdepth;
                         }
                         if (isset($params['li_class_deep'])) {
                             $params['li_class'] = $params['li_class_deep'];
                         }
                         if (isset($params['return_data'])) {
                             unset($params['return_data']);
                         }
                         $params['remove_ids'] = $remove_ids;
                         if ($skip_pages_from_tree == false) {
                             if ($item['id'] != $item['parent']) {
                                 $children = $this->pages_tree($params);
                             }
                         }
                     } else {
                         if ($skip_pages_from_tree == false) {
                             if ($item['id'] != $item['parent']) {
                                 $children = $this->pages_tree(intval($item['id']), $link, $active_ids, $active_code, $remove_ids, $removed_ids_code, $ul_class_name = false);
                             }
                         }
                     }
                     if (isset($include_categories) and $include_categories == true) {
                         $content_cats = array();
                         if (isset($item['subtype_value']) and intval($item['subtype_value']) == true) {
                         }
                         $cat_params = array();
                         if (isset($item['subtype_value']) and intval($item['subtype_value']) != 0) {
                             //$cat_params['subtype_value'] = $item['subtype_value'];
                         }
                         //$cat_params['try_rel_id'] = $item['id'];
                         if (isset($categores_link)) {
                             $cat_params['link'] = $categores_link;
                         } else {
                             $cat_params['link'] = $link;
                         }
                         if (isset($categories_active_ids)) {
                             $cat_params['active_ids'] = $categories_active_ids;
                         }
                         if (isset($categories_removed_ids)) {
                             $cat_params['remove_ids'] = $categories_removed_ids;
                         }
                         if (isset($active_code)) {
                             $cat_params['active_code'] = $active_code;
                         }
                         //$cat_params['for'] = 'content';
                         $cat_params['list_tag'] = $list_tag;
                         $cat_params['list_item_tag'] = $list_item_tag;
                         $cat_params['rel_type'] = 'content';
                         $cat_params['rel_id'] = $item['id'];
                         $cat_params['include_first'] = 1;
                         $cat_params['nest_level'] = $nest_level;
                         if ($max_level != false) {
                             $cat_params['max_level'] = $max_level;
                         }
                         if ($nest_level > 1) {
                             if (isset($params['ul_class_deep'])) {
                                 $cat_params['ul_class'] = $params['ul_class_deep'];
                             }
                             if (isset($params['li_class_deep'])) {
                                 $cat_params['li_class'] = $params['li_class_deep'];
                             }
                         } else {
                             if (isset($params['ul_class'])) {
                                 $cat_params['ul_class'] = $params['ul_class'];
                             }
                             if (isset($params['li_class'])) {
                                 $cat_params['li_class'] = $params['li_class'];
                             }
                         }
                         $this->app->category_manager->tree($cat_params);
                     }
                 }
                 print "</{$list_item_tag}>";
             }
         }
         if (trim($list_tag) != '') {
             print "</{$list_tag}>";
         }
     }
     $content = ob_get_contents();
     if ($nest_level_orig == 0) {
         $this->app->cache_manager->save($content, $function_cache_id, $cache_group);
     }
     ob_end_clean();
     if (isset($params['return_data'])) {
         return $content;
     } else {
         print $content;
     }
     return false;
 }
Ejemplo n.º 30
0
 $var_params['selected_categories'] =  array(14);
$sched = get_posts($var_params);

	  ?>

      <? foreach($sched as $sch): ?>






      <div class="shedule_item" style="background-color: #485462">
        <h2><? print $sch["content_title"]; ?></h2>
        <img src="<? print thumbnail($sch['id'], 250); ?>" alt="" />
        <div class="shedule_item_txt"><? print $sch["the_content_body"]; ?></div>
        <a href="#" class="mw_blue_link">View Trailer</a>
        <div class="shedule_item_embed">
         <textarea><? print html_entity_decode($sch['custom_fields']["embed_code"]); ?></textarea>
        </div>

      </div>




      <? endforeach; ?>
      </div>
      </div>
      <div id="schedule_ctrls" >