Esempio n. 1
0
 public function jcryption()
 {
     $path = Manager::getAppPath('conf');
     $pathPUB = $path . '/rsa_1024_pub.pem';
     $pathPVT = $path . '/rsa_1024_priv.pem';
     $jc = new jcryption($pathPUB, $pathPVT);
     $jc->go();
     header('Content-type: text/plain');
     print_r($_POST);
     die;
 }
Esempio n. 2
0
 public static function contextualize()
 {
     $context = self::$context = new MContext(Manager::$request);
     //$app = self::$app = Manager::$app = $context->getApp();
     self::$path = Manager::getAppPath();
     /*
             $fileAppStructure = Manager::getCachePath('app_' . $app . '.ser');
             if (is_file($fileAppStructure)) {
        $appStructure = unserialize(file_get_contents($fileAppStructure));
             } else {
        $appStructure = new MAppStructure($app, self::$path);
        if (Manager::getOptions('cacheStructure')) {
            file_put_contents($fileAppStructure, serialize($appStructure));
        }
             }
     * 
     */
     //$context->defineContext($appStructure);
     //self::$structure = $appStructure;
     self::$module = $context->getModule();
     //self::$pathModules = self::$path . '/modules';
     //$autoload = self::$path . '/vendor/autoload.php';
     //self::$loader = require $autoload;
 }
Esempio n. 3
0
    public function msyntax($control)
    {
        Manager::import('core::classes::extensions::geshi::geshi', 'GeSHi');
        $css = Manager::getAbsolutePath('core/classes/extensions/geshi/geshi.css');
        $this->page->addStyleSheet($css);
        $cssCustom = Manager::getAppPath('public/css/geshiCustom.css');
        if (file_exists($cssCustom)) {
            $this->page->addStyleSheet($cssCustom);
        }
        $source = $control->text;
        $language = $control->language;
        $geshi = new GeSHi($source, $language);
        $text = $geshi->parse_code();
        return <<<EOT
        {$text}
EOT;
    }
Esempio n. 4
0
 public function __construct($request)
 {
     $loader = Manager::$container->get('loader');
     $this->app = strtolower(Manager::getConf('maestro.app'));
     $this->appName = Manager::getConf('maestro.apps.' . $this->app);
     $this->appPath = Manager::getAppPath();
     $part1 = strtolower($request->getAttribute('part1'));
     if ($part1 != '') {
         if ($part1 == 'api' || $part1 == 'service') {
             $this->type = 'service';
             $this->handler = strtolower($request->getAttribute('part2'));
             $this->action = strtolower($request->getAttribute('part3'));
             $this->id = $request->getAttribute('part4');
         } elseif (Manager::getConf('maestro.modules.' . $part1) != '') {
             $this->type = 'module';
             $this->module = $part1;
         } else {
             $this->type = 'controller';
             $class = $this->appName . "\\Infrastructure\\Maestro\\Controllers\\" . $part1 . "Controller";
             if ($loader->findFile($class)) {
                 $this->handler = $part1;
                 $this->action = strtolower($request->getAttribute('part2')) ?: 'main';
                 $this->id = $request->getAttribute('part3');
             } else {
                 $this->section = $part1;
                 $this->handler = strtolower($request->getAttribute('part2'));
                 $this->action = strtolower($request->getAttribute('part3')) ?: 'main';
                 $this->id = $request->getAttribute('part4');
             }
         }
     }
     if ($this->type == 'module') {
         $part2 = strtolower($request->getAttribute('part2'));
         if ($part2 == 'api' || $part2 == 'service') {
             $this->type = 'service';
             $this->handler = strtolower($request->getAttribute('part3'));
             $this->action = strtolower($request->getAttribute('part4'));
             $this->id = $request->getAttribute('part5');
         } else {
             $this->type = 'controller';
             $class = $this->app . "\\" . $this->module . "\\Infrastructure\\Maestro\\Controllers\\" . $part2 . "Controller";
             if ($loader->findFile($class)) {
                 $this->handler = $part2;
                 $this->action = strtolower($request->getAttribute('part3')) ?: 'main';
                 $this->id = $request->getAttribute('part4');
             } else {
                 $this->section = $part2;
                 $this->handler = strtolower($request->getAttribute('part3'));
                 $this->action = strtolower($request->getAttribute('part4')) ?: 'main';
                 $this->id = $request->getAttribute('part5');
             }
         }
         $this->app = $this->module;
         $this->appPath .= DIRECTORY_SEPARATOR . Manager::getConf('maestro.modules.' . $this->module);
     }
     if ($this->id != '') {
         $_REQUEST['id'] = $this->id;
     }
     mtrace('Context app: ' . $this->app);
     mtrace('Context module: ' . $this->module);
     mtrace('Context section: ' . $this->section);
     mtrace('Context type: ' . $this->type);
     mtrace('Context handler: ' . $this->handler);
     mtrace('Context action: ' . $this->action);
     mtrace('Context id: ' . $this->id);
 }
Esempio n. 5
0
 private function getControlsFromInclude($node, &$controls, $handleChildren = false)
 {
     if ($node) {
         if ($this->ignoreElement($node)) {
             return NULL;
         }
         $attributes = $node->attributes();
         if ($attributes['file']) {
             $fileName = $attributes['file'];
             $file = $this->path . '/' . $this->processValue($fileName);
         } elseif ($attributes['component']) {
             $fileName = $attributes['component'];
             $file = Manager::getAppPath('components/' . $fileName);
         }
         $extension = pathinfo($file, PATHINFO_EXTENSION);
         if ($extension == 'xml') {
             $xmlControls = new MXMLControls();
             $xmlControls->loadFile($file, $this->context);
             foreach ($xmlControls->get() as $c) {
                 $controls->addControl($c);
             }
         } elseif ($extension == 'html') {
             $control = new MBaseControl('mhtml');
             $control->tag = 'div';
             $template = new \Maestro\UI\MTemplate(dirname($file));
             $template->multicontext(['page' => Manager::getPage(), 'data' => Manager::getData(), 'template' => $template, 'painter' => Manager::getPainter()]);
             $control->inner = $template->fetch($fileName);
             $controls->addControl($control);
         } elseif ($extension == 'php') {
             include_once $file;
             $fileName = end(explode('/', $fileName)) ?: $fileName;
             $className = str_replace('.' . $extension, '', $fileName);
             $c = new $className();
             $this->getPropertiesFromNode($c, $node);
             if ($handleChildren) {
                 $controls->addControl($c);
             } else {
                 $controls[] = $c;
             }
         }
     }
 }