コード例 #1
0
ファイル: template.php プロジェクト: andersoonluan/PHP
 public function __construct()
 {
     $this->_db = DB::getInstance();
     $this->_template = new TemplateRender();
     $this->_templateFolder = Options::Get("siteurl") . '/theme/default';
     $this->_templateFolderPath = ABSPATH . '/theme/default';
 }
コード例 #2
0
ファイル: class.post-type.php プロジェクト: andyUA/kabmin-new
 static function registerPostType()
 {
     Register_Post_Type(self::$post_type_name, array('labels' => array('name' => Glossary_Type::$type->label, 'singular_name' => I18n::t('Термін'), 'add_new' => I18n::t('Додати термін'), 'add_new_item' => I18n::t('Новий термін'), 'edit_item' => I18n::t('Редагувати термін'), 'view_item' => I18n::t('Показати термін'), 'search_items' => I18n::t('Пошук термінів'), 'not_found' => I18n::t('Термінів не знайдено'), 'not_found_in_trash' => I18n::t('У кошику Термінів не знайдено'), 'parent_item_colon' => ''), 'public' => True, 'show_ui' => True, 'menu_icon' => 'dashicons-welcome-learn-more', 'has_archive' => True, 'map_meta_cap' => True, 'hierarchical' => False, 'rewrite' => array('slug' => Glossary_Type::$type->slug, 'with_front' => False), 'supports' => array('title', 'editor', 'author', 'excerpt'), 'menu_position' => 20));
     # Add optionally post type support
     if (Options::Get('enable_custom_fields')) {
         Add_Post_Type_Support(self::$post_type_name, 'custom-fields');
     }
 }
コード例 #3
0
 static function loadGlossaryType()
 {
     $type = Options::Get('glossary_type');
     $arr_types = self::getGlossaryTypes();
     if (isset($arr_types[$type])) {
         self::$type = $arr_types[$type];
     } else {
         self::$type = Reset($arr_types);
     }
 }
コード例 #4
0
ファイル: mail.php プロジェクト: andersoonluan/PHP
 public static function send($sendTo, $subject, $message)
 {
     $header = "From: " . Options::Get('sitename') . " <no-reply@" . $_SERVER['HTTP_HOST'] . ">\r\n";
     $header .= "Content-type:text/html; charset=utf-8\r\n";
     try {
         mail($sendTo, $subject, $message, $header);
     } catch (Exception $ex) {
         throw new Exception($ex);
     }
 }
コード例 #5
0
ファイル: options.php プロジェクト: andersoonluan/PHP
 public static function Update($params)
 {
     foreach ($params as $key => $value) {
         if (Options::Get($key) === false) {
             DB::getInstance()->INSERT("options", array('option' => $key, 'value' => $value));
         } else {
             DB::getInstance()->UPDATE("options", "option", $key, array('option' => $key, 'value' => $value));
         }
     }
 }
コード例 #6
0
 static function filterQuery($query)
 {
     if (!$query->Get('suppress_filters') && Core::isGlossaryArchive($query) || Core::isGlossarySearch($query)) {
         # Order the terms in the backend by title, ASC.
         if (!$query->Get('order')) {
             $query->Set('order', 'asc');
         }
         if (!$query->Get('orderby')) {
             $query->Set('orderby', 'title');
         }
         # Take an eye on the filter
         if (!$query->Get('post_title_like') && !$query->Get('ignore_filter_request') && Get_Query_Var('filter')) {
             $query->Set('post_title_like', RawUrlDecode(Get_Query_Var('filter')) . '%');
         }
         # Change the number of terms per page
         if (!Is_Admin()) {
             $query->Set('posts_per_page', Options::Get('terms_per_page'));
         }
     }
 }
コード例 #7
0
ファイル: commoninit.php プロジェクト: andersoonluan/PHP
|
*/
require_once COREPATH . "/template.php";
/*
|--------------------------------------------------------------------------
| Set default Exception handler if not in debug mode
|--------------------------------------------------------------------------
|
*/
if (!DEBUG_MODE) {
    function exception_handler($exception)
    {
        echo $exception->getMessage();
    }
    set_exception_handler('exception_handler');
}
/*
|--------------------------------------------------------------------------
| App fisrt run
|--------------------------------------------------------------------------
|
*/
require_once DIR_CORE . "/firstrun.php";
/*
|-------------------------------------------------
| Set Timezone 
|-------------------------------------------------
|
*/
$timeZone = Options::Get('timezone') ? Options::Get('timezone') : "UTC";
date_default_timezone_set($timeZone);
コード例 #8
0
ファイル: signup.php プロジェクト: andersoonluan/PHP
 if ($validation->passed()) {
     $user = new User();
     $salt = Hash::salt(32);
     try {
         // Activation code
         $code = Token::generate();
         // Account activation
         $active = Options::Get('users_must_confirm_email') == "1" ? 0 : 1;
         $user->create(array('username' => Input::get('username'), 'password' => Hash::make(Input::get('password'), $salt), 'salt' => $salt, 'email' => Input::get('email'), 'roles' => '2', 'act_code' => $code, 'active' => $active, 'signup' => date('Y-m-d H:i:s')));
         // If the user is successfully registered
         if ($user->find(Input::get('username'))) {
             // Send confirmation email
             if ($active == 0) {
                 $registerMessage = "Hello " . Input::get('username') . ",<br /><br />";
                 $registerMessage .= "Thank you for registering with " . Options::get("sitename") . "! To complete your registration, please click on the link below or paste it into a browser to confirm your e-mail address.<br/>";
                 $registerMessage .= "<a href='" . Options::Get("siteurl") . "/confirmregistration.php?email=" . Input::Get("email") . "&code=" . $code . "' >" . Options::Get("siteurl") . "/confirmregistration.php?email=" . Input::Get("email") . "&code=" . $code . "</a>";
                 $registerMessage .= "<br/><br/><br/>Please do not reply to this message.<br/>" . Options::get("sitename");
                 Mail::Send(Input::Get("email"), Options::get("sitename") . ' Account activation', $registerMessage);
             }
             $registerSuccessMsg = lang('THANK_YOU_REGISTERING');
             if ($active == 0) {
                 $registerSuccessMsg .= "<br/>" . lang('THANK_YOU_REGISTERING_CONFIRMATION');
             }
             // User message after the signing up
             Session::flash("signin", "success", $registerSuccessMsg, true);
             Redirect::To("signin.php");
         }
     } catch (Exception $e) {
         echo "<div class='alert alert-danger alert-singnin' role='alert'>";
         echo lang("OPERATION_FAILED_TRY_AGAIN") . "<br/> " . $e->GetMessage();
         echo "</div>";
コード例 #9
0
ファイル: init.php プロジェクト: andersoonluan/PHP
    $hash = Cookie::get(Config::get('remember/cookie_name'));
    $hashCheck = DB::getInstance()->get('users_session', array('hash', '=', $hash));
    if ($hashCheck->count()) {
        $user = new User($hashCheck->first()->user_id);
        $user->login();
    }
}
/*
|--------------------------------------------------------------------------
| User must be signed in
|--------------------------------------------------------------------------
|
*/
$user = new user();
if (!$user->isLoggedIn()) {
    Redirect::to(Options::Get("siteurl") . 'signin.php');
    exit;
}
/*
|-------------------------------------------------
| Set Timezone for the current user
|-------------------------------------------------
|
*/
if (isset($user->Options()->timezone)) {
    if ($user->Options()->timezone) {
        date_default_timezone_set($user->Options()->timezone);
    }
}
/*
|------------------------------------
コード例 #10
0
ファイル: recover.php プロジェクト: andersoonluan/PHP
    ?>
</h3>
						</div>
						<div class="panel-body">
						<?php 
    if (Input::exists()) {
        if (Token::check(Input::get('token'))) {
            $validate = new Validate();
            $validation = $validate->check($_POST, array('email' => array('disp_text' => 'E-mail', 'required' => true, 'exists' => 'users')));
            if ($validation->passed()) {
                $code = Token::generate();
                try {
                    DB::GetInstance()->Query("UPDATE users set act_code = ? WHERE email = ? ", array($code, Input::Get("email")));
                    $recoverMessage = "You recently requested a new password<br /><br />";
                    $recoverMessage .= "Please click the link below to complete your request<br/>";
                    $recoverMessage .= "<a href='" . Options::Get("siteurl") . "/recover.php?email=" . Input::Get("email") . "&code=" . $code . "' >" . Options::Get("siteurl") . "recover.php?email=" . Input::Get("email") . "&code=" . $code . "</a>";
                    Mail::Send(Input::Get("email"), 'Account recovry request', $recoverMessage);
                    echo "<div class='alert alert-success' role='alert'>";
                    echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
                    echo lang('RESET_PASSWORD_REQUEST_SENT') . "</br>";
                    echo "</div>";
                } catch (Exception $e) {
                    die($e->getMessage());
                }
            } else {
                foreach ($validation->errors() as $error) {
                    echo "<div class='alert alert-danger' role='alert'>";
                    echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>";
                    echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
                    echo " " . $error . "</br>";
                    echo "</div>";
コード例 #11
0
ファイル: settings.php プロジェクト: andersoonluan/PHP
    echo $usersCanRegister;
    ?>
 />
									<label for="usersCanRegister"></label>
									<span class="input-text"><?php 
    echo lang('USERS_CAN_REGISTER');
    ?>
</span>
								</div>

								<div class="input-group">
								<?php 
    if (Input::Get("usersMustConfirmEmail")) {
        $usersMustConfirmEmail = Input::Get("usersMustConfirmEmail") == "on" ? "checked" : "";
    } else {
        $usersMustConfirmEmail = Options::Get("users_must_confirm_email") ? "checked" : "";
    }
    ?>
									<input type="checkbox" id="usersMustConfirmEmail" name="usersMustConfirmEmail"  class='checkbox-style' aria-label="New users must confirm their email address" <?php 
    echo $usersMustConfirmEmail;
    ?>
 />
									<label for="usersMustConfirmEmail" ></label>
									<span class="input-text"><?php 
    echo lang('USERS_MUST_CONFIRM_EMAIL');
    ?>
</span>
								</div>
						<?php 
}
// User has admin permission
コード例 #12
0
ファイル: signup.php プロジェクト: andersoonluan/PHP
<?php

/*
|--------------------------------------------------------------------------
| Common init file
|--------------------------------------------------------------------------
|
*/
require_once "core/commoninit.php";
require_once "core/language/language.php";
$user = new user();
$template = new Template();
if ($user->isLoggedIn()) {
    Redirect::to(Options::Get("siteurl") . 'index.php');
    exit;
}
if (Options::Get('users_can_register') == "0") {
    Redirect::to(Options::Get("siteurl") . 'index.php');
    exit;
}
$template->signUp();