示例#1
0
        } else {
            if (User::FindUser($user_name)) {
                $error_message = I18n::L("Username «%s» is already taken, please find another username.", array($user_name));
            } else {
                if (User::FindUserByEmail($user_email)) {
                    $error_message = I18n::L("This email «%s» is already regesitered, please use another email.", array($user_email));
                } else {
                    $obj = User::Add(User::Create($user_name, $user_email, $_POST["user_password"]));
                    if ($obj->user_id) {
                        Session::StartUser($obj);
                        header("Location:" . PREFIX . "/dashboard/");
                        exit;
                    } else {
                        $error_message = I18n::L("Error while registring user.");
                    }
                    //todo: add some error log
                }
            }
        }
    }
} else {
    if (!empty($_POST["register"])) {
        $error_message = I18n::L("Please fill all required fields.");
    }
}
Viewer::AddData("title", I18n::L("Title Registration"));
Viewer::AddData("error_message", $error_message);
Viewer::UseTemplate("register.tpl");
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例#2
0
            Viewer::AddData("comments", Comments::GetByIdea($idea));
            Viewer::AddData("idea", $idea);
            Viewer::AddData("title", $idea->idea_title);
            if (isset($_GET["rate_plus"])) {
                $rated = 3;
            } elseif (isset($_GET["rate_minus"])) {
                $rated = 2;
            } else {
                $rated = 1;
            }
            if (User::Logged()) {
                $rate = Rate::Find($idea, User::$current);
                if (!empty($rate)) {
                    $rated = 4;
                }
                Viewer::AddData("rated", $rated);
            }
            Viewer::UseTemplate("idea.tpl");
            $action = "idea";
        }
    }
} else {
    Viewer::Restricted();
    $action = "idea";
}
if (!$action) {
    Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例#3
0
                $user->user_email = "";
                $user->user_name = $user->user_name . "_removed";
                if (!User::Update($user)) {
                    $error_message = I18n::L("Cannot update user.");
                    $user = User::GetById($id);
                } else {
                    header("Location:" . PREFIX . "/profile?" . $user->user_id);
                    exit;
                }
            } else {
                header("Location:" . PREFIX . "/profile?" . $user->user_id);
                exit;
            }
        }
        Viewer::AddData("user", $user);
        Viewer::AddData("title", I18n::L("Title %s's profile", array($user->user_name)));
        Viewer::AddData("ideas_count", Ideas::GetByUser($user) ? sizeof(Ideas::GetByUser($user)) : 0);
        Viewer::AddData("comments_count", Comments::GetByUser($user) ? sizeof(Comments::GetByUser($user)) : 0);
        Viewer::UseTemplate("user_profile.tpl");
        $action = "profile";
    }
} else {
    Viewer::Restricted();
    $action = "profile";
}
if (!$action) {
    Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
 /**
  *
  * @static
  * return void
  */
 public static function Restricted()
 {
     Viewer::AddData("title", "Restricted");
     Viewer::UseTemplate("unregistered.tpl");
 }
示例#5
0
<?php

/**
 * @package    zoneideas
 * @subpackage dashboard
 * @author     Serg Podtynnyi <*****@*****.**>
 */
/**
 *
 *
 */
ob_start();
include_once "../core.php";
$action = false;
if (User::Logged()) {
    Viewer::AddData("ideas", Ideas::GetByUser(User::$current));
    Viewer::AddData("user", User::$current);
    Viewer::AddData("title", I18n::L("Title Dashboard"));
    Viewer::UseTemplate("dashboard.tpl");
    $action = "dashboard";
} else {
    Viewer::Restricted();
    $action = "restricted";
}
if (!$action) {
    Viewer::RequestError();
}
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();
示例#6
0
<?php

/**
 * @package    zoneideas
 * @subpackage index
 * @author     Serg Podtynnyi <*****@*****.**>
 */
/**
 *
 *
 */
ob_start();
include "core.php";
Viewer::AddData("title", "Home");
Viewer::UseTemplate("front.tpl");
Viewer::Show();
ob_end_flush();
示例#7
0
/**
 *
 *
 */
ob_start();
include_once "../core.php";
$action = "login";
if (!empty($_POST["login"])) {
    if (!empty($_POST["user_name"]) && !empty($_POST["user_password"])) {
        $obj = User::CheckUser($_POST["user_name"], $_POST["user_password"]);
        User::$current = Session::StartUser($obj);
    } else {
        $error_message = I18n::L("Please fill all required fields.");
    }
}
if (User::Logged()) {
    header("Location:" . PREFIX . "/dashboard/");
    exit;
}
if (!empty($_POST["login"]) && !User::Logged()) {
    if (empty($error_message)) {
        $error_message = I18n::L("Wrong password.");
    }
    Viewer::AddData("error_message", $error_message);
    Viewer::AddData("user_name", $_POST["user_name"]);
}
Viewer::AddData("title", I18n::L("Title Login"));
Viewer::UseTemplate("login.tpl");
Viewer::AddData("action", $action);
Viewer::Show();
ob_end_flush();