blob: 9619e835057adaa449ef4e720701616ad2ec6d3d [file] [log] [blame]
atoulmeb80b4682009-01-22 13:08:36 +00001<?php
2/*******************************************************************************
3 * Copyright (c) 2007-2009 Intalio, Inc.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Antoine Toulme, Intalio Inc.
11*******************************************************************************/
12
13// Use a class to define the hooks to avoid bugs with already defined functions.
atoulme13073032009-01-27 16:31:27 +000014class Reference_backend {
atoulmeb80b4682009-01-22 13:08:36 +000015 /*
16 * Authenticate a user.
17 * Returns the User object if the user is found, or false
18 */
atoulmedbe670e2009-01-27 11:23:51 +000019 function authenticate($User, $email, $password) {
20 $User->userid = 5;
atoulmeb80b4682009-01-22 13:08:36 +000021 }
atoulme828bc472009-01-28 06:52:51 +000022
23 /**
24 * Returns a user that is specialized in running the syncup script.
25 */
26 function syncupUser() {
27 $User = new User();
28 $User->loadFromID(1);
29 }
30
31 /**
32 * Returns the genie user that represents the headless admin for most operations,
33 * like importing a zip of translations.
34 */
35 function genieUser() {
36 $User = new User();
37 $User->loadFromID(1);
38 }
atoulme3ac52612009-02-02 13:14:39 +000039
40 /**
41 * Returns the name of the current context, one of live, staging or dev.
42 */
43 function context() {
44 return "reference";
45 }
46
47 /**
48 * Returns a hash of the parameters.
49 */
50 function db_params() {
51 return array('db_read_host' => '',
52 'db_read_user' => '',
53 'db_read_pass' => '',
54 'db_read_name' => '');
Paul Pazderski10ba3f32019-08-28 13:47:44 +020055 }
56
57 /**
58 * Returns a hash of the oauth parameters.
59 */
60 function oauth_params() {
61 return array(
62 'client_id' => '',
63 'client_secret' => '',
64 'client_callback' => ''
65 );
atoulme3ac52612009-02-02 13:14:39 +000066 }
67
68 /**
69 * Deals with error messages.
70 */
71 function error_log() {
72 $args = func_get_args();
73 error_log($args);
74 }
75
76 /**
77 * Returns the name of the directory Babel should use to work in.
78 */
79 function babel_working() {
80 return "/home/babel-working/";
81 }
atoulmeb80b4682009-01-22 13:08:36 +000082}
83
atoulme13073032009-01-27 16:31:27 +000084function __register_backend_ref($addon) {
85 $addon->register('user_authentication', array('Reference_backend', 'authenticate'));
atoulme828bc472009-01-28 06:52:51 +000086 $addon->register('syncup_user', array('Reference_backend', 'syncupUser'));
87 $addon->register('genie_user', array('Reference_backend', 'genieUser'));
atoulme3ac52612009-02-02 13:14:39 +000088 $addon->register('context', array('Reference_backend', 'context'));
89 $addon->register('db_params', array('Reference_backend', 'db_parameters'));
Paul Pazderski10ba3f32019-08-28 13:47:44 +020090 $addon->register('oauth_params', array('Reference_backend', 'oauth_params'));
atoulme3ac52612009-02-02 13:14:39 +000091 $addon->register('error_log', array('Reference_backend', 'error_log'));
92 $addon->register('babel_working', array('Reference_backend', 'babel_working'));
atoulmeb80b4682009-01-22 13:08:36 +000093}
94
atoulme13073032009-01-27 16:31:27 +000095global $register_function_backend;
96$register_function_backend = '__register_backend_ref';
atoulmeb80b4682009-01-22 13:08:36 +000097
98?>