diff options
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/aur.inc | 62 | ||||
-rw-r--r-- | web/lib/translator.inc | 9 |
2 files changed, 64 insertions, 7 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc index 7b7602e..8a4756e 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -1,4 +1,32 @@ <? +include_once("aur_po.inc"); + +# Define global variables +# + + +# connect to the database +# +function db_connect() { + # NOTE: modify these variables if your MySQL setup is different + # + $AUR_db_host = "localhost:/tmp/mysql.sock"; + $AUR_db_name = "AUR"; + $AUR_db_user = "aur"; # XXX use something better when deploying + $AUR_db_pass = "aur"; # XXX use something better when deploying + + $handle = mysql_pconnect($AUR_db_host, $AUR_db_user, $AUR_db_pass); + if (!$handle) { + die("Error connecting to AUR database: " . mysql_error()); + } + + mysql_select_db($AUR_db_name, $handle) or + die("Error selecting AUR database: " . mysql_error()); + + return $handle; +} + + # common header # function html_header() { @@ -13,8 +41,9 @@ function html_header() { print "<table cellspacing='0' "; print "style='background-color: #000; width: 100%;'>\n"; print " <tr>\n"; - print " <td class='preHeader'><span class='preHeader'>AUR: An "; - print "ArchLinux project</span></td>\n"; + print " <td class='preHeader'><span class='preHeader'>"; + print __("%s: An ArchLinux project", array("AUR")); + print "</span></td>\n"; print " </tr>\n"; print " <tr>\n"; print " <td class='headerFill'>\n"; @@ -28,16 +57,43 @@ function html_header() { print " </tr>\n"; print " </table>\n"; print " </tr>\n"; - print "</table>\n"; + + # Menu items + # + print " <tr>\n"; + print " <td class='mainLinks' align='center'>"; + print " <span class='f2'><span class='black'>.:</span>"; + print " <a href='/index.php'>".__("Home")."</a> "; + print " <span class='black'> - </span> "; + print " <a href='/account.php'>".__("Accounts")."</a> "; + print " <span class='black'> - </span> "; + print " <a href='/pkgsearch.php'>".__("Packages")."</a> "; + print " <span class='black'> - </span> "; + print " <a href='/pkgvote.php'>".__("Vote")."</a> "; + print " <span class='black'> - </span> "; + print " <a href='/pkgmgmnt.php'>".__("Manage")."</a> "; + print " <span class='black'> - </span> "; + print " <a href='/pkgsubmit.php'>".__("Submit")."</a> "; + print " <span class='black'> - </span> "; + print " <a href='/logout.php'>".__("Logout")."</a> "; + print " <span class='black'>:.</span></span>"; + print " </td>"; + print " </tr>"; + print " <tr>\n"; + print " <td class='contentDisplay'>\n"; print "<!-- Start of main content -->\n\n"; return; } + # common footer # function html_footer($ver="") { print "\n\n<!-- End of main content -->"; + print " </td>\n"; + print " </tr>\n"; + print "</table>\n"; print "<p>\n"; if ($ver) { print "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n"; diff --git a/web/lib/translator.inc b/web/lib/translator.inc index 79eb39c..87fe781 100644 --- a/web/lib/translator.inc +++ b/web/lib/translator.inc @@ -3,7 +3,7 @@ # # usage: -# use the _() function for returning translated strings of +# use the __() function for returning translated strings of # text. The string can contain escape codes %h for HTML # and %s for regular text. # @@ -17,12 +17,13 @@ # $_t["es"]["My cat is large."] = "Mi gato esta grande."; # # examples: -# print _("%s has %s apples.", array("Bill", "5")); -# print _("This is a %h%s%h problem!", array("<b>","major","</b>")); +# print __("%s has %s apples.", array("Bill", "5")); +# print __("This is a %h%s%h problem!", array("<b>","major","</b>")); include_once("common_po.inc"); -function _($tag, $args=array()) { + +function __($tag, $args=array()) { global $_t; global $_REQUEST; global $LANG; |