function tad_web_image() { global $xoopsDB; if (empty($_GET['WebID'])) { $where_webid = ""; } else { $WebID = intval($_GET['WebID']); $where_webid = "where a.WebID='{$WebID}'"; } $sql = "select a.ActionName,a.ActionID,b.WebTitle,a.WebID from " . $xoopsDB->prefix("tad_web_action") . " as a join " . $xoopsDB->prefix("tad_web") . " as b on a.WebID=b.WebID {$where_webid} order by rand() limit 0,1"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); list($ActionName, $ActionID, $WebTitle, $WebID) = $xoopsDB->fetchRow($result); if (empty($ActionID)) { return; } $slide_images = ""; $block['WebTitle'] = $WebTitle; $block['WebID'] = $WebID; $block['ActionID'] = $ActionID; $block['ActionName'] = $ActionName; include_once XOOPS_ROOT_PATH . "/modules/tadtools/TadUpFiles.php"; $tad_web_action_image = new TadUpFiles("tad_web"); $subdir = isset($WebID) ? "/{$WebID}" : ""; $tad_web_action_image->set_dir('subdir', "/{$subdir}"); $tad_web_action_image->set_col("ActionID", $ActionID); $photos = $tad_web_action_image->get_file(); if (file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/ResponsiveSlides.php")) { include_once XOOPS_ROOT_PATH . "/modules/tadtools/ResponsiveSlides.php"; $ResponsiveSlides = new slider(120, false); $i = 1; foreach ($photos as $pic) { if ($pic['description'] == $pic['original_filename']) { $pic['description'] = ""; } $ResponsiveSlides->add_content($i, $pic['description'], '', $pic['path'], '', XOOPS_URL . "/modules/tad_web/action.php?WebID={$WebID}&ActionID={$ActionID}"); $i++; } $slide_images = $ResponsiveSlides->render(); } $block['slide_images'] = $slide_images; return $block; }
<?php define("TADTOOLS_PATH", XOOPS_ROOT_PATH . "/modules/tadtools"); define("TADTOOLS_URL", XOOPS_URL . "/modules/tadtools"); if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/TadUpFiles.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/TadUpFiles.php"; $TadUpFiles = new TadUpFiles("tad_web"); $subdir = isset($WebID) ? "/{$WebID}" : ""; $TadUpFiles->set_dir('subdir', $subdir); //引入TadTools的函式庫 include_once TADTOOLS_PATH . "/tad_function.php"; include_once "function_list.php"; /********************* 自訂函數 *********************/ //取得所有網站設定值 function get_web_all_config($WebID = "") { global $xoopsDB, $WebID; if (empty($WebID)) { return; } $tad_web_config = ""; $sql = "select `ConfigName`,`ConfigValue` from " . $xoopsDB->prefix("tad_web_config") . " where `WebID`='{$WebID}'"; $result = $xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); while (list($ConfigName, $ConfigValue) = $xoopsDB->fetchRow($result)) { $tad_web_config[$ConfigName] = $ConfigValue; } if (empty($tad_web_config)) { if (file_exists(XOOPS_ROOT_PATH . "/themes/for_tad_web_theme/theme_config.php")) { include XOOPS_ROOT_PATH . "/themes/for_tad_web_theme/theme_config.php";