function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); require_once 'Console/Getopt.php'; $shortOptions = "n:p:k:pre"; $longOptions = array('name=', 'pass='******'key=', 'prefix='); $getopt = new Console_Getopt(); $args = $getopt->readPHPArgv(); array_shift($args); list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions); $vars = array('name' => 'n', 'pass' => 'p', 'key' => 'k', 'prefix' => 'pre'); foreach ($vars as $var => $short) { ${$var} = NULL; foreach ($valid as $v) { if ($v[0] == $short || $v[0] == "--{$var}") { ${$var} = $v[1]; break; } } if (!${$var}) { ${$var} = CRM_Utils_Array::value($var, $_REQUEST); } $_REQUEST[$var] = ${$var}; } // this does not return on failure // require_once 'CRM/Utils/System.php'; CRM_Utils_System::authenticateScript(TRUE, $name, $pass); //log the execution of script CRM_Core_Error::debug_log_message('NormalizePhone.php'); // process all phones processPhones($config, $prefix); }
function __construct() { $this->initialize(); CRM_Utils_System::authenticateScript(TRUE); //log the execution of script CRM_Core_Error::debug_log_message('CiviReportMail.php'); }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); encryptDB(); }
function sfs_bin_Utils_auth() { session_start(); global $civicrm_root; require_once "{$civicrm_root}/civicrm.config.php"; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); }
function __construct() { $config = CRM_Core_Config::singleton(); //this does not return on failure require_once 'CRM/Utils/System.php'; require_once 'CRM/Utils/Hook.php'; CRM_Utils_System::authenticateScript(TRUE); //log the execution time of script CRM_Core_Error::debug_log_message('ParticipantProcessor.php'); }
/** * @param $user * @param $pass */ function authenticate($user, $pass) { session_start(); require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure // require_once 'CRM/Utils/System.php'; // CRM_Utils_System::authenticateScript( true ); CRM_Utils_System::authenticateScript(TRUE, $user, $pass); }
function __construct() { $config = CRM_Core_Config::singleton(); // this does not return on failure require_once 'CRM/Utils/System.php'; require_once 'CRM/Utils/Hook.php'; CRM_Utils_System::authenticateScript(TRUE); $config->cleanURL = 1; //log the execution time of script CRM_Core_Error::debug_log_message('UpdatePledgeRecord.php'); }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); // we now use DB locks on a per job basis processQueue(); }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); require_once 'CRM/Core/BAO/Setting.php'; CRM_Core_BAO_Setting::doSiteMove(); echo "Site Move Completed. Please visit <a href=\"{$config->userFrameworkBaseURL}\">your moved site</a> and test the move<p>"; }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2012 * $Id$ * */ function run() { session_start(); require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); require_once 'CRM/Utils/Migrate/Export.php'; $export = new CRM_Utils_Migrate_Export(); $export->run(); }
function __construct() { $this->initialize(); $config = CRM_Core_Config::singleton(); require_once 'CRM/Utils/Request.php'; require_once 'CRM/Core/PseudoConstant.php'; require_once 'CRM/Contact/BAO/Contact.php'; // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); //log the execution time of script CRM_Core_Error::debug_log_message('UpdateGreeting.php'); }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2013 * $Id$ * */ function run() { session_start(); require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); require_once 'CRM/Utils/Migrate/Export.php'; $export = new CRM_Utils_Migrate_Export(); $export->build(); CRM_Utils_System::download('CustomGroupData.xml', 'text/plain', $export->toXML()); }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2016 */ function run() { session_start(); require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); require_once 'CRM/Core/BAO/ConfigSetting.php'; $moveStatus = CRM_Core_BAO_ConfigSetting::doSiteMove(); echo $moveStatus . '<br />'; echo ts("If no errors are displayed above, the site move steps have completed successfully. Please visit <a href=\"{$config->userFrameworkBaseURL}\">your moved site</a> and test the move."); }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); if (!CRM_Core_Permission::check('administer CiviCRM')) { CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE); } encryptDB(); }
/** * A PHP cron script to run the outstanding and scheduled CiviMail jobs * initiated by Owen Barton from a mailing sent by Lobo to crm-mail * * The structure of the file is set to mimiic soap.php which is a stand-alone * script and hence does not have any UF issues. You should be able to run * this script using a web url or from the command line */ function run() { session_start(); if (!function_exists('drush_get_context')) { require_once '../civicrm.config.php'; } require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); // we now use DB locks on a per job basis require_once 'CRM/Mailing/BAO/Mailing.php'; CRM_Mailing_BAO_Mailing::processQueue(); }
function authenticate($user, $pass) { session_start(); require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure // require_once 'CRM/Utils/System.php'; CRM_Utils_System::authenticateScript(true, $user, $pass); // bootstrap CMS environment global $civicrm_root; $_SERVER['SCRIPT_FILENAME'] = "{$civicrm_root}/bin/cli.php"; require_once 'CRM/Utils/System.php'; CRM_Utils_System::loadBootStrap($user, $pass); }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2010 * $Id: index.php * To import the table used for civicrm ticketing system */ function runCodeTableImport() { session_start(); require_once '../../civicrm/civicrm.config.php'; require_once 'CRM/Core/Config.php'; require_once 'CRM/Core/DAO.php'; $config =& CRM_Core_Config::singleton(); CRM_Utils_System::authenticateScript(true); $sql = "\nCREATE TABLE IF NOT EXISTS `civicrm_value_direct_debit_display_settings` (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Default MySQL primary key',\n `entity_id` int(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n `entity_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `display_dd_block` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; //echo $sql;exit; CRM_Core_DAO::executeQuery($sql); echo "CiviCRM Direct Debit - table(s) created Successful"; //CRM_Utils_System::redirect( ); CRM_Utils_System::civiExit(); }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2016 */ function run() { session_start(); require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); if (!CRM_Core_Permission::check('administer CiviCRM')) { CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE); } require_once 'CRM/Utils/Migrate/ImportJSON.php'; $import = new CRM_Utils_Migrate_ImportJSON(); $import->run('/tmp/export.json'); }
/** * Initialization */ function initialize() { session_start(); if (!function_exists('drush_get_context')) { require_once '../civicrm.config.php'; } // hack to make code think its an upgrade mode, and not do lot of initialization which breaks the code due to new 4.2 schema $_GET['q'] = 'civicrm/upgrade/cleanup42'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); if (php_sapi_name() != "cli") { // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); } }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); //log the execution of script CRM_Core_Error::debug_log_message('civimail.cronjob.php'); // load bootstrap to call hooks require_once 'CRM/Utils/System.php'; CRM_Utils_System::loadBootStrap(); // we now use DB locks on a per job basis processQueue($config->mailerJobSize); }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2016 */ function run() { session_start(); require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); if (!CRM_Core_Permission::check('administer CiviCRM')) { CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE); } require_once 'CRM/Utils/Migrate/Export.php'; $export = new CRM_Utils_Migrate_Export(); $export->build(); CRM_Utils_System::download('CustomGroupData.xml', 'text/plain', $export->toXML()); }
/** * */ function __construct() { // you can run this program either from an apache command, or from the cli if (php_sapi_name() == "cli") { require_once "cli.php"; $cli = new civicrm_cli(); //if it doesn't die, it's authenticated } else { //from the webserver $this->initialize(); $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); //log the execution time of script CRM_Core_Error::debug_log_message('UpdateMembershipReminderDate.php'); } }
/** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ * */ function run() { session_start(); if (!array_key_exists('file', $_GET) || empty($_GET['file'])) { echo "Please send an input file to import<p>"; exit; } require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); require_once 'CRM/Utils/Migrate/Import.php'; $import = new CRM_Utils_Migrate_Import(); $import->run($_GET['file']); echo "Import Done!"; }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); require_once 'Console/Getopt.php'; $shortOptions = "n:p:s:e:k:"; $longOptions = array('name=', 'pass='******'key=', 'start=', 'end='); $getopt = new Console_Getopt(); $args = $getopt->readPHPArgv(); array_shift($args); list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions); $vars = array('start' => 's', 'end' => 'e', 'name' => 'n', 'pass' => 'p', 'key' => 'k'); foreach ($vars as $var => $short) { ${$var} = null; foreach ($valid as $v) { if ($v[0] == $short || $v[0] == "--{$var}") { ${$var} = $v[1]; break; } } if (!${$var}) { ${$var} = CRM_Utils_Array::value($var, $_REQUEST); } $_REQUEST[$var] = ${$var}; } // this does not return on failure // require_once 'CRM/Utils/System.php'; CRM_Utils_System::authenticateScript(true, $name, $pass); // check that we have a geocodeMethod if (empty($config->geocodeMethod)) { echo ts('Error: You need to set a mapping provider under Global Settings'); exit; } $config->userFramework = 'Soap'; $config->userFrameworkClass = 'CRM_Utils_System_Soap'; $config->userHookClass = 'CRM_Utils_Hook_Soap'; // we have an exclusive lock - run the mail queue processContacts($config, $start, $end); }
if (!empty($instanceInfo['title'])) { $obj->assign('reportTitle', $instanceInfo['title']); } else { $obj->assign('reportTitle', $templateInfo['label']); } $wrapper =& new CRM_Utils_Wrapper(); $arguments['urlToSession'] = array(array('urlVar' => 'instanceId', 'type' => 'Positive', 'sessionVar' => 'instanceId', 'default' => 'null')); return $wrapper->run($templateInfo['name'], null, $arguments); } } } session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; require_once 'CRM/Report/Page/Instance.php'; require_once 'CRM/Utils/Wrapper.php'; $config =& CRM_Core_Config::singleton(); CRM_Utils_System::authenticateScript(true); require_once 'CRM/Core/Lock.php'; $lock = new CRM_Core_Lock('CiviReportMail'); if ($lock->isAcquired()) { // try to unset any time limits if (!ini_get('safe_mode')) { set_time_limit(0); } // if there are named sets of settings, use them - otherwise use the default (null) CiviReportMail::processReport(); } else { throw new Exception('Could not acquire lock, another CiviReportMail process is running'); } $lock->release();
} require_once 'CRM/Utils/Mail/EmailProcessor.php'; // check if the script is being used for civimail processing or email to // activity processing. if (isset($cli->args[0]) && $cli->args[0] == "activities") { CRM_Utils_Mail_EmailProcessor::processActivities(); } else { CRM_Utils_Mail_EmailProcessor::processBounces(); } $lock->release(); } else { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); CRM_Utils_System::authenticateScript(TRUE); require_once 'CRM/Utils/System.php'; CRM_Utils_System::loadBootStrap(); //log the execution of script CRM_Core_Error::debug_log_message('EmailProcessor.php'); $lock = Civi\Core\Container::singleton()->get('lockManager')->acquire('worker.mailing.EmailProcessor'); if (!$lock->isAcquired()) { throw new Exception('Could not acquire lock, another EmailProcessor process is running'); } // try to unset any time limits if (!ini_get('safe_mode')) { set_time_limit(0); } require_once 'CRM/Utils/Mail/EmailProcessor.php'; // cleanup directories with old mail files (if they exist): CRM-4452 CRM_Utils_Mail_EmailProcessor::cleanupDir($config->customFileUploadDir . DIRECTORY_SEPARATOR . 'CiviMail.ignored');
function run($supportedArgs, $context) { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); $mailDir = MAIL_DIR_DEFAULT; if (isset($_GET['mailDir'])) { $mailDir = $_GET['mailDir']; } if (array_key_exists('context', $_GET) && isset($supportedArgs[strtolower($_GET['context'])])) { $context = $supportedArgs[strtolower($_GET['context'])]; } $email = new bin_Email2Activity($mailDir, $context); $email->run(); }
function run() { session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); require_once 'Console/Getopt.php'; $shortOptions = "n:p:s:e:k:g:parse"; $longOptions = array('name=', 'pass='******'key=', 'start=', 'end=', 'geocoding=', 'parse='); $getopt = new Console_Getopt(); $args = $getopt->readPHPArgv(); array_shift($args); list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions); $vars = array('start' => 's', 'end' => 'e', 'name' => 'n', 'pass' => 'p', 'key' => 'k', 'geocoding' => 'g', 'parse' => 'ap'); foreach ($vars as $var => $short) { ${$var} = null; foreach ($valid as $v) { if ($v[0] == $short || $v[0] == "--{$var}") { ${$var} = $v[1]; break; } } if (!${$var}) { ${$var} = CRM_Utils_Array::value($var, $_REQUEST); } $_REQUEST[$var] = ${$var}; } // this does not return on failure // require_once 'CRM/Utils/System.php'; CRM_Utils_System::authenticateScript(true, $name, $pass); // do check for geocoding. $processGeocode = false; if (empty($config->geocodeMethod)) { if ($geocoding == 'true') { echo ts('Error: You need to set a mapping provider under Global Settings'); exit; } } else { $processGeocode = true; // user might want to over-ride. if ($geocoding == 'false') { $processGeocode = false; } } // do check for parse street address. require_once 'CRM/Core/BAO/Preferences.php'; $parseAddress = CRM_Utils_Array::value('street_address_parsing', CRM_Core_BAO_Preferences::valueOptions('address_options'), false); $parseStreetAddress = false; if (!$parseAddress) { if ($parse == 'true') { echo ts('Error: You need to enable Street Address Parsing under Global Settings >> Address Settings.'); exit; } } else { $parseStreetAddress = true; // user might want to over-ride. if ($parse == 'false') { $parseStreetAddress = false; } } // don't process. if (!$parseStreetAddress && !$processGeocode) { echo ts('Error: Both Geocode mapping as well as Street Address Parsing are disabled. You must configure one or both options to use this script.'); exit; } $config->userFramework = 'Soap'; $config->userFrameworkClass = 'CRM_Utils_System_Soap'; $config->userHookClass = 'CRM_Utils_Hook_Soap'; // we have an exclusive lock - run the mail queue processContacts($config, $processGeocode, $parseStreetAddress, $start, $end); }
function run() { session_start(); if (!array_key_exists('file', $_GET) || empty($_GET['file'])) { echo "Please send an input file to import<p>"; exit; } require_once '../../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); // this does not return on failure CRM_Utils_System::authenticateScript(true); $import = new bin_migrate_import(); $import->run($_GET['file']); // clean up all caches etc CRM_Core_Config::clearDBCache(); echo "Import Done!"; }
/** * @return bool */ private function _bootstrap() { // so the configuration works with php-cli $_SERVER['PHP_SELF'] = "/index.php"; $_SERVER['HTTP_HOST'] = $this->_site; $_SERVER['REMOTE_ADDR'] = "127.0.0.1"; $_SERVER['SERVER_SOFTWARE'] = NULL; $_SERVER['REQUEST_METHOD'] = 'GET'; // SCRIPT_FILENAME needed by CRM_Utils_System::cmsRootPath $_SERVER['SCRIPT_FILENAME'] = __FILE__; // CRM-8917 - check if script name starts with /, if not - prepend it. if (ord($_SERVER['SCRIPT_NAME']) != 47) { $_SERVER['SCRIPT_NAME'] = '/' . $_SERVER['SCRIPT_NAME']; } $civicrm_root = dirname(__DIR__); chdir($civicrm_root); require_once 'civicrm.config.php'; // autoload if (!class_exists('CRM_Core_ClassLoader')) { require_once $civicrm_root . '/CRM/Core/ClassLoader.php'; } CRM_Core_ClassLoader::singleton()->register(); $this->_config = CRM_Core_Config::singleton(); // HTTP_HOST will be 'localhost' unless overwritten with the -s argument. // Now we have a Config object, we can set it from the Base URL. if ($_SERVER['HTTP_HOST'] == 'localhost') { $_SERVER['HTTP_HOST'] = preg_replace('!^https?://([^/]+)/$!i', '$1', $this->_config->userFrameworkBaseURL); } $class = 'CRM_Utils_System_' . $this->_config->userFramework; $cms = new $class(); if (!CRM_Utils_System::loadBootstrap(array(), FALSE, FALSE, $civicrm_root)) { $this->_log(ts("Failed to bootstrap CMS")); return FALSE; } if (strtolower($this->_entity) == 'job') { if (!$this->_user) { $this->_log(ts("Jobs called from cli.php require valid user as parameter")); return FALSE; } } if (!empty($this->_user)) { if (!CRM_Utils_System::authenticateScript(TRUE, $this->_user, $this->_password, TRUE, FALSE, FALSE)) { $this->_log(ts("Failed to login as %1. Wrong username or password.", array('1' => $this->_user))); return FALSE; } if (!$cms->loadUser($this->_user)) { $this->_log(ts("Failed to login as %1", array('1' => $this->_user))); return FALSE; } } return TRUE; }