Beispiel #1
0
function mklogoPic($WebID = "")
{
    $Class = getWebInfo($WebID);
    $WebName = $Class['WebName'];
    $WebTitle = $Class['WebTitle'];
    if (function_exists('mb_strwidth')) {
        $n = mb_strwidth($WebName) / 2;
    } else {
        $n = strlen($WebName) / 3;
    }
    //$width=50*$n+35;
    $size = round(350 / $n, 0);
    if ($size > 70) {
        $size = 70;
        $x = $size + 10;
        $size2 = 20;
    } else {
        $x = round(350 / $n, 0) + 10;
        $size2 = 17;
    }
    $y = $size + 55;
    header('Content-type: image/png');
    $im = @imagecreatetruecolor(520, 140) or die(_MD_TCW_MKPIC_ERROR);
    imagesavealpha($im, true);
    $white = imagecolorallocate($im, 255, 255, 255);
    //$trans_colour = imagecolorallocatealpha($im, 157,211,223, 127);
    $trans_colour = imagecolorallocatealpha($im, 255, 255, 255, 127);
    imagefill($im, 0, 0, $trans_colour);
    $text_color = imagecolorallocate($im, 0, 0, 0);
    $text_color2 = imagecolorallocatealpha($im, 255, 255, 255, 50);
    $gd = gd_info();
    if ($gd['JIS-mapped Japanese Font Support']) {
        $WebTitle = iconv("UTF-8", "shift_jis", $WebTitle);
        $WebName = iconv("UTF-8", "shift_jis", $WebName);
    }
    /*
        $insert = @imagecreatefrompng("images/shadow.png");
        imagecolortransparent($insert,imagecolorat($insert,0,0));
        $insert_x = imagesx($insert);
        $insert_y = imagesy($insert);
        imagecopymerge($im,$insert,0,0,0,0,$insert_x,$insert_y,100);
    */
    imagettftext($im, $size, 0, 0, $x, $text_color, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebName);
    imagettftextoutline($im, $size, 0, 0, $x, $text_color, $white, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebName, 2);
    imagettftext($im, $size2, 0, 0, $y, $text_color, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebTitle);
    imagettftextoutline($im, $size2, 0, 0, $y, $text_color, $white, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebTitle, 1);
    mk_dir(XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}");
    mk_dir(XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/auto_logo");
    imagepng($im, XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/auto_logo/auto_logo.png");
    imagedestroy($im);
}
Beispiel #2
0
function tad_web_news_form($NewsID = "")
{
    global $xoopsDB, $xoopsUser, $WebID, $MyWebs, $isMyWeb, $xoopsTpl, $TadUpFiles, $web_cate;
    if (!$isMyWeb and $MyWebs) {
        redirect_header($_SERVER['PHP_SELF'] . "?WebID={$MyWebs[0]}&op=tad_web_news_form", 3, _MD_TCW_AUTO_TO_HOME);
    } elseif (empty($MyWebs)) {
        redirect_header("index.php", 3, _MD_TCW_NOT_OWNER);
    }
    $Class = getWebInfo($WebID);
    //抓取預設值
    if (!empty($NewsID)) {
        $DBV = get_tad_web_news($NewsID);
    } else {
        $DBV = array();
    }
    //設定「NewsID」欄位預設值
    $NewsID = !isset($DBV['NewsID']) ? "" : $DBV['NewsID'];
    //設定「NewsTitle」欄位預設值
    if (isset($DBV['NewsTitle'])) {
        $NewsTitle = _NEWS_KIND == "homework" ? $Class['WebTitle'] . date(" Y-m-d ") . _MD_TCW_HOMEWORK : $DBV['NewsTitle'];
    } else {
        $NewsTitle = _NEWS_KIND == "homework" ? $Class['WebTitle'] . date(" Y-m-d ") . _MD_TCW_HOMEWORK : "";
    }
    //設定「NewsContent」欄位預設值
    if (isset($DBV['NewsContent'])) {
        $NewsContent = $DBV['NewsContent'];
    } else {
        $NewsContent = _NEWS_KIND == "homework" ? _MD_TCW_HOMEWORK_DEFAULT : "";
    }
    //設定「NewsDate」欄位預設值
    $NewsDate = !isset($DBV['NewsDate']) ? date("Y-m-d H:i:s") : $DBV['NewsDate'];
    //設定「toCal」欄位預設值
    if (!isset($DBV['toCal'])) {
        $toCal = _NEWS_KIND == "homework" ? date("Y-m-d") : "";
    } else {
        $toCal = $DBV['toCal'] == "0000-00-00 00:00:00" ? "" : $DBV['toCal'];
    }
    //設定「NewsPlace」欄位預設值
    $NewsPlace = !isset($DBV['NewsPlace']) ? "" : $DBV['NewsPlace'];
    //設定「NewsMaster」欄位預設值
    $NewsMaster = !isset($DBV['NewsMaster']) ? "" : $DBV['NewsMaster'];
    //設定「NewsUrl」欄位預設值
    $NewsUrl = !isset($DBV['NewsUrl']) ? "" : $DBV['NewsUrl'];
    //設定「WebID」欄位預設值
    $WebID = !isset($DBV['WebID']) ? $WebID : $DBV['WebID'];
    //設定「NewsKind」欄位預設值
    $NewsKind = !isset($DBV['NewsKind']) ? "" : $DBV['NewsKind'];
    //設定「NewsCounter」欄位預設值
    $NewsCounter = !isset($DBV['NewsCounter']) ? "" : $DBV['NewsCounter'];
    //設定「CateID」欄位預設值
    $CateID = !isset($DBV['CateID']) ? "" : $DBV['CateID'];
    $cate_menu = $web_cate->cate_menu($CateID);
    $xoopsTpl->assign('cate_menu', $cate_menu);
    $op = empty($NewsID) ? "insert_tad_web_news" : "update_tad_web_news";
    //$op="replace_tad_web_news";
    if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) {
        redirect_header("index.php", 3, _MD_NEED_TADTOOLS);
    }
    include_once TADTOOLS_PATH . "/formValidator.php";
    $formValidator = new formValidator("#myForm", true);
    $formValidator_code = $formValidator->render();
    if (_USE_FCKEDITOR) {
        include_once XOOPS_ROOT_PATH . "/modules/tadtools/ck.php";
        $ck = new CKEditor("tad_web", "NewsContent", $NewsContent);
        $ck->setHeight(300);
        $editor = $ck->render();
    } else {
        $editor = "<textarea name='NewsContent' id='NewsContent' class='span12'>{$NewsContent}</textarea>";
    }
    $_SHOW_NEWS_PLACE = $_SHOW_NEWS_MASTER = $_USE_NEWS_FORM_DATETIME = $_SHOW_NEWS_URL = $_SHOW_NEWS_TOCAL = $_SHOW_NEWS_UPLOAD = "";
    $xoopsTpl->assign('formValidator_code', $formValidator_code);
    $xoopsTpl->assign('op', $op);
    $xoopsTpl->assign('NewsID', $NewsID);
    $xoopsTpl->assign('NewsContent_editor', $editor);
    $xoopsTpl->assign('SHOW_NEWS_UPLOAD', _SHOW_NEWS_UPLOAD);
    $xoopsTpl->assign('SHOW_NEWS_TOCAL', _SHOW_NEWS_TOCAL);
    $xoopsTpl->assign('toCal', $toCal);
    $xoopsTpl->assign('USE_NEWS_FORM_DATETIME', _USE_NEWS_FORM_DATETIME);
    $xoopsTpl->assign('NewsDate', $NewsDate);
    $xoopsTpl->assign('SHOW_NEWS_URL', _SHOW_NEWS_URL);
    $xoopsTpl->assign('NewsUrl', $NewsUrl);
    $xoopsTpl->assign('SHOW_NEWS_MASTER', _SHOW_NEWS_MASTER);
    $xoopsTpl->assign('NewsMaster', $NewsMaster);
    $xoopsTpl->assign('SHOW_NEWS_PLACE', _SHOW_NEWS_PLACE);
    $xoopsTpl->assign('NewsPlace', $NewsPlace);
    $xoopsTpl->assign('NewsTitle', $NewsTitle);
    $TadUpFiles->set_col("NewsID", $NewsID);
    $upform = $TadUpFiles->upform();
    $xoopsTpl->assign('upform', $upform);
}
Beispiel #3
0
function list_tad_web_discuss($WebID = "", $CateID = "", $limit = null)
{
    global $xoopsDB, $xoopsUser, $xoopsTpl;
    if (!$xoopsUser and empty($_SESSION['LoginMemID'])) {
        $xoopsTpl->assign('mode', 'need_login');
    } else {
        $showWebTitle = empty($WebID) ? 1 : 0;
        $andWebID = empty($WebID) ? "" : "and a.WebID='{$WebID}'";
        //取得tad_web_cate所有資料陣列
        $web_cate = new web_cate($WebID, "tad_web_discuss", "discuss");
        if (empty($CateID)) {
            $andCateID = "";
        } else {
            //取得單一分類資料
            $cate = $web_cate->get_tad_web_cate($CateID);
            $xoopsTpl->assign('cate', $cate);
            $andCateID = "and a.`CateID`='{$CateID}'";
        }
        $andLimit = $limit > 0 ? "limit 0,{$limit}" : "";
        $sql = "select a.* from " . $xoopsDB->prefix("tad_web_discuss") . " as a left join " . $xoopsDB->prefix("tad_web") . " as b on a.WebID=b.WebID where b.`WebEnable`='1' and a.ReDiscussID='0' {$andWebID} {$andCateID} order by a.LastTime desc {$andLimit}";
        if (empty($limit)) {
            //getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項);
            $PageBar = getPageBar($sql, 20, 10);
            $bar = $PageBar['bar'];
            $sql = $PageBar['sql'];
            $total = $PageBar['total'];
        } else {
            $bar = "";
        }
        $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
        $main_data = "";
        $i = 0;
        while ($all = $xoopsDB->fetchArray($result)) {
            //`DiscussID`, `ReDiscussID`, `CateID`, `WebID`, `MemID`, `MemName`, `DiscussTitle`, `DiscussContent`, `DiscussDate`, `LastTime`, `DiscussCounter`
            foreach ($all as $k => $v) {
                ${$k} = $v;
            }
            $renum = get_re_num($DiscussID);
            $show_re_num = empty($renum) ? "" : " ({$renum}) ";
            $LastTime = substr($LastTime, 0, 10);
            $Class = getWebInfo($WebID);
            $web_cate->set_WebID($WebID);
            $cate = $web_cate->get_tad_web_cate_arr();
            $main_data[$i]['cate'] = $cate[$CateID];
            $main_data[$i]['DiscussID'] = $DiscussID;
            $main_data[$i]['DiscussTitle'] = $DiscussTitle;
            $main_data[$i]['show_re_num'] = $show_re_num;
            $main_data[$i]['LastTime'] = $LastTime;
            $main_data[$i]['MemName'] = $MemName;
            $main_data[$i]['DiscussCounter'] = $DiscussCounter;
            $main_data[$i]['WebID'] = $WebID;
            $main_data[$i]['WebTitle'] = "<a href='index.php?WebID={$WebID}'>{$Class['WebTitle']}</a>";
            $i++;
        }
        $xoopsTpl->assign('discuss_data', $main_data);
        $xoopsTpl->assign('bar', $bar);
        $xoopsTpl->assign('isMineDiscuss', isMine());
        $xoopsTpl->assign('showWebTitleDiscuss', $showWebTitle);
    }
}
Beispiel #4
0
    $LoginMemID = isset($_SESSION['LoginMemID']) ? $_SESSION['LoginMemID'] : null;
    $LoginMemName = isset($_SESSION['LoginMemName']) ? $_SESSION['LoginMemName'] : null;
    $LoginMemNickName = isset($_SESSION['LoginMemNickName']) ? $_SESSION['LoginMemNickName'] : null;
    $LoginWebID = isset($_SESSION['LoginWebID']) ? $_SESSION['LoginWebID'] : null;
}
//目前觀看的班級
if (!empty($_REQUEST['WebID'])) {
    $WebID = intval($_REQUEST['WebID']);
    $_SESSION['WebID'] = $WebID;
} else {
    $WebID = $_SESSION['WebID'];
}
include_once "function.php";
include_once "class/cate.php";
if ($WebID) {
    $Web = getWebInfo($WebID);
    $WebName = $Web['WebTitle'];
    $WebTitle = $Web['WebTitle'];
    $WebOwner = $Web['WebOwner'];
    if (!file_exists(XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/header.png")) {
        output_head_file();
    }
} else {
    $Web = "";
    $WebName = "";
    $WebTitle = "";
    $WebOwner = "";
}
$i = 0;
if ($WebID) {
    $menu_var[$i]['id'] = $i;