working toward app install/upgrdae within setup prog

This commit is contained in:
seek3r 2001-02-13 10:53:18 +00:00
parent cdcde444b7
commit d80f6a4e79
30 changed files with 425 additions and 442 deletions

View File

@ -0,0 +1,10 @@
<?php
include('../version.inc.php');
$phpgw_info['setup']['addressbook']['name'] = 'Addressbook';
$phpgw_info['setup']['addressbook']['version'] = $phpgw_info['server']['versions']['addressbook'];
$phpgw_info['setup']['addressbook']['app_order'] = 7;
$phpgw_info['setup']['addressbook']['tables'] = "";
$hooks = Array();
$hooks_string = implode (',', $hooks);
$phpgw_info['setup']['addressbook']['hooks'] = $hooks_string;
?>

View File

@ -1,89 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
// NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier.
$sql = "CREATE TABLE phpgw_addressbook (
id int(8) DEFAULT '0' NOT NULL,
lid varchar(32),
tid char(1),
owner int(8),
fn varchar(64),
sound varchar(64),
org_name varchar(64),
org_unit varchar(64),
title varchar(64),
n_family varchar(64),
n_given varchar(64),
n_middle varchar(64),
n_prefix varchar(64),
n_suffix varchar(64),
label text,
adr_poaddr varchar(64),
adr_extaddr varchar(64),
adr_street varchar(64),
adr_locality varchar(32),
adr_region varchar(32),
adr_postalcode varchar(32),
adr_countryname varchar(32),
adr_work enum('y','n') DEFAULT 'n' NOT NULL,
adr_home enum('y','n') DEFAULT 'n' NOT NULL,
adr_parcel enum('y','n') DEFAULT 'n' NOT NULL,
adr_postal enum('y','n') DEFAULT 'n' NOT NULL,
tz varchar(8),
geo varchar(32),
a_tel varchar(40) DEFAULT '+1 (000) 000-0000' NOT NULL,
a_tel_work enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_home enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_voice enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_msg enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_fax enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_prefer enum('y','n') DEFAULT 'n' NOT NULL,
b_tel varchar(40) DEFAULT '+1 (000) 000-0000' NOT NULL,
b_tel_work enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_home enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_voice enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_msg enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_fax enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_prefer enum('y','n') DEFAULT 'n' NOT NULL,
c_tel varchar(40) DEFAULT '+1 (000) 000-0000' NOT NULL,
c_tel_work enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_home enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_voice enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_msg enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_fax enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_prefer enum('y','n') DEFAULT 'n' NOT NULL,
d_emailtype enum('INTERNET','CompuServe','AOL','Prodigy','eWorld','AppleLink','AppleTalk','PowerShare','IBMMail','ATTMail','MCIMail','X.400','TLX') DEFAULT 'INTERNET' NOT NULL,
d_email varchar(64),
d_email_work enum('y','n') DEFAULT 'n' NOT NULL,
d_email_home enum('y','n') DEFAULT 'n' NOT NULL,
PRIMARY KEY (id),
UNIQUE id (id)
)";
$db->query($sql);
$sql = "CREATE TABLE phpgw_addressbook_extra (
contact_id int(11),
contact_owner int(11),
contact_name varchar(255),
contact_value varchar(255)
)";
$db->query($sql);
$currentver = "0.9.8pre5";
$oldversion = $currentver;
update_app_version("addressbook");
?>

View File

@ -1,2 +0,0 @@
<?php
$setup_info["addressbook"] = array("name" => "Addressbook", "app_order" => 7, "version" => "0.0.1");

View File

@ -0,0 +1,21 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
/**************************************************************************\
* This file should never be changed! *
* This is only to be used for the original table definitions. *
* Any changes to the tables must be done thru the tables_update and then *
* generate the tables_current *
\**************************************************************************/
?>

View File

@ -0,0 +1,17 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
/**************************************************************************\
* This file should be generated for you. It should never be edited by hand *
\**************************************************************************/
?>

View File

@ -5,12 +5,10 @@
* -------------------------------------------- *
* 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 *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/* $Id $ */
$db->query("DROP TABLE phpgw_addressbook");
$db->query("DROP TABLE phpgw_addressbook_extra");
?>

View File

@ -0,0 +1,13 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
?>

View File

@ -1,153 +0,0 @@
<?
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
function upgradeaddr() {
global $phpgw_info, $phpgw_setup;
// create db objects for the main and two nested queries below
$db1 = $db2 = $phpgw_setup->db;
// create new contacts class tables
$sql = "DROP TABLE IF EXISTS phpgw_addressbook";
$db1->query($sql);
$sql = "DROP TABLE IF EXISTS phpgw_addressbook_extra";
$db1->query($sql);
$sql = "CREATE TABLE phpgw_addressbook (
id int(8) DEFAULT '0' NOT NULL,
lid varchar(32),
tid char(1),
owner int(8),
fn varchar(64),
sound varchar(64),
org_name varchar(64),
org_unit varchar(64),
title varchar(64),
n_family varchar(64),
n_given varchar(64),
n_middle varchar(64),
n_prefix varchar(64),
n_suffix varchar(64),
label text,
adr_poaddr varchar(64),
adr_extaddr varchar(64),
adr_street varchar(64),
adr_locality varchar(32),
adr_region varchar(32),
adr_postalcode varchar(32),
adr_countryname varchar(32),
adr_work enum('y','n') DEFAULT 'n' NOT NULL,
adr_home enum('y','n') DEFAULT 'n' NOT NULL,
adr_parcel enum('y','n') DEFAULT 'n' NOT NULL,
adr_postal enum('y','n') DEFAULT 'n' NOT NULL,
tz varchar(8),
geo varchar(32),
a_tel varchar(40) DEFAULT '+1 (000) 000-0000' NOT NULL,
a_tel_work enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_home enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_voice enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_msg enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_fax enum('y','n') DEFAULT 'n' NOT NULL,
a_tel_prefer enum('y','n') DEFAULT 'n' NOT NULL,
b_tel varchar(40) DEFAULT '+1 (000) 000-0000' NOT NULL,
b_tel_work enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_home enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_voice enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_msg enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_fax enum('y','n') DEFAULT 'n' NOT NULL,
b_tel_prefer enum('y','n') DEFAULT 'n' NOT NULL,
c_tel varchar(40) DEFAULT '+1 (000) 000-0000' NOT NULL,
c_tel_work enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_home enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_voice enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_msg enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_fax enum('y','n') DEFAULT 'n' NOT NULL,
c_tel_prefer enum('y','n') DEFAULT 'n' NOT NULL,
d_emailtype enum('INTERNET','CompuServe','AOL','Prodigy','eWorld','AppleLink','AppleTalk','PowerShare','IBMMail','ATTMail','MCIMail','X.400','TLX') DEFAULT 'INTERNET' NOT NULL,
d_email varchar(64),
d_email_work enum('y','n') DEFAULT 'n' NOT NULL,
d_email_home enum('y','n') DEFAULT 'n' NOT NULL,
PRIMARY KEY (id),
UNIQUE id (id)
)";
$db1->query($sql);
$sql = "CREATE TABLE phpgw_addressbook_extra (
contact_id int(11),
contact_owner int(11),
contact_name varchar(255),
contact_value varchar(255)
)";
$db1->query($sql);
// read in old addressbook
$db1->query("select * from addressbook");
while ( $db1->next_record() ) {
// clear the arrays for subsequent passes
$fields = $extra = array();
$fields["org_name"] = $db1->f("ab_company");
$fields["n_given"] = $db1->f("ab_firstname");
$fields["n_family"] = $db1->f("ab_lastname");
$fields["fn"] = $db1->f("ab_firstname")." ".$db1->f("ab_lastname");
$fields["d_email"] = $db1->f("ab_email");
$fields["title"] = $db1->f("ab_title");
$fields["a_tel"] = $db1->f("ab_wphone");
$fields["a_tel_work"] = "y";
$fields["b_tel"] = $db1->f("ab_hphone");
$fields["b_tel_home"] = "y";
$fields["c_tel"] = $db1->f("ab_fax");
$fields["c_tel_fax"] = "y";
$fields["adr_street"] = $db1->f("ab_street");
$fields["adr_locality"] = $db1->f("ab_city");
$fields["adr_region"] = $db1->f("ab_state");
$fields["adr_postalcode"] = $db1->f("ab_zip");
$fields["owner"] = $db1->f("ab_owner");
$fields["id"] = $db1->f("ab_id");
$extra["pager"] = $db1->f("ab_pager");
$extra["mphone"] = $db1->f("ab_mphone");
$extra["ophone"] = $db1->f("ab_ophone");
$extra["address2"] = $db1->f("ab_address2");
$extra["bday"] = $db1->f("ab_bday");
$extra["url"] = $db1->f("ab_url");
$extra["notes"] = $db1->f("ab_notes");
$extra["access"] = $db1->f("ab_access");
// add this record's standard fields with current entry's owner as owner
$sql="INSERT INTO phpgw_addressbook ("
. "id,org_name,n_given,n_family,fn,d_email,title,a_tel,a_tel_work,"
. "b_tel,b_tel_home,c_tel,c_tel_fax,adr_street,adr_locality,adr_region,adr_postalcode,owner)"
. " VALUES ('".$fields["id"]."','".$fields["org_name"]."','".$fields["n_given"]."','".$fields["n_family"]."','"
. $fields["fn"]."','".$fields["d_email"]."','".$fields["title"]."','".$fields["a_tel"]."','"
. $fields["a_tel_work"]."','".$fields["b_tel"]."','".$fields["b_tel_home"]."','"
. $fields["c_tel"]."','".$fields["c_tel_fax"]."','".$fields["adr_street"]."','"
. $fields["adr_locality"]."','".$fields["adr_region"]."','".$fields["adr_postalcode"]."',"
. $fields["owner"].")";
$db2->query($sql);
//echo "<br>Inserting id '".$fields["id"]."'";
// insert extra fields for this record into extra fields table
while (list($name,$value) = each($extra)) {
//echo "<br>Inserting '".$name."' = '".$value."'";
$db2->query("INSERT INTO phpgw_addressbook_extra VALUES ('".$fields["id"]."','" . $$fields["owner"] . "','"
. addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__);
}
}
}
upgradeaddr();
?>

View File

@ -0,0 +1,10 @@
<?php
include('../version.inc.php');
$phpgw_info['setup']['admin']['name'] = 'Administration';
$phpgw_info['setup']['admin']['version'] = $phpgw_info['server']['versions']['admin'];
$phpgw_info['setup']['admin']['app_order'] = 1;
$phpgw_info['setup']['admin']['tables'] = "";
$hooks = Array();
$hooks_string = implode (',', $hooks);
$phpgw_info['setup']['admin']['hooks'] = $hooks_string;
?>

View File

@ -1,2 +0,0 @@
<?php
$setup_info["admin"] = array("name" => "Administration", "app_order" => 1, "version" => "0.0.1");

View File

@ -0,0 +1,21 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
/**************************************************************************\
* This file should never be changed! *
* This is only to be used for the original table definitions. *
* Any changes to the tables must be done thru the tables_update and then *
* generate the tables_current *
\**************************************************************************/
?>

View File

@ -0,0 +1,17 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
/**************************************************************************\
* This file should be generated for you. It should never be edited by hand *
\**************************************************************************/
?>

View File

@ -5,13 +5,10 @@
* -------------------------------------------- *
* 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 *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/* $Id $ */
$db->query("DROP TABLE calendar_entry");
$db->query("DROP TABLE calendar_entry_repeats");
$db->query("DROP TABLE calendar_entry_user");
?>

View File

@ -0,0 +1,13 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
?>

View File

@ -1,3 +0,0 @@
<?php
echo "<br>hellow world<br>";
?>

View File

@ -1,53 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
// NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier.
$sql = "CREATE TABLE calendar_entry (
cal_id int(11) DEFAULT '0' NOT NULL auto_increment,
cal_owner int(11) DEFAULT '0' NOT NULL,
cal_group varchar(255),
cal_datetime int(11),
cal_mdatetime int(11),
cal_edatetime int(11),
cal_priority int(11) DEFAULT '2' NOT NULL,
cal_type varchar(10),
cal_access varchar(10),
cal_name varchar(80) NOT NULL,
cal_description text,
PRIMARY KEY (cal_id)
)";
$db->query($sql);
$sql = "CREATE TABLE calendar_entry_repeats (
cal_id int(11) DEFAULT '0' NOT NULL,
cal_type enum('daily','weekly','monthlyByDay','monthlyByDate','yearly') DEFAULT 'daily' NOT NULL,
cal_use_end int DEFAULT '0',
cal_end int(11),
cal_frequency int(11) DEFAULT '1',
cal_days char(7)
)";
$db->query($sql);
$sql = "CREATE TABLE calendar_entry_user (
cal_id int(11) DEFAULT '0' NOT NULL,
cal_login int(11) DEFAULT '0' NOT NULL,
cal_status char(1) DEFAULT 'A',
PRIMARY KEY (cal_id, cal_login)
)";
$db->query($sql);
$currentver = "0.9.8pre5";
$oldversion = $currentver;
update_app_version("calendar");
?>

View File

@ -1,2 +0,0 @@
<?php
$setup_info["calendar"] = array("name" => "Calendar", "app_order" => 9, "version" => "0.0.1");

View File

@ -23,6 +23,18 @@
/* $Id$ */
/*!!
* @Type: class
* @Name: acl
* @Author: Seek3r
* @Title: Access Control List security system
* @Description: This class provides an ACL security scheme.
* This can manage rights to 'run' applications, and limit certain features within an application.
* It is also used for granting a user "membership" to a group, or making a user have the security equivilance of another user.
* It is also used for granting a user or group rights to various records, such as todo or calendar items of another user.
* @Syntax: CreateObject('phpgwapi.acl',int account_id);
* @Example1: $acl = CreateObject('phpgwapi.acl',5); // 5 is the user id
*/
class acl
{
var $account_id;
@ -30,10 +42,16 @@
var $data = Array();
var $db;
/**************************************************************************\
* Standard constructor for setting $this->account_id *
\**************************************************************************/
/*!!
* @Type: function
* @Name: acl
* @Author: Seek3r
* @Title: ACL constructor for setting account id.
* @Description: Sets the ID for $acl->account_id. Can be used to change a current instances id as well.
* Some functions are specific to this account, and others are generic.
* @Syntax: int acl(int account_id)
* @Example1: acl->acl(5); // 5 is the user id
*/
function acl($account_id = False)
{
global $phpgw, $phpgw_info;
@ -45,6 +63,15 @@
* These are the standard $this->account_id specific functions *
\**************************************************************************/
/*!!
* @Type: function
* @Name: read_repository
* @Author: Seek3r
* @Title: Read acl records from repository.
* @Description: Reads ACL records for $acl->account_id and returns array along with storing it in $acl->data.
* @Syntax: array read_repository()
* @Example1: acl->read_repository();
*/
function read_repository()
{
global $phpgw, $phpgw_info;
@ -73,6 +100,15 @@
return $this->data;
}
/*!!
* @Type: function
* @Name: read
* @Author: Seek3r
* @Title: Read acl records from $acl->data.
* @Description: Returns ACL records from $acl->data.
* @Syntax: array read()
* @Example1: acl->read();
*/
function read()
{
if (count($this->data) == 0){ $this->read_repository(); }
@ -80,6 +116,15 @@
return $this->data;
}
/*!!
* @Type: function
* @Name: add
* @Author: Seek3r
* @Title: Adds ACL record to $acl->data.
* @Description: Adds ACL record to $acl->data.
* @Syntax: array read()
* @Example1: acl->read();
*/
function add($appname = False, $location, $rights)
{
if ($appname == False){

View File

@ -24,9 +24,15 @@
/* $Id$ */
/****************************************************************************\
* Our API class starts here *
\****************************************************************************/
/*!!
* @Type: class
* @Name: phpgw
* @Author: Seek3r
* @Title: Main class.
* @Description: Main class. Has a few functions but is more importantly used as a parent class for everything else.
* @Syntax: CreateObject('phpgwapi.phpgw');
* @Example1: $phpgw = CreateObject('phpgwapi.acl');
*/
class phpgw
{
var $accounts;
@ -53,58 +59,52 @@
var $addressbook;
var $todo;
/************************************************************************\
* Load up the main instance of the db class. *
\************************************************************************/
function phpgw() {
global $phpgw_info;
$this->db = CreateObject("phpgwapi.db");
$this->db->Host = $phpgw_info["server"]["db_host"];
$this->db->Type = $phpgw_info["server"]["db_type"];
$this->db->Database = $phpgw_info["server"]["db_name"];
$this->db->User = $phpgw_info["server"]["db_user"];
$this->db->Password = $phpgw_info["server"]["db_pass"];
if ($this->debug) {
$this->db->Debug = 1;
}
}
function load_core_objects()
{
/************************************************************************\
* Required classes *
\************************************************************************/
$this->common = CreateObject("phpgwapi.common");
$this->hooks = CreateObject("phpgwapi.hooks");
$this->auth = createobject("phpgwapi.auth");
$this->acl = CreateObject("phpgwapi.acl");
$this->accounts = createobject("phpgwapi.accounts");
$this->session = CreateObject("phpgwapi.sessions");
$this->preferences = CreateObject("phpgwapi.preferences");
$this->applications = CreateObject("phpgwapi.applications");
$this->translation = CreateObject("phpgwapi.translation");
}
/**************************************************************************\
* Core functions *
\**************************************************************************/
/*!!
* @Type: function
* @Name: strip_html
* @Author: Seek3r
* @Title: Strips out html chars.
* @Description: Used as a shortcut for stripping out html special chars.
* @Syntax: string strip_html(string as string)
* @Example1: $reg_string = strip_html($urlencode_string);
*/
function strip_html($s)
{
return htmlspecialchars(stripslashes($s));
}
/* Wrapper to the session->link() */
/*!!
* @Type: function
* @Name: link
* @Author: Seek3r
* @Title: Wrapper to session->link()
* @Description: Used for backward compatibility and as a shortcut.
* If no url is passed, it will use PHP_SELF
* @Syntax: string link(url as string, extra_vars as string)
* @Example1: <a href="<?php echo $phpgw->link('otherpage.php');?>">click here</a>
*/
function link($url = "", $extravars = "")
{
global $phpgw, $phpgw_info, $usercookie, $kp3, $PHP_SELF;
return $this->session->link($url, $extravars);
}
/*!!
* @Type: function
* @Name: link
* @Author: Seek3r
* @Title: Handles redirects under iis and apache
* @Description: This function handles redirects under iis and apache
* it assumes that $phpgw->link() has already been called
* @Syntax: string redirect(url as string)
* @Example1: None yet
*/
function redirect($url = "")
{
// This function handles redirects under iis and apache
// it assumes that $phpgw->link() has already been called
global $HTTP_ENV_VARS;
@ -127,10 +127,20 @@
}
}
/*!!
* @Type: function
* @Name: lang
* @Author: Jengo
* @Title: Shortcut to translation class
* @Description: This function is a basic wrapper to translation->translate()
* @Syntax: string redirect(key as string)
* @Example1: None yet
*/
function lang($key, $m1 = "", $m2 = "", $m3 = "", $m4 = "")
{
global $phpgw;
return $this->translation->translate($key);
}
} //end phpgw class
/* end of class */
}
?>

View File

@ -29,6 +29,16 @@
* Direct functions, which are not part of the API class *
* because they are require to be availble at the lowest level. *
\****************************************************************************/
/*!!
* @Type: function
* @Name: CreateObject
* @Author: mdean
* @Title: Load a class and include the class file if not done so already.
* @Description: This function is used to create an instance of a class,
* and if the class file has not been included it will do so.
* @Syntax: CreateObject('app.class', 'constructor_params');
* @Example1: $phpgw->acl = CreateObject('phpgwapi.acl');
*/
function CreateObject($classname, $constructor_param = "")
{
global $phpgw, $phpgw_info, $phpgw_domain;
@ -85,7 +95,7 @@
\****************************************************************************/
error_reporting(7);
/* Make sure the header.inc.php is current. */
if ($phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"]){
if ($phpgw_info["server"]["versions"]["header"] < $phpgw_info["server"]["versions"]["current_header"]){
echo "<center><b>You need to port your settings to the new header.inc.php version.</b></center>";
exit;
}
@ -157,34 +167,47 @@
// This is where it belongs (jengo)
/* Since LDAP will return system accounts, there are a few we don't want to login. */
$phpgw_info["server"]["global_denied_users"] = array('root' => True,
'bin' => True,
'daemon' => True,
'adm' => True,
'lp' => True,
'sync' => True,
'shutdown' => True,
'halt' => True,
'mail' => True,
'news' => True,
'uucp' => True,
'operator' => True,
'games' => True,
'gopher' => True,
'nobody' => True,
'xfs' => True,
'pgsql' => True,
'mysql' => True,
'postgres' => True,
'ftp' => True,
'gdm' => True,
'named' => True
);
'bin' => True,
'daemon' => True,
'adm' => True,
'lp' => True,
'sync' => True,
'shutdown' => True,
'halt' => True,
'mail' => True,
'news' => True,
'uucp' => True,
'operator' => True,
'games' => True,
'gopher' => True,
'nobody' => True,
'xfs' => True,
'pgsql' => True,
'mysql' => True,
'postgres' => True,
'ftp' => True,
'gdm' => True,
'named' => True
);
/****************************************************************************\
* These lines load up the API, fill up the $phpgw_info array, etc *
\****************************************************************************/
/* Load main class */
$phpgw = CreateObject("phpgwapi.phpgw");
/************************************************************************\
* Load up the main instance of the db class. *
\************************************************************************/
$phpgw->db = CreateObject("phpgwapi.db");
$phpgw->db->Host = $phpgw_info["server"]["db_host"];
$phpgw->db->Type = $phpgw_info["server"]["db_type"];
$phpgw->db->Database = $phpgw_info["server"]["db_name"];
$phpgw->db->User = $phpgw_info["server"]["db_user"];
$phpgw->db->Password = $phpgw_info["server"]["db_pass"];
if ($this->debug) {
$phpgw->db->Debug = 1;
}
$phpgw->db->Halt_On_Error = "no";
@$phpgw->db->query("select count(*) from phpgw_config");
if (! @$phpgw->db->next_record()) {
@ -201,7 +224,18 @@
$phpgw_info["server"][$phpgw->db->f("config_name")] = stripslashes($phpgw->db->f("config_value"));
}
$phpgw->load_core_objects();
/************************************************************************\
* Required classes *
\************************************************************************/
$phpgw->common = CreateObject("phpgwapi.common");
$phpgw->hooks = CreateObject("phpgwapi.hooks");
$phpgw->auth = createobject("phpgwapi.auth");
$phpgw->acl = CreateObject("phpgwapi.acl");
$phpgw->accounts = createobject("phpgwapi.accounts");
$phpgw->session = CreateObject("phpgwapi.sessions");
$phpgw->preferences = CreateObject("phpgwapi.preferences");
$phpgw->applications = CreateObject("phpgwapi.applications");
$phpgw->translation = CreateObject("phpgwapi.translation");
print_debug('main class loaded');
/****************************************************************************\

View File

@ -0,0 +1,24 @@
<?php
include('../version.inc.php');
$phpgw_info['setup']['phpgwapi']['name'] = 'phpgwapi';
$phpgw_info['setup']['phpgwapi']['version'] = $phpgw_info['server']['versions']['phpgwapi'];
// $phpgw_info['setup']['phpgwapi']['app_order'] = '6';
$tables = Array();
$tables[] = 'phpgw_sessions';
$tables[] = 'phpgw_preferences';
$tables[] = 'phpgw_acl';
$tables[] = 'phpgw_hooks';
$tables[] = 'phpgw_config';
$tables[] = 'phpgw_categories';
$tables[] = 'phpgw_applications';
$tables[] = 'phpgw_ass_sessions';
$tables[] = 'phpgw_accounts';
$tables[] = 'phpgw_access_log';
$tables[] = 'phpgw_lang';
$tables[] = 'phpgw_languages';
$tables_string = implode (',', $tables);
$phpgw_info['setup']['phpgwapi']['tables'] = $tables_string;
$hooks = Array();
$hooks_string = implode (',', $hooks);
$phpgw_info['setup']['phpgwapi']['hooks'] = $hooks_string;
?>

View File

@ -0,0 +1,21 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
/**************************************************************************\
* This file should never be changed! *
* This is only to be used for the original table definitions. *
* Any changes to the tables must be done thru the tables_update and then *
* generate the tables_current *
\**************************************************************************/
?>

View File

@ -0,0 +1,17 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
/**************************************************************************\
* This file should be generated for you. It should never be edited by hand *
\**************************************************************************/
?>

View File

@ -0,0 +1,14 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
?>

View File

@ -0,0 +1,13 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 $ */
?>

View File

@ -15,4 +15,5 @@
This is a completely redundant file, but Im keeping it here because
I have some irrational feeling that I should. Seek3r
*/
//$phpgw_info["server"]["versions"]["phpgwapi"] = $phpgw_info["server"]["versions"]["phpgwapi"];
// $phpgw_info['server']['versions']['phpgwapi'] = $phpgw_info['server']['versions']['phpgwapi'];
?>

View File

@ -0,0 +1,10 @@
<?php
include('../version.inc.php');
$phpgw_info['setup']['preferences']['name'] = 'Preferences';
$phpgw_info['setup']['preferences']['version'] = $phpgw_info['server']['versions']['preferences'];
$phpgw_info['setup']['preferences']['app_order'] = 1;
$phpgw_info['setup']['preferences']['tables'] = "";
$hooks = Array();
$hooks_string = implode (',', $hooks);
$phpgw_info['setup']['preferences']['hooks'] = $hooks_string;
?>

View File

@ -12,11 +12,11 @@
/* $Id$ */
/* ######## Start security check ########## */
$d1 = strtolower(substr($phpgw_info["server"]["api_inc"],0,3));
$d2 = strtolower(substr($phpgw_info["server"]["server_root"],0,3));
$d3 = strtolower(substr($phpgw_info["server"]["app_inc"],0,3));
if($d1 == "htt" || $d1 == "ftp" || $d2 == "htt" || $d2 == "ftp" || $d3 == "htt" || $d3 == "ftp") {
echo "Failed attempt to break in via an old Security Hole!<br>\n";
$d1 = strtolower(substr($phpgw_info['server']['api_inc'],0,3));
$d2 = strtolower(substr($phpgw_info['server']['server_root'],0,3));
$d3 = strtolower(substr($phpgw_info['server']['app_inc'],0,3));
if($d1 == 'htt' || $d1 == 'ftp' || $d2 == 'htt' || $d2 == 'ftp' || $d3 == 'htt' || $d3 == 'ftp') {
echo 'Failed attempt to break in via an old Security Hole!<br>';
exit;
} unset($d1);unset($d2);unset($d3);
/* ######## End security check ########## */
@ -36,17 +36,17 @@
// password in ../header.inc.php to protect all of the setup
// pages from unauthorized use.
if(file_exists("../version.inc.php")) {
include("../version.inc.php"); // To set the current core version
if(file_exists('../version.inc.php')) {
include('../version.inc.php'); // To set the current core version
}else{
$phpgw_info["server"]["versions"]["phpgwapi"] = "Undetected";
$phpgw_info['server']['versions']['phpgwapi'] = 'Undetected';
}
$phpgw_info["server"]["app_images"] = "templates/default/images";
$phpgw_info['server']['app_images'] = 'templates/default/images';
if(file_exists("../header.inc.php")) { include("../header.inc.php"); }
if(file_exists('../header.inc.php')) { include('../header.inc.php'); }
include("./inc/phpgw_setup.inc.php");
// include("./inc/phpgw_schema_proc.inc.php");
include('./inc/phpgw_setup.inc.php');
// include('./inc/phpgw_schema_proc.inc.php');
$phpgw_setup = new phpgw_setup;
?>

View File

@ -322,23 +322,23 @@
function app_status($appname = ""){
global $phpgw_info;
$this->get_versions();
reset ($phpgw_info["server"]["versions"]);
reset ($phpgw_info['server']['versions']);
$this->db->query("select * from phpgw_applications");
while ($this->db->next_record()){
$phpgw_info["server"]["current_versions"][$this->db->f("app_name")] = $this->db->f("app_version");
$phpgw_info['server']['current_versions'][$this->db->f('app_name')] = $this->db->f('app_version');
}
while (list($key, $value) = each ($phpgw_info["server"]["versions"])){
if ($key != "header" && $key != "current_header" && $key != "" && $key != "mcrypt"){
if (!isset($phpgw_info["server"]["current_versions"][$key])){
$phpgw_info["server"]["current_versions"][$key] = "new";
$phpgw_info["setup"][$key]["status"] = "new";
}elseif ($value != $phpgw_info["server"]["current_versions"][$key]){
$phpgw_info["setup"][$key]["status"] = "upgrade";
while (list($key, $value) = each ($phpgw_info['server']['versions'])){
if ($key != 'header' && $key != 'current_header' && $key != '' && $key != 'mcrypt'){
if (!isset($phpgw_info['server']['current_versions'][$key])){
$phpgw_info['server']['current_versions'][$key] = 'new';
$phpgw_info['setup'][$key]['status'] = 'new';
}elseif ($value != $phpgw_info['server']['current_versions'][$key]){
$phpgw_info['setup'][$key]['status'] = 'upgrade';
}else{
$phpgw_info["setup"][$key]["status"] = "current";
$phpgw_info['setup'][$key]['status'] = 'current';
}
echo "phpgw_info[setup][$key][status]: ".$phpgw_info["setup"][$key]["status"]."<br>";
echo 'phpgw_info[setup][$key][status]: '.$phpgw_info['setup'][$key]['status'].'<br>';
}
}

View File

@ -11,41 +11,22 @@
/* $Id$ */
$reserved_directorys = array('phpgwapi' => True, 'doc' => True, 'setup' => True, '.' => True,
'..' => True, 'CVS' => True, 'files' => True);
$i = 30;
$dh = opendir(PHPGW_SERVER_ROOT);
while ($dir = readdir($dh)) {
if (! $reserved_directorys[$dir] && is_dir(PHPGW_SERVER_ROOT . SEP . $dir)) {
if (is_file(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'tables_new.inc.php')) {
$new_schema[] = $dir;
}
if (is_file(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'setup_info.inc.php')) {
include(PHPGW_SERVER_ROOT . SEP . $dir . SEP . 'setup' . SEP . 'setup_info.inc.php');
} else {
$setup_info[$dir] = array('name' => $dir, 'app_order' => $i++, 'version' => '0.0.0');
}
}
}
while ($app = each($setup_info)) {
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order,"
. " app_tables, app_version) values ('" . $app[0] . "', '" . $app[1]["name"]
. "',1," . $app[1]['app_order'] . ", '" . $app[1]['app_tables'] . "', '"
. $app[1]['version'] . "')");
}
include(PHPGW_SERVER_ROOT . "/setup/inc/phpgw_schema_current.inc.php");
include(PHPGW_SERVER_ROOT . "/setup/inc/phpgw_schema_proc.inc.php");
$o = new phpgw_schema_proc($phpgw_domain[$ConfigDomain]["db_type"]);
$o->m_odb = $phpgw_setup->db;
while (list(,$app) = each($new_schema)) {
include(PHPGW_SERVER_ROOT . SEP . $app . SEP . 'setup' . SEP . 'tables_new.inc.php');
echo '<br><b>Creating tables for ' . $app . '</b>';
$o->ExecuteScripts($app_tables, True);
}
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('admin', 'Administration', 1, 1, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('addressbook', 'Address Book', 1, 7, 'addressbook', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('filemanager', 'File manager', 1, 6, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('calendar', 'Calendar', 1, 9, 'calendar_entry,calendar_entry_users,calendar_entry_repeats', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('cron_apps', 'cron_apps', 0, 0, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('email', 'Email', 1, 10,NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('nntp', 'NNTP', 1, 11, 'newsgroups', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('notes', 'Notes', 1, 14, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
// This is for the add-on application, which are enabled/disabled based being in the regular or plus version
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('todo', 'ToDo List', 1, 8, 'todo', '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('transy', 'Translation Management', 1, 13, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('tts', 'Trouble Ticket System', 1, 2, NULL, '0.0.0')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('inv', 'Inventory', 1, 3, NULL, '0.0.0')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('chat', 'Chat', 1, 4, NULL, '0.0.0')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('headlines', 'Headlines', 1, 5, 'news_sites,news_headlines', '0.0.0')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('weather', 'Weather', 1, 12, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('bookmarks', 'Book Marks', 1, 15, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
$phpgw_setup->db->query("insert into phpgw_applications (app_name, app_title, app_enabled, app_order, app_tables, app_version) values ('manual', 'Manual', 1, 16, NULL, '".$phpgw_info["setup"]["currentver"]["phpgwapi"]."')");
?>