$this->status = 'graphonly';
}
elseif (isset($iinfo['file'])) {
- $this->rrd_file = (($iinfo['file']{0} != '/')?$this->basedir:'').$iinfo['file'];
+ $this->rrd_file = (($iinfo['file'][0] != '/')?$this->basedir:'').$iinfo['file'];
$this->basename = basename((substr($this->rrd_file, -4) == '.rrd')?substr($this->rrd_file, 0, -4):$this->rrd_file);
}
elseif (!is_null($conf_id) && file_exists($conf_id.'.rrd')) {
- $this->rrd_file = (($iinfo['file']{0} != '/')?$this->basedir:'').$conf_id.'.rrd';
+ $this->rrd_file = (($iinfo['file'][0] != '/')?$this->basedir:'').$conf_id.'.rrd';
$this->basename = $conf_id;
}
else {
$fname = str_replace('%t', $timeframe, $fname);
$fname = str_replace('%f', $fmt_ext, $fname);
if (substr($fname, -strlen($fmt_ext)) != $fmt_ext) { $fname .= $fmt_ext; }
- if (isset($gconf['path']) && ($fname{0} != '/')) { $fname = $gconf['path'].'/'.$fname; }
- if ($fname{0} != '/') { $fname = $this->basedir.$fname; }
+ if (isset($gconf['path']) && ($fname[0] != '/')) { $fname = $gconf['path'].'/'.$fname; }
+ if ($fname[0] != '/') { $fname = $this->basedir.$fname; }
$fname = str_replace('//', '/', $fname);
$graphrows = array(); $specialrows = array(); $gC = 0;
}
$graph_cmd = $this->rrdtool_bin.' graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
- if (!is_writable($fname)) {
+ if ((file_exists($fname) && !is_writable($fname)) ||
+ (!file_exists($fname) && !is_writable(dirname($fname)))) {
trigger_error($this->rrd_file.' - graph file not writable: '.$fname, E_USER_WARNING);
return 'command:'.$graph_cmd."\n\n".'unwritable file: '.$fname;
}
$snames = array(); $s_exclude = array(); $sfiles = array();
if (isset($pconf['index_ids'])) {
foreach (explode(',', $pconf['index_ids']) as $iid) {
- if ($iid{0} == '-') { $s_exclude[] = substr($iid, 1); }
+ if ($iid[0] == '-') { $s_exclude[] = substr($iid, 1); }
else { $snames[] = $iid; }
}
}