示例#1
0
 /**
  * @Route("/created")
  * @Route("/created/")
  */
 public function createdAction($getUsername, $getPassword, $getEmail)
 {
     $account = new account();
     $account->setUsername($getUsername);
     $account->setPassword(strtoupper(sha1($getUsername . ":" . $getPassword)));
     $account->setEmail($getEmail);
     $em = $this->getDoctrine()->getManager();
     $em->persist($account);
     $em->flush();
     return $this->render('twitter/success_created.html.twig', array('getUsername' => $getUsername, 'getEmail' => $getEmail, 'current_year' => date("Y")));
 }
<?php

/*!
 * ifsoft.co.uk engine v1.0
 *
 * http://ifsoft.com.ua, http://ifsoft.co.uk
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : '';
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $currentPassword = isset($_POST['currentPassword']) ? $_POST['currentPassword'] : '';
    $newPassword = isset($_POST['newPassword']) ? $_POST['newPassword'] : '';
    $currentPassword = helper::clearText($currentPassword);
    $currentPassword = helper::escapeText($currentPassword);
    $newPassword = helper::clearText($newPassword);
    $newPassword = helper::escapeText($newPassword);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $account = new account($dbo, $accountId);
    $result = $account->setPassword($currentPassword, $newPassword);
    echo json_encode($result);
    exit;
}