Example #1
0
    echo "Error in creating template\n";
}
// Set System template variables
$NOW = date('r');
$S9YCONF = S9YCONF_PROGRAM_NAME . ' v' . S9YCONF_VERSION;
// Set template variables
$templatevars = db_multirec_read_all_templatevars();
// Set specific Blog template variables
$blogdata = db_read_blogdata($blogid);
$BLOGID = $blogid;
$BLOGNAME = $blogdata['name'];
$BLOGPATH = $blogdata['blog_path'];
$BLOGUSER = $blogdata['user'];
$BLOGURL = $blogdata['url'];
// Set specific template variables
$templatedata = db_read_templates($tplid);
$TEMPLATE_ID = $templatedata['id'];
$TEMPLATE_NAME = $templatedata['name'];
$TEMPLATE_DESCRIPTION = $templatedata['description'];
// Template contents
$template_contents = html_entity_decode($templatedata['template'], ENT_COMPAT, LANG_CHARSET);
// Expand the template variables recursively
$templatevars = expand_templatevars($templatevars);
// Insert system template variables
$template_contents = str_replace('{NOW}', $NOW, $template_contents);
$template_contents = str_replace('{S9YCONF}', $S9YCONF, $template_contents);
/*
$template_contents = str_replace('{SUDO}', $SUDO, $template_contents);
$template_contents = str_replace('{LIBDIR}', $LIBDIR, $template_contents);
$template_contents = str_replace('{S9YDIR}', $S9YDIR, $template_contents);
$template_contents = str_replace('{WWWGROUP}', $WWWGROUP, $template_contents);
Example #2
0
function template_edit($id)
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    html_header("Edit Template Data");
    $result = db_read_templates($id);
    $name = $result['name'];
    $description = $result['description'];
    $template = html_entity_decode($result['template'], ENT_COMPAT, LANG_CHARSET);
    ?>
<div align="center">
<h1>Edit Template</h1>
<br />

<?php 
    template_form('update', $id, $name, $description, $template);
    ?>
</div>
<?php 
    html_footer();
}
Example #3
0
function blogdata_view_all($tplid = '')
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    // Create navigation form
    // Read template data to create selection list
    $result = db_multirec_read_all_templates();
    debug_msg("Query Result: {$result}", 5);
    $num_records = count($result);
    debug_msg("Number of records: {$num_records}", 4);
    if ($num_records > 0) {
        $tplselect = '';
        foreach ($result as $row) {
            if ($row['id'] == $tplid) {
                $tplselect = $tplselect . '<option value="' . $row['id'] . '" selected>' . $row['name'] . '</option>';
            } else {
                $tplselect = $tplselect . '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
            }
        }
    }
    $navform = '<form action="blogdata.php" method="post"><select name="tplid">' . $tplselect . '</select><br /><br /><button name="action" value="viewall" type="submit">View Template Output</button><br /><br /><button name="action" value="back" type="submit">Back to Blog Data</button></form>';
    // Set System template variables
    $NOW = date('r');
    $S9YCONF = S9YCONF_PROGRAM_NAME . ' v' . S9YCONF_VERSION;
    // Set template variables
    $templatevars = db_multirec_read_all_templatevars();
    // Set specific template variables
    $templatedata = db_read_templates($tplid);
    $TEMPLATE_ID = $templatedata['id'];
    $TEMPLATE_NAME = $templatedata['name'];
    $TEMPLATE_DESCRIPTION = $templatedata['description'];
    // Template contents
    $template_contents = html_entity_decode($templatedata['template'], ENT_COMPAT, LANG_CHARSET);
    // Expand the template variables recursively
    $templatevars = expand_templatevars($templatevars);
    // Insert system template variables
    $template_contents = str_replace('{NOW}', $NOW, $template_contents);
    $template_contents = str_replace('{S9YCONF}', $S9YCONF, $template_contents);
    /*
    	$template_contents = str_replace('{SUDO}', $SUDO, $template_contents);
    	$template_contents = str_replace('{LIBDIR}', $LIBDIR, $template_contents);
    	$template_contents = str_replace('{S9YDIR}', $S9YDIR, $template_contents);
    	$template_contents = str_replace('{WWWGROUP}', $WWWGROUP, $template_contents);
    	$template_contents = str_replace('{WWWUSER}', $WWWUSER, $template_contents);
    */
    foreach ($templatevars as $tplvar) {
        $template_contents = str_replace('{' . $tplvar['name'] . '}', html_entity_decode($tplvar['value'], ENT_COMPAT, LANG_CHARSET), $template_contents);
    }
    // Insert specific template template variables
    $template_contents = str_replace('{TPLID}', $TEMPLATE_ID, $template_contents);
    $template_contents = str_replace('{TPLNAME}', $TEMPLATE_NAME, $template_contents);
    $template_contents = str_replace('{TPLDESC}', $TEMPLATE_DESCRIPTION, $template_contents);
    html_header("S9Y_Conf Output of the template '{$TEMPLATE_DESCRIPTION}' for all blogs");
    echo $navform . "<br />";
    echo "Output of the template '" . $TEMPLATE_NAME . "' for all blogs<br />";
    echo "<br />";
    echo "Click <a href=\"tplfileall.php?tplid={$tplid}\" onmouseover=\"window.status='Click to download template contents';return true\" onmouseout=\"window.status='';return true\">here</a> to download";
    echo '<hr /><div class="left">';
    $result = db_select_all_blogdata();
    while ($row = mysql_fetch_assoc($result)) {
        $template_temp = $template_contents;
        // Set specific Blog template variables
        $BLOGID = $row['uid'];
        $BLOGNAME = $row['name'];
        $BLOGPATH = $row['blog_path'];
        $BLOGUSER = $row['user'];
        $BLOGURL = $row['url'];
        // Insert specific blog template variables
        $template_temp = str_replace('{BLOGID}', $BLOGID, $template_temp);
        $template_temp = str_replace('{BLOGNAME}', $BLOGNAME, $template_temp);
        $template_temp = str_replace('{BLOGPATH}', $BLOGPATH, $template_temp);
        $template_temp = str_replace('{BLOGUSER}', $BLOGUSER, $template_temp);
        $template_temp = str_replace('{BLOGURL}', $BLOGURL, $template_temp);
        echo nl2br(htmlentities($template_temp, ENT_COMPAT, LANG_CHARSET));
    }
    echo "</div><hr />";
    echo "Click <a href=\"tplfile.php?tplid={$tplid}\" onmouseover=\"window.status='Click to download template contents';return true\" onmouseout=\"window.status='';return true\">here</a> to download";
    echo "<br />";
    echo "<br />" . $navform . "<br />";
    html_footer();
}