public function action_registration() { if ($this->is_logged) { die(json_encode(['status' => 'error', 'message' => 'You olready registered'], JSON_UNESCAPED_UNICODE)); } $lUsername = Input::post('username', null); $lPassword = Input::post('password', null); $lPassword2 = Input::post('password2', null); $lEmail = Input::post('email', null); if (empty($lUsername) || empty($lPassword) || empty($lPassword2) || empty($lEmail)) { $lError = 'Missing params'; } if ($lPassword !== $lPassword2) { $lError = DifferentFunc::translation('passwords_mismatch'); } if (!empty($lError)) { die(json_encode(['status' => 'error', 'message' => $lError], JSON_UNESCAPED_UNICODE)); } try { Auth::create_user($lUsername, $lPassword, $lEmail, 1, ['role_id' => AuthModule::UR_USER]); Auth::login($lUsername, $lPassword); } catch (Exception $e) { $lError = $e->getMessage(); die(json_encode(['status' => 'error', 'message' => $lError], JSON_UNESCAPED_UNICODE)); } die(json_encode(['status' => 'ok'], JSON_UNESCAPED_UNICODE)); }
echo DifferentFunc::translation('password'); ?> "> </div> </div> <div class="form-group"> <div class="col-sm-4"> <input type="password" class="form-control form_field validate" id="new_password" name="password[new]" placeholder="<?php echo DifferentFunc::translation('new_password'); ?> "> </div> <div class="col-sm-4"> <input type="password" class="form-control form_field validate" id="new_password_2" name="password[new_2]" placeholder="<?php echo DifferentFunc::translation('repeat_new_password'); ?> "> </div> </div> <input type="button" id="change_password" class="btn btn-warning" value="<?php echo DifferentFunc::translation('change_password'); ?> "> </form> <?php }
echo $article['id']; ?> " name="article[article_id]"> <?php } else { $lText = 'add_article'; $lId = 'article_add'; } ?> <input type="button" id="<?php echo $lId; ?> " value="<?php echo DifferentFunc::translation($lText); ?> "> <?php if ($edit_mode) { ?> <input type="button" id="article_delete" value="<?php echo DifferentFunc::translation('delete_article'); ?> "> <?php } ?> </div>
$lRoleName = $lRolesNames[$lVal['profile_fields']['role_id']]; ?> <div class="row"> <div class="col-md-2"><?php echo $lVal['username']; ?> </div> <div class="col-md-2"><?php echo $lVal['email']; ?> </div> <div class="col-md-2"><?php echo DifferentFunc::translation($lRoleName); ?> </div> <div class="col-md-2"><?php echo empty($lVal['profile_fields']['is_deleted']) ? $lMarcks['no'] : $lMarcks['yes']; ?> </div> <div class="col-md-2"><?php echo empty($lVal['profile_fields']['is_blocked']) ? $lMarcks['no'] : $lMarcks['yes']; ?> </div> <div class="col-md-2"> <?php echo Html::anchor('profile/index?user_id=' . $lVal['id'], DifferentFunc::translation('show')); ?> </div> </div> <?php }
echo DifferentFunc::translation('user_email'); ?> :</div> <div class="col-md-9"><?php echo $user_data['email']; ?> </div> </div> <div class="row"> <div class="col-md-3"> <?php echo DifferentFunc::translation('registration_date'); ?> :</div> <div class="col-md-9"><?php echo date('Y-m-d', $user_data['created_at']); ?> </div> </div> <?php if ($owner_mode) { ?> <div class="row"> <div class="col-md-6"> <?php echo Html::anchor('/profile/edit?user_id=' . $user_data['id'], DifferentFunc::translation('edit_profile')); ?> </div> </div> <?php }
public function action_changePassword() { $lUserData = Input::post('password', null); if (empty($lUserData) || empty($lUserData['old']) || empty($lUserData['new']) || empty($lUserData['new_2'])) { die(json_encode(['status' => 'error', 'message' => 'Empty passwords'], JSON_UNESCAPED_UNICODE)); } if ($lUserData['new'] != $lUserData['new_2']) { die(json_encode(['status' => 'error', 'message' => DifferentFunc::translation('passwords_mismatch')], JSON_UNESCAPED_UNICODE)); } try { $lResult = Auth::change_password($lUserData['old'], $lUserData['new']); } catch (Exception $e) { throw new Exception('Error ' . $e); } if ($lResult) { die(json_encode(['status' => 'ok'], JSON_UNESCAPED_UNICODE)); } die(json_encode(['status' => 'error', 'message' => 'Password was not updated'], JSON_UNESCAPED_UNICODE)); }
<div class="col-md-12"> <form id="login_form" class="form-inline"> <div class="form-group"> <input class="form_field validate form-control" name="username" placeholder="<?php echo DifferentFunc::translation('username'); ?> "> </div> <div class="form-group"> <input type="password" class="form_field validate form-control" name="password" placeholder="<?php echo DifferentFunc::translation('password'); ?> "> </div> <button type="button" class="btn btn-default" id="make_login"> <?php echo DifferentFunc::translation('sign_in'); ?> </button> <?php echo Html::anchor('users/register', DifferentFunc::translation('registration')); ?> </form> </div> <?php } ?> </div>
<?php echo $article['text']; ?> </div> <div class="row"> <div class="col-md-2"> <a href="/profile/index?user_id=<?php echo $article['user_id']; ?> "> <?php echo $article['user_name']; ?> </a> </div> <div class="col-md-8"></div> <div class="col-md-2"><?php echo $article['date']; ?> </div> </div> <?php if ($is_logged && ($current_user['id'] == $article['user_id'] || $current_user['role_id'] == AuthModule::UR_ADMIN)) { ?> <div class="row"> <?php echo Html::anchor('/articles/edit?article_id=' . $article['id'], DifferentFunc::translation('edit')); ?> </div> <?php }
<div class="row"> <h3> <?php echo DifferentFunc::translation('access_denied'); ?> </h3> </div> <?php if (!empty($msg)) { ?> <div class="row"> <h3> <?php echo DifferentFunc::translation($msg); ?> </h3> </div> <?php }
<div class="form-group"> <label><?php echo DifferentFunc::translation('password'); ?> </label> <input name="password" type="password" class="form_field validate form-control" id="pass" placeholder="<?php echo DifferentFunc::translation('password'); ?> "> <input name="password2" type="password" class="form_field validate form-control" id="pass2" placeholder="<?php echo DifferentFunc::translation('repeat_password'); ?> "> </div> <div class="form-group"> <label><?php echo DifferentFunc::translation('email'); ?> </label> <input type="text" class="form_field validate form-control" valueType="email" name="email" placeholder="Email"> </div> <button type="button" class="btn btn-default" id="make_registration"> <?php echo DifferentFunc::translation('submit'); ?> </button> </form>
?> </h3> </div> <div class="row"> <div class="col-md-2"><?php echo $lArticle['user_name']; ?> </div> <div class="col-md-8"></div> <div class="col-md-2"><?php echo $lArticle['date']; ?> </div> </div> <div class="row"> <?php $lShortSize = 150; if (mb_strlen($lArticle['text']) > $lShortSize) { $lPos = mb_strpos($lArticle['text'], ' ', $lShortSize); echo empty($lPos) ? mb_substr($lArticle['text'], 0, $lShortSize) : mb_substr($lArticle['text'], 0, $lPos); echo Html::anchor('/articles/article?article_id=' . $lArticle['id'], '...' . DifferentFunc::translation('read_more')); } else { echo $lArticle['text']; } ?> </div> <?php } } echo $pagination;