/**
  * 
  * @param integer $user_id
  * @param integer $act_id
  * @param float $value
  * @param boolean $monetary
  */
 public static function createAccountUser($user_id, $account_id)
 {
     /* ------- ACCOUNT_USER CREATION ------- */
     //In order to link the user and the account, we need a AccountUser object:
     $account_user = new AccountUser();
     //Set its values:
     $account_user->setUserId($user_id);
     $account_user->setAccountId($account_id);
     //Save it:
     $saved_account_user = $account_user->save();
     return $account_id;
 }
예제 #2
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $socialLogins = AccountUser::model()->findByPk(784)->accountUserSocialLogins;
     foreach ($socialLogins as $row) {
         print_r($row->type);
         print_r('<br>');
     }
     die;
     $this->render('index');
 }
예제 #3
0
$tpl->set_block("forgotpassword", "success");
$tpl->set_block("forgotpassword", "unknown");
$page = $_REQUEST['page'];
if (!isset($page)) {
    $page = "/";
}
/* FIXME: Dumb workaround */
unset($tpl->varkeys["PAGE"]);
unset($tpl->varvals["PAGE"]);
$tpl->set_var("PAGE", $page);
/* forgotpassword might get a POST with submit/email, or
   a simple GET with email */
if (isset($_REQUEST['email'])) {
    $email = $_REQUEST['email'];
    $tpl->set_var("EMAIL", $email);
    $user = new AccountUser();
    $user->find_by_email($email);
    if (!$user->valid()) {
        $tpl->set_var("success", "");
    } else {
        $user->forgotpassword();
        $user->update();
        $tpl->set_var("unknown", "");
        $tpl->set_var("form", "");
    }
} else {
    $tpl->set_var("EMAIL", "");
    $tpl->set_var("unknown", "");
    $tpl->set_var("success", "");
}
print generate_page('Forgot Password', $tpl->parse("content", "forgotpassword"));
예제 #4
0
파일: logout.php 프로젝트: kawf/kawf
<?php

$aid = $user->aid;
$user = new AccountUser();
$user->find_by_aid((int) $aid);
if (!$user->unsetcookie()) {
    err_not_found();
}
header("Location: login.phtml?message=" . urlencode("You have been logged out"));
예제 #5
0
파일: login.php 프로젝트: kawf/kawf
} else {
    $tpl->set_var("tou_agreement", "");
}
$page = $_REQUEST['page'];
if (isset($_REQUEST['url'])) {
    $page = "http://" . $_REQUEST['url'];
}
if (!isset($page)) {
    $page = "/";
}
$tpl->set_var("PAGE", $page);
if (isset($_POST['login']) && isset($_POST['email'])) {
    $email = $_POST['email'];
    $password = $_POST['password'];
    $tpl->set_var("EMAIL", $email);
    $user = new AccountUser();
    $user->find_by_email($email);
    if (!$user->valid() || !$user->checkpassword($password)) {
        $message = "Invalid password for {$email}\n";
    } else {
        if ($tou_available && !$_REQUEST["tou_agree"]) {
            $message = "You must agree to the Terms Of Use\n";
        } else {
            $user->setcookie();
            header("Location: {$page}");
            exit;
        }
    }
} else {
    $tpl->set_var("EMAIL", "");
}
예제 #6
0
파일: finish.php 프로젝트: kawf/kawf
$errors = array("unknown", "invalid_aid", "activate_failed", "dup_email");
$successes = array("create", "email", "forgot_password");
if (!isset($_REQUEST['cookie'])) {
    err_not_found('No cookie');
}
$cookie = $_REQUEST['cookie'];
$pending = db_query_first("select * from u_pending where cookie = ?", array($cookie));
if (!$pending) {
    if (isset($cookie) && !empty($cookie)) {
        $error = "unknown";
        $tpl->set_var("COOKIE", $cookie);
    } else {
        err_not_found('No cookie');
    }
} else {
    $user = new AccountUser();
    $user->find_by_aid((int) $pending['aid']);
    if (!$user->valid()) {
        $error = "invalid_aid";
    } else {
        db_exec("update u_pending set status = 'Done' where tid = ?", array($pending['tid']));
        switch ($pending['type']) {
            case "NewAccount":
                if ($user->status == 'Create') {
                    $user->status("Active");
                    if (!$user->update()) {
                        $error = "activate_failed";
                    } else {
                        $success = "create";
                    }
                } else {
예제 #7
0
파일: create.php 프로젝트: kawf/kawf
<?php

include_once "strip.inc";
require_once "page-yatt.inc.php";
/* Delete the logged in user */
unset($user);
/* We'll create a new user */
$user = new AccountUser();
/* See if TOU is available. */
$tou_available = false;
if (is_file($template_dir . "/account/tou.tpl")) {
    $tou_available = true;
}
$template_files = array("create" => "account/create.tpl", "create_mail" => "mail/create.tpl");
if ($tou_available) {
    $template_files["tou"] = "account/tou.tpl";
}
$tpl->set_file($template_files);
$tpl->set_block("create", "form");
$tpl->set_block("create", "disabled");
$tpl->set_block("create", "success");
$tpl->set_block("create", "error");
$tpl->set_block("form", "tou_agreement");
$error = "";
if ($tou_available) {
    $tpl->parse("TOU", "tou");
} else {
    $tpl->set_var("tou_agreement", "");
}
if ($create_disabled) {
    $tpl->set_var("form", "");
예제 #8
0
파일: su.php 프로젝트: kawf/kawf
<?php

$user->req("ForumAdmin");
if (!is_valid_integer($_GET['aid'])) {
    Header("Location: /admin/?message=" . urlencode("No AID!"));
    exit;
}
$aid = $_GET['aid'];
$user = new AccountUser();
$user->find_by_aid((int) $aid);
if (!$user->valid()) {
    Header("Location: /admin/?message=" . urlencode("Invalid AID {$aid}"));
    exit;
}
$user->setcookie();
if (!isset($_GET['page'])) {
    Header("Location: /admin/");
} else {
    Header("Location: " . $_GET['page']);
}
예제 #9
0
파일: acctedit.php 프로젝트: kawf/kawf
<?php

require_once "strip.inc";
require_once "validate.inc";
require_once "page-yatt.inc.php";
$aid = $user->aid;
$user = new AccountUser();
$user->find_by_aid((int) $aid);
$user->req();
$tpl->set_file("edit", "account/edit.tpl");
$tpl->set_block("edit", "error");
$tpl->set_block("edit", "name");
$tpl->set_block("edit", "email");
$tpl->set_block("edit", "password");
unset($update_email);
$error = "";
/* $_page set by main.php from _REQUEST */
$tpl->set_var("PAGE", $_page);
if (isset($_POST['name'])) {
    $name = $_POST['name'];
} else {
    $name = "";
}
if (isset($_POST['email'])) {
    $email = $_POST['email'];
} else {
    $email = "";
}
if (isset($_POST['password1'])) {
    $password1 = $_POST['password1'];
} else {
예제 #10
0
파일: suspend.php 프로젝트: kawf/kawf
<?php

$user->req("ForumAdmin");
if (!is_valid_integer($_GET['aid'])) {
    Header("Location: /admin/?message=" . urlencode("No AID!"));
    exit;
}
if (!$user->is_valid_token($_REQUEST['token'])) {
    err_not_found('Invalid token');
}
$aid = $_GET['aid'];
$uuser = new AccountUser();
$uuser->find_by_aid((int) $aid);
if (!$uuser->valid()) {
    Header("Location: /admin/?message=" . urlencode("Invalid AID {$aid}"));
    exit;
}
if (isset($_GET['undo'])) {
    if ($uuser->status == "Suspended") {
        $uuser->status("Active");
        $uuser->update();
    }
} else {
    if ($uuser->status == "Active") {
        $uuser->status("Suspended");
        $uuser->update();
    }
}
if (!isset($_GET['page'])) {
    Header("Location: /account/{$aid}.phtml");
} else {