For themes, use _options = $dataArray;
return $this;
}
/**
* @param $key
* @param $default
* @return mixed
*/
public function getOption($key, $default = '')
{
return varset($this->_options[$key], $default);
}
/**
* @param $mode
* @param $cache
* @return void
*/
public function releaseCheck($mode='plugin', $cache=TRUE)
{
global $e107cache;
if(!$this->getOption('releaseUrl'))
{
return;
}
$cacheString = $mode. 'UpdateCheck';
$e107cache->CachePageMD5 = md5($cacheString.$this->getOption('curFolder').$this->getOption('curVersion', 1.0));
if(($cache==TRUE) && ($cacheData = $e107cache->retrieve($cacheString, 3600, TRUE)))
{
$mes = e107::getMessage();
$mes->addInfo($cacheData);
$e107cache->CachePageMD5 = "";
return;
}
$xml = e107::getXml();
$feed = $this->getOption('releaseUrl');
if(substr($feed,-4) == ".php")
{
$feed .= "?folder=".$this->getOption('curFolder')."&version=".$this->getOption('curVersion');
}
if($rawData = $xml -> loadXMLfile($feed, TRUE))
{
if(!$rawData[$mode][1])
{
$rawData[$mode] = $rawData;
}
$txt = "";
$lan_text = ($mode == "theme") ? ADLAN_162 : ADLAN_163;
foreach($rawData[$mode] as $val)
{
$name = $val['@attributes']['name'];
$folder = $val['@attributes']['folder'];
$version = $val['@attributes']['version'];
$url = $val['@attributes']['url'];
if(($folder == $this->getOption('curFolder')) && version_compare($version,$this->getOption('curVersion'))==1)
{
$txt .= $lan_text." ".$name ." v".$version."
";
break;
}
}
if($txt)
{
$mes->addInfo($txt);
if($cache==TRUE)
{
$e107cache->set($cacheString, $txt, TRUE);
}
$e107cache->CachePageMD5 = "";
}
}
}
/**
* @return void
*/
function checkAllPlugins()
{
$pref = e107::getPref();
$sql = e107::getDB();
if($sql ->gen("SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_releaseUrl !=''"))
{
while($row = $sql->fetch())
{
$options = array('curFolder' => $row['plugin_path'], 'curVersion' => $row['plugin_version'], 'releaseUrl' => $row['plugin_releaseUrl']);
$this->setOptions($options);
$this->releaseCheck('plugin',FALSE);
}
}
}
/**
* @return void
*/
function checkSiteTheme()
{
$curTheme = e107::getPref('sitetheme');
$curVersion = e107::getPref('sitetheme_version');
$curUrl = e107::getPref('sitetheme_releaseUrl');
$options = array('curFolder' => $curTheme, 'curVersion' => $curVersion, 'releaseUrl' => $curUrl);
$this->setOptions($options);
$this->releaseCheck('theme',FALSE);
}
/**
* @return void
*/
function listLangPacks()
{
}
}