Example #1
0
function ecFileDelete($file)
{
    global $ecFile;
    if (file_exists($file)) {
        unlink($file);
        return true;
    } else {
        $message = 'Can not delete file: ' . $file;
        ecError($ecFile, $message);
        return false;
    }
}
Example #2
0
if (!ecGetAccessLevel($ecLocal['plugin'], $ecLocal['site'])) {
    $ecLocal['plugin'] = 'errors';
    $ecLocal['site'] = '403';
}
$tmpReplaces['sub:view'] = 'plugins/' . $ecLocal['plugin'] . '/' . $ecLocal['site'] . '.php';
// Replace Vars
preg_match_all("/{(?!sub)(.*?)\\:(.*?)}/Sis", $html, $tmpVars);
$count = count($tmpVars[0]);
$i = 0;
while (!empty($count)) {
    $tmpVars[0][$i] = str_replace('{', '', $tmpVars[0][$i]);
    $tmpVars[0][$i] = str_replace('}', '', $tmpVars[0][$i]);
    $file = 'plugins/' . $tmpVars[1][$i] . '/' . $tmpVars[2][$i] . '.php';
    if (!file_exists($file) || !in_array($tmpVars[1][$i], $ecLocal['pluginsList'])) {
        $message = 'File not found: ' . $file;
        ecError($ecFile, $message);
    } else {
        if (ecGetAccessLevel($tmpVars[1][$i], $tmpVars[2][$i])) {
            $tmpReplaces[$tmpVars[0][$i]] = $file;
        } else {
            $html = str_replace('{' . $tmpVars[0][$i] . '}', '', $html);
        }
    }
    $i++;
    $count--;
}
// Refresh Paths
$refreshImages = "=link href\\=\"(?!http)(.*?)\"=si";
$html = preg_replace($refreshImages, "link href=\"themes/" . $ecLocal['theme'] . "/\\1\"", $html);
$refreshBackgrounds = "=background\\=\"(?!http)(.*?)\"=si";
$html = preg_replace($refreshBackgrounds, "background=\"themes/" . $ecLocal['theme'] . "/\\1\"", $html);
Example #3
0
    } else {
        $ecLocal['site'] = 'list';
    }
} else {
    $ecLocal['plugin'] = $ecSettings['system']['defaultPlugin'];
    $ecLocal['site'] = $ecSettings['system']['defaultSite'];
}
// Set Contentwidth
$contentTyp = $ecSettings['system']['contentTyp'] == 1 ? '%' : 'px';
$ecLocal['tableWidth'] = $ecSettings['system']['contentWidth'] . $contentTyp;
// Plugins
$ecPluginsData = dbSelect('pluginsId,pluginsPath', 1, 'plugins');
while ($plugins = mysql_fetch_object($ecPluginsData)) {
    $ecLocal['pluginsList'][$plugins->pluginsId] = $plugins->pluginsPath;
    if ($plugins->pluginsPath == $ecLocal['plugin']) {
        $pluginRegistred = 1;
    }
}
// Check Plugin & Site
if (isset($pluginRegistred)) {
    $viewPath = 'plugins/' . $ecLocal['plugin'] . '/' . $ecLocal['site'] . '.php';
    if (!file_exists($viewPath)) {
        ecError($ecFile, 'File not found ' . $viewPath);
        $ecLocal['plugin'] = 'errors';
        $ecLocal['site'] = '404';
    }
} else {
    ecError($ecFile, 'Plugin not registred: ' . $ecLocal['plugin']);
    $ecLocal['plugin'] = 'errors';
    $ecLocal['site'] = '404';
}
Example #4
0
function ecTemplate($plugin, $site, $part = 'default', $language = 0)
{
    global $ecSettings, $ecFile, $ecLocal, $ecUser;
    // Language
    $language = empty($language) ? $site : $language;
    $ecLang = ecGetLang($plugin, $language);
    // Start parse
    $templatePath = 'templates/' . $ecLocal['template'] . '/' . $plugin . '/' . $site . '.html';
    if (file_exists($templatePath)) {
        $template = implode('', file($templatePath));
        $template = str_replace('{ecTableWidth}', $ecLocal['tableWidth'], $template);
        #########################
        if ($part != 'default') {
            preg_match_all("/\\<\\!\\+" . $part . "\\>(.*?)\\<\\!\\-" . $part . "/Sis", $template, $tmpPart);
            if (isset($tmpPart[1][0])) {
                $template = $tmpPart[1][0];
            } else {
                $template = '';
                ecError($ecFile, 'Templateerror: Part "' . $part . '" not found');
            }
        } else {
            $template = preg_replace("/\\{\\!(.*?)\\}/is", '', $template);
        }
        #########################
        preg_match_all("={(.)(.*?)}=si", $template, $tmpVars);
        $count = count($tmpVars[0]);
        $i = 0;
        while (!empty($count)) {
            if ($tmpVars[1][$i] == '?') {
                if (isset($ecLang[$tmpVars[2][$i]])) {
                    $template = str_replace($tmpVars[0][$i], $ecLang[$tmpVars[2][$i]], $template);
                } else {
                    $template = str_replace($tmpVars[0][$i], 'not defined!', $template);
                    ecError($ecFile, 'Languagevar ' . $tmpVars[0][$i] . ' isn`t defined');
                }
            } elseif ($tmpVars[1][$i] == '@') {
                if (isset($ecLang[$tmpVars[2][$i]])) {
                    $template = str_replace($tmpVars[0][$i], ec_bbcode($ecLang[$tmpVars[2][$i]]), $template);
                } else {
                    $template = str_replace($tmpVars[0][$i], 'not defined!', $template);
                    ecError($ecFile, 'Languagevar ' . $tmpVars[0][$i] . ' isn`t defined');
                }
            } elseif ($tmpVars[1][$i] == '$') {
                if (isset($GLOBALS[$tmpVars[2][$i]])) {
                    $template = str_replace($tmpVars[0][$i], $GLOBALS[$tmpVars[2][$i]], $template);
                } else {
                    $template = str_replace($tmpVars[0][$i], '', $template);
                }
            }
            $i++;
            $count--;
        }
        #########################
        preg_match_all("={icon:(.*?)}=si", $template, $tmpVarsIcons);
        $count = count($tmpVarsIcons[0]);
        $i = 0;
        while (!empty($count)) {
            $iconsdata = preg_split('=:=si', $tmpVarsIcons[1][$i]);
            if (file_exists('icons/' . $ecLocal['icons'] . '/' . $iconsdata[0])) {
                $icon = 'icons/' . $ecLocal['icons'] . '/' . $iconsdata[0] . '/' . $iconsdata[1] . '.png';
                $icon = file_exists($icon) ? $icon : 'icons/' . $ecLocal['icons'] . '/' . $iconsdata[0] . '/default.png';
            } else {
                $icon = '';
                $message = 'Iconfolder not found: icons/' . $ecLocal['icons'] . '/' . $iconsdata[0] . '/';
                ecError($ecFile, $message);
            }
            $template = str_replace($tmpVarsIcons[0][$i], $icon, $template);
            $i++;
            $count--;
        }
        #########################
        // End parse
        return $template;
    } else {
        $templatePath = 'templates/' . $ecLocal['template'] . '/' . $plugin . '/' . $site;
        $message = 'Template (' . $templatePath . '.html) nicht vorhanden';
        $message2 = 'Template (' . $site . '.html) nicht vorhanden';
        ecError($ecFile, $message);
        return $message2;
    }
}