/**
 * @author Daniel Scheidler
 * @copyright Mai 2008
 */
function getStadtplanNavigation()
{
    $pnl = new Panel("Navigation");
    $navMenu = new DBMenu("StadtplanNavigation");
    $pnl->setContent($navMenu);
    return $pnl;
}
Exemplo n.º 2
0
 public static function EditorPanel($fileName)
 {
     //$js = '<div id="pageEditorDiv"><form name="editor" action="" method="post">';
     //$js .= self::GetEditor('pageEditor', self::Parse(self::ReadFile($fileName), 'php'));
     //$js .= '<input type="submit" name="edit_page_content" value="Сохранить" /></form></div>';
     $html = '<div id="siteEditorPanel">';
     $js = '<div id="dialog-window-form"></div>';
     $arPanelItems = Panel::getItems();
     if (count($arPanelItems) > 0) {
         $html .= '<ul>';
         foreach ($arPanelItems as $name => $link) {
             if (substr($link, 0, 4) == '<js>') {
                 $url = 'javascript:void(0)" onClick="' . str_replace('<js>', '', $link);
             } elseif ($link == '<br>') {
                 $name = ' | ';
                 $url = 'javascript:void(0)';
             } else {
                 $url = $link;
             }
             $html .= '<li><a href="' . $url . '">' . $name . '</a></li>';
         }
         $html .= '</ul>';
     }
     $html .= '</div>';
     $html .= '<div id="panelCloser"></div>';
     if (isset($_POST['edit_page_content'])) {
         //	self::WriteFile($fileName, $_POST['pageEditor']);
         //d($_POST['pageEditor']);
     }
     return $js . $html;
 }
Exemplo n.º 3
0
 function NOLOHBadge($left = 0, $top = 0, $textOnly = false, $showVersion = true)
 {
     parent::Panel($left, $top, null, null);
     $this->ToolTip = 'powered by NOLOH';
     $imagePath = GetRelativePath(dirname($_SERVER['SCRIPT_FILENAME']), dirname(__FILE__) . 'Images');
     if ($textOnly) {
         $poweredBy = new Link('http://www.noloh.com', 'powered by noloh');
         $poweredBy->Height = 18;
         $poweredBy->Width = 105;
         $poweredBy->CSSFontSize = '12px';
         $poweredBy->CSSFontFamily = 'helvetica, arial';
     } else {
         $link = new Image(GetRelativePath(dirname($_SERVER['SCRIPT_FILENAME']), dirname(__FILE__) . '/Images') . '/PoweredBy.png');
         $poweredBy = new Link('http://www.noloh.com', $link);
     }
     $poweredBy->Target = Link::Blank;
     $this->Controls->Add($poweredBy);
     if ($showVersion) {
         $this->Controls->Add($this->VersionLabel = new Label(GetNOLOHVersion(), $poweredBy->Right, 0));
         $this->VersionLabel->ReflectAxis('y');
         $this->VersionLabel->Color = '#011f43';
         $this->VersionLabel->CSSFontSize = '12px';
         $this->VersionLabel->CSSFontFamily = 'helvetica, arial';
     }
     $this->Height = $poweredBy->Height;
     $this->Width = $this->VersionLabel->Right;
 }
Exemplo n.º 4
0
 public function __construct($value = null)
 {
     parent::__construct($value);
     if ($value) {
         $this->setProperty('layout', $value);
     }
 }
Exemplo n.º 5
0
 protected function renderContent()
 {
     // force container tag to FIELDSET:
     $this->setAttribute('tag', 'fieldset');
     $flags = $this->getAttribute('flags', 0);
     if ($flags & \Nethgui\Renderer\WidgetFactoryInterface::FIELDSET_EXPANDABLE) {
         $this->setAttribute('class', 'Fieldset expandable');
     } else {
         $this->setAttribute('class', 'Fieldset');
     }
     $labelWidget = new TextLabel($this->view);
     $labelWidget->setAttribute('tag', 'span');
     $renderLegend = FALSE;
     if ($this->hasAttribute('name')) {
         $labelWidget->setAttribute('name', $this->getAttribute('name'));
         $renderLegend = TRUE;
     }
     if ($this->hasAttribute('template')) {
         $labelWidget->setAttribute('template', $this->getAttribute('template'));
         $renderLegend = TRUE;
     }
     if ($renderLegend && !($flags & \Nethgui\Renderer\WidgetFactoryInterface::LABEL_NONE)) {
         $legendWidget = $this->view->panel()->setAttribute('tag', 'legend')->insert($labelWidget);
         if ($this->hasAttribute('icon-before')) {
             $legendWidget->prepend($this->view->literal($this->openTag('span', array('class' => 'ui-icon ' . $this->getAttribute('icon-before'))) . $this->closeTag('span')));
         }
         if ($this->hasAttribute('icon-after')) {
             $legendWidget->append($this->view->literal($this->openTag('span', array('class' => 'ui-icon ' . $this->getAttribute('icon-after'))) . $this->closeTag('span')));
         }
         $this->prepend($legendWidget);
     }
     return parent::renderContent();
 }
Exemplo n.º 6
0
	function __construct($left = 0, $top = 0, $width = 400, $height = 150)
	{
		parent::Panel($left, $top, $width, $height);
		$this->Controls->Add($comment = new TinyMCE('', 0, 0, $width, $height - 30));
		$this->Controls->Add(new Button('Save'))
			->Click = new ServerEvent($this, 'Save', $comment);
		$this->Controls->AllLayout = Layout::Relative;
	}
Exemplo n.º 7
0
 /**
  * Set active record
  *
  * @param array $record
  * @return void
  */
 protected function setActiveRecord($record)
 {
     // update the record row
     $this->m_DataPanel->setRecordArr($record);
     foreach ($record as $key => $value) {
         //if($key=='extend')continue;
         $this->m_ActiveRecord[$key] = $record[$key];
     }
 }
Exemplo n.º 8
0
 static function getPanels()
 {
     $pa = Panel::cacheTags('panels')->remember(1440)->get();
     $panel_list = array();
     foreach ($pa as $panel) {
         $panel_list[$panel->slot] = array('img' => $panel->img, 'text' => $panel->text, 'link' => $panel->link, 'title' => $panel->title, 'updated_at' => display::formatDate($panel->updated_at));
     }
     return $panel_list;
 }
Exemplo n.º 9
0
 public function run()
 {
     $replace = \Config::get('laravel-panels::seed.replace');
     if ($replace) {
         \DB::table('fbf_panels')->delete();
     }
     $faker = \Faker\Factory::create();
     $statuses = array(Panel::DRAFT, Panel::APPROVED);
     $types = \Config::get('laravel-panels::types');
     foreach ($types as $type => $options) {
         for ($i = 0; $i < 10; $i++) {
             $panel = new Panel();
             $panel->type = $type;
             $title = $faker->words(rand(2, 4), true);
             $panel->title = $title;
             $summary = $faker->sentence(rand(10, 20));
             $panel->description = $summary;
             $panel->link_text = 'Read more &raquo;';
             $panel->link_url = '#';
             foreach (range(1, 2) as $imageNum) {
                 $filename = null;
                 $imageKey = 'image_' . $imageNum;
                 $imageOptions = $options['images'][$imageKey];
                 if ($imageOptions['show']) {
                     foreach ($imageOptions['sizes'] as $size => $sizeOptions) {
                         $image = $faker->image(public_path($sizeOptions['dir']), $sizeOptions['width'], $sizeOptions['height']);
                         if (is_null($filename)) {
                             $filename = basename($image);
                             copy($image, public_path($imageOptions['original']['dir']) . $filename);
                         } else {
                             rename($image, public_path($sizeOptions['dir']) . $filename);
                         }
                     }
                     $panel->{$imageKey} = $filename;
                 }
             }
             $panel->status = $faker->randomElement($statuses);
             $panel->published_date = $faker->dateTimeBetween('-1 year', '+1 month');
             $panel->save();
         }
     }
     echo 'Database seeded' . PHP_EOL;
 }
Exemplo n.º 10
0
 private function renderWidgetList($value, $choices, $attributes)
 {
     $name = $this->getAttribute('name');
     $flags = $this->getAttribute('flags');
     $hiddenWidget = new Hidden($this->view);
     $hiddenWidget->setAttribute('flags', $flags)->setAttribute('value', '')->setAttribute('class', 'Hidden')->setAttribute('name', $name);
     $contentWidget = new Literal($this->view);
     $contentWidget->setAttribute('data', $this->generateSelectorContentWidgetList($name, $value, $choices, $flags));
     $panelWidget = new Panel($this->view);
     $panelWidget->setAttribute('class', $attributes['class'])->setAttribute('name', $name)->insert($hiddenWidget)->insert($contentWidget);
     if ($this->getAttribute('flags') & \Nethgui\Renderer\WidgetFactoryInterface::LABEL_NONE) {
         return $panelWidget->renderContent();
     }
     $fieldsetWidget = new Fieldset($this->view);
     $fieldsetWidget->setAttribute('template', $this->getAttribute('label', $this->getTranslateClosure($name . '_label')))->setAttribute('flags', $this->getAttribute('flags'));
     if ($this->hasAttribute('icon-before')) {
         $fieldsetWidget->setAttribute('icon-before', $this->getAttribute('icon-before'));
     }
     $fieldsetWidget->insert($panelWidget);
     return $fieldsetWidget->renderContent();
 }
Exemplo n.º 11
0
function builderForm($id, $fieldName, $fieldsetName, $context)
{
    $kirby = kirby();
    $kirby->extensions();
    $kirby->plugins();
    $root = $kirby->roots->index . DS . 'panel';
    $panel = new Panel($kirby, $root);
    $panel->i18n();
    $roots = new Panel\Roots($panel, $root);
    $site = $kirby->site();
    $page = empty($id) ? site() : page($id);
    if (!$page) {
        throw new Exception('The page could not be found');
    }
    $blueprint = blueprint::find($page);
    $field = null;
    $fields = $context == 'file' ? $blueprint->files()->fields() : $blueprint->fields();
    // make sure to get fields by case insensitive field names
    foreach ($fields as $f) {
        if (strtolower($f->name) == strtolower($fieldName)) {
            $field = $f;
        }
    }
    if (!$field) {
        throw new Exception('The field could not be found');
    }
    $fieldsets = $field->fieldsets();
    $fields = new Blueprint\Fields($fieldsets[$fieldsetName]['fields'], $page);
    $fields = $fields->toArray();
    foreach ($fields as $key => $field) {
        if ($field['type'] == 'textarea') {
            $fields[$key]['buttons'] = false;
        }
    }
    $form = new Form($fields, null, $fieldName);
    $form->save = get('_id') ? l('fields.structure.save') : l('fields.structure.add');
    echo '<div class="modal-content modal-content-large">';
    echo $form;
    echo '</div>';
}
Exemplo n.º 12
0
 /**
  * @see		View::createUserInterface()
  */
 protected function createUserInterface()
 {
     $resourceBundle = Application::getInstance()->getBundle();
     //Definição do título da página principal da aplicação
     $this->setTitle($resourceBundle->getString('MAIN_TITLE'));
     //Carregamento da folha de estilo principal da aplicação
     $this->addStyle('/css/application.css');
     //Painel principal
     $this->applicationPanel = $this->addChild(new Panel());
     $this->applicationPanel->setId('application');
     $topPanel = $this->applicationPanel->addChild(new Panel());
     $topPanel->setId('top');
     //Título da aplicação
     $topPanel->addChild(new Heading())->addChild(new Anchor('/'))->addChild(new Text($resourceBundle->getString('SHORT_TITLE')));
     //Criação do menu da aplicação
     $this->applicationMenu = $topPanel->addChild(new Menu());
     foreach ($resourceBundle->getResource('MENU') as $resourceItem) {
         $this->applicationMenu->addItem($resourceItem->getValue(), $resourceItem->getIterator()->current()->getValue());
     }
     //Painel de conteúdo
     $this->contentPanel = $this->applicationPanel->addChild(new Panel());
     $this->contentPanel->setId('content');
 }
Exemplo n.º 13
0
 public function __construct($id, Pageable $pageable)
 {
     parent::__construct($id);
     $this->pageable = $pageable;
     $pageLinks = new RepeatingView('page');
     $this->add($pageLinks);
     for ($i = 0; $i < $this->pageable->getPageCount(); $i++) {
         $linkBlock = new MarkupContainer($pageLinks->getNextChildId());
         $link = new NavigationLink('pageLink', $pageable, $i + 1);
         $linkBlock->add($link);
         $link->add(new Label('pageNumber', new BasicModel($i + 1)));
         $pageLinks->add($linkBlock);
     }
 }
Exemplo n.º 14
0
 protected function onInitialize()
 {
     parent::onInitialize();
     $me = $this;
     //@todo add the type hint back into the closure when the serializer can handle them
     $this->add(new ListView("tab", function ($item) use($me) {
         $tab = $item->getModelObject();
         $link = $me->newLink('link', $item->getIndex());
         if ($me->getSelectedTab() == $item->getIndex()) {
             $item->add(new \picon\AttributeAppender('class', new \picon\BasicModel('selected'), ' '));
         }
         $item->add($link);
         $link->add(new \picon\Label('name', new \picon\BasicModel($tab->name)));
     }, new ArrayModel($this->collection->tabs)));
 }
Exemplo n.º 15
0
	function ContentSlider($content=null, $left, $top, $width, $height)
	{
		parent::Panel($left, $top, $width, $height);
		WebPage::That()->CSSFiles->Add(GetRelativePath(getcwd(), dirname(__FILE__)) . '/Styles/default.css');
		$this->CSSClasses->Add('ContentSlider');
		$this->SlideHolder = new Panel(0, 0, '100%', '100%');
		$this->Slides = new Group();
		$this->Slides->Change = new ServerEvent($this, 'SlideContent');
		$this->SlideHolder->Controls->Add($this->Slides);
		if($content)
			$this->SetContent($content);
		$this->Controls->Add($this->SlideHolder);
		$this->SetPrevious();
		$this->SetNext();
	}
Exemplo n.º 16
0
 public function __construct($server_id = null)
 {
     global $main;
     //@todo fix me this is an ugly fix to avoid the useless calls in the ajax::editserverhash and ajax::serverhash
     if ($server_id != '-1') {
         parent::__construct($server_id);
         $this->status = false;
         if (!empty($server_id)) {
             if ($this->_testConnection()) {
                 $this->status = true;
                 $main->addlog('ispconfig::construct Testing connection ok');
             } else {
                 $main->addlog('ispconfig::construct Testing connection failed');
             }
         } else {
             $main->addlog('ispconfig::server id not provided');
         }
     }
 }
Exemplo n.º 17
0
 /**
  * Get an element object
  *
  * @param string $elementName - name of the control
  * @return Element
  */
 public function getElement($elementName)
 {
     if ($this->m_DataPanel->get($elementName)) {
         return $this->m_DataPanel->get($elementName);
     }
     if ($this->m_ActionPanel->get($elementName)) {
         return $this->m_ActionPanel->get($elementName);
     }
     if ($this->m_NavPanel->get($elementName)) {
         return $this->m_NavPanel->get($elementName);
     }
     if ($this->m_SearchPanel->get($elementName)) {
         return $this->m_SearchPanel->get($elementName);
     }
     if ($this->m_WizardPanel) {
         if ($this->m_WizardPanel->get($elementName)) {
             return $this->m_WizardPanel->get($elementName);
         }
     }
 }
Exemplo n.º 18
0
 function Hangman($left, $top, $width, $height)
 {
     parent::Panel($left, $top, $width, $height);
     // A Group of RadioButtons allows only one RadioButton to be Checked
     $this->DifficultyGroup = new Group();
     /* Each of the next three lines adds a new RadioButton Control 
     		to the Group. A new Item is passed into the RadioButton so that  a 
     		certain Text will be displayed while the Value will correspond to the 
     		number of Chances that that difficulty allows.*/
     $this->DifficultyGroup->Add(new RadioButton(new Item('Easy game; you are allowed 10 misses.', 10), 15, 98, 300));
     $this->DifficultyGroup->Add(new RadioButton(new Item('Medium game; you are allowed 5 misses.', 5), 15, 121, 300));
     $this->DifficultyGroup->Add(new RadioButton(new Item('Hard game; you are only allowed 3 misses.', 3), 15, 144, 300));
     //Play button which starts the game
     $play = new Button('Play', 15, 169, 60);
     //Assign a Click Event to the play button
     $play->Click = new ServerEvent($this, 'PlayGame');
     //label to display HangMan instructions
     $explanation = new Label('This is the game of HangMan. You must guess a word or phrase, a letter at a time. If you make too many mistakes, you lose the game!', 15, 60, 620, 40);
     //AddRange allows you to add an multiple Control in a single statement
     $this->Controls->AddRange($explanation, $this->DifficultyGroup, $play);
 }
Exemplo n.º 19
0
 protected function renderContent()
 {
     // Ensure a name is defined:
     if (!$this->hasAttribute('name')) {
         $this->setAttribute('name', 'FormAction');
     }
     $name = $this->getAttribute('name');
     if (isset($this->view[$name])) {
         $action = $this->view[$name];
     } else {
         // Rely on action attribute as fallback:
         $action = $this->view->getModuleUrl($this->getAttribute('action', ''));
     }
     // Clear the INSET_FORM flag as the form is now rendered.
     $this->getRenderer()->rejectFlag(\Nethgui\Renderer\WidgetFactoryInterface::INSET_FORM);
     $attributes = array('method' => $this->getAttribute('method', 'post'), 'action' => $action, 'class' => 'Form ' . $this->getClientEventTarget());
     // Change default panel wrap tag:
     $this->setAttribute('tag', $this->getAttribute('tag', FALSE));
     $content = '';
     $content .= $this->openTag('form', $attributes);
     $content .= parent::renderContent();
     $content .= $this->closeTag('form');
     return $content;
 }
Exemplo n.º 20
0
function showPanel($chart_id, $panel_id, $help_msg, $analysis_msg)
{
    $panel_db = new PanelDB();
    $p = $panel_db->selectPanel($panel_id);
    if ($p["ishide"] == 1) {
        return;
    }
    $panel = new Panel();
    $panel->data = $p;
    $panel->data["left"] = $p["x"] . "px";
    $panel->data["top"] = $p["y"] . "px";
    //截图不需要显示这些
    if (!isset($_GET["snap"])) {
        $permission = new Permission();
        $isEditable = $permission->checkBoardEditPermission(DASHBOARD_ID, $_SESSION["email"]);
        $panel->addOptionHelp();
        if ($isEditable) {
            $panel->addOptionEdit();
            $panel->addOptionDataLock();
            if ($panel->data["analysis_show"] == "1") {
                $panel->addOptionAnalysis(1);
            } else {
                $panel->addOptionAnalysis();
            }
            //$panel->addOptionChangeSize();
            //$panel->data["dragable"]='dragable';
        }
    }
    //data["analysis_show"]=="1" 表示显示分析数据 ,如果显示分析数据:chart宽度60%,图标为打开;否则:width默认,图标为折叠样式
    if ($panel->data["analysis_show"] == "1") {
        $panel->data["content"] = "<div class='ichart' style='width:70%' id='chart{$chart_id}'></div>";
        $panel->data["content"] .= "<div class='ichart_analysis_msg showing'>{$analysis_msg}</div>";
        $panel->data["content"] .= "<div class='ichart_help_msg' style='width:70%'>{$help_msg}</div>";
    } else {
        $panel->data["content"] = "<div class='ichart' id='chart{$chart_id}'></div>";
        $panel->data["content"] .= "<div class='ichart_analysis_msg' style='display:none;'>{$analysis_msg}</div>";
        $panel->data["content"] .= "<div class='ichart_help_msg'>{$help_msg}</div>";
    }
    $panel->show();
}
Exemplo n.º 21
0
<?php

define('DS', DIRECTORY_SEPARATOR);
// fetch the site's index directory
$index = dirname(__DIR__);
// load the kirby bootstrapper
require $index . DS . 'kirby' . DS . 'bootstrap.php';
// load the panel bootstrapper
require __DIR__ . DS . 'app' . DS . 'bootstrap.php';
// check for a custom site.php
if (file_exists($index . DS . 'site.php')) {
    // load the custom config
    require $index . DS . 'site.php';
} else {
    // create a new kirby object
    $kirby = kirby();
}
// fix the base url for the kirby installation
if (!isset($kirby->urls->index)) {
    $kirby->urls->index = dirname($kirby->url());
}
// the default index directory
if (!isset($kirby->roots->index)) {
    $kirby->roots->index = $index;
}
// create the panel object
$panel = new Panel($kirby, __DIR__);
// launch the panel
echo $panel->launch();
Exemplo n.º 22
0
 protected function renderContent()
 {
     $childCountClass = ' c' . count($this->getChildren());
     $this->setAttribute('class', $this->getAttribute('class', 'columns') . $childCountClass);
     return parent::renderContent();
 }
Exemplo n.º 23
0
            break;
    }
}
// Определение режима отображения сайта (пользовательский/админский)
if (!defined('APP_DISPLAY_MODE')) {
    if ($bIsAdmin && isset($_SESSION['SACID_DISPLAY_MODE']) && $_SESSION['SACID_DISPLAY_MODE'] == 'EDIT') {
        define("APP_DISPLAY_MODE", 'EDIT');
    } else {
        define("APP_DISPLAY_MODE", 'NORMAL');
    }
}
/**
 * Файл с пунктами меню администратора
 */
if ($bIsAdmin && APP_DISPLAY_MODE == 'NORMAL') {
    Panel::setItem('?sacid_display_mode=edit', 'Режим редактирования');
    Panel::setItem('/scriptacid/logout.php?logout=Y', 'Выход');
} elseif ($USER->IsAdmin() && APP_DISPLAY_MODE == 'EDIT') {
    Panel::setItem('<js>ChgPageTitle(\'' . $_SERVER['PHP_SELF'] . '\')', 'Изменить заголовок');
    Panel::setItem('<br>');
    Panel::setItem('<js>CreatePage()', 'Создать страницу');
    Panel::setItem('<js>EditPage()', 'Изменить страницу');
    Panel::setItem('<js>DeletePage()', 'Удалить страницу');
    Panel::setItem('<br>');
    Panel::setItem('<js>CreateDir()', 'Создать раздел');
    Panel::setItem('<br>');
    Panel::setItem('?sacid_display_mode=normal', 'Режим просмотра');
}
// Проверяем права пользователя на доступ к данной папке
$bAccessPath = Permitions::CheckPathPerms(getCurDir());
define("ACCESS_PATH", $bAccessPath);
Exemplo n.º 24
0
$line_column_panel->addOptionCreate();
$line_column_panel->show();
echo '<script>' . '$("#chart4").highcharts(' . $line_column_chart->getChartJson() . ');' . '</script>';
echo "</div>";
#PieChart
echo "<div class='col-sm-6'>";
$pie_chart = new PieChart();
$pie_panel = new Panel();
$pie_chart->demo();
$pie_panel->data["content"] = "<div class='ichart' id='chart5'></div>";
$pie_panel->addOptionCreate();
$pie_panel->show();
echo '<script>' . '$("#chart5").highcharts(' . $pie_chart->getChartJson() . ');' . '</script>';
echo "</div>";
#Dim2PieChart
echo "<div class='col-sm-6'>";
$dim2pie_chart = new Dim2PieChart();
$dim2pie_panel = new Panel();
$dim2pie_chart->demo();
$dim2pie_panel->data["content"] = "<div class='ichart' id='chart6'></div>";
$dim2pie_panel->addOptionCreate();
$dim2pie_panel->show();
echo '<script>' . '$("#chart6").highcharts(' . $dim2pie_chart->getChartJson() . ');' . '</script>';
echo "</div>";
?>
	</div></div>
	</div>	
</div>

</body>
</html>
Exemplo n.º 25
0
	/**
	* Do not call manually! Override of default Show(). Triggers when tinyMCE instance is initially shown.
	*/
	function Show()
	{
		parent::Show();
		$relativePath = System::GetRelativePath(getcwd(), dirname(__FILE__));
		//Add tinymce script files
		ClientScript::AddSource($relativePath . 'Vendor/jquery-1.5.2.min.js', false);
		ClientScript::AddSource($relativePath . 'Vendor/Highcharts/js/highcharts.js', false);
		ClientScript::AddSource($relativePath . 'Vendor/Highcharts/js/modules/exporting.js', false);
		$args = ClientScript::ClientFormat($this->Config);
		ClientScript::RaceQueue($this, 'Highcharts',
			'new Highcharts.Chart', array($this->Config));	
	}
Exemplo n.º 26
0
 public function opciones()
 {
     Panel::seguridad(true);
 }
Exemplo n.º 27
0
 public function refresh()
 {
     $this->addText($this->lines);
     parent::refresh();
 }
Exemplo n.º 28
0
<?php

defined('PANEL_ACCESS') or die('No direct script access.');
// new panel
$p = new Panel();
/*  = Sections
--------------------------------------------*/
/*
* @name   Dashboard | login
* @desc   if session user get Dashboard
* @desc   if not redirecto to login page
*/
$p->route('/', function () use($p) {
    if (Session::exists('user')) {
        // show dashboard
        $p->view('index', ['title' => $p::$lang['Dashboard'], 'pages' => count(File::scan(ROOTBASE . DS . 'storage' . DS . 'pages', 'md')), 'images' => count(File::scan(ROOTBASE . DS . 'public' . DS . 'images')), 'uploads' => count(File::scan(ROOTBASE . DS . 'public' . DS . 'uploads')), 'blocks' => count(File::scan(ROOTBASE . DS . 'storage' . DS . 'blocks', 'md')), 'themes' => count(Dir::scan(ROOTBASE . DS . 'themes' . DS)), 'plugins' => count(Dir::scan(ROOTBASE . DS . 'plugins' . DS))]);
    } else {
        // empty error
        $error = '';
        if (Request::post('login')) {
            if (Request::post('csrf')) {
                if (Request::post('pass') == $p::$site['backend_password'] && Request::post('email') == $p::$site['autor']['email']) {
                    @Session::start();
                    Session::set('user', uniqid('morfy_user'));
                    Request::redirect($p::$site['url'] . '/' . $p::$site['backend_folder']);
                } else {
                    // password not correct show error
                    $error = '<span class="login-error error">' . $p::$lang['Password_Error'] . '</span>';
                }
            } else {
                // crsf
			if (! $aclf->checkAccessToFunction("ED_CL_META_DATA")) 
			  $pos_objectProp = 2;
			  
			// Process actions:
			if ($action == $lang->get("save") && $errors == "" && $search == "") {
				processSaveSets();

				if ($errors != "") {
					$form->addToTopText($lang->get("saveerror"));
				} else {
					$form->addToTopText($lang->get("savesuccess"));
				}
			}
			$clusterPanel = new Panel($lang->get("ed_content"));
			$clusterPanel->backto = $c["docroot"]."modules/cluster/clusterbrowser.php?sid=$sid&oid=$clnid&view=1";
			$propPanel = new Panel($lang->get("cl_properties"));
			$metaPanel = new Panel($lang->get("ed_meta"));			
			if ($view == $pos_clusterPanel && count($variations) > 0 && ($aclf->checkAccessToFunction("EDIT_CL_CONTENT"))) {
				require_once $c["path"] . "modules/common/panel_cluster.inc.php";
			} else if ($view == $pos_objectProp && $aclf->checkAccessToFunction("CL_PROPS")) {
				$mynode = getVar("cluster");
				$cond = "CLNID = $clnid";
				$oname = new TextInput($lang->get("cl_name"), "cluster_node", "NAME", $cond, "type:text,width:200,size:32", "MANDATORY&UNIQUE");
				$oname->setFilter("CLT_ID = $mynode");
				$propPanel->add(new Hidden("view", $view));
				$propPanel->add(new Hidden("processing", "yes"));

				$propPanel->add($oname);
				$propPanel->add(new SelectMultiple2Input($lang->get("variations"), "cluster_variations", "VARIATION_ID", $cond . " AND DELETED=0", "variations", "NAME", "VARIATION_ID", "DELETED=0"));
				$propPanel->add(new Hidden("action", "objectprop"));
				$propPanel->add(new FormButtons(true, true));
Exemplo n.º 30
0
<?php

/*
** CONTEST PORTAL v3 
** Created By Andy Sturzu (sturzu.org)
*/
require_once dirname(__FILE__) . '/app/config/config.php';
require_once dirname(__FILE__) . '/app/frameworks/panel.php';
require_once dirname(__FILE__) . '/app/functions/functions.php';
session_start();
session_regenerate_id();
date_default_timezone_set('America/Chicago');
$panel = new Panel('panel', false, 'logs/' . date('Y-m-d') . '.txt');
//include default routing engine with logs enabled
$panel->route('/', function ($panel) {
    //index router, check for login
    $schools = json_decode(file_get_contents(dirname(__FILE__) . "/app/config/schools.json"), true);
    if (!isLoggedIn()) {
        return $panel->render("login.html", ["title" => title, "contest_name" => contest_name, "schools" => $schools]);
    }
    return $panel->render("home.html", ["title" => title, "contest_name" => contest_name, "t" => $_SESSION['team'], "navbar_title" => navbar_title, "written" => getTeamWritten(), "info" => getTeamInfo(), "pizza_ordered" => hasOrderedPizza($_SESSION['team'])]);
});
$panel->route('/scoreboard', function ($panel) {
    $schools = json_decode(file_get_contents(dirname(__FILE__) . "/app/config/schools.json"), true);
    if (!isLoggedIn()) {
        return $panel->render("login.html", ["title" => title, "contest_name" => contest_name, "schools" => $schools]);
    }
    return $panel->render("scoreboard.html", ["title" => title, "contest_name" => contest_name]);
});
$panel->route('/admin', function ($panel) {
    if (adminIsLoggedIn()) {