예제 #1
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get project id.
     $this->projectId = $this->input->getUint("pid");
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance("com_crowdfunding");
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get("logger.file");
     $tableName = $registry->get("logger.table");
     $file = JPath::clean($app->get("log_path") . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new Prism\Log\Log();
     $this->log->addWriter(new Prism\Log\Writer\Database(JFactory::getDbo(), $tableName));
     $this->log->addWriter(new Prism\Log\Writer\File($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = Joomla\String\String::trim(Joomla\String\String::strtolower($this->input->getCmd("payment_service")));
     $paymentService = $filter->clean($paymentService, "ALNUM");
     $this->context = !empty($paymentService) ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams("com_crowdfunding");
 }
예제 #2
0
 /**
  * Method to set up the document properties
  * @return void
  */
 protected function setDocument()
 {
     $this->document->setTitle($this->documentTitle);
     // Scripts
     JHtml::_('behavior.formvalidation');
     JHtml::_('behavior.tooltip');
     JHtml::_('formbehavior.chosen', 'select');
     $this->document->addScript(JURI::root() . 'media/' . $this->option . '/js/admin/' . Joomla\String\String::strtolower($this->getName()) . '.js');
 }
예제 #3
0
 /**
  * Upload file by passing it by HTML input
  *
  * @param   array   $fileInput    The file object returned by JInput
  * @param   string  $destination  The path of destination of file uploaded
  * @param   string  $type         The type of file uploaded: attachment or avatar
  *
  * @return object
  */
 public function upload($fileInput, $destination, $type = 'attachment')
 {
     $file = new stdClass();
     $file->ext = JFile::getExt($fileInput['name']);
     $file->size = $fileInput['size'];
     $file->tmp_name = $fileInput['tmp_name'];
     $file->error = $fileInput['error'];
     $file->destination = $destination . '.' . $file->ext;
     $file->success = false;
     $file->isAvatar = false;
     if ($type != 'attachment') {
         $file->isAvatar = true;
     }
     if (!is_uploaded_file($file->tmp_name)) {
         $exception = $this->checkUpload($fileInput);
         if ($exception) {
             throw $exception;
         }
     } elseif ($file->error != 0) {
         throw new RuntimeException(JText::_('COM_KUNENA_UPLOAD_ERROR_NOT_UPLOADED'), 500);
     }
     // Check if file extension matches any allowed extensions (case insensitive)
     foreach ($this->validExtensions as $ext) {
         $extension = Joomla\String\String::substr($file->tmp_name, -Joomla\String\String::strlen($ext));
         if (Joomla\String\String::strtolower($extension) == Joomla\String\String::strtolower($ext)) {
             // File must contain one letter before extension
             $name = Joomla\String\String::substr($file->tmp_name, 0, -Joomla\String\String::strlen($ext));
             $extension = Joomla\String\String::substr($extension, 1);
             if (!$name) {
                 throw new RuntimeException(JText::sprintf('COM_KUNENA_UPLOAD_ERROR_EXTENSION_FILE', implode(', ', $this->validExtensions)), 400);
             }
         }
     }
     if (!$this->checkFileSize($file->size, true)) {
         if ($file->isAvatar) {
             throw new RuntimeException(JText::_('COM_KUNENA_UPLOAD_ERROR_AVATAR_EXCEED_LIMIT_IN_CONFIGURATION'), 500);
         } else {
             throw new RuntimeException(JText::_('COM_KUNENA_UPLOAD_ERROR_FILE_EXCEED_LIMIT_IN_CONFIGURATION'), 500);
         }
     }
     if (!KunenaFile::copy($file->tmp_name, $file->destination)) {
         throw new RuntimeException(JText::_('COM_KUNENA_UPLOAD_ERROR_FILE_RIGHT_MEDIA_DIR'), 500);
     }
     unlink($file->tmp_name);
     KunenaPath::setPermissions($file->destination);
     $file->success = true;
     return $file;
 }
예제 #4
0
 /**
  * Method to set up the document properties
  *
  * @return void
  */
 protected function setDocument()
 {
     $this->document->setTitle($this->documentTitle);
     // Add scripts
     JHtml::_('behavior.keepalive');
     JHtml::_('behavior.formvalidation');
     JHtml::_('formbehavior.chosen', 'select');
     JHtml::_('bootstrap.tooltip');
     JHtml::_('prism.ui.bootstrap2FileInput');
     JHtml::_('prism.ui.bootstrap2Typeahead');
     JHtml::_("prism.ui.joomlaHelper");
     $this->document->addScript('../media/' . $this->option . '/js/admin/' . Joomla\String\String::strtolower($this->getName()) . '.js');
 }
예제 #5
0
 public function dovoid()
 {
     // Get component parameters
     $params = JComponentHelper::getParams("com_crowdfunding");
     /** @var $params Joomla\Registry\Registry */
     // Check for disabled payment functionality
     if ($params->get("debug_payment_disabled", 0)) {
         throw new Exception(JText::_($this->text_prefix . "_ERROR_PAYMENT_HAS_BEEN_DISABLED_MESSAGE"));
     }
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     $cid = $this->input->get("cid", array(), "array");
     JArrayHelper::toInteger($cid);
     $messages = array();
     try {
         if (!empty($cid)) {
             $options = array("ids" => $cid, "txn_status" => "pending");
             $items = new Crowdfunding\Transactions(JFactory::getDbo());
             $items->load($options);
             if (count($items) == 0) {
                 throw new UnexpectedValueException(JText::_($this->text_prefix . "_ERROR_INVALID_TRANSACTIONS"));
             }
             // Import Crowdfunding Payment Plugins
             $dispatcher = JEventDispatcher::getInstance();
             JPluginHelper::importPlugin('crowdfundingpayment');
             foreach ($items as $item) {
                 $context = $this->option . '.payments.void.' . Joomla\String\String::strtolower(str_replace(" ", "", $item->service_provider));
                 // Trigger onContentPreparePayment event.
                 $results = $dispatcher->trigger("onPaymentsVoid", array($context, &$item, &$params));
                 foreach ($results as $message) {
                     if (!is_null($message) and is_array($message)) {
                         $messages[] = $message;
                     }
                 }
             }
         }
     } catch (UnexpectedValueException $e) {
         $this->setMessage($e->getMessage(), "notice");
         $this->setRedirect(JRoute::_("index.php?option=" . $this->option . "&view=transactions", false));
         return;
     } catch (Exception $e) {
         // Store log data in the database
         $this->log->add(JText::_($this->text_prefix . "_ERROR_SYSTEM"), "CONTROLLER_PAYMENTS_DOCAPTURE_ERROR", $e->getMessage());
         throw new Exception(JText::_($this->text_prefix . "_ERROR_SYSTEM"));
     }
     // Set messages.
     if (!empty($messages)) {
         foreach ($messages as $message) {
             $app->enqueueMessage($message["text"], $message["type"]);
         }
     }
     $this->setRedirect(JRoute::_("index.php?option=" . $this->option . "&view=transactions", false));
 }
예제 #6
0
 /**
  * @param $alias
  *
  * @return array
  */
 public static function resolveAlias($alias)
 {
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     $db = JFactory::getDbo();
     $query = "SELECT * FROM #__kunena_aliases WHERE alias LIKE {$db->Quote($alias . '%')}";
     $db->setQuery($query);
     $aliases = $db->loadObjectList();
     $vars = array();
     foreach ($aliases as $object) {
         if (Joomla\String\String::strtolower($alias) == Joomla\String\String::strtolower($object->alias)) {
             $var = $object->type != 'legacy' ? $object->type : 'view';
             $vars[$var] = $object->type != 'layout' ? $object->item : preg_replace('/.*\\./', '', $object->item);
             if ($var == 'catid') {
                 $vars['view'] = 'category';
             }
             break;
         }
     }
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
     return $vars;
 }
예제 #7
0
 /**
  * Validate PayPal transaction
  *
  * @param array  $data
  * @param string $currency
  * @param Crowdfunding\Payment\Session  $paymentSession
  *
  * @return array|null
  */
 protected function validateData($data, $currency, $paymentSession)
 {
     $txnDate = Joomla\Utilities\ArrayHelper::getValue($data, "payment_date");
     $date = new JDate($txnDate);
     // Get additional information from transaction.
     $extraData = $this->prepareExtraData($data);
     // Prepare transaction data
     $transaction = array("investor_id" => (int) $paymentSession->getUserId(), "project_id" => (int) $paymentSession->getProjectId(), "reward_id" => $paymentSession->isAnonymous() ? 0 : (int) $paymentSession->getRewardId(), "service_provider" => "PayPal", "txn_id" => Joomla\Utilities\ArrayHelper::getValue($data, "txn_id", "", "string"), "parent_txn_id" => Joomla\Utilities\ArrayHelper::getValue($data, "parent_txn_id", "", "string"), "txn_amount" => Joomla\Utilities\ArrayHelper::getValue($data, "mc_gross", 0, "float"), "txn_currency" => Joomla\Utilities\ArrayHelper::getValue($data, "mc_currency", "", "string"), "txn_status" => Joomla\String\String::strtolower(Joomla\Utilities\ArrayHelper::getValue($data, "payment_status", "", "string")), "txn_date" => $date->toSql(), "status_reason" => $this->getStatusReason($data), "extra_data" => $extraData);
     // Check Project ID and Transaction ID
     if (!$transaction["project_id"] or !$transaction["txn_id"]) {
         // Log data in the database
         $this->log->add(JText::_($this->textPrefix . "_ERROR_INVALID_TRANSACTION_DATA"), $this->debugType, $transaction);
         return null;
     }
     // Check currency
     if (strcmp($transaction["txn_currency"], $currency) != 0) {
         // Log data in the database
         $this->log->add(JText::_($this->textPrefix . "_ERROR_INVALID_TRANSACTION_CURRENCY"), $this->debugType, array("TRANSACTION DATA" => $transaction, "CURRENCY" => $currency));
         return null;
     }
     // Check receiver
     $allowedReceivers = array(Joomla\String\String::strtolower(Joomla\Utilities\ArrayHelper::getValue($data, "business")), Joomla\String\String::strtolower(Joomla\Utilities\ArrayHelper::getValue($data, "receiver_email")), Joomla\String\String::strtolower(Joomla\Utilities\ArrayHelper::getValue($data, "receiver_id")));
     if ($this->params->get("paypal_sandbox", 1)) {
         $receiver = Joomla\String\String::strtolower(Joomla\String\String::trim($this->params->get("paypal_sandbox_business_name")));
     } else {
         $receiver = Joomla\String\String::strtolower(Joomla\String\String::trim($this->params->get("paypal_business_name")));
     }
     if (!in_array($receiver, $allowedReceivers)) {
         // Log data in the database
         $this->log->add(JText::_($this->textPrefix . "_ERROR_INVALID_RECEIVER"), $this->debugType, array("TRANSACTION DATA" => $data, "RECEIVER" => $receiver, "RECEIVER DATA" => $allowedReceivers));
         return null;
     }
     return $transaction;
 }
예제 #8
0
 /**
  * This method trigger the event onPaymentsPreparePayment.
  * The purpose of this method is to load a data and send it to browser.
  * That data will be used in the process of payment.
  */
 public function preparePaymentAjax()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get component parameters
     $params = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $params Joomla\Registry\Registry */
     $response = new Prism\Response\Json();
     // Check for disabled payment functionality
     if ($params->get("debug_payment_disabled", 0)) {
         // Send response to the browser
         $response->setTitle(JText::_("COM_CROWDFUNDING_FAIL"))->setText(JText::_("COM_CROWDFUNDING_ERROR_PAYMENT_HAS_BEEN_DISABLED_MESSAGE"))->failure();
         echo $response;
         JFactory::getApplication()->close();
     }
     $output = array();
     // Prepare payment service name.
     $filter = new JFilterInput();
     $paymentService = Joomla\String\String::trim(Joomla\String\String::strtolower($this->input->getCmd("payment_service")));
     $paymentService = $filter->clean($paymentService, "ALNUM");
     // Trigger the event
     try {
         $context = 'com_crowdfunding.preparepayment.' . $paymentService;
         // Import Crowdfunding Payment Plugins
         $dispatcher = JEventDispatcher::getInstance();
         JPluginHelper::importPlugin('crowdfundingpayment');
         // Trigger onContentPreparePayment event.
         $results = $dispatcher->trigger("onPaymentsPreparePayment", array($context, &$params));
         // Get the result, that comes from the plugin.
         if (!empty($results)) {
             foreach ($results as $result) {
                 if (!is_null($result) and is_array($result)) {
                     $output =& $result;
                     break;
                 }
             }
         }
     } catch (Exception $e) {
         // Store log data in the database
         JLog::add($e->getMessage());
         // Send response to the browser
         $response->failure()->setTitle(JText::_("COM_CROWDFUNDING_FAIL"))->setText(JText::_("COM_CROWDFUNDING_ERROR_SYSTEM"));
         echo $response;
         JFactory::getApplication()->close();
     }
     // Check the response
     $success = Joomla\Utilities\ArrayHelper::getValue($output, "success");
     if (!$success) {
         // If there is an error...
         // Get project id.
         $projectId = $this->input->getUint("pid");
         $paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $projectId;
         // Initialize the payment process object.
         $paymentProcess = new JData();
         $paymentProcess->step1 = false;
         $app->setUserState($paymentProcessContext, $paymentProcess);
         // Send response to the browser
         $response->failure()->setTitle(Joomla\Utilities\ArrayHelper::getValue($output, "title"))->setText(Joomla\Utilities\ArrayHelper::getValue($output, "text"));
     } else {
         // If all is OK...
         // Send response to the browser
         $response->success()->setTitle(Joomla\Utilities\ArrayHelper::getValue($output, "title"))->setText(Joomla\Utilities\ArrayHelper::getValue($output, "text"))->setData(Joomla\Utilities\ArrayHelper::getValue($output, "data"));
     }
     echo $response;
     JFactory::getApplication()->close();
 }
예제 #9
0
?>
: <input name="modal-video-width" id="modal-video-width" type="text" maxlength="5" size="5" value="" />
		<?php 
echo JText::_('COM_KUNENA_EDITOR_MODAL_TITLE_LINK_SETTINGS_HEIGHT');
?>
: <input name="modal-video-height" id="modal-video-height" type="text" maxlength="5" size="5" value="" />
		<?php 
echo JText::_('COM_KUNENA_EDITOR_VIDEO_PROVIDER');
?>
		<select id="kvideoprovider-list-modal"
			name="provider" class="kbutton">
			<?php 
$vid_provider = array('', 'Bofunk', 'Break', 'Clipfish', 'DivX,divx]http://', 'Flash,flash]http://', 'FlashVars,flashvars param=]http://', 'MediaPlayer,mediaplayer]http://', 'Metacafe', 'MySpace', 'QuickTime,quicktime]http://', 'RealPlayer,realplayer]http://', 'RuTube', 'Sapo', 'Streetfire', 'Veoh', 'Videojug', 'Vimeo', 'Wideo.fr', 'YouTube');
foreach ($vid_provider as $vid_type) {
    $vid_type = explode(',', $vid_type);
    echo '<option value = "' . (!empty($vid_type[1]) ? $this->escape($vid_type[1]) : Joomla\String\String::strtolower($this->escape($vid_type[0])) . '') . '">' . $this->escape($vid_type[0]) . '</option>';
}
?>
		</select>
		<?php 
echo JText::_('COM_KUNENA_EDITOR_MODAL_TITLE_LINK_SETTINGS_ID');
?>
: <input name="modal-video-id" id="modal-video-id" type="text" maxlength="30" size="11" value="" /></p>
	</div>
	<div class="modal-footer">
		<button id="videosettings-modal-submit" class="btn btn-primary"><?php 
echo JText::_('COM_KUNENA_EDITOR_MODAL_ADD_LABEL');
?>
</button>
		<button class="btn" data-dismiss="modal" aria-hidden="true"><?php 
echo JText::_('COM_KUNENA_EDITOR_MODAL_CLOSE_LABEL');
예제 #10
0
파일: paypal.php 프로젝트: pashakiz/crowdf
 /**
  * Return payment receiver.
  *
  * @param $paymentReceiverOption
  * @param $itemId
  *
  * @return null|string
  */
 protected function getPaymentReceiver($paymentReceiverOption, $itemId)
 {
     if ($this->params->get('paypal_sandbox', 1)) {
         return Joomla\String\String::strtolower(Joomla\String\String::trim($this->params->get('paypal_sandbox_business_name')));
     } else {
         if (strcmp("site_owner", $paymentReceiverOption) == 0) {
             // Site owner
             return Joomla\String\String::strtolower(Joomla\String\String::trim($this->params->get('paypal_business_name')));
         } else {
             if (!JComponentHelper::isEnabled("com_crowdfundingfinance")) {
                 return null;
             } else {
                 $payout = new CrowdfundingFinance\Payout(JFactory::getDbo());
                 $payout->load($itemId);
                 if (!$payout->getPaypalEmail()) {
                     return null;
                 }
                 return Joomla\String\String::strtolower(Joomla\String\String::trim($payout->getPaypalEmail()));
             }
         }
     }
 }
예제 #11
0
 /**
  * @param   string	$alias
  *
  * @return boolean
  */
 public function deleteAlias($alias)
 {
     // Do not delete valid alias.
     if (Joomla\String\String::strtolower($this->alias) == Joomla\String\String::strtolower($alias)) {
         return false;
     }
     $db = JFactory::getDbo();
     $query = "DELETE FROM #__kunena_aliases WHERE type='catid' AND item={$db->Quote($this->id)} AND alias={$db->Quote($alias)}";
     $db->setQuery($query);
     $db->execute();
     KunenaError::checkDatabaseError();
     return (bool) $db->getAffectedRows();
 }
예제 #12
0
 /**
  * Method to set up the document properties
  *
  * @return void
  */
 protected function setDocument()
 {
     $this->document->setTitle(JText::_('COM_CROWDFUNDING_IMPORT_MANAGER'));
     // Scripts
     JHtml::_('behavior.formvalidation');
     JHtml::_('bootstrap.tooltip');
     JHtml::_('prism.ui.bootstrap2FileInput');
     $this->document->addScript('../media/' . $this->option . '/js/admin/' . Joomla\String\String::strtolower($this->getName()) . '.js');
 }
예제 #13
0
파일: reward.php 프로젝트: pashakiz/crowdf
 /**
  * Upload an image.
  *
  * @param  array $image
  * @param  string $destFolder
  *
  * @throws RuntimeException
  *
  * @return array
  */
 public function uploadImage($image, $destFolder)
 {
     // Load parameters.
     $params = JComponentHelper::getParams($this->option);
     /** @var  $params Joomla\Registry\Registry */
     // Joomla! media extension parameters
     $mediaParams = JComponentHelper::getParams("com_media");
     /** @var  $mediaParams Joomla\Registry\Registry */
     $names = array("image" => "", "thumb" => "", "square" => "");
     $KB = 1024 * 1024;
     $uploadMaxSize = $mediaParams->get("upload_maxsize") * $KB;
     $mimeTypes = explode(",", $mediaParams->get("upload_mime"));
     $imageExtensions = explode(",", $mediaParams->get("image_extensions"));
     $uploadedFile = JArrayHelper::getValue($image, 'tmp_name');
     $uploadedName = Joomla\String\String::trim(JArrayHelper::getValue($image, 'name'));
     $errorCode = JArrayHelper::getValue($image, 'error');
     $file = new Prism\File\Image();
     if (!empty($uploadedName)) {
         // Prepare size validator.
         $fileSize = (int) JArrayHelper::getValue($image, 'size');
         // Prepare file size validator.
         $sizeValidator = new Prism\File\Validator\Size($fileSize, $uploadMaxSize);
         // Prepare server validator.
         $serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE));
         // Prepare image validator.
         $imageValidator = new Prism\File\Validator\Image($uploadedFile, $uploadedName);
         // Get allowed mime types from media manager options
         $imageValidator->setMimeTypes($mimeTypes);
         // Get allowed image extensions from media manager options
         $imageValidator->setImageExtensions($imageExtensions);
         $file->addValidator($sizeValidator)->addValidator($imageValidator)->addValidator($serverValidator);
         // Validate the file
         if (!$file->isValid()) {
             throw new RuntimeException($file->getError());
         }
         // Generate temporary file name
         $ext = Joomla\String\String::strtolower(JFile::makeSafe(JFile::getExt($image['name'])));
         $generatedName = new Prism\String();
         $generatedName->generateRandomString(12, "reward_");
         $destFile = JPath::clean($destFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext);
         // Prepare uploader object.
         $uploader = new Prism\File\Uploader\Local($uploadedFile);
         $uploader->setDestination($destFile);
         // Upload temporary file
         $file->setUploader($uploader);
         $file->upload();
         // Get file
         $imageSource = $file->getFile();
         if (!is_file($imageSource)) {
             throw new RuntimeException(JText::_("COM_CROWDFUNDING_ERROR_FILE_CANT_BE_UPLOADED"));
         }
         // Generate thumbnails.
         // Create thumbnail.
         $generatedName->generateRandomString(12, "reward_thumb_");
         $options = array("width" => $params->get("rewards_image_thumb_width", 200), "height" => $params->get("rewards_image_thumb_height", 200), "destination" => JPath::clean($destFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext));
         $thumbSource = $file->createThumbnail($options);
         // Create square image.
         $generatedName->generateRandomString(12, "reward_square_");
         $options = array("width" => $params->get("rewards_image_square_width", 50), "height" => $params->get("rewards_image_square_height", 50), "destination" => JPath::clean($destFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext));
         $squareSource = $file->createThumbnail($options);
         $names['image'] = basename($imageSource);
         $names["thumb"] = basename($thumbSource);
         $names["square"] = basename($squareSource);
     }
     return $names;
 }
예제 #14
0
 /**
  * Store the file in a folder of the extension.
  *
  * @param array $image
  *
  * @return string
  */
 public function uploadImage($image)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $uploadedFile = Joomla\Utilities\ArrayHelper::getValue($image, 'tmp_name');
     $uploadedName = Joomla\Utilities\ArrayHelper::getValue($image, 'name');
     $errorCode = Joomla\Utilities\ArrayHelper::getValue($image, 'error');
     $params = JComponentHelper::getParams($this->option);
     /** @var  $params Joomla\Registry\Registry */
     $destinationFolder = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $params->get("images_directory", "images/gamification"));
     // Joomla! media extension parameters
     $mediaParams = JComponentHelper::getParams("com_media");
     /** @var $mediaParams Joomla\Registry\Registry */
     $file = new Prism\File\File();
     // Prepare size validator.
     $KB = 1024 * 1024;
     $fileSize = (int) $app->input->server->get('CONTENT_LENGTH');
     $uploadMaxSize = $mediaParams->get("upload_maxsize") * $KB;
     // Prepare file validators.
     $sizeValidator = new Prism\File\Validator\Size($fileSize, $uploadMaxSize);
     $serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE));
     $imageValidator = new Prism\File\Validator\Image($uploadedFile, $uploadedName);
     // Get allowed mime types from media manager options
     $mimeTypes = explode(",", $mediaParams->get("upload_mime"));
     $imageValidator->setMimeTypes($mimeTypes);
     // Get allowed image extensions from media manager options
     $imageExtensions = explode(",", $mediaParams->get("image_extensions"));
     $imageValidator->setImageExtensions($imageExtensions);
     $file->addValidator($sizeValidator)->addValidator($serverValidator)->addValidator($imageValidator);
     // Validate the file
     if (!$file->isValid()) {
         throw new RuntimeException($file->getError());
     }
     // Generate temporary file name
     $ext = Joomla\String\String::strtolower(JFile::makeSafe(JFile::getExt($image['name'])));
     $generatedName = new Prism\String();
     $generatedName->generateRandomString(16);
     $imageName = $generatedName . "_badge." . $ext;
     $destination = JPath::clean($destinationFolder . DIRECTORY_SEPARATOR . $imageName);
     // Prepare uploader object.
     $uploader = new Prism\File\Uploader\Local($uploadedFile);
     $uploader->setDestination($destination);
     // Upload temporary file
     $file->setUploader($uploader);
     $file->upload();
     $source = $file->getFile();
     return basename($source);
 }
예제 #15
0
 /**
  * Method to set up the document properties
  *
  * @return void
  */
 protected function setDocument()
 {
     $this->document->setTitle($this->documentTitle);
     $layout = $this->getLayout();
     // Scripts
     JHtml::_('jquery.framework');
     JHtml::_('bootstrap.tooltip');
     switch ($layout) {
         case "files":
             // HTML Helpers
             JHtml::_('prism.ui.pnotify');
             JHtml::_("prism.ui.joomlaHelper");
             // Load language string in JavaScript
             JText::script('COM_CROWDFUNDING_DELETE_FILE_QUESTION');
             break;
     }
     $this->document->addScript('../media/' . $this->option . '/js/admin/' . Joomla\String\String::strtolower($this->getName()) . '.js');
 }
예제 #16
0
파일: rewards.php 프로젝트: pashakiz/crowdf
 /**
  * Upload images.
  *
  * @param  array $files
  * @param  string $destFolder
  * @param  array $rewardsIds
  *
  * @return array
  */
 public function uploadImages($files, $destFolder, $rewardsIds)
 {
     // Load parameters.
     $params = JComponentHelper::getParams($this->option);
     /** @var  $params Joomla\Registry\Registry */
     // Joomla! media extension parameters
     $mediaParams = JComponentHelper::getParams("com_media");
     /** @var  $mediaParams Joomla\Registry\Registry */
     $KB = 1024 * 1024;
     $uploadMaxSize = $mediaParams->get("upload_maxsize") * $KB;
     $mimeTypes = explode(",", $mediaParams->get("upload_mime"));
     $imageExtensions = explode(",", $mediaParams->get("image_extensions"));
     $images = array();
     foreach ($files as $rewardId => $image) {
         // If the image is set to not valid reward, continue to next one.
         // It is impossible to store image to missed reward.
         if (!in_array($rewardId, $rewardsIds)) {
             continue;
         }
         $uploadedFile = Joomla\Utilities\ArrayHelper::getValue($image, 'tmp_name');
         $uploadedName = Joomla\String\String::trim(Joomla\Utilities\ArrayHelper::getValue($image, 'name'));
         $errorCode = Joomla\Utilities\ArrayHelper::getValue($image, 'error');
         $file = new Prism\File\Image();
         if (!empty($uploadedName)) {
             // Prepare size validator.
             $fileSize = (int) Joomla\Utilities\ArrayHelper::getValue($image, 'size');
             // Prepare file size validator.
             $sizeValidator = new Prism\File\Validator\Size($fileSize, $uploadMaxSize);
             // Prepare server validator.
             $serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE));
             // Prepare image validator.
             $imageValidator = new Prism\File\Validator\Image($uploadedFile, $uploadedName);
             // Get allowed mime types from media manager options
             $imageValidator->setMimeTypes($mimeTypes);
             // Get allowed image extensions from media manager options
             $imageValidator->setImageExtensions($imageExtensions);
             $file->addValidator($sizeValidator)->addValidator($imageValidator)->addValidator($serverValidator);
             // Validate the file
             if (!$file->isValid()) {
                 continue;
             }
             // Generate temporary file name
             $ext = Joomla\String\String::strtolower(JFile::makeSafe(JFile::getExt($image['name'])));
             $generatedName = new Prism\String();
             $generatedName->generateRandomString(12, "reward_");
             $destFile = JPath::clean($destFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext);
             // Prepare uploader object.
             $uploader = new Prism\File\Uploader\Local($uploadedFile);
             $uploader->setDestination($destFile);
             // Upload temporary file
             $file->setUploader($uploader);
             $file->upload();
             // Get file
             $imageSource = $file->getFile();
             if (!is_file($imageSource)) {
                 continue;
             }
             // Generate thumbnails.
             // Create thumbnail.
             $generatedName->generateRandomString(12, "reward_thumb_");
             $options = array("width" => $params->get("rewards_image_thumb_width", 200), "height" => $params->get("rewards_image_thumb_height", 200), "scale" => $params->get("image_resizing_scale", JImage::SCALE_INSIDE), "destination" => JPath::clean($destFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext));
             $thumbSource = $file->createThumbnail($options);
             // Create square image.
             $generatedName->generateRandomString(12, "reward_square_");
             $options = array("width" => $params->get("rewards_image_square_width", 50), "height" => $params->get("rewards_image_square_height", 50), "scale" => $params->get("image_resizing_scale", JImage::SCALE_INSIDE), "destination" => JPath::clean($destFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext));
             $squareSource = $file->createThumbnail($options);
             $names = array("image" => "", "thumb" => "", "square" => "");
             $names['image'] = basename($imageSource);
             $names["thumb"] = basename($thumbSource);
             $names["square"] = basename($squareSource);
             $images[$rewardId] = $names;
         }
     }
     return $images;
 }
예제 #17
0
파일: project.php 프로젝트: pashakiz/crowdf
 /**
  * Upload a pitch image.
  *
  * @param  array $image
  *
  * @throws Exception
  *
  * @return array
  */
 public function uploadPitchImage($image)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $uploadedFile = Joomla\Utilities\ArrayHelper::getValue($image, 'tmp_name');
     $uploadedName = Joomla\Utilities\ArrayHelper::getValue($image, 'name');
     $errorCode = Joomla\Utilities\ArrayHelper::getValue($image, 'error');
     // Load parameters.
     $params = JComponentHelper::getParams($this->option);
     /** @var  $params Joomla\Registry\Registry */
     $destFolder = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $params->get("images_directory", "images/crowdfunding"));
     $tmpFolder = $app->get("tmp_path");
     // Joomla! media extension parameters
     $mediaParams = JComponentHelper::getParams("com_media");
     /** @var  $mediaParams Joomla\Registry\Registry */
     $file = new Prism\File\File();
     // Prepare size validator.
     $KB = 1024 * 1024;
     $fileSize = (int) $app->input->server->get('CONTENT_LENGTH');
     $uploadMaxSize = $mediaParams->get("upload_maxsize") * $KB;
     $sizeValidator = new Prism\File\Validator\Size($fileSize, $uploadMaxSize);
     // Prepare server validator.
     $serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE));
     // Prepare image validator.
     $imageValidator = new Prism\File\Validator\Image($uploadedFile, $uploadedName);
     // Get allowed mime types from media manager options
     $mimeTypes = explode(",", $mediaParams->get("upload_mime"));
     $imageValidator->setMimeTypes($mimeTypes);
     // Get allowed image extensions from media manager options
     $imageExtensions = explode(",", $mediaParams->get("image_extensions"));
     $imageValidator->setImageExtensions($imageExtensions);
     $file->addValidator($sizeValidator)->addValidator($imageValidator)->addValidator($serverValidator);
     // Validate the file
     if (!$file->isValid()) {
         throw new RuntimeException($file->getError());
     }
     // Generate temporary file name
     $ext = Joomla\String\String::strtolower(JFile::makeSafe(JFile::getExt($image['name'])));
     $generatedName = new Prism\String();
     $generatedName->generateRandomString(32);
     $tmpDestFile = $tmpFolder . DIRECTORY_SEPARATOR . $generatedName . "." . $ext;
     // Prepare uploader object.
     $uploader = new Prism\File\Uploader\Local($uploadedFile);
     $uploader->setDestination($tmpDestFile);
     // Upload temporary file
     $file->setUploader($uploader);
     $file->upload();
     // Get file
     $tmpDestFile = $file->getFile();
     if (!is_file($tmpDestFile)) {
         throw new Exception('COM_CROWDFUNDING_ERROR_FILE_CANT_BE_UPLOADED');
     }
     // Resize image
     $image = new JImage();
     $image->loadFile($tmpDestFile);
     if (!$image->isLoaded()) {
         throw new Exception(JText::sprintf('COM_CROWDFUNDING_ERROR_FILE_NOT_FOUND', $tmpDestFile));
     }
     $imageName = $generatedName . "_pimage.png";
     $imageFile = JPath::clean($destFolder . DIRECTORY_SEPARATOR . $imageName);
     // Create main image
     $width = $params->get("pitch_image_width", 600);
     $height = $params->get("pitch_image_height", 400);
     $image->resize($width, $height, false);
     $image->toFile($imageFile, IMAGETYPE_PNG);
     // Remove the temporary
     if (is_file($tmpDestFile)) {
         JFile::delete($tmpDestFile);
     }
     return $imageName;
 }
예제 #18
0
 /**
  * Method to set up the document properties.
  *
  * @return void
  */
 protected function setDocument()
 {
     $this->document->setTitle(JText::_('COM_CROWDFUNDING_REPORTS_MANAGER'));
     // Scripts
     JHtml::_('behavior.multiselect');
     JHtml::_('bootstrap.tooltip');
     JHtml::_('formbehavior.chosen', 'select');
     JHtml::_('prism.ui.joomlaList');
     $this->document->addScript('../media/' . $this->option . '/js/admin/' . Joomla\String\String::strtolower($this->getName()) . '.js');
 }
예제 #19
0
 /**
  * Invoke the plugin method onPaymentsCompleteCheckout.
  *
  * @throws UnexpectedValueException
  * @throws Exception
  */
 public function completeCheckout()
 {
     // Get component parameters
     $params = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $params Joomla\Registry\Registry */
     // Check for disabled payment functionality
     if ($params->get("debug_payment_disabled", 0)) {
         throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_PAYMENT_HAS_BEEN_DISABLED_MESSAGE"));
     }
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $output = array();
     // Get payment gateway name.
     $paymentService = $this->input->get("payment_service");
     if (!$paymentService) {
         throw new UnexpectedValueException(JText::_("COM_CROWDFUNDING_ERROR_INVALID_PAYMENT_GATEWAY"));
     }
     // Set the name of the payment service to session.
     $this->paymentProcess->paymentService = $paymentService;
     // Trigger the event
     try {
         $context = 'com_crowdfunding.payments.completeCheckout.' . Joomla\String\String::strtolower($paymentService);
         // Import Crowdfunding Payment Plugins
         $dispatcher = JEventDispatcher::getInstance();
         JPluginHelper::importPlugin('crowdfundingpayment');
         // Trigger onContentPreparePayment event.
         $results = $dispatcher->trigger("onPaymentsCompleteCheckout", array($context, &$params));
         // Get the result, that comes from the plugin.
         if (!empty($results)) {
             foreach ($results as $result) {
                 if (!is_null($result) and is_array($result)) {
                     $output =& $result;
                     break;
                 }
             }
         }
     } catch (UnexpectedValueException $e) {
         $this->setMessage($e->getMessage(), "notice");
         $this->setRedirect(JRoute::_(CrowdfundingHelperRoute::getDiscoverRoute(), false));
         return;
     } catch (Exception $e) {
         // Store log data in the database
         $this->log->add(JText::_("COM_CROWDFUNDING_ERROR_SYSTEM"), "CONTROLLER_PAYMENTS_CHECKOUT_ERROR", $e->getMessage());
         throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_SYSTEM"));
     }
     $redirectUrl = Joomla\Utilities\ArrayHelper::getValue($output, "redirect_url");
     $message = Joomla\Utilities\ArrayHelper::getValue($output, "message");
     if (!$redirectUrl) {
         throw new UnexpectedValueException(JText::_("COM_CROWDFUNDING_ERROR_INVALID_REDIRECT_URL"));
     }
     // Store the payment process data into the session.
     $app->setUserState($this->paymentProcessContext, $this->paymentProcess);
     if (!$message) {
         $this->setRedirect($redirectUrl);
     } else {
         $this->setRedirect($redirectUrl, $message, "notice");
     }
 }
예제 #20
0
파일: import.php 프로젝트: pashakiz/crowdf
 /**
  * Import locations from TXT or XML file.
  * The TXT file comes from geodata.org
  * The XML file is generated by the current extension ( Crowdfunding )
  *
  * @param string $file    A path to file
  * @param bool   $resetId Reset existing IDs with new ones.
  * @param int   $minPopulation Reset existing IDs with new ones.
  */
 public function importLocations($file, $resetId = false, $minPopulation = 0)
 {
     $ext = Joomla\String\String::strtolower(JFile::getExt($file));
     switch ($ext) {
         case "xml":
             $this->importLocationsXml($file, $resetId);
             break;
         default:
             // TXT
             $this->importLocationsTxt($file, $resetId, $minPopulation);
             break;
     }
 }
예제 #21
0
 /**
  * @param KunenaBBCode $bbcode
  * @param $action
  * @param $name
  * @param $default
  * @param $params
  * @param $content
  * @return bool|string
  */
 function DoVideo($bbcode, $action, $name, $default, $params, $content)
 {
     if ($action == BBCODE_CHECK) {
         $bbcode->autolink_disable++;
         return true;
     }
     $config = KunenaFactory::getTemplate()->params;
     if (!$content || KunenaFactory::getTemplate()->isHmvc() && !$config->get('video')) {
         return '';
     }
     // Display tag in activity streams etc..
     if (!empty($bbcode->parent->forceMinimal)) {
         return '[video]';
     }
     $vid_minwidth = 200;
     $vid_minheight = 44;
     // min. display size
     $vid_maxwidth = (int) (KunenaFactory::getConfig()->rtewidth * 9 / 10);
     // Max 90% of text width
     $vid_maxheight = 720;
     // max. display size
     $vid_sizemax = 100;
     // max. display zoom in percent
     $vid["type"] = isset($params["type"]) ? Joomla\String\String::strtolower($params["type"]) : '';
     $vid["param"] = isset($params["param"]) ? $params["param"] : '';
     if (!$vid["type"]) {
         $vid_players = array('divx' => 'divx', 'flash' => 'swf', 'mediaplayer' => 'avi,mp3,wma,wmv', 'quicktime' => 'mov,qt,qti,qtif,qtvr', 'realplayer', 'rm');
         foreach ($vid_players as $vid_player => $vid_exts) {
             foreach (explode(',', $vid_exts) as $vid_ext) {
                 if (preg_match('/^(.*\\.' . $vid_ext . ')$/i', $content) > 0) {
                     $vid["type"] = $vid_player;
                     break 2;
                 }
             }
         }
         unset($vid_players);
     }
     if (!$vid["type"]) {
         $vid_auto = preg_match('#^https?://.*?([^.]*)\\.[^.]*(/|$)#u', $content, $vid_regs);
         if ($vid_auto) {
             $vid["type"] = Joomla\String\String::strtolower($vid_regs[1]);
             switch ($vid["type"]) {
                 case 'wideo':
                     $vid["type"] = 'wideo.fr';
                     break;
             }
         }
     }
     $vid_providers = array('bofunk' => array('flash', 446, 370, 0, 0, 'http://www.bofunk.com/e/%vcode%', '', ''), 'break' => array('flash', 464, 392, 0, 0, 'http://embed.break.com/%vcode%', '', ''), 'clipfish' => array('flash', 464, 380, 0, 0, 'http://www.clipfish.de/videoplayer.swf?as=0&videoid=%vcode%&r=1&c=0067B3', 'videoid=([\\w\\-]*)', ''), 'dailymotion' => array('flash', 464, 380, 0, 0, 'http://www.dailymotion.com/swf/video/%vcode%?autoPlay=0', '\\/([\\w]*)_', array(array(6, 'wmode', 'transparent'))), 'metacafe' => array('flash', 400, 345, 0, 0, 'http://www.metacafe.com/fplayer/%vcode%/.swf', '\\/watch\\/(\\d*\\/[\\w\\-]*)', array(array(6, 'wmode', 'transparent'))), 'myspace' => array('flash', 430, 346, 0, 0, 'http://lads.myspace.com/videos/vplayer.swf', 'VideoID=(\\d*)', array(array(6, 'flashvars', 'm=%vcode%&v=2&type=video'))), 'rutube' => array('flash', 400, 353, 0, 0, 'http://video.rutube.ru/%vcode%', '\\.html\\?v=([\\w]*)'), 'sapo' => array('flash', 400, 322, 0, 0, 'http://rd3.videos.sapo.pt/play?file=http://rd3.videos.sapo.pt/%vcode%/mov/1', 'videos\\.sapo\\.pt\\/([\\w]*)', array(array(6, 'wmode', 'transparent'))), 'streetfire' => array('flash', 428, 352, 0, 0, 'http://videos.streetfire.net/vidiac.swf', '\\/([\\w-]*).htm', array(array(6, 'flashvars', 'video=%vcode%'))), 'veoh' => array('flash', 540, 438, 0, 0, 'http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=%vcode%', '\\/videos\\/([\\w-]*)', ''), 'videojug' => array('flash', 400, 345, 0, 0, 'http://www.videojug.com/film/player?id=%vcode%', '', ''), 'vimeo' => array('flash', 400, 321, 0, 0, 'http://www.vimeo.com/moogaloop.swf?clip_id=%vcode%&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=', '\\.com\\/(\\d*)', ''), 'wideo.fr' => array('flash', 400, 368, 0, 0, 'http://www.wideo.fr/p/fr/%vcode%.html', '\\/([\\w-]*).html', array(array(6, 'wmode', 'transparent'))), 'youtube' => array('iframe', 425, 355, 0, 0, 'http://www.youtube.com/embed/%vcode%', '\\/watch\\?v=([\\w\\-]*)', array(array(6, 'wmode', 'transparent'))), 'youku' => array('flash', 425, 355, 0, 0, 'http://player.youku.com/player.php/Type/Folder/Fid/18787874/Ob/1/sid/%vcode%/v.swf', '\\/watch\\?v=([\\w\\-]*)', array(array(6, 'wmode', 'transparent'))));
     if (isset($vid_providers[$vid["type"]])) {
         list($vid_type, $vid_width, $vid_height, $vid_addx, $vid_addy, $vid_source, $vid_match, $vid_par2) = isset($vid_providers[$vid["type"]]) ? $vid_providers[$vid["type"]] : $vid_providers["_default"];
     } else {
         return;
     }
     unset($vid_providers);
     if (!empty($vid_auto)) {
         if ($vid_match and preg_match("/{$vid_match}/i", $content, $vid_regs) > 0) {
             $content = $vid_regs[1];
         } else {
             return;
         }
     }
     $uri = JURI::getInstance();
     if ($uri->isSSL() && $vid["type"] == 'youtube') {
         $vid_source = preg_replace("/^http:/", "https:", $vid_source);
     }
     $vid_source = preg_replace('/%vcode%/', $content, $vid_source);
     if (!is_array($vid_par2)) {
         $vid_par2 = array();
     }
     $vid_size = isset($params["size"]) ? intval($params["size"]) : 0;
     if ($vid_size > 0 and $vid_size < $vid_sizemax) {
         $vid_width = (int) ($vid_width * $vid_size / 100);
         $vid_height = (int) ($vid_height * $vid_size / 100);
     }
     $vid_width += $vid_addx;
     $vid_height += $vid_addy;
     if (!isset($params["size"])) {
         if (isset($params["width"])) {
             if ($params['width'] == '1') {
                 $params['width'] = $vid_minwidth;
             }
         }
         if (isset($params["width"])) {
             $vid_width = intval($params["width"]);
         }
         if (isset($params["height"])) {
             if ($params['height'] == '1') {
                 $params['height'] = $vid_minheight;
             }
         }
         if (isset($params["height"])) {
             $vid_height = intval($params["height"]);
         }
     }
     if ($vid_width < $vid_minwidth) {
         $vid_width = $vid_minwidth;
     }
     if ($vid_width > $vid_maxwidth) {
         $vid_width = $vid_maxwidth;
     }
     if ($vid_height < $vid_minheight) {
         $vid_height = $vid_minheight;
     }
     if ($vid_height > $vid_maxheight) {
         $vid_height = $vid_maxheight;
     }
     switch ($vid_type) {
         case 'divx':
             $vid_par1 = array(array(1, 'classid', 'clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616'), array(1, 'codebase', 'http://go.divx.com/plugin/DivXBrowserPlugin.cab'), array(4, 'type', 'video/divx'), array(4, 'pluginspage', 'http://go.divx.com/plugin/download/'), array(6, 'src', $vid_source), array(6, 'autoplay', 'false'), array(5, 'width', $vid_width), array(5, 'height', $vid_height));
             $vid_allowpar = array('previewimage');
             break;
         case 'flash':
             $vid_par1 = array(array(1, 'classid', 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'), array(1, 'codebase', 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'), array(2, 'movie', $vid_source), array(4, 'src', $vid_source), array(4, 'type', 'application/x-shockwave-flash'), array(4, 'pluginspage', 'http://www.macromedia.com/go/getflashplayer'), array(6, 'quality', 'high'), array(6, 'allowFullScreen', 'true'), array(6, 'allowScriptAccess', 'never'), array(5, 'width', $vid_width), array(5, 'height', $vid_height));
             $vid_allowpar = array('flashvars', 'wmode', 'bgcolor', 'quality');
             break;
         case 'iframe':
             return '<iframe src="' . $vid_source . '" frameborder="0" width="' . $vid_width . '" height="' . $vid_height . '" allowfullscreen></iframe>';
             break;
         case 'mediaplayer':
             $vid_par1 = array(array(1, 'classid', 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95'), array(1, 'codebase', 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab'), array(4, 'type', 'application/x-mplayer2'), array(4, 'pluginspage', 'http://www.microsoft.com/Windows/MediaPlayer/'), array(6, 'src', $vid_source), array(6, 'autostart', 'false'), array(6, 'autosize', 'true'), array(5, 'width', $vid_width), array(5, 'height', $vid_height));
             $vid_allowpar = array();
             break;
         case 'quicktime':
             $vid_par1 = array(array(1, 'classid', 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'), array(1, 'codebase', 'http://www.apple.com/qtactivex/qtplugin.cab'), array(4, 'type', 'video/quicktime'), array(4, 'pluginspage', 'http://www.apple.com/quicktime/download/'), array(6, 'src', $vid_source), array(6, 'autoplay', 'false'), array(6, 'scale', 'aspect'), array(5, 'width', $vid_width), array(5, 'height', $vid_height));
             $vid_allowpar = array();
             break;
         case 'realplayer':
             $vid_par1 = array(array(1, 'classid', 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'), array(4, 'type', 'audio/x-pn-realaudio-plugin'), array(6, 'src', $vid_source), array(6, 'autostart', 'false'), array(6, 'controls', 'ImageWindow,ControlPanel'), array(5, 'width', $vid_width), array(5, 'height', $vid_height));
             $vid_allowpar = array();
             break;
         default:
             return;
     }
     $vid_par3 = array();
     foreach ($params as $vid_key => $vid_value) {
         if (in_array(Joomla\String\String::strtolower($vid_key), $vid_allowpar)) {
             array_push($vid_par3, array(6, $vid_key, $bbcode->HTMLEncode($vid_value)));
         }
     }
     $vid_object = $vid_param = $vid_embed = array();
     foreach (array_merge($vid_par1, $vid_par2, $vid_par3) as $vid_data) {
         list($vid_key, $vid_name, $vid_value) = $vid_data;
         if ($vid_key & 1) {
             $vid_object[$vid_name] = ' ' . $vid_name . '="' . preg_replace('/%vcode%/', $content, $vid_value) . '"';
         }
         if ($vid_key & 2) {
             $vid_param[$vid_name] = '<param name="' . $vid_name . '" value="' . preg_replace('/%vcode%/', $content, $vid_value) . '" />';
         }
         if ($vid_key & 4) {
             $vid_embed[$vid_name] = ' ' . $vid_name . '="' . preg_replace('/%vcode%/', $content, $vid_value) . '"';
         }
     }
     $tag_new = '<object';
     foreach ($vid_object as $vid_data) {
         $tag_new .= $vid_data;
     }
     $tag_new .= '>';
     foreach ($vid_param as $vid_data) {
         $tag_new .= $vid_data;
     }
     $tag_new .= '<embed';
     foreach ($vid_embed as $vid_data) {
         $tag_new .= $vid_data;
     }
     $tag_new .= ' /></object>';
     return $tag_new;
 }