3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright Tech To The People http:tttp.eu (c) 2008 |
7 +--------------------------------------------------------------------+
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License along with this program; if not, contact CiviCRM LLC |
20 | at info[AT]civicrm[DOT]org. If you have questions about the |
21 | GNU Affero General Public License or the licensing of CiviCRM, |
22 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
23 +--------------------------------------------------------------------+
29 * On drupal if you have a symlink to your civi module, don't forget to create a new file - settings_location.php
30 * Enter the following code (substitute the actual location of your <drupal root>/sites directory)
32 * define( 'CIVICRM_CONFDIR', '/var/www/drupal.6/sites' );
35 $include_path = "../packages/:" . get_include_path();
36 set_include_path($include_path);
46 function __construct() {
47 // $include_path = "packages/" . get_include_path( );
48 // set_include_path( $include_path );
49 require_once 'Console/Getopt.php';
50 $shortOptions = "s:u:p:k:";
51 $longOptions = ['site=', 'user', 'pass'];
53 $getopt = new Console_Getopt();
54 $args = $getopt->readPHPArgv();
56 list($valid, $this->args
) = $getopt->getopt2($args, $shortOptions, $longOptions);
65 foreach ($vars as $var => $short) {
67 foreach ($valid as $v) {
68 if ($v[0] == $short ||
$v[0] == "--$var") {
74 die("\nUsage: $ php5 " . $_SERVER['PHP_SELF'] . " -k key -u user -p password -s yoursite.org\n");
80 $this->authenticate($user, $pass);
87 function authenticate($user, $pass) {
89 require_once 'CRM/Core/Config.php';
90 // Does calling this do anything here?
91 CRM_Core_Config
::singleton();
93 // this does not return on failure
94 // require_once 'CRM/Utils/System.php';
95 // CRM_Utils_System::authenticateScript( true );
96 CRM_Utils_System
::authenticateScript(TRUE, $user, $pass);
100 // so the configuration works with php-cli
101 $_SERVER['PHP_SELF'] = "/index.php";
102 $_SERVER['HTTP_HOST'] = $this->site
;
103 $_REQUEST['key'] = $this->key
;
104 require_once("./civicrm.config.php");
109 //$cli=new civicrm_cli ();