AAAAindex.html000066600000000037151372056770006562 0ustar00 contact.php000066600000010772151372056770006740 0ustar00loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } return parent::bind($array, $ignore); } /** * Stores a contact * * @param boolean True to update fields even if they are null. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { // Transform the params field if (is_array($this->params)) { $registry = new JRegistry(); $registry->loadArray($this->params); $this->params = (string)$registry; } $date = JFactory::getDate(); $user = JFactory::getUser(); if ($this->id) { // Existing item $this->modified = $date->toSql(); $this->modified_by = $user->get('id'); } else { // New newsfeed. A feed created and created_by field can be set by the user, // so we don't touch either of these if they are set. if (!intval($this->created)) { $this->created = $date->toSql(); } if (empty($this->created_by)) { $this->created_by = $user->get('id'); } } // Verify that the alias is unique $table = JTable::getInstance('Contact', 'ContactTable'); if ($table->load(array('alias'=>$this->alias, 'catid'=>$this->catid)) && ($table->id != $this->id || $this->id==0)) { $this->setError(JText::_('COM_CONTACT_ERROR_UNIQUE_ALIAS')); return false; } // Attempt to store the data. return parent::store($updateNulls); } /** * Overloaded check function * * @return boolean * @see JTable::check * @since 1.5 */ function check() { $this->default_con = intval($this->default_con); if (JFilterInput::checkAttribute(array ('href', $this->webpage))) { $this->setError(JText::_('COM_CONTACT_WARNING_PROVIDE_VALID_URL')); return false; } /** check for valid name */ if (trim($this->name) == '') { $this->setError(JText::_('COM_CONTACT_WARNING_PROVIDE_VALID_NAME')); return false; } if (empty($this->alias)) { $this->alias = $this->name; } $this->alias = JApplication::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); } /** check for valid category */ if (trim($this->catid) == '') { $this->setError(JText::_('COM_CONTACT_WARNING_CATEGORY')); return false; } // Check the publish down date is not earlier than publish up. if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) { $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); return false; } // clean up keywords -- eliminate extra spaces between phrases // and cr (\r) and lf (\n) characters from string if (!empty($this->metakey)) { // only process if not empty $bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters $keys = explode(',', $after_clean); // create array using commas as delimiter $clean_keys = array(); foreach($keys as $key) { if (trim($key)) { // ignore blank keywords $clean_keys[] = trim($key); } } $this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", " } // clean up description -- eliminate quotes and <> brackets if (!empty($this->metadesc)) { // only process if not empty $bad_characters = array("\"", "<", ">"); $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); } return true; } } .htaccess000066600000000177151372056770006370 0ustar00 Order allow,deny Deny from all featured.php000066600000000763151372071750007076 0ustar00loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } return parent::bind($array, $ignore); } /** * Overloaded check method to ensure data integrity. * * @return boolean True on success. */ function check() { // Check for valid name. if (trim($this->name) == '') { $this->setError(JText::_('COM_NEWSFEEDS_WARNING_PROVIDE_VALID_NAME')); return false; } if (empty($this->alias)) { $this->alias = $this->name; } $this->alias = JApplication::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); } // Check the publish down date is not earlier than publish up. if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) { $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); return false; } // clean up keywords -- eliminate extra spaces between phrases // and cr (\r) and lf (\n) characters from string if (!empty($this->metakey)) { // only process if not empty $bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters $keys = explode(',', $after_clean); // create array using commas as delimiter $clean_keys = array(); foreach($keys as $key) { if (trim($key)) { // ignore blank keywords $clean_keys[] = trim($key); } } $this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", " } // clean up description -- eliminate quotes and <> brackets if (!empty($this->metadesc)) { // only process if not empty $bad_characters = array("\"", "<", ">"); $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); } return true; } /** * Overriden JTable::store to set modified data and user id. * * @param boolean True to update fields even if they are null. * @return boolean True on success. * @since 1.6 */ public function store($updateNulls = false) { $date = JFactory::getDate(); $user = JFactory::getUser(); if ($this->id) { // Existing item $this->modified = $date->toSql(); $this->modified_by = $user->get('id'); } else { // New newsfeed. A feed created and created_by field can be set by the user, // so we don't touch either of these if they are set. if (!intval($this->created)) { $this->created = $date->toSql(); } if (empty($this->created_by)) { $this->created_by = $user->get('id'); } } // Verify that the alias is unique $table = JTable::getInstance('Newsfeed', 'NewsfeedsTable'); if ($table->load(array('alias'=>$this->alias, 'catid'=>$this->catid)) && ($table->id != $this->id || $this->id==0)) { $this->setError(JText::_('COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS')); return false; } return parent::store($updateNulls); } } style.php000066600000005754151372102010006424 0ustar00loadArray($array['params']); $array['params'] = (string)$registry; } // Verify that the default style is not unset if ($array['home']=='0' && $this->home=='1') { $this->setError(JText::_('COM_TEMPLATES_ERROR_CANNOT_UNSET_DEFAULT_STYLE')); return false; } return parent::bind($array, $ignore); } /** * Overloaded check method to ensure data integrity. * * @return boolean True on success. */ function check() { if (empty($this->title)) { $this->setError(JText::_('COM_TEMPLATES_ERROR_STYLE_REQUIRES_TITLE')); return false; } return true; } /** * Overloaded store method to ensure unicity of default style. * * @param boolean True to update fields even if they are null. * @return boolean True on success. * @since 1.0 * @link http://docs.joomla.org/JTable/store */ public function store($updateNulls = false) { if ($this->home!='0') { $query = $this->_db->getQuery(true); $query->update('#__template_styles'); $query->set('home=\'0\''); $query->where('client_id='.(int)$this->client_id); $query->where('home='.$this->_db->quote($this->home)); $this->_db->setQuery($query); $this->_db->query(); } return parent::store($updateNulls); } /** * Overloaded store method to unsure existence of a default style for a template. * * @param mixed An optional primary key value to delete. If not set the * instance property value is used. * @return boolean True on success. * @since 1.0 * @link http://docs.joomla.org/JTable/delete */ public function delete($pk = null) { $k = $this->_tbl_key; $pk = (is_null($pk)) ? $this->$k : $pk; if (!is_null($pk)) { $query = $this->_db->getQuery(true); $query->from('#__template_styles'); $query->select('id'); $query->where('client_id='.(int)$this->client_id); $query->where('template='.$this->_db->quote($this->template)); $this->_db->setQuery($query); $results = $this->_db->loadColumn(); if (count($results)==1 && $results[0]==$pk) { $this->setError(JText::_('COM_TEMPLATES_ERROR_CANNOT_DELETE_LAST_STYLE')); return false; } } return parent::delete($pk); } } product_shoppergroups.php000066600000002471151372133060011746 0ustar00setPrimaryKey('virtuemart_product_id'); $this->setSecondaryKey('virtuemart_shoppergroup_id'); } }category_medias.php000066600000002441151372133060010422 0ustar00setPrimaryKey('virtuemart_category_id'); $this->setSecondaryKey('virtuemart_media_id'); $this->setOrderable(); $this->setTableShortCut('cm'); } } categories.php000066600000015500151372133060007410 0ustar00setPrimaryKey('virtuemart_category_id'); $this->setObligatoryKeys('category_name'); $this->setLoggable(); $this->setTranslatable(array('category_name','category_description','metadesc','metakey','customtitle')); $this->setSlug('category_name'); $this->setTableShortCut('c'); } public function check(){ $csValue = $this->limit_list_step; if(!empty($csValue)){ $sequenceArray = explode(',', $csValue); foreach($sequenceArray as &$csV){ $csV = (int)trim($csV); } $this->limit_list_step = implode(',',$sequenceArray); vmdebug('my check',$this->limit_list_step); } return parent::check(); } /** * Overwrite method * * @author jseros * @param $dirn movement number * @param $parent_id category parent id * @param $where sql WHERE clausule */ public function move( $dirn, $parent_id = 0, $where='' ) { if (!in_array( 'ordering', array_keys($this->getProperties()))) { vmError( get_class( $this ).' does not support ordering' ); return false; } $k = $this->_tbl_key; $sql = "SELECT c.".$this->_tbl_key.", c.ordering FROM ".$this->_tbl." c LEFT JOIN #__virtuemart_category_categories cx ON c.virtuemart_category_id = cx.category_child_id"; $condition = 'cx.category_parent_id = '. $this->_db->Quote($parent_id); $where = ($where ? ' AND '.$condition : $condition); if ($dirn < 0) { $sql .= ' WHERE c.ordering < '.(int) $this->ordering; $sql .= ($where ? ' AND '.$where : ''); $sql .= ' ORDER BY c.ordering DESC'; } else if ($dirn > 0) { $sql .= ' WHERE c.ordering > '.(int) $this->ordering; $sql .= ($where ? ' AND '. $where : ''); $sql .= ' ORDER BY c.ordering'; } else { $sql .= ' WHERE c.ordering = '.(int) $this->ordering; $sql .= ($where ? ' AND '.$where : ''); $sql .= ' ORDER BY c.ordering'; } $this->_db->setQuery( $sql, 0, 1 ); $row = null; $row = $this->_db->loadObject(); if (isset($row)) { $query = 'UPDATE '. $this->_tbl . ' SET ordering = '. (int) $row->ordering . ' WHERE '. $this->_tbl_key .' = '. $this->_db->Quote($this->$k) ; $this->_db->setQuery( $query ); if (!$this->_db->query()) { $err = $this->_db->getErrorMsg(); JError::raiseError( 500, 'TableCategories move isset row this->k '.$err ); } $query = 'UPDATE '.$this->_tbl . ' SET ordering = '.(int) $this->ordering . ' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($row->$k) ; $this->_db->setQuery( $query ); if (!$this->_db->query()) { $err = $this->_db->getErrorMsg(); JError::raiseError( 500, 'TableCategories move isset row $row->$k '.$err ); } $this->ordering = $row->ordering; } else { $query = 'UPDATE '. $this->_tbl . ' SET ordering = '.(int) $this->ordering . ' WHERE '. $this->_tbl_key .' = '. $this->_db->Quote($this->$k) ; $this->_db->setQuery( $query ); if (!$this->_db->query()) { $err = $this->_db->getErrorMsg(); JError::raiseError( 500, 'TableCategories move update '.$err ); } } return true; } /** * Overwrite method * Compacts the ordering sequence of the selected records * @author jseros * * @param $parent_id category parent id * @param string Additional where query to limit ordering to a particular subset of records */ function reorder( $parent_id = 0, $where='' ) { $k = $this->_tbl_key; if (!in_array( 'ordering', array_keys($this->getProperties() ) )) { vmError( get_class( $this ).' does not support ordering'); return false; } $query = 'SELECT c.'.$this->_tbl_key.', c.ordering' . ' FROM '. $this->_tbl . ' c' . ' LEFT JOIN #__virtuemart_category_categories cx' . ' ON c.virtuemart_category_id = cx.category_child_id' . ' WHERE c.ordering >= 0' . ( $where ? ' AND '. $where : '' ) . ' AND cx.category_parent_id = '. $parent_id . ' ORDER BY c.ordering'.$order2; $this->_db->setQuery( $query ); if (!($orders = $this->_db->loadObjectList())) { vmError($this->_db->getErrorMsg()); return false; } // compact the ordering numbers for ($i=0, $n=count( $orders ); $i < $n; $i++) { if ($orders[$i]->ordering >= 0) { if ($orders[$i]->ordering != $i+1) { $orders[$i]->ordering = $i+1; $query = 'UPDATE '.$this->_tbl . ' SET ordering = '. (int) $orders[$i]->ordering . ' WHERE '. $k .' = '. $this->_db->Quote($orders[$i]->$k) ; $this->_db->setQuery( $query); $this->_db->query(); } } } return true; } } userinfos.php000066600000012261151372133060007301 0ustar00setPrimaryKey('virtuemart_userinfo_id'); $this->setObligatoryKeys('address_type'); $this->setObligatoryKeys('virtuemart_user_id'); $this->setLoggable(); $this->setTableShortCut('ui'); } /** * Validates the user info record fields. * * @author RickG, RolandD, Max Milbers * @return boolean True if the table buffer is contains valid data, false otherwise. */ public function check(){ if($this->address_type=='BT' or $this->address_type=='ST' ){ if($this->address_type=='ST' and empty($this->address_type_name)){ $this->address_type_name = 'Delivery Address '.rand(1,9); vmWarn('Table userinfos check failed: address_type '.$this->address_type.' without name, autogenerated '.$this->address_type_name,'check failed: ST has no name, autogenerated '.$this->address_type_name); //return false; } } else { vmError('Table userinfos check failed: Unknown address_type '.$this->address_type,'check failed: Unknown address_type '); vmdebug('Table userinfos check failed: Unknown address_type '.$this->address_type.' virtuemart_user_id '.$this->virtuemart_user_id.' name '.$this->name); return false; } if (!empty($this->virtuemart_userinfo_id)) { $this->virtuemart_userinfo_id = (int)$this->virtuemart_userinfo_id; if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php'); if(!Permissions::getInstance()->check("admin")) { $q = "SELECT virtuemart_user_id FROM #__virtuemart_userinfos WHERE virtuemart_userinfo_id = ".$this->virtuemart_userinfo_id; $this->_db->setQuery($q); $total = $this->_db->loadResultArray(); if (count($total) > 0) { $userId = JFactory::getUser()->id; if($total[0]!=$userId){ vmError('Hacking attempt uid check, you got logged'); echo 'Hacking attempt uid check, you got logged'; return false; } } } //return parent::check(); } else { if(empty($this->address_type)) $this->address_type = 'BT'; /* Check if a record exists */ $q = "SELECT virtuemart_userinfo_id FROM #__virtuemart_userinfos WHERE virtuemart_user_id = ".$this->virtuemart_user_id." AND address_type = ".$this->_db->Quote($this->address_type); if($this->address_type!='BT'){ $q .= " AND address_type_name = ".$this->_db->Quote($this->address_type_name); } $this->_db->setQuery($q); $total = $this->_db->loadResultArray(); if (count($total) > 0) { $this->virtuemart_userinfo_id = (int)$total[0]; } else { $this->virtuemart_userinfo_id = 0;//md5(uniqid($this->virtuemart_user_id)); } } if(empty($this->virtuemart_user_id)){ $user = JFactory::getUser(); if(!empty($user->id)){ $this->virtuemart_user_id = $user->id; } } return parent::check(); } /** * Overloaded delete() to delete a list of virtuemart_userinfo_id's based on the user id * @var mixed id * @return boolean True on success * @author Oscar van Eijk */ function delete( $id=null , $where = 0 ){ // TODO If $id is not numeric, assume it's a virtuemart_userinfo_id. Validate if this is safe enough if (!is_numeric($id)) { return (parent::delete($id)); } // Implicit else $this->_db->setQuery('DELETE from `#__virtuemart_userinfos` WHERE `virtuemart_user_id` = ' . $id); if ($this->_db->query() === false) { vmError($this->_db->getError()); return false; } return true; } } // No Closing tag userfield_values.php000066600000006140151372133060010624 0ustar00setPrimaryKey('virtuemart_userfield_id'); } /** * Validates the userfields record fields, and checks if the given value already exists. * If so, the primary key is set. * * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check() { if (preg_match('/[^a-z0-9\._\-]/i', $this->fieldvalue) > 0) { vmError(JText::_('COM_VIRTUEMART_TITLE_IN_FIELDVALUES_CONTAINS_INVALID_CHARACTERS')); return false; } $db = JFactory::getDBO(); $q = 'SELECT `virtuemart_userfield_value_id` FROM `#__virtuemart_userfield_values` ' . 'WHERE `fieldvalue`="' . $this->fieldvalue . '" ' . 'AND `virtuemart_userfield_id`=' . $this->virtuemart_userfield_id; $db->setQuery($q); $_id = $db->loadResult(); if ($_id === null) { $this->virtuemart_userfield_value_id = null; } else { $this->virtuemart_userfield_value_id = $_id; } return true; } /** * Reimplement delete() to get a list if value IDs based on the field id * @var Field id * @return boolean True on success */ function delete( $virtuemart_userfield_id=null , $where = 0 ){ $db = JFactory::getDBO(); $db->setQuery('DELETE from `#__virtuemart_userfield_values` WHERE `virtuemart_userfield_id` = ' . $virtuemart_userfield_id); if ($db->query() === false) { vmError($db->getError()); return false; } return true; } } //No CLosing Tag order_items.php000066600000004742151372133060007605 0ustar00setLoggable(); } } // pure php no closing tag calc_shoppergroups.php000066600000002322151372133060011163 0ustar00setPrimaryKey('virtuemart_calc_id'); $this->setSecondaryKey('virtuemart_shoppergroup_id'); } } invoices.php000066600000002726151372133060007110 0ustar00setUniqueName('invoice_number'); $this->setLoggable(); $this->setTableShortCut('inv'); } } vmusers.php000066600000003135151372133060006770 0ustar00setPrimaryKey('virtuemart_user_id'); $this->setLoggable(); $this->setTableShortCut('vmu'); } } calc_categories.php000066600000002370151372133060010373 0ustar00setPrimaryKey('virtuemart_calc_id'); $this->setSecondaryKey('virtuemart_category_id','calc_categories'); } } product_prices.php000066600000004775151372133060010324 0ustar00setPrimaryKey('virtuemart_product_price_id'); $this->setLoggable(); $this->setTableShortCut('pp'); $this->_updateNulls = true; } /** * @author Max Milbers * @param */ function check(){ if(!empty($this->product_price)){ $this->product_price = str_replace(array(',',' '),array('.',''),$this->product_price); } if(isset($this->product_override_price)){ $this->product_override_price = str_replace(array(',',' '),array('.',''),$this->product_override_price); } return parent::check(); } } // pure php no closing tag shipmentmethods.php000066600000004334151372133060010501 0ustar00setUniqueName('shipment_name'); $this->setObligatoryKeys('shipment_jplugin_id'); $this->setObligatoryKeys('shipment_name'); $this->setLoggable(); $this->setTranslatable(array('shipment_name', 'shipment_desc')); $this->setSlug('shipment_name'); } } // pure php no closing tag shipmentmethod_shoppergroups.php000066600000002471151372133060013316 0ustar00setPrimaryKey('virtuemart_shipmentmethod_id'); $this->setSecondaryKey('virtuemart_shoppergroup_id'); } } currencies.php000066600000005465151372133060007436 0ustar00setUniqueName('currency_name'); $this->setLoggable(); $this->setOrderable(); } function check(){ //$this->checkCurrencySymbol(); return parent::check(); } /** * ATM Unused ! * Checks a currency symbol wether it is a HTML entity. * When not and $convertToEntity is true, it converts the symbol * Seems not be used ATTENTION seems BROKEN, working only for euro, ... * */ function checkCurrencySymbol($convertToEntity=true ) { $symbol = str_replace('&', '&', $this->currency_symbol ); if( substr( $symbol, 0, 1) == '&' && substr( $symbol, strlen($symbol)-1, 1 ) == ';') { return $symbol; } else { if( $convertToEntity ) { $symbol = htmlentities( $symbol, ENT_QUOTES, 'utf-8' ); if( substr( $symbol, 0, 1) == '&' && substr( $symbol, strlen($symbol)-1, 1 ) == ';') { return $symbol; } // Sometimes htmlentities() doesn't return a valid HTML Entity switch( ord( $symbol ) ) { case 128: case 63: $symbol = '€'; break; } } } $this->currency_symbol = $symbol; } } // pure php no closing tag ratings.php000066600000003232151372133060006731 0ustar00setPrimaryKey('virtuemart_rating_id'); // $this->setObligatoryKeys('virtuemart_product_id'); $this->setLoggable(); $this->setTableShortCut('r'); } } // pure php no closing tag paymentmethods.php000066600000004445151372133060010332 0ustar00setObligatoryKeys('payment_jplugin_id'); $this->setObligatoryKeys('payment_name'); $this->setLoggable(); $this->setTranslatable(array('payment_name', 'payment_desc')); $this->setSlug('payment_name'); // $this->setUniqueName('ordering'); } } // pure php no closing tag vendors.php000066600000011462151372133060006746 0ustar00setPrimaryKey('virtuemart_vendor_id'); $this->setUniqueName('vendor_name'); $this->setSlug('vendor_store_name'); //Attention the slug autoname MUST be also in the translatable, if existing $this->setLoggable(); $this->setTranslatable(array('vendor_store_name','vendor_phone','vendor_store_desc','vendor_terms_of_service','vendor_legal_info','vendor_url','metadesc','metakey','customtitle','vendor_letter_css', 'vendor_letter_header_html', 'vendor_letter_footer_html')); $varsToPushParam = array( 'vendor_min_pov'=>array(0.0,'float'), 'vendor_min_poq'=>array(1,'int'), 'vendor_freeshipment'=>array(0.0,'float'), 'vendor_address_format'=>array('','string'), 'vendor_date_format'=>array('','string'), 'vendor_letter_format'=>array('A4','string'), 'vendor_letter_orientation'=>array('P','string'), 'vendor_letter_margin_top'=>array(45,'int'), 'vendor_letter_margin_left'=>array(25,'int'), 'vendor_letter_margin_right'=>array(25,'int'), 'vendor_letter_margin_bottom'=>array(25,'int'), 'vendor_letter_margin_header'=>array(12,'int'), 'vendor_letter_margin_footer'=>array(20,'int'), 'vendor_letter_font'=>array('helvetica','string'), 'vendor_letter_font_size'=>array(8, 'int'), 'vendor_letter_header_font_size'=>array(7, 'int'), 'vendor_letter_footer_font_size'=>array(6, 'int'), 'vendor_letter_header'=>array(1,'int'), 'vendor_letter_header_line'=>array(1,'int'), 'vendor_letter_header_line_color'=>array("#000000",'string'), 'vendor_letter_header_image'=>array(1,'int'), 'vendor_letter_header_imagesize'=>array(60,'int'), 'vendor_letter_header_cell_height_ratio'=>array(1,'float'), 'vendor_letter_footer'=>array(1,'int'), 'vendor_letter_footer_line'=>array(1,'int'), 'vendor_letter_footer_line_color'=>array("#000000",'string'), 'vendor_letter_footer_cell_height_ratio'=>array(1,'float'), 'vendor_letter_add_tos' => array(0,'int'), 'vendor_letter_add_tos_newpage' => array(1,'int') ); $this->setParameterable('vendor_params',$varsToPushParam); $this->setTableShortCut('v'); // vmdebug('myvendor table',$this); } } //pure php no closing tag paymentmethod_shoppergroups.php000066600000002423151372133060013141 0ustar00setPrimaryKey('virtuemart_paymentmethod_id'); $this->setSecondaryKey('virtuemart_shoppergroup_id'); } } waitingusers.php000066600000003333151372133060010010 0ustar00setLoggable(); } function check() { if(empty($this->notify_email) || !filter_var($this->notify_email, FILTER_VALIDATE_EMAIL)) { vmError(JText::_('COM_VIRTUEMART_ENTER_A_VALID_EMAIL_ADDRESS'),JText::_('COM_VIRTUEMART_ENTER_A_VALID_EMAIL_ADDRESS')); return false; } return parent::check(); } } // pure php no closing tag languages.php000066600000002777151372133060007245 0ustar00setTableShortCut('l'); } } // pure php no closing tag product_categories.php000066600000002411151372133060011145 0ustar00setPrimaryKey('virtuemart_product_id'); $this->setSecondaryKey('virtuemart_category_id'); $this->setOrderable('ordering',false); } } manufacturers.php000066600000003572151372133060010150 0ustar00setUniqueName('mf_name'); $this->setLoggable(); $this->setTranslatable(array('mf_name','mf_email','mf_desc','mf_url')); $this->setSlug('mf_name'); $this->setTableShortCut('m'); } } // pure php no closing tag manufacturer_medias.php000066600000002417151372133060011304 0ustar00setPrimaryKey('virtuemart_manufacturer_id'); $this->setSecondaryKey('virtuemart_media_id'); $this->setOrderable(); } } orders.php000066600000014643151372133060006570 0ustar00setUniqueName('order_number'); $this->setLoggable(); $this->setTableShortCut('o'); } function check(){ if(empty($this->order_number)){ if(!class_exists('VirtueMartModelOrders')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'orders.php'); $this->order_number = VirtueMartModelOrders::generateOrderNumber((string)time()); } if(empty($this->order_pass)){ $this->order_pass = 'p_'.substr( md5((string)time().$this->order_number ), 0, 5); } $adminID = JFactory::getSession()->get('vmAdminID'); if(isset($adminID)) { $this->created_by = $adminID; } return parent::check(); } /** * Overloaded delete() to delete records from order_userinfo and order payment as well, * and write a record to the order history (TODO Or should the hist table be cleaned as well?) * * @var integer Order id * @return boolean True on success * @author Oscar van Eijk * @author Kohl Patrick */ function delete( $id=null , $where = 0 ){ $this->_db->setQuery('DELETE from `#__virtuemart_order_userinfos` WHERE `virtuemart_order_id` = ' . $id); if ($this->_db->query() === false) { vmError($this->_db->getError()); return false; } /*vm_order_payment NOT EXIST have to find the table name*/ $this->_db->setQuery( 'SELECT `payment_element` FROM `#__virtuemart_paymentmethods` , `#__virtuemart_orders` WHERE `#__virtuemart_paymentmethods`.`virtuemart_paymentmethod_id` = `#__virtuemart_orders`.`virtuemart_paymentmethod_id` AND `virtuemart_order_id` = ' . $id ); $paymentTable = '#__virtuemart_payment_plg_'. $this->_db->loadResult(); $this->_db->setQuery('DELETE from `'.$paymentTable.'` WHERE `virtuemart_order_id` = ' . $id); if ($this->_db->query() === false) { vmError($this->_db->getError()); return false; } /*vm_order_shipment NOT EXIST have to find the table name*/ $this->_db->setQuery( 'SELECT `shipment_element` FROM `#__virtuemart_shipmentmethods` , `#__virtuemart_orders` WHERE `#__virtuemart_shipmentmethods`.`virtuemart_shipmentmethod_id` = `#__virtuemart_orders`.`virtuemart_shipmentmethod_id` AND `virtuemart_order_id` = ' . $id ); $shipmentName = $this->_db->loadResult(); if(empty($shipmentName)){ vmError('Seems the used shipmentmethod got deleted'); //Can we securely prevent this just using // 'SELECT `shipment_element` FROM `#__virtuemart_shipmentmethods` , `#__virtuemart_orders` // WHERE `#__virtuemart_shipmentmethods`.`virtuemart_shipmentmethod_id` = `#__virtuemart_orders`.`virtuemart_shipmentmethod_id` AND `virtuemart_order_id` = ' . $id ); } else { $shipmentTable = '#__virtuemart_shipment_plg_'. $shipmentName; $this->_db->setQuery('DELETE from `'.$shipmentTable.'` WHERE `virtuemart_order_id` = ' . $id); if ($this->_db->query() === false) { vmError('TableOrders delete Order shipmentTable = '.$shipmentTable.' `virtuemart_order_id` = '.$id.' dbErrorMsg '.$this->_db->getError()); return false; } } $_q = 'INSERT INTO `#__virtuemart_order_histories` (' . ' virtuemart_order_history_id' . ',virtuemart_order_id' . ',order_status_code' . ',created_on' . ',customer_notified' . ',comments' .') VALUES (' . ' NULL' . ','.$id . ",'-'" . ',NOW()' . ',0' . ",'Order deleted'" .')'; $this->_db->setQuery($_q); $this->_db->query(); // Ignore error here return parent::delete($id); } } worldzones.php000066600000003410151372133060007466 0ustar00setUniqueName('zone_name'); $this->setLoggable(); } } // pure php no closing tag coupons.php000066600000003524151372133060006754 0ustar00setObligatoryKeys('coupon_code'); $this->setLoggable(); } } // pure php no closing tag calc_states.php000066600000002247151372133060007554 0ustar00setPrimaryKey('virtuemart_calc_id'); $this->setSecondaryKey('virtuemart_state_id'); } } manufacturercategories.php000066600000004525151372133060012032 0ustar00setUniqueName('mf_category_name'); $this->setLoggable(); $this->setTranslatable(array('mf_category_name','mf_category_desc')); $this->setSlug('mf_category_name'); } /* * Verify that user have to delete all manufacturers of a particular category before that category can be removed * * @return boolean True if category is ready to be removed, otherwise False */ function checkManufacturer($categoryId = 0) { if($categoryId > 0) { $db = JFactory::getDBO(); $q = 'SELECT count(*)' .' FROM #__virtuemart_manufacturers' .' WHERE virtuemart_manufacturercategories_id = '.$categoryId; $db->setQuery($q); $mCount = $db->loadResult(); if($mCount > 0) { vmInfo('COM_VIRTUEMART_REMOVE_IN_USE'); return false; } } return true; } } // pure php no closing tag rating_votes.php000066600000002660151372133060007772 0ustar00setPrimaryKey('virtuemart_rating_vote_id'); $this->setLoggable(); } } // pure php no closing tag order_calc_rules.php000066600000003740151372133060010575 0ustar00setLoggable(); } } // pure php no closing tag reports.php000066600000002236151372133060006763 0ustar00setPrimaryKey('virtuemart_media_id'); // $this->setUniqueName('file_title'); $this->setLoggable (); } /** * * @author Max Milbers * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check () { $ok = TRUE; $notice = TRUE; if (empty($this->file_type) and empty($this->file_is_forSale)) { $ok = FALSE; vmError (JText::sprintf ('COM_VIRTUEMART_MEDIA_NO_TYPE'), $this->file_name); } if (!empty($this->file_url)) { if (function_exists ('mb_strlen')) { if (mb_strlen ($this->file_url) > 254) { vmError (JText::sprintf ('COM_VIRTUEMART_URL_TOO_LONG', mb_strlen ($this->file_url))); } } else { if (strlen ($this->file_url) > 254) { vmError (JText::sprintf ('COM_VIRTUEMART_URL_TOO_LONG', strlen ($this->file_url))); } } if (strpos ($this->file_url, '..') !== FALSE) { $ok = FALSE; vmError (JText::sprintf ('COM_VIRTUEMART_URL_NOT_VALID', $this->file_url)); } if (empty($this->virtuemart_media_id)) { $q = 'SELECT `virtuemart_media_id`,`file_url` FROM `' . $this->_tbl . '` WHERE `file_url` = "' . $this->_db->getEscaped ($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->virtuemart_media_id)) { $this->virtuemart_media_id = $unique_id[0]['virtuemart_media_id']; } else { vmError (JText::_ ('COM_VIRTUEMART_MEDIA_IS_ALREADY_IN_DB')); $ok = FALSE; } } else { // vmError(JText::_('COM_VIRTUEMART_MEDIA_IS_DOUBLED_IN_DB')); vmError (JText::_ ('COM_VIRTUEMART_MEDIA_IS_DOUBLED_IN_DB')); $ok = FALSE; } } } } else { vmError (JText::_ ('COM_VIRTUEMART_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 (JText::sprintf ('COM_VIRTUEMART_TITLE_TOO_LONG', strlen ($this->file_title))); } $q = 'SELECT * FROM `' . $this->_tbl . '` '; $q .= 'WHERE `file_title`="' . $this->_db->getEscaped ($this->file_title) . '" AND `file_type`="' . $this->_db->getEscaped ($this->file_type) . '"'; $this->_db->setQuery ($q); $unique_id = $this->_db->loadAssocList (); $tblKey = 'virtuemart_media_id'; if (!empty($unique_id)) { foreach ($unique_id as $item) { if ($item['virtuemart_media_id'] != $this->virtuemart_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 (JText::_ ('COM_VIRTUEMART_MEDIA_MUST_HAVE_TITLE')); $ok = FALSE; } if (!empty($this->file_description)) { if (strlen ($this->file_description) > 254) { vmError (JText::sprintf ('COM_VIRTUEMART_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(JPATH_VM_LIBRARIES . 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 (JText::_ ('COM_VIRTUEMART_NO_MEDIA')); } //images 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(JText::sprintf('COM_VIRTUEMART_MEDIA_SHOULD_NOT_BMP',$name)); $notice = true; } //audio 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'; } //video //added missing mimetypes: m2v 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'; } //Added missing formats 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'; } //applications 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'; } //missing types 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 (JText::sprintf ('COM_VIRTUEMART_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(JText::_('COM_VIRTUEMART_DEFAULT_URL'),0,4)); if( strpos($a,$b)!==FALSE ){ $this->file_url_thumb = null; } if ($ok) { return parent::check (); } else { return FALSE; } } /** * We need a customised error handler to catch the errors maybe thrown by * mime_content_type * * @author Max Milbers derived from Philippe Gerber */ function handleError ($errno, $errstr) { // error was suppressed with the @-operator if (0 === error_reporting ()) { return FALSE; } throw new ErrorException($errstr, 0); //echo 'I throw exception'; //throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } } // pure php no closing tag vendor_medias.php000066600000002407151372133060010104 0ustar00setPrimaryKey('virtuemart_vendor_id'); $this->setSecondaryKey('virtuemart_media_id'); $this->setOrderable(); } } customs.php000066600000005742151372133060006767 0ustar00setUniqueName('custom_title'); $this->setObligatoryKeys('field_type'); $this->setLoggable(); $this->setOrderable('ordering',false); } /* * field from 3 table have to be checked at delete * #__vm_custom_field,#__virtuemart_customs,#__virtuemart_product_customfields */ function delete( $id=null , $where = 0 ){ $this->_db->setQuery('DELETE X,C FROM `#__virtuemart_customs` AS C LEFT JOIN `#__virtuemart_product_customfields` AS X ON X.`virtuemart_custom_id` = C.`virtuemart_custom_id` WHERE C.`virtuemart_custom_id`=' . $id); if ($this->_db->query() === false) { vmError($this->_db->getError()); return false; } return true; } } // pure php no closing tag rating_reviews.php000066600000003553151372133060010320 0ustar00setPrimaryKey('virtuemart_rating_review_id'); $this->setObligatoryKeys('comment'); $this->setLoggable(); } } // pure php no closing tag configs.php000066600000002457151372133060006722 0ustar00setLoggable(); } } // pure php no closing tag shoppergroups.php000066600000004230151372133060010201 0ustar00setUniqueName('shopper_group_name'); $this->setLoggable(); $this->setTableShortCut('sg'); } // /** // * Validates the shopper group record fields. // * // * @author Markus Öhler // * @return boolean True if the table buffer contains valid data, false otherwise. // */ function check(){ if (empty($this->shopper_group_name) ){ vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_RECORDS_MUST_HAVE_NAME')); return false; } else { if(function_exists('mb_strlen') ){ if (mb_strlen($this->shopper_group_name) > 32) { vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS')); return false; } } else { if (strlen($this->shopper_group_name) > 32) { vmError(JText::_('COM_VIRTUEMART_SHOPPERGROUP_NAME_LESS_THAN_32_CHARACTERS')); return false; } } } return parent::check(); } } // pure php no closing tag orderstates.php000066600000005233151372133060007624 0ustar00setObligatoryKeys('order_status_code'); $this->setObligatoryKeys('order_status_name'); $this->setObligatoryKeys('order_stock_handle'); $this->setLoggable(); } /** * 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(*),virtuemart_orderstate_id FROM `#__virtuemart_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->virtuemart_orderstate_id){ vmError(JText::_('COM_VIRTUEMART_ORDER_STATUS_CODE_EXISTS')); return false; } } } return parent::check(); } } //No CLosing Tag calcs.php000066600000004733151372133060006356 0ustar00setUniqueName('calc_name'); $this->setObligatoryKeys('calc_kind'); $this->setLoggable(); } } // pure php no closing tag products.php000066600000010762151372133060007133 0ustar00setPrimaryKey('virtuemart_product_id'); $this->setObligatoryKeys('product_name'); $this->setLoggable(); $this->setTranslatable(array('product_name','product_s_desc','product_desc','metadesc','metakey','customtitle')); $this->setSlug('product_name'); $this->setTableShortCut('p'); //We could put into the params also the product_availability and the low_stock_notification $varsToPushParam = array( 'min_order_level'=>array(null,'float'), 'max_order_level'=>array(null,'float'), 'step_order_level'=>array(null,'float'), //'product_packaging'=>array(null,'float'), 'product_box'=>array(null,'float') ); $this->setParameterable('product_params',$varsToPushParam); $this->_updateNulls = true; } } // pure php no closing tag product_medias.php000066600000002457151372133060010274 0ustar00setPrimaryKey('virtuemart_product_id'); $this->setSecondaryKey('virtuemart_media_id'); $this->setOrderable('ordering',true); // $this->setOrderableFormname('mediaordering'); } } countries.php000066600000003472151372133060007303 0ustar00setUniqueName('country_name'); $this->setObligatoryKeys('country_2_code'); $this->setObligatoryKeys('country_3_code'); $this->setLoggable(); $this->setOrderable('ordering',false); } } // pure php no closing tag states.php000066600000003460151372133060006570 0ustar00setUniqueName('state_name'); $this->setObligatoryKeys('state_2_code'); $this->setObligatoryKeys('state_3_code'); $this->setLoggable(); } } // pure php no closing tag usergroups.php000066600000003522151372133060007502 0ustar00setUniqueName('group_name'); $this->setLoggable(); } /** * Validates the userfields record fields. * * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check($nrOfValues){ if (preg_match('/[^a-z0-9\._\-]/i', $this->group_name) > 0) { vmError(JText::_('COM_VIRTUEMART_PERMISSION_GROUP_NAME_INVALID_CHARACTERS')); return false; } return parent::check(); } } //No CLosing Tag product_manufacturers.php000066600000002352151372133060011703 0ustar00setPrimaryKey('virtuemart_product_id'); $this->setSecondaryKey('virtuemart_manufacturer_id'); } } calc_countries.php000066600000002315151372133060010260 0ustar00setPrimaryKey('virtuemart_calc_id'); $this->setSecondaryKey('virtuemart_country_id'); } } category_categories.php000066600000002235151372133060011306 0ustar00setPrimaryKey('category_child_id'); $this->setOrderable(); $this->setTableShortCut('cx'); } }userfields.php000066600000010520151372133060007425 0ustar00setPrimaryKey('virtuemart_userfield_id'); $this->setUniqueName('name'); $this->setObligatoryKeys('title'); $this->setLoggable(); $this->setOrderable('ordering',false); } /** * Validates the userfields record fields. * * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check($nrOfValues) { if (preg_match('/[^a-z0-9\._\-]/i', $this->name) > 0) { vmError(JText::_('COM_VIRTUEMART_NAME_OF_USERFIELD_CONTAINS_INVALID_CHARACTERS')); return false; } if($this->name !='virtuemart_country_id' and $this->name !='virtuemart_state_id'){ $reqValues = array('select', 'multiselect', 'radio', 'multicheckbox'); if (in_array($this->type, $reqValues) and $nrOfValues == 0 ) { vmError(JText::_('COM_VIRTUEMART_VALUES_ARE_REQUIRED_FOR_THIS_TYPE')); return false; } } return parent::check(); } /** * Format the field type * @param $_data array array with additional data written to other tables * @return string Field type in SQL syntax */ function formatFieldType(&$_data = array()) { $_fieldType = $this->type; switch($this->type) { case 'date': $_fieldType = 'DATE'; break; case 'editorta': case 'textarea': case 'multiselect': case 'multicheckbox': $_fieldType = 'MEDIUMTEXT'; break; case 'checkbox': $_fieldType = 'TINYINT'; break; case 'age_verification': $this->params = 'minimum_age='.(int)$_data['minimum_age']."\n"; default: $_fieldType = 'VARCHAR(255)'; break; } return $_fieldType; } /** * 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->virtuemart_userfield_id == 0); if (!parent::store($updateNulls)) { // Write data to the DB vmError($this->getError()); return false; } else { return $this->virtuemart_userfield_id; } } function checkAndDelete($table,$where = 0){ $ok = 1; $k = $this->_tbl_key; if($where!==0){ $whereKey = $where; } else { $whereKey = $this->_pkey; } $query = 'SELECT `'.$this->_tbl_key.'` FROM `'.$table.'` WHERE '.$whereKey.' = "' .$this->$k . '"'; // stAn - it should be better to add this directly to the controller of the shopper fields // only additionally, controllers are not considered as safe. if (isset($this->name)) { $umodel = VmModel::getModel('userfields'); $arr = $umodel->getCoreFields(); if (in_array($this->name, $arr)) { vmError('Cannot delete core field!'); return false; } } $this->_db->setQuery( $query ); $list = $this->_db->loadResultArray(); if($list){ foreach($list as $row){ $ok = $row; $query = 'DELETE FROM `'.$table.'` WHERE '.$this->_tbl_key.' = "'.$row.'"'; $this->_db->setQuery( $query ); if (!$this->_db->query()){ $this->setError($this->_db->getErrorMsg()); vmError('checkAndDelete '.$this->_db->getErrorMsg()); $ok = 0; } } } return $ok; } } //No CLosing Tag order_histories.php000066600000003114151372133060010465 0ustar00setObligatoryKeys('virtuemart_order_id'); $this->setLoggable(); } } // pure php no closing tag vmuser_shoppergroups.php000066600000002475151372133060011613 0ustar00setPrimaryKey('virtuemart_user_id'); $this->setSecondaryKey('virtuemart_shoppergroup_id'); } } order_userinfos.php000066600000002215151372133060010472 0ustar00setLoggable(); } } // No closing tagorder_item_histories.php000066600000003303151372133060011503 0ustar00setObligatoryKeys('virtuemart_order_item_id'); $this->setLoggable(); } } // pure php no closing tag calc_manufacturers.php000066600000002410151372133060011120 0ustar00 St.Kraft 2013-02-24 Herstellerrabatt * @param JDataBase $db */ function __construct(&$db){ parent::__construct('#__virtuemart_calc_manufacturers', 'id', $db); $this->setPrimaryKey('virtuemart_calc_id'); $this->setSecondaryKey('virtuemart_manufacturer_id'); } } product_customfields.php000066600000003703151372133060011526 0ustar00setPrimaryKey('virtuemart_product_id'); // $this->setSecondaryKey('virtuemart_customfield_id'); $this->setLoggable(); $this->setOrderable(); } function check(){ if(!empty($this->custom_price)){ $this->custom_price = str_replace(array(',',' '),array('.',''),$this->custom_price); } else { $this->custom_price = null; } return parent::check(); } } category.php000066600000001766151372253620007116 0ustar00chronoforms.php000066600000001216151372261250007624 0ustar00sliders.php000066600000001605151372265540006742 0ustar00loadArray($array['params']); $array['params'] = (string)$registry; } if(empty($array['alias'])) { $array['alias'] = $array['title']; } $array['alias'] = JFilterOutput::stringURLSafe($array['alias']); if(trim(str_replace('-','',$array['alias'])) == '') { $array['alias'] = JFactory::getDate()->format("Y-m-d-H-i-s"); } //dmp($array);exit(); return parent::bind($array, $ignore); } //public function delete($pk=null){ /* dmp($_REQUEST); MaxFunctionsAdmin::showTrace("delete item"); dmp("items delete"); exit(); */ //parent::delete($pk); //} } weblink.php000066600000015053151374134550006730 0ustar00loadArray($array['params']); $array['params'] = (string)$registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string)$registry; } return parent::bind($array, $ignore); } /** * Overload the store method for the Weblinks table. * * @param boolean Toggle whether null values should be updated. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { $date = JFactory::getDate(); $user = JFactory::getUser(); if ($this->id) { // Existing item $this->modified = $date->toSql(); $this->modified_by = $user->get('id'); } else { // New weblink. A weblink created and created_by field can be set by the user, // so we don't touch either of these if they are set. if (!intval($this->created)) { $this->created = $date->toSql(); } if (empty($this->created_by)) { $this->created_by = $user->get('id'); } } // Verify that the alias is unique $table = JTable::getInstance('Weblink', 'WeblinksTable'); if ($table->load(array('alias'=>$this->alias, 'catid'=>$this->catid)) && ($table->id != $this->id || $this->id==0)) { $this->setError(JText::_('COM_WEBLINKS_ERROR_UNIQUE_ALIAS')); return false; } // Attempt to store the user data. return parent::store($updateNulls); } /** * Overloaded check method to ensure data integrity. * * @return boolean True on success. */ public function check() { if (JFilterInput::checkAttribute(array ('href', $this->url))) { $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_PROVIDE_URL')); return false; } // check for valid name if (trim($this->title) == '') { $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE')); return false; } // check for existing name $query = 'SELECT id FROM #__weblinks WHERE title = '.$this->_db->Quote($this->title).' AND catid = '.(int) $this->catid; $this->_db->setQuery($query); $xid = intval($this->_db->loadResult()); if ($xid && $xid != intval($this->id)) { $this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_NAME')); return false; } if (empty($this->alias)) { $this->alias = $this->title; } $this->alias = JApplication::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); } // Check the publish down date is not earlier than publish up. if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) { $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); return false; } // clean up keywords -- eliminate extra spaces between phrases // and cr (\r) and lf (\n) characters from string if (!empty($this->metakey)) { // only process if not empty $bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters $keys = explode(',', $after_clean); // create array using commas as delimiter $clean_keys = array(); foreach($keys as $key) { if (trim($key)) { // ignore blank keywords $clean_keys[] = trim($key); } } $this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", " } return true; } /** * Method to set the publishing state for a row or list of rows in the database * table. The method respects checked out rows by other users and will attempt * to checkin rows that it can after adjustments are made. * * @param mixed An optional array of primary key values to update. If not * set the instance property value is used. * @param integer The publishing state. eg. [0 = unpublished, 1 = published] * @param integer The user id of the user performing the operation. * @return boolean True on success. * @since 1.0.4 */ public function publish($pks = null, $state = 1, $userId = 0) { // Initialise variables. $k = $this->_tbl_key; // Sanitize input. JArrayHelper::toInteger($pks); $userId = (int) $userId; $state = (int) $state; // If there are no primary keys set check to see if the instance key is set. if (empty($pks)) { if ($this->$k) { $pks = array($this->$k); } // Nothing to set publishing state on, return false. else { $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); return false; } } // Build the WHERE clause for the primary keys. $where = $k.'='.implode(' OR '.$k.'=', $pks); // Determine if there is checkin support for the table. if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time')) { $checkin = ''; } else { $checkin = ' AND (checked_out = 0 OR checked_out = '.(int) $userId.')'; } // Update the publishing state for rows with the given primary keys. $this->_db->setQuery( 'UPDATE '.$this->_db->quoteName($this->_tbl) . ' SET '.$this->_db->quoteName('state').' = '.(int) $state . ' WHERE ('.$where.')' . $checkin ); $this->_db->query(); // Check for a database error. if ($this->_db->getErrorNum()) { $this->setError($this->_db->getErrorMsg()); return false; } // If checkin is supported and all rows were adjusted, check them in. if ($checkin && (count($pks) == $this->_db->getAffectedRows())) { // Checkin the rows. foreach($pks as $pk) { $this->checkin($pk); } } // If the JTable instance value is in the list of primary keys that were set, set the instance. if (in_array($this->$k, $pks)) { $this->state = $state; } $this->setError(''); return true; } }