public function importPagescheme($file) { $file = ROOTPATH . 'themes' . DS . $file; require_once ROOTPATH . 'lib' . DS . 'zip' . DS . 'zip.php'; $archive = new PclZip($file); $this->targetFolder = 'temp' . date('YmdHis'); $archive->extract(PCLZIP_OPT_PATH, ROOTPATH . 'themes' . DS . $this->targetFolder); $info = $this->getMainInfo(); $seo = Core::clearUTF(trim($info['name'])); $seo = preg_replace('/[^A-Za-z0-9\\-\\s\\s+]/', '', $seo); $seo = Core::clearSeoUTF($seo); $this->templateFolder = str_replace('/', '', strtolower($seo)); if (is_dir(ROOTPATH . 'themes' . DS . $this->templateFolder)) { $this->templateFolder = $this->templateFolder . date('YmdHis'); $info['name'] = $info['name'] . ' (Kopia ' . date('Y-m-d H:i:s') . ')'; } rename(ROOTPATH . 'themes' . DS . $this->targetFolder, ROOTPATH . 'themes' . DS . $this->templateFolder); $this->getImportData(); Db::getInstance()->beginTransaction(); if (!empty($this->importData)) { $this->pageSchemeId = App::getModel('pagescheme')->addPageScheme(array('name' => $info['name'], 'templatefolder' => $this->templateFolder)); $this->saveBoxes($this->importData['boxes'], $this->pageSchemeId); $this->saveSubpages($this->importData['layouts'], $this->pageSchemeId); } Db::getInstance()->commit(); $this->clearCache(ROOTPATH . DS . 'serialization', false); $this->clearCache(ROOTPATH . DS . 'cache', false); }
public function index() { if (Session::getActiveUserid() != null) { App::redirect(__ADMINPANE__ . '/mainside'); } $form = new FormEngine\Elements\Form(array('name' => 'forgotlogin', 'action' => '', 'method' => 'post', 'class' => 'login-form')); $form->AddChild(new FormEngine\Elements\TextField(array('name' => 'login', 'label' => _('TXT_EMAIL_FORM_LOGIN'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_LOGIN_FORM_LOGIN')))))); $form->AddChild(new FormEngine\Elements\Submit(array('name' => 'log_in', 'label' => _('TXT_FORGOT_PASSWORD')))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\NoCode()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $loginValues = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $result = App::getModel('login')->checkUsers($loginValues['login']); if ($result == 0) { Session::setVolatileLoginError(1, false); } else { $password = Core::passwordGenerate(); App::getModel('login')->changeUsersPassword($result, $password); $this->registry->template->assign('password', $password); App::getModel('mailer')->sendEmail(array('template' => 'forgotUsers', 'email' => array($_POST['login']), 'bcc' => false, 'subject' => _('TXT_FORGOT_PASSWORD'), 'viewid' => Helper::getViewId())); Session::setVolatileMessage("Nowe hasło zostało wysłane na podany adres e-mail."); App::redirect('login'); } } $error = Session::getVolatileLoginError(); if ($error[0] == 1) { $this->registry->template->assign('error', _('ERR_BAD_EMAIL')); } $languages = App::getModel('language')->getLanguages(); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->assign('form', $form->Render()); $this->registry->template->assign('languages', json_encode($languages)); $this->registry->template->display($this->loadTemplate('index.tpl')); }
public function saveOrder($Data) { $objResponse = new xajaxResponse(); try { $order = $this->setClientOrder($Data); if ($order != NULL) { if (empty($order['dispatchmethod'])) { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "', '" . _('ERR_NO_DELIVERY_SELECTED') . "');"); return $objResponse; } if (empty($order['payment'])) { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "', '" . _('ERR_NO_PAYMENT_SELECTED') . "');"); return $objResponse; } $saveOrder = App::getModel('order')->saveOrder($order); $clientid = Session::getActiveClientid(); Session::setActiveorderid($saveOrder); $email = $order['contactData']['email']; $orderid = Session::getActiveorderid(); $orderlink = App::getModel('order')->generateOrderLink($orderid); if ($orderlink != NULL && $orderid != NULL) { App::getModel('order')->changeOrderLink($orderid, $orderlink); $banktransfer = $this->registry->core->loadModuleSettings('banktransfer', Helper::getViewId()); $payment_model = App::getModel('Admin/paymentmethod/paymentmethod')->getPaymentmethodModelById($order['payment']['idpaymentmethod']); $this->registry->template->assign('order', $order); $this->registry->template->assign('orderId', $orderid); $this->registry->template->assign('orderlink', $orderlink); $this->registry->template->assign('paymentmodel', $payment_model); $this->registry->template->assign('bankdata', $banktransfer); $mailer = App::getModel('mailer'); if (!empty($this->layer['terms'])) { $mailer->AddAttachment('./upload/' . $this->layer['terms'], Core::clearUTF(_('TXT_CONDITIONS')) . '.pdf'); } $mailer->sendEmail(array('template' => 'orderClient', 'email' => array($email), 'bcc' => true, 'subject' => _('TXT_ORDER_CLIENT') . ': ' . $orderid, 'viewid' => Helper::getViewId())); Session::unsetActiveCart(); Session::unsetActiveglobalPriceWithDispatchmethod(); Session::unsetActiveglobalPriceWithDispatchmethodNetto(); Session::unsetActiveDispatchmethodChecked(); Session::unsetActivePaymentMethodChecked(); Session::unsetActiveGlobalPrice(); Session::unsetActiveGlobalPriceWithoutVat(); $paymentMethodData = array('orderId' => Session::getActiveorderid(), 'orderData' => Session::getActiveClientOrder()); Session::setActivePaymentData($paymentMethodData); Session::unsetActiveorderid(); Session::unsetActiveClientOrder(); App::getModel('dataset')->flushCache(); $url = $this->registry->router->generate('frontend.payment', true, array('action' => 'accept')); $objResponse->script("window.location.href = '{$url}';"); } } else { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "','" . _('ERR_ORDER_NOT_DEFINED') . "');"); } } catch (Exception $e) { $objResponse->script("GError('" . _('ERR_ORDER_SAVE') . "','" . _('ERR_ORDER_SAVE_MSG') . "');"); } return $objResponse; }
public function edit() { $integrationModel = $this->model->getIntegrationModelById($this->id); if (empty($integrationModel)) { App::redirect(__ADMINPANE__ . '/integration'); } $form = new FormEngine\Elements\Form(array('name' => 'edit_integration', 'action' => '', 'method' => 'post')); if (method_exists(App::getModel('integration/' . $integrationModel), 'updateCategories')) { App::getModel('integration/' . $integrationModel)->updateCategories(); } $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_INFORMATION')))); $requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . App::getModel('integration/' . $integrationModel)->getDescription() . '</p>'))); $url = $this->registry->router->generate('frontend.integration', true, array('param' => $integrationModel)); $requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p><a href="' . $url . '" target="_blank"><b>Link do pliku integracyjnego</b></a></p>'))); $configurationFields = App::getModel('integration/' . $integrationModel)->getConfigurationFields(); if (is_array($configurationFields) && !empty($configurationFields)) { $configurationData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'configuration_data', 'label' => _('TXT_CONFIGURATION_DATA')))); } $whitelist = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'whitelist_data', 'label' => _('TXT_INTEGRATION_WHITELIST')))); $whitelist->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_INTEGRATION_WHITELIST_HELP') . '</p>'))); $whitelist->AddChild(new FormEngine\Elements\StaticText(array('text' => '<strong>Twój adres IP: ' . Core::getRealIpAddress() . '</strong>'))); $fieldset = $whitelist->AddChild(new FormEngine\Elements\FieldsetRepeatable(array('name' => 'whitelist', 'label' => _('TXT_INTEGRATION_WHITELIST'), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE))); $fieldset->AddChild(new FormEngine\Elements\TextField(array('name' => 'ip', 'label' => 'IP'))); $rawData = $this->model->getIntegrationView($this->id); $pollData = array('whitelist_data' => array('whitelist' => $rawData['whitelist'])); $form->Populate($pollData); $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editIntegration($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/integration'); } $this->registry->template->assign('form', $form->Render()); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->display($this->loadTemplate('edit.tpl')); }
public function add() { $this->registry->xajaxInterface->registerFunction(array('AddClientGroup', App::getModel('clientgroup'), 'addEmptyClientGroup')); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { $generatedPassword = Core::passwordGenerate(); $clientId = $this->model->addNewClient($form->getSubmitValues(), $generatedPassword); $Data = $form->getSubmitValues(); $Data['personal_data']['password'] = $generatedPassword; $this->registry->template->assign('personal_data', $Data['personal_data']); $this->registry->template->assign('address', $Data['billing_data']); App::getModel('mailer')->sendEmail(array('template' => 'addClientFromAdmin', 'email' => array($Data['personal_data']['email']), 'bcc' => false, 'subject' => Translation::get('TXT_REGISTRATION_NEW'), 'viewid' => $Data['personal_data']['viewid'])); if (FormEngine\FE::IsAction('next')) { App::redirect(__ADMINPANE__ . '/client/add'); } else { App::redirect(__ADMINPANE__ . '/client'); } } $this->renderLayout(array('form' => $form->Render())); }
protected final function insertFile($name) { $sql = 'INSERT INTO file(name, filetypeid, fileextensionid, viewid) VALUES (:name, :filetypeid, :fileextensionid, :viewid)'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('name', Core::clearUTF($name)); $stmt->bindValue('filetypeid', current($this->fileType)); $stmt->bindValue('viewid', Helper::getViewId()); $stmt->bindValue('fileextensionid', $this->allowedExtensions[strtolower($this->tmpExtension)]); try { $stmt->execute(); } catch (Exception $e) { throw new Exception($e->getMessage()); } $idFile = Db::getInstance()->lastInsertId(); $this->insertedFileFullName = $idFile . '.' . $this->tmpExtension; $this->registry->cache->delete('files'); $this->setFiles(); return $idFile; }
public function getProducerAll($Categories = array()) { if (!empty($Categories)) { $sql = 'SELECT P.idproducer AS id, PT.name, PT.seo FROM producer P INNER JOIN product PR ON PR.producerid = P.idproducer LEFT JOIN productcategory PC ON PC.productid = PR.idproduct LEFT JOIN producertranslation PT ON PT.producerid = P.idproducer AND PT.languageid = :language WHERE PC.categoryid IN (' . Core::arrayAsString($Categories) . ') AND PR.enable = 1 GROUP BY P.idproducer ORDER BY PT.name ASC'; } else { $sql = 'SELECT P.idproducer AS id, PT.name, PT.seo FROM producer P LEFT JOIN producertranslation PT ON PT.producerid = P.idproducer AND PT.languageid = :language GROUP BY P.idproducer ORDER BY PT.name ASC'; } $Data = array(); $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('language', Helper::getLanguageId()); $stmt->execute(); while ($rs = $stmt->fetch()) { $Data[] = array('id' => $rs['id'], 'name' => $rs['name'], 'seo' => $rs['seo']); } return $Data; }
public function doRefreshSeoCategory() { Db::getInstance()->beginTransaction(); $sql = 'SELECT idcategory FROM category'; $stmt = $stmt = Db::getInstance()->prepare($sql); $stmt->execute(); while ($rs = $stmt->fetch()) { $sql2 = 'SELECT CT.languageid, GROUP_CONCAT(SUBSTRING(IF(CT.categoryid = :id, CT.name, LOWER(CT.name)), 1) ORDER BY C.order DESC SEPARATOR \'/\') AS seo FROM categorytranslation CT LEFT JOIN categorypath C ON C.ancestorcategoryid = CT.categoryid WHERE C.categoryid = :id GROUP BY C.categoryid, CT.languageid '; $stmt2 = Db::getInstance()->prepare($sql2); $stmt2->bindValue('id', $rs['idcategory']); $stmt2->execute(); $rs2 = $stmt2->fetch(); if ($rs2) { $seo = Core::clearSeoUTF($rs2['seo']); $sql3 = 'UPDATE categorytranslation SET seo = :seo WHERE categoryid = :categoryid AND languageid = :languageid '; $stmt3 = Db::getInstance()->prepare($sql3); $stmt3->bindValue('categoryid', $rs['idcategory']); $stmt3->bindValue('languageid', $rs2['languageid']); $stmt3->bindValue('seo', strtolower($seo)); $stmt3->execute(); } } Db::getInstance()->commit(); App::getModel('category')->flushCache(); }
public function addCategory($Data) { $sql = 'INSERT INTO category (categoryid) VALUES (:categoryid)'; $stmt = Db::getInstance()->prepare($sql); if ($Data['categoryid'] != 0) { $stmt->bindValue('categoryid', $Data['categoryid']); } else { $stmt->bindValue('categoryid', NULL); } try { $stmt->execute(); } catch (Exception $e) { throw new CoreException(_('ERR_CATEGORY_ADD'), 3003, $e->getMessage()); } $categoryid = Db::getInstance()->lastInsertId(); $this->getCategoriesPathById(); if ($Data['photo']['unmodified'] == 0) { $sql = 'UPDATE category SET photoid = :photo WHERE idcategory = :id'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('id', $categoryid); if ($Data['photo'][0] > 0) { $stmt->bindValue('photo', $Data['photo'][0]); } else { $stmt->bindValue('photo', NULL); } try { $stmt->execute(); } catch (Exception $e) { throw new CoreException(_('ERR_CATEGORY_UPDATE'), 1, $e->getMessage()); return false; } } else { $sql = 'UPDATE category SET photoid = (SELECT photoid FROM category WHERE idcategory = :previous) WHERE idcategory = :id'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('id', $categoryid); $stmt->bindValue('previous', $this->registry->core->getParam()); try { $stmt->execute(); } catch (Exception $e) { throw new CoreException(_('ERR_CATEGORY_UPDATE'), 1, $e->getMessage()); return false; } } $seo = App::getModel('seo')->doAJAXCreateSeoCategory(array('name' => $Data['name'], 'language' => Helper::getLanguageId())); $sql = 'INSERT INTO categorytranslation (categoryid,name,seo,shortdescription, description, languageid) VALUES (:categoryid,:name,:seo,:shortdescription, :description, :languageid)'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('categoryid', $categoryid); $stmt->bindValue('name', Core::clearNonAlpha($Data['name'])); $stmt->bindValue('seo', $seo['seo']); $stmt->bindValue('shortdescription', $Data['shortdescription']); $stmt->bindValue('description', $Data['description']); $stmt->bindValue('languageid', Helper::getLanguageId()); $stmt->execute(); $views = Helper::getViewIds(); foreach ($views as $key => $val) { if ($val > 0) { $sql = 'INSERT INTO viewcategory (categoryid,viewid) VALUES (:categoryid, :viewid)'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('categoryid', $categoryid); $stmt->bindValue('viewid', $val); try { $stmt->execute(); } catch (Exception $e) { throw new CoreException(_('ERR_CATEGORY_VIEW_ADD'), 4, $e->getMessage()); } } } $this->flushCache(); return $categoryid; }
public function edit() { $rawUserData = App::getModel('users')->getUserById($this->registry->core->getParam()); if (empty($rawUserData)) { App::redirect(__ADMINPANE__ . '/users'); } $layers = App::getModel('users')->getLayersAll(); $form = new FormEngine\Elements\Form(array('name' => 'user', 'action' => '', 'method' => 'post')); $personalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'personal_data', 'label' => _('TXT_PERSONAL_DATA')))); $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME')))))); $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME')))))); $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL')), new FormEngine\Rules\Email(_('ERR_WRONG_EMAIL')), new FormEngine\Rules\Unique(_('ERR_EMAIL_ALREADY_EXISTS'), 'userdata', 'email', null, array('column' => 'userid', 'values' => $this->registry->core->getParam())))))); $changePassword = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'change_password', 'label' => _('TXT_CHANGE_USERS_PASSWORD')))); $userid = Session::getActiveUserid(); $edituserid = $this->registry->core->getParam(); if ($userid == $edituserid) { $newPasswordChange = $changePassword->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'changepassword', 'label' => _('TXT_CHANGE_PASS')))); $oldPassword = $changePassword->AddChild(new FormEngine\Elements\Password(array('name' => 'oldpasswd', 'label' => _('TXT_PASSWORD_OLD'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $newPasswordChange, new FormEngine\Conditions\Equals('1')))))); $newPassword = $changePassword->AddChild(new FormEngine\Elements\Password(array('name' => 'newppasswd', 'label' => _('TXT_PASSWORD_NEW'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PASSWORD')), new FormEngine\Rules\Format(_('ERR_PASSWORD_NEW_INVALID'), '/^.{6,}$/')), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $newPasswordChange, new FormEngine\Conditions\Equals('1')))))); $changePassword->AddChild(new FormEngine\Elements\Password(array('name' => 'newpasswdrep', 'label' => _('TXT_PASSWORD_REPEAT'), 'rules' => array(new FormEngine\Rules\Compare(_('ERR_PASSWORDS_NOT_COMPATIBILE'), $newPassword)), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $newPasswordChange, new FormEngine\Conditions\Equals('1')))))); } else { $changePassword->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_PASSWORD_CHANGE_INSTRUCTION') . '</p>'))); $newPassword = $changePassword->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'newpassword', 'label' => _('TXT_PASSWORD_NEW')))); } $isglobal = App::getModel('users')->checkActiveUserIsGlobal(); if ($isglobal == 1) { $rightsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'rights_data', 'label' => _('TXT_RIGHTS')))); $rightsData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_SET_USER_LAYER_RIGHTS') . '</p>'))); $global = $rightsData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'global', 'label' => _('TXT_GLOBAL_USER')))); $rightsData->AddChild(new FormEngine\Elements\Select(array('name' => 'group', 'label' => _('TXT_GROUPS'), 'options' => FormEngine\Option::Make(App::getModel('groups/groups')->getGroupsAllToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_GROUP'))), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $global, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1'))))))); $layers = App::getModel('users')->getLayersAll(); foreach ($layers as $key => $store) { $storeRightsData[$store['id']] = $rightsData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'store_' . $store['id'], 'label' => _('TXT_RIGHTS') . ' dla ' . $store['name'], 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $global, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1'))))))); foreach ($store['views'] as $v => $view) { $storeRightsData[$store['id']]->AddChild(new FormEngine\Elements\Select(array('name' => 'view_' . $view['id'], 'label' => $view['name'], 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('groups/groups')->getGroupsAllToSelect())))); } } } $additionalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'additional_data', 'label' => _('TXT_ADDITIONAL_DATA')))); $additionalData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 3000', 'max_length' => 3000))); $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'active', 'label' => _('TXT_ENABLE_USER')))); $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_PHOTO')))); $photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('TXT_PHOTO'), 'repeat_min' => 0, 'repeat_max' => 1, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add'))); $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); $userData = array('personal_data' => array('firstname' => $rawUserData['firstname'], 'surname' => $rawUserData['surname'], 'email' => $rawUserData['email']), 'additional_data' => array('description' => $rawUserData['description'], 'active' => $rawUserData['active']), 'photos_pane' => array('photo' => $rawUserData['photo']), 'rights_data' => array('global' => $rawUserData['globaluser'], 'group' => $rawUserData['idgroup'])); foreach ($rawUserData['layer'] as $key => $layer) { $userData['rights_data']['store_' . $layer['store']][] = array('view_' . $layer['view'] => $layer['group']); } $form->Populate($userData); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $edituser = $form->getSubmitValues(); App::getModel('users')->updateUser($edituser, $this->registry->core->getParam()); if ($userid == $edituserid) { if ($edituser['change_password']['changepassword'] == 1) { $editpassword = $edituser['change_password']['newppasswd']; $changPassword = App::getModel('users')->updateUserPassword($edituser['change_password']['newppasswd']); Session::setActiveUserFirstname($edituser['personal_data']['firstname']); Session::setActiveUserSurname($edituser['personal_data']['surname']); Session::setActiveUserEmail($edituser['personal_data']['email']); } } else { if ($edituser['change_password']['newpassword'] == 1) { $editpassword = Core::passwordGenerate(); $changPassword = App::getModel('users')->updateUserPassword($editpassword); if ($changPassword == true) { $password = Core::passwordGenerate(); $this->registry->template->assign('password', $editpassword); App::getModel('mailer')->sendEmail(array('template' => 'newPasswordForUser', 'email' => array($edituser['personal_data']['email']), 'bcc' => false, 'subject' => _('TXT_EDIT_PASSWORD_USER'), 'viewid' => Helper::getViewId())); } } } } catch (Exception $e) { Session::setVolatileUsereditError(1, false); } App::redirect(__ADMINPANE__ . '/users'); } $error = Session::getVolatileUsereditError(); if ($error[0] == 1) { $this->registry->template->assign('error', $e->getMessage()); } $this->registry->template->assign('form', $form->Render()); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->display($this->loadTemplate('edit.tpl')); }