/**
 * @param $dashboardId
 * @return array
 */
function gd_dashboard_admin_page_edit ( $dashboardId ) {
    $dashboardNode = gd_dashboard_load($dashboardId);
    if ( !$dashboardNode ) {
        return MENU_NOT_FOUND;
    }

    gd_datasource_set_active(get_node_field_value($dashboardNode,'field_dashboard_datasource'));

    if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) {
        return MENU_ACCESS_DENIED;
    }

    drupal_add_library('gd_dashboard_admin', 'GD_Admin_DashboardSection_Builder');
    drupal_add_js(drupal_get_path('module','gd_dashboard_admin').'/js/builder/button/action/DashboardDeleteButton.js');

    drupal_add_library('gd','datatables');
    drupal_add_library('gd','highcharts');
    drupal_add_js('sites/all/libraries/sparkline/jquery.sparkline.min.js');

    $options = array('fields'=>array('filters','drilldowns','reports','css'));
    $dashboard = gd_dashboard_create_api_object_from_node($dashboardNode,$options);

    drupal_add_http_header('Cache-Control','no-cache, max-age=0, must-revalidate, no-store');

    return gd_dashboard_admin_page($dashboard);
}
コード例 #2
0
ファイル: template.php プロジェクト: kreynen/elmsln
/**
 * Override or insert variables into the html template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function fontfolio_preprocess_html(&$vars)
{
    // We want to use core's body class 'no-sidebars' but is useless for us
    // because it doesn't ccounts fontfolio's 'sidebar' region as sidebar.
    // So we first remove it.
    $vars['classes_array'] = array_diff($vars['classes_array'], array('no-sidebars'));
    // And restore it if appropriate.
    if (empty($vars['page']['sidebar'])) {
        $vars['classes_array'][] = 'no-sidebars';
    }
    $vars['path_to_fontfolio'] = drupal_get_path('theme', 'fontfolio');
    $vars['base_path'] = base_path();
    // Attributes for html element.
    $vars['html_attributes_array'] = array('lang' => $vars['language']->language, 'dir' => $vars['language']->dir);
    // Send X-UA-Compatible HTTP header to force IE to use the most recent
    // rendering engine or use Chrome's frame rendering engine if available.
    // This also prevents the IE compatibility mode button to appear when using
    // conditional classes on the html tag.
    if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    // We want to insert inline css rules based on fonfolio theme settings.
    $bg_color = check_plain(theme_get_setting('body_bg_color'));
    $data = 'body { background-color: ' . $bg_color . '}';
    drupal_add_css($data, 'inline');
}
コード例 #3
0
 public function sendResponseHeaders()
 {
     $default_headers = array('Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT', 'Last-Modified' => gmdate(DATE_RFC1123, REQUEST_TIME), 'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', 'ETag' => '"' . REQUEST_TIME . '"');
     foreach ($default_headers as $name => $value) {
         drupal_add_http_header($name, $value);
     }
 }
コード例 #4
0
ファイル: authorize.php プロジェクト: aslakhellesoy/drupal
/**
 * Render a 403 access denied page for authorize.php
 */
function authorize_access_denied_page()
{
    drupal_add_http_header('Status', '403 Forbidden');
    watchdog('access denied', 'authorize.php', NULL, WATCHDOG_WARNING);
    drupal_set_title('Access denied');
    return t('You are not allowed to access this page.');
}
コード例 #5
0
/**
 * Return an CT file for download
 */
function churchcore__filedownload()
{
    global $files_dir;
    include_once CHURCHCORE . "/churchcore_db.php";
    $mime_types = getMimeTypes();
    $file = db_query("select * from {cc_file} f where f.id=:id and filename=:filename", array(":id" => $_GET["id"], ":filename" => $_GET["filename"]))->fetch();
    $filename = "{$files_dir}/files/{$file->domain_type}/{$file->domain_id}/{$file->filename}";
    $handle = fopen($filename, "rb");
    if ($handle == false) {
        echo "Die Datei konnte nicht gefunden werden!";
    } else {
        $contents = fread($handle, filesize($filename));
        fclose($handle);
        if (isset($mime_types[substr(strrchr($filename, '.'), 1)])) {
            drupal_add_http_header('Content-Type', $mime_types[substr(strrchr($filename, '.'), 1)], false);
        } else {
            drupal_add_http_header('Content-Type', 'application/unknown', false);
        }
        if (isset($_GET["type"]) && $_GET["type"] == "download") {
            drupal_add_http_header('Content-Disposition', 'attachment;filename="' . $file->bezeichnung . '"', false);
        } else {
            drupal_add_http_header('Content-Disposition', 'inline;filename="' . $file->bezeichnung . '"', false);
        }
        drupal_add_http_header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', false);
        drupal_add_http_header('Cache-Control', 'private', true);
        $content = drupal_get_header();
        echo $contents;
    }
}
コード例 #6
0
/**
 * Return a CT file for download
 */
function churchcore__filedownload()
{
    global $files_dir;
    include_once CHURCHCORE . "/churchcore_db.php";
    $mime_types = getMimeTypes();
    $file = db_query("SELECT * FROM {cc_file} f\n                    WHERE f.id=:id AND filename=:filename", array(":id" => getVar("id"), ":filename" => getVar("filename")))->fetch();
    if (preg_match('/^[0-9a-f]{64}$/i', $file->filename)) {
        $filename = "{$files_dir}/blobs/{$file->filename}";
    } else {
        $filename = "{$files_dir}/files/{$file->domain_type}/{$file->domain_id}/{$file->filename}";
    }
    //open file for binary read
    $handle = fopen($filename, "rb");
    if ($handle === false) {
        echo "Die Datei konnte nicht gelesen werden!";
    } else {
        if (isset($mime_types[substr(strrchr($file->bezeichnung, '.'), 1)])) {
            drupal_add_http_header('Content-Type', $mime_types[substr(strrchr($filename, '.'), 1)], false);
        } else {
            drupal_add_http_header('Content-Type', 'application/unknown', false);
        }
        if (getVar("type") == "download") {
            drupal_add_http_header('Content-Disposition', 'attachment;filename="' . $file->bezeichnung . '"', false);
        } else {
            drupal_add_http_header('Content-Disposition', 'inline;filename="' . $file->bezeichnung . '"', false);
        }
        drupal_add_http_header('Cache-Control', 'private', true);
        //disable output buffer and delete contents
        ob_end_clean();
        //steam all data to apache output buffer
        fpassthru($handle);
        //close file handle
        fclose($handle);
    }
}
コード例 #7
0
ファイル: template.php プロジェクト: rlfrahm/suitcase
function suitcase_preprocess_html(&$vars)
{
    //  ISU Bar responsive classes added to body
    $vars['attributes_array']['class'][] = 'responsive';
    $vars['attributes_array']['class'][] = 'wd-show-sidebar';
    // Drupal 7 in hook_preprocess_html()
    drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
}
 /**
  *  @method:
  *    Public method that is used to get the output based on the request
  */
 public function get_output()
 {
     $break_cache = isset($_GET['break_cache']) ? $_GET['break_cache'] : FALSE;
     //only cache if break_cache is not set
     if (!$break_cache) {
         $cached = $this->_cache();
     }
     //default variables
     $this->_load_project_node();
     $contents = $this->_load_project_contents();
     $this->nodes = $contents;
     $this->_parse_nodes($this->nodes);
     $this->nodes = $contents;
     //switches based on the format requested
     switch ($this->format) {
         case 'xml':
             drupal_add_http_header('Content-Type', 'application/xml; charset=utf-8');
             if (empty($cached)) {
                 $data = $this->_array_to_xml($this);
             } else {
                 $data = $cached;
             }
             break;
         default:
             drupal_add_http_header('Content-Type', 'application/json');
             if (empty($cached)) {
                 $data = $this->_array_to_json($this);
             } else {
                 $data = $cached;
             }
             break;
     }
     //adds data into the cache
     if (empty($cached)) {
         $data = json_decode(json_encode($data), true);
         $this->_cache('set', $data);
     }
     //download the files once the parameter is set
     if (isset($_GET['download']) && $_GET['download']) {
         //generates the download portion once download is required
         $file_path = $this->_download_project($data);
         $filename = explode('/', $file_path);
         $filename = $filename[count($filename) - 1];
         //sets all the headers for the download to work
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Cache-Control: private", false);
         // required for certain browsers
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: " . filesize($file_path));
         readfile("{$file_path}");
     }
     $output = $data;
     return $output;
 }
コード例 #9
0
 /**
  * Processes a payment POST from the CyberSource Hosted Order Page API.
  */
 public static function post()
 {
     if (!uc_cybersource_hop_include()) {
         \Drupal::logger('uc_cybersource_hop')->error('Unable to receive HOP POST due to missing or unreadable HOP.php file.');
         drupal_add_http_header('Status', '503 Service unavailable');
         print $this->t('The site was unable to receive a HOP post because of a missing or unreadble HOP.php');
         exit;
     }
     $verify = VerifyTransactionSignature($_POST);
     \Drupal::logger('uc_cybersource_hop')->notice('Receiving payment notification at URL for order @orderNumber', array('@orderNumber' => $_POST['orderNumber']));
     if (!isset($_POST['orderNumber'])) {
         \Drupal::logger('uc_cybersource_hop')->error('CS HOP attempted with invalid order number.');
         return;
     }
     if (!$verify) {
         \Drupal::logger('uc_cybersource_hop')->notice('Receiving invalid payment notification at URL for order @orderNumber. <pre>@debug</pre>', array('@orderNumber' => $_POST['orderNumber'], '@debug' => print_r($_POST, TRUE)));
         return;
     }
     // Assign posted variables to local variables.
     $decision = SafeMarkup::checkPlain($_POST['decision']);
     $reason_code = SafeMarkup::checkPlain($_POST['reasonCode']);
     $reason = _parse_cs_reason_code($reason_code);
     $payment_amount = SafeMarkup::checkPlain($_POST['orderAmount']);
     $payment_currency = SafeMarkup::checkPlain($_POST['paymentCurrency']);
     $request_id = SafeMarkup::checkPlain($_POST['requestID']);
     $request_token = SafeMarkup::checkPlain($_POST['orderPage_requestToken']);
     $reconciliation_id = SafeMarkup::checkPlain($_POST['reconciliationID']);
     $order_id = SafeMarkup::checkPlain($_POST['orderNumber']);
     $payer_email = SafeMarkup::checkPlain($_POST['billTo_email']);
     $order = Order::load($_POST['orderNumber']);
     switch ($decision) {
         case 'ACCEPT':
             \Drupal::logger('uc_cybersource_hop')->notice('CyberSource verified successful payment.');
             $duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_cybersource_hop_post} WHERE order_id = :order_id AND decision = :decision', 0, 1, array(':order_id' => $order_id, ':decision' => 'ACCEPT'))->fetchField();
             if ($duplicate) {
                 \Drupal::logger('uc_cybersource_hop')->notice('CS HOP transaction for order @order-id has been processed before.', array('@order_id' => $order_id));
                 return;
             }
             db_insert('uc_payment_cybersource_hop_post')->fields(array('order_id' => $order_id, 'request_id' => $request_id, 'request_token' => $request_token, 'reconciliation_id' => $reconciliation_id, 'gross' => $payment_amount, 'decision' => $decision, 'reason_code' => $reason_code, 'payer_email' => $payer_email, 'received' => REQUEST_TIME))->execute();
             $comment = $this->t('CyberSource request ID: @txn_id', array('@txn_id' => $request_id));
             uc_payment_enter($order_id, 'cybersource_hop', $payment_amount, $order->getUserId(), NULL, $comment);
             uc_cart_complete_sale($order);
             uc_order_comment_save($order_id, 0, $this->t('Payment of @amount @currency submitted through CyberSource with request ID @rid.', array('@amount' => $payment_amount, '@currency' => $payment_currency, '@rid' => $request_id)), 'order', 'payment_received');
             break;
         case 'ERROR':
             uc_order_comment_save($order_id, 0, $this->t("Payment error:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
             break;
         case 'REJECT':
             uc_order_comment_save($order_id, 0, $this->t("Payment is rejected:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
             break;
         case 'REVIEW':
             $order->setStatusId('review')->save();
             uc_order_comment_save($order_id, 0, $this->t('Payment is in review & not complete: @reason. Request ID @rid', array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
             break;
     }
 }
コード例 #10
0
 /**
  * jsonp payload wrapper
  *
  * prepend jsonp callbacks with a comment to prevent the rosetta-flash vulnerability
  */
 public static function getPayload ( $data, $callback = null ) {
     if ( !isset($callback) ) {
         drupal_add_http_header('Content-Type', 'application/json');
         return json_encode($data);
     } else {
         drupal_add_http_header('Content-Type', 'text/javascript');
         drupal_add_http_header('X-Content-Type-Options', 'nosniff');
         return '/**/'.$callback.'('.json_encode($data).');';
     }
 }
コード例 #11
0
ファイル: CaptchaFontPreview.php プロジェクト: Wylbur/gj
 /**
  * {@inheritdoc}
  */
 public function content(Request $request)
 {
     $token = $request->get('token');
     // Get the font from the given font token.
     if ($token == 'BUILTIN') {
         $font = 'BUILTIN';
     } else {
         // Get the mapping of font tokens to font file objects.
         $fonts = \Drupal::config('image_captcha.settings')->get('image_captcha_fonts_preview_map_cache');
         $config = \Drupal::config('captcha.settings');
         $fonts = $config->get('image_captcha_fonts_preview_map_cache');
         if (!isset($fonts[$token])) {
             echo 'bad token';
             exit;
         }
         // Get the font path.
         $font = $fonts[$token]->uri;
         // Some sanity checks if the given font is valid.
         if (!is_file($font) || !is_readable($font)) {
             echo 'bad font';
             exit;
         }
     }
     // Settings of the font preview.
     $width = 120;
     $text = 'AaBbCc123';
     $font_size = 14;
     $height = 2 * $font_size;
     // Allocate image resource.
     $image = imagecreatetruecolor($width, $height);
     if (!$image) {
         exit;
     }
     // White background and black foreground.
     $background_color = imagecolorallocate($image, 255, 255, 255);
     $color = imagecolorallocate($image, 0, 0, 0);
     imagefilledrectangle($image, 0, 0, $width, $height, $background_color);
     // Draw preview text.
     if ($font == 'BUILTIN') {
         imagestring($image, 5, 1, 0.5 * $height - 10, $text, $color);
     } else {
         imagettftext($image, $font_size, 0, 1, 1.5 * $font_size, $color, realpath($font), $text);
     }
     // Set content type.
     drupal_add_http_header('Content-Type', 'image/png');
     // Dump image data to client.
     imagepng($image);
     // Release image memory.
     imagedestroy($image);
     // Close connection.
     exit;
 }
コード例 #12
0
ファイル: runserver-prepend.php プロジェクト: redb/MNPP
 function system_watchdog($log_entry = array())
 {
     static $logs = array();
     $logs[] = $log_entry;
     $data = urlencode(serialize($logs));
     if (function_exists('drupal_add_http_header')) {
         // Drupal 7
         drupal_add_http_header('X-Runserver-Watchdog', $data);
     } else {
         // Drupal 6
         drupal_set_header('X-Runserver-Watchdog: ' . $data);
     }
 }
コード例 #13
0
/**
 * Load Kalatheme dependencies.
 *
 * Implements template_preprocess_html().
 */
function innovation_preprocess_html(&$variables)
{
    // Add theme js file here rather than in .info to add a weight and ensure it loads last
    drupal_add_js(drupal_get_path('theme', 'innovation') . '/js/innovation.js', array('scope' => 'footer', 'group' => JS_THEME, 'weight' => 200));
    // Add IE meta tag to force IE rendering mode
    $meta_ie_render_engine = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('content' => 'IE=edge,chrome=1', 'http-equiv' => 'X-UA-Compatible'));
    drupal_add_html_head($meta_ie_render_engine, 'meta_ie_render_engine');
    // WEBSPARK-189 - add actual HTTP header along with meta tag
    drupal_add_http_header('X-UA-Compatible', 'IE=Edge,chrome=1');
    // Add conditional stylesheets for IE
    drupal_add_css(path_to_theme() . '/css/ie9.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 9', '!IE' => FALSE), 'preprocess' => FALSE));
    drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
}
コード例 #14
0
 public static function deliverRawHtmlPage($result)
 {
     if (is_int($result)) {
         drupal_deliver_html_page($result);
         return;
     }
     // Emit the correct charset HTTP header, but not if the page callback
     // result is NULL, since that likely indicates that it printed something
     // in which case, no further headers may be sent, and not if code running
     // for this page request has already set the content type header.
     if (isset($result) && is_null(drupal_get_http_header('Content-Type'))) {
         drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
     }
     // Send appropriate HTTP-Header for browsers and search engines.
     global $language;
     drupal_add_http_header('Content-Language', $language->language);
     if (isset($result)) {
         print render($result);
     }
     drupal_page_footer();
 }
コード例 #15
0
/**
 * @param $reportId
 * @return array
 * @throws Exception
 * @throws IllegalArgumentException
 */
function gd_report_admin_page_edit ( $reportId ) {
    $reportNode = gd_report_load($reportId);
    if ( !$reportNode ) {
        return MENU_NOT_FOUND;
    }

    gd_datasource_set_active(get_node_field_value($reportNode,'field_report_datasource'));

    if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) {
        return MENU_ACCESS_DENIED;
    }

    drupal_add_library('gd_report_admin', 'GD_Admin_ReportSection_Builder');

    $options = array('fields' => array('datasource', 'config', 'filters', 'data', 'customview', 'tags'));
    $report = gd_report_create_api_object_from_node($reportNode,$options);

    $reportDataset = gd_data_controller_ui_metadata_get_dataset_ui_metadata($report->config->model->datasets[0],array_slice($report->config->model->datasets,1));

    drupal_add_http_header('Cache-Control','no-cache, max-age=0, must-revalidate, no-store');

    return gd_report_admin_page($report,$reportDataset);
}
コード例 #16
0
   /**
    * @function getAllLocations()
    *
    * Returns everything necessary to build a map/modal in frontend 
    * TODO: Response-data, especially those regarding additional Html-Head-files,
    * should be caplsulated in a more native function/automated process (in both, JS and Drupal)
    */
   public function getAllLocations()
   {
       $akteure = new akteure();
       $events = new events();
       # We only want future events to be shown...
       $start = array('0' => array('date' => (new \DateTime(date()))->format('Y-m-d 00:00:00'), 'operator' => '>='));
       $resultAkteure = $akteure->getAkteure(array('filter' => array('mustHaveGps' => 1)), 'minimal');
       $resultEvents = $events->getEvents(array('start' => $start, 'filter' => array('mustHaveGps' => 1), 'parent_EID' => NULL), 'complete');
       drupal_add_http_header('Content-Type', 'application/json');
       echo '{ "response" :
 {
  "akteure" : ' . json_encode($resultAkteure) . ',
  "events"  : ' . json_encode($resultEvents) . ',
  "htmlHeaders" :
  {
   "css" : "' . $this->mapboxCss . '",
   "js"  : "' . $this->mapboxJs . '",
   "jsInline" : "' . $this->mapboxJsInline . '",
   "mapName" : "' . $this->mapboxMap . '"
  }
  }}';
       drupal_exit();
   }
コード例 #17
0
/**
 * Override or insert variables into the html template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered. This is usually "html", but can
 *   also be "maintenance_page" since zen_preprocess_maintenance_page() calls
 *   this function to have consistent variables.
 */
function zen_preprocess_html(&$variables, $hook)
{
    // Add variables and paths needed for HTML5 and responsive support.
    $variables['base_path'] = base_path();
    $variables['path_to_zen'] = drupal_get_path('theme', 'zen');
    // Get settings for HTML5 and responsive support. array_filter() removes
    // items from the array that have been disabled.
    $html5_respond_meta = array_filter((array) theme_get_setting('zen_html5_respond_meta'));
    $variables['add_respond_js'] = in_array('respond', $html5_respond_meta);
    $variables['add_html5_shim'] = in_array('html5', $html5_respond_meta);
    $variables['default_mobile_metatags'] = in_array('meta', $html5_respond_meta);
    // If the user is silly and enables Zen as the theme, add some styles.
    if ($GLOBALS['theme'] == 'zen') {
        include_once './' . $variables['path_to_zen'] . '/zen-internals/template.zen.inc';
        _zen_preprocess_html($variables, $hook);
    }
    // Attributes for html element.
    $variables['html_attributes_array'] = array('lang' => $variables['language']->language, 'dir' => $variables['language']->dir);
    // Send X-UA-Compatible HTTP header to force IE to use the most recent
    // rendering engine or use Chrome's frame rendering engine if available.
    // This also prevents the IE compatibility mode button to appear when using
    // conditional classes on the html tag.
    if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    $variables['skip_link_anchor'] = theme_get_setting('zen_skip_link_anchor');
    $variables['skip_link_text'] = theme_get_setting('zen_skip_link_text');
    // Return early, so the maintenance page does not call any of the code below.
    if ($hook != 'html') {
        return;
    }
    // Classes for body element. Allows advanced theming based on context
    // (home page, node of certain type, etc.)
    if (!$variables['is_front']) {
        // Add unique class for each page.
        $path = drupal_get_path_alias($_GET['q']);
        // Add unique class for each website section.
        list($section, ) = explode('/', $path, 2);
        $arg = explode('/', $_GET['q']);
        if ($arg[0] == 'node' && isset($arg[1])) {
            if ($arg[1] == 'add') {
                $section = 'node-add';
            } elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
                $section = 'node-' . $arg[2];
            }
        }
        $variables['classes_array'][] = drupal_html_class('section-' . $section);
    }
    if (theme_get_setting('zen_wireframes')) {
        $variables['classes_array'][] = 'with-wireframes';
        // Optionally add the wireframes style.
    }
    // Store the menu item since it has some useful information.
    $variables['menu_item'] = menu_get_item();
    if ($variables['menu_item']) {
        switch ($variables['menu_item']['page_callback']) {
            case 'views_page':
                // Is this a Views page?
                $variables['classes_array'][] = 'page-views';
                break;
            case 'page_manager_page_execute':
            case 'page_manager_node_view':
            case 'page_manager_contact_site':
                // Is this a Panels page?
                $variables['classes_array'][] = 'page-panels';
                break;
        }
    }
}
コード例 #18
0
function churchcal__ical()
{
    global $base_url, $config;
    include_once CHURCHCAL . "/churchcal_db.php";
    drupal_add_http_header('Content-Type', 'text/calendar;charset=utf-8', false);
    drupal_add_http_header('Content-Disposition', 'inline;filename="ChurchTools.ics"', false);
    drupal_add_http_header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', false);
    drupal_add_http_header('Cache-Control', 'private', true);
    $content = drupal_get_header();
    $cat_names = null;
    if (isset($_GET["security"]) && isset($_GET["id"])) {
        $db = db_query("select * from {cc_calcategory} where id=:id and randomurl=:randomurl", array(":id" => $_GET["id"], ":randomurl" => $_GET["security"]))->fetch();
        if ($db != false) {
            $cat_names[$_GET["id"]] = new stdClass();
            $cat_names[$_GET["id"]]->bezeichnung = $db->bezeichnung;
            $cats = array(0 => $_GET["id"]);
        }
    }
    if ($cat_names == null) {
        $cats = churchcal_getAllowedCategories(false, true);
        $cat_names = churchcal_getAllowedCategories(false, false);
    }
    $arr = churchcal_getCalPerCategory(array("category_ids" => $cats), false);
    $txt = "";
    foreach ($arr as $cats) {
        foreach ($cats as $res) {
            $res->startdate = new DateTime($res->startdate);
            $res->enddate = new DateTime($res->enddate);
            $diff = $res->enddate->format("U") - $res->startdate->format("U");
            $subid = 0;
            foreach (getAllDatesWithRepeats($res, -90, 400) as $d) {
                $txt .= "BEGIN:VEVENT\r\n";
                $txt .= "ORGANIZER:MAILTO:" . variable_get('site_mail', '') . "\r\n";
                $txt .= "SUMMARY:" . $res->bezeichnung . "\r\n";
                //$txt.="X-MICROSOFT-CDO-BUSYSTATUS:BUSY\r\n";
                if ($res->link != "") {
                    $txt .= "URL:" . $res->link . "\r\n";
                } else {
                    $txt .= "URL:" . $base_url . "?q=churchcal\r\n";
                }
                if ($res->ort != "") {
                    $txt .= "LOCATION:" . $res->ort . "\r\n";
                }
                $subid++;
                $txt .= "UID:" . $res->id . "_{$subid}\r\n";
                $txt .= "DTSTAMP:" . churchcore_stringToDateICal($res->modified_date) . "\r\n";
                $ts = $diff + $d->format("U");
                //$enddate=new DateTime("@$ts");
                $enddate = clone $d;
                $enddate->modify("+{$diff} seconds");
                // Ganztagestermin
                if ($res->startdate->format('His') == "000000" && $res->enddate->format('His') == "000000") {
                    $txt .= "DTSTART;VALUE=DATE:" . $d->format('Ymd') . "\r\n";
                    $txt .= "DTEND;VALUE=DATE:" . date('Ymd', strtotime('+1 day', $enddate->format("U"))) . "\r\n";
                } else {
                    $txt .= "DTSTART:" . $d->format('Ymd\\THis') . "\r\n";
                    $txt .= "DTEND:" . $enddate->format('Ymd\\THis') . "\r\n";
                }
                $txt .= 'DESCRIPTION:Kalender:' . $cat_names[$res->category_id]->bezeichnung . ' - Cal[' . $res->id . '] - ' . $res->notizen . "\r\n";
                $txt .= "END:VEVENT\r\n";
            }
        }
    }
    echo surroundWithVCALENDER($txt);
}
コード例 #19
0
 * variable is defined, e.g. $node->body becomes $body. When needing to access
 * a field's raw values, developers/themers are strongly encouraged to use these
 * variables. Otherwise they will have to explicitly specify the desired field
 * language, e.g. $node->body['en'], thus overriding any language negotiation
 * rule that was previously applied.
 *
 * @see template_preprocess()
 * @see template_preprocess_node()
 * @see template_process()
 */
if (!$logged_in) {
    if ($node->field_sources) {
        $source = field_collection_item_load($node->field_sources[LANGUAGE_NONE][0]['value']);
        if ($source->field_url) {
            //dpm("Location: ".$source->field_url[LANGUAGE_NONE][0]['display_url']);
            drupal_add_http_header("Location", $source->field_url[LANGUAGE_NONE][0]['display_url']);
        }
    }
}
?>

<article<?php 
print $attributes;
?>
>
  <?php 
if (!empty($title_prefix) || !empty($title_suffix) || !$page) {
    ?>
    <header>
      <?php 
    print render($title_prefix);
コード例 #20
0
<?php

/**
 * @file
 * This template file is never used. The switch for choosing among the different
 * views_search_autocomplete_* themes based on format is done in
 * views_plugin_style_json->theme_functions()
 *
 * - $view: The View object.
 * - $rows: Array of row objects as rendered by
 *   _search_autocomplete_render_fields
 * - $options: Array of plugin style options
 *
 * @ingroup views_templates
 * @see views_plugin_style_json.inc
 * @see views_search_autocomplete_style.theme.inc
 */
if ($view->override_path) {
    // We're inside a live preview where the JSON is pretty-printed.
    $json = _search_autocomplete_encode_formatted($rows);
    print "<code>{$json}</code>";
} else {
    $json = json_encode($rows);
    // We want to send the JSON as a server response so switch the content
    // type and stop further processing of the page.
    $content_type = 'application/json';
    drupal_add_http_header("Content-Type", "{$content_type}; charset=utf-8");
    print $json;
    // Don't think this is needed in .tpl.php files: module_invoke_all('exit');
    exit;
}
コード例 #21
0
ファイル: update.php プロジェクト: boombatower/drupal
function update_access_denied_page()
{
    drupal_add_http_header('Status', '403 Forbidden');
    watchdog('access denied', 'update.php', NULL, WATCHDOG_WARNING);
    drupal_set_title('Access denied');
    return '<p>Access denied. You are not authorized to access this page. Log in using either an account with the <em>administer software updates</em> permission or the site maintenance account (the account you created during installation). If you cannot log in, you will have to edit <code>settings.php</code> to bypass this access check. To do this:</p>
<ol>
 <li>With a text editor find the settings.php file on your system. From the main Drupal directory that you installed all the files into, go to <code>sites/your_site_name</code> if such directory exists, or else to <code>sites/default</code> which applies otherwise.</li>
 <li>There is a line inside your settings.php file that says <code>$update_free_access = FALSE;</code>. Change it to <code>$update_free_access = TRUE;</code>.</li>
 <li>As soon as the update.php script is done, you must change the settings.php file back to its original form with <code>$update_free_access = FALSE;</code>.</li>
 <li>To avoid having this problem in the future, remember to log in to your website using either an account with the <em>administer software updates</em> permission or the site maintenance account (the account you created during installation) before you backup your database at the beginning of the update process.</li>
</ol>';
}
コード例 #22
0
ファイル: CSVDataHandler.php プロジェクト: ecs-hk/Checkbook
 /**
  * Generates the API file based on the format specified
  * @param $fileName
  * @return mixed
  */
 function outputFile($fileName)
 {
     global $conf;
     // validateRequest:
     if (!$this->validateRequest()) {
         return $this->response;
     }
     $fileDir = variable_get('file_public_path', 'sites/default/files') . '/' . $conf['check_book']['data_feeds']['output_file_dir'];
     $fileDir .= '/' . $conf['check_book']['export_data_dir'];
     $file = DRUPAL_ROOT . '/' . $fileDir . '/' . $fileName;
     drupal_add_http_header("Content-Type", "text/csv; utf-8");
     drupal_add_http_header("Content-Disposition", "attachment; filename=nyc-data-feed.csv");
     drupal_add_http_header("Pragma", "cache");
     drupal_add_http_header("Expires", "-1");
     if (is_file($file)) {
         $data = file_get_contents($file);
         drupal_add_http_header("Content-Length", strlen($data));
         echo $data;
     } else {
         echo "Data is not generated. Please contact support team.";
     }
 }
コード例 #23
0
/**
 * @param $dashboardNode
 * @param $reportNid
 * @return int|null
 */
function gd_dashboard_report_view ( $dashboardNode, $reportNid ) {
    ob_start();
    try {
        if ( !gd_dashboard_access_view($dashboardNode) ) {
            return MENU_ACCESS_DENIED;
        }

        $DashboardConfig = new GD_DashboardConfig($dashboardNode);
        gd_datasource_set_active($DashboardConfig->getDatasource());

        foreach ( $DashboardConfig->items as $item ) {
            if ( $reportNid == $item->content ) {
                $options = array();

                if (isset($_GET['dashboardBuilder']) && $_GET['dashboardBuilder'] == TRUE) {
                    $options['admin'] = TRUE;
                }

                if ( $DashboardConfig->isPublic() && arg(0) == 'public' ) {
                    $options['public'] = TRUE;
                }

                $html = $DashboardConfig->getItemReportView($item, $options);
                $output = array('header'=>$html->header, 'body'=>$html->body, 'footer'=>$html->footer);

                $response = new stdClass();
                $response->status = new stdClass();
                $response->status->code = 200;
                $response->status->message = 'OK';

                $response->data = $output;

                module_invoke_all('gd_ext_response_alter',$response);

                $messages = gd_get_session_messages();
                if ( !empty($messages['error']) ) {
                    $response->status->code = 500;
                    $response->status->message = $messages['error'];
                } else {
                    if ( !isset($_GET['callback']) && $DashboardConfig->isPublic() && arg(0) == 'public' ) {
                        drupal_add_http_header('Cache-Control','no-transform,public,max-age=3600,s-maxage=3600');
                        drupal_add_http_header('Expires',gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
                    }
                }

                echo \GD\Utility\Json::getPayload($response,$_GET['callback']);
            }
        }

        echo ob_get_clean();
        drupal_exit();
    } catch ( Exception $e ) {
        gd_exception_handler($e);
        $response = new stdClass();
        $response->status->code = 500;
        $response->status->message = $e->getMessage();
        echo \GD\Utility\Json::getPayload($response,$_GET['callback']);
        echo ob_get_clean();
        drupal_exit();
    }
}
コード例 #24
0
ファイル: template.php プロジェクト: EIGE/www_staging
/**
 * EIGEDR-140 Add IE Edge support and Chrome Frame
 * https://www.drupal.org/node/1203112
 * http://dropbucket.org/node/1248
 */
function _add_ie_edge_support()
{
    if (drupal_get_http_header('X-UA-Compatible') === NULL) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    $meta_ie_edge = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1'), '#weight' => -99999);
    // Add header meta tag for IE to head
    drupal_add_html_head($meta_ie_edge, 'meta_ie_edge');
}
コード例 #25
0
ファイル: Drupal.php プロジェクト: nielosz/civicrm-core
 /**
  * @inheritDoc
  */
 public function setHttpHeader($name, $value)
 {
     drupal_add_http_header($name, $value);
 }
コード例 #26
0
ファイル: template.php プロジェクト: ehazell/AWPF
function agency_1_process_html(&$page)
{
    drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    //color module support
    if (module_exists('color')) {
        _color_html_alter($page);
    }
}
コード例 #27
0
ファイル: public.php プロジェクト: reasonat/women
 /**
  * Inserts the xua-compatible header if the user has accepted
  * ToS and has API key
  */
 public static function set_xua_compatible_header()
 {
     if (ShareaholicUtilities::has_tos_and_apikey() && !drupal_get_http_header('X-UA-Compatible')) {
         drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
     }
 }
コード例 #28
0
ファイル: template.php プロジェクト: reyjmc03/gwt-drupal
/**
 * Override or insert variables into the html template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered. This is usually "html", but can
 *   also be "maintenance_page" since gwt_drupal_preprocess_maintenance_page() calls
 *   this function to have consistent variables.
 */
function gwt_drupal_preprocess_html(&$variables, $hook)
{
    // Add variables and paths needed for HTML5 and responsive support.
    $variables['base_path'] = base_path();
    $variables['path_to_gwt_drupal'] = drupal_get_path('theme', 'gwt_drupal');
    // Get settings for HTML5 and responsive support. array_filter() removes
    // items from the array that have been disabled.
    $html5_respond_meta = array_filter((array) theme_get_setting('gwt_drupal_html5_respond_meta'));
    $variables['add_respond_js'] = in_array('respond', $html5_respond_meta);
    $variables['add_html5_shim'] = in_array('html5', $html5_respond_meta);
    $variables['default_mobile_metatags'] = in_array('meta', $html5_respond_meta);
    $variables['path_to_gwt'] = drupal_get_path('theme', 'gwt_drupal');
    // Attributes for html element.
    $variables['html_attributes_array'] = array('lang' => $variables['language']->language, 'dir' => $variables['language']->dir);
    // Send X-UA-Compatible HTTP header to force IE to use the most recent
    // rendering engine or use Chrome's frame rendering engine if available.
    // This also prevents the IE compatibility mode button to appear when using
    // conditional classes on the html tag.
    if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    $variables['skip_link_anchor'] = theme_get_setting('gwt_drupal_skip_link_anchor');
    $variables['skip_link_text'] = theme_get_setting('gwt_drupal_skip_link_text');
    // Return early, so the maintenance page does not call any of the code below.
    if ($hook != 'html') {
        return;
    }
    // Serialize RDF Namespaces into an RDFa 1.1 prefix attribute.
    if ($variables['rdf_namespaces']) {
        $prefixes = array();
        foreach (explode("\n  ", ltrim($variables['rdf_namespaces'])) as $namespace) {
            // Remove xlmns: and ending quote and fix prefix formatting.
            $prefixes[] = str_replace('="', ': ', substr($namespace, 6, -1));
        }
        $variables['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
    }
    // Classes for body element. Allows advanced theming based on context
    // (home page, node of certain type, etc.)
    if (!$variables['is_front']) {
        // Add unique class for each page.
        $path = drupal_get_path_alias($_GET['q']);
        // Add unique class for each website section.
        list($section, ) = explode('/', $path, 2);
        $arg = explode('/', $_GET['q']);
        if ($arg[0] == 'node' && isset($arg[1])) {
            if ($arg[1] == 'add') {
                $section = 'node-add';
            } elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
                $section = 'node-' . $arg[2];
            }
        }
        $variables['classes_array'][] = drupal_html_class('section-' . $section);
    }
    if (theme_get_setting('gwt_drupal_wireframes')) {
        $variables['classes_array'][] = 'with-wireframes';
        // Optionally add the wireframes style.
    }
    // Store the menu item since it has some useful information.
    $variables['menu_item'] = menu_get_item();
    if ($variables['menu_item']) {
        switch ($variables['menu_item']['page_callback']) {
            case 'views_page':
                // Is this a Views page?
                $variables['classes_array'][] = 'page-views';
                break;
            case 'page_manager_blog':
            case 'page_manager_blog_user':
            case 'page_manager_contact_site':
            case 'page_manager_contact_user':
            case 'page_manager_node_add':
            case 'page_manager_node_edit':
            case 'page_manager_node_view_page':
            case 'page_manager_page_execute':
            case 'page_manager_poll':
            case 'page_manager_search_page':
            case 'page_manager_term_view_page':
            case 'page_manager_user_edit_page':
            case 'page_manager_user_view_page':
                // Is this a Panels page?
                $variables['classes_array'][] = 'page-panels';
                break;
        }
    }
}
 * - $rows: Hierachial array of key=>value pairs to convert to JSON
 * - $options: Array of options for this style
 *
 * @ingroup views_templates
 */
$jsonp_prefix = $options['jsonp_prefix'];
if ($view->override_path) {
    // We're inside a live preview where the JSON is pretty-printed.
    $json = _views_json_encode_formatted($rows, $options);
    if ($jsonp_prefix) {
        $json = "{$jsonp_prefix}({$json})";
    }
    print "<code>{$json}</code>";
} else {
    $json = json_encode($rows);
    if ($jsonp_prefix) {
        $json = "{$jsonp_prefix}({$json})";
    }
    if ($options['using_views_api_mode']) {
        // We're in Views API mode.
        print $json;
    } else {
        // We want to send the JSON as a server response so switch the content
        // type and stop further processing of the page.
        $content_type = $options['content_type'] == 'default' ? 'application/json' : $options['content_type'];
        drupal_add_http_header("Content-Type", $content_type . '; charset=utf-8');
        print $json;
        drupal_page_footer();
        exit;
    }
}
コード例 #30
-2
function gd_health_medic_admin_api_treatment () {
    try {
        $response = 'OK';

        switch ($_SERVER['REQUEST_METHOD']) {
            case 'GET' :
                break;

            case 'POST' :
                gd_health_medic_treatment_apply(json_decode($_POST['affected']), $_POST['treatment']);
                break;

            default:
                throw new Exception('Unsupported request method.');
        }
    } catch ( Exception $e ) {
        drupal_add_http_header('Status', '500 System Error');
        gd_get_session_messages();
        LogHelper::log_error($e);
        $response = $e->getMessage();
    }

    echo json_encode($response);
    drupal_exit();
}