コード例 #1
0
ファイル: default.php プロジェクト: jaanusnurmoja/redjoomla
if (!JRequest::getvar('ajaxtask')) {
    ?>
<input type="hidden" name="ip_address" value="<?php 
    echo $ip;
    ?>
"/>
<input type="hidden" name="cdate" value="<?php 
    echo time();
    ?>
"/>
<input type="hidden" name="mdate" value="<?php 
    echo time();
    ?>
"/>
<input type="hidden" name="encr_key" value="<?php 
    echo $order_functions->random_gen_enc_key();
    ?>
"/>

<input type="hidden" name="cid[]" value="<?php 
    echo $this->detail->order_id;
    ?>
"/>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="option" value="<?php 
    echo $option;
    ?>
"/>
<input type="hidden" name="view" value="addorder_detail"/>
</form>
	<div id="divCalc"></div>
コード例 #2
0
 public function usercreate($data)
 {
     $redshopMail = new redshopMail();
     $order_functions = new order_functions();
     $Itemid = JRequest::getVar('Itemid');
     $app = JFactory::getApplication();
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway = $app->getPathway();
     $config = JFactory::getConfig();
     $authorize = JFactory::getACL();
     $document = JFactory::getDocument();
     $MailFrom = $app->getCfg('mailfrom');
     $FromName = $app->getCfg('fromname');
     $SiteName = $app->getCfg('sitename');
     $usersConfig = JComponentHelper::getParams('com_users');
     $usersConfig->set('allowUserRegistration', 1);
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('COM_REDSHOP_ACCESS_FORBIDDEN'));
         return;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!$newUsertype) {
         $newUsertype = 'Registered';
     }
     // Bind the post array to the user object
     if (!$user->bind(JRequest::get('post'), 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', 'Registered');
     $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     $date = JFactory::getDate();
     $user->set('registerDate', $date->toMySQL());
     $useractivation = $usersConfig->get('useractivation');
     if ($useractivation == '1') {
         JLoader::import('joomla.user.helper');
         $user->set('block', '0');
     }
     if ($data['is_company'] == 1) {
         $tmp = @explode(" ", $data['contact_person']);
         $name = @$tmp[0] . ' ' . $tmp[1];
         $name = JRequest::getVar('username');
     } else {
         $name = JRequest::getVar('firstname') . ' ' . JRequest::getVar('lastname');
     }
     $email = JRequest::getVar('email');
     $password = $order_functions->random_gen_enc_key(12);
     // Disallow control chars in the email
     $password = preg_replace('/[\\x00-\\x1F\\x7F]/', '', $password);
     $user->password = md5($password);
     $user->set('name', $name);
     $user->name = $name;
     // If there was an error with registration, set the message and display form
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         return false;
     }
     $user_id = $user->id;
     $user->set('id', 0);
     if ($useractivation == 1) {
         $message = JText::_('COM_REDSHOP_REG_COMPLETE_ACTIVATE');
     } else {
         $message = JText::_('COM_REDSHOP_REG_COMPLETE');
     }
     // Creating Joomla user end
     $row = $this->getTable('user_detail');
     $row->user_id = $user_id;
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if ($data['is_company'] == 1) {
         if (SHOPPER_GROUP_DEFAULT_COMPANY != 0) {
             $row->shopper_group_id = SHOPPER_GROUP_DEFAULT_COMPANY;
         } else {
             $row->shopper_group_id = 2;
         }
     } else {
         if (SHOPPER_GROUP_DEFAULT_PRIVATE != 0) {
             $row->shopper_group_id = SHOPPER_GROUP_DEFAULT_PRIVATE;
         } else {
             $row->shopper_group_id = 1;
         }
     }
     if ($data['is_company'] == 1) {
         $tmp = explode(" ", $data['contact_person']);
         $row->firstname = $tmp[0];
         $row->lastname = $tmp[1];
     }
     $row->user_email = $user->email;
     $row->address_type = 'BT';
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $email = $user->email;
     $quotation_id = $quotationDetail->quotation_id;
     $quotationdetailurl = JURI::root() . 'index.php?option=com_redshop&view=quotation_detail&quoid=' . $quotation_id . '&encr=' . $quotationDetail->quotation_encrkey;
     $mailbody = '<table>';
     $mailbody .= '<tr><td>' . JText::_('COM_REDSHOP_USERNAME') . '</td><td> : </td><td>' . $data['username'] . '</td></tr>';
     $mailbody .= '<tr><td>' . JText::_('COM_REDSHOP_PASSWORD') . '</td><td> : </td><td>' . $password . '</td></tr>';
     $mailbody .= '<tr><td>' . JText::_('COM_REDSHOP_QUOTATION_DETAILS') . '</td><td> : </td><td><a href="' . $quotationdetailurl . '">' . JText::_("COM_REDSHOP_QUOTATION_DETAILS") . '</a></td></tr>';
     $mailbody .= '</table>';
     $mailsubject = 'Register';
     $mailbcc = null;
     $mailinfo = $redshopMail->getMailtemplate(0, "quotation_user_register");
     if (count($mailinfo) > 0) {
         $mailbody = $mailinfo[0]->mail_body;
         $mailsubject = $mailinfo[0]->mail_subject;
         if (trim($mailinfo[0]->mail_bcc) != "") {
             $mailbcc = explode(",", $mailinfo[0]->mail_bcc);
         }
     }
     $producthelper = new producthelper();
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     $user = JFactory::getUser();
     $cart['user_id'] = $user_id;
     $user_data = $producthelper->getUserInformation($user_id);
     $cart['user_info_id'] = $user_data->users_info_id;
     $quotationDetail = $this->store($cart);
     $this->sendQuotationMail($quotationDetail->quotation_id);
     $link = "<a href='" . $quotationdetailurl . "'>" . JText::_("COM_REDSHOP_QUOTATION_DETAILS") . "</a>";
     $mailbody = str_replace('{link}', $link, $mailbody);
     $mailbody = str_replace('{username}', $name, $mailbody);
     $mailbody = str_replace('{password}', $name, $mailbody);
     JFactory::getMailer()->sendMail($MailFrom, $FromName, $email, $mailsubject, $mailbody, 1, null, $mailbcc);
     $session = JFactory::getSession();
     $session->set('cart', null);
     $session->set('ccdata', null);
     $session->set('issplit', null);
     $session->set('userfiled', null);
     unset($_SESSION['ccdata']);
     return;
 }