コード例 #1
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();
}
コード例 #2
0
        $tplid = $_GET['tplid'];
    } else {
        // Write text to standard output
        header("Content-type: text/plain");
        echo "Error in creating template\n";
    }
} else {
    // Write text to standard output
    header("Content-type: text/plain");
    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
コード例 #3
0
function list_templatevars()
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    $result = db_multirec_read_all_templatevars();
    debug_msg("Query Result: {$result}", 5);
    $num_records = count($result);
    debug_msg("Number of records: {$num_records}", 4);
    if ($num_records > 0) {
        html_header("List Templates Variables");
        ?>
<div align="center">
<h1>Template Variables Data</h1>
<br />
<table width="100%" cellpadding="0" align="center">
<tr>
<th colspan="2" class="list"></th>		<!-- Edit/Delete -->
<th class="list">Name</th>					<!-- Name -->
<th class="list">Value</th>				<!-- Value -->
</tr>
<?php 
        for ($i = 0; $i < $num_records; $i++) {
            $row = $result[$i];
            if ($row == '') {
                echo "Cannot seek to row {$record}:\n";
                continue;
            }
            ?>
<tr>
<td class="center-list">
&nbsp;
<a href="templatevars.php?action=edit&amp;id=<?php 
            echo $row['id'];
            ?>
" onmouseover="window.status='Edit';return true" onmouseout="window.status='';return true"><img src="images/edit.png" alt="Edit" border="0" /></a>
&nbsp;
</td>
<td class="center-list">
&nbsp;
<a href="templatevars.php?action=delete&amp;id=<?php 
            echo $row['id'];
            ?>
" onmouseover="window.status='Delete';return true" onmouseout="window.status='';return true"><img src="images/delete.png" alt="Delete" border="0" /></a>
&nbsp;
</td>
<td class="left-list">
<?php 
            echo $row['name'];
            ?>
</td>
<td class="left-list">
<?php 
            echo $row['value'];
            ?>
</td>
</tr>
<?php 
        }
        ?>
</table>
<br />
<table width="100%">
<tr>
<td class="left">
<a href="templatevars.php?action=add" onmouseover="window.status='Add a new template';return true" onmouseout="window.status='';return true"><img src="images/add.png" alt="Add" border="0" /> Add new template variable</a>
</td>
</tr>
</table>
</div>
<?php 
    }
    html_footer();
}