コード例 #1
0
 public static function uninstall_plugin($plugin_folder)
 {
     // check already instaled
     if (!DRAWLINE::plugin_installed($plugin_folder)) {
         // write log
         LOGS::write("Plugin <" . $plugin_folder . "> is not installed.");
         // return false
         return false;
     } else {
         // check if plugin exists
         if (!file_exists(FOLDER_PLUGINS . $plugin_folder . DS . "index.php")) {
             // write error
             LOGS::write("There is no plugin in " . FOLDER_PLUGINS . $plugin_folder . ".");
             // return
             return false;
         }
         // call plugin
         include FOLDER_PLUGINS . $plugin_folder . DS . "index.php";
         // check current number of errors, before installing plugin
         $_b_errors = count(LOGS::get_errors());
         // do action for installing plugin
         EVENTS::do_action("uninstall_plugin_" . $plugin_folder);
         // check current number of errors, after installed plugin
         $_a_errors = count(LOGS::get_errors());
         // if no errors
         if (empty(TPL::get_messages('error')) && $_b_errors >= $_a_errors) {
             // delete from installed plugins
             $instaled = explode(",", OPTIONS::website('installed_plugins'));
             if (($key = array_search($plugin_folder, $instaled)) !== false) {
                 unset($instaled[$key]);
             }
             OPTIONS::set('website', 'installed_plugins', implode(",", $instaled));
             // return success
             return true;
         } else {
             // some problems
             LOGS::write("Some problems during the plugin uninstall.");
             // return false
             return false;
         }
     }
 }
コード例 #2
0
function show_404()
{
    // do programmed events
    EVENTS::do_action("on_error_404");
    // change header status
    header("HTTP/1.0 404 Not Found");
    // change title if isn't setted
    if (TPL::thing("head", "title") == '') {
        TPL::thing("head", "title", "Error 404 | Page not found");
    }
    // set render and draw
    if (TPL::check_template("page_404")) {
        TPL::render("page_404");
        TPL::draw(true);
    } else {
        echo "<h1>Error 404! Not found</h1>";
    }
}
コード例 #3
0
             $page['content_slug'] = $_POST['page_slug'] == '' ? slugify($_POST['page_title']) : $_POST['page_slug'];
             $page['content_visible'] = $_POST['page_visible'];
             // update content
             if (CONTENT::set_content($page, $_GET['id']) !== false) {
                 // show success message
                 TPL::message('Continutul a fost actualizat cu succes!', 'success');
             }
         }
         // assign data
         TPL::assign("content", CONTENT::get());
         TPL::assign('categories', CONTENT::get_categories());
         // set render
         TPL::render('v_pages/page_types/page_text');
     });
     EVENTS::add_action("before_render", function () {
         EVENTS::do_action("edit_page_" . CONTENT::get('content_type'));
     });
     break;
     /*
      * delete page
      */
 /*
  * delete page
  */
 case "delete":
     $page_id = $db->real_escape($_GET['id']);
     $del = $db->query("DELETE FROM dl_content WHERE content_id = '{$page_id}'");
     redirect(LINKS::get("admin_pages"));
     break;
 default:
     die("Undefined action");
コード例 #4
0
ファイル: index.php プロジェクト: double-web/drawline
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'] . ".");
        // show error 404
        die("Error 404");
    }
}
TPL::assign('_admin_ob', ob_get_clean());
コード例 #5
0
ファイル: index.php プロジェクト: double-web/drawline
include FOLDER_WEBAPP . "services" . DS . "service_minify.php";
// service SITEMAP
include FOLDER_WEBAPP . "services" . DS . "service_sitemap.php";
// service THUMBS
include FOLDER_WEBAPP . "services" . DS . "service_thumbs.php";
URL::route("/", function () {
    TPL::render("pages/page_home");
});
if (CONTENT::is_page()) {
    TPL::thing("head", "title", CONTENT::$current['content_title']);
    EVENTS::add_action("view_page_page_text", function () {
        TPL::assign("content", CONTENT::get());
        TPL::render("pages/page_text");
    });
    EVENTS::add_action("before_render", function () {
        EVENTS::do_action("view_page_" . CONTENT::get("content_type"));
    });
    URL::routed(true);
}
if (!URL::routed()) {
    $request = URL::get_request();
    if (substr($request, -1) == '/') {
        $request = substr($request, 0, -1);
    }
    $not_allowed = array("home", "text", "404", "maintenance");
    if (TPL::check_template("page_" . $request) && !in_array($request, $not_allowed)) {
        TPL::render("page_" . $request);
        URL::routed(true);
    }
}
//LOGS::export("html", true);
コード例 #6
0
ファイル: index.php プロジェクト: double-web/drawline
}
// 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>';
    }
} elseif (TPL::render() != "") {
    TPL::draw(true);
} else {
    if (!URL::routed()) {
        show_404();
    }
}
EVENTS::do_action("after_render");
//print_array(LOGS::export("html"));