コード例 #1
0
ファイル: tadgallery_cate.php プロジェクト: geek01/tadgallery
function tadgallery_cate($options)
{
    global $xoopsDB, $xoTheme;
    // $default_val="4|album|rand()||300|line-height:1.8;|0";
    $options[0] = intval($options[0]);
    $shownum = empty($options[0]) ? '5' : $options[0];
    $display_arr = array('title', 'album', 'content');
    $display_mode = in_array($options[1], $display_arr) ? $options[1] : "album";
    $sortby_arr = array('csn', 'rand()', 'sort');
    $sortby = in_array($options[2], $sortby_arr) ? $options[2] : "rand()";
    $sort_desc = $options[3] == "desc" ? "desc" : "";
    $options[4] = intval($options[4]);
    $lengh = empty($options[4]) ? 300 : $options[4];
    $content_css = (empty($options[5]) or strrpos(';', $options[5]) === false) ? 'line-height:1.8;' : $options[5];
    $only_have_desc = $options[6] == "1" ? "1" : "0";
    if ($display_mode != "content") {
        $only_have_desc = 0;
    }
    $tadgallery = new tadgallery();
    $order = "{$sortby} {$sort_desc}";
    $albums = $tadgallery->get_albums('return', true, $shownum, $order, true, $lengh, $only_have_desc);
    $block['albums'] = $albums;
    $block['display_mode'] = $display_mode;
    $block['content_css'] = $content_css;
    $block['count'] = sizeof($albums);
    $block['bootstrap_version'] = $_SESSION['bootstrap'];
    if ($xoTheme) {
        $xoTheme->addStylesheet('modules/tadgallery/module.css');
        $xoTheme->addStylesheet('modules/tadgallery/class/jquery.thumbs/jquery.thumbs.css');
        $xoTheme->addScript('modules/tadgallery/class/jquery.thumbs/jquery.thumbs.js');
    }
    return $block;
}
コード例 #2
0
ファイル: cooliris.php プロジェクト: geek01/tadgallery
function list_tad_gallery_cate_tree($def_csn = "")
{
    global $xoopsDB, $xoopsTpl;
    $tadgallery = new tadgallery();
    $cate_count = $tadgallery->get_tad_gallery_cate_count();
    $path = get_tadgallery_cate_path($def_csn);
    $path_arr = array_keys($path);
    $sql = "select csn,of_csn,title from " . $xoopsDB->prefix("tad_gallery_cate") . " order by sort";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    while (list($csn, $of_csn, $title) = $xoopsDB->fetchRow($result)) {
        $font_style = $def_csn == $csn ? ", font:{'background-color':'yellow', 'color':'black'}" : '';
        $open = in_array($csn, $path_arr) ? 'true' : 'false';
        $display_counter = empty($cate_count[$csn]['file']) ? "" : " ({$cate_count[$csn]['file']})";
        $data[] = "{ id:{$csn}, pId:{$of_csn}, name:'{$title}{$display_counter}', url:'cooliris.php?csn={$csn}', open: {$open} ,target:'_self' {$font_style}}";
    }
    $json = implode(",\n", $data);
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/ztree.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/ztree.php";
    $ztree = new ztree("album_tree", $json, '', '', "of_csn", "csn");
    $ztree_code = $ztree->render();
    $xoopsTpl->assign('ztree_code', $ztree_code);
    return $data;
}
コード例 #3
0
ファイル: ajax_menu.php プロジェクト: geek01/tadgallery
function get_option($of_csn = '', $def_csn = '', $chk_view = 1, $chk_up = 1)
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $isAdmin;
    $tadgallery = new tadgallery();
    $ok_cat = $ok_up_cat = "";
    if ($chk_view) {
        $ok_cat = $tadgallery->chk_cate_power();
    }
    if ($chk_up) {
        $ok_up_cat = $tadgallery->chk_cate_power("upload");
    }
    $option = "";
    $sql = "select csn,title from " . $xoopsDB->prefix("tad_gallery_cate") . "\n    where of_csn='{$of_csn}' order by sort";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    while (list($csn, $title) = $xoopsDB->fetchRow($result)) {
        if ($chk_view and is_array($ok_cat)) {
            if (!in_array($csn, $ok_cat)) {
                continue;
            }
        }
        if ($chk_up and is_array($ok_up_cat)) {
            if (!in_array($csn, $ok_up_cat)) {
                continue;
            }
        }
        $selected = $csn == $def_csn ? "selected" : "";
        $option .= "<option value='{$csn}' {$selected}>{$title}</option>\n";
    }
    return $option;
}
コード例 #4
0
ファイル: ajax.php プロジェクト: geek01/tadgallery
function edit_album($csn)
{
    global $upload_powers;
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $path = get_tadgallery_cate_path($csn, false);
    $patharr = array_keys($path);
    $make_option_js = "";
    foreach ($patharr as $k => $of_csn) {
        $j = $k + 1;
        $make_option_js .= "make_option('of_csn_menu','{$k}','{$of_csn}','{$patharr[$j]}');\n";
    }
    $span = $_SESSION['bootstrap'] == '3' ? 'col-md-' : 'span';
    $controls_row = $_SESSION['bootstrap'] == '3' ? 'form-group' : 'control-group';
    $album = tadgallery::get_tad_gallery_cate($csn);
    //可見群組
    $SelectGroup_name = new XoopsFormSelectGroup("", "enable_group", false, explode(",", $album['enable_group']), 3, true);
    $SelectGroup_name->addOption("", _MD_TADGAL_ALL_OK, false);
    $SelectGroup_name->setExtra("class='{$span}12'");
    $enable_group = $SelectGroup_name->render();
    //可上傳群組
    $SelectGroup_name = new XoopsFormSelectGroup("", "enable_upload_group", false, explode(",", $album['enable_upload_group']), 3, true);
    $SelectGroup_name->setExtra("class='{$span}12'");
    $enable_upload_group = $SelectGroup_name->render();
    if ($_SESSION['bootstrap'] == '3') {
        $form_col = "\n        <div class='form-group'>\n          <label class='col-md-2 control-label'>" . _MD_TADGAL_ALBUM_TITLE . "</label>\n          <div class='col-md-10'>\n            <input class='form-control' type='text' name='title' value='{$album['title']}' id='newTitle' placeholder='" . _MD_TADGAL_TITLE . "'>\n          </div>\n        </div>\n\n\n        <div class='form-group'>\n          <label class='col-md-2 control-label'>" . _MD_TADGAL_OF_CSN . "</label>\n          <div class='col-md-10'>\n            <select name='of_csn_menu[0]' id='of_csn_menu0' class='of_csn_menu'><option value=''></option></select>\n            <select name='of_csn_menu[1]' id='of_csn_menu1' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[2]' id='of_csn_menu2' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[3]' id='of_csn_menu3' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[4]' id='of_csn_menu4' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[5]' id='of_csn_menu5' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[6]' id='of_csn_menu6' class='of_csn_menu' style='display: none;'></select>\n          </div>\n        </div>\n\n\n        <div class='form-group'>\n          <label class='col-md-2 control-label'>" . _MD_TADGAL_CATE_POWER_SETUP . "</label>\n          <div class='col-md-5'>\n            <label>" . _MD_TADGAL_ENABLE_GROUP . "</label>\n            {$enable_group}\n          </div>\n          <div class='col-md-5'>\n            <label>" . _MD_TADGAL_ENABLE_UPLOAD_GROUP . "</label>\n            {$enable_upload_group}\n          </div>\n        </div>\n\n\n        <div class='form-group'>\n          <label class='col-md-2 control-label'>" . _MD_TADGAL_PASSWD . "</label>\n          <div class='col-md-4'>\n            <input type='text' name='passwd' class='form-control' value='{$album['passwd']}' placeholder='" . _MD_TADGAL_PASSWD_DESC . "'>\n          </div>\n\n          <label class='col-md-2 control-label'></label>\n          <div class='col-md-4'>\n            <input type='hidden' name='csn' value='{$album['csn']}'>\n            <input type='hidden' name='show_mode' value='{$album['show_mode']}'>\n            <input type='hidden' name='op' value='update_tad_gallery_cate'>\n            <button type='submit' class='btn btn-primary' id='sbtn'>" . _TAD_SAVE . "</button>\n          </div>\n        </div>\n        ";
    } else {
        $form_col = "\n        <div class='control-group'>\n          <label class='{$span}2 control-label'>" . _MD_TADGAL_ALBUM_TITLE . "</label>\n          <div class='{$span}10 controls controls-row'>\n            <input class='span12 form-control' type='text' name='title' value='{$album['title']}' id='newTitle' placeholder='" . _MD_TADGAL_TITLE . "'>\n          </div>\n        </div>\n\n\n        <div class='control-group'>\n          <label class='{$span}2 control-label'>" . _MD_TADGAL_OF_CSN . "</label>\n          <div class='{$span}10 controls controls-row'>\n            <select name='of_csn_menu[0]' id='of_csn_menu0' class='of_csn_menu'><option value=''></option></select>\n            <select name='of_csn_menu[1]' id='of_csn_menu1' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[2]' id='of_csn_menu2' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[3]' id='of_csn_menu3' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[4]' id='of_csn_menu4' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[5]' id='of_csn_menu5' class='of_csn_menu' style='display: none;'></select>\n            <select name='of_csn_menu[6]' id='of_csn_menu6' class='of_csn_menu' style='display: none;'></select>\n          </div>\n        </div>\n\n\n        <div class='control-group'>\n          <label class='{$span}2 control-label'>" . _MD_TADGAL_CATE_POWER_SETUP . "</label>\n          <div class='{$span}5 controls controls-row'>\n            <label>" . _MD_TADGAL_ENABLE_GROUP . "</label>\n            {$enable_group}\n          </div>\n          <div class='{$span}5 controls controls-row'>\n            <label>" . _MD_TADGAL_ENABLE_UPLOAD_GROUP . "</label>\n            {$enable_upload_group}\n          </div>\n        </div>\n\n\n        <div class='control-group'>\n          <label class='{$span}2 control-label'>" . _MD_TADGAL_PASSWD . "</label>\n          <div class='{$span}4 controls controls-row'>\n            <input type='text' name='passwd' class='span12 form-control' value='{$album['passwd']}' placeholder='" . _MD_TADGAL_PASSWD_DESC . "'>\n          </div>\n\n          <label class='{$span}2 control-label'></label>\n          <div class='{$span}4 controls controls-row'>\n            <input type='hidden' name='csn' value='{$album['csn']}'>\n            <input type='hidden' name='op' value='update_tad_gallery_cate'>\n            <button type='submit' class='btn btn-primary' id='sbtn'>" . _TAD_SAVE . "</button>\n          </div>\n        </div>\n        ";
    }
    $form = "\n      <script>\n        \$(function(){\n          {$make_option_js}\n          \$('#myForm').bind('submit', function() {\n            \$.ajax({\n              type : 'POST',\n              cache : false,\n              url : 'ajax.php',\n              data : \$(this).serializeArray(),\n              success: function(data) {\n                if(\$('#newTitle').val()!=''){\n                  \$('#albumTitle{$csn}').parent().addClass('outline');\n                  \$('#albumTitle{$csn}').text(\$('#newTitle').val());\n                }\n\n                \$.fancybox.close();\n                location.reload();\n              }\n            });\n            return false;\n          });\n        })\n\n\n        function make_option(menu_name , num , of_csn , def_csn){\n          \$('#'+menu_name+num).show();\n          \$.post('ajax_menu.php',  {'of_csn': of_csn , 'def_csn': def_csn} , function(data) {\n            \$('#'+menu_name+num).html(\"<option value=''>/</option>\"+data);\n          });\n\n          \$('.'+menu_name).change(function(){\n          var menu_id= \$(this).attr('id');\n          var len=menu_id.length-1;\n          var next_num = Number(menu_id.charAt(len))+1\n            var next_menu = menu_name + next_num;\n            \$.post('ajax_menu.php',  {'of_csn': \$('#'+menu_id).val()} , function(data) {\n              if(data==''){\n                \$('#'+next_menu).hide();\n              }else{\n                \$('#'+next_menu).show();\n                \$('#'+next_menu).html(\"<option value=''>/</option>\"+data);\n              }\n\n            });\n          });\n        }\n      </script>\n\n      <form action='' method='post' id='myForm' style='width:600px;' class='form-horizontal' role='form'>\n        {$form_col}\n      </form>";
    return $form;
}
コード例 #5
0
function tadgallery_scroller_show($options)
{
    global $xoopsDB, $xoTheme;
    // $default_val="12||1|photo_sort||m|0|100%|240|jscroller2_up|40";
    $order_array = array('post_date', 'counter', 'rand', 'photo_sort');
    $limit = empty($options[0]) ? 12 : intval($options[0]);
    $view_csn = empty($options[1]) ? '' : intval($options[1]);
    $include_sub = empty($options[2]) ? "0" : "1";
    $order_by = in_array($options[3], $order_array) ? $options[3] : "post_date";
    $desc = empty($options[4]) ? "" : "desc";
    $size = (!empty($options[5]) and $options[5] == "s") ? "s" : "m";
    $only_good = $options[6] != '1' ? "0" : "1";
    $options[7] = intval($options[7]);
    $width = empty($options[7]) ? '100%' : $options[7];
    $options[8] = intval($options[8]);
    $height = empty($options[8]) ? 240 : $options[8];
    $direction = $options[9] == 'jscroller2_down' ? "jscroller2_down" : "jscroller2_up";
    $options[10] = isset($options[10]) ? intval($options[10]) : 40;
    $speed = empty($options[10]) ? 40 : $options[10];
    $tadgallery = new tadgallery();
    $tadgallery->set_limit($limit);
    if ($view_csn) {
        $tadgallery->set_view_csn($view_csn);
    }
    $tadgallery->set_orderby($order_by);
    $tadgallery->set_order_desc($desc);
    $tadgallery->set_view_good($only_good);
    $photos = $tadgallery->get_photos('return', $include_sub);
    $pics = "";
    $i = 0;
    foreach ($photos as $photo) {
        $pp = 'photo_' . $size;
        $pic_url = $photo[$pp];
        $title = empty($photo['title']) ? $photo['filename'] : $photo['title'];
        $pics[$i]['pic_url'] = $pic_url;
        $pics[$i]['photo_sn'] = $photo['sn'];
        $pics[$i]['photo_title'] = $title;
        $pics[$i]['description'] = empty($photo['description']) ? "" : "<div style='padding:4px;background-color:#F0FFA0;font-size:11px;text-align:left;'>{$photo['description']}</div>";
        $i++;
    }
    $block['height'] = $height;
    $block['direction'] = $direction;
    $block['speed'] = $speed;
    $block['pics'] = $pics;
    get_jquery();
    $xoTheme->addScript('modules/tadgallery/class/jscroller.js');
    $xoTheme->addScript('', null, "\n    (function(\$){\n      \$(document).ready(function(){\n        var width=\$('#scroller_container{$view_csn}_w').width();\n        \$('#scroller_container{$view_csn}').css('width',width+'px');\n      });\n    })(jQuery);\n  ");
    return $block;
}
コード例 #6
0
ファイル: tadgallery_list.php プロジェクト: geek01/tadgallery
function tadgallery_list($options)
{
    global $xoopsDB;
    $order_array = array('post_date', 'counter', 'rand', 'photo_sort');
    $limit = empty($options[0]) ? 12 : intval($options[0]);
    $view_csn = empty($options[1]) ? '' : intval($options[1]);
    $include_sub = empty($options[2]) ? "0" : "1";
    $order_by = in_array($options[3], $order_array) ? $options[3] : "post_date";
    $desc = empty($options[4]) ? "" : "desc";
    $size = (!empty($options[5]) and $options[5] == "s") ? "s" : "m";
    $only_good = $options[6] != '1' ? "0" : "1";
    $options[7] = intval($options[7]);
    $width = empty($options[7]) ? 120 : $options[7];
    $options[8] = intval($options[8]);
    $height = empty($options[8]) ? 120 : $options[8];
    $options[9] = intval($options[9]);
    $margin = empty($options[9]) ? 0 : $options[9];
    $show_txt = $options[10] == "1" ? "1" : "0";
    $style = (empty($options[11]) or strrpos(';', $options[11]) === false) ? 'font-size:11px;font-weight:normal;overflow:hidden;' : $options[11];
    $tadgallery = new tadgallery();
    $tadgallery->set_limit($limit);
    if ($view_csn) {
        $tadgallery->set_view_csn($view_csn);
    }
    $tadgallery->set_orderby($order_by);
    $tadgallery->set_order_desc($desc);
    $tadgallery->set_view_good($only_good);
    $photos = $tadgallery->get_photos('return', $include_sub);
    $pics = "";
    $i = 0;
    foreach ($photos as $photo) {
        $pp = 'photo_' . $size;
        $pic_url = $photo[$pp];
        $pics[$i]['pic_url'] = $pic_url;
        $pics[$i]['photo_sn'] = $photo['sn'];
        $pics[$i]['pic_txt'] = empty($photo['title']) ? $photo['filename'] : $photo['title'];
        $i++;
    }
    //die(var_export($pics));
    $block['view_csn'] = $view_csn;
    $block['width'] = $width;
    $block['height'] = $height;
    $block['margin'] = $margin;
    $block['style'] = $style;
    $block['pics'] = $pics;
    $block['show_txt'] = $show_txt;
    return $block;
}
コード例 #7
0
function tadgallery_marquee_show($options)
{
    global $xoopsDB;
    // $default_val="12|0|1|post_date||m|0|100%|150|80";
    $order_array = array('post_date', 'counter', 'rand', 'photo_sort');
    $limit = empty($options[0]) ? 12 : intval($options[0]);
    $view_csn = empty($options[1]) ? '' : intval($options[1]);
    $include_sub = empty($options[2]) ? "0" : "1";
    $order_by = in_array($options[3], $order_array) ? $options[3] : "post_date";
    $desc = empty($options[4]) ? "" : "desc";
    $size = (!empty($options[5]) and $options[5] == "s") ? "s" : "m";
    $only_good = $options[6] != '1' ? "0" : "1";
    $options[7] = intval($options[7]);
    $width = empty($options[7]) ? '100%' : $options[7];
    $options[8] = intval($options[8]);
    $height = (empty($options[8]) or $options[8] <= 30) ? 240 : $options[8];
    $options[9] = intval($options[9]);
    $speed = empty($options[9]) ? 30 : $options[9];
    $tadgallery = new tadgallery();
    $tadgallery->set_limit($limit);
    if ($view_csn) {
        $tadgallery->set_view_csn($view_csn);
    }
    $tadgallery->set_orderby($order_by);
    $tadgallery->set_order_desc($desc);
    $tadgallery->set_view_good($only_good);
    $photos = $tadgallery->get_photos('return', $include_sub);
    $pics = "";
    $i = 0;
    foreach ($photos as $photo) {
        $pp = 'photo_' . $size;
        $pic_url = $photo[$pp];
        $title = empty($photo['title']) ? $photo['filename'] : $photo['title'];
        $pics[$i]['pic_url'] = $pic_url;
        $pics[$i]['photo_sn'] = $photo['sn'];
        $pics[$i]['photo_title'] = $title;
        //$pics[$i]['description']=(empty($photo['description']))?"":"<div style='padding:4px;background-color:#F0FFA0;font-size:11px;text-align:left;'>{$photo['description']}</div>";
        $i++;
    }
    $block['width'] = $width;
    $block['height'] = $height;
    $block['speed'] = $speed;
    $block['pics'] = $pics;
    get_jquery();
    return $block;
}
コード例 #8
0
function tadgallery_shuffle_show($options)
{
    global $xoopsDB, $xoTheme;
    // $default_val="12||1|photo_sort||m|0|200|160";
    $order_array = array('post_date', 'counter', 'rand', 'photo_sort');
    $limit = empty($options[0]) ? 12 : intval($options[0]);
    $view_csn = empty($options[1]) ? '' : intval($options[1]);
    $include_sub = empty($options[2]) ? "0" : "1";
    $order_by = in_array($options[3], $order_array) ? $options[3] : "post_date";
    $desc = empty($options[4]) ? "" : "desc";
    $size = (!empty($options[5]) and $options[5] == "s") ? "s" : "m";
    $only_good = $options[6] != '1' ? "0" : "1";
    $options[7] = intval($options[7]);
    $width = empty($options[7]) ? 200 : $options[7];
    $options[8] = intval($options[8]);
    $height = empty($options[8]) ? 160 : $options[8];
    $tadgallery = new tadgallery();
    $tadgallery->set_limit($limit);
    if ($view_csn) {
        $tadgallery->set_view_csn($view_csn);
    }
    $tadgallery->set_orderby($order_by);
    $tadgallery->set_order_desc($desc);
    $tadgallery->set_view_good($only_good);
    $photos = $tadgallery->get_photos('return', $include_sub);
    $pics = "";
    $i = 0;
    foreach ($photos as $photo) {
        $pp = 'photo_' . $size;
        $pic_url = $photo[$pp];
        $pics[$i]['width'] = $width;
        $pics[$i]['height'] = $height;
        $pics[$i]['pic_url'] = $pic_url;
        $pics[$i]['photo_sn'] = $photo['sn'];
        $pics[$i]['photo_title'] = $photo['title'];
        $i++;
    }
    $block['view_csn'] = $view_csn;
    $block['width'] = $width;
    $block['height'] = $height;
    $block['pics'] = $pics;
    get_jquery();
    $xoTheme->addScript('modules/tadgallery/class/jqshuffle.js');
    $xoTheme->addScript('', null, "\n    (function(\$){\n      \$(document).ready(function(){\n        \$('.imageBox{$view_csn}').jqShuffle();\n      });\n    })(jQuery);\n  ");
    return $block;
}
コード例 #9
0
ファイル: uploads.php プロジェクト: geek01/tadgallery
function tad_gallery_form($sn = "")
{
    global $xoopsDB, $xoopsTpl;
    //抓取預設值
    if (!empty($sn)) {
        $DBV = tadgallery::get_tad_gallery($sn);
    } else {
        $DBV = array();
    }
    //預設值設定
    $sn = !isset($DBV['sn']) ? "" : $DBV['sn'];
    $title = !isset($DBV['title']) ? "" : $DBV['title'];
    $tag = !isset($DBV['tag']) ? "" : $DBV['tag'];
    $op = empty($sn) ? "insert_tad_gallery" : "update_tad_gallery";
    $xoopsTpl->assign('title', $title);
    $xoopsTpl->assign('op', $op);
    $xoopsTpl->assign('sn', $sn);
    $tag_select = tag_select($tag);
    $xoopsTpl->assign('tag_select', $tag_select);
}
コード例 #10
0
ファイル: tadgallery_show.php プロジェクト: geek01/tadgallery
function tadgallery_show($options)
{
    global $xoopsDB, $xoTheme;
    // $default_val="12||1|photo_sort||m|0|100%|240";
    $order_array = array('post_date', 'counter', 'rand', 'photo_sort');
    $limit = empty($options[0]) ? 12 : intval($options[0]);
    $view_csn = empty($options[1]) ? '' : intval($options[1]);
    $include_sub = empty($options[2]) ? "0" : "1";
    $order_by = in_array($options[3], $order_array) ? $options[3] : "post_date";
    $desc = empty($options[4]) ? "" : "desc";
    $size = (!empty($options[5]) and $options[5] == "s") ? "s" : "m";
    $only_good = $options[6] != '1' ? "0" : "1";
    $options[7] = intval($options[7]);
    $width = empty($options[7]) ? '100%' : $options[7];
    $options[8] = intval($options[8]);
    $block_height = empty($options[8]) ? 240 : $options[8];
    $tadgallery = new tadgallery();
    $tadgallery->set_limit($limit);
    if ($view_csn) {
        $tadgallery->set_view_csn($view_csn);
    }
    $tadgallery->set_orderby($order_by);
    $tadgallery->set_order_desc($desc);
    $tadgallery->set_view_good($only_good);
    $photos = $tadgallery->get_photos('return', $include_sub);
    $pics = "";
    $i = 0;
    foreach ($photos as $photo) {
        $pp = 'photo_' . $size;
        $pic_url = $photo[$pp];
        $pics[$i]['width'] = $width;
        $pics[$i]['height'] = $height;
        $pics[$i]['pic_url'] = $pic_url;
        $pics[$i]['photo_sn'] = $photo['sn'];
        $pics[$i]['photo_title'] = $photo['title'];
        $i++;
    }
    $block['view_csn'] = $view_csn;
    $block['pics'] = $pics;
    get_jquery();
    $xoTheme->addScript('modules/tadgallery/class/jquery.animated.innerfade/js/jquery.animated.innerfade.js');
    $xoTheme->addScript('', null, "\n    (function(\$){\n      \$(document).ready(function(){\n        \$('ul#animated-portfolio-block{$view_csn}').animatedinnerfade({\n          speed: 1000,\n          timeout: 5000,\n          type: 'random',\n          containerwidth: '100%',\n          containerheight: '{$block_height}px',\n          animationSpeed: 5000,\n          animationtype: 'fade',\n          bgFrame: 'none',\n          controlBox: 'auto',\n          controlBoxClass: 'none',\n          controlButtonsPath: '" . XOOPS_URL . "/modules/tadgallery/class/jquery.animated.innerfade/img',\n          displayTitle: 'none'\n        });\n      });\n    })(jQuery);\n  ");
    return $block;
}
コード例 #11
0
ファイル: function.php プロジェクト: geek01/tadgallery
function mk_rss_xml($the_csn = "")
{
    global $xoopsDB, $xoopsModule, $xoopsConfig;
    $tadgallery = new tadgallery();
    $ok_cat = $tadgallery->chk_cate_power();
    if (!empty($the_csn)) {
        if (in_array($the_csn, $ok_cat)) {
            $where = "and a.csn='{$the_csn}'";
            $cate = $tadgallery->get_tad_gallery_cate($the_csn);
            $rss_title = $cate['title'];
            $rss_link = XOOPS_URL . "/modules/tadgallery/index.php?csn={$the_csn}";
            $rss_filename = _TADGAL_UP_FILE_DIR . "photos{$the_csn}.rss";
        } else {
            return;
        }
    } else {
        $ok_str = implode("','", $ok_cat);
        $where = "and a.csn in('{$ok_str}') ";
        $rss_title = $xoopsConfig['sitename'];
        $rss_link = XOOPS_URL . "/modules/tadgallery";
        $rss_filename = _TADGAL_UP_FILE_DIR . "photos.rss";
    }
    $sql = "select a.sn,a.csn,a.title,a.description,a.filename,a.size,a.dir from " . $xoopsDB->prefix("tad_gallery") . " as a , " . $xoopsDB->prefix("tad_gallery_cate") . " as b where a.csn=b.csn {$where} and b.passwd='' and b.enable_group='' order by a.post_date desc";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error() . "<br>{$sql}");
    $main = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n  <channel>\n  <atom:icon>" . XOOPS_URL . "/modules/tadgallery/images/piclen_logo.png</atom:icon>\n  <generator>Tad Gallery</generator>\n  <title>{$rss_title}</title>\n  <link>{$rss_link}</link>\n  <description></description>\n";
    while (list($sn, $csn, $title, $description, $filename, $size, $dir) = $xoopsDB->fetchRow($result)) {
        $title = empty($title) ? $filename : $title;
        $title = htmlspecialchars($title);
        $description = htmlspecialchars($description);
        $filename = urlencode(htmlspecialchars($filename));
        $pic_url = $tadgallery->get_pic_url($dir, $sn, $filename);
        $mpic_url = $tadgallery->get_pic_url($dir, $sn, $filename, "m");
        $spic_url = $tadgallery->get_pic_url($dir, $sn, $filename, "s");
        $main .= "    <item>\n      <title>{$title}</title>\n      <link>" . XOOPS_URL . "/modules/tadgallery/view.php?sn={$sn}</link>\n      <guid>{$sn}-{$csn}</guid>\n      <media:thumbnail url=\"{$spic_url}\"/>\n      <media:content url=\"{$pic_url}\" fileSize=\"{$size}\" />\n      <media:title type=\"plain\">{$title}</media:title>\n      <media:description type=\"plain\">{$description}</media:description>\n    </item>\n";
    }
    $main .= "      </channel>\n</rss>\n";
    $main = to_utf8($main);
    if (!($handle = fopen($rss_filename, 'w'))) {
        redirect_header($_SERVER['PHP_SELF'], 3, sprintf(_MD_TADPLAYER_CANT_OPEN, $rss_filename));
    }
    if (fwrite($handle, $main) === false) {
        redirect_header($_SERVER['PHP_SELF'], 3, sprintf(_MD_TADPLAYER_CANT_WRITE, $rss_filename));
    }
    fclose($handle);
}
コード例 #12
0
ファイル: index.php プロジェクト: geek01/tadgallery
<?php

/*-----------引入檔案區--------------*/
include_once "header.php";
include_once $GLOBALS['xoops']->path('/modules/system/include/functions.php');
$show_uid = system_CleanVars($_REQUEST, 'show_uid', 0, 'int');
$csn = system_CleanVars($_REQUEST, 'csn', 0, 'int');
$passwd = system_CleanVars($_REQUEST, 'passwd', '', 'string');
$tadgallery = new tadgallery();
if ($show_uid) {
    $tadgallery->set_show_uid($show_uid);
}
if (!empty($csn)) {
    $cate = $tadgallery->get_tad_gallery_cate($csn);
    if ($cate['show_mode'] == "waterfall") {
        $xoopsOption['template_main'] = "tadgallery_list_waterfall.html";
    } elseif ($cate['show_mode'] == "flickr") {
        $xoopsOption['template_main'] = "tadgallery_list_flickr.html";
    } elseif (isset($_REQUEST['op']) and $_REQUEST['op'] == "passwd_form") {
        $xoopsOption['template_main'] = "tadgallery_passwd_form.html";
    } else {
        $xoopsOption['template_main'] = "tadgallery_list_normal.html";
    }
} else {
    if ($xoopsModuleConfig['index_mode'] == "waterfall") {
        $xoopsOption['template_main'] = "tadgallery_list_waterfall.html";
    } elseif ($xoopsModuleConfig['index_mode'] == "flickr") {
        $xoopsOption['template_main'] = "tadgallery_list_flickr.html";
    } else {
        $xoopsOption['template_main'] = "tadgallery_list_normal.html";
    }
コード例 #13
0
ファイル: view.php プロジェクト: geek01/tadgallery
function view_pic($sn = "")
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsTpl, $xoTheme;
    $tadgallery = new tadgallery();
    //判斷是否對該模組有管理權限,  若空白
    if ($xoopsUser) {
        $nowuid = $xoopsUser->getVar('uid');
        $module_id = $xoopsModule->getVar('mid');
        $isAdmin = $xoopsUser->isAdmin($module_id);
    } else {
        $isAdmin = false;
        $nowuid = "";
    }
    $sql = "select * from " . $xoopsDB->prefix("tad_gallery") . " where sn='{$sn}'";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    $all = $xoopsDB->fetchArray($result);
    //$csn,$title,$description,$filename,$size,$type,$width,$height,$dir,$uid,$post_date,$counter,$exif,$good,$tag,$photo_sort
    foreach ($all as $k => $v) {
        ${$k} = $v;
        $xoopsTpl->assign($k, $v);
    }
    $photo_s = $tadgallery->get_pic_url($dir, $sn, $filename, "s");
    $photo_m = $tadgallery->get_pic_url($dir, $sn, $filename, "m");
    $photo_l = $tadgallery->get_pic_url($dir, $sn, $filename);
    $xoopsTpl->assign("photo_s", $photo_s);
    $xoopsTpl->assign("photo_m", $photo_m);
    $xoopsTpl->assign("photo_l", $photo_l);
    if (!empty($csn)) {
        $ok_cat = $tadgallery->chk_cate_power();
        $cate = $tadgallery->get_tad_gallery_cate($csn);
        if (!in_array($csn, $ok_cat)) {
            redirect_header("index.php?csn={$csn}&op=passwd_form", 3, sprintf(_TADGAL_NO_PASSWD_CONTENT, $cate['title']));
            exit;
        }
        $sql = "select * from " . $xoopsDB->prefix("tad_gallery") . " where csn='{$csn}' order by photo_sort , post_date";
        $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
        $slides1 = $slides2 = "";
        $i = 0;
        $start = false;
        while ($all = $xoopsDB->fetchArray($result)) {
            if ($sn == $all['sn']) {
                $start = true;
                $i = 0;
            }
            if ($start) {
                $slides1[$i]['sn'] = $all['sn'];
                $slides1[$i]['photo'] = $tadgallery->get_pic_url($all['dir'], $all['sn'], $all['filename']);
                $slides1[$i]['description'] = strip_tags($all['description']);
                $slides1[$i]['thumb'] = $tadgallery->get_pic_url($all['dir'], $all['sn'], $all['filename'], 's');
            } else {
                $slides2[$i]['sn'] = $all['sn'];
                $slides2[$i]['photo'] = $tadgallery->get_pic_url($all['dir'], $all['sn'], $all['filename']);
                $slides2[$i]['description'] = strip_tags($all['description']);
                $slides2[$i]['thumb'] = $tadgallery->get_pic_url($all['dir'], $all['sn'], $all['filename'], 's');
            }
            $i++;
        }
    }
    $xoopsTpl->assign("slides1", $slides1);
    $xoopsTpl->assign("slides2", $slides2);
    //找出上一張或下一張
    $pnp = get_pre_next($csn, $sn);
    $xoopsTpl->assign("next", $pnp['next']);
    $xoopsTpl->assign("back", $pnp['pre']);
    $arr = get_tadgallery_cate_path($csn);
    $jBreadCrumbPath = breadcrumb($csn, $arr);
    $xoopsTpl->assign("path", $jBreadCrumbPath);
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/fancybox.php")) {
        redirect_header("index.php", 3, _MA_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/fancybox.php";
    $fancybox = new fancybox('.fancybox');
    $fancybox_code = $fancybox->render(false);
    $xoopsTpl->assign('fancybox_code', $fancybox_code);
    $title = empty($title) ? $filename : $title;
    $div_width = $xoopsModuleConfig['thumbnail_m_width'] + 30;
    $size_txt = sizef($size);
    if ($uid == $nowuid or $isAdmin) {
        $xoopsTpl->assign('show_del', 1);
        //$del_btn="<a src='javascript:delete_tad_gallery_func($sn)' title='"._TADGAL_DEL_PIC."' class='btn btn-danger'>"._TAD_DEL."</a>";
        $xoopsTpl->assign('good', $good);
        $del_js = "\n    <script>\n    function delete_tad_gallery_func(sn){\n      var sure = window.confirm('" . _TAD_DEL_CONFIRM . "');\n      if (!sure)  return;\n      location.href=\"{$_SERVER['PHP_SELF']}?op=delete_tad_gallery&sn=\" + sn;\n    }\n    </script>";
    } else {
        $del_btn = $admin_tool = $del_js = "";
    }
    $xoopsTpl->assign('del_btn', $del_btn);
    //秀出各種尺寸圖示
    if ($xoopsModuleConfig['show_copy_pic']) {
        $xoopsTpl->assign("photo_s", $photo_s);
        $xoopsTpl->assign("photo_m", $photo_m);
        $xoopsTpl->assign("photo_l", $photo_l);
        $xoopsTpl->assign("description", $description);
        $xoopsTpl->assign("sel_size", 1);
    } else {
        $xoopsTpl->assign("sel_size", 0);
    }
    //推文工具
    $push = push_url($xoopsModuleConfig['use_social_tools']);
    $xoopsTpl->assign("push", $push);
    $xoopsTpl->assign("pic_toolbar", $xoopsModuleConfig['pic_toolbar']);
    $xoopsTpl->assign("thumb_slider", $xoopsModuleConfig['thumb_slider']);
    //計數器
    add_tad_gallery_counter($sn);
    //地圖部份
    $info = explode("||", $exif);
    foreach ($info as $v) {
        $exif_arr = explode("=", $v);
        $exif_arr[1] = str_replace("&#65533;", "", $exif_arr[1]);
        $bb = "\$photoexif{$exif_arr[0]}=\"{$exif_arr[1]}\";";
        if (empty($exif_arr[0])) {
            continue;
        }
        @eval($bb);
    }
    $latitude = $photoexif['GPS']['latitude'];
    $longitude = $photoexif['GPS']['longitude'];
    $xoopsTpl->assign("latitude", $latitude);
    $xoopsTpl->assign("longitude", $longitude);
    $jquery_path = get_jquery(true);
    $xoopsTpl->assign("jquery", $jquery_path);
    $xoopsTpl->assign("path", $jBreadCrumbPath);
    $xoopsTpl->assign("del_js", $del_js);
    $xoopsTpl->assign("div_width", $div_width);
    $facebook_comments = facebook_comments($xoopsModuleConfig['facebook_comments_width'], 'tadgallery', 'view.php', 'sn', $sn);
    $xoopsTpl->assign("facebook_comments", $facebook_comments);
    $fb_tag = "\n      <meta property=\"og:title\" content=\"{$title}\" />\n      <meta property=\"og:description\" content=\"{$description}\" />\n      <meta property=\"og:image\" content=\"" . $tadgallery->get_pic_url($dir, $sn, $filename, "m") . "\" />\n      ";
    $xoopsTpl->assign("xoops_module_header", $fb_tag);
    $xoopsTpl->assign("xoops_pagetitle", $title);
    if (is_object($xoTheme)) {
        $xoTheme->addMeta('meta', 'keywords', $title);
        $xoTheme->addMeta('meta', 'description', $description);
    } else {
        $xoopsTpl->assign('xoops_meta_keywords', 'keywords', $title);
        $xoopsTpl->assign('xoops_meta_description', $description);
    }
}
コード例 #14
0
ファイル: header.php プロジェクト: geek01/tadgallery
<?php

include_once "../../mainfile.php";
include_once "function.php";
if ($xoopsModuleConfig['use_pda'] == '1' and strpos($_SESSION['theme_kind'], 'bootstrap') === false) {
    if (file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/mobile_device_detect.php")) {
        include_once XOOPS_ROOT_PATH . "/modules/tadtools/mobile_device_detect.php";
        mobile_device_detect(true, false, true, true, true, true, true, 'pda.php', false);
    }
}
//判斷是否對該模組有管理權限
$isAdmin = false;
if ($xoopsUser) {
    $module_id = $xoopsModule->mid();
    $isAdmin = $xoopsUser->isAdmin($module_id);
}
$interface_menu[_TAD_TO_MOD] = "index.php";
$csn = empty($_REQUEST['csn']) ? "" : intval($_REQUEST['csn']);
$interface_menu[_MD_TADGAL_COOLIRIS] = "cooliris.php?csn={$csn}";
$upload_powers = tadgallery::chk_cate_power("upload");
if (!empty($upload_powers) and $xoopsUser or $isAdmin) {
    $interface_menu[_MD_TADGAL_UPLOAD_PAGE] = "uploads.php";
}
if ($csn and $isAdmin) {
    $interface_menu[_MD_TADGAL_MODIFY_CATE] = "admin/cate.php?csn={$csn}";
}
コード例 #15
0
function tadgallery_carousel_show($options)
{
    global $xoopsDB, $xoTheme;
    $order_array = array('post_date', 'counter', 'rand', 'photo_sort');
    $limit = empty($options[0]) ? 12 : intval($options[0]);
    $view_csn = empty($options[1]) ? '' : intval($options[1]);
    $include_sub = empty($options[2]) ? "0" : "1";
    $order_by = in_array($options[3], $order_array) ? $options[3] : "post_date";
    $desc = empty($options[4]) ? "" : "desc";
    $size = (!empty($options[5]) and $options[5] == "s") ? "s" : "m";
    $only_good = $options[6] != '1' ? "0" : "1";
    $options[7] = intval($options[7]);
    $width = empty($options[7]) ? 140 : $options[7];
    $options[8] = intval($options[8]);
    $height = empty($options[8]) ? 105 : $options[8];
    $direction = empty($options[9]) ? "0" : "1";
    $options[10] = intval($options[10]);
    $speed = (empty($options[10]) or $options[10] < 10) ? 1000 : $options[10];
    $options[11] = intval($options[11]);
    $scroll = (empty($options[11]) or $options[11] > 20) ? 3 : $options[11];
    $move = (empty($options[12]) or $options[12] > 20) ? 0 : intval($options[12]);
    $options[13] = intval($options[13]);
    $staytime = empty($options[13]) ? 5000 : $options[13];
    $tadgallery = new tadgallery();
    $tadgallery->set_limit($limit);
    if ($view_csn) {
        $tadgallery->set_view_csn($view_csn);
    }
    $tadgallery->set_orderby($order_by);
    $tadgallery->set_order_desc($desc);
    $tadgallery->set_view_good($only_good);
    $photos = $tadgallery->get_photos('return', $include_sub);
    $pics = "";
    $i = 0;
    foreach ($photos as $photo) {
        $pp = 'photo_' . $size;
        $pic_url = $photo[$pp];
        $pics[$i]['width'] = $width;
        $pics[$i]['height'] = $height;
        $pics[$i]['direction'] = $direction;
        $pics[$i]['pic_url'] = $pic_url;
        $pics[$i]['photo_sn'] = $photo['sn'];
        $pics[$i]['photo_title'] = $photo['title'];
        $i++;
    }
    if ($direction == '1') {
        $vertical_height = $height * $scroll + 50;
        $css_txt = "width:{$width}px;";
        $vertical = "direction : 'up',";
    } else {
        $vertical_height = "'auto'";
        $css_txt = "height:{$height}px;";
        $vertical = "";
    }
    //引入TadTools的jquery
    if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/jquery.php")) {
        redirect_header("http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50", 3, _TAD_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH . "/modules/tadtools/jquery.php";
    $block['view_csn'] = $view_csn;
    $block['vertical'] = $vertical;
    $block['vertical_height'] = $vertical_height;
    $block['scroll'] = intval($scroll) == 0 ? "" : "scroll: {$scroll},";
    $block['pics'] = $pics;
    get_jquery();
    $xoTheme->addScript('modules/tadgallery/class/carouFredSel/jquery.carouFredSel-6.2.1-packed.js');
    $xoTheme->addScript('modules/tadgallery/class/carouFredSel/helper-plugins/jquery.mousewheel.min.js');
    $xoTheme->addScript('modules/tadgallery/class/carouFredSel/helper-plugins/jquery.touchSwipe.min.js');
    $xoTheme->addScript('modules/tadgallery/class/carouFredSel/helper-plugins/jquery.transit.min.js');
    $xoTheme->addScript('modules/tadgallery/class/carouFredSel/helper-plugins/jquery.ba-throttle-debounce.min.js');
    return $block;
}
コード例 #16
0
ファイル: pda.php プロジェクト: geek01/tadgallery
function view_pic($sn = "")
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsModuleConfig, $isAdmin;
    //所有分類名稱
    $cate_all = get_tad_gallery_cate_all();
    $sql = "select csn,title,description,filename,size,type,width,height,dir,uid from " . $xoopsDB->prefix("tad_gallery") . " where sn='{$sn}'";
    $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    list($csn, $title, $description, $filename, $size, $type, $width, $height, $dir, $uid) = $xoopsDB->fetchRow($result);
    if (!empty($csn)) {
        $ok_cat = tadgallery::chk_cate_power();
        if (!in_array($csn, $ok_cat)) {
            header("location:{$_SERVER['PHP_SELF']}");
        }
    }
    //找出上一張或下一張
    $pnp = get_pre_next($csn, $sn);
    $back_btn = !empty($pnp['pre']) ? " id='pre_photo' onClick=\"location.href='{$_SERVER['PHP_SELF']}?sn={$pnp['pre']}'\"  onkeypress=\"location.href='{$_SERVER['PHP_SELF']}?sn={$pnp['pre']}'\"" : "";
    $next_btn = !empty($pnp['next']) ? " id='next_photo' onClick=\"location.href='{$_SERVER['PHP_SELF']}?sn={$pnp['next']}'\" onkeypress=\"location.href='{$_SERVER['PHP_SELF']}?sn={$pnp['next']}'\" " : "";
    $title = empty($title) ? $filename : $title;
    //計數器
    add_tad_gallery_counter($sn);
    //縮圖
    if ($width / $height > 2) {
        $mpic = getimagesize(tadgallery::get_pic_url($dir, $sn, $filename, "m", "dir"));
        $pic180 = "<marquee width='{$xoopsModuleConfig['thumbnail_m_width']}' behavior='scroll' height='{$mpic[1]}' direction=left scrolldelay=0 scrollamount=3><a href='" . tadgallery::get_pic_url($dir, $sn, $filename) . "'><img src='" . tadgallery::get_pic_url($dir, $sn, $filename, "m") . "'  alt='{$title}' class='instant itiltnone icolorFCFCFC' /></a></marquee>";
    } else {
        if ($width > $height) {
            $new_wh = round($xoopsModuleConfig['thumbnail_m_width'] * $height / $width, 0);
            $pcss = "width:{$xoopsModuleConfig['thumbnail_m_width']}px;height:{$new_wh}px;";
            $pacss = "width:{$new_wh}px;height:{$new_wh}px;";
        } else {
            $new_wh = round($xoopsModuleConfig['thumbnail_m_width'] * $width / $height, 0);
            $new_wh_a = $new_wh / 2;
            $pcss = "width:{$new_wh}px;height:{$xoopsModuleConfig['thumbnail_m_width']}px;";
            $pacss = "width:{$new_wh_a}px;height:{$xoopsModuleConfig['thumbnail_m_width']}px;";
        }
        $photo = tadgallery::get_pic_url($dir, $sn, $filename, "m");
        $pic180 = "\n    <table id='view_photo' style='{$pcss}background-image:url('{$photo}');background-position: top center;background-repeat: no-repeat;background-color: black;'>\n    <tr>\n    <td {$back_btn} style='{$pacss}background-position: top center;background-repeat: no-repeat;border:0px;'></td>\n    <td {$next_btn} style='{$pacss}background-position: top center;background-repeat: no-repeat;border:0px;'></td></tr>\n    </table>\n  ";
    }
    $data = "\n  <table id='main' style='width:100%;'>\n  <tr><td align='center'><a name='photo_top'>{$pic180}</a></td></tr>\n  <tr><td style='color:#E0E0E0;text-align:center'>{$title}</td></tr>\n  <tr><td style='color:#E0E0E0'>" . nl2br($description) . "</td></tr>\n  </table>\n  ";
    return $data;
}