Example #1
0
function generate_page($url, $title, $content)
{
    global $CSS_STYLE;
    raintpl::$tpl_dir = './tpl/';
    // template directory
    raintpl::$cache_dir = "./cache/";
    // cache directory
    raintpl::$base_url = url();
    // base URL of blog
    raintpl::configure('path_replace', false);
    raintpl::configure('debug', true);
    $tpl = new raintpl();
    //include Rain TPL
    $tpl->assign("url", $url);
    $tpl->assign("tinyurl", md5($url));
    $tpl->assign("title", $title);
    $tpl->assign("isLogged", Session::isLogged());
    if (Session::isLogged()) {
        $tpl->assign("username", $_SESSION['username']);
        $tpl->assign("logpage", "./log.php?logout");
        $tpl->assign("logname", "Logout");
    } else {
        $tpl->assign("logpage", "./log.php");
        $tpl->assign("logname", "Login");
    }
    $tpl->assign("content", $content);
    $tpl->assign("version", VERSION);
    $tpl->draw("article");
    // draw the template
}
 public function comment(Analyse $analysis)
 {
     if (Session::isLogged()) {
         return $this->dao->comment($analysis);
     } else {
         throw new LoginException("Faça o login para poder deixar seu comentário");
     }
 }
Example #3
0
 public function __construct()
 {
     try {
         //rendereiza o construtor da classe pai
         $empresasRelacionadas = array();
         parent::__construct();
         $this->empresas_id = Session::read('Empresa.empresas_id');
         /* PEGAR O ID DA EMPRESA NA SEÇÃO */
         $this->pessoas_id = Session::read('Usuario.pessoas_id');
         /* PEGAR O ID DA EMPRESA NA SEÇÃO */
         $this->css = array('css/bootstrap', 'bs3/css/bootstrap.min', 'css/bootstrap_papper', 'css/bootstrap-reset', 'font-awesome/css/font-awesome', 'css/style', 'css/style-responsive', 'css/custom', 'js/advanced-datatable/css/demo_page', 'js/advanced-datatable/css/demo_table', 'css/Icomoon/style', 'css/preloader', 'js/data-tables/DT_bootstrap', 'js/bootsAlert/css/bootsAlert', 'js/chosen/chosen');
         $this->js = array('js/jquery-1.11.1.min', 'bs3/js/bootstrap.min', 'js/jquery-ui-1.9.2.custom.min', 'js/ajaxForm', 'js/ckeditor/ckeditor', 'js/jquery.scrollTo.min', 'js/jQuery-slimScroll-1.3.0/jquery.slimscroll', 'js/jquery.nicescroll', 'js/dashboard', 'js/sparkline/jquery.sparkline', 'js/advanced-datatable/js/jquery.dataTables.min', 'js/advanced-datatable/js/dataTables.bootstrap.min', 'js/advanced-datatable/js/dataTables.responsive.min', 'js/dynamic_table_init', 'js/jquery.mask.min', 'js/funcoes', 'js/permission_js', 'js/scripts', 'js/bootsAlert/js/bootsAlert', 'js/chosen/chosen.jquery.min');
         $this->ACL = new ACL();
         $this->Util = new Utils();
         $this->Empresa = new Empresa();
         /**
          * definindo a data hora local
          */
         date_default_timezone_set('America/Sao_Paulo');
         if (!in_array($this->view, $this->ClasseAllow)) {
             if (Session::check('Auth') && Session::check('Usuario')) {
                 if ($this->ACL->authenticacaoUser($this->controller, $this->view, Session::read('Usuario.roles_id'))) {
                     Session::isLogged();
                 } else {
                     //verifica se é um metodo ou pagina
                     if ($this->autoRender == true) {
                         throw new PageException("Pagina {$this->view}.php não encontrada", 405);
                     }
                 }
             } else {
                 //logica para o usuario publico
                 if ($this->ACL->authenticacaoUser($this->controller, $this->view, 1)) {
                     //header('Location: ' . Router::url() . 'Erros/areaRestrita' );
                 } else {
                     //verifica se é um metodo ou pagina
                     if ($this->autoRender) {
                         //redireciona para a pagina de area restrita
                         throw new PageException("Pagina {$this->view}.php não encontrada", 405);
                     }
                 }
             }
         }
         /**
          * variaveis pora todas as areas do sistema
          */
         if (in_array(Session::read('Usuario.roles_id'), array(3, 4))) {
             $empresasRelacionadas = $this->Empresa->empresasRelacionadas(md5($this->pessoas_id), Session::read('Usuario.roles_id'));
         }
         $this->set('empresasRelacionadas', $empresasRelacionadas);
         $this->set('css', $this->css);
     } catch (PageException $ex) {
         echo $ex->pageNotFound();
         exit;
     } catch (Exception $ex) {
         echo $ex->getTraceAsString();
     }
 }
Example #4
0
 protected function get_index()
 {
     $conf = Config::getInstance();
     if (Session::isLogged()) {
         Output::redirect(WWW_PATH);
     }
     $conf = Config::getInstance();
     $tpt = new TemplateRes(array("title" => $conf->get("title"), "description" => $conf->get("description"), "favicon" => $conf->get("favicon", null)));
     $tpt->output("login.php");
 }
 public function __construct()
 {
     $token = Request::value('token');
     if (!Session::isLogged() && !Session::getUserByToken($token)) {
         if (Request::get('service') == "1") {
             $j = array();
             $j['status'] = "danger";
             $j['message'] = "Você não está logado ou seu login expirou.";
             $j['redirect'] = "/" . APP_DIR . "login";
             echo json_encode($j);
         } else {
             Router::redirect('login');
         }
     }
 }
Example #6
0
 protected function user($r)
 {
     $user = Session::isLogged();
     if (Session::Has(Session::rights_key)) {
         $rights = Session::Get(Session::rights_key);
     } else {
         $rights = array();
     }
     if ($user) {
         if (Session::Has(self::userid)) {
             $userid = Session::Get(self::userid);
             $userdata = $this->getUserData($userid);
         } else {
             $userid = false;
             $userdata = array();
         }
         Output::success(array_merge(array("user" => $userid, "rights" => $rights), $userdata));
     }
     Output::success(array("user" => false, "rights" => array()));
 }
Example #7
0
 function metodo1()
 {
     $sesion = new Session();
     if (!$sesion->isLogged()) {
         self::metodo0();
     } else {
         $pagina = file_get_contents('./_plantilla/_principal.html');
         ob_start();
         include "./_plantilla/_user.php";
         $formularios = ob_get_clean();
         ob_start();
         include "./_plantilla/_miniaturas.php";
         $miniaturas = ob_get_clean();
         $footer = file_get_contents('./_plantilla/_footer.html');
         $datos = array("formularios" => $formularios, "miniaturas" => $miniaturas, "footer" => $footer);
         foreach ($datos as $key => $value) {
             $pagina = str_replace("{" . $key . "}", $value, $pagina);
         }
         echo $pagina;
     }
 }
Example #8
0
 /**
  * Create a folder for ressouesrc
  */
 public static function create_assets_directory($url)
 {
     $path = './' . SAVED_PATH;
     if (Session::isLogged() && $_SESSION['username'] != null) {
         $path .= '/' . $_SESSION['username'];
     } else {
         $path .= '/public';
     }
     if (!is_dir($path)) {
         mkdir($path, 0705);
     }
     $article_directory = $path . '/';
     if (Utils::isValidMd5($url)) {
         $article_directory .= $url;
     } else {
         $article_directory .= md5($url);
     }
     if (!is_dir($article_directory)) {
         mkdir($article_directory, 0705);
     }
     return $article_directory;
 }
Example #9
0
 public function testDataManger()
 {
     $this->assertNull($this->object->getData('x'));
     $this->assertEquals(1, $this->object->getData('x', 1));
     $this->object->setData('x', 2);
     $this->assertEquals(2, $this->object->getData('x'));
     $this->assertEquals(2, $this->object->getData('x', 1));
     $this->object->removeData('x');
     $this->assertNull($this->object->getData('x'));
     $this->object->setData('y', 'hello');
     $this->object->removeData('Y');
     $this->assertEquals('hello', $this->object->getData('y'));
     $this->assertFalse($this->object->isLogged());
     $this->object->setData('_logged', true);
     $this->assertNull($this->object->getData('_logged'));
     $this->assertFalse($this->object->isLogged());
     $this->object->setCurrentUser(1, 'test', array('teste'), array('a' => 1234));
     $this->assertTrue($this->object->isLogged());
     $this->assertNull($this->object->getData('_logged'));
     $this->object->removeData('_logged');
     $this->assertTrue($this->object->isLogged());
     $this->assertEquals(1234, $this->object->getData('a'));
 }
 static function handle()
 {
     $bd = new BaseDatos();
     $gestor = new ManageArtist($bd);
     $sesion = new Session();
     $action = Request::req("action");
     $do = Request::req("do");
     $metodo = $action . ucfirst($do);
     if (!$sesion->isLogged()) {
         header("Location:../frontend/index.php");
         exit;
     } else {
         if ($sesion->getUser()->getActivo() != 1) {
             header("Location:../frontend/index.php");
         } else {
             if (method_exists(get_class(), $metodo)) {
                 self::$metodo($gestor);
             } else {
                 self::readView($gestor);
             }
         }
     }
     $bd->close();
 }
Example #11
0
 /**
  * @return User
  */
 public static function getLoggedUser()
 {
     return Session::isLogged() ? unserialize($_SESSION[self::$USER_SESSION]) : null;
 }
Example #12
0
                            <?endif?>
                        </div>

                        <div class="clear"></div>
                        
                        <div id="on-right">
                              <!-- #################### -->
                            <!-- FORM LOGIN           -->
                            <!-- #################### -->
                            <?//if(!Session::isLogged()):?>
                            <div class="grid_7 form-login" id="form-login-main">
                                <?if(isset($_GET['login-fail'])):?>
                                <div class="error">usuário e/ou senha inválidos</div>
                                <?endif?>
                                <form action="login" method="POST">
                                    <?if(!Session::isLogged()):?>
                                    Usuário: <input name="username" type="text" value="" class="inpt-txt" /> <br />
                                    Senha: <input name="password" type="password" value="" class="inpt-txt" /> <br />
                                    <span id="updateAll" class="updating-all">
                                        <img style="margin-top: 3px;" src="<?echo LinkController::getBaseURL()?>/images/refresh.png" alt="Atualizar tudo" title="Atualizar todas as caixas abertas"/>
                                    </span>
                                    <span id="ajaxRefreshGif" class="updating-all" style="display: none">
                                        <img style="margin-top: 3px; margin-bottom: 1px;" src="<?echo LinkController::getBaseURL()?>/images/ajax-refresh.gif"/>
                                    </span>                                    
                                    <a id="forget-pass" href="" class="l1">esqueci senha</a>
                                    <input type="submit" value="logar" id="bt-logar" />
                                    <?else:?>                                
                                    Usuário: <input name="username" type="text" value="<?echo Session::getLoggedUser()->username()?>" class="inpt-txt" /> <br />
                                    Senha: <input name="password" type="password" value="xxxxx" class="inpt-txt" /> <br />
                                    <span id="updateAll" class="updating-all">
                                        <img style="margin-top: 3px;" src="<?echo LinkController::getBaseURL()?>/images/refresh.png" alt="Atualizar tudo" title="Atualizar todas as caixas abertas"/>
Example #13
0
File: Yogo.php Project: vinerz/yogo
error_reporting(E_ALL);
define('DS', DIRECTORY_SEPARATOR);
define('YG_BASEPATH', dirname(__FILE__));
define('YG_INCLUDEPATH', YG_BASEPATH . DS . 'includes');
define('YG_TEMPLATEPATH', dirname(__FILE__) . DS . 'themes');
define('YG_TEMPLATEPATH_REL', '/app/themes');
define('YG_LANG_DIR', YG_BASEPATH . DS . 'languages');
define('YG_PLUGIN_DIR', YG_BASEPATH . DS . 'plugins');
define('YG_PLUGINDIR_REL', '/app/plugins');
require_once YG_BASEPATH . DS . 'settings.inc.php';
require_once YG_INCLUDEPATH . DS . 'bcrypt.class.php';
require_once YG_INCLUDEPATH . DS . 'core.class.php';
require_once YG_INCLUDEPATH . DS . 'session.class.php';
require_once YG_INCLUDEPATH . DS . 'stringmanager.php';
require_once YG_INCLUDEPATH . DS . 'functions.php';
if (!Session::isLogged() && (!defined('YG_SKIP_LOGINCHECK') || YG_SKIP_LOGINCHECK == false)) {
    header('Location: ' . get_site_url() . '/login.php?msg=notauthorized&returnpath=' . rawurlencode(get_current_url()));
    exit;
}
require_once YG_INCLUDEPATH . DS . 'pluginmanager.class.php';
require_once YG_INCLUDEPATH . DS . 'database.class.php';
require_once YG_INCLUDEPATH . DS . 'translation.class.php';
if (YG_ENABLE_THEME) {
    require_once YG_INCLUDEPATH . DS . 'templatemanager.php';
}
#require_once(YG_INCLUDEPATH . DS . 'formgen.php');
DB::connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
fire_hook('init');
load_default_domain();
$PluginManager = new PluginManager();
$PluginManager->loadEnabled();
Example #14
0
 public function isLogged()
 {
     global $argv;
     if (Session::isLogged() || $this->visibility === 'public' || isset($_GET['cron']) && $_GET['cron'] === sha1($this->salt . $this->hash) || isset($argv) && count($argv) >= 3 && $argv[1] == 'update' && $argv[2] == sha1($this->salt . $this->hash)) {
         return true;
     }
     return false;
 }
 private static function insertArt()
 {
     $sesion = new Session();
     if ($sesion->isLogged()) {
         $db = new DataBase();
         $manager = new ManageArt($db);
         $managerUser = new ManageUser($db);
         $email = Request::post("email");
         $title = Request::post("title");
         $usuario = $managerUser->get($email);
         $art = new Art();
         $art->setEmail($email);
         $art->setTitle($title);
         $art->setCdate(date('Y-m-d G:i:s'));
         $fecha = date('_Y_m_d_G_i_s');
         $photo = new FileUpload("image");
         if ($photo->getError() === false) {
             $art->setImage("./resources/art/" . $usuario->getAlias() . $fecha . ".jpg");
             $photo->setDestination("./resources/art/");
             $photo->setName($usuario->getAlias() . $fecha);
             $photo->upload();
         }
         $manager->insert($art);
         $db->close();
     }
     self::viewProfile();
 }
Example #16
0
 private function _launchAction()
 {
     if (isset($_GET['login'])) {
         // hello to you
         $this->wallabag->login($this->referer);
     } elseif (isset($_GET['feed']) && isset($_GET['user_id'])) {
         $tag_id = isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0;
         $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 0;
         $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit);
     }
     //allowed ONLY to logged in user
     if (\Session::isLogged() === true) {
         if (isset($_GET['logout'])) {
             // see you soon !
             $this->wallabag->logout();
         } elseif (isset($_GET['config'])) {
             // update password
             $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']);
         } elseif (isset($_GET['newuser'])) {
             $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail'], true);
         } elseif (isset($_GET['deluser'])) {
             $this->wallabag->deleteUser($_POST['password4deletinguser']);
         } elseif (isset($_GET['epub'])) {
             $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['value']);
             $epub->prepareData();
             $epub->produceEpub();
         } elseif (isset($_GET['mobi'])) {
             $mobi = new WallabagMobi($this->wallabag, $_GET['method'], $_GET['value']);
             $mobi->prepareData();
             $mobi->produceMobi();
         } elseif (isset($_GET['pdf'])) {
             $pdf = new WallabagPDF($this->wallabag, $_GET['method'], $_GET['value']);
             $pdf->prepareData();
             $pdf->producePDF();
         } elseif (isset($_GET['import'])) {
             $import = $this->wallabag->import();
             $this->vars = array_merge($this->vars, $import);
         } elseif (isset($_GET['empty-cache'])) {
             Tools::emptyCache();
         } elseif (isset($_GET['export'])) {
             $this->wallabag->export();
         } elseif (isset($_GET['updatetheme'])) {
             $this->wallabag->tpl->updateTheme($_POST['theme']);
         } elseif (isset($_GET['updatelanguage'])) {
             $this->wallabag->language->updateLanguage($_POST['language']);
         } elseif (isset($_GET['uploadfile'])) {
             $this->wallabag->uploadFile();
         } elseif (isset($_GET['feed']) && isset($_GET['action']) && $_GET['action'] == 'generate') {
             $this->wallabag->updateToken();
         } elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
             $plainUrl = new Url(base64_encode($_GET['plainurl']));
             $this->wallabag->action('add', $plainUrl);
         }
     }
 }
Example #17
0
    public static function navTpl()
    {
        extract(FeedPage::$var);
        ?>
<div id="menu" class="navbar">
  <div class="navbar-inner">
    <div class="container">
      <a id="menu-toggle" class="btn btn-navbar" data-toggle="collapse" data-target="#menu-collapse" title="<?php 
        echo Intl::msg('Menu');
        ?>
"><?php 
        echo Intl::msg('Menu');
        ?>
</a>
      <a id="nav-home" class="brand ico-home" href="<?php 
        echo $base;
        ?>
" title="<?php 
        echo Intl::msg('Home');
        ?>
"></a>
      <?php 
        if (isset($currentHashView)) {
            ?>
<span class="brand"><?php 
            echo $currentHashView;
            ?>
</span><?php 
        }
        ?>

      <div id="menu-collapse" class="nav-collapse collapse">
        <ul class="nav">
<?php 
        if ($template === 'stars' || $template === 'index') {
            $counter1 = -1;
            if (isset($menu) && is_array($menu) && sizeof($menu)) {
                foreach ($menu as $key1 => $value1) {
                    $counter1++;
                    ?>
  <?php 
                    if ($key1 === 'menuView') {
                        ?>
    <?php 
                        if ($view === 'expanded') {
                            ?>
          <li><a href="<?php 
                            echo $query . 'view=list';
                            ?>
" title="<?php 
                            echo Intl::msg('View as list');
                            ?>
" class="menu-ico ico-list"><span class="menu-text menu-list"> <?php 
                            echo Intl::msg('View as list');
                            ?>
</span></a></li>
    <?php 
                        } else {
                            ?>
          <li><a href="<?php 
                            echo $query . 'view=expanded';
                            ?>
" title="<?php 
                            echo Intl::msg('View as expanded');
                            ?>
" class="menu-ico ico-expanded"><span class="menu-text menu-expanded"> <?php 
                            echo Intl::msg('View as expanded');
                            ?>
</span></a></li>
    <?php 
                        }
                        ?>
  <?php 
                    } elseif ($key1 === 'menuListFeeds') {
                        ?>
    <?php 
                        if ($listFeeds === 'show') {
                            ?>
          <li><a href="<?php 
                            echo $query . 'listFeeds=hide';
                            ?>
" title="<?php 
                            echo Intl::msg('Hide feeds list');
                            ?>
" class="menu-ico ico-list-feeds-hide"><span class="menu-text menu-list-feeds-hide"> <?php 
                            echo Intl::msg('Hide feeds list');
                            ?>
</span></a></li>
    <?php 
                        } else {
                            ?>
          <li><a href="<?php 
                            echo $query . 'listFeeds=show';
                            ?>
" title="<?php 
                            echo Intl::msg('Show feeds list');
                            ?>
" class="menu-ico ico-list-feeds-show"><span class="menu-text menu-list-feeds-show"> <?php 
                            echo Intl::msg('Show feeds list');
                            ?>
</span></a></li>
    <?php 
                        }
                        ?>
  <?php 
                    } elseif ($key1 === 'menuFilter') {
                        ?>
    <?php 
                        if ($filter === 'unread') {
                            ?>
          <li><a href="<?php 
                            echo $query . 'filter=all';
                            ?>
" title="<?php 
                            echo Intl::msg('Show all items');
                            ?>
" class="menu-ico ico-filter-all"><span class="menu-text menu-filter-all"> <?php 
                            echo Intl::msg('Show all items');
                            ?>
</span></a></li>
    <?php 
                        } else {
                            ?>
          <li><a href="<?php 
                            echo $query . 'filter=unread';
                            ?>
" title="<?php 
                            echo Intl::msg('Show unread items');
                            ?>
" class="menu-ico ico-filter-unread"><span class="menu-text menu-filter-unread"> <?php 
                            echo Intl::msg('Show unread items');
                            ?>
</span></a></li>
     <?php 
                        }
                        ?>
  <?php 
                    } elseif ($key1 === 'menuOrder') {
                        ?>
     <?php 
                        if ($order === 'newerFirst') {
                            ?>
          <li><a href="<?php 
                            echo $query . 'order=olderFirst';
                            ?>
" title="<?php 
                            echo Intl::msg('Show older first');
                            ?>
" class="menu-ico ico-order-older"><span class="menu-text menu-order"> <?php 
                            echo Intl::msg('Show older first');
                            ?>
</span></a></li>
     <?php 
                        } else {
                            ?>
          <li><a href="<?php 
                            echo $query . 'order=newerFirst';
                            ?>
" title="<?php 
                            echo Intl::msg('Show newer first');
                            ?>
" class="menu-ico ico-order-newer"><span class="menu-text menu-order"> <?php 
                            echo Intl::msg('Show newer first');
                            ?>
</span></a></li>
     <?php 
                        }
                        ?>
  <?php 
                    } elseif ($key1 === 'menuUpdate') {
                        ?>
     <?php 
                        if ($currentHashType == 'folder') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Update folder');
                            ?>
     <?php 
                        } elseif ($currentHashType == 'feed') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Update feed');
                            ?>
     <?php 
                        } else {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Update all');
                            ?>
     <?php 
                        }
                        ?>
          <li><a href="<?php 
                        echo $query . 'update=' . $currentHash;
                        ?>
" title="<?php 
                        echo $intl;
                        ?>
" class="menu-ico ico-update"><span class="menu-text menu-update"> <?php 
                        echo $intl;
                        ?>
</span></a></li>
  <?php 
                    } elseif ($key1 === 'menuRead') {
                        ?>
     <?php 
                        if ($currentHashType == 'folder') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Mark folder as read');
                            ?>
     <?php 
                        } elseif ($currentHashType == 'feed') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Mark feed as read');
                            ?>
     <?php 
                        } else {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Mark all as read');
                            ?>
     <?php 
                        }
                        ?>
          <li><a href="<?php 
                        echo $query . 'read=' . $currentHash;
                        ?>
" title="<?php 
                        echo $intl;
                        ?>
" class="menu-ico ico-mark-as-read"><span class="menu-text menu-mark-as-read"> <?php 
                        echo $intl;
                        ?>
</span></a></li>
  <?php 
                    } elseif ($key1 === 'menuUnread') {
                        ?>
     <?php 
                        if ($currentHashType == 'folder') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Mark folder as unread');
                            ?>
     <?php 
                        } elseif ($currentHashType == 'feed') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Mark feed as unread');
                            ?>
     <?php 
                        } else {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Mark all as unread');
                            ?>
     <?php 
                        }
                        ?>
          <li><a href="<?php 
                        echo $query . 'unread=' . $currentHash;
                        ?>
" title="<?php 
                        echo $intl;
                        ?>
" class="menu-ico ico-mark-as-unread"><span class="menu-text menu-mark-as-unread"> <?php 
                        echo $intl;
                        ?>
</span></a></li>
  <?php 
                    } elseif ($key1 === 'menuEdit') {
                        ?>
     <?php 
                        if ($currentHashType == 'folder') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Edit folder');
                            ?>
     <?php 
                        } elseif ($currentHashType == 'feed') {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Edit feed');
                            ?>
     <?php 
                        } else {
                            ?>
          <?php 
                            $intl = FeedPage::$var['intl'] = Intl::msg('Edit all');
                            ?>
     <?php 
                        }
                        ?>
          <li><a href="<?php 
                        echo $query . 'edit=' . $currentHash;
                        ?>
" title="<?php 
                        echo $intl;
                        ?>
" class="menu-ico ico-edit"><span class="menu-text menu-edit"> <?php 
                        echo $intl;
                        ?>
</span></a></li>
  <?php 
                    } elseif ($key1 === 'menuAdd') {
                        ?>
          <li><a href="<?php 
                        echo $query . 'add';
                        ?>
" title="<?php 
                        echo Intl::msg('Add a new feed');
                        ?>
" class="menu-ico ico-add-feed"><span class="menu-text menu-add-feed"> <?php 
                        echo Intl::msg('Add a new feed');
                        ?>
</span></a></li>
  <?php 
                    } elseif ($key1 === 'menuHelp') {
                        ?>
          <li><a href="<?php 
                        echo $query . 'help';
                        ?>
" title="<?php 
                        echo Intl::msg('Help');
                        ?>
" class="menu-ico ico-help"><span class="menu-text menu-help"> <?php 
                        echo Intl::msg('Help');
                        ?>
</span></a></li>
  <?php 
                    } elseif ($key1 === 'menuStars') {
                        ?>
    <?php 
                        if ($template === 'index') {
                            ?>
          <li><a href="<?php 
                            echo $query . 'stars';
                            ?>
" title="<?php 
                            echo Intl::msg('Starred items');
                            ?>
" class="menu-ico ico-star"><span class="menu-text menu-help"> <?php 
                            echo Intl::msg('Starred items');
                            ?>
</span></a></li>
    <?php 
                        }
                        ?>
  <?php 
                    }
                }
            }
            if ($kf->kfc->isLogged()) {
                ?>
          <li><a href="?config" title="<?php 
                echo Intl::msg('Configuration');
                ?>
" class="menu-ico ico-config"><span class="menu-text menu-config"> <?php 
                echo Intl::msg('Configuration');
                ?>
</span></a></li>
<?php 
            }
        } elseif ($template === 'config') {
            ?>
          <li><a href="?password" title="<?php 
            echo Intl::msg('Change password');
            ?>
"> <?php 
            echo Intl::msg('Change password');
            ?>
</a></li>
          <li><a href="?import" title="<?php 
            echo Intl::msg('Import opml file');
            ?>
"> <?php 
            echo Intl::msg('Import opml file');
            ?>
</a></li>
          <li><a href="?export" title="<?php 
            echo Intl::msg('Export opml file');
            ?>
"> <?php 
            echo Intl::msg('Export opml file');
            ?>
</a></li>
          <li><a href="?plugins" title="<?php 
            echo Intl::msg('Plugins management');
            ?>
"> <?php 
            echo Intl::msg('Plugins management');
            ?>
</a></li>
<?php 
        }
        if (Session::isLogged()) {
            ?>
          <li><a href="?logout" title="<?php 
            echo Intl::msg('Sign out');
            ?>
" class="menu-ico ico-logout"><span class="menu-text menu-logout"> <?php 
            echo Intl::msg('Sign out');
            ?>
</span></a></li>
<?php 
        } else {
            ?>
          <li><a href="?login" title="<?php 
            echo Intl::msg('Sign in');
            ?>
" class="menu-ico ico-login"><span class="menu-text menu-login"> <?php 
            echo Intl::msg('Sign in');
            ?>
</span></a></li>
<?php 
        }
        ?>
        </ul>
        <div class="clear"></div>
      </div>
      <div class="clear"></div>
    </div>
  </div>
</div>

<?php 
    }
 public static function restSubscribe()
 {
     self::initRequests();
     if (strpos(self::link(), "?") !== false) {
         $link = substr(self::link(), 0, strpos(self::link(), "?"));
     } else {
         $link = self::link();
     }
     if (!Session::isLogged()) {
         if (self::$map_requests->containsKey($link)) {
             if (file_exists(self::$map_requests->get($link))) {
                 return self::$map_requests->get($link);
             }
             throw new FileNotFoundException("Arquivo de requisição não encontrado!");
         }
         throw new Exception("Destino não encontrado!");
     } else {
         throw new LoginException('Você não pode realizar seu cadastro com um usuário online.');
     }
 }
 public function setTempalte()
 {
     $notFoundPage = false;
     $id = 0;
     $urlArray = $this->splitPageUrl();
     $page = new Page();
     ob_start();
     if (count($urlArray) == 0 || $urlArray[0] == "home") {
         $page->set("url", "home");
         $templateFile = USER_TEMPLATE_FOLDER . '/index.php';
     } elseif (count($urlArray) == 1 && $urlArray[0] == "admin") {
         $templateFile = ADMIN_TEMPLATE_FOLDER . '/index.php';
     } elseif (count($urlArray) == 1 && $urlArray[0] != "admin") {
         $page->set("url", $urlArray[0]);
         $templateFile = USER_TEMPLATE_FOLDER . '/page.php';
     } elseif (count($urlArray) > 1 && count($urlArray) < 6 && $urlArray[0] != "admin") {
         $page->set("url", $urlArray[1]);
         $categoryDetails = $page->getPageCategoryId($urlArray[0]);
         if (count($categoryDetails)) {
             $page->set("category_id", $categoryDetails[0]['id']);
         }
         $templateFile = USER_TEMPLATE_FOLDER . '/page.php';
     } else {
         $notFoundPage = true;
     }
     $pageDetails = $page->getPageDetails();
     //print_r($pageDetails); exit;
     if (is_array($pageDetails) && count($pageDetails) && count($pageDetails[0])) {
         if ($pageDetails[0]["access_type"] == 1 && count($urlArray)) {
             switch ($urlArray[0]) {
                 case "login":
                     if (Session::isLogged()) {
                         $pageType = $page->getPageTypeUrl(Session::read("access_type"));
                         $url = SERVER_URL . "/{$pageType}/home";
                         General::redirectUrl($url);
                     }
                     break;
             }
         } elseif (isset($urlArray[1]) && !is_numeric($urlArray[1]) && count($urlArray) == 2 && $urlArray[1] == "logout") {
             //Logout
         } elseif (isset($urlArray[2]) && is_numeric($urlArray[2]) && $urlArray[2] > 0) {
             //User and Lawyer public profile using id
         } elseif (!Session::isLogged() && $pageDetails[0]["access_type"] > 1 && !is_numeric($urlArray[2])) {
             Error::set(INVALID_LOGIN);
             $url = SERVER_URL . "/login";
             General::redirectUrl($url);
         } elseif ($pageDetails[0]["access_type"] != Session::read("access_type") && Session::isLogged() && !is_numeric($urlArray[2])) {
             $pageType = $page->getPageTypeUrl(Session::read("access_type"));
             $url = SERVER_URL . "/{$pageType}/home";
             General::redirectUrl($url);
         }
         if (!$notFoundPage) {
             if (count($urlArray) > 1) {
                 $pageCnt = self::useClass($urlArray);
                 //print_r($pageCnt); exit;
                 if (!$pageCnt) {
                     $notFoundPage = true;
                 }
             }
             if (!$notFoundPage) {
                 include $templateFile;
             }
         }
     } else {
         $notFoundPage = true;
     }
     if ($notFoundPage) {
         Error::notFoundPage();
     }
     $contents = ob_get_contents();
     ob_clean();
     return $contents;
 }
 /**
  * @version 0.1 - 17/01/2012 by FI
  * @version 0.2 - 25/04/2012 by FI - Rajout de la gestion de la page d'accueil
  * @version 0.3 - 30/04/2012 by FI - Gestion multisites
  * @version 0.4 - 14/06/2012 by FI - Rajout d'un contrôle nécessaire si aucun site n'est retrouné on affiche le formulaire de connexion
  * @version 0.5 - 02/04/2015 by FI - Mise en place automatisation de la traduction dans les fonctions ADD et EDIT
  * @version 0.6 - 22/04/2015 by FI - Correction pour tester l'existence de la constante CURRENT_WEBSITE_ID
  * @see Controller::beforeFilter()
  * @todo améliorer la récupération des configs...
  * @todo améliorer la récupération du menu général pour le moment une mise en cache qui me semble améliorable...
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $prefix = isset($this->request->prefix) ? $this->request->prefix : '';
     //Récupération du préfixe
     //Si on est dans le backoffice
     if ($prefix == 'backoffice') {
         define('INTERFACE_USED', 'backoffice');
         $adminRole = Session::getRole();
         //Récupération du rôle de l'utilisateur connecté
         if (!Session::isLogged() && !$adminRole) {
             $this->redirect('users/login');
         }
         //Si pas loggé ou que l'on ne récupère pas de rôle
         $this->_check_acls($adminRole);
         //Contrôle des droits utilisateurs
         define('IS_USER_LOGGED', 'ok');
         //Récupération de l'identifiant du site courant
         if (!defined('CURRENT_WEBSITE_ID')) {
             $currentWebsite = Session::read('Backoffice.Websites.current');
             define('CURRENT_WEBSITE_ID', $currentWebsite);
         }
         $this->layout = 'backoffice';
         //Définition du layout pour le backoffice
         $this->pager['elementsPerPage'] = $this->backofficeElementPerPage;
         //Nombre d'élément par page
         $leftMenus = $this->_get_backoffice_menu();
         $this->set('leftMenus', $leftMenus);
         //Récupération des formulaires de contacts non validés
         $this->load_model('Contact');
         $nbFormsContacts = $this->Contact->findCount(array('online' => 0));
         $this->set('nbFormsContacts', $nbFormsContacts);
         //Récupération des commentaires articles
         $this->load_model('PostsComment');
         $nbPostsComments = $this->PostsComment->findCount(array('online' => 0));
         $this->set('nbPostsComments', $nbPostsComments);
         /*
         //SUPPRIME LE 02/04/2015 car cela pose des problème lors de la récupération des données pour les listes déroulantes
         //Toutes les traductions étaient récupérées or nous n'avons besoin que de la données de la langue courante du BO
         /////////////////////////////////////////
         //    PARAMETRAGES DE LA TRADUCTION    //
         $modelName = $this->params['modelName'];
         if(
         	in_array($this->params['action'], array('add', 'edit')) && 
         	isset($this->$modelName->fieldsToTranslate) && 
         	!empty($this->$modelName->fieldsToTranslate)
         ) {
         	
         	//Dans le cas de la fonction add et edit on check si on a dans le modèle des champs à traduire
         	//Le cas échéant on paramètre les données du modèle pour récupérer les données traduites
         	$this->$modelName->getTranslation 		= false; //A ce niveau la pas besoin de récupérer la traduction de l'élément
         	$this->$modelName->getTranslatedDatas 	= true; //Récupération de l'ensemble des données traduites pour affiche le formulaire
         }
         */
         //Récupération des plugins
         /*$this->load_model('Plugin');
         		$activatePlugins = $this->Plugin->find(array('conditions' => array('online' => 1)));
         		pr($activatePlugins);
         		$this->set('activatePlugins', $activatePlugins);*/
         //Si on est dans le frontoffice
     } else {
         define('INTERFACE_USED', 'frontoffice');
         //////////////////////////////////////////////////
         //   RECUPERATION DES DONNEES DU SITE COURANT   //
         //$datas['websiteParams'] = $this->_get_website_datas();
         $ws = $this->components['Website']->get_website_datas();
         $datas['websiteParams'] = $ws['website'];
         $this->layout = $ws['layout'];
         //Dans tous les cas sauf si on est sur le formulaire de connexion
         if ($this->params['controllerName'] != 'Users' && ($this->request->action != 'login' || $this->request->action != 'logout')) {
             //Si aucun site trouvé on affiche la connexion
             //$datas['websiteParams'] = $this->_get_website_datas();
             //$ws = $this->components['Website']->get_website_datas();
             //$datas['websiteParams'] = $ws['website'];
             //$this->layout = $ws['layout'];
             if (empty($datas['websiteParams'])) {
                 $datas['websiteParams']['secure_activ'] = 1;
             }
             //Si aucun site n'est retourné on affiche le formulaire de connexion
             //////////////////////////////////////////////////
             //////////////////////////////////////////////
             //   GESTION DES EVENTUELLES REDIRECTIONS   //
             $this->_is_secure_activ($datas['websiteParams']['secure_activ'], $datas['websiteParams']['log_users_activ']);
             //Site sécurisé
             //////////////////////////////////////////////
             //////////////////////////////////////////////////////////
             //   MISE EN CACHE DE LA RECUPERATION DU MENU GENERAL   //
             $datas['menuGeneral'] = $this->_get_website_menu($datas['websiteParams']['id']);
             //////////////////////////////////////////////////////////
         }
         //ON VA DEFINIR LA CONSTANTE D'ACCES AUX VUES DU TEMPLATE//
         define('LAYOUT_VIEWS', WEBROOT . DS . 'templates' . DS . $datas['websiteParams']['tpl_layout'] . DS . 'views');
         $this->set($datas);
     }
     //////////////////////////////////
     //   GESTION DE LA PAGINATION   //
     if (isset($this->request->currentPage)) {
         $this->pager['currentPage'] = $this->request->currentPage;
         //Page courante
         $this->pager['limit'] = $this->pager['elementsPerPage'] * ($this->pager['currentPage'] - 1);
         //Limit
     }
     //////////////////////////////////
 }
Example #21
0
<!DOCTYPE html>
<?php 
require_once 'inc/class.Session.php';
Session::init();
require_once 'inc/class.PDOForum.php';
require_once 'inc/class.FabriqueVue.php';
require_once 'vues/fonctions.php';
include_once 'vues/v_entete.php';
// constantes
define("EOL", "<br />\n");
// fin de ligne html et saut de ligne
define("EL", "\n");
//  saut de ligne
// si l'utilisateur n'est pas identifié, il doit le faire
if (!Session::isLogged()) {
    $uc = $_REQUEST['uc'];
    if ($uc === "inscrire") {
        include "controleurs/c_inscrire.php";
    } else {
        header('Location: login.php');
        // redirection vers le fichier login.php
    }
} else {
    // à partir d'ici, l'utilisateur est forcément connecté
    // instanciation de la fabrique de vue
    $vue = FabriqueVue::getFabrique();
    // instanciation du modèle PDO
    $pdo = PDOForum::getPdoForum();
    // justement on enregistre la dernière activité de l'utilisateur dans la BD
    $pdo->setDerniereCx($_SESSION['numUtil']);
    // actions ?
Example #22
0
<?php

require '../clases/AutoCarga.php';
header('Contet-Type: application/json');
$sesion = new Session();
$logueado = $sesion->isLogged();
//$ok = json_encode(array('email' => true));
$no = json_encode(array('email' => false));
if ($logueado) {
    $usuario = $sesion->getUser();
    $nombre = $usuario->getNombre();
    $email = $usuario->getEmail();
    $ok = json_encode(array('email' => true, 'nombreProfesor' => $nombre, 'emailProfesor' => $email));
    echo $ok;
} else {
    echo $no;
}
Example #23
0
 /**
  * Creates a new user
  */
 public function createNewUser($username, $password, $email = "", $internalRegistration = false)
 {
     Tools::logm('Trying to create a new user...');
     if (!empty($username) && !empty($password)) {
         $newUsername = filter_var($username, FILTER_SANITIZE_STRING);
         $email = filter_var($email, FILTER_SANITIZE_STRING);
         if (!$this->store->userExists($newUsername)) {
             if ($this->store->install($newUsername, Tools::encodeString($password . $newUsername), $email)) {
                 if ($email != "") {
                     // if email is filled
                     if (SEND_CONFIRMATION_EMAIL && function_exists('mail')) {
                         // if internal registration from config screen
                         $body_internal = _('Hi,') . "\r\n\r\n" . sprintf(_('Someone just created a wallabag account for you on %1$s.'), Tools::getPocheUrl()) . "\r\n\r\n" . sprintf(_('Your login is %1$s.'), $newUsername) . "\r\n\r\n" . _('Note : The password has been chosen by the person who created your account. Get in touch with that person to know your password and change it as soon as possible') . "\r\n\r\n" . _('Have fun with it !') . "\r\n\r\n" . _('This is an automatically generated message, no one will answer if you respond to it.');
                         // if external (public) registration
                         $body = sprintf(_('Hi, %1$s'), $newUsername) . "\r\n\r\n" . sprintf(_('You\'ve just created a wallabag account on %1$s.'), Tools::getPocheUrl()) . "\r\n\r\n" . _("Have fun with it !");
                         $body = $internalRegistration ? $body_internal : $body;
                         $body = wordwrap($body, 70, "\r\n");
                         // cut lines with more than 70 caracters (MIME standard)
                         if (mail($email, sprintf(_('Your new wallabag account on %1$s'), Tools::getPocheUrl()), $body, 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n" . "From: " . $newUsername . "@" . gethostname() . "\r\n")) {
                             Tools::logm('The user ' . $newUsername . ' has been emailed');
                             $this->messages->add('i', sprintf(_('The new user %1$s has been sent an email at %2$s. You may have to check spam folder.'), $newUsername, $email));
                             Tools::redirect('?');
                         } else {
                             Tools::logm('A problem has been encountered while sending an email');
                             $this->messages->add('e', _('A problem has been encountered while sending an email'));
                         }
                     } else {
                         Tools::logm('The user has been created, but the server did not authorize sending emails');
                         $this->messages->add('i', _('The server did not authorize sending a confirmation email, but the user was created.'));
                     }
                 } else {
                     Tools::logm('The user has been created, but no email was saved, so no confimation email was sent');
                     $this->messages->add('i', _('The user was created, but no email was sent because email was not filled in'));
                 }
                 Tools::logm('The new user ' . $newUsername . ' has been installed');
                 if (\Session::isLogged()) {
                     $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to <a href="?logout">logout ?</a>'), $newUsername));
                 }
                 Tools::redirect();
             } else {
                 Tools::logm('error during adding new user');
                 Tools::redirect();
             }
         } else {
             $this->messages->add('e', sprintf(_('Error : An user with the name %s already exists !'), $newUsername));
             Tools::logm('An user with the name ' . $newUsername . ' already exists !');
             Tools::redirect();
         }
     } else {
         Tools::logm('Password or username were empty');
     }
 }
Example #24
0
// FUNCTIONS BEGIN
require_once dirname(__FILE__) . '/inc/includes.php';
/*
   TODO: penser a ajouter la gestion des utilisateurs et des fichiers sauvegarder via XML:
    http://php.net/manual/en/function.simplexml-load-string.php
*/
if (isset($_GET['logout'])) {
    Session::logout();
    header('Location: index.php');
    die;
} else {
    if (isset($_POST['login']) && isset($_POST['password'])) {
        $user = User::getUser('./conf/', $_POST['login']);
        if ($user && $user->getPassword() != null && Session::login($_POST['login'], User::getHashPassword($_POST['password']), $user->getLogin(), $user->getPassword())) {
            if (Session::isLogged() && $_SESSION['username'] != null && !is_dir('./' . SAVED_PATH . '/' . $_SESSION['username'])) {
                mkdir('./' . SAVED_PATH . '/' . $_SESSION['username'], 0705);
            }
            header('Location: index.php');
            die;
        }
    }
}
raintpl::$tpl_dir = './tpl/';
// template directory
raintpl::$cache_dir = "./cache/";
// cache directory
raintpl::$base_url = url();
// base URL of blog
raintpl::configure('path_replace', false);
raintpl::configure('debug', true);
 public function getValues(DataParam $params, array $years = null)
 {
     if (Session::isLogged()) {
         if (!$params->anyValueIsArray()) {
             return $this->getValuesWithSimpleParams($params, $years);
         } else {
             return $this->getValuesWithMultipleParams($params, $years);
         }
     } else {
         throw new LoginException();
     }
 }
<?php

require '../clases/AutoCarga.php';
$bd = new BaseDatos();
$modelo = new ManejoUsuario($bd);
$usuario = $modelo->get(Request::get("email"));
$sesion = new Session();
if (!$sesion->isLogged()) {
    header("Location: ../redireccion/phpredireccion.php");
    exit;
} else {
    ?>
<!DOCTYPE HTML>
<html>
    <head>
        <title>Admin</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
        <!-- Bootstrap Core CSS -->
        <link href="../css/bootstrap.min.css" rel='stylesheet' type='text/css' />
        <!-- Custom CSS -->
        <link href="../css/style.css" rel='stylesheet' type='text/css' />
        <!-- Graph CSS -->
        <link href="../css/lines.css" rel='stylesheet' type='text/css' />
        <link href="../css/font-awesome.css" rel="stylesheet"> 
        <!-- jQuery -->
        <script src="../js/jquery.min.js"></script>
        <!----webfonts--->
        <link href='//fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'>
        <!---//webfonts--->    
 public function index()
 {
     if (Session::isLogged()) {
         Router::redirect('home');
     }
 }