[Comoblog-commit] comoblog/modules/mod_tunelog/admin mod_tunelog.php, NONE, 1.1 mod_tunelog_edit.ph
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2006-10-22 11:44:25
|
Update of /cvsroot/comoblog/comoblog/modules/mod_tunelog/admin In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27709/modules/mod_tunelog/admin Added Files: mod_tunelog.php mod_tunelog_edit.php mod_tunelog_add.php mod_tunelog_del.php Log Message: work in progress, ditching this server cos its borked ;( --- NEW FILE: mod_tunelog.php --- <?php require_once ('../../../admin/include/admin.inc.php'); require_once ('../include/mod_tunelog.inc.php'); $tunelog_items = mod_tunelog_list (); // template file $tpl = new XTemplate ('templates/mod_tunelog.tpl.htm'); $tpl->assign('MOD_NAME', 'mod_tunelog'); if ($tunelog_items) { for ($c = 0; $c < count($tunelog_items); $c++) { if ($c % 2) $tpl->assign('BGCOLOR', '#ffffff'); else $tpl->assign('BGCOLOR', '#efefef'); $tpl->assign('ITEM', $tunelog_items[$c]); $tpl->parse('main.items.item'); } $tpl->parse('main.items'); } $tpl->parse('main'); $tpl->out('main'); ?> --- NEW FILE: mod_tunelog_edit.php --- <?php require_once ('../../../admin/include/admin.inc.php'); require_once ('../include/mod_tunelog.inc.php'); if (strtoupper($_SERVER['REQUEST_METHOD'] == 'POST')) { $errors = array(); if ($_POST['tunelog_title'] == '') $errors[] = 'You must provide a title for your entry'; if ($_POST['tunelog_url'] == '') $errors[] = 'You must provide an URL for your entry'; if (count($errors)) { foreach ($errors as $k => $v) $err_msg .= '- ' . $v . '<br />'; error_page ('Errors:<br />'.$err_msg, 'javascript:history.go(-1);'); } else { $item = mod_tunelog_edit($_POST); echo '<html><head></head><body><script language="javascript">opener.location.reload();this.close();</script></body></html>'; exit(); } } else { $item_id = ''; if (isset($_GET['i'])) $item_id = $_GET['i']; $item = mod_tunelog_details($item_id); $tpl = new XTemplate('templates/mod_tunelog_edit.tpl.htm'); $tpl->assign('ITEM', $item); $tpl->assign('ACTION', basename($_SERVER['PHP_SELF'])); $tpl->parse('main'); $tpl->out('main'); } ?> --- NEW FILE: mod_tunelog_add.php --- <?php require_once ('../../../admin/include/admin.inc.php'); require_once ('../include/mod_tunelog.inc.php'); if (strtoupper($_SERVER['REQUEST_METHOD'] == 'POST')) { $errors = array(); foreach($_POST as $k => $v) $_POST[$k] = trim($v); if ($_POST['tunelog_songtitle'] == '') $errors[] = 'You must provide a title for your entry'; if ($_POST['tunelog_artist'] == '') $errors[] = 'You must provide an artist for your entry'; if (count($errors)) { foreach ($errors as $k => $v) $err_msg .= '- ' . $v . '<br />'; error_page ('Errors:<br />'.$err_msg, 'javascript:history.go(-1);'); } else { $item = mod_tunelog_add($_POST); echo '<html><head></head><body><script language="javascript">opener.location.reload();this.close();</script></body></html>'; exit(); } } $tpl = new XTemplate('templates/mod_tunelog_add.tpl.htm'); $tpl->assign('ACTION', basename($_SERVER['PHP_SELF'])); $tpl->parse('main'); $tpl->out('main'); ?> --- NEW FILE: mod_tunelog_del.php --- <?php require_once ('../../../admin/include/admin.inc.php'); require_once ('../include/mod_tunelog.inc.php'); $item_id = ''; if (isset($_GET['i'])) $item_id = $_GET['i']; mod_tunelog_del ($item_id); Header ('Location: mod_tunelog.php'); exit(); ?> |