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


PHP Sections::put_attributes方法代码示例

本文整理汇总了PHP中Sections::put_attributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::put_attributes方法的具体用法?PHP Sections::put_attributes怎么用?PHP Sections::put_attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sections的用法示例。


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

示例1: set_values

 /**
  * change some attributes of an anchor
  *
  * @see shared/anchor.php
  *
  * @param array of (name, value)
  * @return TRUE on success, FALSE otherwise
  */
 function set_values($fields)
 {
     // add our id
     $fields['id'] = $this->item['id'];
     // save in the database
     return Sections::put_attributes($fields);
 }
开发者ID:rair,项目名称:yacs,代码行数:15,代码来源:section.php

示例2: elseif

    Logger::error(i18n::s('You are not allowed to perform this operation in demonstration mode.'));
    // stop robots
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST' && Surfer::may_be_a_robot()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('Please prove you are not a robot.'));
    // process submitted data
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    // ensure the section has a private handle
    if (!isset($item['handle']) || !$item['handle']) {
        $item['handle'] = md5(mt_rand());
        // save in the database
        $fields = array();
        $fields['id'] = $item['id'];
        $fields['handle'] = $item['handle'];
        $fields['silent'] = 'Y';
        Sections::put_attributes($fields);
    }
    // track anonymous surfers
    Surfer::track($_REQUEST);
    // message subject
    $subject = '';
    if (isset($_REQUEST['subject'])) {
        $subject = strip_tags($_REQUEST['subject']);
    }
    // recipient(s) address(es)
    $to = '';
    if (isset($_REQUEST['to'])) {
        $to = $_REQUEST['to'];
    }
    // make an array of recipients
    if (!is_array($to)) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:invite.php

示例3: urlencode

        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Sections::get_url($item['id'], 'own')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // do the job
} elseif (!count($context['error'])) {
    // look for the user through his nick name
    if (isset($_REQUEST['assigned_name']) && ($user = Users::get($_REQUEST['assigned_name']))) {
        $_REQUEST['anchor'] = 'user:' . $user['id'];
    }
    // transfer ownership
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set' && isset($_REQUEST['anchor'])) {
        // assign a user, and also update his watch list
        $attributes = array('id' => $item['id'], 'owner_id' => $user['id']);
        Sections::put_attributes($attributes);
        Members::assign($_REQUEST['anchor'], 'section:' . $item['id']);
        Members::assign('section:' . $item['id'], $_REQUEST['anchor']);
        $context['text'] .= '<p>' . sprintf(i18n::s('Current owner is %s'), Users::get_link($user['full_name'], $user['email'], $user['id'])) . '</p>';
        // name current owner
    } elseif (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) {
        $context['text'] .= '<p>' . sprintf(i18n::s('Current owner is %s'), Users::get_link($owner['full_name'], $owner['email'], $owner['id'])) . '</p>';
    }
    // delegate to another person
    $context['text'] .= '<p style="margin-top: 2em;">' . i18n::s('To transfer ownership to another person, type some letters of the name you are looking for.') . '</p>';
    // the form to link additional users
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . '<input type="text" name="assigned_name" id="assigned_name" size="45" maxlength="255" />' . '<input type="hidden" name="id" value="' . encode_field($item['id']) . '" />' . '<input type="hidden" name="action" value="set" />' . ' <input type="submit" id="submit_button" value="' . i18n::s('Submit') . '" style="display: none;" />' . '</p></form>' . "\n";
    // enable autocompletion
    Page::insert_script('$(function() {' . "\n" . '	$("#name").focus();' . "\n" . '	Yacs.autocomplete_names("assigned_name",true, "", function(data) { $("#submit_button").show().click(); });' . "\n" . '});' . "\n");
    // back to the anchor page
    $links = array();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:own.php


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