/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_rating_reviews', 'tsmart_rating_review_id', $db); $this->setPrimaryKey('tsmart_rating_review_id'); $this->setObligatoryKeys('comment'); $this->setLoggable(); }
/** * * @author Max Milbers * @param $db Class constructor; connect to the database * */ function __construct($db) { parent::__construct('#__tsmart_invoices', 'tsmart_invoice_id', $db); $this->setUniqueName('invoice_number'); $this->setLoggable(); $this->setTableShortCut('inv'); }
function display($tpl = null) { // Load the helper(s) $this->addHelperPath(VMPATH_ADMIN . DS . 'helpers'); if (!class_exists('vmPSPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php'; } if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } $model = tmsModel::getModel(); $layoutName = vRequest::getCmd('layout', 'default'); $this->SetViewTitle(); $layoutName = vRequest::getCmd('layout', 'default'); if ($layoutName == 'edit') { tsmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); $shipment = $model->getShipment(); // Get the payment XML. $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmshipment' . DS . $shipment->shipment_element . DS . $shipment->shipment_element . '.xml'); if (file_exists($formFile)) { $shipment->form = JForm::getInstance($shipment->shipment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $shipment->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($shipment->form); tsmTable::bindParameterableToSubField($shipment, $varsToPush); $shipment->form->bind($shipment->getProperties()); } else { $shipment->form = null; } if (!class_exists('VmImage')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php'; } if (!class_exists('tsmartModelVendor')) { require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php'; } $vendor_id = 1; $currency = tsmartModelVendor::getVendorCurrency($vendor_id); $this->assignRef('vendor_currency', $currency->currency_symbol); if ($this->showVendors()) { $vendorList = ShopFunctions::renderVendorList($shipment->tsmart_vendor_id); $this->assignRef('vendorList', $vendorList); } $this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id); $this->assignRef('shipment', $shipment); $this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->tsmart_shoppergroup_ids, true); $this->addStandardEditViewCommands($shipment->tsmart_shipmentmethod_id); } else { JToolBarHelper::custom('cloneshipment', 'copy', 'copy', tsmText::_('com_tsmart_SHIPMENT_CLONE'), true); $this->addStandardDefaultViewCommands(); $this->addStandardDefaultViewLists($model); $this->shipments = $model->getShipments(); tsmConfig::loadJLang('com_tsmart_shoppers', TRUE); foreach ($this->shipments as &$data) { // Write the first 5 shoppergroups in the list $data->shipmentShoppersList = shopfunctions::renderGuiList($data->tsmart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'shopper'); } $this->pagination = $model->getPagination(); } parent::display($tpl); }
function __construct(&$db) { parent::__construct('#__tsmart_calcs', 'tsmart_calc_id', $db); $this->setObligatoryKeys('calc_name'); $this->setObligatoryKeys('calc_kind'); $this->setLoggable(); }
function check() { if (empty($this->shopper_group_name)) { vmError('com_tsmart_SHOPPERGROUP_RECORDS_MUST_HAVE_NAME'); return false; } else { if (function_exists('mb_strlen')) { $length = mb_strlen($this->shopper_group_name); } else { $length = strlen($this->shopper_group_name); } if ($length > 128) { vmError('com_tsmart_SHOPPERGROUP_NAME_128'); } } if ($this->tsmart_shoppergroup_id == 1) { $this->default = 2; $this->sgrp_additional = 0; } if ($this->tsmart_shoppergroup_id == 2) { $this->default = 1; $this->sgrp_additional = 0; } return parent::check(); }
/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_manufacturercategories', 'tsmart_manufacturercategories_id', $db); $this->setUniqueName('mf_category_name'); $this->setLoggable(); $this->setTranslatable(array('mf_category_name', 'mf_category_desc')); $this->setSlug('mf_category_name'); }
function check() { if (empty($this->notify_email) || !filter_var($this->notify_email, FILTER_VALIDATE_EMAIL)) { vmError(tsmText::_('com_tsmart_ENTER_A_VALID_EMAIL_ADDRESS'), tsmText::_('com_tsmart_ENTER_A_VALID_EMAIL_ADDRESS')); return false; } return parent::check(); }
/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_manufacturers', 'tsmart_manufacturer_id', $db); $this->setUniqueName('mf_name'); $this->setLoggable(); $this->setTranslatable(array('mf_name', 'mf_email', 'mf_desc', 'mf_url')); $this->setSlug('mf_name'); $this->setTableShortCut('m'); }
function check() { if (!empty($this->customfield_price)) { $this->customfield_price = str_replace(array(',', ' '), array('.', ''), $this->customfield_price); } else { $this->customfield_price = null; } return parent::check(); }
/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_ratings', 'tsmart_rating_id', $db); //In a VmTable the primary key is the same as the _tbl_key and therefore not needed $this->setPrimaryKey('tsmart_rating_id'); // $this->setObligatoryKeys('tsmart_product_id'); $this->setLoggable(); $this->setTableShortCut('r'); }
/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_paymentmethods', 'tsmart_paymentmethod_id', $db); $this->setObligatoryKeys('payment_jplugin_id'); $this->setObligatoryKeys('payment_name'); $this->setLoggable(); $this->setTranslatable(array('payment_name', 'payment_desc')); $this->setSlug('payment_name'); // $this->setUniqueName('ordering'); }
/** * @author Patrick Kohl * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_customs', 'tsmart_custom_id', $db); $this->_cidName = 'tsmart_custom_id'; $this->setUniqueName('custom_title'); $this->setObligatoryKeys('field_type'); $this->setLoggable(); $this->setOrderable('ordering', false); $this->setParameterable('custom_params', array()); }
function display($tpl = null) { $db = JFactory::getDBO(); if ($field = vRequest::getVar('field')) { if (strpos($field, 'plugin') !== false) { JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); $table = '#__extensions'; $field = substr($field, 6); $q = 'SELECT `params`,`element`,`type` FROM `' . $table . '` WHERE `element` = "' . $field . '"'; $db->setQuery($q); $this->userField = $db->loadObject(); //$this->userField->element = substr($this->userField->type, 6); if (!class_exists('vmPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmplugin.php'; } vmPlugin::loadJLang('plg_vmuserfield_' . $this->userField->element, 'vmuserfield', $this->userField->element); $path = VMPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml'; // Get the payment XML. $formFile = vRequest::filterPath($path); if (file_exists($formFile)) { if (!class_exists('tsmConfig')) { require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_tsmart' . DS . 'helpers' . DS . 'config.php'; } if (!class_exists('tsmTable')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmtable.php'; } $this->userField->form = JForm::getInstance($this->userField->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $this->userField->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($this->userField->form); /* $this->userField->params->userfield_params = $this->userField->params; VmTable::bindParameterable($this->userField->params,'userfield_params',$varsToPush);*/ if (empty($this->userField->userfield_params)) { $this->userField->userfield_params = ''; } tsmTable::bindParameterableToSubField($this->userField, $varsToPush); $this->userField->form->bind($this->userField); } else { $this->userField->form = false; vmdebug('renderUserfieldPlugin could not find xml for ' . $this->userField->type . ' at ' . $path); } //vmdebug('renderUserfieldPlugin ',$this->userField->form); if ($this->userField->form) { $form = $this->userField->form; ob_start(); include VMPATH_ADMIN . DS . 'fields' . DS . 'formrenderer.php'; $body = ob_get_contents(); ob_end_clean(); echo $body; } } } jExit(); }
/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_shipmentmethods', 'tsmart_shipmentmethod_id', $db); // we can have several time the same shipment name. It is the vendor problem to set up correctly his shipment rate. // $this->setUniqueName('shipment_name'); $this->setObligatoryKeys('shipment_jplugin_id'); $this->setObligatoryKeys('shipment_name'); $this->setLoggable(); $this->setTranslatable(array('shipment_name', 'shipment_desc')); $this->setSlug('shipment_name'); }
public function bindChecknStore(&$data, $preload = false) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('products_en_gb.tsmart_product_id')->from('#__tsmart_products AS products')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->where('products_en_gb.tsmart_product_id!=' . (int) $data['tsmart_product_id'])->where('products_en_gb.product_name = ' . $query->q("{$data['product_name']}")); $db->setQuery($query); $list_tour = $db->loadObjectList(); if (count($list_tour) > 0) { vmError('tour name exists, please select other tour name'); return false; } return parent::bindChecknStore($data, $preload); // TODO: Change the autogenerated stub }
/** * Retrieve the detail record for the current $id if the data has not already been loaded. * * @author RickG */ function getShipment($id = 0) { if (!empty($id)) { $this->_id = (int) $id; } if (empty($this->_cache[$this->_id])) { $this->_cache[$this->_id] = $this->getTable('shipmentmethods'); $this->_cache[$this->_id]->load((int) $this->_id); if (empty($this->_cache[$this->_id]->tsmart_vendor_id)) { if (!class_exists('tsmartModelVendor')) { require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php'; } $this->_cache[$this->_id]->tsmart_vendor_id = tsmartModelVendor::getLoggedVendor(); } if ($this->_cache[$this->_id]->shipment_jplugin_id) { JPluginHelper::importPlugin('vmshipment'); $dispatcher = JDispatcher::getInstance(); $blind = 0; $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsShipmentVM3', array(&$this->_cache[$this->_id])); } if (!empty($this->_cache[$this->_id]->_varsToPushParam)) { tsmTable::bindParameterable($this->_cache[$this->_id], 'shipment_params', $this->_cache[$this->_id]->_varsToPushParam); } //We still need this, because the table is already loaded, but the keys are set later if ($this->_cache[$this->_id]->getCryptedFields()) { if (!class_exists('tsmCrypt')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmcrypt.php'; } if (isset($this->_cache[$this->_id]->modified_on)) { $date = JFactory::getDate($this->_cache[$this->_id]->modified_on); $date = $date->toUnix(); } else { $date = 0; } foreach ($this->_cache[$this->_id]->getCryptedFields() as $field) { if (isset($this->_cache[$this->_id]->{$field})) { $this->_cache[$this->_id]->{$field} = tsmCrypt::decrypt($this->_cache[$this->_id]->{$field}, $date); } } } /* Add the shipmentcarreir shoppergroups */ $q = 'SELECT `tsmart_shoppergroup_id` FROM #__tsmart_shipmentmethod_shoppergroups WHERE `tsmart_shipmentmethod_id` = "' . $this->_id . '"'; $this->_db->setQuery($q); $this->_cache[$this->_id]->tsmart_shoppergroup_ids = $this->_db->loadColumn(); if (empty($this->_cache[$this->_id]->tsmart_shoppergroup_ids)) { $this->_cache[$this->_id]->tsmart_shoppergroup_ids = 0; } } return $this->_cache[$this->_id]; }
/** * Validates the order status record fields. * * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check() { $db = JFactory::getDBO(); $q = 'SELECT count(*),tsmart_orderstate_id FROM `#__tsmart_orderstates` '; $q .= 'WHERE `order_status_code`="' . $this->order_status_code . '"'; $db->setQuery($q); $row = $db->loadRow(); if (is_array($row)) { if ($row[0] > 0) { if ($row[1] != $this->tsmart_orderstate_id) { vmError(tsmText::_('com_tsmart_ORDER_STATUS_CODE_EXISTS')); return false; } } } return parent::check(); }
/** * method must be called after preflight * Sets the paths and loads VMFramework config */ public function loadVm() { // $this->path = JInstaller::getInstance()->getPath('extension_administrator'); if (empty($this->path)) { $this->path = VMPATH_ADMIN; } if (!class_exists('tsmConfig')) { require_once $this->path . '/helpers/config.php'; } tsmConfig::loadConfig(false, true); if (!class_exists('tsmTable')) { require_once $this->path . '/helpers/tsmtable.php'; } if (!class_exists('tmsModel')) { require_once $this->path . '/helpers/tsmmodel.php'; } tsmTable::addIncludePath($this->path . DS . 'tables'); tmsModel::addIncludePath($this->path . DS . 'models'); }
/** * Gets a single custom by tsmart_custom_id * . * @param string $type * @param string $mime mime type of custom, use for exampel image * @return customobject */ function getCustom($id = 0) { if (!empty($id)) { $this->_id = (int) $id; } if (empty($this->_cache[$this->_id])) { $this->_cache[$this->_id] = $this->getTable('customs'); $this->_cache[$this->_id]->load($this->_id); $this->_cache[$this->_id]->_varsToPushParam = self::getVarsToPush($this->_cache[$this->_id]->field_type); $this->_cache[$this->_id]->customfield_params = ''; if ($this->_cache[$this->_id]->field_type == 'E') { JPluginHelper::importPlugin('vmcustom'); $dispatcher = JDispatcher::getInstance(); $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsCustomVM3', array(&$this->_cache[$this->_id])); } //exaample vm2 withParent="0"|parentOrderable="0"| // vm3 withParent="1"|parentOrderable="1"| $this->_cache[$this->_id]->_xParams = 'custom_params'; if (!empty($this->_cache[$this->_id]->_varsToPushParam)) { tsmTable::bindParameterable($this->_cache[$this->_id], 'custom_params', $this->_cache[$this->_id]->_varsToPushParam); } } return $this->_cache[$this->_id]; }
/** * @param $db Class constructor; connect to the database */ function __construct($db) { parent::__construct('#__tsmart_order_calc_rules', 'tsmart_order_calc_rule_id', $db); $this->setLoggable(); }
/** * Constructor for report table class * @param $db Database connector object */ function __construct(&$db) { parent::__construct('#__tsmart_orders', 'tsmart_order_id', $db); }
/** * @author RickG * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_states', 'tsmart_state_id', $db); $this->setUniqueName('state_name'); $this->setLoggable(); }
/** * @author Max Milbers * @param JDataBase $db */ function __construct(&$db) { parent::__construct('#__tsmart_countries', 'tsmart_country_id', $db); $this->setLoggable(); $this->setOrderable('ordering', false); }
/** * Reimplement the store method to return the last inserted ID * * @return mixed When a new record was succesfully inserted, return the ID, otherwise the status */ public function store($updateNulls = false) { $isNew = $this->tsmart_userfield_id == 0; if (!parent::store($updateNulls)) { // Write data to the DB vmError($this->_db->getError()); return false; } else { return $this->tsmart_userfield_id; } }
/** * Check if an item is checked out * * This function can be used as a static function too, when you do so you need to also provide the * a value for the $against parameter. * * @static * @access public * @param integer $with The userid to preform the match with, if an item is checked out * by this user the function will return false * @param integer $against The userid to perform the match against when the function is used as * a static function. * @return boolean */ function isCheckedOut($with = 0, $against = null) { if (isset($this) && is_a($this, 'tsmTable') && is_null($against)) { $against = $this->get('locked_by'); } //item is not checked out, or being checked out by the same user if (!$against || $against == $with) { return false; } $session = tsmTable::getInstance('session'); return $session->exists($against); }
static function bindCustomEmbeddedFieldParams(&$obj, $fieldtype) { //vmdebug('bindCustomEmbeddedFieldParams begin',$obj); if (!class_exists('tsmartModelCustom')) { require VMPATH_ADMIN . DS . 'models' . DS . 'custom.php'; } if ($obj->field_type == 'E') { JPluginHelper::importPlugin('vmcustom'); $dispatcher = JDispatcher::getInstance(); $retValue = $dispatcher->trigger('plgVmDeclarePluginParamsCustomVM3', array(&$obj)); if (!empty($obj->_varsToPushParam)) { if (empty($obj->_varsToPushParamCustom)) { $obj->_varsToPushParamCustom = $obj->_varsToPushParam; } if (empty($obj->_varsToPushParamCustomField)) { $obj->_varsToPushParamCustomField = $obj->_varsToPushParam; } } } else { $obj->_varsToPushParamCustom = tsmartModelCustom::getVarsToPush($fieldtype); $obj->_varsToPushParam = $obj->_varsToPushParamCustomField = $obj->_varsToPushParamCustom; //vmdebug('my $obj->_varsToPushParamCustom',$obj->_varsToPushParamCustomField); } if (!empty($obj->_varsToPushParam)) { //$obj ->_xParams = 'custom_params'; tsmTable::bindParameterable($obj, 'custom_params', $obj->_varsToPushParamCustom); $obj->_xParams = 'customfield_params'; tsmTable::bindParameterable($obj, $obj->_xParams, $obj->_varsToPushParamCustomField); } }
/** * @param $db Class constructor; connect to the database */ function __construct($db) { parent::__construct('#__tsmart_order_histories', 'tsmart_order_history_id', $db); $this->setObligatoryKeys('tsmart_order_id'); $this->setLoggable(); }
public function getCustomParams(&$field) { tsmTable::bindParameterable($field, 'customfield_params', $this->_varsToPushParam); //Why do we have this? if (empty($field->custom_element)) { return 0; } //Why do we have this, when bindParameterable could already doing it //And why we do it here, when we do it later again? foreach ($this->_varsToPushParam as $k => $v) { if (!isset($this->params->{$k})) { $this->params->{$k} = $field->{$k}; } // vmdebug('fields org '.$this->_name,$this->params); } $this->tsmart_custom_id = $field->tsmart_custom_id; if (!empty($field->custom_params) && is_string($field->custom_params)) { $this->params = json_decode($field->custom_params); } else { return; } //$field->custom_params = $custom_params; //vmdebug('$this->_varsToPushParam '.$this->_name,$this->_varsToPushParam ); foreach ($this->_varsToPushParam as $k => $v) { if (!isset($this->params->{$k})) { $this->params->{$k} = $field->{$k}; } } }
function check() { $ok = TRUE; $notice = TRUE; if (empty($this->file_type) and empty($this->file_is_forSale)) { $ok = FALSE; vmError(tsmText::sprintf('com_tsmart_MEDIA_NO_TYPE'), $this->file_name); } if (!empty($this->file_url)) { if (function_exists('mb_strlen')) { $length = mb_strlen($this->file_url); } else { $length = strlen($this->file_url); } if ($length > 254) { vmError(JText::sprintf('com_tsmart_URL_TOO_LONG', $length)); } if (strpos($this->file_url, '..') !== FALSE) { $ok = FALSE; vmError(tsmText::sprintf('com_tsmart_URL_NOT_VALID', $this->file_url)); } if (empty($this->tsmart_media_id)) { $q = 'SELECT `tsmart_media_id`,`file_url` FROM `' . $this->_tbl . '` WHERE `file_url` = "' . $this->_db->escape($this->file_url) . '" '; $this->_db->setQuery($q); $unique_id = $this->_db->loadAssocList(); $count = count($unique_id); if ($count !== 0) { if ($count == 1) { if (empty($this->tsmart_media_id)) { $this->tsmart_media_id = $unique_id[0]['tsmart_media_id']; } else { vmError(tsmText::_('com_tsmart_MEDIA_IS_ALREADY_IN_DB')); $ok = FALSE; } } else { // vmError(vmText::_('com_tsmart_MEDIA_IS_DOUBLED_IN_DB')); vmError(tsmText::_('com_tsmart_MEDIA_IS_DOUBLED_IN_DB')); $ok = FALSE; } } } } else { vmError(tsmText::_('com_tsmart_MEDIA_MUST_HAVE_URL')); $ok = FALSE; } if (empty($this->file_title) && !empty($this->file_name)) { $this->file_title = $this->file_name; } if (!empty($this->file_title)) { if (strlen($this->file_title) > 126) { vmError(tsmText::sprintf('com_tsmart_TITLE_TOO_LONG', strlen($this->file_title))); } $q = 'SELECT * FROM `' . $this->_tbl . '` '; $q .= 'WHERE `file_title`="' . $this->_db->escape($this->file_title) . '" AND `file_type`="' . $this->_db->escape($this->file_type) . '"'; $this->_db->setQuery($q); $unique_id = $this->_db->loadAssocList(); $tblKey = 'tsmart_media_id'; if (!empty($unique_id)) { foreach ($unique_id as $item) { if ($item['tsmart_media_id'] != $this->tsmart_media_id) { $lastDir = substr($this->file_url, 0, strrpos($this->file_url, '/')); $lastDir = substr($lastDir, strrpos($lastDir, '/') + 1); if (!empty($lastDir)) { $this->file_title = $this->file_title . '_' . $lastDir; } else { $this->file_title = $this->file_title . '_' . rand(1, 9); } } } } } else { vmError(tsmText::_('com_tsmart_MEDIA_MUST_HAVE_TITLE')); $ok = FALSE; } if (!empty($this->file_description)) { if (strlen($this->file_description) > 254) { vmError(tsmText::sprintf('com_tsmart_DESCRIPTION_TOO_LONG', strlen($this->file_description))); } } // $app = JFactory::getApplication(); //vmError('Checking '.$this->file_url); if (empty($this->file_mimetype)) { $rel_path = str_replace('/', DS, $this->file_url); //The function mime_content_type is deprecated, we may use /*function _mime_content_type($filename) { $result = new finfo(); if (is_resource($result) === true) { return $result->file($filename, FILEINFO_MIME_TYPE); } return false; } if (function_exists ('mime_content_type')) { $ok = TRUE; $app = JFactory::getApplication (); if (!$this->file_is_forSale) { $this->file_mimetype = mime_content_type (JPATH_ROOT . DS . $rel_path); } else { $this->file_mimetype = mime_content_type ($rel_path); } if (!empty($this->file_mimetype)) { if ($this->file_mimetype == 'directory') { vmError ('cant store this media, is a directory ' . $rel_path); return FALSE; } else { if (strpos ($this->file_mimetype, 'corrupt') !== FALSE) { vmError ('cant store this media, Document corrupt: Cannot read summary info ' . $rel_path); return FALSE; } } } else { vmError ('Couldnt resolve mime ' . $rel_path); return FALSE; } } else {*/ if (!class_exists('JFile')) { require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php'; } if (!$this->file_is_forSale) { $lastIndexOfSlash = strrpos($this->file_url, '/'); $name = substr($this->file_url, $lastIndexOfSlash + 1); $file_extension = strtolower(JFile::getExt($name)); } else { $lastIndexOfSlash = strrpos($this->file_url, DS); $name = substr($this->file_url, $lastIndexOfSlash + 1); $file_extension = strtolower(JFile::getExt($name)); } if (empty($name)) { vmError(tsmText::_('com_tsmart_NO_MEDIA')); } elseif ($file_extension === 'jpg' or $file_extension === 'jpeg' or $file_extension === 'jpe') { $this->file_mimetype = 'image/jpeg'; } elseif ($file_extension === 'gif') { $this->file_mimetype = 'image/gif'; } elseif ($file_extension === 'png') { $this->file_mimetype = 'image/png'; } elseif ($file_extension === 'bmp') { vmInfo(tsmText::sprintf('com_tsmart_MEDIA_SHOULD_NOT_BMP', $name)); $notice = true; } elseif ($file_extension === 'mp3') { $this->file_mimetype = 'audio/mpeg'; } elseif ($file_extension === 'ogg') { $this->file_mimetype = 'audio/ogg'; } elseif ($file_extension === 'oga') { $this->file_mimetype = 'audio/vorbis'; } elseif ($file_extension === 'wma') { $this->file_mimetype = 'audio-/x-ms-wma'; } elseif ($file_extension === 'mp4' or $file_extension === 'mpe' or $file_extension === 'mpeg' or $file_extension === 'mpg' or $file_extension === 'mpga' or $file_extension === 'm2v') { $this->file_mimetype = 'video/mpeg'; } elseif ($file_extension === 'avi') { $this->file_mimetype = 'video/x-msvideo'; } elseif ($file_extension === 'qt' or $file_extension === 'mov') { $this->file_mimetype = 'video/quicktime'; } elseif ($file_extension === 'wmv') { $this->file_mimetype = 'video/x-ms-wmv'; } elseif ($file_extension === '3gp') { $this->file_mimetype = 'video/3gpp'; } elseif ($file_extension === 'ogv') { $this->file_mimetype = 'video/ogg'; } elseif ($file_extension === 'flv') { $this->file_mimetype = 'video/x-flv'; } elseif ($file_extension === 'f4v') { $this->file_mimetype = 'video/x-f4v'; } elseif ($file_extension === 'm4v') { $this->file_mimetype = 'video/x-m4v'; } elseif ($file_extension === 'webm') { $this->file_mimetype = 'video/webm'; } elseif ($file_extension === 'zip') { $this->file_mimetype = 'application/zip'; } elseif ($file_extension === 'pdf') { $this->file_mimetype = 'application/pdf'; } elseif ($file_extension === 'gz') { $this->file_mimetype = 'application/x-gzip'; } elseif ($file_extension === 'exe') { $this->file_mimetype = 'application/octet-stream'; } elseif ($file_extension === 'swf') { $this->file_mimetype = 'application/x-shockwave-flash'; } elseif ($file_extension === 'doc') { $this->file_mimetype = 'application/msword'; } elseif ($file_extension === 'docx') { $this->file_mimetype = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; } elseif ($file_extension === 'xls') { $this->file_mimetype = 'application/vnd.ms-excel'; } elseif ($file_extension === 'xlsx') { $this->file_mimetype = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; } elseif ($file_extension === 'ppt') { $this->file_mimetype = 'application/vnd.ms-powerpoint'; } elseif ($file_extension === 'pptx') { $this->file_mimetype = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; } elseif ($file_extension === 'txt') { $this->file_mimetype = 'text/plain'; } elseif ($file_extension === 'rar') { $this->file_mimetype = 'application/x-rar-compressed'; } else { vmInfo(tsmText::sprintf('com_tsmart_MEDIA_SHOULD_HAVE_MIMETYPE', $name)); $notice = TRUE; } //} } //Nasty small hack, should work as long the word for default is in the language longer than 3 words and the first //letter should be always / or something like this //It prevents storing of the default path $a = trim(substr($this->file_url_thumb, 0, 4)); $b = trim(substr(tsmText::_('com_tsmart_DEFAULT_URL'), 0, 4)); if (strpos($a, $b) !== FALSE) { $this->file_url_thumb = null; } if ($ok) { return parent::check(); } else { return FALSE; } }
function renderUserfieldPlugin() { if (!class_exists('vmUserfieldPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmuserfieldtypeplugin.php'; } tsmConfig::loadJLang('plg_vmpsplugin', false); JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields'); //$selected = $this->userField->userfield_jplugin_id; //vmdebug('renderUserfieldPlugin $this->userField->element',$this->userField->type,$this->userField->element); $this->userField->element = substr($this->userField->type, 6); $path = VMPATH_ROOT . DS . 'plugins' . DS . 'vmuserfield' . DS . $this->userField->element . DS . $this->userField->element . '.xml'; // Get the payment XML. $formFile = vRequest::filterPath($path); if (file_exists($formFile)) { $this->userField->form = JForm::getInstance($this->userField->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]'); $this->userField->params = new stdClass(); $varsToPush = vmPlugin::getVarsToPushFromForm($this->userField->form); tsmTable::bindParameterableToSubField($this->userField, $varsToPush); $this->userField->form->bind($this->userField->getProperties()); } else { $this->userField->form = false; vmdebug('renderUserfieldPlugin could not find xml for ' . $this->userField->type . ' at ' . $path); } if ($this->userField->form) { $form = $this->userField->form; ob_start(); include VMPATH_ADMIN . DS . 'fields' . DS . 'formrenderer.php'; $body = ob_get_contents(); ob_end_clean(); return $body; } return; }