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' );
36 $include_path = "../packages/:" . get_include_path();
37 set_include_path($include_path);
47 function __construct() {
48 // $include_path = "packages/" . get_include_path( );
49 // set_include_path( $include_path );
50 require_once 'Console/Getopt.php';
51 $shortOptions = "s:u:p:k:";
52 $longOptions = array('site=', 'user', 'pass');
54 $getopt = new Console_Getopt();
55 $args = $getopt->readPHPArgv();
57 list($valid, $this->args
) = $getopt->getopt2($args, $shortOptions, $longOptions);
66 foreach ($vars as $var => $short) {
68 foreach ($valid as $v) {
69 if ($v[0] == $short ||
$v[0] == "--$var") {
75 die("\nUsage: $ php5 " . $_SERVER['PHP_SELF'] . " -k key -u user -p password -s yoursite.org\n");
81 $this->authenticate($user, $pass);
88 function authenticate($user, $pass) {
90 require_once 'CRM/Core/Config.php';
92 $config = &CRM_Core_Config
::singleton();
94 // this does not return on failure
95 // require_once 'CRM/Utils/System.php';
96 // CRM_Utils_System::authenticateScript( true );
97 CRM_Utils_System
::authenticateScript(TRUE, $user, $pass);
101 // so the configuration works with php-cli
102 $_SERVER['PHP_SELF'] = "/index.php";
103 $_SERVER['HTTP_HOST'] = $this->site
;
104 $_REQUEST['key'] = $this->key
;
105 require_once ("./civicrm.config.php");
110 //$cli=new civicrm_cli ();