comply with updated version of the plugin.xml syntax
This commit is contained in:
parent
98e49c7552
commit
2a78209728
|
@ -40,6 +40,7 @@ $SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
|
||||||
$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI));
|
$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($WEBROOT!='' and $WEBROOT[0]!=='/'){
|
if($WEBROOT!='' and $WEBROOT[0]!=='/'){
|
||||||
$WEBROOT='/'.$WEBROOT;
|
$WEBROOT='/'.$WEBROOT;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +129,14 @@ $loginresult=OC_USER::loginlisener();
|
||||||
class OC_UTIL {
|
class OC_UTIL {
|
||||||
public static $scripts=array();
|
public static $scripts=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the current installed version of ownCloud
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getVersion(){
|
||||||
|
return array(1,0,60);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add a javascript file
|
* add a javascript file
|
||||||
*
|
*
|
||||||
|
|
|
@ -34,9 +34,30 @@ class OC_PLUGIN{
|
||||||
if(is_dir($SERVERROOT.'/plugins/'.$id) and is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){
|
if(is_dir($SERVERROOT.'/plugins/'.$id) and is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){
|
||||||
$plugin=new DOMDocument();
|
$plugin=new DOMDocument();
|
||||||
$plugin->load($SERVERROOT.'/plugins/'.$id.'/plugin.xml');
|
$plugin->load($SERVERROOT.'/plugins/'.$id.'/plugin.xml');
|
||||||
|
if($plugin->documentElement->getAttribute('version')!=='1.0'){ //we only support this for now
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$minVersion=$plugin->getElementsByTagName('require');
|
||||||
|
if($minVersion->length>0){
|
||||||
|
$minVersion=$minVersion->item(0)->textContent;
|
||||||
|
$minVersion=explode('.',$minVersion);
|
||||||
|
$version=OC_UTIL::getVersion();
|
||||||
|
$roundTo=count($minVersion);
|
||||||
|
while(count($version)>$roundTo){
|
||||||
|
if($version[count($version)-1]>=50){
|
||||||
|
$version[count($version)-2]++;
|
||||||
|
}
|
||||||
|
unset($version[count($version)-1]);
|
||||||
|
}
|
||||||
|
for($i=0;$i<count($minVersion);$i++){
|
||||||
|
if($version[$i]<$minVersion[$i]){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$pluginId=$plugin->getElementsByTagName('id')->item(0)->textContent;
|
$pluginId=$plugin->getElementsByTagName('id')->item(0)->textContent;
|
||||||
if($pluginId==$id){//sanity check for plugins installed in the wrong folder
|
if($pluginId==$id){//sanity check for plugins installed in the wrong folder
|
||||||
$childs=$plugin->documentElement->childNodes;
|
$childs=$plugin->getElementsByTagName('runtime')->item(0)->childNodes;
|
||||||
foreach($childs as $child){
|
foreach($childs as $child){
|
||||||
if($child->nodeType==XML_ELEMENT_NODE and $child->tagName=='include'){
|
if($child->nodeType==XML_ELEMENT_NODE and $child->tagName=='include'){
|
||||||
$file=$SERVERROOT.'/plugins/'.$id.'/'.$child->textContent;
|
$file=$SERVERROOT.'/plugins/'.$id.'/'.$child->textContent;
|
||||||
|
|
|
@ -12,10 +12,10 @@ Hint: Mount it via webdav like this: <a href="webdav://<?php echo($_SERVER["HTTP
|
||||||
<?php }?>
|
<?php }?>
|
||||||
<p class="footer">
|
<p class="footer">
|
||||||
<?php
|
<?php
|
||||||
echo('<a href="http://ownCloud.org">ownCloud</a> - 1.0 RC 1');
|
$version=implode('.',OC_UTIL::getVersion());
|
||||||
|
echo('<a href="http://ownCloud.org">ownCloud</a> - '.$version);
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<p id="debug">debug</p>-->
|
|
||||||
</body></html>
|
</body></html>
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<plugin>
|
<plugin version='1.0'>
|
||||||
<meta>
|
<info>
|
||||||
<id>ldap</id>
|
<id>ldap</id>
|
||||||
<name>LDAP support for ownCloud</name>
|
<name>LDAP support for ownCloud</name>
|
||||||
<version>0.1</version>
|
<version>0.1</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>fabian</author>
|
<author>fabian</author>
|
||||||
</meta>
|
<require>1.1</require>
|
||||||
<include>lib_ldap.php</include>
|
</info>
|
||||||
|
<runtime>
|
||||||
|
<include>lib_ldap.php</include>
|
||||||
|
</runtime>
|
||||||
</plugin>
|
</plugin>
|
|
@ -1,11 +1,14 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<plugin>
|
<plugin version='1.0'>
|
||||||
<meta>
|
<meta>
|
||||||
<id>music</id>
|
<id>music</id>
|
||||||
<name>Music player for ownCloud</name>
|
<name>Music player for ownCloud</name>
|
||||||
<version>0.1</version>
|
<version>0.1</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>2010 Frank Karlitschek karlitschek@kde.org</author>
|
<author>2010 Frank Karlitschek karlitschek@kde.org</author>
|
||||||
|
<require>1.1</require>
|
||||||
</meta>
|
</meta>
|
||||||
<include>lib_music.php</include>
|
<runtime>
|
||||||
|
<include>lib_music.php</include>
|
||||||
|
</runtime>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<plugin>
|
<plugin version='1.0'>
|
||||||
<meta>
|
<meta>
|
||||||
<id>test</id>
|
<id>test</id>
|
||||||
<name>Test plugin</name>
|
<name>Test plugin</name>
|
||||||
<version>0.1</version>
|
<version>0.1</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>2010 Frank Karlitschek karlitschek@kde.org</author>
|
<author>2010 Frank Karlitschek karlitschek@kde.org</author>
|
||||||
|
<require>1.1</require>
|
||||||
</meta>
|
</meta>
|
||||||
<include>lib_test.php</include>
|
<runtime>
|
||||||
|
<include>lib_test.php</include>
|
||||||
|
</runtime>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue