function onUpdate( $mode , $link_id , $forum_id , $topic_id , $post_id = 0 ) { include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $db =& Database::getInstance() ; $mydirname = $this->mydirname ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $lid = intval( $link_id ) ; $sql = "SELECT COUNT(*) FROM ".$db->prefix($this->d3forum_dirname."_posts")." p" ; $sql .= " LEFT JOIN ".$db->prefix($this->d3forum_dirname."_topics")." t" ; $sql .= " ON t.topic_id = p.topic_id WHERE t.forum_id = '".$forum_id."'" ; $sql .= " AND t.topic_external_link_id='".$lid."'" ; list( $count ) = $db->fetchRow( $db->query( $sql ) ) ; $db->queryF( "UPDATE ".$db->prefix( $mydirname."_downloads" )." SET comments=$count WHERE lid = '".$lid."'" ) ; $mycategory->delete_cache_of_categories() ; return true ; }
function d3download_delete_cache_of_categories( $mydirname ) { include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $mycategory->delete_cache_of_categories() ; }
function Ratefile_Execution( $cid, $lid ) { global $xoopsConfig ; // Check if rating is valid if( $this->rating <= 0 || $this->rating > 10 ) { redirect_header( XOOPS_URL."/modules/$this->mydirname/index.php?page=ratefile&cid=$cid&lid=$lid" , 4 , _MD_D3DOWNLOADS_NORATING ) ; exit ; } $check_result = $this->Ratefile_check( $lid ) ; if( ! empty( $check_result ) ) { $this->redirect_message( $check_result ) ; exit ; } // All is well. Add to Line Item Rate to DB. $this->Insert_DB( $lid ) ; //All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. $this->UpdateRating( $lid ); include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $this->mydirname, 'Show' ) ; $mycategory->delete_cache_of_categories() ; $message = _MD_D3DOWNLOADS_VOTEAPPRE."<br />".sprintf( _MD_D3DOWNLOADS_THANKURATE , $xoopsConfig['sitename'] ) ; $this->redirect_message( $message ) ; exit ; }