function update_category($CAT) { global $db, $DT; $linkurl = listurl($CAT); if ($DT['index']) { $linkurl = str_replace($DT['index'] . '.' . $DT['file_ext'], '', $linkurl); } $db->query("UPDATE {$db->pre}category SET linkurl='{$linkurl}' WHERE catid=" . $CAT['catid']); }
while ($r = $db->fetch_array($result)) { if ($lazy && isset($r['thumb']) && $r['thumb']) { $r['thumb'] = DT_SKIN . 'image/lazy.gif" original="' . $r['thumb']; } $tags[] = $r; } } $seo_file = 'list'; include DT_ROOT . '/include/seo.inc.php'; $destoon_task = "moduleid={$moduleid}&html=list&catid={$catid}&page={$page}"; if ($EXT['wap_enable']) { $head_mobile = $EXT['wap_url'] . 'index.php?moduleid=' . $moduleid . '&catid=' . $catid . ($page > 1 ? '&page=' . $page : ''); } $filename = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl($CAT, $page); ob_start(); include template($template, $module); $data = ob_get_contents(); ob_clean(); if ($DT['pcharset']) { $filename = convert($filename, DT_CHARSET, $DT['pcharset']); } file_put($filename, $data); if ($page == 1) { $indexname = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl($CAT, 0); if ($DT['pcharset']) { $indexname = convert($indexname, DT_CHARSET, $DT['pcharset']); } file_copy($filename, $indexname); } } return true;
function delete($itemid, $all = true) { global $MOD, $table; if (is_array($itemid)) { foreach ($itemid as $v) { $this->delete($v, $all); } } else { $r = $this->get_one(); if ($MOD['list_html']) { $_file = DT_ROOT . '/' . $MOD['moduledir'] . '/' . $r['linkurl'] . $DT['index'] . '.' . $DT['file_ext']; if (is_file($_file)) { unlink($_file); } $i = 1; while ($i) { $_file = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl(array('catid' => $r['itemid'], 'catdir' => $r['filepath'], 'catname' => $r['title']), $i); if (is_file($_file)) { unlink($_file); $i++; } else { break; } } } if ($all) { $userid = get_user($r['username']); if ($r['thumb']) { delete_upload($r['thumb'], $userid); } $this->db->query("DELETE FROM {$this->table} WHERE itemid={$itemid}"); $this->db->query("DELETE FROM {$table}_fans WHERE gid={$itemid}"); $this->db->query("UPDATE {$table} SET status=0 WHERE gid={$itemid}"); } } }
function listpages($CAT, $total, $page = 1, $perpage = 20, $step = 2) { global $DT, $MOD, $L; if ($total <= $perpage) { return ''; } $items = $total; $total = ceil($total / $perpage); if ($page < 1 || $page > $total) { $page = 1; } $home_url = $MOD['linkurl'] . $CAT['linkurl']; $demo_url = $MOD['linkurl'] . listurl($CAT, '{destoon_page}'); $pages = ''; include DT_ROOT . '/api/pages.' . ($DT['pages_mode'] ? 'sample' : 'default') . '.php'; return $pages; }
<?php defined('IN_DESTOON') or exit('Access Denied'); if (!$CAT || $CAT['moduleid'] != $moduleid) { include load('404.inc'); } require DT_ROOT . '/module/' . $module . '/common.inc.php'; if ($MOD['list_html']) { $html_file = listurl($CAT, $page); if (is_file(DT_ROOT . '/' . $MOD['moduledir'] . '/' . $html_file)) { d301($MOD['linkurl'] . $html_file); } } if (!check_group($_groupid, $MOD['group_list']) || !check_group($_groupid, $CAT['group_list'])) { include load('403.inc'); } $CP = $MOD['cat_property'] && $CAT['property']; if ($MOD['cat_property'] && $CAT['property']) { require DT_ROOT . '/include/property.func.php'; $PPT = property_condition($catid); } unset($CAT['moduleid']); extract($CAT); $maincat = get_maincat($child ? $catid : $parentid, $moduleid); $condition = 'status=3'; $condition .= $CAT['child'] ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid={$catid}"; if ($cityid) { $areaid = $cityid; $ARE = $AREA[$cityid]; $condition .= $ARE['child'] ? " AND areaid IN (" . $ARE['arrchildid'] . ")" : " AND areaid={$areaid}"; $items = $db->count($table, $condition, $CFG['db_expires']);
$update_user = update_user($member, $item); if ($update_user) { $db->query("UPDATE {$table} SET " . substr($update_user, 1) . " WHERE username='******'"); } } include DT_ROOT . '/include/update.inc.php'; if ($MOD['show_html'] && $task_item && $DT_TIME - @filemtime(DT_ROOT . '/' . $MOD['moduledir'] . '/' . $item['linkurl']) > $task_item) { tohtml('show', $module); } } else { if ($html == 'list') { $catid or exit; if ($MOD['list_html'] && $task_list && $CAT) { $num = 1; $totalpage = max(ceil($CAT['item'] / $MOD['pagesize']), 1); $demo = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl($CAT, '{DEMO}'); $fid = $page; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('list', $module); } $fid = $page + 1; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('list', $module); } $fid = $totalpage + 1 - $page; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('list', $module); } } } else { if ($html == 'index') {
function repair() { $query = $this->db->query("SELECT * FROM {$this->table} WHERE moduleid='{$this->moduleid}' ORDER BY listorder,catid"); $CATEGORY = array(); while ($r = $this->db->fetch_array($query)) { $CATEGORY[$r['catid']] = $r; } $childs = array(); foreach ($CATEGORY as $catid => $category) { $CATEGORY[$catid]['arrparentid'] = $arrparentid = $this->get_arrparentid($catid, $CATEGORY); $CATEGORY[$catid]['catdir'] = $catdir = preg_match("/^[0-9a-z_\\-\\/]+\$/i", $category['catdir']) ? $category['catdir'] : $catid; $sql = "catdir='{$catdir}',arrparentid='{$arrparentid}'"; if (!$category['linkurl']) { $CATEGORY[$catid]['linkurl'] = listurl($category); $sql .= ",linkurl='{$category['linkurl']}'"; } $this->db->query("UPDATE {$this->table} SET {$sql} WHERE catid={$catid}"); if ($arrparentid) { $arr = explode(',', $arrparentid); foreach ($arr as $a) { if ($a == 0) { continue; } isset($childs[$a]) or $childs[$a] = ''; $childs[$a] .= ',' . $catid; } } } foreach ($CATEGORY as $catid => $category) { if (isset($childs[$catid])) { $CATEGORY[$catid]['arrchildid'] = $arrchildid = $catid . $childs[$catid]; $CATEGORY[$catid]['child'] = 1; $this->db->query("UPDATE {$this->table} SET arrchildid='{$arrchildid}',child=1 WHERE catid='{$catid}'"); } else { $CATEGORY[$catid]['arrchildid'] = $catid; $CATEGORY[$catid]['child'] = 0; $this->db->query("UPDATE {$this->table} SET arrchildid='{$catid}',child=0 WHERE catid='{$catid}'"); } } $this->cache($CATEGORY); return true; }
} $fid = $page + 1; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('list', $module); } $fid = $totalpage + 1 - $page; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('list', $module); } } else { $itemid = $gid = $catid; $GRP = get_group($gid); if ($GRP) { $num = 1; $totalpage = max(ceil($GRP['post'] / $MOD['pagesize']), 1); $demo = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl(array('catid' => $GRP['itemid'], 'catdir' => $GRP['filepath'], 'catname' => $GRP['title']), '{DEMO}'); $fid = $page; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('group', $module); } $fid = $page + 1; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('group', $module); } $fid = $totalpage + 1 - $page; if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) { tohtml('group', $module); } if ($_userid && is_admin($GRP)) { echo '$(".manage").show();'; }