/** * Only Admin can continue */ function onlyForAdmin() { if (!\Ease\Shared::user()->getSettingValue('admin')) { $this->addStatusMessage(_('Only for admin'), 'warning'); $this->redirect('login.php'); exit; } }
public function articleListing() { $oUser = \Ease\Shared::user(); if ($oUser->getSettingValue('admin')) { $articles = $this->newsEngine->getColumnsFromSQL('*', null, 'id', 'id'); } else { $articles = $this->newsEngine->dblink->queryToArray('SELECT * FROM ' . $this->newsEngine->getMyTable() . ' WHERE author = ' . $oUser->getUserID(), 'id', 'id'); } $list = new \Ease\Html\OlTag(); foreach ($articles as $articleID => $article) { $listRow = new \Ease\Html\Span(); $listRow->addItem(new \Ease\Html\ATag('?id=' . $articleID, $article['title'])); $listRow->addItem(' ('); $listRow->addItem(new \Ease\JQuery\ConfirmedLinkButton('?delete=' . $articleID, _('Delete'))); $listRow->addItem(')'); $list->addItemSmart($listRow); } return $list; }
public function finalize() { \Ease\Shared::webPage()->addJavaScript(' window.fbAsyncInit = function() { FB.init({ appId : \'186287018435097\', xfbml : true, version : \'v2.6\' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/cs_CZ/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\')); '); }
/** * Hlavní menu aplikace * * @param string $name * @param mixed $content * @param array $properties */ public function __construct($name = null, $content = null, $properties = null) { parent::__construct("Menu", new \Ease\Html\ImgTag('images/LinkQuickTwitterLogo.png', 'NetspotAdmin', 20, 20, ['class' => 'img-rounded']), ['class' => 'navbar-fixed-top']); $user = \Ease\Shared::user(); \Ease\TWB\Part::twBootstrapize(); if (!$user->getUserID()) { // $this->addMenuItem('<a href="createaccount.php">' . \Ease\TWB\Part::GlyphIcon('leaf') . ' ' . _('Register') . '</a>', 'right'); $this->addMenuItem(' <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" href="login.php" data-toggle="dropdown"><i class="icon-circle-arrow-left"></i> ' . _('Logon') . '<strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px; left: -120px;"> <form method="post" class="navbar-form navbar-left" action="login.php" accept-charset="UTF-8"> <input class="form-control" style="margin-bottom: 15px;" type="text" placeholder="' . _('Username') . '" id="username" name="login"> <input class="form-control" style="margin-bottom: 15px;" type="password" placeholder="' . _('Password') . '" id="password" name="password"> <!-- input style="float: left; margin-right: 10px;" type="checkbox" name="remember-me" id="remember-me" value="1"> <label class="string optional" for="remember-me"> ' . _('zapamatuj si mne') . '</label --> <input class="btn btn-primary btn-block" type="submit" id="sign-in" value="' . _('Log in') . '"> </form> </div>', 'right'); } else { $userID = EaseShared::user()->getUserID(); if ($userID) { $myLinksCount = EaseShared::myDbLink()->queryToValue('SELECT COUNT(*) FROM entry WHERE owner=' . $userID); } else { $myLinksCount = EaseShared::myDbLink()->queryToValue('SELECT COUNT(*) FROM entry'); } $brand = new \Ease\HtmlDivTag('sitelogo', $myLinksCount, ['class' => 'brand']); $this->addMenuItem($brand); $userMenu = '<li class="dropdown" style="width: 120px; text-align: right; background-image: url( ' . $user->getIcon() . ' ) ; background-repeat: no-repeat; background-position: left center; background-size: 40px 40px;"><a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $user->getLogin() . ' <b class="caret"></b></a> <ul class="dropdown-menu" style="text-align: left; left: -60px;"> <li><a href="settings.php">' . \Ease\TWB\Part::GlyphIcon('wrench') . '<i class="icon-cog"></i> ' . _('Settings') . '</a></li> '; $this->addMenuItem($userMenu . ' <li><a href="http://v.s.cz/ease.php">' . \Ease\TWB\Part::GlyphIcon('envelope') . ' ' . _('Developer support') . '</a></li> <li class="divider"></li> <li><a href="logout.php">' . \Ease\TWB\Part::GlyphIcon('off') . ' ' . _('Logout') . '</a></li> </ul> </li> ', 'right'); } }
/** * Menu including */ function afterAdd() { $nav = $this->addItem(new BootstrapMenu()); $user = \Ease\Shared::user(); if ($user->getSettingValue('admin')) { $nav->addMenuItem(new \Ease\TWB\LinkButton('newsedit.php', '<i class="fa fa-pencil"></i> ' . _('Edit news'))); } $nav->addMenuItem(new \Ease\Html\ATag('music.php', _('Music'))); $nav->addMenuItem(new \Ease\Html\ATag('writeme.php', _('Write me'))); $nav->addMenuItem(new \Ease\Html\ATag('video.php', _('Video'))); $nav->addMenuItem(new \Ease\Html\ATag('gallery.php', _('Gallery'))); if ($user->getSettingValue('admin')) { $nav->addMenuItem(new \Ease\TWB\LinkButton('galleryedit.php', '<i class="fa fa-pencil"></i> ' . _('Edit Gallery'))); } // $nav->addMenuItem(new \Ease\Html\ATag('download.php', _('Download'))); $nav->addMenuItem(new \Ease\Html\ATag('lyrics.php', _('Lyrics'))); if ($user->getSettingValue('admin')) { $nav->addMenuItem(new \Ease\TWB\LinkButton('lyricsedit.php', '<i class="fa fa-pencil"></i> ' . _('Edit lyrics'))); } $nav->addMenuItem(new \Ease\Html\ATag('contact.php', _('Contact'))); }
/** * Menu including */ function afterAdd() { $nav = $this->addItem(new BootstrapMenu()); $user = \Ease\Shared::user(); $userID = $user->getUserID(); if ($userID) { $icon = $user->getIcon(); if ($icon) { $nav->addMenuItem(new \Ease\Html\SpanTag('UserIcon', new \Ease\Html\ATag('settings.php', new \Ease\Html\ImgTag($icon, $user->getUserLogin(), 40, 40)))); } else { $nav->addMenuItem(new \Ease\Html\SpanTag('User', new \Ease\Html\ATag('settings.php', $user->getUserLogin()))); } } $nav->addMenuItem(new \Ease\Html\ATag('index.php', _('Add new'))); if ($userID) { $nav->addMenuItem(new \Ease\Html\ATag('list.php', _('My Shortcuts'))); $nav->addMenuItem(new \Ease\Html\ATag('logout.php', _('Sign out'))); } else { $nav->addMenuItem(new \Ease\Html\ATag('login.php', _('Sign IN'))); $nav->addMenuItem(new \Ease\Html\ATag('createaccount.php', _('Create account'))); } }
} if ($error == false) { $newOUser = new User(); $customerData = ['firstname' => $firstname, 'lastname' => $lastname, 'email' => $email_address, 'password' => $newOUser->encryptPassword($password), 'login' => $login]; $customerID = $newOUser->insertToSQL($customerData); if ($customerID) { $newOUser->setMyKey($customerID); $oUser->addStatusMessage(_('Account Was Created'), 'success'); $newOUser->loginSuccess(); $email = $oPage->addItem(new \Ease\Mail($newOUser->getDataValue('email'), _('New LinkQuick account'))); $email->setMailHeaders(['From' => EMAIL_FROM]); $email->addItem(new \Ease\Html\Div(_("Welcome to LinkQuick") . "\n")); $email->addItem(new \Ease\Html\Div(_('Login') . ': ' . $newOUser->getUserLogin() . "\n")); $email->addItem(new \Ease\Html\Div(_('Password') . ': ' . $password . "\n")); $email->send(); \Ease\Shared::user($newOUser); //Assign newly created user as default $oPage->redirect('index.php'); exit; } else { $oUser->addStatusMessage(_('Error creating account'), 'error'); } } } $oPage->addItem(new PageTop(_('Account Registration'))); $oPage->column1->addItem(new \Ease\Html\Div(_('Register to edit your shortcuts'), ['id' => 'WelcomeHint'])); $regBlock = $oPage->column2->addItem(new \Ease\TWB\Panel(_('Registration'), 'success')); $regForm = $regBlock->addItem(new \Ease\TWB\Form('create_account', 'createaccount.php')); $regForm->setTagID('LoginForm'); $regForm->addItem(new \Ease\Html\H3Tag(_('Account'))); $regForm->addInput(new \Ease\Html\InputTextTag('login', $login), _('Login'), null, _('Requied'));
} else { $oUser->addStatusMessage(_('User account created'), 'success'); } $newOUser->loginSuccess(); $email = $oPage->addItem(new \Ease\Mailer($newOUser->getDataValue('email'), _('New account confirmation'))); $email->setMailHeaders(['From' => EMAIL_FROM]); $email->addItem(new \Ease\Html\Div("Account created:\n")); $email->addItem(new \Ease\Html\Div(' Login: '******' Heslo: ' . $_POST['password'] . "\n")); $email->send(); $email = $oPage->addItem(new \Ease\Mailer(SEND_INFO_TO, sprintf(_('New sign on %s'), $newOUser->GetUserLogin()))); $email->setMailHeaders(['From' => EMAIL_FROM]); $email->addItem(new \Ease\Html\Div(_("New user account:\n"))); $email->addItem(new \Ease\Html\Div(' Login: '******'index.php'); exit; } else { $oUser->addStatusMessage(_('New account was not created'), 'error'); $email = $oPage->addItem(new \Ease\Mail(constant('SEND_ORDERS_TO'), 'New account was not created')); $email->addItem(new \Ease\Html\DivTag('Account', $oPage->printPre($newOUser->getData()))); $email->send(); } } } $oPage->addItem(new PageTop(_('Sign up'))); $regFace = $oPage->container->addItem(new \Ease\TWB\Panel(_('Sign up'))); $regForm = $regFace->addItem(new ColumnsForm(new \Ease\User())); if ($oUser->getUserID()) { $regForm->addItem(new \Ease\Html\InputHiddenTag('parent', $oUser->GetUserID()));
<?php /** * SkeliCZ - Title page * * @package SkeliCZ * @author Vitex <*****@*****.**> * @copyright 2009-2016 info@vitexsoftware.cz (G) */ namespace SkeliCZ; require_once 'includes/SkeliInit.php'; if ($oUser->getUserID()) { $oUser->logout(); $messagesBackup = $oUser->getStatusMessages(TRUE); \Ease\Shared::user(new \Ease\Anonym()); $oUser->addStatusMessages($messagesBackup); } $oPage->addItem(new PageTop(_('Sign off'))); $oPage->container->addItem('<br/><br/><br/><br/>'); $oPage->container->addItem(new \Ease\Html\Div(new \Ease\Html\ATag('login.php', _('Good bye & next time'), ['class' => 'jumbotron']))); $oPage->container->addItem('<br/><br/><br/><br/>'); $oPage->addItem(new PageBottom()); $oPage->draw();
/** * Give you number of codes for given domain * * @param string $domain * @return int codes for domain in database */ public static function getCodeCount($domain) { return (int) \Ease\Shared::db()->queryToValue('SELECT count(*) FROM entry WHERE domain=\'' . $domain . '\''); }
require_once '../vendor/autoload.php'; //Initialise Gettext $langs = ['en_US' => ['en', 'English (International)'], 'cs_CZ' => ['cs', 'Česky (Čeština)']]; $locale = "en_US"; if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { $locale = locale_accept_from_http($_SERVER["HTTP_ACCEPT_LANGUAGE"]); } if (isset($_GET["locale"])) { $locale = preg_replace("/[^a-zA-Z_]/", "", substr($_GET["locale"], 0, 10)); } foreach ($langs as $code => $lang) { if ($locale == $lang[0]) { $locale = $code; } } setlocale(LC_ALL, $locale); bind_textdomain_codeset("skelicz", "UTF-8"); putenv("LC_ALL={$locale}"); bindtextdomain('skelicz', './i18n'); textdomain('skelicz'); session_start(); /** * User Object * @global \Ease\Anonym | SkeliCZ\User */ $oUser = \Ease\Shared::user(); /** * WebPage Object * @global WebPage */ $oPage = new WebPage();
/** * SkeliCZ - Login page * * @package SkeliCZ * @author Vitex <*****@*****.**> * @copyright 2009-2016 info@vitexsoftware.cz (G) */ namespace SkeliCZ; require_once 'includes/SkeliInit.php'; if (!is_object($oUser)) { die(_('Cookies required')); } $login = $oPage->getRequestValue('login'); if ($login) { $oUser = \Ease\Shared::user(new User()); // \Ease\Shared::user()->SettingsColumn = 'settings'; if ($oUser->tryToLogin($_POST)) { $oPage->redirect('index.php'); exit; } } else { $oPage->addStatusMessage(_('Please enter your login and password')); } $oPage->addItem(new PageTop(_('Sign in'))); $loginFace = new \Ease\Html\Div(null, ['id' => 'LoginFace']); $oPage->container->addItem($loginFace); $loginRow = new \Ease\TWB\Row(); $infoColumn = $loginRow->addItem(new \Ease\TWB\Col(4)); $infoBlock = $infoColumn->addItem(new \Ease\TWB\Well(new \Ease\Html\ImgTag('images/password.png'))); $infoBlock->addItem(_('Welcome to Skeli.cz'));
function finalize() { $recordID = $this->engine->getMyKey(); $this->addItem(new \Ease\Html\InputHiddenTag('class', get_class($this->engine))); if (!is_null($recordID)) { $this->addItem(new \Ease\Html\InputHiddenTag($this->engine->myKeyColumn, $recordID)); } $this->addItem($this->savers); \Ease\Shared::webPage()->includeJavaScript('js/jquery.validate.js'); \Ease\Shared::webPage()->includeJavaScript('js/messages_cs.js'); return parent::finalize(); }