ERROR!';
echo '
The main configuration file does NOT exist!
';
echo 'Click ';
html_link('./install/index.php', $text = 'here', $status = 'Install S9Y_Conf', $target = '');
echo 'to installS9Y_Conf.
';
}
exit;
}
// Installed
if(!defined('S9YCONF_INSTALLED')) {
// If no headers are sent, send one
if (!headers_sent()) {
header("Location: http://" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/install");
}else{
echo 'ERROR!
';
echo 'The main configuration file does NOT exist!
';
echo 'Click ';
html_link('./install/index.php', $text = 'here', $status = 'Install S9Y_Conf', $target = '');
echo 'to installS9Y_Conf.
';
}
exit;
}
// Include template functions
include_once S9YCONF_INC_PATH.'templates.functions.inc.php';
debug_msg ("FILE: ".__FILE__,3);
db_connect();
$action = '';
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (isset($_POST['action'])) {
$action = $_POST['action'];
}
debug_msg("Action: ".$action,5);
// Determine what action to take
switch ($action) {
case 'add':
blogdata_add();
break;
case 'edit':
if (isset($_GET['uid'])) {
$uid = $_GET['uid'];
blogdata_edit($uid);
}
break;
case 'view':
if (isset($_POST['uid'])) {
$uid = $_POST['uid'];
if (isset($_POST['tplid'])) {
$tplid = $_POST['tplid'];
}
blogdata_view($uid, $tplid);
}
break;
case 'viewall':
if (isset($_POST['tplid'])) {
$tplid = $_POST['tplid'];
blogdata_view_all($tplid);
}
break;
case 'delete':
if (isset($_GET['uid'])) {
$uid = $_GET['uid'];
blogdata_delete($uid);
}
break;
case 'deleterecord':
if (isset($_POST['uid'])) {
$uid = $_POST['uid'];
blogdata_deleterecord($uid);
}
break;
case 'insert':
blogdata_insert();
break;
case 'update':
if (isset($_POST['uid'])) {
$uid = $_POST['uid'];
blogdata_update($uid);
}
break;
default :
list_blogs();
break;
} //end switch
exit(0);
/*
blogdata_delete($uid = '')
Delete a Blog Data record (no recovery)
*/
function blogdata_deleterecord($uid = '') {
debug_msg ("FUNCTION: ".__FUNCTION__,4);
db_delete_blogdata($uid);
// If no headers are sent, send one
if (!headers_sent()) {
header("Location: http://" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/blogdata.php");
exit;
}
echo "Delete Blog Data";
} // end function blogdata_deleterecord($uid = '')
/*
blogdata_delete($uid = '')
Delete a Blog Data record (last chance)
*/
function blogdata_delete($uid = '') {
debug_msg ("FUNCTION: ".__FUNCTION__,3);
html_header("Delete Blog Data");
$result = db_read_blogdata($uid);
$name = $result['name'];
$blog_path=$result['blog_path'];
$user = $result['user'];
$url = $result['url'];
?>
Delete Blog
Really DELETE this record ?
Edit Blog
Add Blog
Add Blog
Edit Blog
'.$message.'
';
}
?>
0) {
$tplselect = '';
foreach ($result as $row) {
$tplselect = $tplselect.'';
}
}
$result = db_multirec_read_all_blogdata();
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 Blogs");
?>
'.$message.'
';
}
?>
Name :
|
|
Blog Path :
|
|
Local user :
|
|
Blog URL :
|
|
0) {
$tplselect = '';
foreach ($result as $row) {
if ($row['id'] == $tplid) {
$tplselect = $tplselect.'';
}else{
$tplselect = $tplselect.'';
}
}
}
$navform = '';
// 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']);
// 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']), $template_contents);
}
// Insert specific blog template variables
$template_contents = str_replace('{BLOGID}', $BLOGID, $template_contents);
$template_contents = str_replace('{BLOGNAME}', $BLOGNAME, $template_contents);
$template_contents = str_replace('{BLOGPATH}', $BLOGPATH, $template_contents);
$template_contents = str_replace('{BLOGUSER}', $BLOGUSER, $template_contents);
$template_contents = str_replace('{BLOGURL}', $BLOGURL, $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 Blog '$BLOGNAME'");
echo $navform."
";
echo "Output of the template '".$TEMPLATE_NAME."' for blog '".$BLOGNAME."'
";
echo "
";
echo "Click here to download";
echo '
';
echo nl2br(htmlentities($template_contents));
echo "
";
echo "Click here to download";
echo "
";
echo "
".$navform."
";
html_footer();
} //end function blogdata_view($uid = '', $tplid = '')
/*
blogdata_view_all()
View output of a template for ALL Blog
*/
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.'';
}else{
$tplselect = $tplselect.'';
}
}
}
$navform = '';
// 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']);
// 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']), $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."
";
echo "Output of the template '".$TEMPLATE_NAME."' for all blogs
";
echo "
";
echo "Click here to download";
echo '
';
$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));
}
echo "
";
echo "Click here to download";
echo "
";
echo "
".$navform."
";
html_footer();
} //end function blogdata_view_all($tplid = '')
?>