public static function plugins_list($only_installed = false) { $plugins = array(); if ($only_installed == true) { $plugins = explode(",", OPTIONS::website('installed_plugins')); if (count($plugins) == 1 && $plugins[0] == '') { $plugins = array(); } } else { foreach (scandir(FOLDER_PLUGINS) as $f) { $temp_p = FOLDER_PLUGINS . $f; if ($f != '.' && $f != '..' && is_dir($temp_p)) { // check for elementary file if (!file_exists($temp_p . DS . "index.php")) { continue; } // include infos $p_info = drawline_getFileDoc($temp_p . DS . "index.php"); $p_info['folder'] = $f; $p_info['path'] = $temp_p . DS; $p_info['url'] = str_replace(array(FOLDER_BASE, DS), array(BASE_URL, "/"), $p_info['path']); // check if current $p_info['installed'] = DRAWLINE::plugin_installed($f); // add to list $plugins[] = $p_info; } } } // return plugins list return $plugins; }
*/ case "templates_list": TPL::assign("templates_list", DRAWLINE::templates_list()); TPL::render('v_design/templates_list'); break; /* * install a template */ /* * install a template */ case "template_install": if (isset($_GET['package'])) { $package = str_replace(array("/", ".."), "", $_GET['package']); if (file_exists(FOLDER_EXTENDER . "templates" . DS . $package . DS . "index.php")) { if (OPTIONS::set("website", "frontend_template", $package)) { TPL::message("The template was changed successfuly.", "success"); } else { TPL::message("We encounted an error. Please try again!"); } } else { TPL::message("I can't find this template on the server."); } } else { redirect(ADMIN_URL); } TPL::assign("templates_list", DRAWLINE::templates_list()); TPL::render('v_design/templates_list'); break; } }
<?php } ?> </ul> </div> <div id="sidebar-submenu" <?php if (on_link("admin_home")) { ?> style="display:none;"<?php } ?> > <?php foreach (DRAWLINE::admin_menu() as $category_name => $item) { ?> <ul class="sidebar-submenu-nav" id="submenu-<?php echo $category_name; ?> " <?php if (!on_link($item['item_active_on_link'])) { ?> style="display:none;"<?php } ?> > <?php if (isset($item['item_subitems'])) {
* SETTINGS */ DRAWLINE::admin_menu('settings', array("title" => "Settings", "icon" => "cogs", "link" => "admin_settings")); DRAWLINE::admin_menu('s_general', array("title" => "General", "icon" => "globe", "link" => "admin_settings_general", "parent" => "settings")); DRAWLINE::admin_menu('s_security', array("title" => "Security", "icon" => "shield", "link" => "admin_settings_security", "parent" => "settings")); DRAWLINE::admin_menu('s_seo', array("title" => "SEO", "icon" => "google", "link" => "admin_settings_seo", "parent" => "settings")); DRAWLINE::admin_menu('s_maintenance', array("title" => "Maintenance", "icon" => "code-fork", "link" => "admin_settings_maintenance", "parent" => "settings")); DRAWLINE::admin_menu('s_backend', array("title" => "Backend", "icon" => "paper-plane", "link" => "admin_settings_backend", "parent" => "settings")); DRAWLINE::admin_menu('s_email', array("title" => "E-mail", "icon" => "envelope-o", "link" => "admin_settings_email", "parent" => "settings")); DRAWLINE::admin_menu('s_backup', array("title" => "Backup", "icon" => "cloud", "link" => "admin_settings_backup", "parent" => "settings")); /* * EXTENDER */ DRAWLINE::admin_menu('extender', array("title" => "Extender", "icon" => "bolt", "link" => "admin_extender")); DRAWLINE::admin_menu('users_list', array("title" => "Plugins", "icon" => "plug", "link" => "admin_plugins", "parent" => "extender", "item_separator_bottom" => true)); DRAWLINE::admin_menu('marketplace', array("title" => "Marketplace", "icon" => "shopping-bag", "link" => "admin_marketplace", "parent" => "extender")); /* include template function file */ if (file_exists(FOLDER_ADMIN . "template" . DS . "functions.php")) { include FOLDER_ADMIN . "template" . DS . "functions.php"; } EVENTS::do_action("init"); /* run controller */ if (isset($_GET['c'])) { // path to controller $path = FOLDER_ADMIN . "controllers" . DS . "controller_" . $_GET['c'] . ".php"; if (file_exists($path)) { // include controller include $path; } else { // write to log [fail] LOGS::write("Fail load controller " . $_GET['c'] . ".");
if (on_admin()) { // set template path to admin TPL::dir(FOLDER_ADMIN . "template" . DS); // run admin include FOLDER_ADMIN . "index.php"; } else { // set template path to admin TPL::dir(FOLDER_EXTENDER . "templates" . DS . OPTIONS::website('frontend_template') . DS); // run frontend include FOLDER_FRONTEND . "index.php"; } // general assign TPL::assign("admin_url", ADMIN_URL); TPL::assign("base_url", BASE_URL); // run plugins foreach (DRAWLINE::plugins_list(true) as $plugin) { if (file_exists(FOLDER_PLUGINS . $plugin . DS . "index.php")) { include_once FOLDER_PLUGINS . $plugin . DS . "index.php"; EVENTS::do_action("run_plugin_" . $plugin); } else { LOGS::write("Not found plugin " . $plugin . " on the server."); } } EVENTS::do_action("before_render"); // start render if (OPTIONS::website("maintenance_mode") == '1' && !on_admin() && !PERMISSIONS::check("access_admin")) { if (TPL::check_template("page_maintenance")) { TPL::render("page_maintenance"); TPL::draw(true); } else { echo '<h1>This website is in maintenance!</h1>';
} // if base url is not defined in config file if (!defined("BASE_URL")) { define("BASE_URL", URL::get_base_url()); } /* CONNECT TO DATABASE */ $db = new MYSQLI_DB(CONFIG_DATABASE_HOST, CONFIG_DATABASE_PORT, CONFIG_DATABASE_USERNAME, CONFIG_DATABASE_PASSWORD, CONFIG_DATABASE_DBNAME); if (DEBUG_MODE == true) { $db->sql_debug = true; $db->sql_query_monitor = true; } if ($db->conn === false) { if (DEBUG_MODE == true) { die('Error initializing the database connection.'); } else { die; } } /* INITIALIZATIONS */ URL::init(); USER::init(); LINKS::init(BASE_URL, ADMINISTRATOR_URL_PATH); CONTENT::init(); DRAWLINE::init(); // set cache folder CACHE::config("cache_folder", FOLDER_CACHE); // remove $path variable if (isset($path)) { $path = NULL; unset($path); }
* uninstall plugins */ /* * uninstall plugins */ case "plugin_uninstall": $package = $_GET['package']; if (DRAWLINE::plugin_installed($package)) { if (DRAWLINE::uninstall_plugin($package)) { TPL::message("The plugin " . $package . " was succesfully uninstalled!", "success"); } else { if (empty(TPL::get_messages('error'))) { TPL::message("We encounted some errors during the uninstallition of " . $package . ". Please try again!"); } } } else { TPL::message("This plugin is not installed. You can't uninstall an uninstalled plugin :)"); } TPL::assign("plugins", DRAWLINE::plugins_list()); TPL::render('v_extender/extender_plugins'); break; /* * drawline marketplace */ /* * drawline marketplace */ case "marketplace": break; } }