public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/functions.php
/**
 * Create a directory that can be used to store the uploaded files in for the user completing a specific quiz.
 *
 * @since 1.0.0
 *
 * @param object  $quizDetails The details of the quiz being completed.
 * @param integer $userID The ID of the user completing the quiz.
 * @param boolean $createItToo If true, then create the new directory.
 *
 * @return array The full server path to the newly created upload directory and URL version.
 */
Create a directory that can be used to store the uploaded files in for the user completing a specific quiz.

@param object  $quizDetails The details of the quiz being completed.
@param integer $userID The ID of the user completing the quiz.
@param boolean $createItToo If true, then create the new directory.

@return array The full server path to the newly created upload directory and URL version.
Create a directory that can be used to store the uploaded files in for the user completing a specific quiz . @param object $quizDetails The details of the quiz being completed . @param integer $userID The ID of the user completing the quiz . @param boolean $createItToo If true then create the new directory . @return array The full server path to the newly created upload directory and URL version .
function WPCW_files_getFileUploadDirectory_forUser( $quizDetails, $userID, $createItToo = true ) {
	$keyString = sprintf( '%d_%d_%s', $quizDetails->quiz_id, $userID, date( 'Ymd_His' ) );
	$pathName  = $keyString . '_' . md5( 'user_upload_directory' . $keyString );
	$fullPath = WP_CONTENT_DIR . '/wpcourseware_uploads/' . $pathName . '/';
	if ( $createItToo && ! file_exists( $fullPath ) ) {
		@mkdir( $fullPath, 0777, true );
	}
	if ( file_exists( $fullPath ) ) {
		touch( $fullPath . 'index.php' );
	}
	return array(
		'dir_path'  => $fullPath,
		'path_only' => '/wpcourseware_uploads/' . $pathName . '/',
	);
}
function WPCW_files_getFileUploadDirectory_forUser ( $ quizDetails , $ userID , $ createItToo = true ) { $ keyString = sprintf ( '%d_%d_%s' , $ quizDetails -> quiz_id , $ userID , date ( 'Ymd_His' ) ) ; $ pathName = $ keyString . '_' . md5 ( 'user_upload_directory' . $ keyString ) ; $ fullPath = WP_CONTENT_DIR . '/wpcourseware_uploads/' . $ pathName . '/' ; if ( $ createItToo && ! file_exists ( $ fullPath ) ) { @ mkdir ( $ fullPath , 0777 , true ) ; } if ( file_exists ( $ fullPath ) ) { touch ( $ fullPath . 'index.php' ) ; } return array ( 'dir_path' => $ fullPath , 'path_only' => '/wpcourseware_uploads/' . $ pathName . '/' , ) ; }
Create a directory that can be used to store the uploaded files in for the user completing a specific quiz.
Create a directory that can be used to store the uploaded files in for the user completing a specific quiz .
// Create path based on the quiz ID, user ID, and date. // Generate the full file path // Create an empty index page to stop directory listings. // Need URL and directory versions