Example #1
0
function CreateMenu($path, $depth, $template, $title)
{
    $TPL = new LTemplate();
    include_once GC_IPATH . "_base/site-index.php";
    $AllLinks = array();
    reset($SIndex);
    while ($SSite = current($SIndex)) {
        if (substr(key($SIndex), 0, strlen($path)) == $path) {
            $Link['Name'] = extractName(key($SIndex));
            $Link['File'] = GC_WEBPATH . 'show.php?p=' . key($SIndex);
            $AllLinks[] = $Link;
        }
        next($SIndex);
    }
    $TPL->set('Title', $title);
    $TPL->setBlock('Links', $AllLinks);
    $TPL->render($template);
}
Example #2
0
if ($Step == "2") {
    // allgemeine settings
    //include blocks from template config
    include_once GC_IPATH . 'templates/' . $_POST['Template'] . '/config.php';
    $TPLBlocks = explode(';', $TemplateSettings);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//Step 3: Save new Site
if ($Step == "3") {
    //get Template Settings
    include_once GC_IPATH . 'templates/' . $_POST['Template'] . '/config.php';
    $TPLBlocks = explode(';', $TemplateSettings);
    include_once GC_IPATH . 'functions.php';
    include GC_IPATH . '_base/site-index.php';
    //filename
    $filename = extractName($_POST['path']);
    $filehandle = fopen(GC_IPATH . "_base/sites/" . dec2hex($SLastID + 1) . '-' . $filename . '.php', "w");
    //write header
    fwrite($filehandle, "<?php \r\n");
    fwrite($filehandle, '$SSettings = array();' . "\r\n");
    fwrite($filehandle, '$SBlocks = array();' . "\r\n");
    //write settings
    fwrite($filehandle, '$SSettings' . "['template'] = '" . $_POST['Template'] . '/standard.tpl' . "'; \r\n");
    fwrite($filehandle, '$SSettings' . "['title'] = '" . $_POST['title'] . "'; \r\n");
    fwrite($filehandle, '$SSettings' . "['path'] = '" . $_POST['path'] . "'; \r\n");
    //write blocks
    foreach ($TPLBlocks as $BlockEntry) {
        if (empty($_POST[$BlockEntry])) {
            continue;
        }
        fwrite($filehandle, '$SBlocks' . "['" . $BlockEntry . "'] = '" . $_POST[$BlockEntry] . "'; \r\n");
Example #3
0
 function convertChangelog($mods, $version)
 {
     //
     $added = array();
     $updated = array();
     $removed = array();
     $new = array();
     foreach ($mods as &$mod) {
         $arr = explode(' ', trim($mod));
         $type = substr($arr[0], 1);
         if ($type == "Added") {
             $added[] = extractName($mod);
         } elseif ($type == "Updated") {
             $updated[] = extractName($mod, true);
         } elseif ($type == "Removed") {
             $removed[] = extractName($mod);
         }
     }
     $result = '';
     if (count($updated) > 3) {
         shuffle($updated);
         $result .= 'Updated ' . formatMod($updated[0], $version) . ', ' . formatMod($updated[1], $version) . ', and ' . (string) (count($updated) - 2) . ' other mods... ';
     } elseif (count($updated) > 1) {
         $last = array_pop($updated);
         $addedlist = array();
         foreach ($updated as &$mod) {
             $addedlist[] = formatMod($mod, $version);
         }
         $result .= 'Updated ' . implode(', ', $addedlist) . ' and ' . formatMod($last, $version) . '. ';
     } elseif (count($updated) == 1) {
         $result .= 'Updated ' . formatMod($updated[0], $version) . '. ';
     }
     if (count($added) > 3) {
         shuffle($added);
         $result .= 'Added ' . formatMod($added[0], $version) . ', ' . formatMod($added[1], $version) . ', and ' . (string) (count($added) - 2) . ' other mods... ';
     } elseif (count($added) > 1) {
         $last = array_pop($added);
         $addedlist = array();
         foreach ($added as &$mod) {
             $addedlist[] = formatMod($mod, $version);
         }
         $result .= 'Added ' . implode(', ', $addedlist) . ' and ' . formatMod($last, $version) . '. ';
     } elseif (count($added) == 1) {
         $result .= 'Added ' . formatMod($added[0], $version) . '. ';
     }
     if (count($removed) > 3) {
         shuffle($removed);
         $result .= 'Removed ' . $removed[0] . ', ' . $removed[1] . ', and ' . (string) (count($removed) - 2) . ' other mods... ';
     } elseif (count($removed) > 1) {
         $last = array_pop($removed);
         $result .= 'Removed ' . implode(', ', $removed) . ' and ' . $last . '. ';
     } elseif (count($removed) == 1) {
         $result .= 'Removed ' . $removed[0] . '. ';
     }
     return $result;
 }
Example #4
0
}
$gram = file($argv[1]);
$temp = file($argv[2]);
foreach ($temp as $line) {
    $line = str_replace("~~~FILENAME~~~", $argv[3], $line);
    if (strstr($line, "~~~PUTSTUFFHERE~~~")) {
        $first = true;
        foreach ($gram as $gl) {
            if (strstr($gl, "::=")) {
                // head
                if (!$first) {
                    $outp[] = "</pre>\n</div>\n";
                } else {
                    $first = false;
                }
                $name = extractName($gl);
                $outp[] = "<div id=\"{$name}\">\n<pre>\n";
                $gl = htmlspecialchars($gl);
                $gl = preg_replace("/&lt;([-a-z]+)&gt;/i", "<a href=\"javascript:display('\$1')\">\$0</a>", $gl);
                $outp[] = "<b><a name=\"{$name}\">" . $gl . "</a></b>\n";
            } else {
                // body
                $gl = htmlspecialchars($gl);
                $gl = preg_replace("/&lt;([-a-z]+)&gt;/i", "<a href=\"javascript:display('\$1')\">\$0</a>", $gl);
                $outp[] = $gl;
            }
        }
    } else {
        $outp[] = $line;
    }
}