Пример #1
0
	function d3download_approval_insertdb( $mydirname, $myparams )
	{
		require_once dirname( dirname(__FILE__) ).'/class/db_download.php' ;
		require_once dirname( dirname(__FILE__) ).'/include/common_functions.php' ;
		include_once dirname( dirname(__FILE__) ).'/include/upload_functions.php' ;

		$db =& Database::getInstance() ;
		global $xoopsUser , $xoopsModuleConfig ;

		// Initialization
		$error = 0 ;
		foreach ( $myparams as $key=>$value ){ $$key = $value; }

		// MAKE LINK SQL
		if( ! empty( $requestid ) && empty( $modify ) && empty( $lid ) ) {
			$new_lid = $db->genId($db->prefix( $mydirname."_downloads" )."_lid_seq");
			$make_link = new db_download( $db->prefix( $mydirname."_downloads" ) , "lid", $new_lid ) ;
			$newid = $make_link->db_insert( $set4sql );
			if( empty( $newid ) ) $error = $requestid ;
			d3download_convert_for_newid( $mydirname, $newid, $post_url, $post_file2, $submitter );

			// Category title
			include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ;
			$mycategory = new MyCategory( $mydirname, 'Show', $cid ) ;
			$ctitle = $mycategory->return_title() ;

			// Define tags for notification message
			$tags = array();
			$tags = array(
				'POSTER_UNAME' => $postname ,
				'POST_TITLE' => $title ,
				'POST_BODY' => $body ,
				'POST_URL' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=singlefile&cid=' . $cid . '&lid=' . $newid,
				'CAT_TITLE' => $ctitle ,
				'CAT_URL' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?cid=' . $cid ,
			) ;
			d3download_main_trigger_event( $mydirname , 'global' , 0 , 'newpost' , $tags, 0 ) ;
			d3download_main_trigger_event( $mydirname , 'category' , $cid , 'newpost' , $tags, 0 ) ;
			d3download_main_trigger_event( $mydirname , 'category' , $cid , 'newpostfull' , $tags, 0 ) ;
			if( ! empty( $notify ) ){
				d3download_main_trigger_event( $mydirname , 'global' , $requestid , 'approve' , $tags, 0 ) ;
			}

			// Increment Post
			if( $submitter > 0 && ! empty( $xoopsModuleConfig['plus_posts'] ) ) {
				$user = new XoopsUser( $submitter ) ;
				$user->incrementPost() ;
			}
		} elseif( ! empty( $requestid ) && ! empty( $modify ) && ! empty( $lid ) ) {
			// UPDATE SQL
			$make_link = new db_download( $db->prefix( $mydirname."_downloads" ) , "lid", $lid ) ;
			$count = $make_link->db_getrowsnum( $lid );
			if( $count > 0 ){
				require_once dirname( dirname(__FILE__) ).'/class/history_download.php' ;
				$history = new history_download( $mydirname ) ;
				$history->history_Insert_DB( $lid ) ;
				$result = $make_link->db_update( $set4sql, $lid );
				if( ! $result ) $error = $lid ;
				$history->history_Delete( $lid ) ;
				if( ! empty( $notify ) ){
					// Define tags for notification message
					$tags = array();
					$tags = array(
						'POST_TITLE' => $title ,
						'POST_URL' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=singlefile&cid=' . $cid . '&lid=' . $lid,
					) ;
					d3download_main_trigger_event( $mydirname , 'global' , $lid , 'approve' , $tags, 0 ) ;
				}
			}
		}
		$sql = "SELECT COUNT(*) FROM ".$db->prefix( $mydirname."_unapproval" )." WHERE requestid='".$requestid."'";
		list( $count ) = $db->fetchRow( $db->query( $sql ) );
		if( $count > 0 ){
			$sql = "DELETE FROM ".$db->prefix($mydirname."_unapproval")." WHERE requestid = ".$requestid;
			$result = $db->query($sql);
			if( ! $result ) $error = $requestid ;
		}
		d3download_delete_cache_of_categories( $mydirname ) ;
		redirect_header( XOOPS_URL."/modules/$mydirname/admin/index.php?page=approvalmanager" , 2 , $error ? sprintf( _MD_D3DOWNLOADS_ERROR_MESSEAGE , $error ) : _MD_D3DOWNLOADS_SUBMIT_APPROVED ) ;
		exit();
	}
Пример #2
0
		'cid' => $edit_id ,
		'pid' => $pid ,
		'title' => $requests_text['title4edit'] ,
		'imgurl' => $requests_text['imgurl4edit'] ,
		'description' => $requests_text['description4edit'] ,
		'shotsdir' => $requests_text['shotsdir4edit'] ,
		'cat_weight' =>  $requests_int['cat_weight'] ,
		'submit_message' => $requests_text['submit_message4edit'] ,
		'old_pid' =>  $old_pid ,
	) ;

	if( empty( $iserror ) ){
		if ( ! empty( $edit_id ) && ( $pid != $old_pid ) ) $category_edit->pid_select_check( $edit_id, $pid, $old_pid, 1 ) ;

		include_once dirname( dirname(__FILE__) ).'/class/db_download.php' ;
		$post_cat = new db_download( $db->prefix( $mydirname."_cat" ) , "cid", $edit_id ) ;

		// SET4SQL
		$set4sql_int = $requests_int['set4sql'] ;
		$set4sql_text = $requests_text['set4sql'] ;
		$set4sql = $set4sql_int . $set4sql_text ;

		// MAKE LINK SQL
		if( empty( $edit_id ) ) {
			$new_cid = $post_cat->db_insert( $set4sql );
			if( empty( $new_cid ) ){
				redirect_header( XOOPS_URL."/modules/$mydirname/admin/index.php?page=categorymanager" , 2 , _MD_D3DOWNLOADS_ERROR_MESSEAGE_NOID ) ;
				exit();
			}
			// Define tags for notification message
			$tags = array(