Exemplo n.º 1
0
 /**
  * @dataProvider canBeEnabledProvider
  */
 public function testCanBeEnabled($boolean)
 {
     $contacts = $this->getMock('\\OCP\\Contacts\\IManager');
     $contacts->expects($this->any())->method('isEnabled')->will($this->returnValue($boolean));
     $backend = new Backend($contacts);
     $this->assertSame($boolean, $backend->canBeEnabled());
 }
Exemplo n.º 2
0
 public function __call($method, $args)
 {
     $id = md5($method . serialize($args) . serialize(get_object_vars($this->object)));
     if (($value = $this->backend->get($id)) === null) {
         $value = call_user_func_array(array($this->object, $method), $args);
         $this->backend->add($id, $value);
     }
     return $value;
 }
Exemplo n.º 3
0
 /**
  * @throws Docman_FolderNotCreatedException
  */
 private function createFolderWithRightAccessRights($folder_path, $project_unix_name)
 {
     if (!mkdir($folder_path)) {
         throw new Docman_FolderNotCreatedException("Folder {$folder_path} not created");
     }
     $user = ForgeConfig::get('sys_http_user');
     $this->backend->changeOwnerGroupMode($folder_path, $user, $user, 0700);
     $this->logger->info("Docman root folder for project {$project_unix_name} created");
 }
Exemplo n.º 4
0
 public function uploadImageItem()
 {
     if ($img = $this->images_model->checkImgUpload()) {
         $this->crud_model->update($this->input->post('type'), ['id' => $this->input->post('id'), 'image' => $img]);
         echo Backend::tplElement('images/item', ['item' => $this->crud_model->select($this->input->post('type'), ['id' => $this->input->post('id')], 'row'), 'table' => $this->input->post('type')]);
     }
 }
Exemplo n.º 5
0
 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_live_update');
     $objTemplate->updateClass = 'tl_confirm';
     $objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
     $objTemplate->isActive = $this->isActive();
     $strMessage = ' <a href="contao/changelog.php" onclick="Backend.openModalIframe({\'width\':860,\'title\':\'CHANGELOG\',\'url\':this.href});return false" title="' . specialchars($GLOBALS['TL_LANG']['tl_maintenance']['changelog']) . '"><img src="' . TL_FILES_URL . 'system/themes/' . \Backend::getTheme() . '/images/changelog.gif" width="14" height="14" alt="" style="vertical-align:text-bottom;padding-left:3px"></a>';
     // Newer version available
     if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
         $objTemplate->updateClass = 'tl_info';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion')) . $strMessage;
     } else {
         $objTemplate->updateClass = 'tl_confirm';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD) . $strMessage;
     }
     // Automatically switch to SSL
     if (\Environment::get('ssl')) {
         \Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
     }
     $objTemplate->uid = \Config::get('liveUpdateId');
     $objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
     // Run the update
     if (\Input::get('token') != '') {
         $this->runLiveUpdate($objTemplate);
     }
     $objTemplate->version = VERSION . '.' . BUILD;
     $objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
     $objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
     $objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
     $objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="http://luid.inetrobots.com" target="_blank">Live Update ID</a>');
     $objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
     $objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
     return $objTemplate->parse();
 }
Exemplo n.º 6
0
 public function init()
 {
     parent::init();
     parent::auth();
     $this->_db = Yii::app()->db;
     exit('暂不开启,后续待开发');
 }
Exemplo n.º 7
0
	/**
	 * Import String library
	 */
	public function __construct()
	{
		parent::__construct();

		$this->import('String');
		$this->import('Files');
	}
Exemplo n.º 8
0
 /**
  * Generate the metamodels renderer button.
  *
  * @param array  $row        Current row.
  * @param string $href       The button href.
  * @param string $label      The button label.
  * @param string $title      The button title.
  * @param string $icon       The button icon.
  * @param string $attributes Optional attributes.
  *
  * @return string
  */
 public function generateRendererButton($row, $href, $label, $title, $icon, $attributes)
 {
     if (empty($this->layers[$row['type']]['metamodels'])) {
         return '';
     }
     return sprintf('<a href="%s" title="%s">%s</a> ', \Backend::addToUrl($href . '&amp;id=' . $row['id']), $title, \Image::getHtml($icon, $label, $attributes));
 }
Exemplo n.º 9
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new Backend();
     }
     return self::$instance;
 }
Exemplo n.º 10
0
 public function html_list($document)
 {
     Backend::add('Sub Title', $document->getMeta('name'));
     Backend::add('TabLinks', $this->getTabLinks(Controller::$action));
     Backend::add('Object', $document);
     Backend::addContent(Render::renderFile('document_list.tpl.php'));
 }
 /** 
  * Process stored event
  */
 function process()
 {
     list($group_id, $user_id) = $this->getParametersAsArray();
     if ($project = $this->getProject($group_id)) {
         if ($user_id == 0) {
             return $this->setErrorBadParam();
         }
         // CVS writers
         if ($project->usesCVS()) {
             if (!Backend::instance('CVS')->updateCVSwriters($group_id)) {
                 $this->error("Could not update CVS writers for group {$group_id}");
                 return false;
             }
         }
         // SVN access file
         if ($project->usesSVN()) {
             if (!Backend::instance('SVN')->updateSVNAccess($group_id)) {
                 $this->error("Could not update SVN access file ({$group_id})");
                 return false;
             }
         }
         // Need to update system group cache
         Backend::instance('System')->setNeedRefreshGroupCache();
         $this->done();
         return true;
     }
     return false;
 }
Exemplo n.º 12
0
 public function html_tweet($result)
 {
     if ($result) {
         Backend::addSuccess('Tweeted!');
         Backend::addContent(var_export($result, true));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->import('BackendUser', 'User');
     $this->loadLanguageFile('tl_subscribe_plus');
     $this->loadDataContainer('tl_subscribe_plus');
 }
Exemplo n.º 14
0
 /**
  * Creates a pipeline for batching operations
  *
  * If the backend does not support pipelines, the
  * generic {@see Pipeline} implementation will be used.
  *
  * @return Pipeline
  */
 public function createPipeline()
 {
     if ($this->backend->supportsPipelines()) {
         return $this->backend->createPipeline();
     }
     return new Pipeline($this);
 }
Exemplo n.º 15
0
 public function __construct()
 {
     parent::__construct();
     $page_config = array('table' => $this->table_pages, 'field_id' => 'page_id', 'field_title' => 'page_title', 'field_slug' => 'page_slug');
     $this->load->library('slug');
     $this->slug->set_config($page_config);
 }
Exemplo n.º 16
0
 public function beforeroute()
 {
     $this->table = $this->fw->get('PARAMS.table');
     if (!\models\meta\Meta::getInstance()->exists($this->table)) {
         $this->fw->error(404);
     }
     $this->tableMeta = \models\meta\Meta::getInstance()->getTableMeta($this->table);
     //		Для типов контента, которые завияст от других, должен быть передан ID родительского объекта
     //		$this->meta_all = \models\ContentMeta::getMetaAll();
     //		$this->meta = $this->meta_all[$this->table];
     //		foreach ($this->meta_all as $meta) {
     //			if ($meta['depend'] == $this->table) {
     //				$this->dependants[] = $meta['type'];
     //			}
     //		}
     $class = $this->modelClass;
     $this->model = $class::getInstance($this->table);
     if ($this->tableMeta->isTree()) {
         $this->setPid();
     }
     if ($this->fw->get('use_app_routes')) {
         $this->fw->mset(array('ctrl_base' => $this->fw->get('app_backend_base.content'), 'core_ctrl_base' => $this->fw->get('app_backend_base.content_core')));
     } else {
         $this->fw->mset(array('ctrl_base' => $this->fw->get('backend_base.content'), 'core_ctrl_base' => $this->fw->get('backend_base.content_core')));
     }
     $this->fw->set('valid_items', $this->tableMeta->get('items'));
     parent::beforeroute();
     $this->setOwnerId();
 }
Exemplo n.º 17
0
 public function init()
 {
     parent::init();
     parent::auth();
     $this->_db = Yii::app()->db;
     $this->_bakupPath = $this->_webRoot . '/protected/data/dbbak/';
 }
 /**
  * Perform user creation on system
  * 
  * @param PFUser $user
  * 
  * @return Boolean
  */
 private function createUser(PFUser $user)
 {
     Backend::instance('Aliases')->setNeedUpdateMailAliases();
     $system_backend = Backend::instance('System');
     $system_backend->flushNscdAndFsCache();
     return $system_backend->createUserHome($user);
 }
 public function __construct()
 {
     parent::__construct();
     $this->loadLanguageFile("tl_settings");
     $this->import('BackendUser', 'User');
     $this->import('Environment');
 }
Exemplo n.º 20
0
 public function tearDown() {
     unlink($GLOBALS['alias_file']);
     unset($GLOBALS['alias_file']);
     //clear the cache between each tests
     Backend::clearInstances();
     EventManager::clearInstance();
 }
Exemplo n.º 21
0
 public function action_check()
 {
     $roles = GateKeeper::getRoles();
     if (!$roles || !count($roles)) {
         if (Controller::$debug) {
             Backend::addNotice('No roles setup, addings some');
         }
         $roles = $this->getDefaultRoles();
         if ($roles) {
             foreach ($roles as $role) {
                 GateKeeper::assign($role['role'], $role['access_type'], $role['access_id']);
                 if (Controller::$debug) {
                     Backend::addSuccess('Added role ' . $role['role']);
                 }
             }
         }
         $permits = $this->getDefaultPermissions();
         if ($permits) {
             foreach ($permits as $permit) {
                 GateKeeper::permit($permit['role'], $permit['control'], $permit['action'], $permit['subject'], $permit['subject_id']);
                 if (Controller::$debug) {
                     Backend::addSuccess('Added permission to ' . $role['action'] . ' to ' . $permit['role']);
                 }
             }
         }
     } else {
         if (Controller::$debug) {
             var_dump($roles);
         }
     }
 }
Exemplo n.º 22
0
 public function action_test()
 {
     /*$lock = BackendLock::get('testing', BackendLock::LOCK_CUSTOM);
     		if (!$lock) {
     			Backend::addError('Could not aquire lock');
     		} else {
     			Backend::addSuccess('Testing is ' . ($lock->check() ? 'Available' : 'Not Available'));
     		}
     		$lock = BackendLock::release('testing');
     		Backend::addSuccess('Testing is ' . ($lock->check() ? 'Available' : 'Not Available'));
     		if ($lock = BackendLock::get('testing_expiry', BackendLock::LOCK_CUSTOM, '2010-01-01')) {
     			Backend::addSuccess('Testing Expiry is ' . ($lock->check() ? 'Available' : 'Not Available'));
     		}
     		if ($lock = BackendLock::get('testing_type', 5)) {
     			Backend::addSuccess('Testing Type is ' . ($lock->check() ? 'Available' : 'Not Available'));
     		}*/
     if ($lock = BackendLock::get('testing_system', BackendLock::LOCK_SYSTEM)) {
         Backend::addSuccess('Testing Type is ' . ($lock->check() ? 'Available' : 'Not Available'));
     } else {
         Backend::addSuccess('Should not get System lock (no expiry or password)');
     }
     if ($lock = BackendLock::get('testing_system', BackendLock::LOCK_SYSTEM, 'now + 1 minutes', 'Abc123')) {
         Backend::addSuccess('Testing Type is ' . ($lock->check() ? 'Available' : 'Not Available'));
     } else {
         Backend::addError('Could not get System lock');
     }
     return false;
 }
Exemplo n.º 23
0
 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_login');
     // Show a cookie warning
     if (Input::get('referer', true) != '' && empty($_COOKIE)) {
         $this->Template->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
     }
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], Config::get('websiteTitle'));
     $this->Template->theme = Backend::getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->languages = System::getLanguages(true);
     $this->Template->title = specialchars($strHeadline);
     $this->Template->charset = Config::get('characterSet');
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $this->Template->headline = $strHeadline;
     $this->Template->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $this->Template->curUsername = Input::post('username') ?: '';
     $this->Template->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $this->Template->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $this->Template->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $this->Template->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $this->Template->frontendFile = Environment::get('base');
     $this->Template->disableCron = Config::get('disableCron');
     $this->Template->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
     $this->Template->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $this->Template->output();
 }
Exemplo n.º 24
0
 protected function tearDown()
 {
     foreach ($this->groups as $group) {
         $this->backend->deleteGroup($group);
     }
     parent::tearDown();
 }
 /**
  * Import the back end user object
  */
 public function __construct()
 {
     parent::__construct();
     $this->import('BackendUser', 'User');
     $this->loadLanguageFile('orm_avisota_recipient');
     $this->loadDataContainer('orm_avisota_recipient');
 }
Exemplo n.º 26
0
 public function editTemplate($v)
 {
     if (isset(Pages_model::$types[$v])) {
         $this->admin['type'] = ['type' => $v, 'value' => Pages_model::$types[$v]];
         Backend::tpl('templates/templateedit');
     }
 }
Exemplo n.º 27
0
Arquivo: file.php Projeto: rikaix/core
 /**
  * Initialize the controller
  *
  * 1. Import the user
  * 2. Call the parent constructor
  * 3. Authenticate the user
  * 4. Load the language files
  * DO NOT CHANGE THIS ORDER!
  */
 public function __construct()
 {
     $this->import('BackendUser', 'User');
     parent::__construct();
     $this->User->authenticate();
     $this->loadLanguageFile('default');
 }
Exemplo n.º 28
0
 public static function enable()
 {
     Backend::addScript(SITE_LINK . '/js/jquery.js');
     Backend::addScript(SITE_LINK . '/js/wmd.component.js');
     Backend::addScript(SITE_LINK . '/js/wmd/wmd.js');
     Backend::addStyle(SITE_LINK . '/css/wmd.css');
 }
 public function __construct()
 {
     $this->import('BackendUser', 'User');
     parent::__construct();
     $this->import('AvisotaBase', 'Base');
     $this->import('AvisotaNewsletterContent', 'Content');
     $this->import('AvisotaStatic', 'Static');
     $this->import('Database');
     // force all URLs absolute
     $GLOBALS['TL_CONFIG']['forceAbsoluteDomainLink'] = true;
     // load default translations
     $this->loadLanguageFile('default');
     // HOTFIX Remove isotope frontend hook
     if (isset($GLOBALS['TL_HOOKS']['parseTemplate']) && is_array($GLOBALS['TL_HOOKS']['parseTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['parseTemplate'] as $k => $v) {
             if ($v[0] == 'IsotopeFrontend') {
                 unset($GLOBALS['TL_HOOKS']['parseTemplate'][$k]);
             }
         }
     }
     // HOTFIX Remove catalog frontend hook
     if (isset($GLOBALS['TL_HOOKS']['parseFrontendTemplate']) && is_array($GLOBALS['TL_HOOKS']['parseFrontendTemplate'])) {
         foreach ($GLOBALS['TL_HOOKS']['parseFrontendTemplate'] as $k => $v) {
             if ($v[0] == 'CatalogExt') {
                 unset($GLOBALS['TL_HOOKS']['parseFrontendTemplate'][$k]);
             }
         }
     }
 }
Exemplo n.º 30
0
 public function init()
 {
     //栏目
     parent::init();
     $this->_catalog = Catalog::model()->findAll();
     $this->_model_type = ModelType::model()->findAll();
 }