コード例 #1
0
 /**
  * Method for calling function or static method
  * @param type $call
  * @param type $matches
  * @return boolean $res if no function or method is found return false. 
  */
 public static function call($call)
 {
     $ary = explode('::', $call);
     $call_exists = null;
     ob_start();
     // call is a class
     if (count($ary) == 2) {
         $module = $ary[0];
         $method = $ary[1];
         $class = self::getModuleName($module);
         if (method_exists($class, $method)) {
             $call_exists = 1;
             $o = new $class();
             $o->{$method}();
             if (isset(moduleloader::$status[403])) {
                 moduleloader::includeModule('error');
                 $e = new errorModule();
                 $e->accessdeniedAction();
             }
             if (isset(moduleloader::$status[404])) {
                 moduleloader::includeModule('error');
                 $e = new errorModule();
                 $e->notfoundAction();
             }
         }
     }
     return ob_get_clean();
 }
コード例 #2
0
ファイル: cron.php プロジェクト: diversen/simple-php-classes
function cron_run()
{
    $m = new moduleloader();
    $modules = $m->getAllModules();
    foreach ($modules as $module) {
        $name = $module['module_name'];
        $class = "\\modules\\{$name}\\cron";
        if (method_exists($class, 'run')) {
            moduleloader::includeModule($name);
            $c = new $class();
            $c->run();
        }
    }
}
コード例 #3
0
function multi_shared_all_up($options = null)
{
    $path = conf::pathBase() . "/config/multi/*";
    $dirs = file::getDirsGlob($path, array('basename' => 1));
    //print_r($options); die;
    moduleloader::includeModule('siteclone');
    foreach ($dirs as $domain) {
        $command = "./coscli.sh --domain={$domain} module --all-up";
        common::echoMessage("Updating: {$domain}");
        common::echoMessage($command);
        passthru($command, $return_var);
        $command = "./coscli.sh --domain={$domain} install --lang";
        common::echoMessage("Updating system language: {$domain}");
        common::echoMessage($command);
        passthru($command, $return_var);
    }
}
コード例 #4
0
function cos_upgrade($options)
{
    moduleloader::includeModule('system');
    $p = new profile();
    if (git::isMaster()) {
        common::abort('Can not make upgrade from master branch');
    }
    $repo = conf::getModuleIni('system_repo');
    $remote = git::getTagsRemoteLatest($repo);
    if ($p->upgradePossible()) {
        common::echoMessage("Latest version/tag: {$remote}", 'y');
        $continue = common::readlineConfirm('Continue the upgrade');
        if ($continue) {
            cos_upgrade_to($remote);
        }
    } else {
        $locale = git::getTagsInstallLatest();
        common::echoMessage("Latest version/tag: {$locale}", 'y');
        $continue = common::readlineConfirm('Continue. Maybe your upgrade was interrupted. ');
        if ($continue) {
            cos_upgrade_to($remote);
        }
    }
}
コード例 #5
0
ファイル: main.php プロジェクト: gpawlik/suited-php-classes
 /**
  * loads all modules in database
  */
 public static function loadDbModules()
 {
     if (!self::tablesExists()) {
         common::echoMessage('No tables exists. We can not load all modules');
         return;
     }
     $mod_loader = new moduleloader();
     $modules = moduleloader::getAllModules();
     foreach ($modules as $val) {
         if (isset($val['is_shell']) && $val['is_shell'] == 1) {
             moduleloader::includeModule($val['module_name']);
             $path = conf::pathModules() . "/{$val['module_name']}/{$val['module_name']}.inc";
             if (file_exists($path)) {
                 include_once $path;
             }
         }
     }
 }
コード例 #6
0
 /**
  * method for getting all parsed blocks
  * @todo clearify what is going on
  * @param string $block
  * @return array blocks containing strings with html to display
  */
 public static function parseBlock($block)
 {
     $blocks = array();
     if (isset(conf::$vars['coscms_main'][$block], conf::$vars['coscms_main']['module'][$block])) {
         $blocks = array_merge(conf::$vars['coscms_main'][$block], conf::$vars['coscms_main']['module'][$block]);
     } else {
         if (isset(conf::$vars['coscms_main'][$block])) {
             $blocks = conf::$vars['coscms_main'][$block];
         } else {
             if (isset(conf::$vars['coscms_main']['module'][$block])) {
                 $blocks = conf::$vars['coscms_main']['module'][$block];
             } else {
                 return $blocks;
             }
         }
     }
     $ret_blocks = array();
     foreach ($blocks as $val) {
         // numeric is custom block added to database
         if (is_numeric($val)) {
             moduleloader::includeModule('blocks');
             $row = blocks::getOne($val);
             $row['content_block'] = moduleloader::getFilteredContent(conf::getModuleIni('blocks_filters'), $row['content_block']);
             $row['title'] = htmlspecialchars($row['title']);
             $content = view::get('blocks', 'block_html', $row);
             $ret_blocks[] = $content;
             continue;
         }
         if ($val == 'module_menu') {
             $ret_blocks[] = self::getMainMenu();
             continue;
         }
         $func = explode('/', $val);
         $num = count($func) - 1;
         $func = explode('.', $func[$num]);
         $func = 'block_' . $func[0];
         $path_to_function = conf::pathModules() . "/{$val}";
         include_once $path_to_function;
         ob_start();
         $ret = $func();
         if ($ret) {
             $ret_blocks[] = $ret;
         } else {
             $ret_blocks[] = ob_get_contents();
             ob_end_clean();
         }
     }
     return $ret_blocks;
 }
コード例 #7
0
ファイル: event.php プロジェクト: gpawlik/suited-php-classes
 public static function includeModules($methods = array())
 {
     foreach ($methods as $val) {
         $ary = explode('::', $val);
         $module = $class = $ary[0];
         //$method = $ary[1];
         if (moduleloader::isInstalledModule($module)) {
             moduleloader::includeModule($module);
         }
     }
     return;
 }
コード例 #8
0
ファイル: user.php プロジェクト: gpawlik/suited-php-classes
 /**
  * inits profile system. Include profile module
  */
 public static function initProfile()
 {
     if (!isset(self::$profile_object)) {
         $profile_system = conf::getMainIni('profile_module');
         if (!isset($profile_system) || !moduleloader::isInstalledModule($profile_system)) {
             self::$profile_object = new defaultProfile();
             return;
         } else {
             moduleloader::includeModule($profile_system);
             $class = "modules\\{$profile_system}\\module";
             self::$profile_object = new $class();
         }
     }
 }