Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-6801

Contact image not shown (and generate error) on certain server directory setups

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2.2
    • Fix Version/s: 3.2.4
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      IF your server is set up like this where the drupal root is something like
      /home/sites/<site_id>/web/

      then function getRelativePath does not work properly (in CRM/Contact/BAO/Contact.php).
      For Drupal sites it will not return the /sites/ dir within the drupal root, but the /sites/<site_id/web/sites/* dir outside drupal root.
      Not sure how often this kind of server setup occurs, but CiviCrm should look within the "drupal root" and not outside.

      I solved it like this:
      else if ( $config->userFramework == 'Drupal' ) {
      $absolutePathStr = strstr( $absolutePath, 'sites');

      ->
      else if ( $config->userFramework == 'Drupal' ) {
      $absolutePathStr = substr($absolutePath, strrpos( $absolutePath, 'sites'));

      So the last occurence of 'sites' is used. Seems safe enough for me.
      I only changed it for the "drupal" Framework, because it makes sense that directory "sites" can occur outside the web-root, but "administrator" or "files" will be very rare.

        Attachments

          Activity

            People

            • Assignee:
              sushant Sushant Paste
              Reporter:
              catorghans Hans Idink
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: