public function getAllowedFileExtensions() { $u = new User(); $extensions = array(); if ($u->isSuperUser()) { $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions(); return $extensions; } $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return array(); } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(FileSetPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); foreach ($list as $l) { if ($l->getFileTypesAllowedPermission() == 'N') { $extensions = array(); } if ($l->getFileTypesAllowedPermission() == 'C') { $extensions = array_unique(array_merge($extensions, $l->getFileTypesAllowedArray())); } if ($l->getFileTypesAllowedPermission() == 'A') { $extensions = Loader::helper('concrete/file')->getAllowedFileExtensions(); } } return $extensions; }
function __construct($value = '', $name = null) { $load = new Loader(); $this->date_picker = $load->customFormComponent('/widgets/datepicker'); $this->dropdown = Loader::formComponent('dropdown'); parent::__construct('hidden', $value, $name); }
/** * @return mixed */ public function getData() { if (!$this->dataLoaded) { $this->data = (array) $this->loader->load($this->path); $this->dataLoaded = TRUE; } return $this->data; }
/** * assign the loaded class in the application to the $this var * */ public function __construct() { $good = new Loader(); $this->load = $good->view("welcome/index.php"); print_r($this->load); // print_r($this->load->view()); // log_message("debug","Controller class has been initialized"); }
/** * @param string $dir * @param bool $append */ public function loadFixturesFromDir($dir, $append = true) { if (!$append) { $this->purger->purge(); } $this->loader->loadFromDirectory($dir); $this->executor->execute($this->loader->getFixtures()); }
/** * * @param type $vista * @param type $parametros */ public function renderizarPagina($vista, $parametros) { $path = TEMPLATEURI . TEMPLATE . '/Loader.php'; if (file_exists($path)) { include $path; $loader = new Loader(); $loader->cargarContenido($vista, $parametros); $loader->rederizarPagina(); // return true; } else { // return false; } }
/** * @param string $path * @param string $file * @return \WCM\WPStarter\Env\Env|static */ public static function load($path, $file = '.env') { if (is_null(self::$loaded)) { self::wpConstants(); if (!is_string($file)) { $file = '.env'; } $filePath = rtrim(str_replace('\\', '/', $path), '/') . '/' . $file; $loader = new Loader($filePath, true); $loader->load(); self::$loaded = new static($loader->allVarNames()); } return self::$loaded; }
/** * @param string $path * @param string $file * @return \WCM\WPStarter\Env\Env|static */ public static function load($path, $file = '.env') { if (is_null(self::$loaded)) { self::wpConstants(); if (!is_string($file)) { $file = '.env'; } $filePath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file; $loader = new Loader($filePath, true); $loader->load(); self::$loaded = new static($loader->allVarNames()); } return self::$loaded; }
public static function handleLogin($urlValues) { Session::init(); // if user is still not logged in, then destroy session and handle user as "not logged in" if (!isset($_SESSION['user_logged_in']) || $_SESSION['site'] != SITE) { Session::destroy(); // route user to login page //header('location: ' . URL . 'login'); $loader = new Loader(array('controller' => 'login', 'action' => 'index', 'path' => $urlValues)); $controller = $loader->createController(); $controller->executeAction(); break; } }
/** * Each time a page will be load, this method will be called each time * * TODO : How are we supposed to provide the request string like so if it is a singleton? * Maxime Martineau * * @method parseRequest * @access public * @param string $request URL of the requested page * @return void * @author Quentin LOZACH * @version 0.1 */ public function parseRequest($request = FALSE) { // Load the Loader class include BASE_PATH . '/core/loader/loader.php'; // Instanciation of the loader which will load every file on the project $loader = new Loader(); // Are we on the index page or note ? switch ($request) { // We are on the index page case FALSE: // Load the mainController, the index method, mainView $this->controller = "mainController"; $this->method = "index"; $this->params = NULL; $loader->loadController($this->controller); break; // We are on another page so load the Controller and the model with the same name // We are on another page so load the Controller and the model with the same name default: // Load the mainController, mainView and mainModel $requestExploded = explode("/", $request); // If the user is trying to load a file directly in the URL such as : .php, .html, .css, .js, .sql ... $requestSecured = explode(".", $request); // If there is only a controller with no method, raise an error with error() method if (empty($requestExploded[1]) && !empty($requestExploded[0])) { $this->error("empty-method"); } else { // If requestSecured[1] is not empty the user tried to load a file in the URL if (isset($requestSecured[1])) { // The controller is the name of the 1st param but cleaned with the explode $this->controller = $requestSecured[0]; } else { // The controller is the first parameter of the URL $this->controller = $requestExploded[0]; } // The method is the second parameter of the URL $this->method = $requestExploded[1]; } // Getting parameters, so let's keep only useful informations unset($requestExploded[0]); unset($requestExploded[1]); // Getting the rest of the parameters in the $_GET['request'] in the URL if (!empty($requestExploded[2])) { $this->params = $requestExploded; } else { $this->params = NULL; } } }
public function __construct() { parent::__construct(); $html = Loader::helper('html'); $this->set('av', Loader::helper('concrete/avatar')); $this->addHeaderItem($html->javascript('swfobject.js')); }
/** * Rendering method * * @param string $layout file name * @param mixed $data * * @return Response */ public function render($layout, $data = array()) { $fullpath = realpath(\Loader::get_path_views() . $layout . '.php'); $renderer = new Renderer(realpath(Service::get('config')->get('main_layout'))); $content = $renderer->render($fullpath, $data); return new Response($content); }
public function view($page = 0) { $this->set('title', t('Logs')); $pageBase = View::url('/dashboard/reports/logs', 'view'); $paginator = Loader::helper('pagination'); $total = Log::getTotal($_REQUEST['keywords'], $_REQUEST['logType']); $paginator->init(intval($page), $total, $pageBase . '/%pageNum%/?keywords=' . $_REQUEST['keywords'] . '&logType=' . $_REQUEST['logType'], 10); $limit = $paginator->getLIMIT(); $types = Log::getTypeList(); $txt = Loader::helper('text'); $logTypes = array(); $logTypes[''] = '** ' . t('All'); foreach ($types as $t) { if ($t == '') { $logTypes[''] = '** ' . t('All'); } else { $logTypes[$t] = $txt->unhandle($t); } } $entries = Log::getList($_REQUEST['keywords'], $_REQUEST['logType'], $limit); $this->set('keywords', $keywords); $this->set('pageBase', $pageBase); $this->set('entries', $entries); $this->set('paginator', $paginator); $this->set('logTypes', $logTypes); }
public function __construct() { // Loader initialiseren $this->_loader = Loader::getInstance(); // input class initialiseren $this->_input = new Input(); }
public function __construct() { parent::__construct(); $this->db = Loader::model('admin_login_log_model'); $this->admin_username = cookie('admin_username'); // 管理员COOKIE }
public function authControl() { $config = Config::getInstance(); Loader::definePathConstants(); $this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/facebook/view/facebook.account.index.tpl'); $this->view_mgr->addHelp('facebook', 'userguide/settings/plugins/facebook'); /** set option fields **/ // Application ID text field $this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'facebook_app_id', 'label' => 'App ID', 'size' => 18)); // add element // set a special required message $this->addPluginOptionRequiredMessage('facebook_app_id', 'The Facebook plugin requires a valid App ID.'); // Application Secret text field $this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'facebook_api_secret', 'label' => 'App Secret', 'size' => 37)); // add element // set a special required message $this->addPluginOptionRequiredMessage('facebook_api_secret', 'The Facebook plugin requires a valid App Secret.'); $max_crawl_time_label = 'Max crawl time in minutes'; $max_crawl_time = array('name' => 'max_crawl_time', 'label' => $max_crawl_time_label, 'default_value' => '20', 'advanced' => true, 'size' => 3); $this->addPluginOption(self::FORM_TEXT_ELEMENT, $max_crawl_time); $this->addToView('thinkup_site_url', Utils::getApplicationURL()); $facebook_plugin = new FacebookPlugin(); if ($facebook_plugin->isConfigured()) { $this->setUpFacebookInteractions($facebook_plugin->getOptionsHash()); $this->addToView('is_configured', true); } else { $this->addInfoMessage('Please complete plugin setup to start using it.', 'setup'); $this->addToView('is_configured', false); } return $this->generateView(); }
public function install() { $pkg = parent::install(); Loader::model('single_page'); $main = SinglePage::add('/dashboard/multisite', $pkg); $mainSites = SinglePage::add('/dashboard/multisite/sites', $pkg); }
public function update_library() { if (Loader::helper("validation/token")->validate('update_library')) { if ($this->post('activeLibrary')) { $scl = SystemAntispamLibrary::getByHandle($this->post('activeLibrary')); if (is_object($scl)) { $scl->activate(); Config::save('ANTISPAM_NOTIFY_EMAIL', $this->post('ANTISPAM_NOTIFY_EMAIL')); Config::save('ANTISPAM_LOG_SPAM', $this->post('ANTISPAM_LOG_SPAM')); if ($scl->hasOptionsForm() && $this->post('ccm-submit-submit')) { $controller = $scl->getController(); $controller->saveOptions($this->post()); } $this->redirect('/dashboard/system/permissions/antispam', 'saved'); } else { $this->error->add(t('Invalid anti-spam library.')); } } else { SystemAntispamLibrary::deactivateAll(); } } else { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } $this->view(); }
public function save($args) { $db = Loader::db(); parent::save(); $db->Execute('delete from AreaPermissionBlockTypeAccessList where paID = ?', array($this->getPermissionAccessID())); $db->Execute('delete from AreaPermissionBlockTypeAccessListCustom where paID = ?', array($this->getPermissionAccessID())); if (is_array($args['blockTypesIncluded'])) { foreach ($args['blockTypesIncluded'] as $peID => $permission) { $v = array($this->getPermissionAccessID(), $peID, $permission); $db->Execute('insert into AreaPermissionBlockTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v); } } if (is_array($args['blockTypesExcluded'])) { foreach ($args['blockTypesExcluded'] as $peID => $permission) { $v = array($this->getPermissionAccessID(), $peID, $permission); $db->Execute('insert into AreaPermissionBlockTypeAccessList (paID, peID, permission) values (?, ?, ?)', $v); } } if (is_array($args['btIDInclude'])) { foreach ($args['btIDInclude'] as $peID => $btIDs) { foreach ($btIDs as $btID) { $v = array($this->getPermissionAccessID(), $peID, $btID); $db->Execute('insert into AreaPermissionBlockTypeAccessListCustom (paID, peID, btID) values (?, ?, ?)', $v); } } } if (is_array($args['btIDExclude'])) { foreach ($args['btIDExclude'] as $peID => $btIDs) { foreach ($btIDs as $btID) { $v = array($this->getPermissionAccessID(), $peID, $btID); $db->Execute('insert into AreaPermissionBlockTypeAccessListCustom (paID, peID, btID) values (?, ?, ?)', $v); } } } }
public function run() { $tables_for_optimization = array(); $count = 0; $db = Loader::db(); $v = array(); $q = "SHOW TABLE STATUS"; $rs = $db->query($q, $v); foreach ($rs as $table) { if ($table["Data_free"] > 0) { $tables_for_optimization[] = $table["Name"]; } } unset($rs); foreach ($tables_for_optimization as $table) { $db->execute("OPTIMIZE TABLE " . $table); $count++; } $return_message = t("The Job was run successfully."); if ($count > 0) { return $return_message . " " . t("Optimized %s tables.", $count); } else { return $return_message . " " . t("There were no tables to optimize."); } }
/** * Private Constructor * @param array $vals Optional values to override file config * @return Config */ private function __construct($vals = null) { if ($vals != null) { $this->config = $vals; } else { Loader::definePathConstants(); if (file_exists(EFC_WEBAPP_PATH . 'config.inc.php')) { require EFC_WEBAPP_PATH . 'config.inc.php'; $this->config = $EFC_CFG; //set version info... /* require EFC_WEBAPP_PATH . 'install/version.php'; $this->config['EFC_VERSION'] = $EFC_VERSION; $this->config['EFC_VERSION_REQUIRED'] = array('php' => $EFC_VERSION_REQUIRED['php'], 'mysql' => $EFC_VERSION_REQUIRED['mysql']); */ } else { throw new ConfigurationException("EFC's configuration file does not exist! " . "Try installing EFC."); } } foreach (array_keys(self::$defaults) as $default) { if (!isset($this->config[$default])) { $this->config[$default] = self::$defaults[$default]; } } }
public function run() { Cache::disableCache(); Loader::library('database_indexed_search'); $is = new IndexedSearch(); if ($_GET['force'] == 1) { Loader::model('attribute/categories/collection'); Loader::model('attribute/categories/file'); Loader::model('attribute/categories/user'); $attributes = CollectionAttributeKey::getList(); $attributes = array_merge($attributes, FileAttributeKey::getList()); $attributes = array_merge($attributes, UserAttributeKey::getList()); foreach($attributes as $ak) { $ak->updateSearchIndex(); } $result = $is->reindexAll(true); } else { $result = $is->reindexAll(); } if ($result->count == 0) { return t('Indexing complete. Index is up to date'); } else { if ($result->count == $is->searchBatchSize) { return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count); } else { return t('Index updated. %s %s required reindexing.', $result->count, $result->count == 1 ? t('page') : t('pages')); } } }
public function run_import_item() { Loader::model($_REQUEST['importType'], 'problog_importer'); $location = $_REQUEST['importLocation']; $ctID = $_REQUEST['selectedPageType']; $path = DIR_BASE . File::getRelativePathFromID($_REQUEST['importXml']); $xmlObject = simplexml_load_file($path, 'SimpleXMLElement'); $i = $_REQUEST['i']; foreach ($xmlObject->channel->item as $item_object) { $t++; if ($t == $i) { $method = ucfirst($_REQUEST['importType']) . 'Item'; $item = new $method($item_object); //var_dump($item);exit; $page = new CreateBlogPost($item, $location, $ctID); //print json_encode($child); if ($page) { print json_encode(array('success' => 1)); } else { print json_encode(array('error' => t('There was a problem with your import.'))); } } } exit; }
/** * @return Server * @throws \Initially\Rpc\Exception\InitiallyRpcException */ public static function getServer() { if (!isset(self::$server)) { self::$server = Loader::server(); } return self::$server; }
public function view($nodeID = 1, $auxMessage = false) { $dh = Loader::helper('concrete/dashboard/sitemap'); if ($dh->canRead()) { $this->set('nodeID', $nodeID); $nodes = $dh->getSubNodes($nodeID, 1, false, false); $instanceID = time(); $this->set('listHTML', $dh->outputRequestHTML($instanceID, 'explore', false, $nodes)); $this->set('instanceID', $instanceID); } if (isset($_REQUEST['task']) && isset($_REQUEST['cNodeID'])) { $nc = Page::getByID($_REQUEST['cNodeID']); if ($_REQUEST['task'] == 'send_to_top') { $nc->movePageDisplayOrderToTop(); } else { if ($_REQUEST['task'] == 'send_to_bottom') { $nc->movePageDisplayOrderToBottom(); } } $this->redirect('/dashboard/sitemap/explore', $nc->getCollectionParentID(), 'order_updated'); } if ($auxMessage != false) { switch ($auxMessage) { case 'order_updated': $this->set('message', t('Sort order saved')); break; } } $this->set('dh', $dh); }
public function __construct() { $this->contentid = isset($_GET['contentid']) && trim(urldecode($_GET['contentid'])) ? trim(urldecode($_GET['contentid'])) : $this->_show_msg(L('illegal_parameters')); $this->contentid = safe_replace($this->contentid); $this->db = Loader::model('digg_model'); $this->db_log = Loader::model('digg_log_model'); }
public function buttons() { $ih = Loader::helper('concrete/interface'); $btnStr = $ih->submit('Save', null, 'right', 'primary'); $btnStr .= $ih->button_js('Cancel', 'history.back()', 'left'); return $btnStr; }
public static function getInstance() { if (empty(self::$instance)) { self::$instance = new self(); } return self::$instance; }
private function _format($id, $data, $type) { switch ($type) { case '1': // json if (CHARSET == 'gbk') { $data = array_iconv($data, 'gbk', 'utf-8'); } return json_encode($data); break; case '2': // xml $xml = Loader::lib('Xml'); return $xml->xml_serialize($data); break; case '3': // js Loader::func('dbsource:global'); ob_start(); include template_url($id); $html = ob_get_contents(); ob_clean(); return format_js($html); break; } }
public function delete($delGroupId, $token = ''){ $u=new User(); try { if(!$u->isSuperUser()) { throw new Exception(t('You do not have permission to perform this action.')); } $group = Group::getByID($delGroupId); if(!($group instanceof Group)) { throw new Exception(t('Invalid group ID.')); } $valt = Loader::helper('validation/token'); if (!$valt->validate('delete_group_' . $delGroupId, $token)) { throw new Exception($valt->getErrorMessage()); } $group->delete(); $resultMsg=t('Group deleted successfully.'); $_REQUEST=array(); $_GET=array(); $_POST=array(); $this->set('message', $resultMsg); $this->view(); } catch(Exception $e) { $this->set('error', $e); } }