コード例 #1
0
ファイル: attach.php プロジェクト: cedwards-reisys/nexus-web
 protected function verifyAttachmentPath($userid)
 {
     // Allow userid to be 0 since vB2 allowed guests to post attachments
     $userid = intval($userid);
     $path = $this->fetchAttachmentPath($userid);
     if (vB_Library_Functions::vbMkdir($path)) {
         return $path;
     } else {
         return false;
     }
 }
コード例 #2
0
 /**
  * Get the path for a user and make sure it exists
  *
  * @param 	int	$userid
  * @param	int	Attachment storage type to use to generate the path
  *
  * @return 	string	path to user's storage.
  */
 public function fetchAttachmentPath($userid, $storageType)
 {
     // Allow userid to be 0 since vB2 allowed guests to post attachments
     $userid = intval($userid);
     if (empty($attachPath)) {
         $attachPath = $this->filePath;
     }
     if ($storageType == self::ATTACH_AS_FILES_NEW) {
         $path = $attachPath . '/' . implode('/', preg_split('//', $userid, -1, PREG_SPLIT_NO_EMPTY));
     } else {
         $path = $attachPath . '/' . $userid;
     }
     if (is_dir($path)) {
         return $path;
     } else {
         if (file_exists($path)) {
             throw new vB_Exception_Api('attachpathfailed');
         }
     }
     if (vB_Library_Functions::vbMkdir($path)) {
         return $path;
     } else {
         return false;
     }
 }