$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI));
+
if($WEBROOT!='' and $WEBROOT[0]!=='/'){
$WEBROOT='/'.$WEBROOT;
}
class OC_UTIL {
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
*
if(is_dir($SERVERROOT.'/plugins/'.$id) and is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){
$plugin=new DOMDocument();
$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;
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){
if($child->nodeType==XML_ELEMENT_NODE and $child->tagName=='include'){
$file=$SERVERROOT.'/plugins/'.$id.'/'.$child->textContent;
<?php }?>
<p class="footer">
<?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>
</div>
</div>
-<!--<p id="debug">debug</p>-->
</body></html>
<?xml version="1.0"?>
-<plugin>
- <meta>
+<plugin version='1.0'>
+ <info>
<id>ldap</id>
<name>LDAP support for ownCloud</name>
<version>0.1</version>
<licence>AGPL</licence>
<author>fabian</author>
- </meta>
- <include>lib_ldap.php</include>
+ <require>1.1</require>
+ </info>
+ <runtime>
+ <include>lib_ldap.php</include>
+ </runtime>
</plugin>
\ No newline at end of file
<?xml version="1.0"?>
-<plugin>
+<plugin version='1.0'>
<meta>
<id>music</id>
<name>Music player for ownCloud</name>
<version>0.1</version>
<licence>AGPL</licence>
<author>2010 Frank Karlitschek karlitschek@kde.org</author>
+ <require>1.1</require>
</meta>
- <include>lib_music.php</include>
+ <runtime>
+ <include>lib_music.php</include>
+ </runtime>
</plugin>