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


PHP drupal_get_token函数代码示例

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


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

示例1: build_operations_alter

 /**
  * Use ajax for run, since we're launching in the background.
  */
 public function build_operations_alter($job, &$allowed_operations)
 {
     if (empty($allowed_operations['run'])) {
         if (in_array('killable', $job->hook['tags']) && !$job->peekSignal('kill')) {
             $allowed_operations['kill'] = array('title' => t('Kill'), 'href' => 'admin/config/system/cron/jobs/list/' . $job->name . '/signal/' . $this->type . '/' . $this->name . '/kill', 'attributes' => array('class' => array('use-ajax')), 'query' => array('token' => drupal_get_token('signal')));
         }
     }
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:11,代码来源:general.class.php

示例2: build_operations_alter

 /**
  * Use ajax for run, since we're launching in the background.
  */
 public function build_operations_alter($job, &$allowed_operations)
 {
     if (!empty($allowed_operations['run'])) {
         $allowed_operations['run']['attributes'] = array('class' => array('use-ajax'));
     } else {
         $settings = $job->getSettings('launcher');
         if ($settings['daemonize'] && !$job->peekSignal('end_daemonize')) {
             unset($allowed_operations['kill']);
             $allowed_operations['end_daemonize'] = array('title' => t('Kill daemon'), 'href' => 'admin/config/system/cron/jobs/list/' . $job->name . '/signal/' . $this->type . '/' . $this->name . '/end_daemonize', 'attributes' => array('class' => array('use-ajax')), 'query' => array('token' => drupal_get_token('signal')));
         }
     }
 }
开发者ID:etype-services,项目名称:moser,代码行数:15,代码来源:background_process_legacy.class.php

示例3: spaces_preset_list

/**
 * Presets form.
 */
function spaces_preset_list($form, &$form_state, $export_ui)
{
    // Some setup for the spaces_preset_name_validation
    $form_state['plugin'] = $export_ui->plugin;
    $form_state['object'] =& $export_ui;
    $types = array();
    foreach (spaces_types(TRUE) as $type => $info) {
        $types[$type] = $info['title'];
    }
    $form['new'] = array('#tree' => FALSE, '#theme' => 'spaces_preset_list_new', 'space_type' => array('#title' => t('Type'), '#type' => 'select', '#options' => $types), 'name' => array('#type' => 'textfield', '#maxlength' => 64, '#size' => 32, '#title' => t('Machine ID'), '#element_validate' => array('spaces_preset_name_validate')), 'title' => array('#type' => 'textfield', '#maxlength' => 64, '#size' => 32, '#title' => t('Name')), 'submit' => array('#type' => 'submit', '#value' => t('Create new preset'), '#submit' => array('spaces_preset_list_new')));
    // Generate preset options.
    foreach ($types as $type => $title) {
        module_load_include('inc', 'spaces', 'spaces.admin');
        $presets = spaces_preset_load(NULL, $type, TRUE);
        ksort($presets);
        $form[$type] = spaces_preset_form($presets, $type, TRUE);
        $form[$type]['#title'] = t('@spacetype presets', array('@spacetype' => $title));
        $form[$type]['#description'] = t('Select a default preset for each new @spacetype.', array('@spacetype' => $title));
        $plugin = $export_ui->plugin;
        foreach ($presets as $name => $item) {
            // Note: Creating this list seems a little clumsy, but can't think of
            // better ways to do this.
            $allowed_operations = drupal_map_assoc(array_keys($plugin['allowed operations']));
            $not_allowed_operations = array('import');
            if ($item->type == t('Normal')) {
                $not_allowed_operations[] = 'revert';
            } elseif ($item->type == t('Overridden')) {
                $not_allowed_operations[] = 'delete';
            } else {
                $not_allowed_operations[] = 'revert';
                $not_allowed_operations[] = 'delete';
            }
            $not_allowed_operations[] = empty($item->disabled) ? 'enable' : 'disable';
            foreach ($not_allowed_operations as $op) {
                // Remove the operations that are not allowed for the specific exportable.
                unset($allowed_operations[$op]);
            }
            $operations = array();
            foreach ($allowed_operations as $op) {
                $operations[$op] = array('title' => $plugin['allowed operations'][$op]['title'], 'href' => ctools_export_ui_plugin_menu_path($plugin, $op, $name));
                if (!empty($plugin['allowed operations'][$op]['token'])) {
                    $operations[$op]['query'] = array('token' => drupal_get_token($op));
                }
            }
            $form[$type]['storage'][$item->name] = array('#type' => 'markup', '#markup' => isset($item->disabled) && $item->disabled ? t('Disabled') : check_plain($item->type));
            $form[$type]['actions'][$item->name] = array('#type' => 'markup', '#markup' => theme('links', array('links' => $operations)));
            $form[$type]["spaces_preset_{$type}"][$name] = array();
        }
    }
    $form = system_settings_form($form);
    return $form;
}
开发者ID:aleph-n,项目名称:opencholar,代码行数:55,代码来源:spaces_presets_export_ui.class.php

示例4: t

</th>
        <th style="width:45%;"><?php 
print t('Assigned To');
?>
</th>
        <th style="text-align:right;width:10%;"><?php 
print t('Operation');
?>
</th>
      </tr>
    </thead>

    <tbody>

<?php 
$sec_token = drupal_get_token('maestro_user');
if (is_array($queue)) {
    $i = 0;
    foreach ($queue as $task) {
        $classname = ++$i % 2 == 0 ? 'even' : 'odd';
        ?>
      <tr id="ot_row<?php 
        print $i;
        ?>
" class="<?php 
        print $classname;
        ?>
">
        <td style="vertical-align:top;"><?php 
        print $task->taskname;
        ?>
开发者ID:kastowo,项目名称:idbigdata,代码行数:31,代码来源:maestro-outstanding-tasks.tpl.php

示例5: filedepot_dispatcher


//.........这里部分代码省略.........
            $fid = intval($_POST['id']);
            $cid = db_query("SELECT cid FROM {filedepot_files} WHERE fid=:fid", array(':fid' => $fid))->fetchField();
            if ($filedepot->checkPermission($cid, 'view')) {
                $data['retcode'] = 200;
                $data['fid'] = $fid;
                $data['displayhtml'] = theme('filedepot_filedetail', array('fid' => $fid, 'reportmode' => $reportmode));
            } else {
                $data['retcode'] = 400;
                $data['error'] = t('Invalid access');
            }
            break;
        case 'updatenote':
            $fid = intval($_POST['fid']);
            $version = intval($_POST['version']);
            $note = check_plain($_POST['note']);
            $reportmode = check_plain($_POST['reportmode']);
            $token = isset($_POST['ftoken']) ? $_POST['ftoken'] : NULL;
            if ($token == NULL || !drupal_valid_token($token, FILEDEPOT_TOKEN_FILEDETAILS)) {
                $data['retcode'] = 403;
                // forbidden
            } elseif ($fid > 0) {
                db_query("UPDATE {filedepot_fileversions} SET notes=:notes WHERE fid=:fid and version=:version", array(':notes' => $note, ':fid' => $fid, ':version' => $version));
                $data['retcode'] = 200;
                $data['fid'] = $fid;
                $data['displayhtml'] = theme('filedepot_filedetail', array('fid' => $fid, 'reportmode' => $reportmode));
            } else {
                $data['retcode'] = 400;
            }
            break;
        case 'getfolderperms':
            $cid = intval($_POST['cid']);
            if ($cid > 0) {
                if ($filedepot->ogenabled) {
                    $data['html'] = theme('filedepot_folderperms_ogenabled', array('cid' => $cid, 'token' => drupal_get_token(FILEDEPOT_TOKEN_FOLDERPERMS)));
                } else {
                    $data['html'] = theme('filedepot_folderperms', array('cid' => $cid, 'token' => drupal_get_token(FILEDEPOT_TOKEN_FOLDERPERMS)));
                }
                $data['retcode'] = 200;
            } else {
                $data['retcode'] = 404;
            }
            break;
        case 'delfolderperms':
            $id = intval($_POST['id']);
            $token = isset($_POST['token']) ? $_POST['token'] : NULL;
            if ($token == NULL || !drupal_valid_token($token, FILEDEPOT_TOKEN_FOLDERPERMS)) {
                $data['retcode'] = 403;
                // forbidden
            } elseif ($id > 0) {
                $query = db_query("SELECT catid, permtype, permid FROM  {filedepot_access} WHERE accid=:accid", array(':accid' => $id));
                $A = $query->fetchAssoc();
                if ($filedepot->checkPermission($A['catid'], 'admin')) {
                    db_delete('filedepot_access')->condition('accid', $id)->execute();
                    db_update('filedepot_usersettings')->fields(array('allowable_view_folders' => ''))->execute();
                    // For this folder - I need to update the access metrics now that a permission has been removed
                    $nexcloud->update_accessmetrics($A['catid']);
                    if ($filedepot->ogenabled) {
                        $data['html'] = theme('filedepot_folderperms_ogenabled', array('cid' => $A['catid'], 'token' => drupal_get_token(FILEDEPOT_TOKEN_FOLDERPERMS)));
                    } else {
                        $data['html'] = theme('filedepot_folderperms', array('cid' => $A['catid'], 'token' => drupal_get_token(FILEDEPOT_TOKEN_FOLDERPERMS)));
                    }
                    $data['retcode'] = 200;
                } else {
                    $data['retcode'] = 403;
                    // Forbidden
                }
开发者ID:dalia-m-elsayed,项目名称:spica,代码行数:67,代码来源:ajaxserver.php

示例6: update_info_page

function update_info_page()
{
    // Change query-strings on css/js files to enforce reload for all users.
    _drupal_flush_css_js();
    // Flush the cache of all data for the update status module.
    if (db_table_exists('cache_update')) {
        cache_clear_all('*', 'cache_update', TRUE);
    }
    update_task_list('info');
    drupal_set_title('Drupal database update');
    $token = drupal_get_token('update');
    $output = '<p>Use this utility to update your database whenever a new release of Drupal or a module is installed.</p><p>For more detailed information, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>';
    $output .= "<ol>\n";
    $output .= "<li><strong>Back up your database</strong>. This process will change your database values and in case of emergency you may need to revert to a backup.</li>\n";
    $output .= "<li><strong>Back up your code</strong>. Hint: when backing up module code, do not leave that backup in the 'modules' or 'sites/*/modules' directories as this may confuse Drupal's auto-discovery mechanism.</li>\n";
    $output .= '<li>Put your site into <a href="' . base_path() . '?q=admin/settings/maintenance-mode">maintenance mode</a>.</li>' . "\n";
    $output .= "<li>Install your new files in the appropriate location, as described in the handbook.</li>\n";
    $output .= "</ol>\n";
    $output .= "<p>When you have performed the steps above, you may proceed.</p>\n";
    $output .= '<form method="post" action="update.php?op=selection&amp;token=' . $token . '"><p><input type="submit" value="Continue" /></p></form>';
    $output .= "\n";
    return $output;
}
开发者ID:veggieryan,项目名称:drupal,代码行数:23,代码来源:update.php

示例7: disable_ajax_indicator

  <div style="margin: 0px 10px 0px 0px; float: right;">&nbsp;</div>

  <div class="active"><div class="maestro_task_edit_tab_close" style="float: right;"><div class="t"><div class=""><div class="r"><div class="l"><div class="bl-cl"><div class="br-cl"><div class="tl-cl"><div class="tr-cl">
  <a href="#" onclick="(function($) { $.modal.close(); disable_ajax_indicator(); select_boxes = []; })(jQuery); return false;"><img src="<?php 
print $maestro_url;
?>
/images/admin/close.png"></a>
  </div></div></div></div></div></div></div></div></div></div>

  <div style="clear: both;"></div>

  <div class="maestro_task_edit_panel">
    <div class="t"><div class="b"><div class="r"><div class="l"><div class="bl-wht"><div class="br-wht"><div class="tl-wht"><div class="tr-wht">
      <form id="maestro_task_edit_form" method="post" action="" onsubmit="return save_task(this, '<?php 
print drupal_get_token('maestro_admin');
?>
');">
        <input type="hidden" name="task_class" value="<?php 
print $task_class;
?>
">
        <input type="hidden" name="template_data_id" value="<?php 
print $tdid;
?>
">

        <div id="task_edit_main">
          <div style="float: none;" class="maestro_tool_tip maestro_taskname"><div class="t"><div class="b"><div class="r"><div class="l"><div class="bl-bge"><div class="br-bge"><div class="tl-bge"><div class="tr-bge">
            <?php 
print t('Task Name');
开发者ID:kastowo,项目名称:idbigdata,代码行数:30,代码来源:maestro-workflow-edit-tasks-frame.tpl.php

示例8: initializeJavascriptArrays

 function initializeJavascriptArrays()
 {
     $js = '';
     $res = db_query('SELECT id, offset_left, offset_top FROM {maestro_template_data} WHERE template_id=:tid', array(':tid' => $this->_template_id));
     $i = 0;
     $j = 0;
     foreach ($res as $rec) {
         $js .= "existing_tasks[{$i}] = ['task{$rec->id}', {$rec->offset_left}, {$rec->offset_top}];\n";
         $i++;
         $res2 = DB_query("SELECT template_data_to, template_data_to_false FROM {maestro_template_data_next_step} WHERE template_data_from=:tid", array(':tid' => $rec->id));
         foreach ($res2 as $rec2) {
             $to = intval($rec2->template_data_to);
             $to_false = intval($rec2->template_data_to_false);
             if ($to != 0) {
                 $js .= "line_ids[{$j}] = ['task{$rec->id}', 'task{$to}', true];\n";
                 $j++;
             }
             if ($to_false != 0) {
                 $js .= "line_ids[{$j}] = ['task{$rec->id}', 'task{$to_false}', false];\n";
                 $j++;
             }
         }
     }
     $js .= "var move_tkn = '" . drupal_get_token('maestro_admin') . "';\n";
     return $js;
 }
开发者ID:kastowo,项目名称:idbigdata,代码行数:26,代码来源:maestro_interface.class.php

示例9: t

<div id="search" class="container-inline">
  <div class="form-item">
    <input type="text" maxlength="128" name="search_theme_form_keys" id="edit-search-theme-form-keys" size="15" value="" title="<?php 
print t('Enter the terms you wish to search for.');
?>
" class="form-text" />
  </div>
  <input type="submit" name="op" id="edit-submit" value="<?php 
print t('Search');
?>
"  class="form-submit" />
  <input type="hidden" name="form_token" id="edit-search-theme-form-form-token" value="<?php 
print drupal_get_token('search_theme_form');
?>
"  />
  <input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form"  />
</div>
开发者ID:jiva-technology,项目名称:smcuk,代码行数:17,代码来源:search-theme-form.tpl.php

示例10: applyLuceneXSLT

 /**
  * apply an xslt to lucene gsearch search results
  *
  * @param <type> $resultData
  * @param <type> $startPage
  * @param <type> $xslt_file
  * @param <type> $query the query that was executed.  May want to pass this on.
  */
 function applyLuceneXSLT($resultData, $startPage = 1, $xslt_file = '/xsl/results.xsl', $query = null)
 {
     $path = drupal_get_path('module', 'Fedora_Repository');
     $proc = null;
     if (!$resultData) {
         //drupal_set_message(t('No Results!'));
         return ' ';
         //no results
     }
     try {
         $proc = new XsltProcessor();
     } catch (Exception $e) {
         drupal_set_message(t('Error loading results xslt! ') . $e->getMessage());
         return ' ';
     }
     if (isset($query)) {
         $proc->setParameter('', 'fullQuery', $query);
     }
     //inject into xsl stylesheet
     global $user;
     $proc->setParameter('', 'userID', $user->uid);
     $proc->setParameter('', 'searchToken', drupal_get_token('fedora_repository_advanced_search'));
     //token generated by Drupal, keeps tack of what tab etc we are on
     $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository');
     //needed in our xsl
     $proc->setParameter('', 'objectsPage', base_path());
     $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'demo: changeme:'));
     $proc->setParameter('', 'hitPageStart', $startPage);
     $proc->registerPHPFunctions();
     $xsl = new DomDocument();
     $test = $xsl->load($path . $xslt_file);
     if (!isset($test)) {
         drupal_set_message(t('Error loading search results xslt!'));
         return t('Error loading search results xslt! ');
     }
     $input = new DomDocument();
     $didLoadOk = $input->loadXML($resultData);
     if (!isset($didLoadOk)) {
         drupal_set_message(t('Error loading search results!'));
         return t('Error loading search results! ');
     } else {
         $proc->importStylesheet($xsl);
         $newdom = $proc->transformToDoc($input);
         return $newdom->saveXML();
     }
 }
开发者ID:ratzeni,项目名称:islandora,代码行数:54,代码来源:SearchClass.php

示例11: getCsrfToken

 /**
  * Value callback; Return the CSRF token.
  *
  * @return array
  */
 protected static function getCsrfToken() {
   return drupal_get_token(\RestfulInterface::TOKEN_VALUE);
 }
开发者ID:humanitarianresponse,项目名称:site,代码行数:8,代码来源:RestfulCsrfTokenResource.class.php

示例12: _authcache_form_token_id

/**
 * Form tokens (prevents CSRF)
 *
 * form_token_id is a hidden field added by authcache.module's hook_form_alter()
 * @see form.inc
 */
function _authcache_form_token_id($vars) {
  include_once './includes/common.inc';
  foreach($vars as $form_token_id) {
    switch($form_token_id) {
      case 'contact_mail_page':
        global $user;
        $tokens[$form_token_id] = drupal_get_token($user->name . $user->mail);
        break;
      default;
        $tokens[$form_token_id] = drupal_get_token($form_token_id);
        break;
    }
  }
  return $tokens;
}
开发者ID:ATouhou,项目名称:www.alim.org,代码行数:21,代码来源:authcache.php

示例13: getCsrfToken

 /**
  * Value callback; Return the CSRF token.
  *
  * @return string
  *   The token.
  */
 public static function getCsrfToken()
 {
     return drupal_get_token(\Drupal\restful\Plugin\authentication\Authentication::TOKEN_VALUE);
 }
开发者ID:jhoffman-tm,项目名称:waldorf-deployment,代码行数:10,代码来源:CsrfToken.php

示例14: update_info_page

function update_info_page()
{
    drupal_set_title('Drupal database update');
    $link = 'update.php?op=selection&token=' . drupal_get_token('update');
    $output = "<ol>\n";
    $output .= "<li>Use this script to <strong>upgrade an existing Drupal installation</strong>. You don't need this script when installing Drupal from scratch.</li>";
    $output .= "<li>Before doing anything, backup your database. This process will change your database and its values, and some things might get lost.</li>\n";
    $output .= "<li>Update your Drupal sources, check the notes below and <a href=\"{$link}\">run the database upgrade script</a>. Don't upgrade your database twice as it may cause problems.</li>\n";
    $output .= "<li>Go through the various administration pages to change the existing and new settings to your liking.</li>\n";
    $output .= "</ol>";
    $output .= '<p>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>';
    return $output;
}
开发者ID:CaptainNozick,项目名称:seasteading.org,代码行数:13,代码来源:update.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_get_token函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。