AAAAaffiliates.php000066600000003460151453173040007376 0ustar00getFields() as $k => $v) { // If the property is not private, reset it. if (strpos($k, '_') !== 0) { $this->$k = NULL; } } } /** * Check if the affiliate already exists * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 4.0 */ public function check() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName($this->_tbl_key)); $query->from($db->quoteName($this->_tbl)); $query->where($db->quoteName('user_id').' = '.$db->quote($this->user_id)); $db->setQuery($query); $this->akeebasubs_affiliate_id = $db->loadResult(); if ($this->akeebasubs_affiliate_id > 0) return true; else return false; } } ?> index.html000066600000000054151453173040006547 0ustar00affpayments.php000066600000004601151453173040007602 0ustar00getFields() as $k => $v) { // If the property is not private, reset it. if (strpos($k, '_') !== 0) { $this->$k = NULL; } } } /** * Check if a payment has already been made * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 4.0 */ public function check() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName($this->_tbl_key)); $query->from($db->quoteName($this->_tbl)); $query->where($db->quoteName('akeebasubs_affiliate_id').' = '.$db->quote($this->akeebasubs_affiliate_id)); $query->where($db->quoteName('created_on').' = '.$db->quote($this->created_on)); $db->setQuery($query); $id = $db->loadResult(); if ($id > 0) return false; else return true; } /** * Delete affiliate payments * * @copyright * @author RolandD * @todo * @see * @access public * @param int $user_id the ID of the affiliate * @return * @since 4.0 */ public function delete($user_id) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->delete($db->quoteName($this->_tbl)); $query->where($db->quoteName('akeebasubs_affiliate_id').' = '.$db->quote($user_id)); $db->setQuery($query); if ($db->query()) return true; else return false; } } ?> coupons.php000066600000003705151453173040006757 0ustar00akeebasubs_coupon_id)) return true; else { $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($this->_tbl_key); $query->from($this->_tbl); $query->where('coupon ='.$db->Quote($this->coupon)); $db->setQuery($query); $csvilog->addDebug(JText::_('COM_CSVI_CHECK_COUPON_CODE_EXISTS'), true); $db->query(); if ($db->getAffectedRows() > 0) { $this->akeebasubs_coupon_id = $db->loadResult(); } } } /** * Reset the table fields, need to do it ourselves as the fields default is not NULL * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 4.0 */ public function reset() { // Get the default values for the class from the table. foreach ($this->getFields() as $k => $v) { // If the property is not private, reset it. if (strpos($k, '_') !== 0) { $this->$k = NULL; } } } } ?> subscriptions.php000066600000002340151453173040010172 0ustar00getFields() as $k => $v) { // If the property is not private, reset it. if (strpos($k, '_') !== 0) { $this->$k = NULL; } } } } ?> .htaccess000066600000000177151453173040006356 0ustar00 Order allow,deny Deny from all export/couponexport.php000066600000013217151453251110011351 0ustar00input; $csvilog = $jinput->get('csvilog', null, null); $template = $jinput->get('template', null, null); $exportclass = $jinput->get('export.class', null, null); $export_fields = $jinput->get('export.fields', array(), 'array'); // Build something fancy to only get the fieldnames the user wants $userfields = array(); foreach ($export_fields as $column_id => $field) { if ($field->process) { switch ($field->field_name) { case 'params': $userfields[] = $db->quoteName('#__akeebasubs_coupons').'.'.$db->quoteName($field->field_name); break; case 'custom': break; default: $userfields[] = $db->quoteName($field->field_name); break; } } } // Build the query $userfields = array_unique($userfields); $query = $db->getQuery(true); $query->select(implode(",\n", $userfields)); $query->from('#__akeebasubs_coupons'); $query->leftJoin('#__akeebasubs_users ON #__akeebasubs_users.user_id = #__akeebasubs_coupons.user'); $query->leftJoin('#__users ON #__users.id = #__akeebasubs_coupons.user'); // Check if there are any selectors $selectors = array(); // Filter by published state $publish_state = $template->get('publish_state', 'general'); if ($publish_state !== '' && ($publish_state == 1 || $publish_state == 0)) { $selectors[] = '#__akeebasubs_coupons.enabled = '.$publish_state; } // Check if we need to attach any selectors to the query if (count($selectors) > 0 ) $query->where(implode("\n AND ", $selectors)); // Check if we need to group the orders together $groupby = $template->get('groupby', 'general', false, 'bool'); if ($groupby) { $filter = $this->getFilterBy('groupby'); if (!empty($filter)) $query->group($filter); } // Order by set field $orderby = $this->getFilterBy('sort'); if (!empty($orderby)) $query->order($orderby); // Add a limit if user wants us to $limits = $this->getExportLimit(); // Execute the query $csvidb->setQuery($query, $limits['offset'], $limits['limit']); $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true); // There are no records, write SQL query to log if (!is_null($csvidb->getErrorMsg())) { $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg())); $this->writeOutput(); $csvilog->AddStats('incorrect', $csvidb->getErrorMsg()); } else { $logcount = $csvidb->getNumRows(); $jinput->set('logcount', $logcount); if ($logcount > 0) { while ($record = $csvidb->getRow()) { if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') $this->addExportContent($exportclass->NodeStart()); foreach ($export_fields as $column_id => $field) { $fieldname = $field->field_name; // Add the replacement if (isset($record->$fieldname)) $fieldvalue = CsviHelper::replaceValue($field->replace, $record->$fieldname); else $fieldvalue = ''; switch ($fieldname) { case 'value': $fieldvalue = number_format($fieldvalue, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general')); if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; case 'publish_up': case 'publish_down': case 'created_on': case 'modified_on': case 'locked_on': $date = JFactory::getDate($record->$fieldname); $fieldvalue = CsviHelper::replaceValue($field->replace, date($template->get('export_date_format', 'general'), $date->toUnix())); $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; default: // Check if we have any content otherwise use the default value if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; } } if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') { $this->addExportContent($exportclass->NodeEnd()); } // Output the contents $this->writeOutput(); } } else { $this->addExportContent(JText::_('COM_CSVI_NO_DATA_FOUND')); // Output the contents $this->writeOutput(); } } } } ?>export/affiliateexport.php000066600000021445151453251110011774 0ustar00input; $csvilog = $jinput->get('csvilog', null, null); $template = $jinput->get('template', null, null); $exportclass = $jinput->get('export.class', null, null); $export_fields = $jinput->get('export.fields', array(), 'array'); // Build something fancy to only get the fieldnames the user wants $userfields = array(); foreach ($export_fields as $column_id => $field) { if ($field->process) { switch ($field->field_name) { case 'user_id': case 'akeebasubs_affiliate_id': $userfields[] = $db->quoteName('#__akeebasubs_affiliates').'.'.$db->quoteName($field->field_name); break; case 'money_owed': case 'money_paid': case 'total_commission': $userfields[] = $db->quoteName('#__akeebasubs_affiliates').'.'.$db->quoteName('akeebasubs_affiliate_id'); break; case 'custom': break; default: $userfields[] = $db->quoteName($field->field_name); break; } } } // Build the query $userfields = array_unique($userfields); $query = $db->getQuery(true); $query->select(implode(",\n", $userfields)); $query->from('#__akeebasubs_affiliates'); $query->leftJoin('#__akeebasubs_affpayments ON #__akeebasubs_affpayments.akeebasubs_affiliate_id = #__akeebasubs_affiliates.akeebasubs_affiliate_id'); $query->leftJoin('#__users ON #__users.id = #__akeebasubs_affiliates.user_id'); // Check if there are any selectors $selectors = array(); // Filter by published state $publish_state = $template->get('publish_state', 'general'); if ($publish_state !== '' && ($publish_state == 1 || $publish_state == 0)) { $selectors[] = '#__akeebasubs_affiliates.enabled = '.$publish_state; } // Check if we need to attach any selectors to the query if (count($selectors) > 0 ) $query->where(implode("\n AND ", $selectors)); // Ignore some custom fields $ignore = array('money_owed', 'money_paid', 'total_commission'); // Check if we need to group the orders together $groupby = $template->get('groupby', 'general', false, 'bool'); if ($groupby) { $filter = $this->getFilterBy('groupby', $ignore); if (!empty($filter)) $query->group($filter); } // Order by set field $orderby = $this->getFilterBy('sort', $ignore); if (!empty($orderby)) $query->order($orderby); // Add a limit if user wants us to $limits = $this->getExportLimit(); // Execute the query $csvidb->setQuery($query, $limits['offset'], $limits['limit']); $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true); // There are no records, write SQL query to log if (!is_null($csvidb->getErrorMsg())) { $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg())); $this->writeOutput(); $csvilog->AddStats('incorrect', $csvidb->getErrorMsg()); } else { $logcount = $csvidb->getNumRows(); $jinput->set('logcount', $logcount); if ($logcount > 0) { while ($record = $csvidb->getRow()) { if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') $this->addExportContent($exportclass->NodeStart()); foreach ($export_fields as $column_id => $field) { $fieldname = $field->field_name; // Add the replacement if (isset($record->$fieldname)) $fieldvalue = CsviHelper::replaceValue($field->replace, $record->$fieldname); else $fieldvalue = ''; switch ($fieldname) { case 'money_owed': $query1 = $db->getQuery(true); $query1->select('akeebasubs_affiliate_id, SUM(affiliate_comission) AS money_owed'); $query1->from('#__akeebasubs_subscriptions'); $query1->where('state = '.$db->Quote('C')); $query1->where('akeebasubs_affiliate_id = '.$record->akeebasubs_affiliate_id); $query1->group('akeebasubs_affiliate_id'); $query2 = $db->getQuery(true); $query2->select('akeebasubs_affiliate_id, SUM(amount) AS money_paid'); $query2->from('#__akeebasubs_affpayments'); $query2->where('akeebasubs_affiliate_id = '.$record->akeebasubs_affiliate_id); $query2->group('akeebasubs_affiliate_id'); $query = $db->getQuery(true); $query->select('money_owed-money_paid AS balance'); $query->from('#__akeebasubs_affiliates'); $query->leftJoin('('.$query1.') AS o USING ('.$db->quoteName('akeebasubs_affiliate_id').')'); $query->leftJoin('('.$query2.') AS p USING ('.$db->quoteName('akeebasubs_affiliate_id').')'); $query->where('akeebasubs_affiliate_id = '.$record->akeebasubs_affiliate_id); $db->setQuery($query); $fieldvalue = $db->loadResult(); $fieldvalue = number_format($fieldvalue, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general')); if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; case 'money_paid': $query = $db->getQuery(true); $query->select('SUM(amount) AS money_paid'); $query->from('lwraz_akeebasubs_affpayments'); $query->where('akeebasubs_affiliate_id = '.$record->akeebasubs_affiliate_id); $db->setQuery($query); $fieldvalue = $db->loadResult(); $fieldvalue = number_format($fieldvalue, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general')); if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; case 'total_commission': $query = $db->getQuery(true); $query->select('SUM(affiliate_comission) AS total_commision'); $query->from('#__akeebasubs_subscriptions'); $query->where('state = '.$db->Quote('C')); $query->where('akeebasubs_affiliate_id = '.$record->akeebasubs_affiliate_id); $query->group('akeebasubs_affiliate_id'); $db->setQuery($query); $fieldvalue = $db->loadResult(); $fieldvalue = number_format($fieldvalue, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general')); if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; case 'created_on': $date = JFactory::getDate($record->$fieldname); $fieldvalue = CsviHelper::replaceValue($field->replace, date($template->get('export_date_format', 'general'), $date->toUnix())); $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; default: // Check if we have any content otherwise use the default value if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; } } if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') { $this->addExportContent($exportclass->NodeEnd()); } // Output the contents $this->writeOutput(); } } else { $this->addExportContent(JText::_('COM_CSVI_NO_DATA_FOUND')); // Output the contents $this->writeOutput(); } } } } ?>export/index.html000066600000000054151453251110010063 0ustar00export/subscriptionexport.php000066600000021375151453251110012576 0ustar00input; $csvilog = $jinput->get('csvilog', null, null); $template = $jinput->get('template', null, null); $exportclass = $jinput->get('export.class', null, null); $export_fields = $jinput->get('export.fields', array(), 'array'); // Build something fancy to only get the fieldnames the user wants $userfields = array(); foreach ($export_fields as $column_id => $field) { if ($field->process) { switch ($field->field_name) { case 'notes': case 'params': case 'state': $userfields[] = $db->quoteName('#__akeebasubs_users').'.'.$db->quoteName($field->field_name); break; case 'user_id': $userfields[] = $db->quoteName('#__akeebasubs_subscriptions').'.'.$db->quoteName('user_id'); break; case 'custom': break; default: $userfields[] = $db->quoteName($field->field_name); break; } } } // Build the query $userfields = array_unique($userfields); $query = $db->getQuery(true); $query->select(implode(",\n", $userfields)); $query->from('#__akeebasubs_subscriptions'); $query->leftJoin('#__akeebasubs_users ON #__akeebasubs_users.user_id = #__akeebasubs_subscriptions.user_id'); $query->leftJoin('#__users ON #__users.id = #__akeebasubs_subscriptions.user_id'); // Check if there are any selectors $selectors = array(); // Filter by published state $publish_state = $template->get('publish_state', 'general'); if ($publish_state !== '' && ($publish_state == 1 || $publish_state == 0)) { $selectors[] = '#__akeebasubs_subscriptions.enabled = '.$publish_state; } // Filter by order number start $ordernostart = $template->get('ordernostart', 'order', array(), 'int'); if ($ordernostart > 0) { $selectors[] = '#__akeebasubs_subscriptions.akeebasubs_subscription_id >= '.$ordernostart; } // Filter by order number end $ordernoend = $template->get('ordernoend', 'order', array(), 'int'); if ($ordernoend > 0) { $selectors[] = '#__akeebasubs_subscriptions.akeebasubs_subscription_id <= '.$ordernoend; } // Filter by list of order numbers $orderlist = $template->get('orderlist', 'order'); if ($orderlist) { $selectors[] = '#__akeebasubs_subscriptions.akeebasubs_subscription_id IN ('.$orderlist.')'; } // Filter by order date start $orderdatestart = $template->get('orderdatestart', 'order', false); if ($orderdatestart) { $orderdate = JFactory::getDate($orderdatestart); $selectors[] = $db->quoteName('#__akeebasubs_subscriptions').'.'.$db->quoteName('created_on').' >= '.$db->Quote($orderdate->toMySQL()); } // Filter by order date end $orderdateend = $template->get('orderdateend', 'order', false); if ($orderdateend) { $orderdate = JFactory::getDate($orderdateend); $selectors[] = $db->quoteName('#__akeebasubs_subscriptions').'.'.$db->quoteName('created_on').' <= '.$db->Quote($orderdate->toMySQL()); } // Filter by order status $orderstatus = $template->get('orderstatus', 'order', false); if ($orderstatus && $orderstatus[0] != '') { $selectors[] = '#__akeebasubs_subscriptions.state IN (\''.implode("','", $orderstatus).'\')'; } // Filter by payment method $orderpayment = $template->get('orderpayment', 'order', false); if ($orderpayment && $orderpayment[0] != '') { $selectors[] = '#__akeebasubs_subscriptions.processor IN (\''.implode("','", $orderpayment).'\')'; } // Filter by order price start $pricestart = $template->get('orderpricestart', 'order', false, 'float'); if ($pricestart) { $selectors[] = '#__akeebasubs_subscriptions.gross_amount >= '.$pricestart; } // Filter by order price end $priceend = $template->get('orderpriceend', 'order', false, 'float'); if ($priceend) { $selectors[] = '#__akeebasubs_subscriptions.gross_amount <= '.$priceend; } // Filter by order user id $orderuser = $template->get('orderuser', 'order', false); if ($orderuser && $orderuser[0] != '') { $selectors[] = '#__akeebasubs_subscriptions.user_id IN (\''.implode("','", $orderuser).'\')'; } // Filter by order product $orderproduct = $template->get('orderproduct', 'order', false); if ($orderproduct && $orderproduct[0] != '') { $selectors[] = '#__akeebasubs_subscriptions.akeebasubs_level_id IN (\''.implode("','", $orderproduct).'\')'; } // Check if we need to attach any selectors to the query if (count($selectors) > 0 ) $query->where(implode("\n AND ", $selectors)); // Check if we need to group the orders together $groupby = $template->get('groupby', 'general', false, 'bool'); if ($groupby) { $filter = $this->getFilterBy('groupby'); if (!empty($filter)) $query->group($filter); } // Order by set field $orderby = $this->getFilterBy('sort'); if (!empty($orderby)) $query->order($orderby); // Add a limit if user wants us to $limits = $this->getExportLimit(); // Execute the query $csvidb->setQuery($query, $limits['offset'], $limits['limit']); $csvilog->addDebug(JText::_('COM_CSVI_EXPORT_QUERY'), true); // There are no records, write SQL query to log if (!is_null($csvidb->getErrorMsg())) { $this->addExportContent(JText::sprintf('COM_CSVI_ERROR_RETRIEVING_DATA', $csvidb->getErrorMsg())); $this->writeOutput(); $csvilog->AddStats('incorrect', $csvidb->getErrorMsg()); } else { $logcount = $csvidb->getNumRows(); $jinput->set('logcount', $logcount); if ($logcount > 0) { while ($record = $csvidb->getRow()) { if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') $this->addExportContent($exportclass->NodeStart()); foreach ($export_fields as $column_id => $field) { $fieldname = $field->field_name; // Add the replacement if (isset($record->$fieldname)) $fieldvalue = CsviHelper::replaceValue($field->replace, $record->$fieldname); else $fieldvalue = ''; switch ($fieldname) { case 'net_amount': case 'tax_amount': case 'gross_amount': case 'prediscount_amount': case 'discount_amount': case 'affiliate_comission': $fieldvalue = number_format($fieldvalue, $template->get('export_price_format_decimal', 'general', 2, 'int'), $template->get('export_price_format_decsep', 'general'), $template->get('export_price_format_thousep', 'general')); if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; case 'publish_up': case 'publish_down': case 'created_on': case 'first_contact': case 'second_contact': $date = JFactory::getDate($record->$fieldname); $fieldvalue = CsviHelper::replaceValue($field->replace, date($template->get('export_date_format', 'general'), $date->toUnix())); $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; default: // Check if we have any content otherwise use the default value if (strlen(trim($fieldvalue)) == 0) $fieldvalue = $field->default_value; $this->addExportField($field->combine, $fieldvalue, $fieldname, $field->column_header); break; } } if ($template->get('export_file', 'general') == 'xml' || $template->get('export_file', 'general') == 'html') { $this->addExportContent($exportclass->NodeEnd()); } // Output the contents $this->writeOutput(); } } else { $this->addExportContent(JText::_('COM_CSVI_NO_DATA_FOUND')); // Output the contents $this->writeOutput(); } } } } ?>export/.htaccess000066600000000177151453251110007672 0ustar00 Order allow,deny Deny from all import/index.html000066600000000054151453251110010054 0ustar00import/subscriptionimport.php000066600000013502151453251110012551 0ustar00_loadTables(); $this->loadSettings(); // Set some initial values $this->date = JFactory::getDate(); } /** * Here starts the processing * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function getStart() { // Load the data $this->loadData(); // Load the helper $this->helper = new Com_Akeebasubs(); // Get the logger $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // Process data foreach ($this->csvi_data as $name => $value) { // Check if the field needs extra treatment switch ($name) { case 'enabled': switch ($value) { case 'n': case 'N': case '0': $value = 0; break; default: $value = 1; break; } $this->published = $value; break; case 'subscription_delete': switch ($value) { case 'y': case 'Y': $this->$name = 'Y'; break; default: $this->$name = 'N'; break; } break; case 'net_amount': case 'tax_amount': case 'gross_amount': case 'affiliate_commision': case 'prediscount_amount': case 'discount_amount': $this->$name = $this->cleanPrice($value); break; case 'publish_up': case 'publish_down': $this->$name = $this->convertDate($value); break; case 'state': $this->_subscriptions->state = $value; break; default: $this->$name = $value; break; } } // All good return true; } /** * Process each record and store it in the database * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function getProcessRecord() { $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // See if we need to delete a subscription if ($this->subscription_delete == 'Y' && $this->akeebasubs_subscription_id) { $this->_deleteSubscription(); } else { // Check if we have a user ID if (!isset($this->user_id) && isset($this->username)) { $this->user_id = $this->helper->getUser($this->username); } // Check if we have a subscription title if (!isset($this->akeebasubs_level_id) && isset($this->subscription_title)) { $this->akeebasubs_level_id = $this->helper->getSubscription($this->subscription_title); } // Add a creating date if there is no product_id if (empty($this->akeebasubs_subscription_id)) { $this->_subscriptions->created_on = $this->date->toMySQL(); } // Bind the data $this->_subscriptions->bind($this); // Check the data $this->_subscriptions->check(); // Store the data if ($this->_subscriptions->store()) { if ($this->queryResult() == 'UPDATE') $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_SUBSCRIPTION')); else $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_SUBSCRIPTION')); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_SUBSCRIPTION_NOT_ADDED', $this->_subscriptions->getError())); // Store the debug message $csvilog->addDebug(JText::_('COM_CSVI_SUBSCRIPTION_QUERY'), true); } // Clean the tables $this->cleanTables(); } /** * Load the coupon related tables * * @copyright * @author RolandD * @todo * @see * @access private * @param * @return * @since 3.0 */ private function _loadTables() { $this->_subscriptions = $this->getTable('subscriptions'); } /** * Cleaning the coupon related tables * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return * @since 3.0 */ protected function cleanTables() { $this->_subscriptions->reset(); // Clean local variables $class_vars = get_class_vars(get_class($this)); foreach ($class_vars as $name => $value) { if (substr($name, 0, 1) != '_') { $this->$name = $value; } } } /** * Delete a subscription * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 4.0 */ private function _deleteSubscription() { $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); if ($this->_subscriptions->delete($this->akeebasubs_subscription_id)) { $csvilog->AddStats('deleted', JText::sprintf('COM_CSVI_SUBSCRIPTION_DELETED', $this->akeebasubs_subscription_id)); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_SUBSCRIPTION_NOT_DELETED', $this->akeebasubs_subscription_id)); } } ?>import/couponimport.php000066600000011464151453251110011335 0ustar00_loadTables(); $this->loadSettings(); // Set some initial values $this->date = JFactory::getDate(); $this->csviuser = JFactory::getUser(); } /** * Here starts the processing * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function getStart() { // Load the data $this->loadData(); // Load the helper $this->helper = new Com_Akeebasubs(); // Get the logger $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // Process data foreach ($this->csvi_data as $name => $value) { // Check if the field needs extra treatment switch ($name) { case 'enabled': switch ($value) { case 'n': case 'N': case '0': $value = 0; break; default: $value = 1; break; } $this->published = $value; break; case 'value': $this->$name = $this->cleanPrice($value); break; case 'publish_up': case 'publish_down': $this->$name = $this->convertDate($value); break; default: $this->$name = $value; break; } } // All good return true; } /** * Process each record and store it in the database * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function getProcessRecord() { $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // Check if we have a user ID if (!isset($this->user) && isset($this->username)) { $this->user = $this->helper->getUser($this->username); } // Check if we have a subscription title if (!isset($this->subscriptions) && isset($this->subscription_title)) { $this->subscriptions = $this->helper->getSubscription($this->subscription_title); } // Set some basic values if (!isset($this->modified_on)) { $this->_coupons->modified_on = $this->date->toMySQL(); $this->_coupons->modified_by = $this->csviuser->id; } // Add a creating date if there is no product_id if (empty($this->akeebasubs_coupon_id)) { $this->_coupons->created_on = $this->date->toMySQL(); $this->_coupons->created_by = $this->csviuser->id; } // Bind the data $this->_coupons->bind($this); // Check the data $this->_coupons->check(); // Store the data if ($this->_coupons->store()) { if ($this->queryResult() == 'UPDATE') $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_COUPON')); else $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_COUPON')); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_COUPON_NOT_ADDED', $this->_coupons->getError())); // Store the debug message $csvilog->addDebug(JText::_('COM_CSVI_COUPON_QUERY'), true); // Clean the tables $this->cleanTables(); } /** * Load the coupon related tables * * @copyright * @author RolandD * @todo * @see * @access private * @param * @return * @since 3.0 */ private function _loadTables() { $this->_coupons = $this->getTable('coupons'); } /** * Cleaning the coupon related tables * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return * @since 3.0 */ protected function cleanTables() { $this->_coupons->reset(); // Clean local variables $class_vars = get_class_vars(get_class($this)); foreach ($class_vars as $name => $value) { if (substr($name, 0, 1) != '_') { $this->$name = $value; } } } } ?>import/affiliateimport.php000066600000014500151453251110011750 0ustar00_loadTables(); $this->loadSettings(); // Set some initial values $this->date = JFactory::getDate(); $this->csviuser = JFactory::getUser(); } /** * Here starts the processing * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function getStart() { // Load the data $this->loadData(); // Load the helper $this->helper = new Com_Akeebasubs(); // Get the logger $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // Process data foreach ($this->csvi_data as $name => $value) { // Check if the field needs extra treatment switch ($name) { case 'enabled': switch ($value) { case 'n': case 'N': case '0': $value = 0; break; default: $value = 1; break; } $this->published = $value; break; case 'commision': case 'amount': $this->$name = $this->cleanPrice($value); break; default: $this->$name = $value; break; } } // All good return true; } /** * Process each record and store it in the database * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 3.0 */ public function getProcessRecord() { $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // Check if we have a user ID if (!isset($this->user_id) && isset($this->username)) { $this->user_id = $this->helper->getUser($this->username); } if (!empty($this->user_id)) { // Bind the data $this->_affiliates->bind($this); // Check if the affiliate needs to be deleted if ($this->affiliate_delete == 'Y') { $this->_deleteAffiliate(); } else { // Check the data $this->_affiliates->check(); // Store the data if ($this->_affiliates->store()) { if ($this->queryResult() == 'UPDATE') $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_AFFILIATE')); else $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_AFFILIATE')); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_AFFILIATE_NOT_ADDED', $this->_affiliates->getError())); // Store the debug message $csvilog->addDebug(JText::_('COM_CSVI_AFFILIATE_QUERY'), true); // See if we have any affiliate payments to add if (isset($this->amount)) { if (!isset($this->created_on)) $this->created_on = $this->date->toMySQL(); // Bind the data $this->akeebasubs_affiliate_id = $this->_affiliates->akeebasubs_affiliate_id; $this->_affpayments->bind($this); // Check the data if ($this->_affpayments->check()) { // Store the data if ($this->_affpayments->store()) { if ($this->queryResult() == 'UPDATE') $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_AFFILIATEPAY')); else $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_AFFILIATEPAY')); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_AFFILIATEPAY_NOT_ADDED', $this->_affpayments->getError())); // Store the debug message $csvilog->addDebug(JText::_('COM_CSVI_AFFILIATEPAY_QUERY'), true); } } } } // Clean the tables $this->cleanTables(); } /** * Load the affiliate related tables * * @copyright * @author RolandD * @todo * @see * @access private * @param * @return * @since 3.0 */ private function _loadTables() { $this->_affiliates = $this->getTable('affiliates'); $this->_affpayments = $this->getTable('affpayments'); } /** * Cleaning the coupon related tables * * @copyright * @author RolandD * @todo * @see * @access protected * @param * @return * @since 3.0 */ protected function cleanTables() { $this->_affiliates->reset(); $this->_affpayments->reset(); // Clean local variables $class_vars = get_class_vars(get_class($this)); foreach ($class_vars as $name => $value) { if (substr($name, 0, 1) != '_') { $this->$name = $value; } } } /** * Delete an affiliate * * @copyright * @author RolandD * @todo * @see * @access public * @param * @return * @since 4.0 */ private function _deleteAffiliate() { $jinput = JFactory::getApplication()->input; $csvilog = $jinput->get('csvilog', null, null); // Check the data if ($this->_affiliates->check()) { if ($this->_affiliates->delete()) { $csvilog->AddStats('deleted', JText::sprintf('COM_CSVI_AFFILIATES_DELETED', $this->_affiliates->akeebasubs_affiliate_id)); // Delete all payments if ($this->_affpayments->delete($this->user_id)) { $csvilog->AddStats('deleted', JText::sprintf('COM_CSVI_AFFILIATESPAY_DELETED', $this->user_id)); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_AFFILIATESPAY_NOT_DELETED', $this->user_id)); } else $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_AFFILIATES_NOT_DELETED', $this->_affiliates->akeebasubs_affiliate_id)); } } } ?>import/.htaccess000066600000000177151453251110007663 0ustar00 Order allow,deny Deny from all export/subscription.xml000066600000004546151466425630011364 0ustar00 export/default_subscription.php000066600000006724151475530310013047 0ustar00
form->getLabel('orderuser', 'order'); ?>
form->getInput('orderuser', 'order'); ?>
form->getLabel('orderproduct', 'order'); ?>
form->getInput('orderproduct', 'order'); ?>
export/default_file.php000066600000012172151475530310011234 0ustar00