source: sandbox/workflow/branches/993/inc/common.inc.php @ 2492

Revision 2492, 3.3 KB checked in by pedroerp, 14 years ago (diff)

Ticket #993 - Trocando acessos à GLOBALS por acessos à Settings.

Line 
1<?php
2/**************************************************************************\
3* eGroupWare                                                               *
4* http://www.egroupware.org                                                *
5* --------------------------------------------                             *
6*  This program is free software; you can redistribute it and/or modify it *
7*  under the terms of the GNU General Public License as published by the   *
8*  Free Software Foundation; either version 2 of the License, or (at your  *
9*  option) any later version.                                              *
10\**************************************************************************/
11
12/**
13 * This is an other big workaround. In ajax calls, we use controller.php
14 * directly, which do not includes header.inc for performance issues.
15 * However, for phpgwAPI to work properly we need to set several
16 * constants and objects, which are created in this file (header.inc).
17 * As much as this problem still unsolved (by phpAPI group), this potencially
18 * problematic and ugly code must still here.. =(
19 */
20$old = $GLOBALS['phpgw_info']['flags'];
21$GLOBALS['phpgw_info']['flags'] = array(
22        'noheader' => True,
23        'nonavbar' => True,
24        'currentapp' => 'workflow'
25);
26
27/**
28 * the base dir must be relative to this file location because
29 * the root directory is not the some in every call.
30 */
31$base = dirname(dirname(dirname(__FILE__)));
32
33/* including expresso's header.inc.php */
34require_once ($base . '/header.inc.php');
35
36/* restoring old flags */
37$GLOBALS['phpgw_info']['flags'] = $old;
38
39
40/* assure that the correct encoding will be used (e.g string functions) */
41setlocale(LC_CTYPE, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8');
42
43
44/* define o umask para a criação de arquivos por parte do Workflow */
45umask(007);
46
47
48/**
49 * Server base path. In this module, we should only use
50 * constants defined here. PHPGW_SERVER_ROOT is defined
51 * on 'header.inc.php' which is always included by this
52 * file.
53 * @name EGW_SERVER_ROOT
54 */
55define('EGW_SERVER_ROOT', PHPGW_SERVER_ROOT);
56
57/**
58 * Server include base path. We must define our own constants
59 * because there are several cases in which workflow is called
60 * directly, thus PHPGW constants are not defined.
61 * @name EGW_INC_ROOT
62 */
63define('EGW_INC_ROOT', EGW_SERVER_ROOT . '/phpgwapi/inc/');
64
65/**
66 * Workflow base path.
67 * @name WF_SERVER_ROOT
68 */
69define('WF_SERVER_ROOT', EGW_SERVER_ROOT.'/workflow/');
70
71/**
72 * Workflow include path.
73 * @name WF_INC_ROOT
74 */
75define('WF_INC_ROOT', WF_SERVER_ROOT.'/inc/');
76
77/**
78 * Workflow lib base dir.
79 * @name WF_LIB_ROOT
80 */
81define('WF_LIB_ROOT', WF_SERVER_ROOT.'/lib/');
82
83
84/* including common classes */
85require_once WF_LIB_ROOT . 'security/Security.php';
86require_once WF_LIB_ROOT . 'factory/Factory.php';
87require_once WF_LIB_ROOT . 'factory/BaseFactory.php';
88require_once WF_LIB_ROOT . 'factory/WorkflowFactory.php';
89require_once WF_LIB_ROOT . 'factory/ProcessFactory.php';
90require_once WF_LIB_ROOT . 'settings/Settings.php';
91
92/**
93 * Expresso base url.
94 * @name EGW_BASE_URL
95 */
96define('EGW_BASE_URL', Settings::get('expresso', 'webserver_url'));
97
98/**
99 * Workflow base url.
100 * @name WF_BASE_URL
101 */
102define('WF_BASE_URL', EGW_BASE_URL . "/workflow/");
103
104
105$GLOBALS['workflow']['workflowObjects'] = Factory::getInstance('WorkflowObjects');
106?>
Note: See TracBrowser for help on using the repository browser.