Exemplo n.º 1
0
 public function qooljsAction()
 {
     $config = $this->config;
     $dirs = $this->dirs;
     $html = '';
     header('Content-Type: text/javascript');
     ob_start("ob_gzhandler");
     $xml = readLangFile($dirs['structure']['templates'] . DIR_SEP . 'frontend' . DIR_SEP . $config->template->frontend->title . DIR_SEP . "template.xml");
     foreach ($xml->js->file as $k => $v) {
         $v = $this->jsonArray($v);
         $file = file($dirs['structure']['templates'] . DIR_SEP . 'frontend' . DIR_SEP . $config->template->frontend->title . DIR_SEP . $v[0]);
         $html .= implode('', $file);
     }
     echo $html;
     die;
 }
Exemplo n.º 2
0
function keepTranslationStrings($str, $dirs)
{
    $xml = readLangFile($dirs['structure']['languages'] . DIR_SEP . "autotranslate.xml");
    $lang = Zend_Registry::get('currentlang');
    //check if the value already exists...
    foreach ($xml->translate as $k => $v) {
        $v = json_encode($v);
        $v = json_decode($v, 1);
        if ($v['@attributes']['value'] == $str) {
            return;
        }
    }
    $node = $xml->addChild('translate');
    $node->addAttribute('value', $str);
    $node->addAttribute('lang', $lang);
    $xml->asXML($dirs['structure']['languages'] . DIR_SEP . "autotranslate.xml");
}
Exemplo n.º 3
0
 function loadModules()
 {
     //load the modules installed...
     $config = $this->config;
     $dirs = $this->dirs;
     $modules = $this->modules;
     $modsettings = array();
     $addons = readLangFile(APPL_PATH . 'config' . DIR_SEP . "addons.xml");
     foreach ($modules as $k => $v) {
         //if the path exists then this is a standalone module and we need to do the default action
         if (!file_exists(APPL_PATH . DIR_SEP . $v . DIR_SEP . "addon.xml")) {
             //else this is an addon module and we need to treat it as one
             //we also need the parent addon settings.
             $this->loadAddonSettings($v);
             include_once APPL_PATH . $dirs['structure']['addons'] . DIR_SEP . $v . DIR_SEP . $k . ".php";
             $class = $k . '_Module';
             new $class($this, $this->addonSettings);
         } else {
             //read the xml and get the settings
             $xml = readLangFile(APPL_PATH . $v . DIR_SEP . "addon.xml");
             foreach ($addons->modules->addon as $ko => $vo) {
                 $vo = $this->jsonArray($vo);
                 if ($vo['@attributes']['name'] == $xml->id) {
                     $level = $vo['@attributes']['level'];
                 }
             }
             if ($_SESSION['user']['level'] && $_SESSION['user']['level'] <= $level) {
                 $settings = array();
                 foreach ($xml->settings->item as $a) {
                     $a = $this->jsonArray($a);
                     $settings[$a['@attributes']['id']] = $a['default_value'];
                 }
                 $modsettings = $settings;
                 $this->moduleSettings = $modsettings;
                 //get the func.php for this module
                 include_once $v . DIR_SEP . "func.php";
                 $class = $k . '_Module';
                 new $class($this, $settings);
             }
         }
     }
     $modsettings = $this->doQoolHook('front_module_settings', $modsettings);
     $this->toTpl('modules_settings', $modsettings);
 }
Exemplo n.º 4
0
 private function connectDB()
 {
     $xml = readLangFile('config/config.xml');
     setIncludePath(array('special' => array('folder' => $xml->host->folder)));
     try {
         $dbconfig = array('host' => $xml->database->host, 'username' => $xml->database->username, 'password' => $xml->database->password, 'dbname' => $xml->database->db);
         //here we check for database type
         switch ($xml->database->type) {
             case "mysql":
                 require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
                 $db = new Zend_Db_Adapter_Pdo_Mysql($dbconfig);
                 $db->getConnection();
                 $db->setFetchMode(Zend_Db::FETCH_ASSOC);
                 $smt = $db->query("SET NAMES 'utf8'");
                 $smt->execute();
                 break;
             default:
                 require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
                 $db = new Zend_Db_Adapter_Pdo_Mysql($dbconfig);
                 $db->getConnection();
                 $db->setFetchMode(Zend_Db::FETCH_ASSOC);
                 $smt = $db->query("SET NAMES 'utf8'");
                 $smt->execute();
         }
     } catch (Zend_Db_Adapter_Exception $e) {
         $this->triggerError($this->language['db_connect_error']);
     } catch (Zend_Exception $e) {
         $this->triggerError($this->language['db_factory_error']);
     }
     $this->db = $db;
 }
Exemplo n.º 5
0
 /**
  * Collects hooks and registers them for use by the system
  *
  */
 function collectHooks()
 {
     $addons = $this->addons;
     $apps = $this->applications->toArray();
     $dirs = $this->dirs;
     $actions = array();
     //get the addons hooks first
     $hooks = array();
     foreach ($addons as $k => $v) {
         if ($levels[$k] <= $this->level) {
             $addon = readLangFile(APPL_PATH . $dirs['structure']['addons'] . DIR_SEP . $k . DIR_SEP . 'addon.xml');
             $addon = $this->jsonArray($addon);
             $hooks = $addon['actions']['backend']['hooks'];
             if (count($hooks) > 0 && $hooks['hook']) {
                 if (!$hooks['hook']['name']) {
                     foreach ($hooks['hook'] as $w => $h) {
                         $hooks['hook'][$w]['caller_file'] = APPL_PATH . $dirs['structure']['addons'] . DIR_SEP . $k . DIR_SEP . 'func.php';
                     }
                     $actions = array_merge($actions, $hooks);
                 } else {
                     $hooks['hook']['caller_file'] = APPL_PATH . $dirs['structure']['addons'] . DIR_SEP . $k . DIR_SEP . 'func.php';
                     $actions['hook'][] = $hooks['hook'];
                 }
             }
         }
     }
     //now get the module hooks
     $addons = $this->modules;
     $ahooks = array();
     foreach ($addons as $k => $v) {
         $addon = readLangFile(APPL_PATH . $dirs['structure']['modules'] . DIR_SEP . $k . DIR_SEP . 'addon.xml');
         $addon = $this->jsonArray($addon);
         $ahooks = $addon['actions']['backend']['hooks'];
         if (count($ahooks) > 0 && $ahooks['hook']) {
             if (!$ahooks['hook']['name']) {
                 foreach ($ahooks['hook'] as $w => $h) {
                     $ahooks['hook'][$w]['caller_file'] = APPL_PATH . $dirs['structure']['modules'] . DIR_SEP . $k . DIR_SEP . 'func.php';
                 }
                 $actions = array_merge($actions, $ahooks);
             } else {
                 $ahooks['hook']['caller_file'] = APPL_PATH . $dirs['structure']['modules'] . DIR_SEP . $k . DIR_SEP . 'func.php';
                 $actions['hook'][] = $ahooks['hook'];
             }
         }
     }
     //now get the widgets hooks
     $addons = $this->widgets;
     $bhooks = array();
     foreach ($addons as $k => $v) {
         $addon = readLangFile(APPL_PATH . $dirs['structure']['widgets'] . DIR_SEP . $k . DIR_SEP . 'addon.xml');
         $addon = $this->jsonArray($addon);
         $bhooks = $addon['actions']['backend']['hooks'];
         if (count($bhooks) > 0 && $bhooks['hook']) {
             if (!$bhooks['hook']['name']) {
                 foreach ($bhooks['hook'] as $w => $h) {
                     $bhooks['hook'][$w]['caller_file'] = APPL_PATH . $dirs['structure']['widgets'] . DIR_SEP . $k . DIR_SEP . 'func.php';
                 }
                 $actions = array_merge($actions, $bhooks);
             } else {
                 $bhooks['hook']['caller_file'] = APPL_PATH . $dirs['structure']['widgets'] . DIR_SEP . $k . DIR_SEP . 'func.php';
                 $actions['hook'][] = $bhooks['hook'];
             }
         }
     }
     $this->registerHooks($actions);
 }
Exemplo n.º 6
0
 public function hooksdbAction()
 {
     $this->addToBreadcrumb(array('thirdparty', $this->t('Third Party Tools')));
     $this->addToBreadcrumb(array('hooksdb', $this->t('Qool Hooks Database')));
     $this->totpl('theInclude', 'simplelist');
     Zend_Registry::set('module', 'Qool Hooks Database');
     $hooks = readLangFile(APPL_PATH . 'config/hooksdb.xml');
     foreach ($hooks->hook as $k => $v) {
         $list[] = array('title' => $v, 'link' => 'http://www.qool.gr/hooks/' . str_replace("_", "-", $v));
     }
     $list = $this->doQoolHook('hooks_list', $list);
     $this->toTpl('theList', $list);
 }