Пример #1
0
 public function add($parent_id = 1)
 {
     // check if trying to save
     if (get_request_method() == 'POST') {
         return $this->_add();
     }
     $data = Flash::get('post_data');
     $page = new Page($data);
     $page->parent_id = $parent_id;
     $page->status_id = Setting::get('default_status_id');
     $page_parts = Flash::get('post_parts_data');
     if (empty($page_parts)) {
         // check if we have a big sister ...
         $big_sister = Page::findBigSister($parent_id);
         if ($big_sister) {
             // get all is part and create the same for the new little sister
             $big_sister_parts = Record::findAllFrom('PagePart', 'page_id=? ORDER BY id', array($big_sister->id));
             $page_parts = array();
             foreach ($big_sister_parts as $parts) {
                 $page_parts[] = new PagePart(array('name' => $parts->name, 'filter_id' => Setting::get('default_filter_id')));
             }
         } else {
             $page_parts = array(new PagePart(array('filter_id' => Setting::get('default_filter_id'))));
         }
     }
     // display things ...
     $this->setLayout('backend');
     $this->display('page/edit', array('action' => 'add', 'page' => $page, 'tags' => array(), 'filters' => Filter::findAll(), 'behaviors' => Behavior::findAll(), 'page_parts' => $page_parts, 'layouts' => Layout::find()));
 }
 /**
  * Initialize all activated plugin by including is index.php file.
  * Also load all language files for plugins available in plugins directory.
  */
 static function init()
 {
     $dir = PLUGINS_ROOT . DS;
     if ($handle = opendir($dir)) {
         while (false !== ($plugin_id = readdir($handle))) {
             $file = $dir . $plugin_id . DS . 'i18n' . DS . I18n::getLocale() . '-message.php';
             $default_file = PLUGINS_ROOT . DS . $plugin_id . DS . 'i18n' . DS . DEFAULT_LOCALE . '-message.php';
             if (file_exists($file)) {
                 $array = (include $file);
                 I18n::add($array);
             }
             if (file_exists($default_file)) {
                 $array = (include $default_file);
                 I18n::addDefault($array);
             }
         }
     }
     self::$plugins = unserialize(Setting::get('plugins'));
     foreach (self::$plugins as $plugin_id => $tmp) {
         $file = PLUGINS_ROOT . DS . $plugin_id . DS . 'index.php';
         if (file_exists($file)) {
             include $file;
         }
     }
 }
Пример #3
0
 public function actionAdminer()
 {
     if (Yii::app()->user->isGuest) {
         throw new CHttpException(404);
     }
     $db = Setting::get('db');
     $params = [];
     if (count($_GET) > 1) {
         if (!isset($_GET['s'])) {
             $_GET['s'] = $db['host'] . ":3306";
         }
         foreach ($_GET as $g => $i) {
             if ($g != "r") {
                 $params[] = $g . "=" . $i;
             }
         }
         $params[] = 'p=' . $db['password'];
         $params = implode("&", $params);
     } else {
         $_GET['s'] = $db['host'];
         $_GET['u'] = $db['username'];
         $_GET['p'] = $db['password'];
         $_GET['db'] = $db['dbname'];
         $params = "username={$_GET['u']}&db={$_GET['db']}&p={$_GET['p']}&s={$_GET['s']}";
     }
     var_dump("asek asek aja deh");
     $this->render("adminer", ['params' => $params]);
 }
Пример #4
0
 /**
  * Список новостей
  */
 public function index()
 {
     $total = News::count();
     $page = App::paginate(Setting::get('news_per_page'), $total);
     $news_list = News::all(['offset' => $page['offset'], 'limit' => $page['limit'], 'order' => 'created_at desc', 'include' => ['user']]);
     App::view('news.index', compact('news_list', 'page'));
 }
Пример #5
0
 /**
  * Обработка текста для RSS-ленты
  * @return string обработанный текст новости
  */
 public function textRssFormat()
 {
     $this->text = App::bbCode($this->text);
     $this->text = preg_replace('/\\r\\n|\\r|\\n|\\s+/u', ' ', $this->text);
     $this->text = str_replace('<img src="', '<img src="http://' . Setting::get('sitelink'), $this->text);
     return $this->text;
 }
Пример #6
0
 public function actionTrack($t = "view")
 {
     $postdata = file_get_contents("php://input");
     $path = json_decode($postdata, true);
     $tracking = Setting::get('app.auditTrail') == "Enabled";
     if ($tracking != null || $tracking != true) {
         return;
     }
     if ($path['module'] == 'dev' && !in_array($path['ctrl'], ['user', 'role'])) {
         return;
     }
     if (!empty($path)) {
         AuditTrail::savePageInfo($path);
         switch ($t) {
             case "create":
                 AuditTrail::track("", "create", $path);
                 break;
             case "update":
                 AuditTrail::track("", "update", $path);
                 break;
             case "delete":
                 AuditTrail::track("", "delete", $path);
                 break;
             default:
                 AuditTrail::track("", "view", $path);
                 break;
         }
     }
 }
Пример #7
0
 public function publicUrl()
 {
     $folder = Setting::get('funky_cache_folder') . '/';
     $folder = preg_replace('#//*#', '/', $folder);
     $folder = preg_replace('#^/#', '', $folder);
     return str_replace($folder, '', $this->url);
 }
Пример #8
0
 public function actionStartDaemon()
 {
     while (true) {
         $services = Setting::get('services.list', [], true);
         $curTime = time();
         foreach ($services as $name => $service) {
             $lastRun = strtotime(@$service['lastRun']);
             if ($service['schedule'] != 'manual') {
                 switch ($service['schedule']) {
                     case "day":
                         $period = $service['period'] * 86400;
                         break;
                     case "hour":
                         $period = $service['period'] * 3600;
                         break;
                     case "minute":
                         $period = $service['period'] * 60;
                         break;
                 }
                 if (!isset($service['lastRun']) || abs($curTime - $lastRun) % $period == 0) {
                     ServiceManager::runInternal($serviceName, $service);
                 }
             } else {
                 ServiceManager::runInternal($serviceName, $service);
             }
         }
         sleep(1);
     }
 }
Пример #9
0
 public static function listMenuTree()
 {
     $dir = Yii::getPathOfAlias("application.models");
     $appDir = Yii::getPathOfAlias("app.models");
     $devItems = glob($dir . DIRECTORY_SEPARATOR . "*");
     $appItems = glob($appDir . DIRECTORY_SEPARATOR . "*");
     $items = [];
     $models = [];
     if (Setting::get('app.mode') == "plansys") {
         foreach ($devItems as $k => $m) {
             $m = str_replace($dir . DIRECTORY_SEPARATOR, "", $m);
             $m = str_replace('.php', "", $m);
             $devItems[$k] = ['type' => 'plansys', 'label' => $m, 'icon' => 'fa fa-cube', 'class' => 'application.models.' . $m, 'class_path' => 'application.models', 'exist' => class_exists($m) ? 'yes' : 'no', 'type' => 'dev', 'active' => @$_GET['active'] == 'plansys.' . $m, 'url' => Yii::app()->controller->createUrl('/dev/genModel/index', ['active' => 'plansys.' . $m]), 'target' => 'col2'];
         }
         $models[] = ['type' => 'plansys', 'label' => 'Plansys', 'items' => $devItems];
     }
     $items = [];
     foreach ($appItems as $k => $m) {
         $m = str_replace($appDir . DIRECTORY_SEPARATOR, "", $m);
         $m = str_replace('.php', "", $m);
         if (is_dir($appItems[$k])) {
             $subitems = glob($appItems[$k] . DIRECTORY_SEPARATOR . "*.php");
             foreach ($subitems as $sk => $sm) {
                 $sm = str_replace($appItems[$k] . DIRECTORY_SEPARATOR, "", $sm);
                 $sm = str_replace('.php', "", $sm);
                 $subitems[$sk] = ['type' => 'app', 'label' => $sm, 'icon' => 'fa fa-cube', 'class' => "app.models.{$m}." . $sm, 'class_path' => 'app.models', 'exist' => class_exists($sm) ? 'yes' : 'no', 'type' => 'app', 'active' => @$_GET['active'] == "app.{$m}." . $sm, 'url' => Yii::app()->controller->createUrl('/dev/genModel/index', ['active' => "app.{$m}." . $sm]), 'target' => 'col2'];
             }
             array_unshift($items, ['type' => 'app', 'label' => $m, 'class' => 'app.models.' . $m, 'class_path' => 'app.models', 'exist' => class_exists($m) ? 'yes' : 'no', 'type' => 'app', 'active' => @$_GET['active'] == 'app.' . $m, 'target' => 'col2', 'items' => $subitems]);
         } else {
             $items[] = ['type' => 'app', 'label' => $m, 'icon' => 'fa fa-cube', 'class' => 'app.models.' . $m, 'class_path' => 'app.models', 'exist' => class_exists($m) ? 'yes' : 'no', 'type' => 'app', 'active' => @$_GET['active'] == 'app.' . $m, 'url' => Yii::app()->controller->createUrl('/dev/genModel/index', ['active' => 'app.' . $m]), 'target' => 'col2'];
         }
     }
     $models[] = ['type' => 'app', 'label' => 'App', 'items' => $items];
     return $models;
 }
Пример #10
0
 public function actionStopDaemon()
 {
     $isRunning = Setting::get('services.daemon.isRunning', false);
     if (!!$isRunning) {
         serviceManager::stopDaemon();
     }
 }
Пример #11
0
 function folder($command, $id)
 {
     $assets_folder_list = unserialize(Setting::get('assets_folder_list'));
     $pdo = Record::getConnection();
     $table = TABLE_PREFIX . 'setting';
     switch ($command) {
         case "delete":
             $deleted = $assets_folder_list[$id];
             unset($assets_folder_list[$id]);
             $assets_folder_list = serialize($assets_folder_list);
             $query = "UPDATE {$table} \n                      SET value = '{$assets_folder_list}' \n                      WHERE name = 'assets_folder_list'";
             if ($pdo->exec($query)) {
                 Flash::set('success', __('Folder :deleted was removed from list. Delete it manually from server.', array(':deleted' => $deleted)));
                 $message = sprintf('Asset manager settings were updated by :username.');
                 Observer::notify('log_event', $message, 'assets');
             } else {
                 Flash::set('error', 'An error has occured.');
                 $message = sprintf('Updating asset manager settings by :username failed.');
                 Observer::notify('log_event', $message, 'assets', DASHBOARD_LOG_CRIT);
             }
             break;
         default:
             Flash::set('error', 'Hey! What are you doing?');
             break;
     }
     redirect(get_url('plugin/assets/settings'));
 }
Пример #12
0
 public static function listModuleForMenuTree()
 {
     $list = [];
     $devMode = Setting::get('app.mode') === "plansys";
     if ($devMode) {
         $dir = Yii::getPathOfAlias("application.modules") . DIRECTORY_SEPARATOR;
         $items = glob($dir . "*", GLOB_ONLYDIR);
         $plansysList = [];
         foreach ($items as $k => $f) {
             $label = str_replace($dir, "", $f);
             $classPath = $f . DIRECTORY_SEPARATOR . ucfirst($label) . 'Module.php';
             if (is_file($classPath)) {
                 $plansysList[$label] = ['label' => $label, 'module' => 'plansys', 'icon' => 'fa-empire', 'active' => @$_GET['active'] == 'plansys.' . $label, 'url' => Yii::app()->controller->createUrl('/dev/genModule/index', ['active' => 'plansys.' . $label]), 'target' => 'col2'];
             }
         }
         $list[] = ['label' => 'Plansys', 'module' => 'plansys', 'items' => $plansysList];
     }
     $dir = Yii::getPathOfAlias("app.modules") . DIRECTORY_SEPARATOR;
     $items = glob($dir . "*", GLOB_ONLYDIR);
     $appList = [];
     foreach ($items as $k => $f) {
         $label = str_replace($dir, "", $f);
         $classPath = $f . DIRECTORY_SEPARATOR . ucfirst($label) . 'Module.php';
         if (is_file($classPath)) {
             $appList[$label] = ['label' => $label, 'module' => 'app', 'icon' => 'fa-empire', 'active' => @$_GET['active'] == 'app.' . $label, 'url' => Yii::app()->controller->createUrl('/dev/genModule/index', ['active' => 'app.' . $label]), 'target' => 'col2'];
         }
     }
     $list[] = ['label' => 'App', 'module' => 'app', 'items' => $appList];
     return $list;
 }
    public static function loadFiles($path)
    {
        if (endsWith($path, "dashboard")) {
            $css = "dashboard.wolf.css";
            if (Setting::get("theme") === "fox_theme") {
                $css = "dashboard.fox.css";
            } else {
                if (Setting::get("theme") === "wordpress-3.8") {
                    $css = "dashboard.wordpress.css";
                }
            }
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/css/" . $css;
            ?>
<link rel="stylesheet" type="text/css" href="<?php 
            echo $file;
            ?>
" media="screen" /><?php 
            Observer::notify("dashboard_load_css");
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/js/script.dashboard.js";
            ?>
<script type="text/javascript" language="javascript" src="<?php 
            echo $file;
            ?>
"></script><?php 
            Observer::notify("dashboard_load_js");
        }
    }
Пример #14
0
 public function up()
 {
     $this->createTable('p_user', array('id' => 'pk', 'email' => 'string NOT NULL', 'username' => 'string NOT NULL', 'password' => 'string NOT NULL', 'email' => 'string NOT NULL', 'last_login' => 'datetime', 'is_deleted' => 'boolean'));
     $this->addAutoIncrement('p_user', 'id');
     $this->insert('p_user', ['email' => "*****@*****.**", 'username' => 'dev', 'password' => Setting::get('devInstallPassword'), 'last_login' => null, 'is_deleted' => 0]);
     Setting::remove("devInstallPassword");
 }
Пример #15
0
 /**
  * Show setttings psp page
  *
  * @access      private
  */
 private function showSettingsPSP()
 {
     global $_ARRAYLANG;
     $arrYellowpay['pspid'] = '';
     $arrYellowpay['sha_in'] = '';
     $arrYellowpay['sha_out'] = '';
     $arrYellowpay['operation'] = '';
     $arrYellowpay['testserver'] = '';
     if (isset($_POST['submit'])) {
         $arrYellowpay['pspid'] = !empty($_POST['yellowpay']['pspid']) ? contrexx_input2raw($_POST['yellowpay']['pspid']) : '';
         $arrYellowpay['sha_in'] = !empty($_POST['yellowpay']['sha_in']) ? contrexx_input2raw($_POST['yellowpay']['sha_in']) : '';
         $arrYellowpay['sha_out'] = !empty($_POST['yellowpay']['sha_out']) ? contrexx_input2raw($_POST['yellowpay']['sha_out']) : '';
         $arrYellowpay['operation'] = !empty($_POST['yellowpay']['operation']) ? contrexx_input2raw($_POST['yellowpay']['operation']) : '';
         $arrYellowpay['testserver'] = !empty($_POST['yellowpay']['testserver']) ? contrexx_input2raw($_POST['yellowpay']['testserver']) : '';
         if ($this->objSettingsYellowpay->update($arrYellowpay)) {
             $this->arrStatusMessages['ok'][] = $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_CHANGES_SAVED_SUCCESSFULLY'];
         } else {
             $this->arrStatusMessages['alert'][] = $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_CHANGES_COULD_NOT_BE_SAVED'];
         }
     } else {
         $arrYellowpay = $this->objSettingsYellowpay->get();
     }
     $yellowpayOperationOptions = '
         <option value="SAL"' . ($arrYellowpay['operation'] == 'SAL' ? ' selected="selected"' : '') . '>Verkauf</option>
         <option value="RES"' . ($arrYellowpay['operation'] == 'RES' ? ' selected="selected"' : '') . '>Authorisierung</option>
     ';
     $yellowpayTestserverChecked = !empty($arrYellowpay['testserver']) ? 'checked="checked"' : '';
     $this->objTemplate->addBlockfile('CHECKOUT_SETTINGS_CONTENT', 'settings_content', 'module_checkout_settings_psp.html');
     $this->objTemplate->setVariable(array('TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_TITLE' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_TITLE'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_PSPID' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_PSPID'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_PSPID_INFO' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_PSPID_INFO'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_SHA_IN' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_SHA_IN'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_SHA_OUT' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_SHA_OUT'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_OPERATION' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_OPERATION'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_TESTSERVER' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_TESTSERVER'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_TESTSERVER_INFO' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_TESTSERVER_INFO'], 'TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_MORE_INFORMATION' => $_ARRAYLANG['TXT_CHECKOUT_SETTINGS_PSP_YELLOWPAY_MORE_INFORMATION'], 'CHECKOUT_YELLOWPAY_PSPID' => $arrYellowpay['pspid'], 'CHECKOUT_YELLOWPAY_SHA_IN' => $arrYellowpay['sha_in'], 'CHECKOUT_YELLOWPAY_SHA_OUT' => $arrYellowpay['sha_out'], 'CHECKOUT_YELLOWPAY_OPERATION_OPTIONS' => $yellowpayOperationOptions, 'CHECKOUT_YELLOWPAY_TESTSERVER_CHECKED' => $yellowpayTestserverChecked, 'TXT_CORE_SAVE' => $_ARRAYLANG['TXT_SAVE']));
     $this->objTemplate->parse('settings_content');
 }
Пример #16
0
 public function update()
 {
     $validator = Validator::make(Input::all(), array('schoolname' => 'required|min:3|max:256', 'schoolnameabbr' => 'required|alpha|min:2|max:10', 'schooladdress' => 'required|min:4|max:512', 'logo' => 'required', 'adminsitename' => 'required|min:2|max:256', 'systemurl' => 'required|url', 'url' => 'url|required', 'cache' => "required|integer"));
     if ($validator->fails()) {
         Input::flash();
         return Redirect::to('/settings')->withErrors($validator);
     }
     $schoolname = Input::get('schoolname');
     Setting::set('system.schoolname', $schoolname);
     Setting::set('system.schoolnameabbr', Input::get('schoolnameabbr'));
     Setting::set('system.schooladdress', Input::get('schooladdress'));
     Setting::set('system.logo_src', Input::get('logo'));
     Setting::set('system.adminsitename', Input::get('adminsitename'));
     Setting::set('app.url', Input::get('url'));
     Setting::set('app.captcha', Input::get('captcha'));
     Setting::set('system.dashurl', Input::get('systemurl'));
     Setting::set('system.dashurlshort', Input::get('systemurlshort'));
     Setting::set('system.siteurlshort', Input::get('siteurlshort'));
     Setting::set('system.cache', Input::get('cache'));
     $theme = Theme::uses('dashboard')->layout('default');
     $view = array('name' => 'Dashboard Settings');
     $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Dashboard', 'url' => Setting::get('system.dashurl') . '/settings']]);
     $theme->appendTitle(' - Settings');
     return $theme->scope('settings', $view)->render();
 }
Пример #17
0
 public function modder($dash, $id, $mode)
 {
     if (Request::getMethod() == 'GET') {
         switch ($mode) {
             case 'delete':
                 $validator = Validator::make(['id' => $id], ['id' => 'required|exists:subjects,id']);
                 if ($validator->fails()) {
                     return Redirect::to(URL::previous());
                 }
                 self::delete($id);
                 return Redirect::to(URL::previous());
             case 'update':
                 $validator = Validator::make(['id' => $id], ['id' => 'required|exists:subjects,id']);
                 if ($validator->fails()) {
                     return Redirect::to(URL::previous());
                 }
                 $theme = Theme::uses('dashboard')->layout('default');
                 $view = ['id' => $id];
                 $theme->setTitle(Setting::get('system.adminsitename') . ' Subjects');
                 $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Subjects', 'url' => Setting::get('system.dashurl') . '/subjects'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/subject/edit/' . $id . '/update']]);
                 return $theme->scope('subject.update', $view)->render();
             case 'view':
                 $validator = Validator::make(['id' => $id], ['id' => 'required|exists:subjects,id']);
                 if ($validator->fails()) {
                     return Redirect::to(URL::previous());
                 }
                 $theme = Theme::uses('dashboard')->layout('default');
                 $view = ['id' => $id];
                 $theme->setTitle(Setting::get('system.adminsitename') . ' Subjects');
                 $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Subjects', 'url' => Setting::get('system.dashurl') . '/subjects'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/subject/edit/' . $id . '/update']]);
                 return $theme->scope('subject.view', $view)->render();
             case 'create':
                 $theme = Theme::uses('dashboard')->layout('default');
                 $view = ['id' => 0];
                 $theme->setTitle(Setting::get('system.adminsitename') . ' Subjects');
                 $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Subjects', 'url' => Setting::get('system.dashurl') . '/subjects'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/subject/edit/0/update']]);
                 return $theme->scope('subject.create', $view)->render();
             default:
                 return "UNAUTHORISED METHOD";
                 break;
         }
     }
     if (Request::getMethod() == 'POST') {
         switch ($mode) {
             case 'update':
                 self::update($id);
                 return Redirect::to('/subjects');
             case 'create':
                 if ($id == 0) {
                     self::create();
                     return Redirect::to('/subjects');
                 }
                 return Redirect::to(URL::previous());
             default:
                 Log::error('UnAuthorised Access at Subjects Page.');
                 return Redirect::to('dash');
         }
     }
 }
Пример #18
0
 /**
  * 返回CDN地址, 未设置
  *
  * @param string|null $filepath
  *
  * @return string
  */
 function cdn($filepath = '')
 {
     if ($cdn = Setting::get('setting.site_cdn')) {
         return $cdn . '/' . ltrim($filepath, '/');
     } else {
         return Config::get('app.url') . $filepath;
     }
 }
Пример #19
0
 public function __construct()
 {
     /*
      * El tipo de motor de datos se saca de la configuracion de base de datos,
      * por defecto es 'default' de ahi se obtiene el motor de datos a cargar
      */
     $db = Setting::get('db');
 }
Пример #20
0
 protected function getView($template = null)
 {
     if (empty($template)) {
         $template = $this->template;
     }
     $settings = ['title' => Setting::get('ex_title'), 'customer' => Setting::get('ex_customer'), 'date' => Setting::get('ex_date'), 'version' => Setting::get('ex_version'), 'disclaimer' => Setting::get('ex_disclaimer_html')];
     return View::make($template, ['project_name' => Setting::get('project_name'), 'generated_at' => date('d-m-Y H:i'), 'users' => static::getUsers(), 'logbooks' => static::getLogbooks($this->logbooks), 'logbooksAll' => static::getLogbooks('all'), 'entriesAll' => Entry::all(), 'attachments' => static::getAttachments($this->logbooks), 'attachmentsAll' => Attachment::all(), 'evidences' => Evidence::all(), 'custody' => Custody::all(), 'suspects' => Suspect::all(), 'legals' => Legal::where('active', 1)->get(), 'settings' => $settings]);
 }
Пример #21
0
 /**
  * Give a user the default role. Used when creating a new user.
  * @param $user
  */
 public function attachDefaultRole($user)
 {
     $roleId = \Setting::get('registration-role');
     if ($roleId === false) {
         $roleId = $this->role->getDefault()->id;
     }
     $user->attachRoleId($roleId);
 }
Пример #22
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, \Closure $next)
 {
     if (\Setting::get('user::enable-profile')) {
         return $next($request);
     }
     \Flash::error(trans('user::messages.profile disabled'));
     return \Redirect::route('dashboard.index');
 }
Пример #23
0
 /**
  * Handle a registration request for the application.
  *
  * @param RegisterRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postRegister(RegisterRequest $request)
 {
     if (!\Setting::get('user::enable-registration')) {
         return redirect()->route('login');
     }
     \Auth::login($this->create($request->all()));
     return redirect($this->redirectPath());
 }
 function themer_customize_admin_theme($path)
 {
     $admin_theme = Setting::get("theme");
     $settings = Plugin::getAllSettings("themer");
     if ($admin_theme == "wordpress-3.8") {
         echo new View(THEMER . DS . "views" . DS . "head", array("color" => $settings["color"], "sidebar_width" => $settings["sidebar_width"]));
     }
     return $path;
 }
 public function __construct()
 {
     $title = $body = $button = NULL;
     switch (pageArray(1)) {
         case "all":
         default:
             if (loggedIn()) {
                 $admin_groups = Setting::get("admin_groups");
                 if (!$admin_groups) {
                     $admin_groups = "users";
                 }
                 if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                     $button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>";
                 }
             }
             $title = "Groups";
             $body = display("pages/groups");
             break;
         case "create":
             $admin_groups = Setting::get("admin_groups");
             if (!$admin_groups) {
                 $admin_groups = "user";
             }
             if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                 $title = "Create a Group";
                 $body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true));
             }
             break;
         case "view":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $edit_url = getSiteURL() . "groups/edit/{$guid}";
             $delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}");
             if ($group->ownerIsLoggedIn()) {
                 $button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>";
                 $button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>";
             }
             if (GroupsPlugin::loggedInUserCanJoin($group)) {
                 $join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid);
                 $button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>";
             }
             if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) {
                 $leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid);
                 $button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>";
             }
             $title = $group->title;
             $body = display("pages/group");
             break;
         case "edit":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $title = "Edit " . $group->title;
             $body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button));
 }
Пример #26
0
 private static function login_success_message()
 {
     if (!Auth::check()) {
         return false;
     }
     $username = Auth::user()->username;
     $project_name = Setting::get('project_name');
     return ['content' => "Welkom bij het {$project_name} logboek, {$username}!", 'class' => 'success'];
 }
Пример #27
0
 public function getUseLdap()
 {
     $useLdap = Setting::get('ldap');
     if (is_null($useLdap)) {
         return false;
     } else {
         return $useLdap['enable'];
     }
 }
 public function __construct()
 {
     $this->theme = Setting::get("theme");
     $this->settings = Plugin::getAllSettings("themer");
     // This allows us to check if we're being called in the front or the back.
     if (defined("CMS_BACKEND")) {
         $this->setLayout("backend");
         $this->assignToLayout("sidebar", new View("../../plugins/themer/views/sidebar"));
     }
 }
Пример #29
0
 public function actionReceive($id)
 {
     $enableNotif = Setting::get("notif.enable");
     if (!!$enableNotif) {
         $list = Yii::app()->nfy->receive($id);
         if (count($list) > 0) {
             echo json_encode($list) . "\n\n";
         }
     }
 }
Пример #30
0
 public function estimatePrice($opts = array())
 {
     extract($opts);
     $info = $this->info();
     if (!isset($material)) {
         $material = reset(json_decode($info['material']));
     }
     $price = $info['weight'] * (1 + Setting::get('wear_tear')) * Price::current($material) * ($material === 'PT950' ? Setting::get('weight_ratio') : 1) + Setting::get('labor_expense') + $info['small_stone'] * (Setting::get('st_expense') + Setting::get('st_price'));
     return round($price, 2);
 }