Example #1
0
 /**
  * Checks the set of rules against visitor's data.
  */
 public static function prerun(array $uParms)
 {
     self::$maintenance = Config::get('access/maintenance/mode', false);
     self::$maintenanceExcludeIps = Config::get('access/maintenance/ipExcludeList', array());
     foreach (Config::get('access/ipFilter/ipFilterList', array()) as $tIpFilterList) {
         if (preg_match('/^' . str_replace(array('.', '*', '?'), array('\\.', '[0-9]{1,3}', '[0-9]{1}'), $tIpFilterList['pattern']) . '$/i', $_SERVER['REMOTE_ADDR'])) {
             if ($tIpFilterList['type'] === 'allow') {
                 self::$ipFilters = array();
                 continue;
             }
             self::$ipFilters[] = $tIpFilterList['pattern'];
         }
     }
     if (self::$maintenance && !in_array($_SERVER['REMOTE_ADDR'], self::$maintenanceExcludeIps)) {
         header(Request::$protocol . ' 503 Service Unavailable', true, 503);
         header('Retry-After: 600', true);
         // to interrupt event-chain execution
         throw new CustomException('maintenance', I18n::_('Service Unavailable'), I18n::_('This service is currently undergoing scheduled maintenance. ' . 'Please try back later. Sorry for the inconvenience.'));
     }
     if (count(self::$ipFilters) > 0) {
         header(Request::$protocol . ' 403 Forbidden', true, 403);
         // to interrupt event-chain execution
         throw new CustomException('ipban', I18n::_('Service Unavailable'), I18n::_('Your access have been banned from this service.'));
     }
     return null;
 }
 /**
  * @ignore
  */
 public static function javascriptTranslations()
 {
     $tLanguage = Request::cookie('lang', 'en');
     I18n::setLanguage($tLanguage);
     $tTranslations = array('sunday' => I18n::_('Sunday'), 'monday' => I18n::_('Monday'), 'tuesday' => I18n::_('Tuesday'), 'wednesday' => I18n::_('Wednesday'), 'thursday' => I18n::_('Thursday'), 'friday' => I18n::_('Friday'), 'saturday' => I18n::_('Saturday'), 'change' => I18n::_('Change'), 'remove' => I18n::_('Remove'));
     LarouxJs::addToDictionary($tTranslations);
 }
Example #3
0
<?php

use Scabbia\Extensions\Helpers\Html;
use Scabbia\Extensions\Http\Http;
use Scabbia\Extensions\I18n\I18n;
use Scabbia\Framework;
echo Html::doctype('html5');
?>
<html lang="en-us">
<head>
    <meta charset="utf-8" />

    <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>
Example #4
0
    ?>
							<td>
								<a class="iconcategoryedit"
										href="<?php 
    echo Http::url('panel/' . $automodel->entityName . '/edit/' . $row['slug']);
    ?>
"><?php 
    echo I18n::_('Edit');
    ?>
</a>
								<a class="iconcategorydelete delete"
										href="<?php 
    echo Http::url('panel/' . $automodel->entityName . '/remove/' . $row['slug']);
    ?>
"><?php 
    echo I18n::_('Remove');
    ?>
</a>
							</td>
						</tr>
						<?php 
}
?>
					</tbody>
				</table>
				<div id="tablepager">
					<form>
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/first.png');
?>
" class="first" />
Example #5
0
                        <span class="bgSpacer pull-left"></span>
                        <a href="#" class="bgLink pull-left"><?php 
echo I18n::_('User:'******'username'];
?>
</span></a>
                        <a href="#" class="bgLink pull-right bootstrap-popover" data-toggle="popover" data-placement="bottom" data-content="<?php 
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>
Example #6
0
								* 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>
					</tr>
					</tbody>
				</table>

			</div>
			<div class="bottomLine"></div>
			<div class="clearfix"></div>
		</td>
		<td id="pageMiddleExtra">
Example #7
0
                            </div>

                            <label for="password"><?php 
echo I18n::_('Password:'******'Login');
?>
" />
                            </div>
                        </div>
                    </fieldset>
                </form>

            </div>
        </div>

        <script type="text/javascript">
            $l.contentEnd();
        </script>
    </body>
</html>
Example #8
0
 /**
  * @ignore
  */
 public static function edit($uAction, $uSlug)
 {
     Auth::checkRedirect('editor');
     $tModule = AutoModels::get(Panel::$module);
     $tViewbag = array('module' => $tModule, 'fields' => array());
     if (Request::$method === 'post') {
         //! todo: validations
         Validation::addRule('name')->isRequired()->errorMessage('Name shouldn\'t be blank.');
         // Validation::addRule('slug')->isRequired()->errorMessage('Slug shouldn\'t be blank.');
         if (Validation::validate($_POST)) {
             $tSlug = Request::post('slug', "");
             if (strlen(rtrim($tSlug)) === 0) {
                 $tSlug = Request::post('name', "");
             }
             $tInput = array('type' => Request::post('type'), 'name' => Request::post('name'), 'slug' => String::slug(String::removeAccent($tSlug)));
             $tAutoModel = new AutoModel('categories');
             $tAutoModel->update($uSlug, $tInput);
             Session::set('notification', array('info', 'ok-sign', 'Record modified.'));
             Http::redirect('panel/categories');
             return;
         }
         Session::set('notification', array('error', 'remove-sign', Validation::getErrorMessages(true)));
         foreach ($tModule['fieldList'] as $tField) {
             $tIsView = array_key_exists('view', $tField['methods']);
             $tIsEdit = array_key_exists('edit', $tField['methods']);
             if ($tIsView || $tIsEdit) {
                 if ($tField['type'] === 'enum') {
                     $tTypes = array();
                     foreach ($tField['valueList'] as $tValue) {
                         $tTypes[$tValue['name']] = $tValue['title'];
                     }
                     $tAttributes = array('name' => $tField['name'], 'class' => 'input-block-level input_' . $tField['type']);
                     if (!$tIsEdit) {
                         $tAttributes['readonly'] = 'readonly';
                     }
                     $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('select', $tAttributes, Html::selectOptions($tTypes, Request::post($tField['name'], null))) . '</p>';
                 } else {
                     $tAttributes = array('type' => 'text', 'name' => $tField['name'], 'value' => Request::post($tField['name'], ""), 'class' => 'input-block-level input_' . $tField['type']);
                     if (!$tIsEdit) {
                         $tAttributes['readonly'] = 'readonly';
                     }
                     $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('input', $tAttributes) . '</p>';
                 }
             }
             $tViewbag['fields'][] = array('data' => $tField, 'html' => $tTag);
         }
         Views::viewFile('{core}views/panel/models/form.php', $tViewbag);
         return;
     }
     $tAutoModel = new AutoModel('categories');
     $tCategory = $tAutoModel->getBySlug($tModule['name'], $uSlug);
     foreach ($tModule['fieldList'] as $tField) {
         $tIsView = array_key_exists('view', $tField['methods']);
         $tIsEdit = array_key_exists('edit', $tField['methods']);
         if ($tIsView || $tIsEdit) {
             if ($tField['type'] === 'enum') {
                 $tTypes = array();
                 foreach ($tField['valueList'] as $tValue) {
                     $tTypes[$tValue['name']] = $tValue['title'];
                 }
                 $tAttributes = array('name' => $tField['name'], 'class' => 'input-block-level input_' . $tField['type']);
                 if (!$tIsEdit) {
                     $tAttributes['readonly'] = 'readonly';
                 }
                 $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('select', $tAttributes, Html::selectOptions($tTypes, $tCategory[$tField['name']])) . '</p>';
             } else {
                 $tAttributes = array('type' => 'text', 'name' => $tField['name'], 'value' => $tCategory[$tField['name']], 'class' => 'input-block-level input_' . $tField['type']);
                 if (!$tIsEdit) {
                     $tAttributes['readonly'] = 'readonly';
                 }
                 $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('input', $tAttributes) . '</p>';
             }
         }
         $tViewbag['fields'][] = array('data' => $tField, 'html' => $tTag);
     }
     Views::viewFile('{core}views/panel/models/form.php', $tViewbag);
 }
Example #9
0
<?php

use Scabbia\Extensions\I18n\I18n;
use Scabbia\Framework;
?>
</section>
<footer id="pageBottom">
	<?php 
echo I18n::_('Generated in'), ' ', number_format(microtime(true) - Framework::$timestamp, 5), ' msec.';
?>
</footer>
</div>

<script type="text/javascript">
	$l.contentEnd();
</script>
</body>
</html>
Example #10
0
Views::viewFile('{core}views/panel/sectionError.php', Panel::$module);
?>

                        <div class="menuDiv">
                            <fieldset>
                                <legend><?php 
echo I18n::_($module['singularTitle']);
?>
</legend>
                                <?php 
foreach ($fields as $tField) {
    echo $tField['html'];
}
?>
                                <input type="submit" class="btn btn-primary pull-right" value="<?php 
echo I18n::_('Submit');
?>
" />
                            </fieldset>
                        </div>
                    </div>
					<div class="clearfix"></div>
				</td>
				<td id="pageMiddleSidebarToggle">
					&laquo;
				</td>
				<td id="pageMiddleContent">
					<div class="topLine"></div>
					<div class="middleLine">

					</div>
Example #11
0
 /**
  * @ignore
  */
 public function render($uAction, array $uParams, array $uInput)
 {
     I18n::setLanguage('en');
     self::$modules = Config::get('panel/menuList', array());
     self::$modules[self::LOGIN_MODULE_INDEX] = array('actions' => array(self::DEFAULT_ACTION_INDEX => array('callback' => array(&$this, 'login'))));
     foreach (Config::get('panel/menuGeneratorList', array()) as $tGeneratorMethod) {
         call_user_func_array($tGeneratorMethod, array(&self::$modules));
     }
     self::$module = strlen($uAction) > 0 ? strtolower($uAction) : self::DEFAULT_MODULE_INDEX;
     if (!isset(self::$modules[self::$module])) {
         return false;
     }
     foreach (self::$modules as $tKey => $tMenu) {
         if (!isset($tMenu['title']) || isset($tMenu['role']) && !Auth::check($tMenu['role'])) {
             continue;
         }
         self::$menuItems[$tKey] = array($tKey === self::DEFAULT_MODULE_INDEX ? Http::url('panel') : Http::url('panel/' . $tKey), I18n::_($tMenu['title']), array());
         foreach ($tMenu['actions'] as $tMenuActionKey => $tMenuAction) {
             if (!isset($tMenuAction['title']) || isset($tMenuAction['role']) && !Auth::check($tMenuAction['role'])) {
                 continue;
             }
             if (isset($tMenuAction['before'])) {
                 if ($tMenuAction['before'] === 'separator') {
                     self::$menuItems[$tKey][self::MENU_ITEMS][] = '-';
                 }
             }
             if (isset($tMenuAction['customurl'])) {
                 $tUrl = $tMenuAction['customurl'];
             } elseif ($tMenuActionKey === self::DEFAULT_ACTION_INDEX) {
                 if ($tKey === self::DEFAULT_MODULE_INDEX) {
                     $tUrl = Http::url('panel');
                 } else {
                     $tUrl = Http::url('panel/' . $tKey);
                 }
             } else {
                 $tUrl = Http::url('panel/' . $tKey . '/' . $tMenuActionKey);
             }
             self::$menuItems[$tKey][self::MENU_ITEMS][] = array($tUrl, isset($tMenuAction['icon']) ? $tMenuAction['icon'] : 'minus', I18n::_($tMenuAction['title']));
             if (isset($tMenuAction['after'])) {
                 if ($tMenuAction['after'] === 'separator') {
                     self::$menuItems[$tKey][self::MENU_ITEMS][] = '-';
                 }
             }
         }
     }
     $tSubAction = count($uParams) > 0 ? array_shift($uParams) : self::DEFAULT_ACTION_INDEX;
     if (!isset(self::$modules[self::$module]['actions'][$tSubAction])) {
         return false;
     }
     return call_user_func_array(self::$modules[self::$module]['actions'][$tSubAction]['callback'], $uParams);
 }
Example #12
0
<?php

use Scabbia\Extensions\Helpers\Html;
use Scabbia\Extensions\Http\Http;
use Scabbia\Extensions\I18n\I18n;
use Scabbia\Framework;
echo Html::doctype('html5');
?>
<html lang="en-us">
<head>
    <meta charset="utf-8" />

    <title><?php 
echo I18n::_('Scabbia Framework: Error');
?>
</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,errorpages');
?>
" rel="stylesheet" media="all" />
    <script type="text/javascript" src="<?php 
echo Http::url('scabbia.js?core');
?>
"></script>
</head>
<body>
Example #13
0
 /**
  * @ignore
  */
 public static function notfound()
 {
     header(Request::$protocol . ' 404 Not Found', true, 404);
     self::error('notfound', I18n::_('404 Not Found'), I18n::_('The resource you have been looking for is not found on the server'));
 }
Example #14
0
?>
                <?php 
Views::viewFile('{core}views/panel/sectionMenu.php', Panel::$module);
?>
            </div>
			<div class="clearfix"></div>
		</td>
		<td id="pageMiddleSidebarToggle">
			&laquo;
		</td>
		<td id="pageMiddleContent">
			<div class="topLine"></div>
			<div class="middleLine">

				<h2 class="iconxdashboard"><?php 
echo I18n::_('Dashboard');
?>
</h2>

                <div class="row-fluid">
                <?php 
foreach (Panel::$menuItems as $tKey => $tMenu) {
    if ($tKey === 'index') {
        continue;
    }
    ?>
                    <div class="span8">
                    <h3>
                        <a href="<?php 
    echo $tMenu[Panel::MENU_TITLEURL];
    ?>