public function prepateData(&$post) { $jshopConfig = JSFactory::getConfig(); $usergroup = JSFactory::getTable('usergroup', 'jshop'); $dispatcher = JDispatcher::getInstance(); $this->default_usergroup = $usergroup->getDefaultUsergroup(); $post['username'] = $post['u_name']; if ($post['password_2'] != '') { $post['password2'] = $post['password_2']; } if ($post['f_name'] == "") { $post['f_name'] = $post['email']; } $post['name'] = $post['f_name'] . ' ' . $post['l_name']; if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } $post['lang'] = $jshopConfig->getLang(); $dispatcher->trigger('onBeforeRegister', array(&$post, &$this->default_usergroup, &$this->userparams)); }
public function prepateData(&$post) { $jshopConfig = JSFactory::getConfig(); if (!isset($post['password'])) { $post['password'] = ''; } if (!isset($post['password_2'])) { $post['password_2'] = ''; } if ($post['password2']) { $post['password_2'] = $post['password2']; } if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } unset($post['user_id']); if (!$this->admin_registration) { $post['lang'] = $jshopConfig->getLang(); unset($post['usergroup_id']); } }
function accountsave() { checkUserLogin(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $app = JFactory::getApplication(); JPluginHelper::importPlugin('jshoppingcheckout'); $dispatcher = JDispatcher::getInstance(); $jshopConfig = JSFactory::getConfig(); $user_shop = JTable::getInstance('userShop', 'jshop'); $post = JRequest::get('post'); if (!isset($post['password'])) { $post['password'] = ''; } if (!isset($post['password_2'])) { $post['password_2'] = ''; } if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } $dispatcher->trigger('onBeforeAccountSave', array(&$post)); unset($post['user_id']); unset($post['usergroup_id']); $user_shop->load($user->id); $user_shop->bind($post); $user_shop->password = $post['password']; $user_shop->password2 = $post['password_2']; if (!$user_shop->check("editaccount")) { JError::raiseWarning('', $user_shop->getError()); $this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=editaccount", 0, 1, $jshopConfig->use_ssl)); return 0; } unset($user_shop->password); unset($user_shop->password2); if (!$user_shop->store()) { JError::raiseWarning(500, _JSHOP_REGWARN_ERROR_DATABASE); $this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=editaccount", 0, 1, $jshopConfig->use_ssl)); return 0; } $user = new JUser($user->id); if (!$jshopConfig->not_update_user_joomla) { if ($user_shop->email) { $user->email = $user_shop->email; } if ($user_shop->f_name || $user_shop->l_name) { $user->name = $user_shop->f_name . ' ' . $user_shop->l_name; } } if ($post['password'] != '') { $data = array("password" => $post['password'], "password2" => $post['password']); $user->bind($data); } $user->save(); $data = array(); $data['email'] = $user->email; $data['name'] = $user->name; $app->setUserState('com_users.edit.profile.data', $data); setNextUpdatePrices(); $dispatcher->trigger('onAfterAccountSave', array()); $this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=myaccount", 0, 1, $jshopConfig->use_ssl), _JSHOP_ACCOUNT_UPDATE); }
function step2save() { $checkout = JModelLegacy::getInstance('checkout', 'jshop'); $checkout->checkStep(2); JPluginHelper::importPlugin('jshoppingcheckout'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onLoadCheckoutStep2save', array()); $cart = JModelLegacy::getInstance('cart', 'jshop'); $cart->load(); $session = JFactory::getSession(); $jshopConfig = JSFactory::getConfig(); $post = JRequest::get('post'); if (!count($post)) { JError::raiseWarning("", _JSHOP_ERROR_DATA); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 0, 1, $jshopConfig->use_ssl)); return 0; } if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } unset($post['user_id']); unset($post['usergroup_id']); $user = JFactory::getUser(); if ($user->id) { $adv_user = JTable::getInstance('userShop', 'jshop'); $adv_user->load($user->id); } else { $adv_user = JSFactory::getUserShopGuest(); } $adv_user->bind($post); if (!$adv_user->check("address")) { JError::raiseWarning("", $adv_user->getError()); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 0, 1, $jshopConfig->use_ssl)); return 0; } $dispatcher->trigger('onBeforeSaveCheckoutStep2', array(&$adv_user, &$user, &$cart)); if (!$adv_user->store()) { JError::raiseWarning(500, _JSHOP_REGWARN_ERROR_DATABASE); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 0, 1, $jshopConfig->use_ssl)); return 0; } if ($user->id && !$jshopConfig->not_update_user_joomla) { $user = clone JFactory::getUser(); if ($adv_user->email) { $user->email = $adv_user->email; } if ($adv_user->f_name || $adv_user->l_name) { $user->name = $adv_user->f_name . " " . $adv_user->l_name; } if ($adv_user->f_name || $adv_user->l_name || $adv_user->email) { $user->save(); } } setNextUpdatePrices(); $cart->setShippingId(0); $cart->setShippingPrId(0); $cart->setShippingPrice(0); $cart->setPaymentId(0); $cart->setPaymentParams(""); $cart->setPaymentPrice(0); $dispatcher->trigger('onAfterSaveCheckoutStep2', array(&$adv_user, &$user, &$cart)); if ($jshopConfig->without_shipping && $jshopConfig->without_payment) { $checkout->setMaxStep(5); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl)); return 0; } if ($jshopConfig->without_payment) { $checkout->setMaxStep(4); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step4', 0, 1, $jshopConfig->use_ssl)); return 0; } if ($jshopConfig->step_4_3) { if ($jshopConfig->without_shipping) { $checkout->setMaxStep(3); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3', 0, 1, $jshopConfig->use_ssl)); return 0; } $checkout->setMaxStep(4); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step4', 0, 1, $jshopConfig->use_ssl)); } else { $checkout->setMaxStep(3); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3', 0, 1, $jshopConfig->use_ssl)); } }
function save() { $db = JFactory::getDBO(); $jshopConfig = JSFactory::getConfig(); $post = JRequest::get('post'); $client_id = JRequest::getInt('client_id', 0); $file_generete_pdf_order = $jshopConfig->file_generete_pdf_order; JPluginHelper::importPlugin('jshoppingadmin'); $dispatcher = JDispatcher::getInstance(); $order_id = intval($post['order_id']); $orders = $this->getModel("orders"); $order = JTable::getInstance('order', 'jshop'); $order->load($order_id); if (!$order_id) { $order->user_id = -1; $order->order_date = getJsDate(); $orderNumber = $jshopConfig->next_order_number; $jshopConfig->updateNextOrderNumber(); $order->order_number = $order->formatOrderNumber($orderNumber); $order->order_hash = md5(time() . $order->order_total . $order->user_id); $order->file_hash = md5(time() . $order->order_total . $order->user_id . "hashfile"); $order->ip_address = $_SERVER['REMOTE_ADDR']; $order->order_status = $jshopConfig->default_status_order; } $order->order_m_date = getJsDate(); $order_created_prev = $order->order_created; if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } if ($post['invoice_date']) { $post['invoice_date'] = getJsDateDB($post['invoice_date'], $jshopConfig->store_date_format); } if (!$jshopConfig->hide_tax) { $post['order_tax'] = 0; $order_tax_ext = array(); if (isset($post['tax_percent'])) { foreach ($post['tax_percent'] as $k => $v) { if ($post['tax_percent'][$k] != "" || $post['tax_value'][$k] != "") { $order_tax_ext[number_format($post['tax_percent'][$k], 2)] = $post['tax_value'][$k]; } } } $post['order_tax_ext'] = serialize($order_tax_ext); $post['order_tax'] = number_format(array_sum($order_tax_ext), 2); } $currency = JTable::getInstance('currency', 'jshop'); $currency->load($post['currency_id']); $post['currency_code'] = $currency->currency_code; $post['currency_code_iso'] = $currency->currency_code_iso; $post['currency_exchange'] = $currency->currency_value; $dispatcher->trigger('onBeforeSaveOrder', array(&$post, &$file_generete_pdf_order)); $order->bind($post); $order->store(); $order_id = $order->order_id; $order_items = $order->getAllItems(); $orders->saveOrderItem($order_id, $post, $order_items); JSFactory::loadLanguageFile($order->getLang()); if ($jshopConfig->order_send_pdf_client || $jshopConfig->order_send_pdf_admin) { $order->load($order_id); $order->items = null; $order->products = $order->getAllItems(); JSFactory::loadLanguageFile($order->getLang()); $lang = JSFactory::getLang($order->getLang()); $order->order_date = strftime($jshopConfig->store_date_format, strtotime($order->order_date)); $order->order_tax_list = $order->getTaxExt(); $country = JTable::getInstance('country', 'jshop'); $country->load($order->country); $field_country_name = $lang->get("name"); $order->country = $country->{$field_country_name}; $d_country = JTable::getInstance('country', 'jshop'); $d_country->load($order->d_country); $field_country_name = $lang->get("name"); $order->d_country = $d_country->{$field_country_name}; $shippingMethod = JTable::getInstance('shippingMethod', 'jshop'); $shippingMethod->load($order->shipping_method_id); $pm_method = JTable::getInstance('paymentMethod', 'jshop'); $pm_method->load($order->payment_method_id); $name = $lang->get("name"); $description = $lang->get("description"); $order->shipping_information = $shippingMethod->{$name}; $order->payment_name = $pm_method->{$name}; $order->payment_information = $order->payment_params; if ($jshopConfig->order_send_pdf_client || $jshopConfig->order_send_pdf_admin) { include_once $file_generete_pdf_order; $order->pdf_file = generatePdf($order); $order->insertPDF(); } } if ($order->order_created == 1 && $order_created_prev == 0) { $order->items = null; JSFactory::loadLanguageFile($order->getLang()); JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jshopping/models'); $checkout = JModelLegacy::getInstance('checkout', 'jshop'); if ($jshopConfig->send_order_email) { $checkout->sendOrderEmail($order_id, 1); } } JSFactory::loadAdminLanguageFile(); $dispatcher->trigger('onAfterSaveOrder', array(&$order, &$file_generete_pdf_order)); $this->setRedirect("index.php?option=com_jshopping&controller=orders&client_id=" . $client_id); }
public function doReg() { require_once JPATH_ROOT . "/components/com_jshopping/lib/functions.php"; //echo'<pre>';print_r($_POST);echo'</pre>';die; $mainframe = JFactory::getApplication(); $jshopConfig = JSFactory::getConfig(); $config = JFactory::getConfig(); $db = JFactory::getDBO(); $params = JComponentHelper::getParams('com_users'); $lang = JFactory::getLanguage(); $lang->load('com_users'); $post = JRequest::get('post'); // if ($user->guest) { // $redirecturl = base64_encode("index.php?option=com_hostorder"); // $joomlaLoginUrl = 'index.php?option=com_user&view=login&return='; // $finalUrl = $joomlaLoginUrl.$redirecturl; // // global $mainframe; // $mainframe->redirect($finalUrl); //echo'<pre>';print_r($post);echo'</pre>';die; if ($this->checkThisEmail($post['email']) == false) { $this->checkUserLogin(); } $usergroup = JSFactory::getTable('usergroup', 'jshop'); $default_usergroup = $usergroup->getDefaultUsergroup(); $post['username'] = $post['email']; $post['password2'] = $post['password_2']; if ($post['f_name'] == "") { $post['f_name'] = $post['email']; } $post['name'] = $post['f_name'] . ' ' . $post['l_name']; if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } saveToLog('error.log', 'aad reg'); $post['lang'] = $jshopConfig->getLang(); $post["password"] = substr(md5('up' . time()), 0, 8); $row = JSFactory::getTable('userShop', 'jshop'); $row->bind($post); $row->user_id = 0; $row->u_name = $post['f_name'] . ' ' . $post['l_name']; $row->usergroup_id = $default_usergroup; $row->password = $post['password']; $row->password2 = $post['password']; //echo'<pre>';print_r($row);echo'</pre>';die; $row->check("register"); //echo'<pre>';var_dump($row->check("register"));echo'</pre>';die; if ($post["u_name"] == "") { $post["u_name"] = $post['email']; $row->u_name = $post["u_name"]; } $user = new JUser(); $data = array(); $data['groups'][] = $params->get('new_usertype', 2); $data['email'] = $post['email']; $data['password'] = $post['password']; $data['password2'] = $post['password']; $data['name'] = $post['f_name'] . ' ' . $post['l_name']; $data['username'] = $post["u_name"]; $useractivation = $params->get('useractivation'); $sendpassword = $params->get('sendpassword', 1); $user->bind($data); if (!$user->save()) { JError::raiseWarning('', $user->getError()); saveToLog('error.log', 'Error registration-' . $user->getError()); $mainframe->redirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl)); return 0; } $row->user_id = $user->id; $row->number = $row->getNewUserNumber(); unset($row->password); unset($row->password2); if (!$db->insertObject($row->getTableName(), $row, $row->getKeyName())) { saveToLog('error.log', $db->getErrorMsg()); JError::raiseWarning('', "Error insert in table " . $row->getTableName()); $mainframe->redirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl)); return 0; } $session = JFactory::getSession(); $session->set("order_user_id", $user->id); saveToLog('error.log', $user->id); $data = $user->getProperties(); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['siteurl'] = JUri::base(); $emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']); if ($sendpassword) { $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY', $data['name'], $data['sitename'], $data['siteurl'], $data['username'], $data['password_clear']); } else { $emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_BODY_NOPW', $data['name'], $data['sitename'], $data['siteurl']); } $mailer = JFactory::getMailer(); $mailer->setSender(array($data['mailfrom'], $data['fromname'])); $mailer->addRecipient($data['email']); $mailer->setSubject($emailSubject); $mailer->setBody($emailBody); $mailer->isHTML(false); $mailer->Send(); $options = array(); $options['remember'] = false; //$options['return'] = JURI::root(); $credentials = array(); $credentials['username'] = $post['email']; $credentials['password'] = $post['password']; //$dispatcher = JDispatcher::getInstance(); //$dispatcher->trigger( 'onBeforeLogin', array(&$options, &$credentials) ); //$error = $mainframe->login($credentials, $options); //echo'<pre>';print_r($mainframe);echo'</pre>';die; if ($return = JRequest::getVar('return', '', 'method', 'base64')) { $return = base64_decode($return); if (!JURI::isInternal($return)) { $return = ''; } } }
function save() { $jshopConfig = JSFactory::getConfig(); $db = JFactory::getDBO(); $apply = JRequest::getVar("apply"); JSFactory::loadLanguageFile(); $dispatcher = JDispatcher::getInstance(); $user_shop = JSFactory::getTable('userShop', 'jshop'); $user_id = JRequest::getInt("user_id"); $post = JRequest::get("post"); if ($post['f_name'] == "") { $post['f_name'] = $post['email']; } if (!$user_id) { $params = JComponentHelper::getParams('com_users'); $user_shop->bind($post); $user_shop->password = $post['password']; $user_shop->password2 = $post['password2']; if (!$user_shop->check("editaccountadmin.edituser")) { JError::raiseWarning('', $user_shop->getError()); $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit"); return 0; } $user = new JUser(); $data = array(); $data['groups'][] = $params->get('new_usertype', 2); $data['email'] = $post['email']; $data['password'] = $post['password']; $data['password2'] = $post['password2']; $data['name'] = $post['f_name'] . ' ' . $post['l_name']; $data['username'] = $post["u_name"]; $user->bind($data); if (!$user->save()) { JError::raiseWarning('', $user->getError()); $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit"); return 0; } $user_id = $user->id; unset($user); $user_shop->user_id = $user_id; $user_shop->number = $user_shop->getNewUserNumber(); unset($user_shop->password); unset($user_shop->password2); if (!$db->insertObject($user_shop->getTableName(), $user_shop, $user_shop->getKeyName())) { JError::raiseWarning('', "Error insert in table " . $user_shop->getTableName()); $this->setRedirect("index.php?option=com_jshopping&controller=users"); return 0; } $post['user_id'] = $user_id; if (!$post['number']) { $post['number'] = $user_shop->number; } } $user_shop->load($user_id); $dispatcher->trigger('onBeforeSaveUser', array(&$post)); if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } $user_shop->bind($post); $user_shop->password = JRequest::getVar('password'); $user_shop->password2 = JRequest::getVar('password2'); if (!$user_shop->check("editaccountadmin.edituser")) { JError::raiseWarning("", $user_shop->getError()); $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit&user_id=" . $user_shop->user_id); return 0; } unset($user_shop->password); unset($user_shop->password2); if (!$user_shop->store()) { JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE); $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit&user_id=" . $user_shop->user_id); return 0; } $user = new JUser($user_id); $data['email'] = JRequest::getVar("email"); $data['password'] = JRequest::getVar("password"); $data['password2'] = JRequest::getVar("password2"); $data['name'] = JRequest::getVar("f_name"); $data['username'] = JRequest::getVar("u_name"); $data['block'] = JRequest::getVar("block"); $user->bind($data); $user->save(true); $dispatcher->trigger('onAfterSaveUser', array(&$user, &$user_shop)); if ($this->getTask() == 'apply') { $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit&user_id=" . $user_shop->user_id); } else { $this->setRedirect("index.php?option=com_jshopping&controller=users"); } }
function save() { $db = JFactory::getDBO(); $jshopConfig = JSFactory::getConfig(); $post = JRequest::get('post'); $client_id = JRequest::getInt('client_id', 0); $file_generete_pdf_order = $jshopConfig->file_generete_pdf_order; $dispatcher = JDispatcher::getInstance(); $order_id = intval($post['order_id']); $orders = JSFactory::getModel("orders"); $order = JSFactory::getTable('order', 'jshop'); $order->load($order_id); if (!$order_id) { $order->user_id = -1; $order->order_date = getJsDate(); $orderNumber = $jshopConfig->next_order_number; $jshopConfig->updateNextOrderNumber(); $order->order_number = $order->formatOrderNumber($orderNumber); $order->order_hash = md5(time() . $order->order_total . $order->user_id); $order->file_hash = md5(time() . $order->order_total . $order->user_id . "hashfile"); $order->ip_address = $_SERVER['REMOTE_ADDR']; $order->order_status = $jshopConfig->default_status_order; } $order->order_m_date = getJsDate(); $order_created_prev = $order->order_created; if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } if ($post['invoice_date']) { $post['invoice_date'] = getJsDateDB($post['invoice_date'], $jshopConfig->store_date_format); } if (!$jshopConfig->hide_tax) { $post['order_tax'] = 0; $order_tax_ext = array(); if (isset($post['tax_percent'])) { foreach ($post['tax_percent'] as $k => $v) { if ($post['tax_percent'][$k] != "" || $post['tax_value'][$k] != "") { $order_tax_ext[number_format($post['tax_percent'][$k], 2)] = $post['tax_value'][$k]; } } } $post['order_tax_ext'] = serialize($order_tax_ext); $post['order_tax'] = number_format(array_sum($order_tax_ext), 2); } $currency = JSFactory::getTable('currency', 'jshop'); $currency->load($post['currency_id']); $post['currency_code'] = $currency->currency_code; $post['currency_code_iso'] = $currency->currency_code_iso; $post['currency_exchange'] = $currency->currency_value; $dispatcher->trigger('onBeforeSaveOrder', array(&$post, &$file_generete_pdf_order, &$order)); $order->bind($post); $order->delivery_times_id = $post['order_delivery_times_id']; $order->store(); $order_id = $order->order_id; $order_items = $order->getAllItems(); $orders->saveOrderItem($order_id, $post, $order_items); $order->items = null; $vendor_id = $order->getVendorIdForItems(); $order->vendor_id = $vendor_id; $order->store(); JSFactory::loadLanguageFile($order->getLang()); $lang = JSFactory::getLang($order->getLang()); $order->items = null; if ($order->order_created == 1 && $order_created_prev == 0) { $order->updateProductsInStock(1); $checkout = JSFactory::getModel('checkout', 'jshop'); if ($jshopConfig->send_order_email) { $checkout->sendOrderEmail($order_id, 1); } } elseif ($order->order_created == 1 && $jshopConfig->generate_pdf) { $order->load($order_id); $order->prepareOrderPrint(); $order->generatePdf($file_generete_pdf_order); } JSFactory::loadAdminLanguageFile(); $dispatcher->trigger('onAfterSaveOrder', array(&$order, &$file_generete_pdf_order)); $this->setRedirect("index.php?option=com_jshopping&controller=orders&client_id=" . $client_id); }
function save() { $jshopConfig = JSFactory::getConfig(); $apply = JRequest::getVar("apply"); JSFactory::loadLanguageFile(); JPluginHelper::importPlugin('jshoppingadmin'); $dispatcher = JDispatcher::getInstance(); $user_shop = JTable::getInstance('userShop', 'jshop'); $user_id = JRequest::getInt("user_id"); $user_shop->load($user_id); $post = JRequest::get("post"); $dispatcher->trigger('onBeforeSaveUser', array(&$post)); if ($post['birthday']) { $post['birthday'] = getJsDateDB($post['birthday'], $jshopConfig->field_birthday_format); } if ($post['d_birthday']) { $post['d_birthday'] = getJsDateDB($post['d_birthday'], $jshopConfig->field_birthday_format); } $user_shop->bind($post); $user_shop->password = JRequest::getVar('password'); $user_shop->password2 = JRequest::getVar('password2'); if (!$user_shop->check("editaccountadmin.edituser")) { JError::raiseWarning("", $user_shop->getError()); $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit&user_id=" . $user_shop->user_id); return 0; } unset($user_shop->password); unset($user_shop->password2); if (!$user_shop->store()) { JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE); $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit&user_id=" . $user_shop->user_id); return 0; } $user = new JUser($user_id); $data['email'] = JRequest::getVar("email"); $data['password'] = JRequest::getVar("password"); $data['password2'] = JRequest::getVar("password2"); $data['name'] = JRequest::getVar("f_name"); $data['username'] = JRequest::getVar("u_name"); $data['block'] = JRequest::getVar("block"); $user->bind($data); $user->save(true); $dispatcher->trigger('onAfterSaveUser', array(&$user, &$user_shop)); if ($this->getTask() == 'apply') { $this->setRedirect("index.php?option=com_jshopping&controller=users&task=edit&user_id=" . $user_shop->user_id); } else { $this->setRedirect("index.php?option=com_jshopping&controller=users"); } }