Example #1
0
 private function loadConfig()
 {
     if (defined('DYNAMIC_CONFIG') && DYNAMIC_CONFIG == true) {
         $hConfig = CONFIG_DIR . '/' . strtolower($_SERVER['SERVER_NAME']) . "." . CORE_CONFIG_EXTENSION;
         if (file_exists($hConfig)) {
             $this->xmlObject = QXC()->Xml->Open($hConfig);
             return null;
         }
     }
     $cPath = CONFIG_DIR . '/' . strtolower($this->configName) . "." . CORE_CONFIG_EXTENSION;
     $this->xmlObject = QXC()->Xml->Open($cPath);
 }
Example #2
0
    public function Render()
    {
        // Begin output buffering
        ob_start();
        extract($this->varsArray, EXTR_SKIP);
        require_once $this->tplPath;
        $output = ob_get_clean();
        // Display toolbar
        if (DEBUG) {
            $output = preg_replace("/<\\/body>/", "{$this->Module->Toolbar->Render()}</body>", $output);
        }
        if (preg_match("/{[^}]+}/", $output) && count($this->varsArray) > 0) {
            $output = preg_replace(array_map(array($this, 'varsReplace'), array_keys($this->varsArray)), array_values($this->varsArray), $output);
            if (preg_match_all("/{%[\\s]?[\"\\']+([^\"\\']+)[\"\\']+}/", $output, $matches)) {
                foreach ($matches[1] as $val) {
                    // TODO: Remove relation with View
                    $output = preg_replace("/{%[\\s]?[\"\\']+([^\"\\']+)[\"\\']+}/", new QView($val, $this->varsArray), $output, 1);
                }
            }
            $output = preg_replace("/{\\s?\\\$[^}]+}/", "", $output);
        }
        // Display erros, validation etc.
        $errorsArray = QXC()->getGlobal(null, "ERRORS");
        $messagesArray = QXC()->getGlobal(null, "MESSAGES");
        if ((bool) $errorsArray || (bool) $messagesArray && stristr($output, "</body>")) {
            $data = "<link rel=\"stylesheet\" href=\"{$web_url}/qxc/handler/jquery.growl.css\" type=\"text/css\" />";
            $data .= "<script type=\"text/javascript\" src=\"{$web_url}/qxc/handler/jquery.growl.js\"></script>";
            $data .= <<<DATA
<script type="text/javascript">
\t\$(document).ready(function()
\t{
DATA;
            if ((bool) count($errorsArray)) {
                foreach ($errorsArray as $key => $val) {
                    $data .= " jQuery.noticeAdd({\n                                    text: '" . addslashes($val) . "',\n                                    stay: true\n                            }); ";
                    $data .= "\$('#{$key}').css('border', '1px solid red'); ";
                }
            }
            if ((bool) count($messagesArray)) {
                foreach ($messagesArray as $val) {
                    $data .= " jQuery.noticeAdd({\n                                    text: '" . addslashes($val) . "',\n                                    stay: true\n                            }); ";
                }
            }
            $data .= <<<DATA
\t});
</script>
DATA;
            $output = preg_replace("/<\\/body>/", "{$data}</body>", $output);
        }
        return $output;
    }
Example #3
0
 public function Captcha($type = '', $file = '')
 {
     switch ($type) {
         case 'image':
             QXC()->Captcha->Render();
             break;
         case 'audio':
             if ($file == "voice.swf") {
                 $this->basePath = CORE_DIR . "/system/captcha/resources";
                 $this->Handler("voice.swf");
             } else {
                 QXC()->Captcha->Play();
             }
             break;
         default:
             echo QXC()->Captcha->GetCode();
             break;
     }
 }
Example #4
0
 public function IsValid()
 {
     $errorsArray = QXC()->getGlobal(null, "ERRORS");
     if (is_array($errorsArray) && count($errorsArray) == 0) {
         return true;
     } else {
         return false;
     }
 }
Example #5
0
 function __construct()
 {
     $this->QXC = QXC();
 }
Example #6
0
        }
        $parts = preg_split("/\\//", $str, -1, PREG_SPLIT_NO_EMPTY);
        return array_map(create_function('$str', 'return (preg_match("/^[\\w\\-\\.]{1,50}$/", trim($str)))?$str:NULL;'), $parts);
    }
    private function loadModule()
    {
        include_once CORE_DIR . '/qxcore/module.php';
        return new QModule();
    }
    // Magic Methods
    protected function __get($name)
    {
        if (isset($name) && ctype_alnum($name)) {
            if (strtolower($name) == 'module') {
                return $this->{$name} = $this->loadModule();
            }
            $this->loadExtension($name);
            $qname = "Q{$name}";
            $this->{$name} = new $qname(self::$QXC);
            $this->{$name}->QXC = self::$QXC;
            $this->{$name}->PATH = CORE_DIR . '/system/' . strtolower($name);
            return $this->{$name};
        } else {
            // TODO Add exception handler
            return '';
        }
    }
}
// Start point
QXC()->Initialize();
Example #7
0
 /**
  * @return Model Returns Model
  */
 function files()
 {
     $var = QXC()->getGlobal($name, 'FILES');
     return $var;
 }
Example #8
0
 /**
  * Localization Function TODO Implement
  */
 function __($key)
 {
     $qxc = QXC();
     pr($qxc->Config->Get('language'), 1);
 }