コード例 #1
0
 /**
  * Constructor. Registers the addon name to use.
  * The addon name should be the name of the folder in use.
  * You can directly pass the addon name, or have it be consumed
  * from a properties file as a separate location, under the key "addon".
  */
 function AddonsManagement($addon = null)
 {
     if (!isset($addon)) {
         if (!isset($ini_file_path)) {
             $ini_file_path = dirname(__FILE__) . '/../../addons/addons.conf';
         }
         if (($ini = @parse_ini_file($ini_file_path)) && isset($ini['addons'])) {
             $addon = $ini['addons'];
         }
         if (!isset($addon)) {
             $addon = $_ENV['BABEL_ADDONS'];
         }
         if (!isset($addon)) {
             exitTo();
         }
     }
     $this->addon = $addon;
 }
コード例 #2
0
 function connect()
 {
     static $dbh;
     global $addon;
     $db_params = $addon->callHook('db_params');
     $dbh = mysql_connect($db_params['db_read_host'], $db_params['db_read_user'], $db_params['db_read_pass']);
     if (!$dbh) {
         errorLog("Failed attempt to connect to server - aborting.");
         exitTo("/error.php?errNo=101301", "error: 101301 - data server can not be found");
     }
     $database = $db_params['db_read_name'];
     if (isset($database)) {
         if (!mysql_select_db($database)) {
             errorLog("Failed attempt to open database: {$database} - aborting \n\t" . mysql_error());
             exitTo("/error.php?errNo=101303", "error: 101303 - unknown database name");
         }
     }
     return $dbh;
 }
コード例 #3
0
ファイル: global.php プロジェクト: Tiger66639/server-1
function InitPage($login)
{
    $page = $login;
    $lastPage = GetSessionVar('s_pageName');
    $User = GetSessionVar('User');
    if (empty($GLOBALS['page'])) {
        $GLOBALS['page'] = '';
    }
    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], "login.php") == FALSE && strpos($_SERVER['REQUEST_URI'], "callback") == FALSE) {
        SetSessionVar('s_pageLast', $_SERVER['REQUEST_URI']);
    }
    $dbc = new DBConnection();
    global $dbh;
    $dbh = $dbc->connect();
    if ($login == "login" && !$User) {
        # Login required, but the User object isn't there.
        if (isset($_COOKIE[COOKIE_REMEMBER])) {
            # Try to fetch username from session
            require_once dirname(__FILE__) . "/../classes/system/session.class.php";
            $Session = new Session();
            if (!$Session->validate()) {
                exitTo("login.php");
            } else {
                $User = new User();
                $User->loadFromID($Session->_userid);
                SetSessionVar("User", $User);
            }
        } else {
            exitTo("login.php");
        }
    }
    $GLOBALS['g_PHPSELF'] = $GLOBALS['page'];
    $GLOBALS['g_PAGE'] = $page;
    if (isset($_SERVER['HTTP_HOST'])) {
        $GLOBALS['g_SITEURL'] = $_SERVER['HTTP_HOST'];
        $GLOBALS['g_SITENAME'] = substr($GLOBALS['g_SITEURL'], 0, strlen($GLOBALS['g_SITEURL']) - 4);
        $GLOBALS['g_TITLE'] = $GLOBALS['g_SITENAME'];
    }
    $GLOBALS['g_ERRSTRS'] = array("", "", "", "", "", "", "", "", "", "", "");
    $GLOBALS['DEBUG'] = "";
}
コード例 #4
0
ファイル: map_files.php プロジェクト: Tiger66639/server-1
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eclipse Foundation - Initial API and implementation
 *    Kit Lo (IBM) - patch, bug 266010, Map file table does not show release train and file name info
 *    Kit Lo (IBM) - Bug 299402, Extract properties files from Eclipse project update sites for translation
*******************************************************************************/
include "global.php";
InitPage("");
global $User;
global $dbh;
if (!isset($User->userid)) {
    exitTo("importing.php");
}
if ($User->is_committer != 1) {
    exitTo("login.php?errNo=3214", "error: 3214 - you must be an Eclipse committer to access this page.");
}
require dirname(__FILE__) . "/../classes/file/file.class.php";
$pageTitle = "Babel - Define Map Files or Update Sites";
$pageKeywords = "";
$incfile = "content/en_map_files.php";
$PROJECT_ID = getHTTPParameter("project_id");
$VERSION = getHTTPParameter("version");
$TRAIN_ID = getHTTPParameter("train_id");
$FILE_FLD = getHTTPParameter("fileFld");
$PATTERNS = getHTTPParameter("patterns");
$FILENAME = getHTTPParameter("filename");
$SUBMIT = getHTTPParameter("submit");
$VERSION = preg_replace("/^\\* /", "", $VERSION);
if ($SUBMIT == "Save") {
    if ($PROJECT_ID != "" && $VERSION != "" && $FILE_FLD != "") {
コード例 #5
0
ファイル: login.php プロジェクト: Tiger66639/server-1
            }
            // we couldn't authenticate, therefore we don't have a user anymore
            $User = null;
        } else {
            # create session
            $Session = new Session();
            $Session->create($User->userid, $REMEMBER);
            SetSessionVar('User', $User);
            if (isset($_SESSION['s_pageLast'])) {
                if ($_SESSION['s_pageLast'] != "") {
                    exitTo($_SESSION['s_pageLast']);
                } else {
                    exitTo("translate.php");
                }
            } else {
                exitTo("translate.php");
            }
        }
    } else {
        $GLOBALS['g_ERRSTRS'][0] = "Your username and password must not be empty.";
    }
}
if ($SUBMIT == "Logout") {
    $Session = new Session();
    $Session->destroy();
    // we're logging out, therefore we don't have a user anymore
    $User = null;
    $GLOBALS['g_ERRSTRS'][0] = "You have successfully logged out.  You can login again using the form below.";
}
# TODO: finish the intro text
global $addon;