function get_footer()
{
    load_module('footer');
    ?>
</body>
</html><?php 
}
function load_module($module)
{
    global $all_packages;
    // Check if module exists in the list
    if (!isset($all_packages[$module])) {
        echo "Can't find module {$module}.";
        return;
    }
    // Check if module is already loaded
    if (file_exists("./installed_modules/{$module}")) {
        echo "{$module} is already installed.\n";
        return;
    }
    echo "Installing {$module}.\n";
    // Install dependencies
    if (count($all_packages[$module])) {
        echo "In order to install {$module}, we need";
        foreach ($all_packages[$module] as $dep) {
            echo " " . $dep;
        }
        echo ".\n";
        foreach ($all_packages[$module] as $dep) {
            load_module($dep);
        }
    }
    // Create directory when loaded
    mkdir("./installed_modules/{$module}");
    return;
}
Пример #3
0
 public function index()
 {
     if (is_logged(false)) {
         redirect(base_url());
     }
     set_theme('title', 'Login');
     set_theme('content', load_module('login', 'login'));
     set_theme('bodyClass', 'login bg-login printable');
     set_theme('pluginsJS', load_javascript(array('user-pages', 'initialize-login')), false);
     load_template();
 }
Пример #4
0
<?php

if (!is_admin()) {
    mw_error("must be admin");
}
?>

<?php 
$load_module = url_param('load_module');
if ($load_module == true) {
    ?>
    <?php 
    $mod = str_replace('___', DS, $load_module);
    $mod = load_module($mod, $attrs = array('view' => 'admin', 'backend' => 'true'));
    print $mod;
} else {
    ?>
    <?php 
    $mod_params = array();
    $mod_params['ui'] = 'any';
    if (isset($params['reload_modules'])) {
        $s = 'skip_cache=1';
        if (isset($params['cleanup_db'])) {
            $s .= '&cleanup_db=1';
        }
        $mods = scan_for_modules($s);
    }
    if (isset($params['category'])) {
        $mod_params['category'] = $params['category'];
    }
    if (isset($params['keyword'])) {
Пример #5
0
<?php

/*
 * Author: alphazo_id
 *
 * Date: Jan 21, 2010
 * Time: 12:25:47 PM
 */
print '<div id="main">';
if (isset($_REQUEST['section'])) {
    $section = $_REQUEST['section'];
    load_module($section);
} else {
    $section = "ftp";
}
print '</div>';
Пример #6
0
     }
     /**
      *	Now check modules folder with entries in addons
      */
     $modules = scan_current_dir(LEPTON_PATH . '/modules');
     if (count($modules['path']) > 0) {
         foreach ($modules['path'] as &$value) {
             $code_version = get_modul_version($value);
             $db_version = get_modul_version($value, false);
             if ($db_version != null && $code_version != null) {
                 if (versioncompare($db_version, $code_version, '>')) {
                     $error_msg[] = '<span class="normal bold red">' . $value . ' ( ' . $db_version . ' > ' . $code_version . ' ) ' . $MESSAGE['GENERIC_MODULE_VERSION_ERROR'] . '</span>';
                     continue;
                 } else {
                     require LEPTON_PATH . '/modules/' . $value . "/info.php";
                     load_module(LEPTON_PATH . '/modules/' . $value);
                     $msg[] = '<span class="normal bold green">' . $value . ' :: ' . $MESSAGE['ADDON_MODULES_RELOADED'] . '</span>';
                 }
             }
         }
     } else {
         $error_msg[] = '<span class="normal bold red">' . $MESSAGE['ADDON_ERROR_RELOAD'] . '</span>';
     }
     break;
 case 'reload_templates':
     $templates = scan_current_dir(LEPTON_PATH . '/templates');
     if (count($templates['path']) > 0) {
         // Delete templates from database
         $sql = 'DELETE FROM  `' . TABLE_PREFIX . 'addons`  WHERE `type` = \'template\'';
         $database->query($sql);
         // Reload all templates
Пример #7
0
require_once LEPTON_PATH . '/framework/summary.functions.php';
rm_full_dir(LEPTON_PATH . '/modules/output_interface');
echo "<h3>delete obsolete module output_interface: successfull</h3>";
/**
 *  install new modules
 *
 */
if (!function_exists('load_module')) {
    require_once LEPTON_PATH . "/framework/summary.functions.php";
}
$install = array("/modules/lib_semantic");
// install new modules
foreach ($install as $module) {
    $temp_path = LEPTON_PATH . $module;
    require $temp_path . '/info.php';
    load_module($temp_path, true);
    foreach (array('module_license', 'module_author', 'module_name', 'module_directory', 'module_version', 'module_function', 'module_description', 'module_platform', 'module_guid') as $varname) {
        if (isset(${$varname})) {
            unset(${$varname});
        }
    }
}
echo "<h3>install new modules: successfull</h3>";
/**
 *  run upgrade.php of all modified modules
 *
 */
$upgrade_modules = array("addon_file_editor", "captcha_control", "code2", "droplets", "initial_page", "jsadmin", "lib_jquery", "lib_lepton", "lib_semantic", "lib_search", "lib_twig", "news", "tiny_mce_4", "wrapper", "wysiwyg", "wysiwyg_admin");
foreach ($upgrade_modules as $module) {
    $temp_path = LEPTON_PATH . "/modules/" . $module . "/upgrade.php";
    if (file_exists($temp_path)) {
Пример #8
0
function next_function($from, $func = "dbchanges")
{
    global $oldvers, $system_upgrade_detail, $currentscript, $cache;
    load_module("upgrade" . $from . ".php");
    if (function_exists("upgrade" . $from . "_" . $func)) {
        $function = "upgrade" . $from . "_" . $func;
    } else {
        // We're done with our last upgrade script, so add it to the upgrade scripts we've already completed.
        $version_history = $cache->read("version_history");
        $version_history[$from] = $from;
        $cache->update("version_history", $version_history);
        $from = $from + 1;
        if (file_exists(INSTALL_ROOT . "resources/upgrade" . $from . ".php")) {
            $function = next_function($from);
        }
    }
    if (!$function) {
        $function = "whatsnext";
    }
    return $function;
}
Пример #9
0
<?php

require 'system/loader.inc.php';
$CMS = load_module('Cms');
Пример #10
0
        }
    }
}
/**
 * 
 * Reload all specified Addons
 */
$msg = array();
$table = TABLE_PREFIX . 'addons';
foreach ($post_check as $key) {
    switch ($key) {
        case 'reload_modules':
            $aAddonList = glob(WB_PATH . '/modules/*', GLOB_ONLYDIR);
            foreach ($aAddonList as $sAddonFile) {
                if (is_readable($sAddonFile)) {
                    load_module($sAddonFile);
                }
            }
            // add success message
            $msg[] = $MESSAGE['ADDON_MODULES_RELOADED'];
            unset($aAddonList);
            break;
        case 'reload_templates':
            $aAddonList = glob(WB_PATH . '/templates/*', GLOB_ONLYDIR);
            foreach ($aAddonList as $sAddonFile) {
                if (is_readable($sAddonFile)) {
                    load_template($sAddonFile);
                }
            }
            // add success message
            $msg[] = $MESSAGE['ADDON_TEMPLATES_RELOADED'];
Пример #11
0
 function index($params)
 {
     if (isset($params['manage_categories'])) {
         print load_module('categories/manage', $params);
         return;
     }
     if (isset($params['is_shop']) and $params['is_shop'] == 'y') {
         $params['is_shop'] = 1;
     } else {
         if (isset($params['is_shop']) and $params['is_shop'] == 'n') {
             $params['is_shop'] = 0;
         }
     }
     $no_page_edit = false;
     $posts_mod = array();
     // $posts_mod['type'] = 'content/admin_posts_list';
     if (isset($params['data-page-id'])) {
         $posts_mod['page-id'] = $params['data-page-id'];
     }
     if (isset($params['no_page_edit'])) {
         $no_page_edit = $params['no_page_edit'];
     }
     if (isset($params['keyword'])) {
         $posts_mod['search_by_keyword'] = $params['keyword'];
     }
     if (isset($params['content_type']) and $params['content_type'] != false) {
         $posts_mod['content_type'] = $params['content_type'];
     }
     if (isset($params['subtype']) and $params['subtype'] != false) {
         $posts_mod['subtype'] = $params['subtype'];
     }
     if (isset($params['is_shop']) and $params['is_shop'] == 1) {
         $posts_mod['content_type'] = 'product';
     } else {
         if (isset($params['is_shop']) and $params['is_shop'] == 0) {
             $posts_mod['subtype'] = 'post';
         }
     }
     if (isset($params['content_type']) and $params['content_type'] == 'product') {
         $posts_mod['content_type'] = 'product';
         // $posts_mod['content_type'] = 'post';
     }
     if (isset($params['content_type']) and $params['content_type'] == 'post') {
         if (!isset($params['subtype']) or $params['subtype'] == false) {
             //	$posts_mod['subtype'] = 'post';
         }
     }
     if (isset($params['content_type_filter']) and $params['content_type_filter'] != '') {
         $posts_mod['content_type'] = $params['content_type_filter'];
     }
     if (isset($params['subtype_filter']) and $params['subtype_filter'] != '') {
         $posts_mod['subtype'] = $params['subtype_filter'];
     }
     if (!isset($params['category-id']) and isset($params['page-id']) and $params['page-id'] != 'global') {
         $check_if_exist = $this->provider->get_by_id($params['page-id']);
         if (is_array($check_if_exist)) {
             if (isset($check_if_exist['is_shop']) and trim($check_if_exist['is_shop']) == 1) {
                 //  $posts_mod['subtype'] = 'product';
             }
         }
     }
     $page_info = false;
     if (isset($params['page-id'])) {
         if ($params['page-id'] == 'global') {
             if (isset($params['is_shop']) and $params['is_shop'] == 1) {
                 $page_info = $this->provider->get('limit=1&one=1&content_type=page&is_shop=0');
             }
         } else {
             $page_info = $this->provider->get_by_id($params['page-id']);
             if (isset($page_info['is_shop']) and trim($page_info['is_shop']) == 1) {
                 //  $posts_mod['subtype'] = 'product';
             }
         }
     }
     if (isset($params['category-id']) and $params['category-id'] != 'global') {
         $check_if_exist = $this->category_provider->get_page($params['category-id']);
         if (is_array($check_if_exist)) {
             $page_info = $check_if_exist;
             if (isset($check_if_exist['is_shop']) and trim($check_if_exist['is_shop']) == 1) {
                 $posts_mod['content_type'] = 'product';
             } else {
                 // $posts_mod['subtype'] = $check_if_exist['subtype'];
             }
         }
     }
     $posts_mod['paging_param'] = 'pg';
     $posts_mod['orderby'] = 'position desc';
     if (isset($posts_mod['page-id'])) {
         $posts_mod['parent'] = $posts_mod['page-id'];
     }
     if (isset($params['pg'])) {
         $posts_mod['pg'] = $params['pg'];
     }
     if (isset($params['data-category-id'])) {
         $posts_mod['category'] = $params['data-category-id'];
     } else {
         if (isset($params['parent-category-id'])) {
             $posts_mod['category'] = $params['parent-category-id'];
         } elseif (isset($params['category-id'])) {
             $posts_mod['category'] = $params['category-id'];
         }
     }
     if (isset($params[$posts_mod['paging_param']])) {
         $posts_mod['page'] = $params[$posts_mod['paging_param']];
     }
     $keyword = false;
     if (isset($posts_mod['search_by_keyword'])) {
         $keyword = strip_tags($posts_mod['search_by_keyword']);
     }
     if (isset($params['parent-page-id'])) {
         $posts_mod['parent'] = intval($params['parent-page-id']);
     }
     $data = $this->provider->get($posts_mod);
     if (empty($data) and isset($posts_mod['page'])) {
         if (isset($posts_mod['paging_param'])) {
             $posts_mod[$posts_mod['paging_param']] = 1;
         }
         unset($posts_mod['page']);
         $data = $this->provider->get($posts_mod);
     }
     $post_params_paging = $posts_mod;
     $post_params_paging['page_count'] = true;
     $pages = $this->provider->get($post_params_paging);
     $this->event_manager->trigger('module.content.manager', $posts_mod);
     $post_toolbar_view = $this->views_dir . 'toolbar.php';
     $toolbar = new View($post_toolbar_view);
     $toolbar->assign('page_info', $page_info);
     $toolbar->assign('keyword', $keyword);
     $toolbar->assign('params', $params);
     $post_list_view = $this->views_dir . 'manager.php';
     if ($no_page_edit == false) {
         if ($data == false) {
             if (isset($posts_mod['category-id']) and isset($page_info['content_type']) and $page_info['content_type'] == 'page' and $page_info['subtype'] != 'static') {
                 if (isset($posts_mod['category-id']) and $posts_mod['category-id'] != 0) {
                 } else {
                     $manager = new Edit();
                     return $manager->index($params);
                 }
             } elseif (isset($page_info['content_type']) and $page_info['content_type'] == 'page' and isset($page_info['subtype']) and isset($page_info['id'])) {
                 if ($page_info['subtype'] != 'dynamic') {
                     $manager = new Edit();
                     return $manager->index($params);
                 }
             }
         }
     }
     $view = new View($post_list_view);
     $view->assign('params', $params);
     $view->assign('page_info', $page_info);
     $view->assign('toolbar', $toolbar);
     $view->assign('data', $data);
     $view->assign('pages', $pages);
     $view->assign('keyword', $keyword);
     $view->assign('post_params', $posts_mod);
     $view->assign('paging_param', $posts_mod['paging_param']);
     return $view->display();
 }
            echo '<h2>Step ' . $stepID++ . ' : Upgrade module \'' . $sModul . '\' to version ' . $newModulVersion . '</h2>';
            require_once WB_PATH . '/modules/' . $sModul . '/upgrade.php';
        }
    }
}
/**********************************************************
 *  - Reload all addons
 */
echo '<h2>Step ' . $stepID++ . ' : Reload all addons database entry (no upgrade)</h2>';
////delete modules
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
// Load all modules
if ($handle = opendir(WB_PATH . '/modules/')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != '' and substr($file, 0, 1) != '.' and $file != 'admin.php' and $file != 'index.php') {
            load_module(WB_PATH . '/modules/' . $file);
            //     upgrade_module($file, true);
        }
    }
    closedir($handle);
}
echo '<br />Modules reloaded<br />';
////delete templates
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
// Load all templates
if ($handle = opendir(WB_PATH . '/templates/')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != '' and substr($file, 0, 1) != '.' and $file != 'index.php') {
            load_template(WB_PATH . '/templates/' . $file);
        }
    }
Пример #13
0
include 'lang.functions.php';
// Work-out if we should check for existing page_code
$sql = 'DESCRIBE `' . TABLE_PREFIX . 'pages` `page_code`';
$field_sql = $database->query($sql);
$field_set = $field_sql->numRows();
// $field_set = $database->field_add('page_code', 'pages', 'INT(11) NOT NULL AFTER `modified_by`');
// extract page_id from old format
$pattern = '/(?<=_)([0-9]{1,11})/s';
$format = $field_sql->fetchRow(MYSQL_ASSOC);
// upgrade only if old format
if ($format['Type'] == 'varchar(255)') {
    $sql = 'SELECT `page_code`,`page_id` FROM `' . TABLE_PREFIX . 'pages` ORDER BY `page_id`';
    $query_code = $database->query($sql);
    while ($page = $query_code->fetchRow(MYSQL_ASSOC)) {
        preg_match($pattern, $page['page_code'], $array);
        $page_code = $array[0];
        $page_id = $page['page_id'];
        $sql = 'UPDATE `' . TABLE_PREFIX . 'pages` SET ';
        $sql .= empty($array[0]) ? '`page_code` = 0 ' : '`page_code` = ' . $page_code . ' ';
        $sql .= 'WHERE `page_id` = ' . $page_id;
        $database->query($sql);
    }
    $sql = 'ALTER TABLE `' . TABLE_PREFIX . 'pages` MODIFY COLUMN `page_code` INT(11) NOT NULL';
    $database->query($sql);
}
//
$directory = dirname(__FILE__) . '/' . 'info.php';
// update entry in table addons to new version
load_module($directory, $install = false);
// Print admin footer
// $admin->print_footer();
Пример #14
0
<?php

/*
*	@version	0.1
*	@author		Ruud Eisinga (Ruud)
*	@date		2009-04-10
*
*/
if (!defined('WB_PATH')) {
    die(header('Location: ../index.php'));
}
$table = TABLE_PREFIX . 'mod_capslider_slide';
$database->query("DROP TABLE IF EXISTS `{$table}`");
$database->query("CREATE TABLE `{$table}` (\n\t`id` INT NOT NULL auto_increment,\n\t`group_id` INT NOT NULL DEFAULT '0',\n\t`image` TEXT NOT NULL ,\n\t`alt` TEXT NOT NULL ,\n\t`height` INT NOT NULL DEFAULT '0',\n\t`width` INT NOT NULL DEFAULT '0',\n\t`modified_when` INT NOT NULL DEFAULT '0',\n\t`modified_by` INT NOT NULL DEFAULT '0',\n\t`active` INT NOT NULL DEFAULT '0',\n\t`comments` TEXT NOT NULL,\n\tPRIMARY KEY ( `id` )\n\t)");
$table = TABLE_PREFIX . 'mod_capslider_groups';
$database->query("DROP TABLE IF EXISTS `{$table}`");
$database->query("CREATE TABLE `{$table}` (\n\t`group_id` INT NOT NULL auto_increment,\n\t`group_name` VARCHAR(32) NOT NULL DEFAULT '',\n\t`height` INT NOT NULL DEFAULT '0',\n\t`width` INT NOT NULL DEFAULT '0',\n\t`delay` INT NOT NULL DEFAULT '0',\n\t`speed` INT NOT NULL DEFAULT '0',\n\t`panel` VARCHAR(6) NOT NULL DEFAULT '000000',\n\tPRIMARY KEY ( `group_id` )\n\t)");
$database->query("INSERT INTO " . $table . " (`group_name`,`height`,`width`,`delay`,`speed`) VALUES ('capslider','200','600','5000','800' )");
load_module(WB_PATH . '/modules/capslider/snippet');
Пример #15
0
                            <div id="parent-category-selector-holder"></div>
                        </div>
                    <?php 
    }
    ?>
                </div>
            </div>
        </div>
    <?php 
}
?>
    <div class="mw-admin-edit-content-holder">
        <?php 
$data['recommended_parent'] = $recommended_parent;
$data['active_categories'] = $categories_active_ids;
print load_module('content/views/tabs', $data);
?>
    </div>
    <?php 
if (isset($data['subtype']) and isset($data['content_type']) and $data['content_type'] == 'page' and $data['subtype'] == 'dynamic') {
    ?>
        <module type="content/views/layout_selector" id="mw-quick-add-choose-layout-middle-pos" autoload="yes"
                template-selector-position="bottom" content-id="<?php 
    print $data['id'];
    ?>
"
                inherit_from="<?php 
    print $data['parent'];
    ?>
"/>
        <?php 
Пример #16
0
<?php

session_start();
require __DIR__ . '/config/init.php';
/** @var PDO $app_dbo */
$app_dbo = load_module('database', true);
load_module('auth');
try {
    $auth_response = Auth_Base::attempt(array('username' => '*****@*****.**', 'password' => '123456'));
} catch (Exception $e) {
    $auth_response = $e->getMessage();
}
var_dump($auth_response);
Пример #17
0
function run_module($module = '', $options = '', $transaction = 1)
{
    global $conf, $self, $onadb;
    // Build the options array string from $options_string if we need to
    // This is only used for logging!  If $options_string is an array it
    // is passed untouched to the module.
    $options_string = $options;
    if (is_array($options)) {
        $options_string = '';
        $and = '';
        foreach (array_keys($options) as $key) {
            // Quote any "special" characters in the value.
            // Specifically the '=' and '&' characters need to be escaped.
            $options[$key] = str_replace(array('=', '&'), array('\\=', '\\&'), $options[$key]);
            // If the key has no value or it is the javascript key, dont print it.
            if ($options[$key] != "" and $key != 'js') {
                $options_string .= "{$and}{$key}={$options[$key]}";
                $and = '&';
            }
        }
    }
    // get the options as an array so we can look for logging info
    $local_options = parse_options($options);
    // If the user passes in an option called 'module_loglevel' then use it as the run module output level
    // otherwise default it to 1 so it will print out as normal.
    $log_level = 1;
    if ($local_options['module_loglevel']) {
        $log_level = $local_options['module_loglevel'];
    }
    // Remove config info as it can be huge and could have sensitive info in it.
    // This could cause issues since I"m doing & as an anchor at the end.  see how it goes.
    // The module that is called could also display this information depending on debug level
    $options_string = preg_replace("/config=.*&/", '', $options_string);
    printmsg("INFO => Running module: {$module} options: {$options_string}", $log_level);
    // Load the module
    if (load_module($module)) {
        return array(1, $self['error'] . "\n");
    }
    // Start an DB transaction (If the database supports it)
    if ($transaction) {
        $has_trans = $onadb->BeginTrans();
    }
    if (!$has_trans) {
        printmsg("WARNING => Transactions support not available on this database, this can cause problems!", 1);
    }
    // If begintrans worked and we support transactions, do the smarter "starttrans" function
    if ($has_trans) {
        printmsg("DEBUG => Commiting transaction", 2);
        $onadb->StartTrans();
    }
    // Start a timer so we can display moudle run time if debugging is enabled
    $start_time = microtime_float();
    // Run the function
    list($status, $output) = $module($options);
    // Stop the timer, and display how long it took
    $stop_time = microtime_float();
    printmsg("DEBUG => [Module_runtime] " . round($stop_time - $start_time, 2) . " seconds -- [Total_SQL_Queries] " . $self['db_get_record_count'] . " --  [Module_exit_code] {$status}", 1);
    // Either commit, or roll back the transaction
    if ($transaction and $has_trans) {
        if ($status != 0) {
            printmsg("INFO => There was a module error, marking transaction for a Rollback!", 1);
            //$onadb->RollbackTrans();
            $onadb->FailTrans();
        }
    }
    if ($has_trans) {
        // If there was any sort of failure, make sure the status has incremented, this catches sub module output errors;
        if ($onadb->HasFailedTrans()) {
            $status = $status + 1;
        }
        // If the user passed the rollback flag then dont commit the transaction
        // FIXME: not complete or tested.. it would be nice to have an ability for the user to pass
        //        a rollback flag to force the transaction to rollback.. good for testing adds/modify.
        //        The problem is sub modules will fire and then the whole thing stops so you wont see/test the full operation.
        //         if ($local_options['rollback']) {
        //             printmsg("INFO => The user requested to mark the transaction for a rollback, no changes made.", 0);
        //             $output .= "INFO => The user requested to mark the transaction for a rollback, no changes made.\n";
        //             $status = $status + 1;
        //         }
        printmsg("DEBUG => Commiting transaction", 2);
        $onadb->CompleteTrans();
    }
    // Return the module's output
    return array($status, $output);
}
Пример #18
0
<?php

$module_info = array("name" => "plugwise", "description" => "Plugwise USB Driver", "version" => "0.1", "author" => "Cedric Marie-Marthe", "bootstrap" => "plugwise_usb", "driver" => "plugwise_usb_driver.php", "socket" => array());
load_module($module_info);
Пример #19
0


            <span class="mw_editor_btn mw_editor_link" data-command="custom-link" title="<?php 
_e("Add/Edit Link");
?>
"><span class="ed-ico"></span></span>
            <span class="mw_editor_btn mw_editor_unlink" data-command="custom-unlink" title="<?php 
_e("Remove Link");
?>
"><span class="ed-ico"></span></span>


            <span class="mw_editor_btn mw_editor_remove_formatting" data-command="removeformat" title="<?php 
_e("Remove Formatting");
?>
"><span class="ed-ico"></span></span>

            <?php 
if (is_admin() and isset($_REQUEST['modules'])) {
    $mods = explode(',', $_REQUEST['modules']);
    $mods = array_trim($mods);
    if (is_array($mods)) {
        foreach ($mods as $mod) {
            print load_module($mod);
        }
    }
}
?>
        </div>
    </div>
Пример #20
0
                    }
                }
            }
        }
    }
    $modules = array_unique($modules);
}
?>
  <?php 
if (!empty($modules)) {
    ?>
  <?php 
    foreach ($modules as $module) {
        ?>
  <?php 
        print load_module($module, $data);
        ?>
  <?php 
    }
    ?>
  <?php 
} else {
    ?>
  <?php 
    include __DIR__ . DS . 'edit_default.php';
    ?>
  <?php 
}
?>
</div>
if (!$list) {
    $admin->print_error($MESSAGE['GENERIC_CANNOT_UNZIP']);
}
// Delete the temp zip file
if (file_exists($temp_file)) {
    unlink($temp_file);
}
// Chmod all the uploaded files
$dir = dir($module_dir);
while (false !== ($entry = $dir->read())) {
    // Skip pointers
    if (substr($entry, 0, 1) != '.' and $entry != '.svn' and !is_dir($module_dir . '/' . $entry)) {
        // Chmod file
        change_mode($module_dir . '/' . $entry, 'file');
    }
}
// Run the modules install // upgrade script if there is one
if (file_exists($module_dir . '/' . $action . '.php')) {
    require $module_dir . '/' . $action . '.php';
}
// Print success message
if ($action == "install") {
    // Load module info into DB
    load_module(WB_PATH . '/modules/' . $module_directory, false);
    $admin->print_success($MESSAGE['GENERIC_INSTALLED']);
} elseif ($action == "upgrade") {
    upgrade_module($module_directory, false);
    $admin->print_success($MESSAGE['GENERIC_UPGRADED']);
}
// Print admin footer
$admin->print_footer();
Пример #22
0
    $admin->print_error($MESSAGE['GENERIC_NOT_UPGRADED']);
}
// remove temp
cleanup($temp_unzip, $temp_file);
// load info.php again to have current values
if (file_exists(LEPTON_PATH . '/modules/' . $module_directory . '/info.php')) {
    require LEPTON_PATH . '/modules/' . $module_directory . '/info.php';
}
// Run the modules install // upgrade script if there is one
if (file_exists($module_dir . '/' . $action . '.php')) {
    require $module_dir . '/' . $action . '.php';
}
// Print success message
if ($action == "install") {
    // Load module info into DB
    load_module(LEPTON_PATH . '/modules/' . $module_directory, false);
    // let admin set access permissions for modules of type 'page' and 'tool'
    if ($module_function == 'page' || $module_function == 'tool') {
        // get groups
        $stmt = $database->query('SELECT * FROM ' . TABLE_PREFIX . 'groups WHERE group_id <> 1');
        if ($stmt->numRows() > 0) {
            echo "<script type=\"text/javascript\">\n", "function markall() {\n", "  for ( i=0; i<document.forms[0].elements.length; i++ ) {\n", "    if ( document.forms[0].elements[i].type == \"checkbox\" ) {\n", "      if ( document.forms[0].group_all.checked == true ) {\n", "        document.forms[0].elements[i].checked=true;\n", "      } else {\n", "        document.forms[0].elements[i].checked=false;\n", "      }\n", "    }\n", "  }\n", "}\n", "</script>\n", "<h2>", $MESSAGE['GENERIC_INSTALLED'], "</h2><br /><br />\n", "<h3>", $TEXT['MODULE_PERMISSIONS'], "</h3><br />\n", "<form method=\"post\" action=\"" . ADMIN_URL . "/modules/save_permissions.php\">\n", "<input type=\"hidden\" name=\"module\" id=\"module\" value=\"", $module_directory, "\" />\n", "<input type=\"checkbox\" name=\"group_all\" id=\"group_all\" onclick=\"markall();\" /> ", $MESSAGE['ADDON_GROUPS_MARKALL'], "<br />\n";
            // let the admin choose which groups can access this module
            while ($row = $stmt->fetchRow(MYSQL_ASSOC)) {
                echo "<input type=\"checkbox\" name=\"group_id[]\" id=\"group_id[]\" value=\"", $row['group_id'], "\" /> ", $row['name'], "<br />\n";
            }
            echo "<br /><br /><input type=\"submit\" value=\"" . $TEXT['SAVE'] . "\" /></form>";
        } else {
            $admin->print_success($MESSAGE['GENERIC_INSTALLED']);
        }
    } else {
Пример #23
0
require_once LEPTON_PATH . '/framework/summary.functions.php';
// load WB language file
require_once LEPTON_PATH . '/languages/' . LANGUAGE . '.php';
// create Admin object with admin header
$admin = new admin('Addons', '', true, false);
$js_back = ADMIN_URL . '/modules/index.php?advanced';
/**
 * Manually execute the specified module file (install.php, upgrade.php or uninstall.php)
 */
// check if specified module folder exists
$mod_path = LEPTON_PATH . '/modules/' . basename(LEPTON_PATH . '/' . $_POST['file']);
// let the old variablename if module use it
$module_dir = $mod_path;
if (!file_exists($mod_path . '/' . $_POST['action'] . '.php')) {
    $admin->print_error($TEXT['NOT_FOUND'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt> ', $js_back);
}
// include modules install.php script
require $mod_path . '/' . $_POST['action'] . '.php';
// load module info into database and output status message
require $mod_path . "/info.php";
load_module($mod_path, false);
$msg = $TEXT['EXECUTE'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt>';
switch ($_POST['action']) {
    case 'install':
    case 'upgrade':
    case 'uninstall':
        $admin->print_success($msg, $js_back);
        break;
    default:
        $admin->print_error($TEXT["ACTION_NOT_SUPPORTED"], $js_back);
}
Пример #24
0
function next_function($from, $func = "dbchanges")
{
    global $oldvers, $system_upgrade_detail, $currentscript;
    load_module("upgrade" . $from . ".php");
    if (function_exists("upgrade" . $from . "_" . $func)) {
        $function = "upgrade" . $from . "_" . $func;
    } else {
        $from = $from + 1;
        if (file_exists(INSTALL_ROOT . "resources/upgrade" . $from . ".php")) {
            $function = next_function($from);
        }
    }
    if (!$function) {
        $function = "whatsnext";
    }
    return $function;
}
Пример #25
0
    exit;
}
if (isset($_GET["popup"])) {
    popup();
    exit;
}
if (isset($_GET["options"])) {
    popup_options();
    exit;
}
if (isset($_GET["modules"])) {
    popup_modules();
    exit;
}
if (isset($_GET["load-module"])) {
    load_module();
    exit;
}
if (isset($_GET["Modules-list"])) {
    load_modules_list();
    exit;
}
if (isset($_POST["unik-EnableRRDGraphFunction"])) {
    EnableRRDGraphFunctionSave();
    exit;
}
js();
function EnableRRDGraphFunctionSave()
{
    $sock = new sockets();
    $sock->SET_INFO("EnableRRDGraphFunction", $_POST["unik-EnableRRDGraphFunction"]);
Пример #26
0
        }

        locate_template('user_login.php', true);
    break;

    case 'register':
        if (!$config['register_open'])
        {
            trigger_error('REGISTERS_CLOSED', E_USER_WARNING);
        }
        if (isset($_REQUEST['not_agreed']) || $user->data['user_id'] != ANONYMOUS)
        {
            redirect(generate_url('', '')); //redirect to home page
        }

        load_module('ucp', 'register');

        locate_template('user_register.php', true);
    break;

    case 'logout':
        /**
        * @todo Maybe meta refresh?
        */
        $user->logout($redirect);
    break;
    default:

    break;
}
?>
Пример #27
0
<?php

/*
 * Author: alphazo_id
 *
 * Date: Jan 21, 2010
 * Time: 12:25:37 PM
 */
$server_name = exec('uname -n');
$arch = exec('uname -m');
$os_type = exec('uname -s');
$os_release = exec('uname -r');
$kernel = exec('uname -i');
print '<div id="right">';
print '<div id="info">';
print 'Server name: ' . $server_name . '<br>';
print 'Server arch: ' . $arch . '<br>';
print 'OS: ' . $os_type . '<br>';
print 'OS release: ' . $os_release . '<br>';
print 'Kernel: ' . $kernel . '<br>';
print '</div>';
print '<div id="info">';
print "<h3>Services status</h3>";
load_module("status");
show_service_status('vsftpd');
show_service_status('apache');
show_service_status('mysql-server');
show_service_status('sshd');
print '</div>';
print '</div>';
Пример #28
0
 function index($params)
 {
     if (is_admin() == false) {
         return;
     }
     if (isset($params['content_type']) and $params['content_type'] == 'category') {
         print load_module('categories/edit_category', $params);
         return;
     }
     $data = false;
     $just_saved = false;
     $is_new_content = false;
     $is_current = false;
     $is_live_edit = false;
     if (!isset($is_quick)) {
         $is_quick = false;
     }
     //	if (isset($params['is_shop'])) {
     //            if (trim($params['is_shop']) == 'y') {
     //				$params['is_shop'] = 1;
     //			} else if (trim($params['is_shop']) == 'n') {
     //				$params['is_shop'] = 0;
     //			}
     //        }
     if (isset($params['live_edit'])) {
         $is_live_edit = $params['live_edit'];
     } elseif (isset($params['from_live_edit'])) {
         $is_live_edit = $params['from_live_edit'];
     }
     if (isset($params['quick_edit'])) {
         $is_quick = $params['quick_edit'];
     }
     if ($is_live_edit == true) {
         $is_quick = false;
     }
     if (isset($params['just-saved'])) {
         $just_saved = $params['just-saved'];
     }
     if (isset($params['is-current'])) {
         $is_current = $params['is-current'];
     }
     if (isset($params['page-id'])) {
         $data = $this->app->content_manager->get_by_id(intval($params["page-id"]));
     }
     if (isset($params['content-id'])) {
         $data = $this->app->content_manager->get_by_id(intval($params["content-id"]));
     }
     $recommended_parent = false;
     if (isset($params['recommended_parent']) and $params['recommended_parent'] != false) {
         $recommended_parent = $params['recommended_parent'];
     } elseif (isset($params['parent']) and $params['parent'] != false) {
         $recommended_parent = $params['parent'];
     }
     // dd($params);
     $categories_active_ids = false;
     $title_placeholder = false;
     if (isset($params['category']) and $params['category'] != false) {
         $categories_active_ids = $params['category'];
     } elseif (isset($params['selected-category-id']) and $params['selected-category-id'] != false) {
         $categories_active_ids = $params['selected-category-id'];
     }
     /* FILLING UP EMPTY CONTENT WITH DATA */
     if ($data == false or empty($data)) {
         $is_new_content = true;
         $data = $this->empty_data;
         if (isset($params['content_type'])) {
             $data['content_type'] = $params['content_type'];
         }
         if (isset($params['subtype'])) {
             $data['subtype'] = $params['subtype'];
             if ($data['subtype'] == 'post') {
                 $data['content_type'] = 'post';
             }
         }
         if (isset($data['content_type']) and $data['content_type'] == 'post' and $data['subtype'] == 'static') {
             $data['subtype'] = 'post';
         } else {
             if (isset($data['content_type']) and $data['content_type'] == 'product' and $data['subtype'] == 'static') {
                 $data['content_type'] = 'product';
                 $data['subtype'] = 'product';
             }
         }
     }
     if (isset($params['add-to-menu'])) {
         $data['add_to_menu'] = $params["add-to-menu"];
     }
     /* END OF FILLING UP EMPTY CONTENT  */
     /* SETTING PARENT AND ACTIVE CATEGORY */
     $forced_parent = false;
     if (intval($data['id']) == 0 and intval($data['parent']) == 0 and isset($params['parent-category-id']) and $params['parent-category-id'] != 0 and !isset($params['parent-page-id'])) {
         $cat_page = get_page_for_category($params['parent-category-id']);
         if (is_array($cat_page) and isset($cat_page['id'])) {
             $forced_parent = $params['parent-page-id'] = $cat_page['id'];
         }
     }
     if (intval($data['id']) == 0 and intval($data['parent']) == 0 and isset($params['parent-page-id'])) {
         $data['parent'] = $params['parent-page-id'];
         if (isset($params['content_type']) and $params['content_type'] == 'product') {
             $parent_content = $this->app->content_manager->get_by_id($params['parent-page-id']);
             // if(!isset($parent_content['is_shop']) or $parent_content['is_shop'] != 1){
             // $data['parent'] = 0;
             // }
         }
         if (isset($params['parent-category-id']) and $params['parent-category-id'] != 0) {
             $categories_active_ids = $params['parent-category-id'];
         }
     } else {
         if (intval($data['id']) != 0) {
             $categories = $this->app->category_manager->get_for_content($data['id']);
             if (is_array($categories)) {
                 $c = array();
                 foreach ($categories as $category) {
                     $c[] = $category['id'];
                 }
                 $categories_active_ids = implode(',', $c);
             }
         }
     }
     /* END OF SETTING PARENT AND ACTIVE CATEGORY  */
     if ($recommended_parent != false and $data['parent'] == 0) {
         $data['parent'] = $recommended_parent;
     }
     /* SETTING PARENT AND CREATING DEFAULT BLOG OR SHOP IF THEY DONT EXIST */
     if ($recommended_parent != false and intval($data['id']) == 0) {
         if (isset($data['subtype']) and $data['subtype'] == 'post') {
             if (isset($data['is_shop']) and $data['is_shop'] == 0) {
                 $parent_content = $this->app->content_manager->get_by_id($recommended_parent);
                 if (isset($parent_content['is_shop']) and $parent_content['is_shop'] == 1) {
                     $parent_content_params = array();
                     $parent_content_params['subtype'] = 'dynamic';
                     $parent_content_params['content_type'] = 'page';
                     $parent_content_params['limit'] = 1;
                     $parent_content_params['one'] = 1;
                     $parent_content_params['fields'] = 'id';
                     $parent_content_params['order_by'] = 'posted_at desc, updated_at desc';
                     $parent_content_params['is_shop'] = 0;
                     $parent_content = $this->app->content_manager->get($parent_content_params);
                     if (isset($parent_content['id']) and $parent_content['id'] != 0) {
                         $data['parent'] = $recommended_parent = $parent_content['id'];
                         $categories_active_ids = false;
                     }
                 }
             }
         }
     }
     if ($recommended_parent == false and intval($data['id']) == 0 and intval($data['parent']) == 0) {
         $parent_content_params = array();
         $parent_content_params['subtype'] = 'dynamic';
         $parent_content_params['content_type'] = 'page';
         $parent_content_params['limit'] = 1;
         $parent_content_params['one'] = 1;
         $parent_content_params['parent'] = 0;
         $parent_content_params['fields'] = 'id';
         $parent_content_params['order_by'] = 'posted_at desc, updated_at desc';
         if (isset($params['subtype']) and $params['subtype'] == 'post') {
             $parent_content_params['is_shop'] = 0;
             $parent_content_params['is_home'] = 0;
             $parent_content = $this->app->content_manager->get($parent_content_params);
             if (!isset($parent_content['id'])) {
                 unset($parent_content_params['parent']);
                 $parent_content = $this->app->content_manager->get($parent_content_params);
             }
             if (isset($parent_content['id'])) {
                 $data['parent'] = $parent_content['id'];
             } else {
                 $this->app->content_manager->create_default_content('blog');
                 $parent_content_params['no_cache'] = true;
                 $parent_content = $this->app->content_manager->get($parent_content_params);
             }
         } elseif (isset($params['subtype']) and $params['content_type'] == 'product') {
             $parent_content_params['is_shop'] = 1;
             $parent_content = $this->app->content_manager->get($parent_content_params);
             if (isset($parent_content['id'])) {
                 $data['parent'] = $parent_content['id'];
             } else {
                 $this->app->content_manager->create_default_content('shop');
                 $parent_content_params['no_cache'] = true;
                 $parent_content = $this->app->content_manager->get($parent_content_params);
             }
         }
         if (isset($parent_content) and isset($parent_content['id'])) {
             $data['parent'] = $parent_content['id'];
         }
     } elseif ($forced_parent == false and (intval($data['id']) == 0 and intval($data['parent']) != 0) and isset($data['subtype']) and $data['content_type'] == 'product') {
         //if we are adding product in a page that is not a shop
         $parent_shop_check = $this->app->content_manager->get_by_id($data['parent']);
         if (!isset($parent_shop_check['is_shop']) or $parent_shop_check['is_shop'] != 1) {
             $parent_content_shop = $this->app->content_manager->get('content_type=page&order_by=updated_at desc&one=true&is_shop=0');
             if (isset($parent_content_shop['id'])) {
                 $data['parent'] = $parent_content_shop['id'];
             }
         }
     } elseif ($forced_parent == false and (intval($data['id']) == 0 and intval($data['parent']) != 0) and isset($data['subtype']) and $data['subtype'] == 'post') {
         $parent_shop_check = $this->app->content_manager->get_by_id($data['parent']);
         if (!isset($parent_shop_check['content_type']) or $parent_shop_check['content_type'] != 'page') {
             $parent_content_shop = $this->app->content_manager->get('order_by=updated_at desc&one=true&content_type=page&subtype=dynamic&is_shop=1');
             if (isset($parent_content_shop['id'])) {
                 $data['parent'] = $parent_content_shop['id'];
             }
         }
     }
     /* END OF SETTING PARENT AND CREATING DEFAULT BLOG OR SHOP IF THEY DONT EXIST */
     $module_id = $params['id'];
     $post_list_view = $this->views_dir . 'edit.php';
     $this->app->event_manager->trigger('module.content.edit.main', $data);
     //d($params);
     //d($data['content_type']);
     //d($data);
     $view = new View($post_list_view);
     $view->assign('params', $params);
     $view->assign('module_id', $module_id);
     $view->assign('just_saved', $just_saved);
     $view->assign('is_new_content', $is_new_content);
     $view->assign('is_current', $is_current);
     $view->assign('is_live_edit', $is_live_edit);
     $view->assign('recommended_parent', $recommended_parent);
     $view->assign('categories_active_ids', $categories_active_ids);
     $view->assign('title_placeholder', $title_placeholder);
     $view->assign('rand', rand());
     $view->assign('data', $data);
     $view->assign('is_quick', $is_quick);
     return $view->display();
 }
Пример #29
0
//    $database = new database();
//}
// Include the PclZip class file (thanks to
require_once WB_PATH . '/include/pclzip/pclzip.lib.php';
$admin = new admin_dummy('Start', '', false, false);
// Load addons into DB
$dirs['modules'] = WB_PATH . '/modules/';
$dirs['templates'] = WB_PATH . '/templates/';
$dirs['languages'] = WB_PATH . '/languages/';
foreach ($dirs as $type => $dir) {
    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != '' and substr($file, 0, 1) != '.' and $file != 'admin.php' and $file != 'index.php') {
                // Get addon type
                if ($type == 'modules') {
                    load_module($dir . '/' . $file, true);
                    // Pretty ugly hack to let modules run $admin->set_error
                    // See dummy class definition admin_dummy above
                    if ($admin->error != '') {
                        set_error($admin->error);
                    }
                } elseif ($type == 'templates') {
                    load_template($dir . '/' . $file);
                } elseif ($type == 'languages') {
                    load_language($dir . '/' . $file);
                }
            }
        }
        closedir($handle);
    }
}
Пример #30
0
            $error = $vars["error"];
        }
    } else {
        $no_last = 0;
        unset($error);
        $page = $vars["page"];
    }
}
// LOAD PAGE
// If this is a login, then load the approprate module information based on wher
// the login page is.
if ($vars["login"] == "1" || $page == LOGINPAGE || !$perm->check($dir_list["perms"])) {
    $last_page = $this_page;
    $page = LOGINPAGE;
    $modulename = dirname($page);
    $module = load_module($modulename);
    require "{$modulename}/lib/ps_include.inc";
    $label = load_labels($modulename);
}
if (!$no_last) {
    $last_page = $this_page;
}
if (!$page) {
    $page = HOMEPAGE;
}
// Show the page!
$modulename = dirname($page);
$pagename = basename($page) . ".ihtml";
// Load global file
require "templates/global.inc";
// Load language file for this module