当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_exit函数代码示例

本文整理汇总了PHP中drupal_exit函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_exit函数的具体用法?PHP drupal_exit怎么用?PHP drupal_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_exit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: neuflize_users_export_csv_download

/**
 * Menu callback for admin/people/neuflize-users-export
 *
 * Let admin download a csv file of existing users.
 */
function neuflize_users_export_csv_download($csv)
{
    $datas = neuflize_users_export_get_users();
    $csv = neuflize_users_export_csv_render($datas);
    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-Type: application/csv;charset=utf-8");
    header("Content-Disposition: attachment;");
    header("Content-Transfer-Encoding: binary");
    print $csv;
    drupal_exit();
}
开发者ID:nyl-auster,项目名称:snippets,代码行数:20,代码来源:drupal-7--user-export-csv.php

示例2: vcard_download

 /**
  * Möglichkeit, einen einzelnen Akteur als .vcf-Datei (VCard-Format)
  * zu exportieren.
  * TODO: Behebe invalidität (ein Zeilenumbruch zu viel)
  */
 public function vcard_download()
 {
     global $user;
     $resultAkteur = db_select($this->tbl_akteur, 'a')->fields('a')->condition('AID', $this->akteur_id)->execute()->fetchObject();
     $resultAdresse = db_select($this->tbl_adresse, 'ad')->fields('ad')->condition('ADID', $resultAkteur->adresse)->execute()->fetchObject();
     //Generierung der .vcf-Datei
     $var .= "BEGIN:VCARD\r";
     $var .= "VERSION:3.0\r\n";
     $var .= "REV:" . date('Y-m-d H:i:s') . "\r\n";
     $var .= "TITLE:" . $resultAkteur->name . "\r\n";
     $var .= "N:" . str_replace(" ", ";", $resultAkteur->name) . "\r\n";
     $var .= "FN:" . $resultAkteur->ansprechpartner . "\r\n";
     $var .= "TZ:" . date('O') . "\r\n";
     $var .= "EMAIL;TYPE=PREF,INTERNET:" . $resultAkteur->email . "\r\n";
     $var .= "SOURCE:https://leipzger-ecken.de/download_vcard/" . $resultAkteur->AID . "\r\n";
     $var .= "URL:https://leipziger-ecken.de/akteurprofil/" . $resultAkteur->AID . "\r\n";
     if (!empty($resultAkteur->bild)) {
         $var .= "PHOTO;VALUE=URL;TYPE=JPEG:https://leipziger-ecken.de" . $resultAkteur->bild . "\r\n";
     }
     if (!empty($resultAdresse->strasse) && !empty($resultAdresse->nr) && !empty($resultAdresse->plz)) {
         $var .= "ADR;TYPE=WORK:;;" . $resultAdresse->strasse . " " . $resultAdresse->nr . ";" . $resultAdresse->plz . ";Leipzig\r\n";
         $var .= "LABEL;TYPE=WORK:" . $resultAdresse->strasse . " " . $resultAdresse->nr . ", " . $resultAdresse->plz . " Leipzig\r\n";
     }
     if (!empty($resultAkteur->telefon)) {
         $var .= "TEL;TYPE=WORK,VOICE:" . $resultAkteur->telefon . "\r\n";
     }
     if (!empty($resultAkteur->beschreibung)) {
         $numwords = 30;
         preg_match("/(\\S+\\s*){0,{$numwords}}/", $resultAkteur->beschreibung, $regs);
         $var .= "NOTE:" . trim($regs[0]) . "...\r\n";
     }
     $var .= "END:VCARD\r";
     $fileName = htmlspecialchars($resultAkteur->name);
     $fileName = str_replace(" ", "_", $fileName);
     $fileName = str_replace(".", "_", $fileName);
     header('Content-Length: ' . strlen($var));
     header("Content-type:text/x-vCard; charset=utf-8");
     header("Content-Disposition: attachment; filename=vcard_" . $fileName . ".vcf");
     //header('Connection', 'close');
     echo $var;
     drupal_exit();
 }
开发者ID:JuliAne,项目名称:easteasteast,代码行数:47,代码来源:akteurprofil.php

示例3: download

 /**
  * Download the archive
  * @param type $errorsInHeaders
  * @return boolean
  */
 public function download($errorsInHeaders = FALSE)
 {
     if (file_exists($this->zipFileName) === FALSE) {
         $file_exists = FALSE;
         $file_size = 0;
         $error_code = 1;
     } else {
         $file_exists = TRUE;
         $error_code = 0;
         $file_size = filesize($this->zipFileName);
     }
     $headers = array('Content-Type: application/x-zip-compressed; name="filedepot_archive.zip"', 'Content-Length: ' . $file_size, 'Content-Disposition: attachment; filename="filedepot_archive.zip"', 'Cache-Control: private', 'Error-Code: ' . $error_code, 'FileSize: ' . $file_size);
     // This has to be manually done so we can still show error header information
     foreach ($headers as $value) {
         //drupal_add_http_header($name, $value);
         header($value);
     }
     if ($file_exists === TRUE) {
         $fp = fopen($this->zipFileName, 'rb');
         while (!feof($fp)) {
             echo fread($fp, 1024);
             flush();
             // this is essential for large downloads
         }
         fclose($fp);
     } else {
         echo "";
     }
     drupal_exit();
 }
开发者ID:dalia-m-elsayed,项目名称:spica,代码行数:35,代码来源:filedepot_archiver.class.php

示例4: scsmetronic_subtheme_preprocess_page

/**
 * Processes variables for block.tpl.php.
 *
 * Prepares the values passed to the theme_block function to be passed
 * into a pluggable template engine. Uses block properties to generate a
 * series of template file suggestions. If none are found, the default
 * block.tpl.php is used.
 *
 * Most themes utilize their own copy of block.tpl.php. The default is located
 * inside "modules/block/block.tpl.php". Look in there for the full list of
 * variables.
 *
 * The $variables array contains the following arguments:
 * - $block
 *
 * @see block.tpl.php
 */
function scsmetronic_subtheme_preprocess_page(&$variables)
{
    global $user;
    if (variable_get('scsmetronic_redirect_to_login') && $user->uid == 0 && arg(0) != 'user') {
        //header('Location: ' . url('user/login', array( 'absolute' => TRUE)), TRUE, 302);
        // Handle redirection to the login form.
        // using drupal_goto() with destination set causes a recursive redirect loop
        $login_path = 'user/login';
        $code = 302;
        // The code in drupal_get_destination() doesn't preserve any query string
        // on 403 pages, so reproduce the part we want here.
        $path = isset($_GET['destination']) ? $_GET['destination'] : '<front>';
        $query = drupal_http_build_query(drupal_get_query_parameters(NULL, array('q', 'destination')));
        if ($query != '') {
            $path .= '?' . $query;
        }
        $destination = array('destination' => $path);
        header('Location: ' . url($login_path, array('query' => $destination, 'absolute' => TRUE)), TRUE, 302);
        drupal_exit();
    }
    $variables['navbar_top'] = 'navbar-static-top';
    $theme_header = theme_get_setting('theme_header', 'scsmetronic');
    if (!empty($theme_header) && $theme_header !== 'default') {
        $variables['navbar_top'] = 'navbar-fixed-top';
    }
    //Get the entire main menu tree
    $main_menu_name = theme_get_setting('theme_main_menu', 'scsmetronic');
    $main_menu_tree = menu_tree_all_data($main_menu_name);
    $user_menu_tree = menu_tree_all_data('user-menu');
    //Add the rendered output to the $main_menu_expanded variable
    $variables['main_menu_expanded'] = menu_tree_output($main_menu_tree);
    $variables['user_menu_expanded'] = menu_tree_output($user_menu_tree);
    if ($modal_form_paths = theme_get_setting('theme_modal')) {
        $modal_forms = explode("\r\n", $modal_form_paths);
        drupal_add_js(array('scsmetronic_forms_modal' => $modal_forms), 'setting');
    }
    if ($user->uid) {
        $name = theme('username', array('account' => $user, 'link_path' => NULL));
    } else {
        $name = variable_get('anonymous', t('Guest'));
    }
    $variables['loggedin_user_name'] = $name;
    $variables['image'] = scsmetronic_login_user_image($user);
}
开发者ID:Thomsonaj,项目名称:Ken,代码行数:61,代码来源:template.php

示例5: getDbStats

function getDbStats($nodeid, $userid)
{
    try {
        $node = node_load($nodeid);
        if (!$node) {
            echo json_encode(array(status => 0, message => "Request for stats is for an umknown node"));
            drupal_exit();
        }
        $m = field_get_items("node", $node, "yesno_subtask_milestone_value");
        $milestone = $m[0]["value"] == "" ? 0 : $m[0]["value"];
        $t = field_get_items("node", $node, "yesno_threshold");
        /*
         Cast this result to an int to ensure that the comparison in the query is correct - the query builder appears to examine the data type to decide whether or not
         to quote the value - probably does not matter in mysql but does not work in sqllite
        */
        $threshold = (int) $t[0]["value"];
        //Create a query to count the completed answers
        /*$query = db_select("yesno_responses",'r')
                 ->fields('r', array("objectid"))
                 ->condition("r.nodeid",$nodeid)
                 ->groupBy("r.objectid");
          $query->havingCondition("rcount",$threshold,">=");
          $query->addExpression("count(r.id)","rcount");*/
        $query = db_select("yesno_response_summaries", "r")->fields('r', array("objectid"))->condition("r.nodeid", $nodeid)->condition("r.responsecount", $threshold, ">=");
        //Get the total number of completed answers based on the threshold
        $completed = $query->countQuery()->execute()->fetchField();
        $result = $query->execute();
        //$sql = "select count(*) from yesno_responses where nodeid = :nid";
        //db_query($sql,array(":nid"=>$nodeid))->fetchField();
        //Cannot use the summaries table here because these stats are user specific and the summaries table is task specific
        $query = db_select("yesno_responses", "r")->fields('r', array("answer", "objectid"))->condition("r.nodeid", $nodeid);
        //Get the total number of answers
        $answers = $query->countQuery()->execute()->fetchField();
        $query->condition("r.userid", $userid);
        $contributions = $query->countQuery()->execute()->fetchField();
        $query->groupBy('answer');
        $query->addExpression("count(r.id)", "rcount");
        $result = $query->execute();
        $yes = 0;
        $no = 0;
        $dn = 0;
        while ($row = $result->fetchAssoc()) {
            switch ($row["answer"]) {
                case -1:
                    $no = $row["rcount"];
                    break;
                case 0:
                    $dn = $row["rcount"];
                    break;
                case 1:
                    $yes = $row["rcount"];
                    break;
            }
        }
        $contributors = db_select("yesno_responses", "r")->fields("r", array("userid"))->distinct()->condition("r.nodeid", $nodeid)->countQuery()->execute()->fetchField();
        //Counting of records needs more thinking about - how do we count answers?
        $totrecs = db_select("yesno_manifest_entries", "m")->condition("nodeid", $nodeid)->countQuery()->execute()->fetchField();
        echo json_encode(array(status => 1, total => $totrecs, responses => $answers, completed => $completed, contributions => $contributions, contributors => $contributors, yes => $yes, no => $no, dontknow => $dn, milestone => $milestone, threshold => $threshold));
    } catch (PDException $e) {
        echo json_encode(array(status => 0, message => "Could not parse data file! Reason: {$e->getMessage()}"));
    }
}
开发者ID:rbgeplantsman,项目名称:YesNo,代码行数:62,代码来源:yesnostats.php

示例6: adosspp_commerce_abonnes_csv_page_callback

function adosspp_commerce_abonnes_csv_page_callback()
{
    $datas = _abonnes_get_table_datas();
    if (empty($datas)) {
        return;
    }
    $header = array();
    foreach ($datas['header'] as $item) {
        $header[] = $item['data'];
    }
    $first_line = csv_convert_single_line_array_to_string($header);
    $csv = '';
    $csv .= $first_line;
    $csv .= "\r\n";
    $csv .= csv_convert_all_lines_array_to_string($datas["rows"]);
    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-Type: application/csv;charset=utf-8");
    header('Content-Disposition: attachment; filename="export.csv"');
    header("Content-Transfer-Encoding: binary");
    print $csv;
    drupal_exit();
}
开发者ID:nyl-auster,项目名称:snippets,代码行数:26,代码来源:php--export-csv-example.php

示例7: removeEvent

    /**
     * @function removeEvent
     * Returns interface for removing an event
     */
    public function removeEvent()
    {
        $explodedpath = explode("/", current_path());
        $event_id = $this->clearContent($explodedpath[1]);
        if (!user_is_logged_in() || !$this->event->isAuthorized($event_id, $this->user_id)) {
            drupal_access_denied();
            drupal_exit();
        }
        if (isset($_POST['submit'])) {
            $this->event->removeEvent($event_id);
            if (session_status() == PHP_SESSION_NONE) {
                session_start();
            }
            drupal_set_message(t('Das Event wurde gelöscht.'));
            header("Location: " . $base_url . "/events");
            // Und "Tschö mit ö..."!
        } else {
            $pathThisFile = $_SERVER['REQUEST_URI'];
            return '<div class="callout row">
 <h4><strong>' . t('Möchten Sie dieses Event wirklich löschen?') . '</strong></h4><br />
 <form action=' . $pathThisFile . ' method="POST" enctype="multipart/form-data">
   <input name="event_id" type="hidden" id="eventEIDInput" value="' . $event_id . '" />
   <a class="secondary button" href="javascript:history.go(-1)">Abbrechen</a>
   <input type="submit" class="button" id="eventSubmit" name="submit" value="Löschen">
 </form></div>';
        }
    }
开发者ID:JuliAne,项目名称:easteasteast,代码行数:31,代码来源:eventprofil.php

示例8: run

 /**
  *  Routing behaviour
  *  @returns $profileHTML;
  */
 public function run()
 {
     if (isset($_POST['submit'])) {
         if ($this->target == 'update') {
             if (!$this->isAuthorized($this->akteur_id)) {
                 drupal_access_denied();
                 drupal_exit();
             }
             $this->akteurUpdaten();
         } else {
             $this->akteurSpeichern();
         }
     } else {
         // Load input-values via akteure-model
         if ($this->target == 'update') {
             if (!$this->isAuthorized($this->akteur_id)) {
                 drupal_access_denied();
                 drupal_exit();
             } else {
                 # formerly: $this->akteurGetFields();
                 $this->__setSingleAkteurVars(reset($this->getAkteure(array('AID' => $this->akteur_id), 'complete')));
                 if (module_exists('aggregator')) {
                     $this->rssFeed = aggregator_feed_load('aae-feed-' . $this->akteur_id);
                 }
             }
         }
     }
     return $this->akteurDisplay();
 }
开发者ID:JuliAne,项目名称:easteasteast,代码行数:33,代码来源:akteurformular.php

示例9: exportToFile

 /**
  * {@inheritdoc}
  */
 public function exportToFile($name)
 {
     $content = $this->generateFileContent();
     header("Content-Type: text/plain");
     header("Content-Disposition: attachment; filename=\"{$name}\";");
     echo $content;
     drupal_exit();
 }
开发者ID:aleph-n,项目名称:opencholar,代码行数:11,代码来源:CsvExport.class.php

示例10: __construct

 function __construct($action)
 {
     parent::__construct();
     global $user;
     if (!array_intersect(array('administrator', 'festival'), $user->roles)) {
         drupal_access_denied();
         drupal_exit();
     } else {
         # if update -> needs to be admin or global admin
     }
     if ($action == 'update') {
         $this->target = 'update';
     }
     $explodedpath = explode('/', current_path());
     $this->festival_id = $this->clearContent($explodedpath[1]);
 }
开发者ID:JuliAne,项目名称:easteasteast,代码行数:16,代码来源:festivalformular.php

示例11: getAkteurAdresse

 /**
  * @function getAkteurAdresse()
  *
  * Gibt Adresse eines Akteurs wieder, welche (wie im eventformular) zur
  * dynamischen Anzeige dient
  */
 public function getAkteurAdresse($id)
 {
     $akteur_id = $this->clearContent($id);
     if (!is_numeric($akteur_id)) {
         // Festival = Get festival-admin-akteur
         $fAkteurId = db_select($this->tbl_festival, 'f')->fields('f', array('admin'))->condition('FID', str_replace('f', '', $akteur_id))->execute()->fetchObject();
         $akteur_id = $fAkteurId->admin;
     }
     if (empty($akteur_id) || $akteur_id == 0) {
         drupal_exit();
     }
     $akteurAdresse = db_select($this->tbl_akteur, 'a')->fields('a', array('adresse'))->condition('AID', $akteur_id)->execute()->fetchObject();
     $resultAdresse = db_select($this->tbl_adresse, 'ad')->fields('ad')->condition('ADID', $akteurAdresse->adresse)->execute()->fetchObject();
     echo json_encode($resultAdresse);
     drupal_exit();
 }
开发者ID:JuliAne,项目名称:easteasteast,代码行数:22,代码来源:aae_data_ajax_requests.php

示例12: __construct

 function __construct($action = false)
 {
     parent::__construct();
     $explodedpath = explode('/', current_path());
     $this->event_id = $this->clearContent($explodedpath[1]);
     $this->event = new events();
     $this->tagsHelper = new tags();
     $this->adressHelper = new adressen();
     // Sollen die Werte im Anschluss gespeichert oder geupdatet werden?
     if ($action == 'update') {
         $this->target = 'update';
         if (!user_is_logged_in() || !$this->event->isAuthorized($this->event_id, $this->user_id)) {
             drupal_access_denied();
             drupal_exit();
         }
     } else {
         if (!user_is_logged_in()) {
             drupal_access_denied();
             drupal_exit();
         }
     }
 }
开发者ID:JuliAne,项目名称:easteasteast,代码行数:22,代码来源:eventformular.php

示例13: processRequest

 public function processRequest($apikey, $getParams, $postParams)
 {
     $this->apikey = $apikey;
     if ($apikey == null && isset($postParams['apikey'])) {
         $this->apikey = $postParams['apikey'];
     }
     $this->getParams = $getParams;
     $this->postParams = $postParams;
     $result = array('success' => 1);
     if (!$this->checkApiKey()) {
         $result = Nl2go_ResponseHelper::generateErrorResponse('Invalid or missing API key!', Nl2go_ResponseHelper::ERRNO_PLUGIN_CREDENTIALS_WRONG);
     } else {
         switch ($this->postParams['action']) {
             case 'test':
                 $result['message'] = $this->test();
                 break;
             case 'getPost':
                 $post = $this->getPost();
                 if (!$post) {
                     $result = Nl2go_ResponseHelper::generateErrorResponse('Post with given id not found!', Nl2go_ResponseHelper::ERRNO_PLUGIN_OTHER);
                 } else {
                     $result = Nl2go_ResponseHelper::generateSuccessResponse(array('post' => $post));
                 }
                 break;
             case 'getPluginVersion':
                 $version = $this->getPluginVersion();
                 $result = Nl2go_ResponseHelper::generateSuccessResponse(array('version' => $version));
                 break;
             default:
                 $result = Nl2go_ResponseHelper::generateErrorResponse('Invalid action!', Nl2go_ResponseHelper::ERRNO_PLUGIN_OTHER);
                 break;
         }
     }
     drupal_json_output($result);
     drupal_exit();
 }
开发者ID:newsletter2go,项目名称:newsletter2go-drupal-module,代码行数:36,代码来源:newsletter2goApi.php

示例14: deliverFileTransfer

 /**
  * Delivery callback; transfer the file inline.
  *
  * @param mixed $file
  */
 public static function deliverFileTransfer($file)
 {
     if (is_int($file)) {
         drupal_deliver_html_page($file);
         return;
     } elseif (!is_object($file) || !is_file($file->uri) || !is_readable($file->uri)) {
         drupal_deliver_html_page(MENU_NOT_FOUND);
         return;
     }
     // @todo Figure out if any other headers should be added.
     $headers = array('Content-Type' => mime_header_encode($file->filemime), 'Content-Disposition' => 'inline', 'Content-Length' => $file->filesize);
     // Let other modules alter the download headers.
     //drupal_alter('file_download_headers', $headers, $file);
     // Let other modules know the file is being downloaded.
     module_invoke_all('file_transfer', $file->uri, $headers);
     foreach ($headers as $name => $value) {
         drupal_add_http_header($name, $value);
     }
     $fd = fopen($file->uri, 'rb');
     if ($fd !== FALSE) {
         while (!feof($fd)) {
             print fread($fd, DRUPAL_KILOBYTE);
         }
         fclose($fd);
     } else {
         watchdog('favicon', 'Unable to open @uri for reading.', array('@uri' => $file->uri));
         drupal_deliver_html_page(MENU_NOT_FOUND);
         return;
     }
     // Perform end-of-request tasks.
     if (static::canCacheFile($file)) {
         drupal_page_footer();
     } else {
         drupal_exit();
     }
 }
开发者ID:kevintnguyens,项目名称:testsite,代码行数:41,代码来源:DrupalFavicon.php

示例15: gd_js_ext

function gd_js_ext () {
    ob_start();
    header('Content-Type: text/javascript; charset=UTF-8');

    echo '(function(global){ '."\n\n";

    foreach ( \GD\Js\Registry::getInstance()->getVendorFiles() as $file ) {
        echo file_get_contents($file)."\n\n";
    }

    foreach ( \GD\Js\Registry::getInstance()->getFiles() as $file ) {
        echo file_get_contents($file)."\n\n";
    }

    echo 'GD.options.host = "'.GOVDASH_HOST.'";'."\n\n";
    echo 'GD.options.themeList = ["table.css", "filter.css", "highcharts.css", "reportMenu.css", "report.css"];'."\n\n";
    echo 'GD.options.themePath = "' . path_to_theme() . '/css/viewer/";'."\n\n";
    echo 'GD.options.csrf = "' . drupal_get_token('services') . '";'."\n";

    echo "\n\n";
    echo file_get_contents(dirname(__FILE__) . '/js/apps/Ext.js')."\n\n";

    echo 'global.GD_Highcharts = Highcharts;'."\n";
    echo 'global.GD_jQuery = jQuery;'."\n";

    echo "\n";
    echo '})(typeof window === "undefined" ? this : window);'."\n";


    gd_get_session_messages();

    echo ob_get_clean();
    drupal_exit();
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:34,代码来源:gd.ext.php


注:本文中的drupal_exit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。