Exemple #1
0
function checkUserAdmin($smarty)
{
    $Frontend = new FrontEnd();
    if (!$Frontend->checkIsAdmin($smarty)) {
        $smarty->assign("msg", "You must be a logged in admin to view this page.");
        $smarty->display('error.tpl');
        return false;
    }
    return true;
}
Exemple #2
0
function checkLogin($user, $pass)
{
    $Frontend = new FrontEnd();
    $pass = $Frontend->encryptPassword($pass);
    $dbuser = new Lan_users();
    $dbuser->username = $dbuser->escape($user);
    $dbuser->password = $pass;
    $dbuser->find();
    if (0 == $dbuser->count()) {
        return null;
    }
    $dbuser->fetch();
    return $dbuser;
}
Exemple #3
0
function CheckLogin($user, $pass)
{
    $Frontend = new FrontEnd();
    //Manually pull updated info
    $uid = $Frontend->findUserID($user);
    if (streq($uid, '0')) {
        return false;
    }
    $Frontend->pullUserInfo($uid);
    $dbuser = new Lan_users();
    $dbuser->username = $dbuser->escape($user);
    $dbuser->password = $pass;
    $dbuser->find();
    return 0 != $dbuser->count();
}
 /**
  * index
  *
  * @param IlluminateConfig    $config       laravel config
  * @param MenuRetrieveHandler $menuHandler  menu handler
  * @param MenuCacheHandler    $cacheHandler menu cache handler
  * @param SiteHandler         $siteHandler  site handler
  *
  * @return RendererInterface
  */
 public function index(IlluminateConfig $config, MenuRetrieveHandler $menuHandler, MenuCacheHandler $cacheHandler, SiteHandler $siteHandler)
 {
     $siteKey = $siteHandler->getCurrentSiteKey();
     $menus = $menuHandler->getAllMenu($siteKey);
     $homeMenuId = $siteHandler->getHomeInstanceId();
     $menuMaxDepth = $config->get('xe.menu.maxDepth');
     $transKey = [];
     foreach ($menus as $menu) {
         $transKey = array_merge($transKey, $cacheHandler->getMenuItemKeys($menu));
     }
     // 메뉴 어드민 트리 뷰에서 필요한 고유 다국어
     FrontEnd::translation(['xe::addItem', 'xe::goLink', 'xe::setHome']);
     // 메뉴 타이틀 user 다국어
     Frontend::translation($transKey);
     return Presenter::make('menu.index', ['siteKey' => $siteKey, 'menus' => $menus, 'home' => $homeMenuId, 'maxDepth' => $menuMaxDepth]);
 }
Exemple #5
0
 /**
  * Set notification via Flash Messanger
  * @deprecated
  * @see FrontEnd::setN
  * @param string $s
  */
 public static function setN($s, $ns = 'default')
 {
     FrontEnd::setN($s, $ns);
 }
Exemple #6
0
             $seats->lan_id = $seats->escape($_GET["lan"]);
             $seats->x = 20;
             $seats->y = 20;
             $seats->seat_name = "";
             $seats->type = 0;
             $seats->insert();
         }
         break;
     case "getusers":
         if (isset($_GET["lan"])) {
             $users = new Lan_attendees();
             $seats = new Lan_seats();
             $lanid = $users->escape($_GET["lan"]);
             $user_id = $users->escape($_GET["user_id"]);
             $applicable = array();
             $Frontend = new FrontEnd();
             $users->query("SELECT * FROM {$users->__table} WHERE `lan_id` = " . $lanid . " AND `user_id` NOT IN (SELECT `user_id` FROM {$seats->__table} WHERE `lan_id` = '" . $lanid . "') ");
             echo "<option value=\"0\"></option>";
             if ($user_id != '0') {
                 $applicable[$user_id] = $Frontend->getName($user_id);
             }
             while ($users->fetch()) {
                 $applicable[$users->user_id] = $Frontend->getName($users->user_id);
             }
             foreach ($applicable as $key => $val) {
                 echo "<option value=\"" . $key . "\">" . $val . "</option>";
             }
             $Frontend->disconnect();
         }
         break;
 }
Exemple #7
0
            if ($success) {
                $Frontend = new FrontEnd();
                logMessage($Frontend->getUserId(), 0, "Removed attendance for " . $Frontend->getName($user->user_id) . "' from " . $lan->name . " [" . $lan->id . "]");
                $user->delete();
            }
            break;
    }
}
if (isset($_POST["user"]) && isset($_POST["lan"])) {
    $newuser = new Lan_attendees();
    $newuser->lan_id = $newuser->escape($_POST["lan"]);
    $newuser->user_id = $newuser->escape($_POST["user"]);
    $newuser->insert();
    $Frontend = new FrontEnd();
    $lan = new Lan_events();
    $lan->get($lan->escape($_GET["id"]));
    logMessage($Frontend->getUserId(), 0, "Added attendee " . $Frontend->getName($newuser->user_id) . " at " . $lan->name);
}
if (isset($_POST["lanid"]) && isset($_POST["ticket"])) {
    $newticket = new Lan_addons_sold();
    $newticket->lan_id = $newticket->escape($_POST["lanid"]);
    $newticket->user_id = $newticket->escape($_POST["user"]);
    $newticket->addon_id = $newticket->escape($_POST["ticket"]);
    $newticket->insert();
    $lan = new Lan_events();
    $lan->get($lan->escape($_GET["id"]));
    $group = new Lan_addons_groups();
    $group->get($newticket->escape($_POST["ticket"]));
    $Frontend = new FrontEnd();
    logMessage($Frontend->getUserId(), 0, "Added new '" . $group->name . "' ticket for " . $Frontend->getName($newticket->user_id) . " at " . $lan->name);
}
 /**
  * Регистрация
  * @return
  */
 function registerAction()
 {
     if ($this->view->identity) {
         $this->_redirect('/');
     }
     if (!$this->userRegistrationAllowed) {
         return $this->_forward('login');
     }
     $this->textRow('register');
     $form = $this->getFormRegister();
     if ($this->getRequest()->isPost()) {
         $rawData = $this->getRequest()->getPost();
         l($rawData, __METHOD__ . ' rawData');
         if ($form->isValid($rawData)) {
             $v = $form->getValues();
             $row = $this->getRow('users', 'email = "' . $v['email'] . '" OR LCASE(username) = "' . strtolower($v['username']) . '"');
             if ($row) {
                 #$this->setN(FrontEnd::getMsg(array('auth', 'loginExists')), 'errors');
                 $this->view->notifyerr[] = FrontEnd::getMsg(array('auth', 'loginExists'));
             } else {
                 $data = $v;
                 $data['password'] = md5($v['password']);
                 $data['created'] = new Zend_Db_Expr('NOW()');
                 l($data, __METHOD__ . ' data');
                 $row = $this->users->createRow($data);
                 $res = $row->save();
                 l($res, __METHOD__ . ' save() res');
                 if ($res) {
                     if (isset($this->conf->auth->mailRegister)) {
                         $data['password'] = $v['password'];
                         Users::mailRegister($data);
                     }
                     #$this->setN(FrontEnd::getMsg(array('auth', 'regSuccess')));#$this->setContent('');
                     $this->view->notifymsg[] = FrontEnd::getMsg(array('auth', 'regSuccess'));
                     #d($this->view->notifymsg);
                     $this->view->done = true;
                 }
             }
         } else {
             $this->view->errors = $form->getMessages();
             #d($res);
             #$this->setN(FrontEnd::getMsg(array('form', 'errors')), 'errors');
             $this->view->notifyerr[] = FrontEnd::getMsg(array('form', 'errors'));
         }
         #$this->_redirect($this->view->requestUri);
     }
     $this->view->form = $form;
 }
Exemple #9
0
 /**
  * Get message
  * @param
  * @return
  */
 function msg($key)
 {
     if (!empty($this->_msg[$key])) {
         return $this->_msg[$key];
     } else {
         return FrontEnd::getMsg($key);
     }
     return null;
 }
Exemple #10
0
?>
<!DOCTYPE html>
<head>
	<meta charset="<?php 
bloginfo('charset');
?>
" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta name="copyright" content="Copyright <?php 
echo date('Y'), ' ', bloginfo('name');
?>
. All Rights Reserved." />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-ui" />

	<?php 
FrontEnd::getTitle();
?>

	<link rel="profile" href="//gmpg.org/xfn/11" />
	<link rel="pingback" href="<?php 
bloginfo('pingback_url');
?>
" />
	<link rel="image_src" href="" />
	<link rel="shortcut icon" href="/favicon.ico" />

	<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons" />
	<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto+Slab:400,700,300" />
	<link rel="stylesheet" href="<?php 
echo bowerDir;
?>
 public function test_GetCSS_Fail()
 {
     // This is the test case used which gives incorrect input and it is matched with the css in getCss function in FrontEnd.php file
     $form = 'abc';
     $this->assertNotEquals($form, FrontEnd::getCss());
 }
Exemple #12
0
if (isset($_GET["user-session-login"])) {
    if (streq($_GET["user-session-login"], "1")) {
        if (isset($_POST["Register"])) {
            //Register button clicked
            global $master;
            $master->AddWarning("Register on the <a href=\"http://lanops.co.uk/signup.php\">main web site *click here*</a>.");
            return;
        }
        $login = $_POST["user"];
        $password = $_POST["password"];
        $loginOK = checkLogin($login, $password);
        if ($loginOK) {
            startSession($loginOK->user_id, $loginOK->username);
            //header( 'Location: intranet.php' ) ;
        } else {
            $Frontend = new FrontEnd();
            if (!streq("0", $Frontend->getUserId())) {
                $Frontend->pullUserInfo($Frontend->getUserId());
                $loginOK = checkLogin($login, $password);
                if ($loginOK) {
                    startSession($loginOK->user_id, $loginOK->username);
                    //header( 'Location: intranet.php' ) ;
                } else {
                    $displayError = true;
                }
            } else {
                $displayError = true;
            }
            /**
            			 echo "nok";
            			 //Login failed, so check remote site.
{{ App::setLocale('ko') }}
{{ XeLang::trans('lang::message', ['name' => '준호']) }}<br/>
{{ XeLang::transChoice('lang::bananas', 1) }}<br/>
{{ XeLang::transChoice('lang::bananas', 2) }} => 복수지만 locale이 ko라서 첫번째 문장이 선택됨<br/>
{{ XeLang::transChoice('lang::apples', 0) }} => 0<br/>
{{ XeLang::transChoice('lang::apples', 1) }} => 1<br/>
{{ XeLang::transChoice('lang::apples', 19) }} => 19<br/>
{{ XeLang::transChoice('lang::apples', 20) }} => 20<br/>
{{ App::setLocale('en') }}
<br/>

<h4>프론트엔드 다국어</h4>
<span>
<?php 
FrontEnd::translation('lang::message');
Frontend::translation('lang::bananas');
Frontend::translation('lang::next');
Frontend::translation(['lang::week.mon', 'lang::week.tue']);
Frontend::translation('lang::nothing');
?>
    <script>
        document.write(XE.Lang.trans('lang::message', {'name': '준호'}) + "<br/>");
        document.write(XE.Lang.transChoice('lang::bananas', 1) + "<br/>");
        document.write(XE.Lang.transChoice('lang::bananas', 2) + "<br/>");
        document.write(XE.Lang.trans('lang::next') + "<br/>");
        document.write(XE.Lang.trans('lang::previous') + " => 존재하는 key이지만 load를 안한경우<br/>");
        document.write(XE.Lang.trans('lang::week.mon') + "<br/>");
        document.write(XE.Lang.trans('lang::week.tue') + "<br/>");
        document.write(XE.Lang.trans('lang::nothing') + " => 존재하지 않는 key는 head의 다국어 script에 set 되지도 않게 함<br/>");
    </script>
Exemple #14
0
 function addComment($identityId)
 {
     $res = false;
     $form = new Form_Comment();
     $formData = Zend_Controller_Front::getInstance()->getRequest()->getPost();
     if ($form->isValid($formData)) {
         $uid = $form->getValue('user_id', 0);
         if ($identityId != $uid) {
             l($uid, __METHOD__ . ': $uid invalid!', Zend_Log::DEBUG);
             return false;
         }
         $data = $form->getValues();
         $data['dt'] = $data['tm'] = dateMySQL();
         l($data, __METHOD__ . ': $data', Zend_Log::DEBUG);
         $res = $this->createComment($data);
     } else {
         l($formData, __METHOD__ . ': INVALID_COMMENT::formData', Zend_Log::DEBUG);
         Zend_Registry::set('comment_error', FrontEnd::getMsg(array('comments', 'fail')));
     }
     return $res;
 }
Exemple #15
0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once $_SERVER["DOCUMENT_ROOT"] . '/core/core.php';
$microbordo = new MicroBordo();
$frontend = new FrontEnd();
?>
<!DOCTYPE html>
<html>
    <head>
        <title><?php 
$microbordo->pageTitle();
?>
</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="icon" type="image/x-icon" href="<?php 
echo MicroBordo::BASE_URL . MicroBordo::IMG_DIR;
?>
favicon.ico" />

        <?php 
<?php

if (isset($_POST["Update"])) {
    $frontend = new FrontEnd();
    $user = new Lan_users();
    $id = POSTSafe("userid");
    if ($user->get($id)) {
        $currentpassword = $frontend->encryptPassword(POSTSafe("currentpass"));
        if (streq($currentpassword, $user->password)) {
            if (strlen(POSTSafe("newpass")) > 0) {
                $user->password = $frontend->encryptPassword(POSTSafe("newpass"));
            }
            $user->steamprofile = POSTSafe("steamprofile");
            $user->updateSteamData();
            $user->update();
            //Reset session if we are changing the current user, so we make sure the session has the latest data.
            if (streq(getCurrentUID(), $user->user_id)) {
                startSession($user->user_id, $user->username);
            }
        } else {
            $master->AddWarning("Incorrect current password!");
        }
    }
}
Exemple #17
0
{
    $date = strtotime($data);
    $fdate = strftime("%d/%m/%Y %H:%M", $date);
    return $fdate;
}
$lan = new Lan_events();
if (isset($_GET["id"])) {
    if ($lan->get($lan->escape($_GET["id"]))) {
        $lan->start = convertDateOut($lan->start);
        $lan->end = convertDateOut($lan->end);
        // Get attendees
        $attendees = new Lan_attendees();
        $attendees->lan_id = $lan->id;
        $attendees->find();
        $attendeeslist = array();
        $Frontend = new FrontEnd();
        $allusers = $Frontend->getAllUsers();
        while ($attendees->fetch()) {
            // Get tickets for the attendee
            $sold = new Lan_addons_sold();
            $sold->lan_id = $lan->id;
            $sold->user_id = $attendees->user_id;
            $sold->find();
            $soldlists = array();
            while ($sold->fetch()) {
                $g = new Lan_addons_groups();
                $g->get($sold->addon_id);
                $g->tid = $sold->id;
                $soldlists[] = clone $g;
            }
            $attendees->tickets = $soldlists;
Exemple #18
0
 /**
  * Set notification via Flash Messanger
  * @deprecated
  * @uses Table::setN
  * @param string $s
  */
 function setN($s, $ns = 'default')
 {
     FrontEnd::setN($s, $ns);
     /*
     		$this->_flashMessenger->setNamespace('errors')->addMessage(FrontEnd::getMsg(array('update', 'fail')));
     		if (is_array($s)) {
     			foreach ($s as $k => $v)
     			{
     				$this->_flashMessenger->setNamespace($ns)->addMessage(current($v));
     			}
     		} else {
     	        $this->_flashMessenger->setNamespace($ns)->addMessage($s);
     		}
     */
 }
Exemple #19
0
 function upload()
 {
     #d($this);
     $res = $this->_upload();
     #d($res);
     if (is_array($res)) {
         $messages = $res['messages'];
         $res = $res['res'];
     }
     if ($res) {
         $this->getTable()->setN(FrontEnd::getMsg(array('upload', 'ok')), 'success');
     } else {
         $this->getTable()->setN(FrontEnd::getMsg(array('upload', 'fail')), 'errors');
         if (!empty($messages)) {
             foreach ($messages as $value) {
                 $this->getTable()->setN($value, 'errors');
             }
         }
     }
     return $res;
 }
Exemple #20
0
<?php

/**
 * HTW
 *
 * Build: video
 */
$ytUrl = CFS()->get('youtube_url');
$ytID = FrontEnd::extractYT($ytUrl);
$img = "//img.youtube.com/vi/{$ytID}/hqdefault.jpg";
?>

<figure class="item row" itemscope itemtype="http://schema.org/Review">
	<div class="s12 m3 col image full-bg" style="
		background-image: url(<?php 
echo $img;
?>
)
	">
		<a href="<?php 
echo $ytUrl;
?>
" target="_blank" class="cover"></a>
		<img src="<?php 
echo $img;
?>
" class="invisible" itemprop="image" />
	</div>

	<div class="s12 m8 col desc">
		<a href="<?php 
Exemple #21
0
<?php

include_once 'core.php';
include 'skins/' . Config::$theme . '/setup.php';
include_once 'integration/integration.php';
//Pull through user ID
$frontend = new FrontEnd();
setCurrentUser($frontend->getUserId());
startSession(getCurrentUID(), $frontend->getName(getCurrentUID()));
//Check user is in db and run checks.
$frontend->pullUserInfo(getCurrentUID());
$frontend->checkGroups(getCurrentUID(), getCurrentLID());
$frontend->disconnect();
$page = new Lan_pages();
$page->name = GETSafe('page');
$page->find();
if ($page->fetch()) {
    $file = 'modules/' . $page->module . '/' . $page->file . '.php';
    if (file_exists($file)) {
        include $file;
        $master->RenderPage($page->module . '.' . $page->file . '.htm');
    } else {
        $master->AddError("The file for this page does not exist!");
    }
} else {
    $master->AddError("Unknown page!");
}
if ($master->HasFatalError()) {
    $master->RenderPage('error.htm');
}
$master->RenderSite('master.integration.htm');
Exemple #22
0
 protected function setLayout()
 {
     parent::setLayout();
     if ($this->fw->exists('node', $node)) {
         \helpers\Layout::setPropertiesFromNode($node);
         \helpers\Layout::setBreadcrumbsFromNode($node, $this->struct_page);
     }
     if (!empty($this->tree_nodes)) {
         \helpers\Layout::setPropertiesFromNode($this->tree_node);
         \helpers\Layout::setBreadcrumbsTree($this->tree_nodes, $this->struct_pages);
     }
 }