function b_sitemap_d3downloads( $mydirname ) { require_once dirname( dirname(__FILE__) ).'/class/user_access.php' ; include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $user_access = new user_access( $mydirname ) ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $whr = "cid IN ( ".implode( ",", $user_access->can_read() )." )" ; return $mycategory->sitemap( '', $whr, 1 ) ; }
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 b_d3downloads_category_show( $options ) { include_once dirname( dirname(__FILE__) ).'/class/user_access.php' ; include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mydirname = empty( $options[0] ) ? 'd3downloads' : $options[0] ; $intree = empty( $options[1] ) ? 0 : 1 ; $cols= empty( $options[2] ) ? 1 : intval( $options[2] ) ; $this_template = empty( $options[3] ) ? 'db:'.$mydirname.'_block_category.html' : trim( $options[3] ) ; if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ; $user_access = new user_access( $mydirname ) ; $whr = "cid IN ( ".implode( ",", $user_access->can_read() )." )" ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $whr_append = $mycategory->default_whr_append() ; $category = $mycategory->sitemap( 'index.php?', $whr, 0, $whr_append, $intree ) ; if( ! empty( $category ) ){ $block['category'] = $category ; $block['mydirname'] = $mydirname ; $block['mod_url'] = XOOPS_URL.'/modules/'.$mydirname ; $block['intree'] = $intree; $block['cols'] = $cols; $block['lang_total'] = _MB_D3DOWNLOADS_TOTAL; if( empty( $options['disable_renderer'] ) ) { require_once XOOPS_ROOT_PATH.'/class/template.php' ; $tpl = new XoopsTpl() ; $tpl->assign( 'block' , $block ) ; $ret['content'] = $tpl->fetch( $this_template ) ; return $ret ; } else { return $block ; } } }
} $error = $iserror = 0 ; $category4assin = $copyselect = $message = array() ; $error_message = '' ; // GET CATEGORY LIST $category4assin = d3download_categories_selbox( $mydirname, '', 0, 1, 1 ) ; $user_access = new user_access( $mydirname ) ; if( ! empty( $_POST['category_select'] ) ) $cid = intval( $_POST['category_select'] ); elseif( ! empty( $_GET['cid'] ) ) $cid = intval( $_GET['cid'] ); else $cid = $user_access->get_top_weightid( 1 ) ; // GET CATEGORY TITLE $mycategory = new MyCategory( $mydirname, 'Show', $cid ) ; $title = $mycategory->return_title() ; $formtitle = ( $title ) ? sprintf( _MD_D3DOWNLOADS_H2USERACCESS , $title ) : _MD_D3DOWNLOADS_NEWCID_USERACCESS ; $parentid = $mycategory->return_pid() ; $maincid = ( $parentid != 0 ) ? $mycategory->get_my_maincid( $cid ) : 0 ; $category_tree = ( $parentid != 0 ) ? d3download_category_tree( $mydirname, $cid, 'index.php?page=user_access' ) : '' ; $copyselect = d3download_categories_selbox( $mydirname, '', 0, 0, 1, '----' , 1, $cid ) ; $categorycount = count( $copyselect ) ; // GROUP FORM $group_trs = ( $categorycount > 1 ) ? $user_access->get_group_form( $cid, $parentid, 0, 1 ) : $user_access->get_group_form( $cid, $parentid ) ; // USER FORM $user_trs = ( $categorycount > 1 ) ? $user_access->get_user_form( $cid, $parentid, 0, 1 ) : $user_access->get_user_form( $cid, $parentid ) ;
function d3download_make_serialize_data( $mydirname ) { include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $mycategory->serialize_insertdb() ; }
if( $xoopsModule->getVar('dirname') != $mydirname ) die( 'this page can be called only from '.$mydirname ) ; // PERMISSION ERROR $module_handler =& xoops_gethandler( 'module' ) ; $module =& $module_handler->getByDirname( $mydirname ) ; $moduleperm_handler =& xoops_gethandler( 'groupperm' ) ; $mid = $module->getVar('mid') ; if( ! is_object( @$xoopsUser ) || ! $moduleperm_handler->checkRight( 'module_admin' , $mid , $xoopsUser->getGroups() ) ) { die( 'Only administrator can use this feature.' ) ; } $iserror = 0 ; $category = $errors = $moveselect = $message = array() ; $error_message = '' ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $user_access = new user_access( $mydirname ) ; // ページナビの処理 $total = $mycategory->category_sum() ; $select_perpage = d3download_select_perpage( $mydirname ) ; $current_start = isset($_GET['start']) ? intval( $_GET['start'] ) : 0 ; $perpage4assign = d3download_items_perpage(); require_once XOOPS_ROOT_PATH.'/class/pagenav.php' ; $pagenav = new XoopsPageNav( $total, $select_perpage, $current_start, 'start', 'page=categorymanager&perpage='.$select_perpage ); $pagenav4assign = $pagenav->renderNav( 10 ) ; // GET CATEGORYLIST $category = $mycategory->get_categorylist( $select_perpage, $current_start ) ; $sitemap = $mycategory->sitemap( 'admin/index.php?page=categoryedit' ) ;
// 登録件数を取得 $total = $mydownload->Total_Num( $whr_cat, $cid, 0, 0, $intree ) ; $total_num = ( ! empty( $cid ) ) ? sprintf( _MD_D3DOWNLOADS_CATEGORY_NUM , $total ) : sprintf( _MD_D3DOWNLOADS_TOTAL_NUM , $total ) ; // 非公開件数をアサイン if( $module_admin ){ $invisible_num = $mydownload->Invisible_Num( $cid, $intree ) ; $xoopsTpl->assign( 'invisible_num' , $invisible_num['num'] ) ; $xoopsTpl->assign( 'invisible_link' , $invisible_num['link'] ) ; } // ページタイトルをアサイン $pagetitle4assign = _MD_D3DOWNLOADS_FILELIST_MAIN ; if( ! empty( $cid ) ){ include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $mydirname, 'Show', $cid, $whr_cat ) ; $pagetitle4assign .= ' - '.$mycategory->return_title() ; } // パンくず部分の処理 $bc[0] = d3download_breadcrumbs( $mydirname ) ; $breadcrumbs_tree = d3download_breadcrumbs_tree( $mydirname, $cid, $whr_cat, "index.php?page=filelist" ) ; $bc[] = ( empty( $breadcrumbs_tree ) ) ? array( 'name' => _MD_D3DOWNLOADS_FILELIST_MAIN ) : array( 'url' => 'index.php?page=filelist' , 'name' => _MD_D3DOWNLOADS_FILELIST_MAIN ) ; $breadcrumbs = array_merge( $bc, $breadcrumbs_tree ) ; // ページナビの処理 $perpage4assign = d3download_items_perpage(); $select_perpage = d3download_select_perpage( $mydirname ) ; $current_start = isset( $_GET['start'] ) ? intval( $_GET['start'] ) : 0 ; require_once dirname( dirname(__FILE__) ).'/class/my_pagenav.php' ; $orderby4pagenav = d3download_convertorderbyout( $orderby );
function get_categories_list( $top=0 ) { require_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $this->mydirname, 'Show' ) ; $ret = array() ; $ret[''] = '------' ; $result = $this->db->query( "SELECT cid, title, child FROM ".$this->cat_table." WHERE pid='0' ORDER BY cat_weight ASC" ) ; while( $array = $this->db->fetchArray( $result ) ) { foreach ( $array as $key=>$value ){ $$key = $value; } $id =intval( $cid ) ; $ret[ $id ] = $this->myts->makeTboxData4Show( $title ) ; if( empty( $top ) ) { $arr = $mycategory->unserialize_my_child( $id, '', $child ) ; foreach ( $arr as $child ) { $child_id = intval( $child['cid'] ) ; $child['prefix'] = str_replace( ".","--", $child['prefix'] ) ; $ret[ $child_id ] = $child['prefix']." " . $this->myts->makeTboxData4Show( $child['title'] ) ; } } } return $ret ; }
$ispreview = $iserror = $auto_approved = $canhtml = $canupload = $config_error = 0 ; $permissions = $category = $select_platform = $select_license = $img_ar = $liveformErrors= array() ; $shots_help = $preview_title = $preview_body = $error_message = ''; if( ! empty( $_GET['cid'] ) ) $cid = intval( $_GET['cid'] ) ; elseif( ! empty( $_POST['cid'] ) ) $cid = intval( $_POST['cid'] ) ; // 登録は CID の指定を必要とします if( empty( $cid ) ){ redirect_header(XOOPS_URL.'/modules/'.$mydirname.'/index.php',3, _MD_D3DOWNLOADS_NO_CID ); exit(); } // 存在しない CID の場合リダイレクト $mycategory = new MyCategory( $mydirname, 'Show', $cid ) ; if( ! $mycategory->return_cid() ) { redirect_header( XOOPS_URL."/modules/$mydirname/" , 2 , _MD_D3DOWNLOADS_NOREADPERM ) ; exit(); } // 投稿権限をチェック $user_access = new user_access( $mydirname ) ; $permissions = $user_access->permissions_of_current_user( $cid ) ; if( empty( $permissions['can_post'] ) ) { redirect_header(XOOPS_URL.'/modules/'.$mydirname.'/',3, _MD_D3DOWNLOADS_NOSUBMITPERM ); exit(); } // 自動承認のチェック(管理者は除く) $auto_approved = $permissions['auto_approved'] ;
function d3download_shots_dir( $mydirname, $cid ) { include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $mydirname, 'Show', $cid ) ; $cate_shotsdir = $mycategory->return_shotsdir() ; if( ! empty( $cate_shotsdir ) && file_exists( XOOPS_ROOT_PATH.'/'.$cate_shotsdir ) ){ $shots_dir = XOOPS_ROOT_PATH.'/'.$cate_shotsdir; } else { $shots_dir = XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/images/shots/'; } return $shots_dir ; }
$error = $iserror = $can_selectshotsdir = 0 ; $categorydata = $error_message = $tags = array() ; $error_message = '' ; $cid = isset( $_GET['cid'] ) ? intval( $_GET['cid'] ) : 0 ; $mycategory = new MyCategory( $mydirname, 'Show', $cid ) ; // 存在しない CID の場合リダイレクト if( $cid != 0 && ! $mycategory->return_cid() ) { redirect_header( XOOPS_URL."/modules/$mydirname/admin/index.php?page=categorymanager" , 2 , _MD_D3DOWNLOADS_NOREADPERM ) ; exit(); } // GET CATEGORY DATA $category_edit = new MyCategory( $mydirname,'Edit' ) ; if( empty( $iserror ) ) $categorydata = $category_edit->MyCategory_for_Edit( $cid ) ; $pid = $categorydata['pid'] ; $useshots = d3download_can_useshots( $mydirname ) ; $usealbum = d3download_can_albumselect( $mydirname ) ; if( ! empty( $useshots ) && empty( $usealbum ) ) $can_selectshotsdir = 1 ; $shots_dir = XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/images/shots/' ; $shotsdirhelp = sprintf( _MD_D3DOWNLOADS_CATEGORYSHOTSDIRHELP , $shots_dir ) ; $mydownload = new MyDownload( $mydirname ) ; $my_shots_dir = d3download_shots_dir( $mydirname, $cid ) ; $select_imgurl = $mydownload->shots_img_ar( $cid, $my_shots_dir ) ; // GET CATEGORY TITLE $title = $mycategory->return_title() ;
function return_category_title( $category_option ) { include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $this->mydirname, 'Show', $category_option ) ; $ret = array() ; $ret[0]['cat_name'] = $mycategory->return_title() ; return $ret ; }
function get_copy_target_category( $target_dirname ) { require_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $target_dirname, 'Show' ) ; $category = "" ; $sql = "SELECT cid, title, child FROM ".$this->db->prefix( $target_dirname."_cat" )." WHERE pid='0' ORDER BY cat_weight ASC" ; $result = $this->db->query( $sql ); while( list( $id, $name, $child_array ) = $this->db->fetchRow( $result ) ) { $cid = intval( $id ); $category .= "<option value='$cid'>".$this->myts->makeTboxData4Show( $name )."</option>\n" ; $arr = $mycategory->unserialize_my_child( $cid, '', $child_array ) ; foreach ( $arr as $child ) { $child_id = intval( $child['cid'] ) ; $child['prefix'] = str_replace( ".","--", $child['prefix'] ) ; $category .= "<option value='$child_id'>".$child['prefix']." ".$this->myts->makeTboxData4Show( $child['title'] )."</option>\n" ; } } return $category ; }
// 管理者用に閲覧権限設定状況をアサイン if( $module_admin ){ $canread_info = $user_access->canread_info( $cid ) ; $group_trs = d3download_group_useraccess_info( $mydirname, $cid ) ; $user_trs = d3download_myuser_useraccess_info( $mydirname, $cid ) ; $useraccess_edit = d3download_useraccess_edit_info( $mydirname, $cid ) ; $xoopsTpl->assign( 'canread_info', $canread_info ) ; $xoopsTpl->assign( 'group_trs', $group_trs ) ; $xoopsTpl->assign( 'user_trs', $user_trs ) ; $xoopsTpl->assign( 'useraccess_edit', $useraccess_edit ) ; } // ページタイトルをアサイン include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $mydirname, 'Show', $cid, $whr_cat ) ; $pagetitle4assign = $mycategory->return_title() ; // 閲覧できないカテゴリはリダイレクト $canread = $user_access->user_access_for_cat( $cid, $whr_cat ) ; if( empty( $canread ) ) { redirect_header( XOOPS_URL.'/modules/'.$mydirname.'/',3, _MD_D3DOWNLOADS_NOREADPERM ) ; exit() ; } // 投稿可能なカテゴリのみ投稿フォームへのリンクを表示 $can_post4cid = $user_access->user_access_for_cat( $cid, $whr_cat4post ) ; // パンくず部分の処理 $breadcrumbs = array_merge( $bc ,d3download_breadcrumbs_tree( $mydirname, $cid, $whr_cat ) ) ;
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 ; }