public function generateIndex()
 {
     $logger = FrameworkLoggerFactory::getLogger($this);
     $responseCode = 200;
     $responseStr = null;
     if ($this->cmsController->getHttpRequest()->getVar('token') !== $this->cmsController->getCmsSettings()->security_token) {
         throw new HttpException('Access denied! No or wrong security token submitted.', 403);
     }
     ob_start();
     try {
         echo "Load mod_search settings...\n";
         $searchSettingsPath = $this->cmsController->getCore()->getSiteRoot() . 'settings' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'mod_search.config.json';
         $searchSettings = JsonUtils::decodeFile($searchSettingsPath);
         $indexesBasePath = $this->cmsController->getCore()->getSiteRoot() . 'index' . DIRECTORY_SEPARATOR;
         $indexer = new Indexer($this->cmsController->getDB(), $this->cmsController->getCore(), $indexesBasePath);
         $indexer->start($searchSettings);
         unset($indexer);
         $responseStr = ob_get_clean();
     } catch (\Exception $e) {
         $logger->error('Could not create index: ', $e);
         $responseCode = 500;
         $responseStr = 'Could not create index: ' . $e->getMessage();
     }
     return new HttpResponse($responseCode, $responseStr, array('Content-Type' => 'text/plain; charset=utf-8'));
 }
 public function __construct($savePath)
 {
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     $this->savePath = $savePath;
     $this->cachedXML = null;
     $this->transactionName = null;
 }
Example #3
0
 public function __construct(DB $db, $savePath)
 {
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     $this->db = $db;
     $this->savePath = $savePath;
     $this->fileCategories = array('image' => array('types' => array('image/jpeg', 'image/jpx', 'image/jp2', 'image/jpm', 'image/ief', 'image/png', 'image/gif', 'image/png', 'image/svg+xml', 'image/tiff', 'image/tiff-x', 'image/vnd.adobe.photoshop', 'image/x-icon'), 'send' => 0), 'audio' => array('types' => array('audio/ac3', 'audio/basic', 'audio/mid', 'audio/ogg', 'audio/mpeg', 'audio/x-aiff', 'audio/x-mpegurl', 'audio/x-aiff', 'audio/wav', 'audio/x-wav'), 'send' => 1), 'video' => array('types' => array('application/annodex', 'application/mp4', 'application/ogg', 'application/vnd.rn-realmedia', 'application/x-matroska', 'video/3gpp', 'video/3gpp2', 'video/annodex', 'video/divx', 'video/flv', 'video/h264', 'video/mp4', 'video/mp4v-es', 'video/mpeg', 'video/mpeg-2', 'video/mpeg4', 'video/ogg', 'video/ogm', 'video/quicktime', 'video/ty', 'video/vdo', 'video/vivo', 'video/vnd.rn-realvideo', 'video/vnd.vivo', 'video/webm', 'video/x-bin', 'video/x-cdg', 'video/x-divx', 'video/x-dv', 'video/x-flv', 'video/x-la-asf', 'video/x-m4v', 'video/x-matroska', 'video/x-motion-jpeg', 'video/x-ms-asf', 'video/x-ms-dvr', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-msvideo', 'video/x-sgi-movie', 'video/x-tivo', 'video/avi', 'video/x-ms-asx', 'video/x-ms-wvx', 'video/x-ms-wmx'), 'send' => 1), 'doc' => array('types' => array('application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/pdf', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-master', 'application/vnd.oasis.opendocument.spreadsheet'), 'send' => 1));
 }
Example #4
0
 public function __construct(Core $core, HttpRequest $httpRequest, Route $route)
 {
     parent::__construct($core, $httpRequest, $route);
     $this->pageModel = new PageModel($this->db);
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     $this->markHtmlIdAsActive('pages');
     $cacheDir = $this->core->getSiteCacheDir() . 'templates' . DIRECTORY_SEPARATOR;
     $templateBaseDir = $this->core->getSiteRoot() . 'templates' . DIRECTORY_SEPARATOR;
     $tplCache = new DirectoryTemplateCache($cacheDir, $templateBaseDir);
     $this->moduleView = new CmsView(new CmsTemplateEngine($tplCache, 'tst'), $templateBaseDir . $this->currentDomain->template . DIRECTORY_SEPARATOR . 'elements' . DIRECTORY_SEPARATOR);
 }
Example #5
0
 /**
  * @param string $method
  * @param array $sentVar
  *
  * @deprecated Use FormHandler (metanet/form-handler) instead
  */
 public function __construct($method, $sentVar = array(self::METHOD_GET, 'send'))
 {
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     $this->rsc = $method === self::METHOD_POST ? $_POST : $_GET;
     $this->errors = null;
     $this->fields = array();
     $this->totalFields = 0;
     $this->totalRequired = 0;
     //$this->name = ($name === null) ? implode("-", $this->requestHandler->getLinkVars()) : $name;
     $this->sentVar = $sentVar;
 }
 /**
  * @param Core $core The framework core instance
  * @param HttpRequest $httpRequest Frameworks HTTP request object
  * @param Route $route Frameworks route object
  */
 public function __construct(Core $core, HttpRequest $httpRequest, Route $route)
 {
     parent::__construct($core, $httpRequest, $route);
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     if ($this->auth->isLoggedIn() && $this->httpRequest->getProtocol() !== HttpRequest::PROTOCOL_HTTPS) {
         RequestHandler::redirect($this->httpRequest->getURL(HttpRequest::PROTOCOL_HTTPS));
     }
     $cacheDir = $this->core->getSiteCacheDir() . 'templates' . DIRECTORY_SEPARATOR;
     $templateBaseDir = $this->core->getSiteRoot() . 'templates' . DIRECTORY_SEPARATOR;
     $tplCache = new DirectoryTemplateCache($cacheDir, $templateBaseDir);
     $this->templateEngine = new CmsTemplateEngine($tplCache, 'tst');
     $this->cmsView = new CmsView($this->templateEngine, $templateBaseDir . $this->currentDomain->template . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR);
 }
 public function __construct(Core $core, HttpRequest $httpRequest, Route $route)
 {
     parent::__construct($core, $httpRequest, $route);
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     $this->markHtmlIdAsActive('elements');
 }
Example #8
0
 public function __construct(DB $db)
 {
     parent::__construct($db);
     $this->logger = FrameworkLoggerFactory::getLogger($this);
     $this->stmntMod = $this->db->prepare("\n\t\t\tSELECT mi.ID, mi.page_IDFK, ma.class, ma.name, ma.ID modID, parent_mod_IDFK, IF(ih.element_instance_IDFK IS NULL, 0, 1) hidden\n\t\t\tFROM cms_element_instance mi\n\t\t\tLEFT JOIN cms_element_available ma ON ma.ID = mi.mod_IDFK\n\t\t\tLEFT JOIN cms_element_instance_hidden ih ON ih.element_instance_IDFK = mi.ID AND ih.page_IDFK = ?\n\t\t\tWHERE mi.ID = ?\n\t\t");
 }
date_default_timezone_set('Europe/Berlin');
/*$_SERVER['SERVER_NAME'] = 'metanet.ch.metdev.ch';
$_SERVER['SERVER_PORT'] = 80;
$_SERVER['QUERY_STRING'] = null;
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';*/
// Framework specific constants
//define('REQUEST_TIME', $_SERVER['REQUEST_TIME']+microtime());
define('FW_DIR', DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'tsFramework' . DIRECTORY_SEPARATOR . 'tsfw_src' . DIRECTORY_SEPARATOR);
define('MODULES_DIR', 'modules' . DIRECTORY_SEPARATOR);
// Site specific constants
define('SITE_ROOT', dirname(__FILE__) . '/../../../../../..' . DIRECTORY_SEPARATOR);
define('CACHE_DIR', SITE_ROOT . 'cache' . DIRECTORY_SEPARATOR);
define('SETTINGS_DIR', SITE_ROOT . 'settings' . DIRECTORY_SEPARATOR);
// Initialize Autoloader
require_once FW_DIR . 'ch/timesplinter/autoloader/Autoloader.class.php';
require_once FW_DIR . 'ch/timesplinter/core/FrameworkAutoloader.class.php';
$autoLoader = new FrameworkAutoloader(CACHE_DIR . 'cache.autoload');
$autoLoader->addPath('fw-logic', array('path' => FW_DIR, 'mode' => Autoloader::MODE_NAMESPACE, 'class_suffix' => array('.class.php', '.interface.php')));
$autoLoader->register();
$settings = new \ch\timesplinter\core\Settings(SETTINGS_DIR);
$autoLoader->addPathsFromSettings($settings->autoloader);
\ch\timesplinter\core\FrameworkLoggerFactory::setEnvironment($env);
if (!isset($settings->db->{$env})) {
    die('No database connection for environment: ' . $env . "\n");
}
$dbSettings = $settings->db->{$env};
$db = \ch\timesplinter\db\DBFactory::getNewInstance($dbSettings->type, new \ch\timesplinter\db\DBConnect($dbSettings->host, $dbSettings->database, $dbSettings->user, $dbSettings->password));
$indexer = new \ch\metanet\cms\module\mod_search\common\Indexer($db);
$indexer->start();
/* EOF */
 public function __construct($ID, $pageID)
 {
     parent::__construct($ID, $pageID, 'element_column_layout');
     $this->logger = FrameworkLoggerFactory::getLogger($this);
 }