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


PHP Surfer::get_id方法代码示例

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


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

示例1: layout

 /**
  * list comments as successive notes in a thread
  *
  * @param resource the SQL result
  * @return string the rendered text
  **/
 function layout($result)
 {
     global $context;
     // we return formatted text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // build a list of comments
     while ($item = SQL::fetch($result)) {
         // automatic notification
         if ($item['type'] == 'notification') {
             $text = '<dd class="thread_other" style="font-style: italic;">' . ucfirst(trim($item['description'])) . '</dd>' . $text;
         } else {
             // link to user profile -- open links in separate window to enable side browsing of participant profiles
             if ($item['create_id']) {
                 if ($user = Users::get($item['create_id']) && $user['full_name']) {
                     $hover = $user['full_name'];
                 } else {
                     $hover = NULL;
                 }
                 $author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'], TRUE, $hover);
             } else {
                 $author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'], TRUE);
             }
             // differentiate my posts from others
             if (Surfer::get_id() && $item['create_id'] == Surfer::get_id()) {
                 $style = ' class="thread_me"';
             } else {
                 $style = ' class="thread_other"';
             }
             // a clickable label
             $stamp = '#';
             // flag old items on same day
             if (!strncmp($item['edit_date'], gmstrftime('%Y-%m-%d %H:%M:%S', time()), 10)) {
                 $stamp = Skin::build_time($item['edit_date']);
             } else {
                 $stamp = Skin::build_date($item['edit_date']);
             }
             // append this at the end of the comment
             $stamp = ' <div style="float: right; font-size: x-small">' . Skin::build_link(Comments::get_url($item['id']), $stamp, 'basic', i18n::s('Edit')) . '</div>';
             // package everything --change order to get oldest first
             $text = '<dt' . $style . '>' . $author . '</dt><dd' . $style . '>' . $stamp . ucfirst(trim($item['description'])) . '</dd>' . $text;
         }
     }
     // end of processing
     SQL::free($result);
     // finalize the returned definition list
     if ($text) {
         $text = '<dl>' . $text . '</dl>';
     }
     // process yacs codes
     $text = Codes::beautify($text);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:62,代码来源:layout_comments_as_thread.php

示例2: sprintf

 /**
  * list participants
  *
  * @see overlays/overlay.php
  *
  * @param array the hosting record
  * @return some HTML to be inserted into the resulting page
  */
 function &get_list_text($host = NULL)
 {
     global $context;
     // we return some text
     $text = '';
     $to_avoid = NULL;
     if ($id = Surfer::get_id()) {
         $to_avoid = 'user:' . $id;
     }
     // page editors, except target surfer
     if ($friends =& Members::list_users_by_posts_for_member('article:' . $host['id'], 0, USERS_LIST_SIZE, 'comma', $to_avoid)) {
         $text = '<p class="details">' . sprintf(i18n::s('with %s'), Skin::build_list($friends, 'comma')) . '</p>';
     }
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:23,代码来源:thread.php

示例3: build_endpoints

 /**
  * retrieve endpoints of last calls
  *
  * This is useful to list all servers notified after a publication.
  *
  * @param string title of the folded box generated
  * @return mixed text to be integrated into the page, or array with one item per recipient, or ''
  */
 public static function build_endpoints($title = NULL)
 {
     global $context;
     // nothing to show
     if (!Surfer::get_id() || !isset($context['servers_endpoints']) || !$context['servers_endpoints']) {
         return '';
     }
     // return the bare list
     if (!$title) {
         return $context['servers_endpoints'];
     }
     // build a nice list
     $list = array();
     foreach ($context['servers_endpoints'] as $recipient) {
         $list[] = htmlspecialchars($recipient);
     }
     return Skin::build_box($title, Skin::finalize_list($list, 'compact'), 'folded');
 }
开发者ID:rair,项目名称:yacs,代码行数:26,代码来源:servers.php

示例4: elseif

// common definitions and initial processing
include_once '../shared/global.php';
// ensure we only provide public content through newsfeeds
$context['users_without_teasers'] = 'Y';
// check network credentials, if any -- used by winamp and other media players
if ($user = Users::authenticate()) {
    Surfer::empower($user['capability']);
}
// look for the id
$id = NULL;
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
    $id = $context['arguments'][0];
} elseif (Surfer::is_logged()) {
    $id = Surfer::get_id();
}
$id = strip_tags($id);
// get the item from the database
$item = Users::get($id);
// associates can do what they want
if (Surfer::is_associate()) {
    $permitted = TRUE;
} elseif ($item['active'] == 'R' && Surfer::is_member()) {
    $permitted = TRUE;
} elseif ($item['active'] == 'Y') {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// load the skin
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:feed.php

示例5: array

     }
 }
 // archive the letter
 $context['text'] .= i18n::s('Archiving the new letter') . BR . "\n";
 // save the letter as a published article, but don't use special categories
 $fields = array();
 $fields['anchor'] = $anchor;
 $fields['title'] = $_REQUEST['letter_title'];
 $label = $_REQUEST['letter_recipients'];
 if ($_REQUEST['letter_recipients'] == 'custom' && isset($_REQUEST['mail_to'])) {
     $label = $_REQUEST['mail_to'];
 }
 $fields['introduction'] = sprintf(i18n::c('Sent %s to&nbsp;"%s"'), Skin::build_date(time(), 'full', $context['preferred_language']), $label);
 $fields['description'] = $_REQUEST['letter_body'];
 $fields['publish_name'] = Surfer::get_name();
 $fields['publish_id'] = Surfer::get_id();
 $fields['publish_address'] = Surfer::get_email_address();
 $fields['publish_date'] = gmstrftime('%Y-%m-%d %H:%M:%S');
 $fields['id'] = Articles::post($fields);
 // from: from configuration files
 if (isset($context['letter_reply_to']) && $context['letter_reply_to']) {
     $from = $context['letter_reply_to'];
 } elseif (isset($context['mail_from']) && $context['mail_from']) {
     $from = $context['mail_from'];
 } else {
     $from = $context['site_name'];
 }
 // to: build the list of recipients
 $recipients = array();
 switch ($_REQUEST['letter_recipients']) {
     case 'all':
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:new.php

示例6: confirm

 /**
  * remember that surfer is enrolled in a meeting
  *
  * @param string reference of the target page
  */
 public static function confirm($reference)
 {
     global $context;
     // sanity check
     if (!$reference) {
         return;
     }
     // ensure that the joiner has been enrolled...
     if (!($item = enrolments::get_record($reference))) {
         if (Surfer::get_id()) {
             // fields to save
             $query = array();
             $query[] = "anchor = '" . $reference . "'";
             $query[] = "approved = 'Y'";
             $query[] = "edit_date = '" . SQL::escape(gmstrftime('%Y-%m-%d %H:%M:%S')) . "'";
             $query[] = "user_id = " . SQL::escape(Surfer::get_id());
             $query[] = "user_email = '" . SQL::escape(Surfer::get_email_address()) . "'";
             // insert a new record
             $query = "INSERT INTO " . SQL::table_name('enrolments') . " SET " . implode(', ', $query);
             SQL::query($query);
         }
         // each joiner takes one seat
     } else {
         $query = "UPDATE " . SQL::table_name('enrolments') . " SET approved = 'Y' WHERE id = " . SQL::escape($item['id']);
         SQL::query($query);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:32,代码来源:enrolments.php

示例7: touch


//.........这里部分代码省略.........
             }
         }
         // refresh stamp only if image update occurs within 6 hours after last edition
         if (SQL::strtotime($this->item['edit_date']) + 6 * 60 * 60 < time()) {
             $silently = TRUE;
         }
         // suppress a reference to an image that has been deleted
     } elseif ($action == 'image:delete') {
         // suppress reference in main description field
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'image', $origin)) . "'";
         // suppress references as icon and thumbnail as well
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
             if ($url = Images::get_thumbnail_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
         }
         // set an existing image as the category icon
     } elseif ($action == 'image:set_as_icon') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 $query[] = "icon_url = '" . SQL::escape($url) . "'";
             }
             // also use it as thumnail if none has been defined yet
             if (!(isset($this->item['thumbnail_url']) && trim($this->item['thumbnail_url'])) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         $silently = TRUE;
         // set an existing image as the category thumbnail
     } elseif ($action == 'image:set_as_thumbnail') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_thumbnail_href($image)) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         $silently = TRUE;
         // append a new image, and set it as the article thumbnail
     } elseif ($action == 'image:set_as_both') {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [image=' . $origin . ']') . "'";
         }
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_thumbnail_href($image)) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         } elseif ($origin) {
             $query[] = "thumbnail_url = '" . SQL::escape($origin) . "'";
         }
         // do not remember minor changes
         $silently = TRUE;
         // add a reference to a new table in the category description
     } elseif ($action == 'table:create') {
         if (!Codes::check_embedded($this->item['description'], 'table', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [table=' . $origin . ']') . "'";
         }
         // suppress a reference to a table that has been deleted
     } elseif ($action == 'table:delete') {
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'table', $origin)) . "'";
     }
     // stamp the update
     if (!$silently) {
         $query[] = "edit_name='" . Surfer::get_name() . "'," . "edit_id=" . Surfer::get_id() . "," . "edit_address='" . Surfer::get_email_address() . "'," . "edit_action='{$action}'," . "edit_date='" . strftime('%Y-%m-%d %H:%M:%S') . "'";
     }
     // ensure we have a valid update query
     if (!@count($query)) {
         return;
     }
     // update the anchor category
     $query = "UPDATE " . SQL::table_name('categories') . " SET " . implode(', ', $query) . " WHERE id = " . SQL::escape($this->item['id']);
     if (SQL::query($query) === FALSE) {
         return;
     }
     // always clear the cache, even on no update
     Categories::clear($this->item);
     // get the parent
     if (!$this->anchor) {
         $this->anchor = Anchors::get($this->item['anchor']);
     }
     // propagate the touch upwards silently -- we only want to purge the cache
     if (is_object($this->anchor)) {
         $this->anchor->touch('category:update', $this->item['id'], TRUE);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:category.php

示例8: array

 /**
  * text to come after page description
  *
  * @param array the hosting record, if any
  * @return some HTML to be inserted into the resulting page
  */
 function &get_trailer_text($host = NULL)
 {
     global $context;
     // the text
     $text = '';
     // actually, a menu of commands
     $menu = array();
     // no end date
     if (!isset($this->attributes['end_date']) || $this->attributes['end_date'] <= NULL_DATE) {
         $open = TRUE;
     } elseif ($this->attributes['end_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
         $open = TRUE;
     } else {
         $open = FALSE;
     }
     // different for each surfer
     Cache::poison();
     // link to vote
     if ($open && Surfer::get_id() && Surfer::get_id() && !Comments::count_approvals_for_anchor($this->anchor->get_reference(), Surfer::get_id())) {
         $menu[] = Skin::build_link(Comments::get_url($this->anchor->get_reference(), 'approve'), i18n::s('Sign this petition'), 'shortcut');
     }
     $text = Skin::finalize_list($menu, 'menu_bar');
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:30,代码来源:petition.php

示例9: elseif

    // post a new query
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    // protect from hackers
    if (isset($_REQUEST['edit_name'])) {
        $_REQUEST['edit_name'] = preg_replace(FORBIDDEN_IN_NAMES, '_', $_REQUEST['edit_name']);
    }
    if (isset($_REQUEST['edit_address'])) {
        $_REQUEST['edit_address'] = encode_link($_REQUEST['edit_address']);
    }
    // track anonymous surfers
    Surfer::track($_REQUEST);
    // this is the exact copy of what end users has typed
    $item = $_REQUEST;
    // from form fields to record columns
    if (!isset($_REQUEST['edit_id'])) {
        $_REQUEST['edit_id'] = Surfer::get_id();
    }
    $_REQUEST['create_address'] = $_REQUEST['edit_address'];
    $_REQUEST['create_name'] = $_REQUEST['edit_name'];
    if (!$_REQUEST['create_name']) {
        $_REQUEST['create_name'] = $_REQUEST['create_address'];
    }
    if (!$_REQUEST['create_name']) {
        $_REQUEST['create_name'] =& i18n::c('(anonymous)');
    }
    // always auto-publish queries
    $_REQUEST['publish_date'] = gmstrftime('%Y-%m-%d %H:%M:%S');
    if (isset($_REQUEST['edit_id'])) {
        $_REQUEST['publish_id'] = $_REQUEST['edit_id'];
    }
    $_REQUEST['publish_address'] = $_REQUEST['edit_address'];
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:query.php

示例10: array

        // post the confirmation message
        Mailer::notify(NULL, $item['email'], $subject, $message, $headers);
        // feed-back message
        $context['text'] .= '<p>' . i18n::s('A reminder message has been sent to you. Check your mailbox and use provided information to authenticate to this site.') . '</p>';
        // back to the anchor page
        $links = array();
        $links[] = Skin::build_link('users/login.php', i18n::s('Login'));
        $context['text'] .= Skin::finalize_list($links, 'assistant_bar');
    }
    // redirect to the origin server
} elseif ($origin) {
    Logger::error(sprintf(i18n::s('We are only keeping a shadow record for this profile. Please handle this account at %s'), Skin::build_link('http://' . $origin, $origin, 'external')));
    // password is changing
} elseif (isset($_REQUEST['confirm'])) {
    // restrictions: anyone can modify its own profile; associates can modify everything
    if ($item['id'] != Surfer::get_id() && !Surfer::is_associate()) {
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
        Logger::error(i18n::s('You are not allowed to perform this operation.'));
        // passwords have to be confirmed
    } elseif (!isset($_REQUEST['password']) || !$_REQUEST['password'] || strcmp($_REQUEST['confirm'], $_REQUEST['password'])) {
        Logger::error(i18n::s('Please confirm your new password.'));
        $with_form = TRUE;
        // stop robots and replay attacks
    } elseif (Surfer::may_be_a_robot()) {
        Logger::error(i18n::s('Please prove you are not a robot.'));
        $with_form = TRUE;
        // display the form on error
    } elseif (!Users::put($_REQUEST)) {
        $with_form = TRUE;
        // save one click to associates
    } elseif (Surfer::is_associate()) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:password.php

示例11: get_start_url

 /**
  * the URL to start and to join the meeting
  *
  * @see overlays/events/start.php
  *
  * @return string the URL to redirect the user to the meeting, or NULL on error
  */
 function get_start_url()
 {
     global $context;
     // almost random passwords
     $this->initialize_passwords();
     // link to authenticate
     $url = 'https://my.dimdim.com/api/auth/login';
     // parameters to authenticate
     $parameters = array();
     $parameters['account'] = $this->attributes['account'];
     $parameters['password'] = $this->attributes['password'];
     $parameters['group'] = 'all';
     // encode in json
     $data = array('request' => Safe::json_encode($parameters));
     // do authenticate
     if ($response = http::proceed($url, '', $data)) {
         // successful authentication
         $output = Safe::json_decode($response);
         if (isset($output['result']) && $output['result']) {
             // remember the authentication token
             $fields = array('token' => $output['response']['authToken']);
             $this->set_values($fields);
             // link to create a meeting
             $url = 'https://my.dimdim.com/api/conf/start_meeting';
             // provide authentication token
             $headers = 'X-Dimdim-Auth-Token: ' . $this->attributes['token'] . CRLF;
             // parameters to create a meeting
             $parameters = array();
             $parameters['authToken'] = $this->attributes['token'];
             $parameters['account'] = $this->attributes['account'];
             $parameters['clientId'] = Surfer::get_id();
             $parameters['displayName'] = Surfer::get_name();
             $parameters['meetingName'] = $this->anchor->get_title();
             $parameters['roomName'] = $this->anchor->get_title();
             $parameters['meetingLengthMinutes'] = $this->attributes['duration'];
             $parameters['attendeeKey'] = $this->attendee_password;
             $parameters['assistantEnabled'] = 'false';
             // disable some features
             $parameters['displayDialInfo'] = 'false';
             // message displayed within the BigBlueButton session
             $welcome = '';
             // meeting title
             if (is_object($this->anchor)) {
                 $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Title'), $this->anchor->get_title()) . "\n";
             }
             // meeting date
             if (isset($this->attributes['date_stamp'])) {
                 $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Date'), Skin::build_date($this->attributes['date_stamp'], 'standalone')) . "\n";
             }
             // meeting duration
             if (isset($this->attributes['duration'])) {
                 $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Duration'), $this->attributes['duration'] . ' ' . i18n::s('minutes')) . "\n";
             }
             // build a link to the owner page, if any
             if (is_object($this->anchor) && ($user = Users::get($this->anchor->get_value('owner_id')))) {
                 $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Chairman'), $user['full_name']) . "\n";
             }
             // welcome message
             $parameters['agenda'] = $welcome;
             // return URL
             if (is_callable(array($this->anchor, 'get_url'))) {
                 $parameters['returnurl'] = $context['url_to_home'] . $context['url_to_root'] . $this->anchor->get_url();
             }
             // encode in json
             $data = array('request' => Safe::json_encode($parameters));
             // do the transaction
             if ($response = http::proceed($url, $headers, $data)) {
                 // successful transaction
                 $output = Safe::json_decode($response);
                 if (isset($output['result']) && $output['result']) {
                     // redirect to the target page
                     return 'https://my.dimdim.com/redirect?clientId=' . urlencode(Surfer::get_id()) . '&amp;account=' . urlencode($this->attributes['account']);
                 }
             }
         }
     }
     // don't know where to go
     return NULL;
 }
开发者ID:rair,项目名称:yacs,代码行数:86,代码来源:dimdim_meeting.php

示例12: post


//.........这里部分代码省略.........
         $fields['activation_date'] = NULL_DATE;
     }
     if (!isset($fields['create_date']) || $fields['create_date'] <= NULL_DATE) {
         $fields['create_date'] = $fields['edit_date'];
     }
     if (!isset($fields['expiry_date']) || $fields['expiry_date'] <= NULL_DATE) {
         $fields['expiry_date'] = NULL_DATE;
     }
     if (!isset($fields['publish_date']) || $fields['publish_date'] <= NULL_DATE) {
         $fields['publish_date'] = NULL_DATE;
     }
     // set conservative default values
     if (!isset($fields['active_set'])) {
         $fields['active_set'] = 'Y';
     }
     if (isset($fields['edit_action'])) {
         $fields['edit_action'] = preg_replace('/import$/i', 'update', $fields['edit_action']);
     }
     if (!isset($fields['home_panel']) || !$fields['home_panel']) {
         $fields['home_panel'] = 'main';
     }
     if (!isset($fields['index_map']) || !$fields['index_map']) {
         $fields['index_map'] = 'Y';
     }
     if (!isset($fields['index_news']) || !$fields['index_news']) {
         $fields['index_news'] = 'none';
     }
     // save on requests
     if (!isset($fields['rank']) || !$fields['rank']) {
         $fields['rank'] = 10000;
     }
     // set layout for sections
     if (!isset($fields['sections_layout']) || !$fields['sections_layout'] || !preg_match('/^(accordion|carrousel|compact|custom|decorated|directory|folded|inline|jive|map|slashdot|tabs|titles|yabb|none)$/', $fields['sections_layout'])) {
         $fields['sections_layout'] = 'none';
     } elseif ($fields['sections_layout'] == 'custom') {
         if (isset($fields['sections_custom_layout']) && $fields['sections_custom_layout']) {
             $fields['sections_layout'] = $fields['sections_custom_layout'];
         } else {
             $fields['sections_layout'] = 'none';
         }
     }
     // set layout for articles
     if (!isset($fields['articles_layout']) || !$fields['articles_layout'] || !preg_match('/^(accordion|alistapart|carrousel|custom|compact|daily|decorated|digg|directory|hardboiled|jive|map|newspaper|none|simile|slashdot|table|tabs|tagged|threads|titles|yabb)$/', $fields['articles_layout'])) {
         $fields['articles_layout'] = 'decorated';
     } elseif ($fields['articles_layout'] == 'custom') {
         if (isset($fields['articles_custom_layout']) && $fields['articles_custom_layout']) {
             $fields['articles_layout'] = $fields['articles_custom_layout'];
         } else {
             $fields['articles_layout'] = 'decorated';
         }
     }
     // set canvas for articles
     if (!isset($fields['articles_canvas']) || !$fields['articles_canvas']) {
         $fields['articles_canvas'] = 'standard';
     }
     // clean provided tags
     if (isset($fields['tags'])) {
         $fields['tags'] = trim($fields['tags'], " \t.:,!?");
     }
     // cascade anchor access rights
     if (isset($fields['anchor']) && ($anchor = Anchors::get($fields['anchor']))) {
         $fields['active'] = $anchor->ceil_rights($fields['active_set']);
     } else {
         $fields['active'] = $fields['active_set'];
     }
     // always create a random handle for this section
     if (!isset($fields['handle']) || strlen($fields['handle']) < 32) {
         $fields['handle'] = md5(mt_rand());
     }
     $handle = "handle='" . SQL::escape($fields['handle']) . "',";
     // allow anonymous surfer to access this section during his session
     if (!Surfer::get_id()) {
         Surfer::add_handle($fields['handle']);
     }
     // insert a new record
     $query = "INSERT INTO " . SQL::table_name('sections') . " SET ";
     // on import
     if (isset($fields['id'])) {
         $query .= "id='" . SQL::escape($fields['id']) . "',";
     }
     // all fields should be visible
     $query .= "anchor='" . SQL::escape(isset($fields['anchor']) ? $fields['anchor'] : '') . "'," . "activation_date='" . SQL::escape($fields['activation_date']) . "'," . "active='" . SQL::escape($fields['active']) . "'," . "active_set='" . SQL::escape($fields['active_set']) . "'," . "articles_canvas='" . SQL::escape(isset($fields['articles_canvas']) ? $fields['articles_canvas'] : 'null') . "'," . "articles_layout='" . SQL::escape(isset($fields['articles_layout']) ? $fields['articles_layout'] : 'decorated') . "'," . "articles_templates='" . SQL::escape(isset($fields['articles_templates']) ? $fields['articles_templates'] : '') . "'," . "behaviors='" . SQL::escape(isset($fields['behaviors']) ? $fields['behaviors'] : '') . "'," . "content_options='" . SQL::escape(isset($fields['content_options']) ? $fields['content_options'] : '') . "'," . "content_overlay='" . SQL::escape(isset($fields['content_overlay']) ? $fields['content_overlay'] : '') . "'," . "create_address='" . SQL::escape(isset($fields['create_address']) ? $fields['create_address'] : $fields['edit_address']) . "', " . "create_date='" . SQL::escape($fields['create_date']) . "'," . "create_id=" . SQL::escape(isset($fields['create_id']) ? $fields['create_id'] : $fields['edit_id']) . ", " . "create_name='" . SQL::escape(isset($fields['create_name']) ? $fields['create_name'] : $fields['edit_name']) . "', " . "description='" . SQL::escape(isset($fields['description']) ? $fields['description'] : '') . "'," . "edit_action='" . SQL::escape(isset($fields['edit_action']) ? $fields['edit_action'] : 'section:create') . "', " . "edit_address='" . SQL::escape($fields['edit_address']) . "', " . "edit_date='" . SQL::escape($fields['edit_date']) . "'," . "edit_id=" . SQL::escape($fields['edit_id']) . ", " . "edit_name='" . SQL::escape($fields['edit_name']) . "', " . "expiry_date='" . SQL::escape($fields['expiry_date']) . "'," . "extra='" . SQL::escape(isset($fields['extra']) ? $fields['extra'] : '') . "'," . "family='" . SQL::escape(isset($fields['family']) ? $fields['family'] : '') . "'," . "file_overlay='" . SQL::escape(isset($fields['file_overlay']) ? $fields['file_overlay'] : '') . "'," . $handle . "hits=" . SQL::escape(isset($fields['hits']) ? $fields['hits'] : 0) . "," . "home_panel='" . SQL::escape(isset($fields['home_panel']) ? $fields['home_panel'] : 'main') . "'," . "icon_url='" . SQL::escape(isset($fields['icon_url']) ? $fields['icon_url'] : '') . "'," . "index_map='" . SQL::escape(isset($fields['index_map']) ? $fields['index_map'] : 'Y') . "'," . "index_news='" . SQL::escape(isset($fields['index_news']) ? $fields['index_news'] : 'static') . "'," . "index_news_count=" . SQL::escape(isset($fields['index_news_count']) ? $fields['index_news_count'] : 5) . "," . "index_title='" . SQL::escape(isset($fields['index_title']) ? $fields['index_title'] : '') . "'," . "introduction='" . SQL::escape(isset($fields['introduction']) ? $fields['introduction'] : '') . "'," . "language='" . SQL::escape(isset($fields['language']) ? $fields['language'] : '') . "'," . "locked='" . SQL::escape(isset($fields['locked']) ? $fields['locked'] : 'N') . "'," . "meta='" . SQL::escape(isset($fields['meta']) ? $fields['meta'] : '') . "'," . "nick_name='" . SQL::escape(isset($fields['nick_name']) ? $fields['nick_name'] : '') . "'," . "options='" . SQL::escape(isset($fields['options']) ? $fields['options'] : '') . "'," . "overlay='" . SQL::escape(isset($fields['overlay']) ? $fields['overlay'] : '') . "'," . "overlay_id='" . SQL::escape(isset($fields['overlay_id']) ? $fields['overlay_id'] : '') . "'," . "owner_id=" . SQL::escape(isset($fields['create_id']) ? $fields['create_id'] : $fields['edit_id']) . ", " . "prefix='" . SQL::escape(isset($fields['prefix']) ? $fields['prefix'] : '') . "'," . "rank='" . SQL::escape(isset($fields['rank']) ? $fields['rank'] : 10000) . "'," . "section_overlay='" . SQL::escape(isset($fields['section_overlay']) ? $fields['section_overlay'] : '') . "'," . "sections_layout='" . SQL::escape(isset($fields['sections_layout']) ? $fields['sections_layout'] : 'map') . "'," . "suffix='" . SQL::escape(isset($fields['suffix']) ? $fields['suffix'] : '') . "'," . "tags='" . SQL::escape(isset($fields['tags']) ? $fields['tags'] : '') . "'," . "template='" . SQL::escape(isset($fields['template']) ? $fields['template'] : '') . "'," . "thumbnail_url='" . SQL::escape(isset($fields['thumbnail_url']) ? $fields['thumbnail_url'] : '') . "'," . "title='" . SQL::escape(isset($fields['title']) ? $fields['title'] : '') . "'," . "trailer='" . SQL::escape(isset($fields['trailer']) ? $fields['trailer'] : '') . "'";
     // actual insert
     if (SQL::query($query) === FALSE) {
         return FALSE;
     }
     // remember the id of the new item
     $fields['id'] = SQL::get_last_id($context['connection']);
     // assign the page to related categories
     Categories::remember('section:' . $fields['id'], NULL_DATE, isset($fields['tags']) ? $fields['tags'] : '');
     // turn author to page editor and update author's watch list
     if ($watch && isset($fields['edit_id']) && $fields['edit_id']) {
         Members::assign('user:' . $fields['edit_id'], 'section:' . $fields['id']);
         Members::assign('section:' . $fields['id'], 'user:' . $fields['edit_id']);
     }
     // clear the cache
     Sections::clear($fields);
     // return the id of the new item
     return $fields['id'];
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:sections.php

示例13: urlencode

 $text = '';
 require_once '../canvas/' . $item['canvas'] . '.php';
 // special layout for digg
 if (defined('DIGG')) {
     $text = '<div class="digg_content">' . $text . '</div>';
 }
 // update the main content panel
 $context['text'] .= $text;
 //
 // extra panel
 //
 // page tools
 //
 if ($whole_rendering) {
     // comment this page if anchor does not prevent it --anonymous surfers will have it in main area
     if ($cur_article->allows('creation', 'comment') && Surfer::get_id()) {
         Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
         $context['page_tools'][] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
     }
     // attach a file, if upload is allowed
     if ($cur_article->allows('creation', 'file')) {
         Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
         $context['page_tools'][] = Skin::build_link('files/edit.php?anchor=' . urlencode('article:' . $item['id']), FILES_UPLOAD_IMG . i18n::s('Add a file'), 'basic', i18n::s('Attach related files.'));
     }
     // add a link
     if ($cur_article->allows('creation', 'link')) {
         Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
         $context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('article:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
     }
     // post an image, if upload is allowed
     if ($cur_article->allows('creation', 'image')) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例14: array

 // create a new page
 if ($item['id'] = Articles::post($item)) {
     // also duplicate the provided overlay, if any -- re-use 'overlay_type' only
     $overlay = Overlay::load($item, 'article:' . $item['id']);
     // post an overlay, with the new article id
     if (is_object($overlay)) {
         $overlay->remember('insert', $item, 'article:' . $item['id']);
     }
     // duplicate all related items, images, etc.
     Anchors::duplicate_related_to($original_anchor, 'article:' . $item['id']);
     // if poster is a registered user
     if (Surfer::get_id()) {
         // increment the post counter of the surfer
         Users::increment_posts(Surfer::get_id());
         // add this page to watch list
         Members::assign('article:' . $item['id'], 'user:' . Surfer::get_id());
     }
     // get the new item
     $article = Anchors::get('article:' . $item['id'], TRUE);
     $context['page_title'] = i18n::s('Thank you for your contribution');
     // the page has been duplicated
     $context['text'] .= '<p>' . i18n::s('The page has been duplicated.') . '</p>';
     // follow-up commands
     $follow_up = i18n::s('What do you want to do now?');
     $menu = array();
     $menu = array_merge($menu, array($article->get_url() => i18n::s('View the page')));
     $menu = array_merge($menu, array($article->get_url('edit') => i18n::s('Edit the page')));
     if (Surfer::may_upload()) {
         $menu = array_merge($menu, array('images/edit.php?anchor=' . urlencode($article->get_reference()) => i18n::s('Add an image')));
         $menu = array_merge($menu, array('files/edit.php?anchor=' . urlencode($article->get_reference()) => i18n::s('Add a file')));
     }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:duplicate.php

示例15: array

 // bottom commands
 if (!$render_overlaid) {
     $menu = array();
     $menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
     if (is_object($anchor) && $anchor->is_viewable()) {
         $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Cancel'), 'span');
     }
     $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
     // optional checkboxes
     $context['text'] .= '<p>';
     // do not process notifications for draft articles
     if (strncmp($anchor->get_reference(), 'article:', strlen('article:')) || $anchor->get_value('publish_date', NULL_DATE) > NULL_DATE) {
         // notify watchers
         $context['text'] .= '<input type="checkbox" name="notify_watchers" value="Y" checked="checked" /> ' . i18n::s('Notify watchers') . BR;
         // notify people following me
         if (Surfer::get_id() && !$anchor->is_hidden()) {
             $context['text'] .= '<input type="checkbox" name="notify_followers" value="Y" /> ' . i18n::s('Notify my followers') . BR;
         }
     }
     // associates may decide to not stamp changes, but only for changes -- complex command
     if (Surfer::is_associate() && isset($anchor) && Surfer::has_all()) {
         if ((Surfer::is_associate() || is_object($anchor) && $anchor->is_assigned()) && Surfer::has_all()) {
             $context['text'] .= '<input type="checkbox" name="silent" value="Y" /> ' . i18n::s('Do not change modification date of the main page.') . BR;
         }
     }
     // validate page content
     $context['text'] .= '<input type="checkbox" name="option_validate" value="Y" checked="checked" /> ' . i18n::s('Ensure this post is valid XHTML.') . '</p>';
 }
 // transmit the id as a hidden field
 if (isset($item['id']) && $item['id']) {
     $context['text'] .= '<input type="hidden" name="id" value="' . $item['id'] . '" />';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php


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