X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw_sourceml.php;h=66392d4992366eeea886c41fd9d0677f1df4d00c;hb=refs%2Ftags%2Fsourceml.1.4.1;hp=740a25a9221db7f5a5ff67f69b2714ba024a2ccd;hpb=8bc0397daaff51b3810ce9860686147f2bcd57d4;p=mw_sourceml diff --git a/mw_sourceml.php b/mw_sourceml.php index 740a25a..66392d4 100644 --- a/mw_sourceml.php +++ b/mw_sourceml.php @@ -2,15 +2,44 @@ class mw_sourceml extends mw_plugin{ - function title(){ + public function title(){ return "SourceML"; } - function description(){ + public function description(){ return "Publication de sources musicales"; } - function init($env){ + public function loaded($env){ + $AUTO_ACTIVATE = false; + if(!$env->bdd("sgbd") || ($plugin_data = $env->plugin_data("mw_sourceml")) === false) return; + if(!isset($plugin_data["installed"]) || !$plugin_data["installed"]){ + $data = $env->data(); + $sgbd = $data->sgbd(); + if($env->bdd("sgbd") == "xml"){ + $AUTO_ACTIVATE = $sgbd->data_exists("sources"); + } + else{ + $AUTO_ACTIVATE = $sgbd->table_exists("#--sources"); + } + } + if($AUTO_ACTIVATE){ + if( + $env->set_plugin_data( + "mw_sourceml", + array( + "installed" => true, + "enabled" => true, + "priorite" => 0 + ) + ) + ){ + $env->load_plugin("mw_sourceml"); + } + } + } + + public function init($env){ $env->set_link("admin/sourceml", $env->url("admin/sourceml"), "SourceML", 50); $env->set_link("admin/sourceml/licences", $env->url("admin/licences"), "Licences", 10); @@ -34,7 +63,7 @@ return true; } - function nb_invitations($env){ + public function nb_invitations($env){ if($user = $env->user()){ $data = $env->data(); if($groupes = $data->groupes($user["id"])){ @@ -46,13 +75,9 @@ return 0; } - function enable($env){ + public function enable($env){ $data = $env->data(); - if( - ($data->config("site_name") == "mtweb") - && (($plugins = $env->plugins()) !== false) - && (count($plugins) == 1) - ){ + if($data->config("site_name") == "mtweb"){ $data->set_config("site_name", "SourceML"); } return true; @@ -60,17 +85,13 @@ function disable($env){ $data = $env->data(); - if( - ($data->config("site_name") == "SourceML") - && (($plugins = $env->plugins()) !== false) - && (count($plugins) == 1) - ){ + if($data->config("site_name") == "SourceML"){ $data->set_config("site_name", "mtweb"); } return true; } - function install($env){ + public function install($env){ $data = $env->data(); $res = true; if( @@ -98,7 +119,7 @@ return $res; } - function uninstall($env){ + public function uninstall($env){ $data = $env->data(); $res = true; if(