From 25fe742367c0b78e546595fa837b1b0289ac24db Mon Sep 17 00:00:00 2001 From: jengo Date: Thu, 8 Mar 2001 23:32:22 +0000 Subject: [PATCH] Cleaned up all of the link calls in the admin section --- admin/accounts.php | 10 +-- admin/applications.php | 6 +- admin/currentusers.php | 2 +- admin/deleteaccount.php | 8 +-- admin/deleteapplication.php | 8 +-- admin/deletegroup.php | 12 ++-- admin/editaccount.php | 6 +- admin/editapplication.php | 4 +- admin/editgroup.php | 6 +- admin/groups.php | 8 +-- admin/inc/hook_admin.inc.php | 56 +++++++++------ admin/index.php | 130 +++++++++++++++++++---------------- admin/killsession.php | 9 ++- admin/mainscreen_message.php | 4 +- admin/navbar-create.php | 2 +- admin/newaccount.php | 4 +- admin/newapplication.php | 4 +- admin/newgroup.php | 4 +- admin/viewaccount.php | 2 +- 19 files changed, 153 insertions(+), 132 deletions(-) diff --git a/admin/accounts.php b/admin/accounts.php index cd23c363fb..b5ad70a2f4 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -74,12 +74,12 @@ $p->set_var('row_loginid',$loginid); $p->set_var('row_firstname',$firstname); $p->set_var('row_lastname',$lastname); - $p->set_var('row_edit','link('/admin/editaccount.php','account_id=' . $account_id) . '"> ' . lang('Edit') . ' '); if ($phpgw_info['user']['userid'] != $account['account_lid']) { - $p->set_var('row_delete','link('/admin/deleteaccount.php','account_id=' . $account_id) . '"> '.lang('Delete').' '); } else @@ -87,15 +87,15 @@ $p->set_var('row_delete',' '); } - $p->set_var('row_view','link("/admin/viewaccount.php", "account_id=" . $account_id) . '"> ' . lang("View") . ' '); $p->parse('rows','row',True); } } // End else - $p->set_var('actionurl',$phpgw->link("newaccount.php")); - $p->set_var('accounts_url',$phpgw->link("accounts.php")); + $p->set_var('actionurl',$phpgw->link("/admin/newaccount.php")); + $p->set_var('accounts_url',$phpgw->link("/admin/accounts.php")); $p->set_var('lang_add',lang("add")); $p->set_var('lang_search',lang("search")); diff --git a/admin/applications.php b/admin/applications.php index 875fcb4c5e..32f99a91b9 100644 --- a/admin/applications.php +++ b/admin/applications.php @@ -48,8 +48,8 @@ $p->set_var("tr_color",$tr_color); $p->set_var("name",$name); - $p->set_var("edit",' ' . lang("Edit") . ' '); - $p->set_var("delete",' ' . lang("Delete") . ' '); + $p->set_var("edit",' ' . lang("Edit") . ' '); + $p->set_var("delete",' ' . lang("Delete") . ' '); if ($phpgw->db->f("app_enabled") != 0) { $status = lang("Yes"); @@ -61,7 +61,7 @@ $p->parse("rows","row",True); } - $p->set_var("new_action",$phpgw->link("newapplication.php")); + $p->set_var("new_action",$phpgw->link("/admin/newapplication.php")); $p->set_var("lang_add",lang("add")); $p->pparse("out","list"); diff --git a/admin/currentusers.php b/admin/currentusers.php index ee8a30f62f..06f23a5cf8 100755 --- a/admin/currentusers.php +++ b/admin/currentusers.php @@ -86,7 +86,7 @@ if ($phpgw->db->f('session_id') != $phpgw_info['user']['sessionid']) { - $phpgw->template->set_var('row_kill','link('/admin/killsession.php','ksession=' . $phpgw->db->f('session_id') . '&kill=true') . '">' . lang('Kill').''); } else diff --git a/admin/deleteaccount.php b/admin/deleteaccount.php index 76cb6ce306..6038f1534e 100755 --- a/admin/deleteaccount.php +++ b/admin/deleteaccount.php @@ -52,7 +52,7 @@ // Make sure they are not attempting to delete there own account. // If they are, they should not reach this point anyway. if ($phpgw_info["user"]["account_id"] == $account_id) { - Header("Location: " . $phpgw->link("accounts.php")); + Header('Location: ' . $phpgw->link('/admin/accounts.php')); $phpgw->common->phpgw_exit(); } @@ -61,9 +61,9 @@ $account_id = rawurlencode($account_id); $phpgw->template->set_var("message",lang("Are you sure you want to delete this account ?") . "
" . "" . lang("All records and account information will be lost!") . ""); - $phpgw->template->set_var("yes",'template->set_var("yes",'' . lang("Yes") . ''); - $phpgw->template->set_var("no",'template->set_var("no",'' . lang("No") . ''); $phpgw->template->pparse("out","body"); @@ -73,7 +73,7 @@ if ($confirm) { $cd = account_delete($account_id); - Header("Location: " . $phpgw->link("accounts.php","cd=$cd")); + Header("Location: " . $phpgw->link("/admin/accounts.php","cd=$cd")); } account_close(); ?> diff --git a/admin/deleteapplication.php b/admin/deleteapplication.php index dedbddfec3..2c185201d4 100644 --- a/admin/deleteapplication.php +++ b/admin/deleteapplication.php @@ -14,7 +14,7 @@ $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "admin"); if (! $app_name) { - Header("Location: " . $phpgw->link("applications.php")); + Header("Location: " . $phpgw->link("/admin/applications.php")); } include("../header.inc.php"); $phpgw->template->set_file(array("body" => "delete_common.tpl")); @@ -22,7 +22,7 @@ if ($confirm) { $phpgw->db->query("delete from phpgw_applications where app_name='$app_name'",__LINE__,__FILE__); - Header("Location: " . $phpgw->link("applications.php")); + Header("Location: " . $phpgw->link("/admin/applications.php")); $phpgw->common->phpgw_exit(); } @@ -30,9 +30,9 @@ echo parse_navbar(); $phpgw->template->set_var("message",lang("Are you sure you want to delete this application ?")); - $phpgw->template->set_var("no",'template->set_var("no",'' . lang("No") . ''); - $phpgw->template->set_var("yes",'' . lang("Yes") . ''); + $phpgw->template->set_var("yes",'' . lang("Yes") . ''); $phpgw->template->pparse("out","body"); $phpgw->common->phpgw_footer(); diff --git a/admin/deletegroup.php b/admin/deletegroup.php index e3d5020d84..cce00a1d79 100755 --- a/admin/deletegroup.php +++ b/admin/deletegroup.php @@ -15,7 +15,7 @@ $phpgw_info['flags'] = array('noheader' => True, 'nonavbar' => True, 'currentapp' => 'admin'); if (! $group_id) { - Header('Location: ' . $phpgw->link('groups.php')); + Header('Location: ' . $phpgw->link('/admin/groups.php')); } include('../header.inc.php'); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); @@ -47,11 +47,11 @@ $p->parse('messages','message_row',True); while (list(,$id) = each($old_group_list)) { - $p->set_var('message_display','' . $phpgw->common->grab_owner_name($id) . ''); + $p->set_var('message_display','' . $phpgw->common->grab_owner_name($id) . ''); $p->parse('messages','message_row',True); } $p->set_var('message_display','' - . 'link('/admin/deletegroup.php','group_id=' . $group_id . '&removeusers=True') . '">' . lang('Remove all users from this group') . ''); $p->parse('messages','message_row',True); $p->set_var('yes',''); @@ -75,7 +75,7 @@ $phpgw->db->unlock(); - Header('Location: ' . $phpgw->link('groups.php','cd='.$cd)); + Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd)); $phpgw->common->phpgw_exit(); } } else { @@ -85,8 +85,8 @@ $p->set_var('message_display',lang('Are you sure you want to delete this group ?')); $p->parse('messages','message_row'); - $p->set_var('yes','' . lang('Yes') . ''); - $p->set_var('no','' . lang('No') . ''); + $p->set_var('yes','' . lang('Yes') . ''); + $p->set_var('no','' . lang('No') . ''); $p->pparse('out','body'); diff --git a/admin/editaccount.php b/admin/editaccount.php index dbfa6f12b6..07cf9a548b 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -52,7 +52,7 @@ $allGroups = $account->get_list('groups'); } - $t->set_var('form_action',$phpgw->link('editaccount.php', + $t->set_var('form_action',$phpgw->link('/admin/editaccount.php', "account_id=$_account_id&old_loginid=".rawurlencode($userData['account_lid']))); if ($_errors) @@ -299,7 +299,7 @@ // not needed if i use the same file for new users too if (! $account_id) { - Header('Location: ' . $phpgw->link('accounts.php')); + Header('Location: ' . $phpgw->link('/admin/accounts.php')); } if ($submit) @@ -320,7 +320,7 @@ if (!$errors = userDataInvalid($userData)) { saveUserData($userData); - Header('Location: ' . $phpgw->link('accounts.php', 'cd='.$cd)); + Header('Location: ' . $phpgw->link('/admin/accounts.php', 'cd='.$cd)); $phpgw->common->phpgw_exit(); } else diff --git a/admin/editapplication.php b/admin/editapplication.php index 7128c1a889..afb09cd840 100644 --- a/admin/editapplication.php +++ b/admin/editapplication.php @@ -72,7 +72,7 @@ $phpgw->acl->delete($n_app_name,'everywhere',0,'g'); } - Header("Location: " . $phpgw->link("applications.php")); + Header("Location: " . $phpgw->link("/admin/applications.php")); $phpgw->common->phpgw_exit(); } } @@ -98,7 +98,7 @@ $p->set_var("lang_header",lang("Edit application")); $p->set_var("hidden_vars",''); $p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - $p->set_var("form_action",$phpgw->link("editapplication.php")); + $p->set_var("form_action",$phpgw->link("/admin/editapplication.php")); display_row(lang("application name"),''); display_row(lang("application title"),''); diff --git a/admin/editgroup.php b/admin/editgroup.php index 83129c5698..cd5cf76af6 100755 --- a/admin/editgroup.php +++ b/admin/editgroup.php @@ -29,7 +29,7 @@ } if (! $group_id) { - Header("Location: " . $phpgw->link("groups.php")); + Header("Location: " . $phpgw->link("/admin/groups.php")); } if ($submit) { @@ -119,7 +119,7 @@ $phpgw->db->unlock(); - Header('Location: ' . $phpgw->link('groups.php','cd='.$cd)); + Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd)); $phpgw->common->phpgw_exit(); } } @@ -153,7 +153,7 @@ $db_perms = $apps->read_account_specific(); } - $p->set_var('form_action',$phpgw->link('editgroup.php')); + $p->set_var('form_action',$phpgw->link('/admin/editgroup.php')); $p->set_var('hidden_vars',''); $p->set_var('lang_group_name',lang('group name')); diff --git a/admin/groups.php b/admin/groups.php index e826dfeb9d..26bb4f25d0 100755 --- a/admin/groups.php +++ b/admin/groups.php @@ -60,16 +60,16 @@ if (! $group_name) $group_name = ' '; $p->set_var("group_name",$group_name); - $p->set_var("edit_link",' ' . lang("Edit") . ' '); - $p->set_var("delete_link",' ' . lang("Delete") . ' '); + $p->set_var("edit_link",' ' . lang("Edit") . ' '); + $p->set_var("delete_link",' ' . lang("Delete") . ' '); $p->parse("rows","row",True); } - $p->set_var("new_action",$phpgw->link("newgroup.php")); + $p->set_var("new_action",$phpgw->link("/admin/newgroup.php")); $p->set_var("lang_add",lang("add")); - $p->set_var("search_action",$phpgw->link("groups.php")); + $p->set_var("search_action",$phpgw->link("/admin/groups.php")); $p->set_var("lang_search",lang("search")); $p->pparse("out","list"); diff --git a/admin/inc/hook_admin.inc.php b/admin/inc/hook_admin.inc.php index 824982710f..be7e162a4c 100644 --- a/admin/inc/hook_admin.inc.php +++ b/admin/inc/hook_admin.inc.php @@ -1,5 +1,7 @@ \n"; + $imgfile = $phpgw->common->get_image_dir($appname) . '/' . $appname . '.gif'; + if (file_exists($imgfile)) + { + $imgpath = $phpgw->common->get_image_path($appname) . '/' . $appname . '.gif'; + } + else + { + $imgfile = $phpgw->common->get_image_dir($appname) . '/navbar.gif'; + if (file_exists($imgfile)) + { + $imgpath = $phpgw->common->get_image_path($appname) . '/navbar.gif'; + } + else + { + $imgpath = ''; + } + } - // actual items in this section - echo ""; - echo lang("User accounts")."
\n"; + section_start(ucfirst($appname),$imgpath); - echo ""; - echo lang("User groups")."
\n"; + // actual items in this section + echo '' . lang('User accounts')."
\n"; + echo '' . lang('User groups')."
\n"; + echo "

\n"; - echo "

\n"; + echo '' . lang('Applications')."
\n"; + echo "

\n"; - echo ""; - echo lang("Applications")."
\n"; + echo '' . lang('Change main screen message') . "
\n"; + echo "

\n"; - echo "

\n"; + echo '' . lang('View sessions') . "
\n"; + echo '' . lang('View Access Log') . "
\n"; - echo ""; - echo lang("Change main screen message")."
\n"; - - echo "

\n"; - - echo ""; - echo lang("View sessions")."
\n"; - - echo ""; - echo lang("View Access Log")."
\n"; - - section_end(); + section_end(); } -?> +?> \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 079d1c8d7c..a6cc883cf8 100755 --- a/admin/index.php +++ b/admin/index.php @@ -1,70 +1,80 @@ * - * Modified by Stephen Brown * - * to distribute admin across the application directories * - * -------------------------------------------- * - * This program is free software; you can redistribute it and/or modify it * - * under the terms of the GNU General Public License as published by the * - * Free Software Foundation; either version 2 of the License, or (at your * - * option) any later version. * - \**************************************************************************/ + /**************************************************************************\ + * phpGroupWare - administration * + * http://www.phpgroupware.org * + * Written by Joseph Engo * + * Modified by Stephen Brown * + * to distribute admin across the application directories * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ - /* $Id$ */ + /* $Id$ */ - $phpgw_info = array(); - $phpgw_info["flags"]["currentapp"] = "admin"; - include("../header.inc.php"); + $phpgw_info['flags']['currentapp'] = 'admin'; + include('../header.inc.php'); - check_code($cd); + check_code($cd); - // This func called by the includes to dump a row header - function section_start($name="",$icon="") { - global $phpgw,$phpgw_info; - echo "\n"; - echo ""; - if ($icon != "") { - echo ""; - echo ""; - } else { - echo ""; - } - echo "\n"; - echo "
[Icon]".lang($name)."$name
\n"; - } - function section_end() { - echo "
\n\n"; - } + // This func called by the includes to dump a row header + function section_start($name='',$icon='') + { + global $phpgw,$phpgw_info; + echo ''; + if ($icon) + { + echo ''; + echo ''; + } + else + { + echo ''; + } + echo ''; + echo '
[Icon]' . lang($name) . '' . $name . '
'; + } - // We only want to list applications that are enabled, plus the common stuff - // (if they can get to the admin page, the admin app is enabled, hence it is shown) + function section_end() + { + echo '
'; + } - $phpgw->db->query("select app_name from phpgw_applications where app_enabled = 1 order by app_title",__LINE__,__FILE__); + // We only want to list applications that are enabled, plus the common stuff + // (if they can get to the admin page, the admin app is enabled, hence it is shown) + + $phpgw->db->query("select app_name from phpgw_applications where app_enabled = 1 order by app_title",__LINE__,__FILE__); - // Stuff it in an array in the off chance the admin includes need the db - while ($phpgw->db->next_record() ) { - $apps[] = $phpgw->db->f("app_name"); - } + // Stuff it in an array in the off chance the admin includes need the db + while ($phpgw->db->next_record()) + { + $apps[] = $phpgw->db->f('app_name'); + } - for( $i =0; $i < sizeof($apps); $i++) { - $appname = $apps[$i]; - $f = PHPGW_SERVER_ROOT . "/" . $appname . "/inc/hook_admin.inc.php"; - if (file_exists($f)) { - include($f); - echo "

\n"; - } - } + for ($i =0; $i < sizeof($apps); $i++) + { + $appname = $apps[$i]; + $f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_admin.inc.php'; -if ( $SHOW_INFO > 0 ) { - echo "

link("", "SHOW_INFO=0")."\">Hide PHP Information"; - echo "


\n"; - phpinfo(); - echo "
\n"; -} -else { - echo "

link("", "SHOW_INFO=1")."\">PHP Information"; -} - $phpgw->common->phpgw_footer(); -?> + if (file_exists($f)) + { + include($f); + echo "

\n"; + } + } + + if ($SHOW_INFO > 0) + { + echo '

' . lang('Hide PHP Information') . ''; + echo "


\n"; + phpinfo(); + echo "
\n"; + } + else + { + echo '

' . lang('PHP Information') . ''; + } + $phpgw->common->phpgw_footer(); +?> \ No newline at end of file diff --git a/admin/killsession.php b/admin/killsession.php index 4f3a722503..5bf129a3df 100755 --- a/admin/killsession.php +++ b/admin/killsession.php @@ -18,14 +18,13 @@ $phpgw_info["flags"]["currentapp"] = "admin"; include("../header.inc.php"); if ($ksessionid == $phpgw_info["user"]["sessionid"]) { - Header("Location: " . $phpgw->link("currentusers.php")); + Header("Location: " . $phpgw->link("/admin/currentusers.php")); $phpgw->common->phpgw_exit(); } if ($confirm) { $phpgw->db->query("delete from phpgw_sessions where session_id='$ksession'"); - Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/admin/currentusers.php", - "cd=19")); + Header("Location: " . $phpgw->link("/admin/currentusers.php","cd=19")); } else { ?>

@@ -37,10 +36,10 @@ - " . lang("No"); ?> + " . lang("No"); ?> - " . lang("Yes"); ?> diff --git a/admin/mainscreen_message.php b/admin/mainscreen_message.php index d788084f6f..179f3aa6c2 100644 --- a/admin/mainscreen_message.php +++ b/admin/mainscreen_message.php @@ -30,7 +30,7 @@ if (! isset($select_lang)) { $phpgw->template->set_var("header_lang",lang("Main screen message")); - $phpgw->template->set_var("form_action",$phpgw->link("mainscreen_message.php")); + $phpgw->template->set_var("form_action",$phpgw->link("/admin/mainscreen_message.php")); $phpgw->template->set_var("tr_color",$phpgw_info["theme"]["th_bg"]); $phpgw->template->set_var("value"," "); $phpgw->template->parse("rows","row_2",True); @@ -76,7 +76,7 @@ } else { $phpgw->template->set_var("header_lang",lang("Edit login screen message")); } - $phpgw->template->set_var("form_action",$phpgw->link("mainscreen_message.php","select_lang=$select_lang§ion=$section")); + $phpgw->template->set_var("form_action",$phpgw->link("/admin/mainscreen_message.php","select_lang=$select_lang§ion=$section")); $phpgw->template->set_var("tr_color",$phpgw_info["theme"]["th_bg"]); $phpgw->template->set_var("value"," "); $phpgw->template->parse("rows","row_2",True); diff --git a/admin/navbar-create.php b/admin/navbar-create.php index 92344d6386..13fc39cefb 100644 --- a/admin/navbar-create.php +++ b/admin/navbar-create.php @@ -24,7 +24,7 @@ The instructions are as follows:

link("navbar-sel.php","filename=".$phpgw_info["server"]["server_root"]."/".$key."/images/navbar.gif")."\">"; + echo "\nlink("/admin/navbar-sel.php","filename=".$phpgw_info["server"]["server_root"]."/".$key."/images/navbar.gif")."\">"; echo $phpgw_info["apps"][$key]["title"]."
"; } diff --git a/admin/newaccount.php b/admin/newaccount.php index f57598f67b..cdbb149a12 100755 --- a/admin/newaccount.php +++ b/admin/newaccount.php @@ -156,7 +156,7 @@ $phpgw->common->hook_single('add_user_data', $value); } */ - Header('Location: ' . $phpgw->link('accounts.php','cd='.$cd)); + Header('Location: ' . $phpgw->link('/admin/accounts.php','cd='.$cd)); $phpgw->common->phpgw_exit(); } } @@ -186,7 +186,7 @@ $phpgw->template->set_var('tr_color1',$phpgw_info['theme']['row_on']); $phpgw->template->set_var('tr_color2',$phpgw_info['theme']['row_off']); - $phpgw->template->set_var('form_action',$phpgw->link('newaccount.php')); + $phpgw->template->set_var('form_action',$phpgw->link('/admin/newaccount.php')); $phpgw->template->set_var('lang_loginid',lang('LoginID')); if ($account_status) diff --git a/admin/newapplication.php b/admin/newapplication.php index 7bb0c72f94..162847bd2e 100644 --- a/admin/newapplication.php +++ b/admin/newapplication.php @@ -64,7 +64,7 @@ $phpgw->acl->add($n_app_name,'everywhere',0,'g',1); } - Header("Location: " . $phpgw->link("applications.php")); + Header("Location: " . $phpgw->link("/admin/applications.php")); $phpgw->common->phpgw_exit(); } else { $phpgw->template->set_var("error","

" . $phpgw->common->error_list($error) . "

"); @@ -79,7 +79,7 @@ $phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $phpgw->template->set_var("hidden_vars",""); - $phpgw->template->set_var("form_action",$phpgw->link("newapplication.php")); + $phpgw->template->set_var("form_action",$phpgw->link("/admin/newapplication.php")); display_row(lang("application name"),''); display_row(lang("application title"),''); diff --git a/admin/newgroup.php b/admin/newgroup.php index 376b1a6460..92e2a1bbdd 100755 --- a/admin/newgroup.php +++ b/admin/newgroup.php @@ -108,7 +108,7 @@ $phpgw->db->unlock(); - Header("Location: " . $phpgw->link("groups.php","cd=$cd")); + Header("Location: " . $phpgw->link("/admin/groups.php","cd=$cd")); $phpgw->common->phpgw_exit(); } } @@ -125,7 +125,7 @@ $p->set_var("error",""); } - $p->set_var("form_action",$phpgw->link("newgroup.php")); + $p->set_var("form_action",$phpgw->link("/admin/newgroup.php")); $p->set_var("hidden_vars",""); $p->set_var("lang_group_name",lang("New group name")); $p->set_var("group_name_value",""); diff --git a/admin/viewaccount.php b/admin/viewaccount.php index 823068f89d..164442f982 100755 --- a/admin/viewaccount.php +++ b/admin/viewaccount.php @@ -28,7 +28,7 @@ if (! $account_id) { - Header('Location: ' . $phpgw->link('accounts.php')); + Header('Location: ' . $phpgw->link('/admin/accounts.php')); } $t = new Template($phpgw->common->get_tpl_dir('admin'));