예제 #1
0
 public static function realJavaUpload($frontEnd = 0)
 {
     $app = JFactory::getApplication();
     JRequest::checkToken('request') or exit('ERROR: ' . JText::_('COM_PHOCAGALLERY_INVALID_TOKEN'));
     //	$files 	= JRequest::getVar( 'Filedata', '', 'files', 'array' );
     $path = PhocaGalleryPath::getPath();
     $folder = JRequest::getVar('folder', '', '', 'path');
     if (isset($folder) && $folder != '') {
         $folder = $folder . DS;
     }
     $errUploadMsg = '';
     $ftp = JClientHelper::setCredentialsFromRequest('ftp');
     foreach ($_FILES as $fileValue => $file) {
         echo 'File key: ' . $fileValue . "\n";
         foreach ($file as $item => $val) {
             echo ' Data received: ' . $item . '=>' . $val . "\n";
         }
         // Make the filename safe
         if (isset($file['name'])) {
             $file['name'] = JFile::makeSafe($file['name']);
         }
         if (isset($file['name'])) {
             $filepath = JPath::clean($path->image_abs . $folder . strtolower($file['name']));
             if (!PhocaGalleryFileUpload::canUpload($file, $errUploadMsg, $frontEnd)) {
                 exit('ERROR: ' . JText::_($errUploadMsg));
             }
             if (JFile::exists($filepath)) {
                 exit('ERROR: ' . JText::_('COM_PHOCAGALLERY_FILE_ALREADY_EXISTS'));
             }
             if (!JFile::upload($file['tmp_name'], $filepath)) {
                 exit('ERROR: ' . JText::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'));
             }
             if ((int) $frontEnd > 0) {
                 return $file['name'];
             }
             exit('SUCCESS');
         } else {
             exit('ERROR: ' . JText::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'));
         }
     }
     return true;
 }
예제 #2
0
<?php

defined('_JEXEC') or die('Restricted access');
if (!empty($this->tmpl['ju_output'])) {
    echo '<div id="phocagallery-javaupload" class="ph-in">';
    echo '<form action="' . JURI::base() . 'index.php?option=com_phocagallery" >';
    if ($this->tmpl['ftp']) {
        echo PhocaGalleryFileUpload::renderFTPaccess();
    }
    echo '<div class="control-label ph-head-form">' . JText::_('COM_PHOCAGALLERY_UPLOAD_FILE') . ' [ ' . JText::_('COM_PHOCAGALLERY_MAX_SIZE') . ':&nbsp;' . $this->tmpl['uploadmaxsizeread'] . ',' . ' ' . JText::_('COM_PHOCAGALLERY_MAX_RESOLUTION') . ':&nbsp;' . $this->tmpl['uploadmaxreswidth'] . ' x ' . $this->tmpl['uploadmaxresheight'] . ' px ]</div>';
    echo $this->tmpl['ju_output'];
    echo '</form>';
    echo '</div>';
}
예제 #3
0
 function javaupload()
 {
     $result = PhocaGalleryFileUpload::realJavaUpload();
     return true;
 }
예제 #4
0
<?php

defined('_JEXEC') or die('Restricted access');
echo '<div id="phocagallery-upload">';
echo '<div style="font-size:1px;height:1px;margin:0px;padding:0px;">&nbsp;</div>';
echo '<form action="' . $this->tmpl['su_url'] . '" id="uploadFormU" method="post" enctype="multipart/form-data">';
if ($this->tmpl['ftp']) {
    echo PhocaGalleryFileUpload::renderFTPaccess();
}
echo '<fieldset class="actions">' . ' <legend>';
echo JText::_('COM_PHOCAGALLERY_UPLOAD_FILE') . ' [ ' . JText::_('COM_PHOCAGALLERY_MAX_SIZE') . ':&nbsp;' . $this->tmpl['uploadmaxsizeread'] . ',' . ' ' . JText::_('COM_PHOCAGALLERY_MAX_RESOLUTION') . ':&nbsp;' . $this->tmpl['uploadmaxreswidth'] . ' x ' . $this->tmpl['uploadmaxresheight'] . ' px ]';
echo ' </legend>';
echo $this->tmpl['su_output'] . '</fieldset>';
echo '</form>';
echo PhocaGalleryFileUpload::renderCreateFolder($this->session->getName(), $this->session->getId(), $this->currentFolder, 'phocagallerym', 'tab=' . $this->tmpl['currenttab']['upload']);
echo '</div>';
예제 #5
0
 function multipleupload()
 {
     JResponse::allowCache(false);
     // Chunk Files
     header('Content-type: text/plain; charset=UTF-8');
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     // Invalid Token
     JRequest::checkToken('request') or jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 100, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_INVALID_TOKEN'))));
     jimport('joomla.client.helper');
     $app = JFactory::getApplication();
     $ftp = JClientHelper::setCredentialsFromRequest('ftp');
     $user = JFactory::getUser();
     $path = PhocaGalleryPath::getPath();
     $return = $this->input->get('return-url', null, 'base64');
     $format = $this->input->get('format', 'html', 'cmd');
     $viewBack = $this->input->get('viewback', '', 'string');
     $tab = $this->input->get('tab', 0, 'int');
     $catid = $this->input->get('id', '', 'string');
     $rating = $this->input->get('rating', '', 'string');
     $Itemid = $this->input->get('Itemid', 0, 'int');
     $limitStart = $this->input->get('limitstart', 0, 'int');
     $paramsC = JComponentHelper::getParams('com_phocagallery');
     $model = $this->getModel('category');
     $catid = (int) $catid;
     // USER RIGHT - UPLOAD - - - - - - - - - - -
     // 2, 2 means that user access will be ignored in function getUserRight for display Delete button
     $rightDisplayUpload = 0;
     $catAccess = PhocaGalleryAccess::getCategoryAccess((int) $catid);
     if (!empty($catAccess)) {
         $rightDisplayUpload = PhocaGalleryAccess::getUserRight('uploaduserid', $catAccess->uploaduserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
     }
     // - - - - - - - - - - - - - - - - - - - - - -
     // USER RIGHT - FOLDER - - - - - - - - - - - -
     $rightFolder = '';
     if (isset($catAccess->userfolder)) {
         $rightFolder = $catAccess->userfolder;
     }
     // - - - - - - - - - - - - - - - - - - - - - -
     if ($rightDisplayUpload == 1) {
         if ($rightFolder == '') {
             jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_USER_FOLDER_NOT_DEFINED'))));
             return false;
         }
         if (!JFolder::exists($path->image_abs . $rightFolder . DS)) {
             jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_USER_FOLDER_NOT_EXISTS'))));
             return false;
         }
         // Check the size of all images by users
         /*	$maxUserImageSize 	= (int)$paramsC->get( 'user_images_max_size', 20971520 );
         			$allFileSize		= PhocaGalleryFileUploadFront::getSizeAllOriginalImages($file, $this->_user->id);
         
         			if ($maxUserImageSize > 0 && (int) $allFileSize > $maxUserImageSize) {
         				$errUploadMsg = JText::_('COM_PHOCAGALLERY_WARNING_USERIMAGES_TOOLARGE');	
         				$app->redirect($redirectUrl, $errUploadMsg);
         				return false;
         			}*/
         // Sending and setting data for common realsingleupload function
         $this->input->set('folder', $rightFolder);
         //Set the right path for uploaded image (category folder included)
         $this->input->set('return-url', base64_encode($return));
         // set return url
         $fileName = PhocaGalleryFileUpload::realMultipleUpload(1);
         if ($fileName != '') {
             // Saving file name into database with relative path
             $fileName = $rightFolder . '/' . strtolower($fileName);
             if (PhocaGalleryControllerCategory::save((int) $catid, $fileName, false, $succeeded, $errUploadMsg, false)) {
                 jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'OK', 'code' => 200, 'message' => JText::_('COM_PHOCAGALERY_SUCCESS') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_IMAGES_UPLOADED'))));
                 return true;
             } else {
                 jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'))));
                 return false;
             }
         }
     } else {
         jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION'))));
         return false;
     }
 }
예제 #6
0
    ?>
<div>
		<?php 
    for ($i = 0, $n = count($this->folders); $i < $n; $i++) {
        $this->setFolder($i);
        echo $this->loadTemplate('folder');
    }
    ?>

</div>
<?php 
} else {
    ?>
<div>
	<center style="clear:both;font-size:large;font-weight:bold;color:#b3b3b3;font-family: Helvetica, sans-serif;">
		<?php 
    echo JText::_('COM_PHOCAGALLERY_THERE_IS_NO_FOLDER');
    ?>
	</center>
</div>

<?php 
}
echo '<div style="clear:both"></div>';
echo PhocaGalleryFileUpload::renderCreateFolder($this->session->getName(), $this->session->getId(), $currentFolder, 'phocagalleryf', 'field=' . $this->field);
?>




예제 #7
0
<?php

defined('_JEXEC') or die('Restricted access');
echo '<div id="phocagallery-javaupload">';
echo '<div style="font-size:1px;height:1px;margin:0px;padding:0px;">&nbsp;</div>';
echo '<form action="' . JURI::base() . 'index.php?option=com_phocagallery" >';
if ($this->tmpl['ftp']) {
    echo PhocaGalleryFileUpload::renderFTPaccess();
}
echo '<fieldset class="actions">' . ' <legend>';
echo JText::_('COM_PHOCAGALLERY_UPLOAD_FILE') . ' [ ' . JText::_('COM_PHOCAGALLERY_MAX_SIZE') . ':&nbsp;' . $this->tmpl['uploadmaxsizeread'] . ',' . ' ' . JText::_('COM_PHOCAGALLERY_MAX_RESOLUTION') . ':&nbsp;' . $this->tmpl['uploadmaxreswidth'] . ' x ' . $this->tmpl['uploadmaxresheight'] . ' px ]';
echo ' </legend>';
echo $this->tmpl['ju_output'] . '</fieldset>';
echo '</form>';
echo PhocaGalleryFileUpload::renderCreateFolder($this->session->getName(), $this->session->getId(), $this->currentFolder, 'phocagalleryi', 'tab=' . $this->tmpl['currenttab']['javaupload'] . '&amp;field=' . $this->field);
echo '</div>';
예제 #8
0
    }
    $label = JHtml::_('image', 'media/com_phocagallery/images/administrator/icon-16-folder.png', '') . '&nbsp;' . JText::_('COM_PHOCAGALLERY_CREATE_FOLDER');
    echo '<li><a href="#createfolder" data-toggle="tab">' . $label . '</a></li>';
    echo '</ul>';
    echo '<div class="tab-content">' . "\n";
    echo '<div class="tab-pane" id="upload">' . "\n";
    echo $this->loadTemplate('upload');
    echo '</div>' . "\n";
    echo '<div class="tab-pane" id="multipleupload">' . "\n";
    echo $this->loadTemplate('multipleupload');
    echo '</div>' . "\n";
    echo '<div class="tab-pane" id="javaupload">' . "\n";
    echo $this->loadTemplate('javaupload');
    echo '</div>' . "\n";
    echo '<div class="tab-pane" id="createfolder">' . "\n";
    echo PhocaGalleryFileUpload::renderCreateFolder($this->session->getName(), $this->session->getId(), $this->currentFolder, 'phocagalleryi', 'tab=createfolder&amp;field=' . $this->field);
    echo '</div>' . "\n";
    echo '</div>' . "\n";
}
?>



<?php 
/*
if ($this->tmpl['displaytabs'] > 0) {
	echo '<div id="phocagallery-pane">';
	//$pane =& JPane::getInstance('Tabs', array('startOffset'=> $this->tmpl['tab']));
	echo JHtml::_('tabs.start', 'config-tabs-com_phocagallery-i', array('useCookie'=>1, 'startOffset'=> $this->tmpl['tab']));
	//echo $pane->startPane( 'pane' );
예제 #9
0
    if ($this->tmpl['enablejava'] >= 0) {
        $label = JHtml::_('image', 'media/com_phocagallery/images/administrator/icon-16-upload-java.png', '') . '&nbsp;' . JText::_('COM_PHOCAGALLERY_JAVA_UPLOAD');
        echo '<li><a href="#javaupload" data-toggle="tab">' . $label . '</a></li>';
    }
    $label = JHtml::_('image', 'media/com_phocagallery/images/administrator/icon-16-folder.png', '') . '&nbsp;' . JText::_('COM_PHOCAGALLERY_CREATE_FOLDER');
    echo '<li><a href="#createfolder" data-toggle="tab">' . $label . '</a></li>';
    echo '</ul>';
    echo '<div class="tab-content">' . "\n";
    echo '<div class="tab-pane" id="upload">' . "\n";
    echo $this->loadTemplate('upload');
    echo '</div>' . "\n";
    echo '<div class="tab-pane" id="multipleupload">' . "\n";
    echo $this->loadTemplate('multipleupload');
    echo '</div>' . "\n";
    echo '<div class="tab-pane" id="javaupload">' . "\n";
    echo $this->loadTemplate('javaupload');
    echo '</div>' . "\n";
    echo '<div class="tab-pane" id="createfolder">' . "\n";
    echo PhocaGalleryFileUpload::renderCreateFolder($this->session->getName(), $this->session->getId(), $this->currentFolder, 'phocagallerym', 'tab=createfolder');
    echo '</div>' . "\n";
    echo '</div>' . "\n";
}
if ($this->tmpl['tab'] != '') {
    $jsCt = 'a[href=#' . $this->tmpl['tab'] . ']';
} else {
    $jsCt = 'a:first';
}
echo '<script type="text/javascript">';
echo '   jQuery(\'#configTabs ' . $jsCt . '\').tab(\'show\');';
// Select first tab
echo '</script>';