.
require_once("../inc/db_ops.inc");
require_once("../inc/util.inc");
require_once("../project/project.inc");
// TODO: get rid of the following. use style sheets
define("TD", "
");
define("TD2", " ");
define("TD3", " ");
define("TABLE", "");
define("TABLE2", "");
function admin_page_head($title) {
$stylesheet = URL_BASE.STYLESHEET;
echo "$title
".PROJECT.": $title
";
}
function admin_page_tail() {
echo "
Back to Main admin page |
";
$user = get_logged_in_user_ops();
if ($user) {
echo "logged in as $user->name. Log out ";
} else {
echo "Log in ";
}
echo "
";
}
// TODO: get rid of all the following
function print_checkbox($text,$name,$checked) {
echo " "
. "$text\n"
. "\n";
}
function print_radio_button($text,$name,$value,$checked) {
echo " "
. "$text\n"
. " \n";
}
function print_text_field($text,$name,$value) {
echo "$text \n"
. "
\n";
}
function row($x, $y) {
echo "
$x \n$y \n \n";
}
function c_row2($color, $x, $y) {
echo "$x $y \n";
}
function show_profile_link_ops($user) {
if ($user->has_profile) {
row2("Profile",
"id\">View "
);
}
}
// initialize database connection with username & password from
// command line instead of config.xml
//
function db_init_cli() {
$config = get_config();
$db_name = parse_config($config, "");
$host = parse_config($config, "");
if ($host == null) {
$host = "localhost";
}
$in = fopen("php://stdin","r");
print "Database username (if not current user): ";
$user = rtrim(fgets($in, 80));
print "Database password (if any): ";
$pass = rtrim(fgets($in, 80));
$retval = mysql_pconnect($host, $user, $pass);
if (!$retval) {
die("Can't connect to DB\n");
}
if (!mysql_select_db($db_name)) {
die("Can't select DB\n");
}
}
function print_login_form_ops($next_url='') {
if ($next_url == '') $next_url = $_SERVER['REQUEST_URI'];
start_table();
echo "