function onUpdate($mode, $link_id, $forum_id, $topic_id, $post_id = 0) { $clipping_id = intval($link_id); $mydirname = $this->mydirname; $db =& Database::getInstance(); // $count = $this->getPostsCount( $forum_id , $link_id ) ; list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix($this->d3forum_dirname . "_posts") . " p LEFT JOIN " . $db->prefix($this->d3forum_dirname . "_topics") . " t ON t.topic_id=p.topic_id WHERE t.forum_id={$forum_id} AND t.topic_external_link_id='{$clipping_id}'")); // should be replaced $db->queryF("UPDATE " . $db->prefix($mydirname . "_clippings") . " SET comments_count={$count} WHERE clipping_id={$clipping_id}"); // remove all cache of the pipe list($pipe_id) = $db->fetchRow($db->query("SELECT pipe_id FROM " . $db->prefix($mydirname . "_clippings") . " WHERE clipping_id={$clipping_id}")); d3pipes_common_delete_all_cache($mydirname, $pipe_id, false, false); return true; }
<?php require_once dirname(dirname(__FILE__)) . '/include/common_functions.php'; require_once dirname(dirname(__FILE__)) . '/include/admin_functions.php'; require_once dirname(dirname(__FILE__)) . '/class/gtickets.php'; $myts =& MyTextSanitizer::getInstance(); $db =& Database::getInstance(); // // transaction stage // if (!empty($_POST['do_deletefetchcache'])) { d3pipes_common_delete_all_cache($mydirname); redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=cache", 3, _MD_A_D3PIPES_MSG_CACHEDELETED); exit; } if (!empty($_POST['do_clearlastfetch'])) { $db->query("UPDATE " . $db->prefix($mydirname . "_pipes") . " SET lastfetch_time=0"); redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=cache", 3, _MD_A_D3PIPES_MSG_PIPEUPDATED); exit; } // // form stage // // // display stage // xoops_cp_header(); include dirname(__FILE__) . '/mymenu.php'; $tpl = new D3Tpl(); $tpl->assign(array('mydirname' => $mydirname, 'mod_name' => $xoopsModule->getVar('name'), 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig)); $tpl->display('db:' . $mydirname . '_admin_cache.html');
<?php $mytrustdirname = basename(dirname(dirname(__FILE__))); $mytrustdirpath = dirname(dirname(__FILE__)); // check permission of 'module_read' of this module // (already checked by common.php) $langmanpath = XOOPS_TRUST_PATH . '/libs/altsys/class/D3LanguageManager.class.php'; if (!file_exists($langmanpath)) { die('install the latest altsys'); } require_once $langmanpath; $langman =& D3LanguageManager::getInstance(); $langman->read('main.php', $mydirname, $mytrustdirname); require_once XOOPS_TRUST_PATH . '/modules/d3pipes/include/common_functions.php'; // mod_config $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname($mydirname); $config_handler =& xoops_gethandler('config'); $configs = $config_handler->getConfigList($module->mid()); // force to remove all cache of all pipes d3pipes_common_delete_all_cache($mydirname, 0, true, false); // pipes loop $db =& Database::getInstance(); $result = $db->query("SELECT pipe_id FROM " . $db->prefix($mydirname . "_pipes")); while (list($pipe_id) = $db->fetchRow($result)) { $pipe4assign = d3pipes_common_get_pipe4assign($mydirname, intval($pipe_id)); d3pipes_common_fetch_entries($mydirname, $pipe4assign, $configs['entries_per_eachpipe'], $errors, $configs); }
$pipe_id = $db->getInsertId(); } $db->queryF("UPDATE " . $db->prefix($mydirname . "_pipes") . " SET " . $set4sql . ",modified_time=UNIX_TIMESTAMP(),lastfetch_time=0 WHERE `pipe_id`={$pipe_id}"); // remove cache d3pipes_common_delete_all_cache($mydirname, $pipe_id); redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=pipe", 3, _MD_A_D3PIPES_MSG_PIPEUPDATED); exit; } if (!empty($_POST['do_delete'])) { if (!$xoopsGTicket->check(true, 'd3pipes_admin')) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } $pipe_id = intval(@$_POST['pipe_id']); $db->queryF("DELETE FROM " . $db->prefix($mydirname . "_pipes") . " WHERE pipe_id={$pipe_id}"); // remove cache d3pipes_common_delete_all_cache($mydirname, $pipe_id); redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=pipe", 3, _MD_A_D3PIPES_MSG_PIPEUPDATED); exit; } if (!empty($_POST['do_batchupdate'])) { if (!$xoopsGTicket->check(true, 'd3pipes_admin')) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } foreach ($_POST['name'] as $pipe_id => $name) { $pipe_id = intval($pipe_id); $name4sql = mysql_real_escape_string($myts->stripSlashesGPC($name)); $weight4sql = intval(@$_POST['weight'][$pipe_id]); $flags4sql = ''; foreach (array('main_disp', 'main_list', 'main_aggr', 'main_rss', 'block_disp', 'in_submenu') as $key) { $flags4sql .= ",`{$key}`=" . (empty($_POST[$key][$pipe_id]) ? '0' : '1'); }