Ejemplo n.º 1
0
 /**
  * @ignore
  */
 public static function sign($uMethod, $uBaseString, $uConsumerSecret, $uTokenSecret)
 {
     $tKey = Http::encode($uConsumerSecret);
     if (strlen($uTokenSecret) > 0) {
         $tKey .= '&' . Http::encode($uTokenSecret);
     }
     if ($uMethod === self::METHOD_PLAINTEXT) {
         return $tKey;
     }
     return base64_encode(hash_hmac('sha1', $uBaseString, $tKey, true));
 }
Ejemplo n.º 2
0
    /**
     * @ignore
     */
    public static function exportJs()
    {
        $tReturn = <<<EOD
\$l.extend({
EOD;
        $tMethods = array();
        foreach (Config::get('larouxjs/methods', array()) as $tMethod) {
            $tSplit = explode('.', $tMethod);
            $tMethodName = array_pop($tSplit);
            // $tNamespace = Framework::$application->name . '\\Controllers\\' . implode('\\', $tSplit);
            $tPath = implode('/', $tSplit);
            if (!isset($tMethods[$tPath])) {
                $tMethods[$tPath] = array();
            }
            $tMethods[$tPath][] = $tMethodName;
        }
        if (count($tMethods) > 0) {
            foreach ($tMethods as $tMethodController => $tMethodActions) {
                $tLines = array();
                if (isset($tFirst)) {
                    $tReturn .= ',';
                } else {
                    $tFirst = false;
                }
                $tReturn .= PHP_EOL . "\t" . str_replace('/', '_', $tMethodController) . ': {' . PHP_EOL;
                foreach ($tMethodActions as $tMethodAction) {
                    $tLines[] = "\t\t" . $tMethodAction . ': function(values, successfnc, errorfnc, method) { if (typeof method == \'undefined\') method = \'post\'; $l.ajax[method](\'' . Http::url($tMethodController . '/' . $tMethodAction) . '\', values, successfnc, errorfnc); }';
                }
                $tReturn .= implode(',' . PHP_EOL, $tLines) . PHP_EOL . "\t" . '}';
            }
            $tReturn .= ',';
        }
        $tReturn .= <<<EOD
        translations:
EOD;
        $tReturn .= json_encode(self::$translations);
        $tReturn .= <<<EOD

});
EOD;
        return $tReturn;
    }
Ejemplo n.º 3
0
    <title><?php 
echo I18n::_('Scabbia Framework: Docs');
?>
</title>
    <link rel="shortcut icon" href="<?php 
echo Http::url('scabbia-assets/favicon.ico');
?>
" type="image/x-icon" />

    <link type="text/css" href="<?php 
echo Http::url('scabbia.css?core,docs');
?>
" rel="stylesheet" media="all" />
    <script type="text/javascript" src="<?php 
echo Http::url('scabbia.js?core');
?>
"></script>
</head>
<body>
<script type="text/javascript">
    $l.contentBegin('main', '<?php 
echo $root;
?>
/');
</script>

<div id="page">
    <header id="pageTop">
        Scabbia Documentation
    </header>
Ejemplo n.º 4
0
					<form>
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/first.png');
?>
" class="first" />
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/prev.png');
?>
" class="prev" />
						<input type="text" class="pagedisplay" readonly="readonly" />
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/next.png');
?>
" class="next" />
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/last.png');
?>
" class="last" />
						<select class="pagesize">
							<option value="10">10</option>
							<option selected="selected" value="25">25</option>
							<option value="50">50</option>
							<option value="100">100</option>
						</select>
					</form>
				</div>

			</div>
			<div class="bottomLine"></div>
			<div class="clear"></div>
		</td>
Ejemplo n.º 5
0
echo String::encodeHtml(Html::tag('a', array('href' => 'https://github.com/eserozvataf/scabbia1'), 'https://github.com/eserozvataf/scabbia1'));
?>
" title="" data-original-title="<?php 
echo I18n::_('Scabbia Framework'), ' ', Framework::VERSION;
?>
"><?php 
echo I18n::_('Scabbia Framework');
?>
</a>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div id="pageTopLogo">
                    <div class="containerBox inner">
                        <a href="<?php 
echo Http::url('panel');
?>
"><img src="<?php 
echo $root, Config::get('panel/logo', '/scabbia-assets/panel/images/logo.png');
?>
" alt="" /></a>
                    </div>
                </div>
                <div id="pageTopMenu">
                    <div class="containerBox inner">
                        <nav>
                            <div id="pageTopNavbar" class="navbar navbar-static">
                                <div class="navbar-inner">
                                    <div class="container" style="width: auto;">
                                        <!-- <a class="brand" href="#">Panel</a> -->
                                        <ul class="nav" role="navigation">
Ejemplo n.º 6
0
							<div id="placeholder">

								* model generator<br />
								* edit configuration files<br />
								* edit .htaccess/web.config<br />
								* add/remove/download extensions<br />
								* add/remove downloads<br />
								* edit database<br />
								* edit files<br />
								* <a href="<?php 
echo Http::url('panel/build');
?>
">build</a><br />
								* <a href="<?php 
echo Http::url('panel/purge');
?>
">purge</a><br />

							</div>
							<div class="clearfix"></div>
						</td>
						<td class="halfWidth">
							<h3><?php 
echo I18n::_('Statistics:');
?>
</h3>

							<div id="placeholderVisitors"></div>
							<div class="clearfix"></div>
						</td>
Ejemplo n.º 7
0
 /**
  * @ignore
  */
 public function output()
 {
     Http::sendHeaderCache(-1);
     header('Content-Type: ' . $this->mime, true);
     header('Content-Length: ' . $this->size, true);
     header('Content-Disposition: inline;filename=' . $this->filename . '.' . $this->extension, true);
     // @readfile($this->source);
     if ($this->mime === 'image/jpeg' || $this->mime === 'image/jpg') {
         imagejpeg($this->image);
     } elseif ($this->mime === 'image/gif') {
         imagegif($this->image);
     } elseif ($this->mime === 'image/png') {
         imagepng($this->image);
     }
     return $this;
 }
Ejemplo n.º 8
0
 /**
  * @ignore
  */
 public static function getPack($uName, array $uClasses = array())
 {
     foreach (self::$packs as $tPack) {
         if ($tPack['name'] !== $uName) {
             continue;
         }
         $tSelectedPack = $tPack;
         break;
     }
     if (!isset($tSelectedPack)) {
         return false;
     }
     $tCacheTtl = isset($tSelectedPack['cacheTtl']) ? (int) $tSelectedPack['cacheTtl'] : 0;
     $tBinder = new Binder($tSelectedPack['name'], $tSelectedPack['type'], $tCacheTtl, $uClasses);
     $tMimetype = Mime::getType($tBinder->outputType);
     header('Content-Type: ' . $tMimetype, true);
     Http::sendHeaderCache($tCacheTtl);
     foreach ($tSelectedPack['partList'] as $tPart) {
         $tBindType = isset($tPart['bindtype']) ? $tPart['bindtype'] : 'file';
         $tClass = isset($tPart['class']) ? $tPart['class'] : null;
         if ($tBindType === 'function') {
             $tValue = $tPart['name'];
             $tPartType = isset($tPart['parttype']) ? $tPart['parttype'] : $tBinder->outputType;
         } elseif ($tBindType === 'string') {
             $tValue = $tPart['value'];
             $tPartType = isset($tPart['parttype']) ? $tPart['parttype'] : $tBinder->outputType;
         } else {
             $tValue = $tPart['path'];
             $tPartType = isset($tPart['parttype']) ? $tPart['parttype'] : pathinfo($tPart['path'], PATHINFO_EXTENSION);
         }
         $tBinder->add($tBindType, $tPartType, $tValue, $tClass);
     }
     echo $tBinder->output();
     return true;
 }
Ejemplo n.º 9
0
?>
/');
        </script>

        <div class="block">

            <div class="block_head">
                <h2><?php 
echo I18n::_(Config::get('panel/loginTitle', 'Scabbia: Panel Login'));
?>
</h2>
            </div>

            <div class="block_content">
                <form method="POST" action="<?php 
echo Http::url('panel/' . Panel::LOGIN_MODULE_INDEX);
?>
">
                    <fieldset>
                        <div class="indent">
                            <?php 
Views::viewFile('{core}views/panel/sectionError.php');
?>

                            <label for="username"><?php 
echo I18n::_('Username:');
?>
</label>
                            <div class="input-prepend">
                                <span class="add-on"><i class="icon-user"></i></span>
                                <input id="username" type="text" class="text" name="username" placeholder="Enter username" />
Ejemplo n.º 10
0
 /**
  * @ignore
  */
 public static function remove($uAction, $uSlug)
 {
     Auth::checkRedirect('editor');
     Session::set('notification', array('info', 'ok-sign', 'Category removed.'));
     Http::redirect('panel/categories');
 }
Ejemplo n.º 11
0
 /**
  * @ignore
  */
 public function login()
 {
     if (Request::$method !== 'post') {
         Auth::clear();
         $this->viewFile('{core}views/panel/login.php');
         return;
     }
     // validations
     Validation::addRule('username')->isRequired()->errorMessage('Username shouldn\'t be blank.');
     // Validation::addRule('username')->isEmail()->errorMessage('Please consider your e-mail address once again.');
     Validation::addRule('password')->isRequired()->errorMessage('Password shouldn\'t be blank.');
     Validation::addRule('password')->lengthMinimum(4)->errorMessage('Password should be longer than 4 characters at least.');
     if (!Validation::validate($_POST)) {
         Session::set('notification', array('error', 'remove-sign', Validation::getErrorMessages(true)));
         $this->viewFile('{core}views/panel/login.php');
         return;
     }
     $username = Request::post('username');
     $password = Request::post('password');
     // user not found
     if (!Auth::login($username, $password)) {
         Session::set('notification', array('error', 'remove-sign', 'User not found'));
         $this->viewFile('{core}views/panel/login.php');
         return;
     }
     Http::redirect('panel');
 }
Ejemplo n.º 12
0
 /**
  * Redirects users to another location if user does not have required roles
  *
  * @uses Auth::check($uRequiredRoles)
  * @param string $uRequiredRoles roles
  */
 public static function checkRedirect($uRequiredRoles = 'user')
 {
     self::load();
     if (self::check($uRequiredRoles)) {
         return;
     }
     $tLoginUrl = Config::get('auth/loginUrl', null);
     if ($tLoginUrl !== null) {
         //! todo: warning messages like insufficent privileges.
         Http::redirect($tLoginUrl, true);
     }
     Framework::end(0);
 }