コード例 #1
0
 /**
  * Run some sanity checks.
  *
  * This could become a hook so that CiviCRM can run both built-in
  * configuration & sanity checks, and modules/extensions can add
  * their own checks.
  *
  * We might even expose the results of these checks on the Wordpress
  * plugin status page or the Drupal admin/reports/status path.
  *
  * @return array of messages
  * @see Drupal's hook_requirements() -
  * https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements
  */
 public function checkAll()
 {
     $messages = array_merge(CRM_Utils_Check_Security::singleton()->checkLogFileIsNotAccessible(), CRM_Utils_Check_Security::singleton()->checkUploadsAreNotAccessible(), CRM_Utils_Check_Security::singleton()->checkDirectoriesAreNotBrowseable());
     return $messages;
 }
コード例 #2
0
ファイル: Page.php プロジェクト: archcidburnziso/civicrm-core
 /**
  * This function takes care of all the things common to all
  * pages. This typically involves assigning the appropriate
  * smarty variable :)
  *
  * @return string The content generated by running this page
  */
 function run()
 {
     if ($this->_embedded) {
         return;
     }
     self::$_template->assign('mode', $this->_mode);
     $pageTemplateFile = $this->getHookedTemplateFileName();
     self::$_template->assign('tplFile', $pageTemplateFile);
     // invoke the pagRun hook, CRM-3906
     CRM_Utils_Hook::pageRun($this);
     if ($this->_print) {
         if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON))) {
             $content = self::$_template->fetch('CRM/common/snippet.tpl');
         } else {
             $content = self::$_template->fetch('CRM/common/print.tpl');
         }
         CRM_Utils_System::appendTPLFile($pageTemplateFile, $content, $this->overrideExtraTemplateFileName());
         //its time to call the hook.
         CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
         if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
             CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE, array('paper_size' => 'a3', 'orientation' => 'landscape'));
         } elseif ($this->_print == CRM_Core_Smarty::PRINT_JSON) {
             $this->ajaxResponse['content'] = $content;
             CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse);
         } else {
             echo $content;
         }
         CRM_Utils_System::civiExit();
     }
     $config = CRM_Core_Config::singleton();
     // TODO: Is there a better way to ensure these actions don't happen during AJAX requests?
     if (empty($_GET['snippet'])) {
         // Version check and intermittent alert to admins
         CRM_Utils_VersionCheck::singleton()->versionAlert();
         CRM_Utils_Check_Security::singleton()->showPeriodicAlerts();
         // Debug msg once per hour
         if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) {
             $msg = ts('Warning: Debug is enabled in <a href="%1">system settings</a>. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1')));
             CRM_Core_Session::setStatus($msg, ts('Debug Mode'));
         }
     }
     $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
     // Render page header
     if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
         CRM_Utils_System::addHTMLHead($region->render(''));
     }
     CRM_Utils_System::appendTPLFile($pageTemplateFile, $content);
     //its time to call the hook.
     CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
     echo CRM_Utils_System::theme($content, $this->_print);
     return;
 }
コード例 #3
0
ファイル: Check.php プロジェクト: hguru/224Civi
 /**
  * Run some sanity checks.
  *
  * This could become a hook so that CiviCRM can run both built-in
  * configuration & sanity checks, and modules/extensions can add
  * their own checks.
  *
  * We might even expose the results of these checks on the Wordpress
  * plugin status page or the Drupal admin/reports/status path.
  *
  * @return array of messages
  * @see Drupal's hook_requirements() -
  * https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements
  */
 public function checkAll()
 {
     $security = new CRM_Utils_Check_Security();
     $env = new CRM_Utils_Check_Env();
     $messages = array_merge($security->checkAll(), $env->checkAll());
     return $messages;
 }