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


PHP comcode_escape函数代码示例

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


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

示例1: run

 /**
  * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
  *
  * @return tempcode  The snippet
  */
 function run()
 {
     $type = get_param('type');
     if (!has_zone_access(get_member(), 'adminzone')) {
         return new ocp_tempcode();
     }
     decache('main_staff_checklist');
     require_lang('staff_checklist');
     switch ($type) {
         case 'add':
             $recurinterval = get_param_integer('recurinterval', 0);
             $task_title = get_param('tasktitle', false, true);
             $id = $GLOBALS['SITE_DB']->query_insert('customtasks', array('tasktitle' => $task_title, 'datetimeadded' => time(), 'recurinterval' => $recurinterval, 'recurevery' => get_param('recurevery'), 'taskisdone' => NULL), true);
             require_code('notifications');
             $subject = do_lang('CT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $task_title);
             $mail = do_lang('CT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($task_title));
             dispatch_notification('checklist_task', NULL, $subject, $mail);
             return do_template('BLOCK_MAIN_STAFF_CHECKLIST_CUSTOM_TASK', array('TASKTITLE' => comcode_to_tempcode(get_param('tasktitle', false, true)), 'DATETIMEADDED' => display_time_period(time()), 'RECURINTERVAL' => $recurinterval == 0 ? '' : integer_format($recurinterval), 'RECUREVERY' => get_param('recurevery'), 'TASKDONE' => 'not_completed', 'ID' => strval($id)));
         case 'delete':
             $GLOBALS['SITE_DB']->query_delete('customtasks', array('id' => get_param_integer('id')), '', 1);
             break;
         case 'mark_done':
             $GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => time()), array('id' => get_param_integer('id')), '', 1);
             break;
         case 'mark_undone':
             $GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => NULL), array('id' => get_param_integer('id')), '', 1);
             break;
     }
     return new ocp_tempcode();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:checklist_task_manage.php

示例2: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (get_forum_type() != 'ocf') {
         return;
     }
     $time = time();
     $last_time = intval(get_value('last_confirm_reminder_time'));
     if ($last_time > time() - 24 * 60 * 60 * 2) {
         return;
     }
     set_value('last_confirm_reminder_time', strval($time));
     require_code('mail');
     require_lang('ocf');
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members WHERE ' . db_string_not_equal_to('m_validated_email_confirm_code', '') . ' AND m_join_time>' . strval($last_time));
     $GLOBALS['NO_DB_SCOPE_CHECK'] = false;
     foreach ($rows as $row) {
         $coppa = get_option('is_on_coppa') == '1' && utctime_to_usertime(time() - mktime(0, 0, 0, $row['m_dob_month'], $row['m_dob_day'], $row['m_dob_year'])) / 31536000.0 < 13.0;
         if (!$coppa) {
             $zone = get_module_zone('join');
             if ($zone != '') {
                 $zone .= '/';
             }
             $url = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4&email=' . rawurlencode($row['m_email_address']) . '&code=' . $row['m_validated_email_confirm_code'];
             $url_simple = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4';
             $message = do_lang('OCF_SIGNUP_TEXT', comcode_escape(get_site_name()), comcode_escape($url), array($url_simple, $row['m_email_address'], strval($row['m_validated_email_confirm_code'])), $row['m_language']);
             mail_wrap(do_lang('CONFIRM_EMAIL_SUBJECT', get_site_name(), NULL, NULL, $row['m_language']), $message, array($row['m_email_address']), $row['m_username']);
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:ocf_confirm_reminder.php

示例3: send_content_validated_notification

/**
 * Send a "your content has been validated" notification out to the submitter of some content. Only call if this is true ;).
 *
 * @param  ID_TEXT		Content type
 * @param  ID_TEXT		Content ID
 */
function send_content_validated_notification($content_type, $content_id)
{
    require_code('content');
    list($content_title, $submitter_id, , , , $content_url_safe) = content_get_details($content_type, $content_id);
    if (!is_null($content_url_safe)) {
        require_code('notifications');
        require_lang('unvalidated');
        $subject = do_lang('CONTENT_VALIDATED_NOTIFICATION_MAIL_SUBJECT', $content_title, get_site_name());
        $mail = do_lang('CONTENT_VALIDATED_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($content_title), array($content_url_safe->evaluate()));
        dispatch_notification('content_validated', NULL, $subject, $mail, array($submitter_id));
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:submit.php

示例4: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (!addon_installed('catalogues')) {
         return;
     }
     $last = get_value('last_classified_refresh');
     $time = time();
     if (!is_null($last) && intval($last) > $time - 60 * 60) {
         return;
     }
     // Don't do more than once per hour
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     $start = 0;
     do {
         $entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries e JOIN ' . get_table_prefix() . 'classifieds_prices p ON p.c_catalogue_name=e.c_name', array('e.*'), array('ce_validated' => 1), '', 1000, $start);
         foreach ($entries as $entry) {
             if ($entry['ce_last_moved'] == $entry['ce_add_date']) {
                 require_code('classifieds');
                 initialise_classified_listing($entry);
             }
             // Expiring
             if ($entry['ce_last_moved'] < $time) {
                 $GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_validated' => 0), array('id' => $entry['id']), '', 1);
                 decache('main_cc_embed');
                 decache('main_recent_cc_entries');
                 require_code('catalogues2');
                 calculate_category_child_count_cache($entry['cc_id']);
             } elseif ($entry['ce_last_moved'] < $time + 60 * 60 * 24 && $entry['ce_last_moved'] > $time + 60 * 60 * 23) {
                 // Expiring in 24 hours
                 require_code('notifications');
                 require_lang('classifieds');
                 $member_id = $entry['ce_submitter'];
                 $renew_url = build_url(array('page' => 'classifieds', 'type' => 'adverts', 'id' => $member_id), get_module_zone('classifieds'));
                 require_code('catalogues');
                 $data_map = get_catalogue_entry_map($entry, NULL, 'CATEGORY', 'DEFAULT', NULL, NULL, array(0));
                 $ad_title = $data_map['FIELD_0_PLAIN'];
                 if (is_object($ad_title)) {
                     $ad_title = $ad_title->evaluate();
                 }
                 $subject_tag = do_lang('SUBJECT_CLASSIFIED_ADVERT_EXPIRING', $ad_title, get_site_name(), NULL, get_lang($member_id), false);
                 $mail = do_lang('MAIL_CLASSIFIED_ADVERT_EXPIRING', $ad_title, comcode_escape(get_site_name()), comcode_escape($renew_url->evaluate()), get_lang($member_id), false);
                 // Send actual notification
                 dispatch_notification('classifieds__' . $entry['c_name'], '', $subject_tag, $mail, array($member_id), A_FROM_SYSTEM_PRIVILEGED);
             }
         }
     } while (count($entries) == 1000);
     set_value('last_classified_refresh', strval($time));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:classifieds.php

示例5: activities_addon_syndicate_described_activity

/**
 * @license		http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
 * @copyright	ocProducts Ltd
 * @package		activity_feed
 */
function activities_addon_syndicate_described_activity($a_language_string_code = '', $a_label_1 = '', $a_label_2 = '', $a_label_3 = '', $a_pagelink_1 = '', $a_pagelink_2 = '', $a_pagelink_3 = '', $a_addon = '', $a_is_public = 1, $a_member_id = NULL, $sitewide_too = false, $a_also_involving = NULL)
{
    require_code('activities');
    require_lang('activities');
    if (get_db_type() == 'xml' && get_param_integer('keep_testing_logging', 0) != 1) {
        return NULL;
    }
    $stored_id = 0;
    if (is_null($a_member_id)) {
        $a_member_id = get_member();
    }
    if (is_guest($a_member_id)) {
        return NULL;
    }
    $go = array('a_language_string_code' => $a_language_string_code, 'a_label_1' => $a_label_1, 'a_label_2' => $a_label_2, 'a_label_3' => $a_label_3, 'a_is_public' => $a_is_public);
    $stored_id = mixed();
    // Check if this has been posted previously (within the last 10 minutes) to
    // stop spamming but allow generalised repeat status messages.
    $test = $GLOBALS['SITE_DB']->query_select('activities', array('a_language_string_code', 'a_label_1', 'a_label_2', 'a_label_3', 'a_is_public'), NULL, 'WHERE a_time>' . strval(time() - 600), 1);
    if (!array_key_exists(0, $test) || $test[0] != $go || running_script('execute_temp')) {
        // Log the activity
        $row = $go + array('a_member_id' => $a_member_id, 'a_also_involving' => $a_also_involving, 'a_pagelink_1' => $a_pagelink_1, 'a_pagelink_2' => $a_pagelink_2, 'a_pagelink_3' => $a_pagelink_3, 'a_time' => time(), 'a_addon' => $a_addon, 'a_is_public' => $a_is_public);
        $stored_id = $GLOBALS['SITE_DB']->query_insert('activities', $row, true);
        // Update the latest activity file
        log_newest_activity($stored_id, 1000);
        // External places
        if ($a_is_public == 1 && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
            $dests = find_all_hooks('systems', 'syndication');
            foreach (array_keys($dests) as $hook) {
                require_code('hooks/systems/syndication/' . $hook);
                $ob = object_factory('Hook_Syndication_' . $hook);
                if ($ob->is_available()) {
                    $ob->syndicate_user_activity($a_member_id, $row);
                    if ($sitewide_too && has_specific_permission(get_member(), 'syndicate_site_activity') && post_param_integer('syndicate_this', 0) == 1) {
                        $ob->syndicate_site_activity($row);
                    }
                }
            }
        }
        list($message) = render_activity($row, false);
        require_code('notifications');
        $username = $GLOBALS['FORUM_DRIVER']->get_username($a_member_id);
        $subject = do_lang('ACTIVITY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $username, html_entity_decode(strip_tags($message->evaluate()), ENT_QUOTES, get_charset()));
        $mail = do_lang('ACTIVITY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($username), array('[semihtml]' . $message->evaluate() . '[/semihtml]'));
        dispatch_notification('activity', strval($a_member_id), $subject, $mail);
    }
    return $stored_id;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:activities_submission.php

示例6: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (!defined('MAXIMUM_DIGEST_LENGTH')) {
         define('MAXIMUM_DIGEST_LENGTH', 1024 * 100);
         // 100KB
     }
     require_code('notifications');
     foreach (array(A_DAILY_EMAIL_DIGEST => 60 * 60 * 24, A_WEEKLY_EMAIL_DIGEST => 60 * 60 * 24 * 7, A_MONTHLY_EMAIL_DIGEST => 60 * 60 * 24 * 31) as $frequency => $timespan) {
         $start = 0;
         do {
             // Find where not tint-in-tin
             $members = $GLOBALS['SITE_DB']->query('SELECT DISTINCT d_to_member_id FROM ' . get_table_prefix() . 'digestives_consumed c JOIN ' . get_table_prefix() . 'digestives_tin t ON c.c_member_id=t.d_to_member_id AND c.c_frequency=' . strval($frequency) . ' WHERE c_time<' . strval(time() - $timespan) . ' AND c_frequency=' . strval($frequency), 100, $start);
             foreach ($members as $member) {
                 require_lang('notifications');
                 $to_member_id = $member['d_to_member_id'];
                 $to_name = $GLOBALS['FORUM_DRIVER']->get_username($to_member_id);
                 $to_email = $GLOBALS['FORUM_DRIVER']->get_member_email_address($to_member_id);
                 $messages = $GLOBALS['SITE_DB']->query_select('digestives_tin', array('d_subject', 'd_message', 'd_date_and_time'), array('d_to_member_id' => $to_member_id, 'd_frequency' => $frequency), 'ORDER BY d_date_and_time');
                 $GLOBALS['SITE_DB']->query_delete('digestives_tin', array('d_to_member_id' => $to_member_id, 'd_frequency' => $frequency));
                 $_message = '';
                 foreach ($messages as $message) {
                     if ($_message != '') {
                         $_message .= chr(10);
                     }
                     if (strlen($_message) + strlen($message['d_message']) < MAXIMUM_DIGEST_LENGTH) {
                         $_message .= do_lang('DIGEST_EMAIL_INDIVIDUAL_MESSAGE_WRAP', comcode_escape($message['d_subject']), $message['d_message'], array(comcode_escape(get_site_name()), get_timezoned_date($message['d_date_and_time'])));
                     } else {
                         $_message .= do_lang('DIGEST_ITEM_OMITTED', comcode_escape($message['d_subject']), get_timezoned_date($message['d_date_and_time']), array(comcode_escape(get_site_name())));
                     }
                 }
                 if ($_message != '') {
                     $wrapped_subject = do_lang('DIGEST_EMAIL_SUBJECT_' . strval($frequency), comcode_escape(get_site_name()));
                     $wrapped_message = do_lang('DIGEST_EMAIL_MESSAGE_WRAP', $_message, comcode_escape(get_site_name()));
                     require_code('mail');
                     mail_wrap($wrapped_subject, $wrapped_message, array($to_email), $to_name, get_option('staff_address'), get_site_name(), 3, NULL, true, A_FROM_SYSTEM_UNPRIVILEGED, false);
                     $GLOBALS['SITE_DB']->query_update('digestives_consumed', array('c_time' => time()), array('c_member_id' => $to_member_id, 'c_frequency' => $frequency), '', 1);
                 }
             }
             $start += 100;
         } while (count($members) == 100);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:45,代码来源:notification_digests.php

示例7: basic_newsletter_join

/**
 * Add to the newsletter, in the simplest way.
 *
 * @param  EMAIL				The email address of the subscriber
 * @param  integer			The interest level
 * @range  1 4
 * @param  ?LANGUAGE_NAME	The language (NULL: users)
 * @param  boolean			Whether to require a confirmation mail
 * @param  ?AUTO_LINK		The newsletter to join (NULL: the first)
 * @param  string				Subscribers forename
 * @param  string				Subscribers surname
 * @return string				Newsletter password
 */
function basic_newsletter_join($email, $interest_level = 4, $lang = NULL, $get_confirm_mail = false, $newsletter_id = NULL, $forename = '', $surname = '')
{
    if (is_null($lang)) {
        $lang = user_lang();
    }
    if (is_null($newsletter_id)) {
        $newsletter_id = db_get_first_id();
    }
    $password = get_rand_password();
    $code_confirm = $get_confirm_mail ? mt_rand(1, 9999999) : 0;
    $test = $GLOBALS['SITE_DB']->query_value_null_ok('newsletter_subscribe', 'the_level', array('newsletter_id' => $newsletter_id, 'email' => $email));
    if ($test === 0) {
        $GLOBALS['SITE_DB']->query_delete('newsletter_subscribe', array('newsletter_id' => $newsletter_id, 'email' => $email), '', 1);
        $test = NULL;
    }
    if (is_null($test)) {
        require_lang('newsletter');
        $test = $GLOBALS['SITE_DB']->query_value_null_ok('newsletter', 'email', array('email' => $email));
        if (is_null($test)) {
            $salt = produce_salt();
            $GLOBALS['SITE_DB']->query_insert('newsletter', array('n_forename' => $forename, 'n_surname' => $surname, 'join_time' => time(), 'email' => $email, 'code_confirm' => $code_confirm, 'pass_salt' => $salt, 'the_password' => md5($password . $salt), 'language' => $lang), false, true);
            // race condition
            if ($get_confirm_mail) {
                $_url = build_url(array('page' => 'newsletter', 'type' => 'confirm', 'email' => $email, 'confirm' => $code_confirm), get_module_zone('newsletter'));
                $url = $_url->evaluate();
                $message = do_lang('NEWSLETTER_SIGNUP_TEXT', comcode_escape($url), comcode_escape($password), array($forename, $surname, $email, get_site_name()), $lang);
                require_code('mail');
                mail_wrap(do_lang('NEWSLETTER_SIGNUP', NULL, NULL, NULL, $lang), $message, array($email));
            }
        } else {
            $GLOBALS['SITE_DB']->query_update('newsletter', array('join_time' => time()), array('email' => $email), '', 1);
            $password = '';
        }
        $GLOBALS['SITE_DB']->query_insert('newsletter_subscribe', array('newsletter_id' => $newsletter_id, 'the_level' => $interest_level, 'email' => $email), false, true);
        // race condition
        return $password;
    }
    return do_lang('NA');
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:52,代码来源:newsletter.php

示例8: buddy_add

/**
 * Add a buddy.
 *
 * @param  MEMBER			The member befriending
 * @param  MEMBER			The member being befriended
 * @param  ?TIME			The logged time of the friendship (NULL: now)
 */
function buddy_add($likes, $liked, $time = NULL)
{
    if (is_null($time)) {
        $time = time();
    }
    $GLOBALS['SITE_DB']->query_delete('chat_buddies', array('member_likes' => $likes, 'member_liked' => $liked), '', 1);
    // Just in case page refreshed
    $GLOBALS['SITE_DB']->query_insert('chat_buddies', array('member_likes' => $likes, 'member_liked' => $liked, 'date_and_time' => $time));
    // Send a notification
    if (is_null($GLOBALS['SITE_DB']->query_value_null_ok('chat_buddies', 'date_and_time', array('member_likes' => $liked, 'member_liked' => $likes)))) {
        require_lang('chat');
        require_code('notifications');
        $to_name = $GLOBALS['FORUM_DRIVER']->get_username($liked);
        $from_name = $GLOBALS['FORUM_DRIVER']->get_username($likes);
        $subject_tag = do_lang('YOURE_MY_BUDDY_SUBJECT', $from_name, get_site_name(), NULL, get_lang($liked));
        $befriend_url = build_url(array('page' => 'chat', 'type' => 'buddy_add', 'member_id' => $likes), get_module_zone('chat'), NULL, false, false, true);
        $message_raw = do_lang('YOURE_MY_BUDDY_BODY', comcode_escape($to_name), comcode_escape(get_site_name()), array($befriend_url->evaluate(), comcode_escape($from_name)), get_lang($liked));
        dispatch_notification('new_buddy', NULL, $subject_tag, $message_raw, array($liked), $likes);
        // Log the action
        log_it('MAKE_BUDDY', strval($likes), strval($liked));
        syndicate_described_activity('chat:PEOPLE_NOW_FRIENDS', $to_name, '', '', '_SEARCH:members:view:' . strval($liked), '_SEARCH:members:view:' . strval($likes), '', 'chat', 1, $likes);
        syndicate_described_activity('chat:PEOPLE_NOW_FRIENDS', $to_name, '', '', '_SEARCH:members:view:' . strval($liked), '_SEARCH:members:view:' . strval($likes), '', 'chat', 1, $liked);
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:chat2.php

示例9: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     $this_birthday_day = date('d/m/Y');
     if (get_long_value('last_birthday_day') !== $this_birthday_day) {
         set_long_value('last_birthday_day', $this_birthday_day);
         require_lang('ocf');
         require_code('ocf_general');
         $_birthdays = ocf_find_birthdays();
         $birthdays = new ocp_tempcode();
         foreach ($_birthdays as $_birthday) {
             $member_url = $GLOBALS['OCF_DRIVER']->member_profile_url($_birthday['id'], false, true);
             $username = $_birthday['username'];
             $birthday_url = build_url(array('page' => 'topics', 'type' => 'birthday', 'id' => $_birthday['username']), get_module_zone('topics'));
             require_code('notifications');
             $subject = do_lang('BIRTHDAY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $username);
             $mail = do_lang('BIRTHDAY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($username), array($member_url->evaluate(), $birthday_url->evaluate()));
             if (addon_installed('chat')) {
                 $friends = $GLOBALS['SITE_DB']->query_select('chat_buddies', array('member_likes'), array('member_liked' => $_birthday['id']));
                 dispatch_notification('ocf_friend_birthday', NULL, $subject, $mail, collapse_1d_complexity('member_likes', $friends));
             }
             dispatch_notification('ocf_birthday', NULL, $subject, $mail);
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:27,代码来源:ocf_birthdays.php

示例10: ocf_make_post


//.........这里部分代码省略.........
    }
    if (is_null($validated) || $validated == 1 && $check_permissions) {
        if (!is_null($forum_id) && !has_specific_permission(get_member(), 'bypass_validation_lowrange_content', 'topics', array('forums', $forum_id))) {
            $validated = 0;
        } else {
            $validated = 1;
        }
    }
    if (!$support_attachments) {
        $lang_id = insert_lang_comcode($post, 4, $GLOBALS['FORUM_DB'], $insert_comcode_as_admin);
    } else {
        $lang_id = 0;
    }
    if (!addon_installed('unvalidated')) {
        $validated = 1;
    }
    $map = array('p_title' => substr($title, 0, 255), 'p_post' => $lang_id, 'p_ip_address' => $ip_address, 'p_time' => $time, 'p_poster' => $anonymous ? db_get_first_id() : $poster, 'p_poster_name_if_guest' => substr($poster_name_if_guest, 0, 80), 'p_validated' => $validated, 'p_topic_id' => $topic_id, 'p_is_emphasised' => $is_emphasised, 'p_cache_forum_id' => $forum_id, 'p_last_edit_time' => $last_edit_time, 'p_last_edit_by' => $last_edit_by, 'p_intended_solely_for' => $intended_solely_for, 'p_skip_sig' => $skip_sig, 'p_parent_id' => $parent_id);
    if (!is_null($id)) {
        $map['id'] = $id;
    }
    $post_id = $GLOBALS['FORUM_DB']->query_insert('f_posts', $map, true);
    if ($support_attachments) {
        require_code('attachments2');
        $lang_id = insert_lang_comcode_attachments(4, $post, 'ocf_post', strval($post_id), $GLOBALS['FORUM_DB']);
        $GLOBALS['FORUM_DB']->query_update('f_posts', array('p_post' => $lang_id), array('id' => $post_id), '', 1);
    }
    $_url = build_url(array('page' => 'topicview', 'type' => 'findpost', 'id' => $post_id), 'forum', NULL, false, false, true, 'post_' . strval($post_id));
    $url = $_url->evaluate();
    if ($validated == 0) {
        if ($check_permissions) {
            // send_validation_mail is used for other content - but forum is special
            $subject = do_lang('POST_REQUIRING_VALIDATION_MAIL_SUBJECT', $topic_title, NULL, NULL, get_site_default_lang());
            $post_text = get_translated_text($lang_id, $GLOBALS['FORUM_DB'], get_site_default_lang());
            $mail = do_lang('POST_REQUIRING_VALIDATION_MAIL', comcode_escape($url), comcode_escape($poster_name_if_guest), $post_text);
            require_code('notifications');
            dispatch_notification('needs_validation', NULL, $subject, $mail);
        }
    } else {
        if ($check_permissions) {
            if ($send_notification) {
                $post_comcode = get_translated_text($lang_id, $GLOBALS['FORUM_DB']);
                require_code('ocf_posts_action2');
                ocf_send_topic_notification($url, $topic_id, $forum_id, $anonymous ? db_get_first_id() : $poster, $is_starter, $post_comcode, $topic_title, $intended_solely_for, $is_pt);
                // Send a notification for the inline PP
                if (!is_null($intended_solely_for)) {
                    require_code('notifications');
                    $msubject = do_lang('NEW_PERSONAL_POST_SUBJECT', $topic_title, NULL, NULL, get_lang($intended_solely_for));
                    $mmessage = do_lang('NEW_PERSONAL_POST_MESSAGE', comcode_escape($GLOBALS['FORUM_DRIVER']->get_username($anonymous ? db_get_first_id() : $poster)), comcode_escape($topic_title), array(comcode_escape($url), $post_comcode), get_lang($intended_solely_for));
                    dispatch_notification('ocf_new_pt', NULL, $msubject, $mmessage, array($intended_solely_for), $anonymous ? db_get_first_id() : $poster);
                }
            }
        }
    }
    if ($check_permissions) {
        // Is the user gonna automatically enable notifications for this?
        $auto_monitor_contrib_content = $GLOBALS['OCF_DRIVER']->get_member_row_field($poster, 'm_auto_monitor_contrib_content');
        if ($auto_monitor_contrib_content == 1) {
            require_code('notifications');
            enable_notifications('ocf_topic', strval($topic_id), $poster);
        }
    }
    if ($update_cacheing) {
        if (function_exists('get_member')) {
            if (function_exists('ocf_ping_topic_read')) {
                ocf_ping_topic_read($topic_id);
            }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:ocf_posts_action.php

示例11: add_note

 /**
  * UI to add note to an order
  *
  * @return tempcode	The interface.
  */
 function add_note()
 {
     require_code('form_templates');
     $id = get_param_integer('id');
     $redirect_url = get_param('redirect', NULL);
     $last_action = get_param('last_act', NULL);
     breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('ORDERS')), array('_SELF:_SELF:show_orders', do_lang_tempcode('ORDER_LIST'))));
     $update_url = build_url(array('page' => '_SELF', 'type' => '_add_note', 'redirect' => $redirect_url), '_SELF');
     $fields = new ocp_tempcode();
     $note = $GLOBALS['SITE_DB']->query_value('shopping_order', 'notes', array('id' => $id));
     if (!is_null($last_action)) {
         $note .= do_lang('ADD_NOTE_UPPEND_TEXT', get_timezoned_date(time(), true, false, true, true), do_lang('ORDER_STATUS_' . $last_action));
     }
     $fields->attach(form_input_text(do_lang_tempcode('NOTE'), do_lang_tempcode('NOTE_DESCRIPTION'), 'note', $note, true));
     $fields->attach(form_input_hidden('order_id', strval($id)));
     $title = get_page_title('ADD_NOTE_TITLE', true, array(strval($id)));
     if ($last_action == 'dispatched') {
         //Display dispatch mail preview
         $res = $GLOBALS['SITE_DB']->query_select('shopping_order', array('*'), array('id' => $id), '', 1);
         $order_det = $res[0];
         $member_name = $GLOBALS['FORUM_DRIVER']->get_username($order_det['c_member']);
         $message = do_lang('ORDER_DISPATCHED_MAIL_MESSAGE', comcode_escape(get_site_name()), comcode_escape($member_name), array(strval($id)), get_lang($order_det['c_member']));
         $fields->attach(form_input_text(do_lang_tempcode('DISPATCH_MAIL_PREVIEW'), do_lang_tempcode('DISPATCH_MAIL_PREVIEW_DESCRIPTION'), 'dispatch_mail_content', $message, true));
     }
     return do_template('FORM_SCREEN', array('TITLE' => $title, 'TEXT' => do_lang_tempcode('NOTE_DESCRIPTION'), 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $update_url, 'SUBMIT_NAME' => do_lang_tempcode('ADD_NOTE')));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:admin_orders.php

示例12: edit_video

/**
 * Edit a video in a specified gallery.
 *
 * @param  AUTO_LINK		The ID of the entry to edit
 * @param  SHORT_TEXT	Video title
 * @param  ID_TEXT		The gallery name
 * @param  LONG_TEXT		The video comments
 * @param  URLPATH		The URL to the actual video
 * @param  URLPATH		The URL to the thumbnail of the actual video
 * @param  BINARY			Whether the video has been validated for display on the site
 * @param  BINARY			Whether the video may be rated
 * @param  BINARY			Whether the video may be commented upon
 * @param  BINARY			Whether the video may be trackbacked
 * @param  LONG_TEXT		Hidden notes associated with the video
 * @param  integer		The length of the video
 * @param  integer		The width of the video
 * @param  integer		The height of the video
 * @param  SHORT_TEXT	Meta keywords
 * @param  LONG_TEXT		Meta description
 */
function edit_video($id, $title, $cat, $comments, $url, $thumb_url, $validated, $allow_rating, $allow_comments, $allow_trackbacks, $notes, $video_length, $video_width, $video_height, $meta_keywords, $meta_description)
{
    require_code('urls2');
    suggest_new_idmoniker_for('galleries', 'video', strval($id), $title == '' ? $comments : $title);
    $_title = $GLOBALS['SITE_DB']->query_value('videos', 'title', array('id' => $id));
    $_comments = $GLOBALS['SITE_DB']->query_value('videos', 'comments', array('id' => $id));
    require_code('files2');
    delete_upload('uploads/galleries', 'videos', 'url', 'id', $id, $url);
    delete_upload('uploads/galleries_thumbs', 'videos', 'thumb_url', 'id', $id, $thumb_url);
    require_code('transcoding');
    $url = transcode_video($url, 'videos', 'url', NULL, 'video_width', 'video_height');
    if (!addon_installed('unvalidated')) {
        $validated = 1;
    }
    require_code('submit');
    $just_validated = !content_validated('video', strval($id)) && $validated == 1;
    if ($just_validated) {
        send_content_validated_notification('video', strval($id));
    }
    $GLOBALS['SITE_DB']->query_update('videos', array('title' => lang_remap_comcode($_title, $title), 'edit_date' => time(), 'allow_rating' => $allow_rating, 'allow_comments' => $allow_comments, 'allow_trackbacks' => $allow_trackbacks, 'notes' => $notes, 'validated' => $validated, 'cat' => $cat, 'comments' => lang_remap_comcode($_comments, $comments), 'url' => $url, 'thumb_url' => $thumb_url, 'video_length' => $video_length, 'video_width' => $video_width, 'video_height' => $video_height), array('id' => $id), '', 1);
    $self_url = build_url(array('page' => 'galleries', 'type' => 'video', 'id' => $id), get_module_zone('galleries'), NULL, false, false, true);
    if ($just_validated) {
        require_lang('galleries');
        require_code('notifications');
        $subject = do_lang('VIDEO_NOTIFICATION_MAIL_SUBJECT', get_site_name(), strip_comcode($title));
        $mail = do_lang('VIDEO_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($title), array(comcode_escape($self_url->evaluate())));
        dispatch_notification('gallery_entry', $cat, $subject, $mail);
    }
    log_it('EDIT_VIDEO', strval($id), $title);
    require_code('seo2');
    seo_meta_set_for_explicit('video', strval($id), $meta_keywords, $meta_description);
    decache('main_gallery_embed');
    require_lang('galleries');
    require_code('feedback');
    update_spacer_post($allow_comments != 0, 'videos', strval($id), $self_url, do_lang('VIEW_VIDEO', '', '', '', get_site_default_lang()), get_value('comment_forum__videos'));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:56,代码来源:galleries2.php

示例13: module_do_upload

 /**
  * The actualiser for uploading a file.
  *
  * @return tempcode	The UI.
  */
 function module_do_upload()
 {
     if (!has_specific_permission(get_member(), 'upload_filedump')) {
         access_denied('I_ERROR');
     }
     $title = get_page_title('FILEDUMP_UPLOAD');
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     // Slowly uploading a file can trigger time limit, on some servers
     $place = filter_naughty(post_param('place'));
     require_code('uploads');
     if (!is_swf_upload(true) && (!array_key_exists('file', $_FILES) || !is_uploaded_file($_FILES['file']['tmp_name']))) {
         $attach_name = 'file';
         $max_size = get_max_file_size();
         if (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 1 || $_FILES[$attach_name]['error'] == 2)) {
             warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format($max_size)));
         } elseif (isset($_FILES[$attach_name]) && ($_FILES[$attach_name]['error'] == 3 || $_FILES[$attach_name]['error'] == 6 || $_FILES[$attach_name]['error'] == 7)) {
             warn_exit(do_lang_tempcode('ERROR_UPLOADING_' . strval($_FILES[$attach_name]['error'])));
         } else {
             warn_exit(do_lang_tempcode('ERROR_UPLOADING'));
         }
     }
     $file = $_FILES['file']['name'];
     if (get_magic_quotes_gpc()) {
         $file = stripslashes($file);
     }
     if (!has_specific_permission(get_member(), 'upload_anything_filedump') || get_file_base() != get_custom_file_base()) {
         check_extension($file);
     }
     $file = str_replace('.', '-', basename($file, '.' . get_file_extension($file))) . '.' . get_file_extension($file);
     if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place . $file)) {
         $max_size = get_max_file_size();
         if ($_FILES['file']['size'] > $max_size) {
             warn_exit(do_lang_tempcode('FILE_TOO_BIG', integer_format(intval($max_size))));
         }
         $full = get_custom_file_base() . '/uploads/filedump' . $place . $file;
         if (is_swf_upload(true)) {
             @rename($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
         } else {
             @move_uploaded_file($_FILES['file']['tmp_name'], $full) or warn_exit(do_lang_tempcode('FILE_MOVE_ERROR', escape_html($file), escape_html('uploads/filedump' . $place)));
         }
         fix_permissions($full);
         sync_file($full);
         $return_url = build_url(array('page' => '_SELF', 'place' => $place), '_SELF');
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => $file, 'path' => $place));
         if (!is_null($test)) {
             delete_lang($test);
         }
         $GLOBALS['SITE_DB']->query_delete('filedump', array('name' => $file, 'path' => $place), '', 1);
         $description = post_param('description');
         $GLOBALS['SITE_DB']->query_insert('filedump', array('name' => $file, 'path' => $place, 'the_member' => get_member(), 'description' => insert_lang_comcode($description, 3)));
         require_code('notifications');
         $subject = do_lang('FILEDUMP_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $file, $place);
         $mail = do_lang('FILEDUMP_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($file), array(comcode_escape($place), comcode_escape($description)));
         dispatch_notification('filedump', $place, $subject, $mail);
         log_it('FILEDUMP_UPLOAD', $file, $place);
         if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), get_page_name(), get_zone_name())) {
             syndicate_described_activity('filedump:ACTIVITY_FILEDUMP_UPLOAD', $place . '/' . $file, '', '', '', '', '', 'filedump');
         }
         return redirect_screen($title, $return_url, do_lang_tempcode('SUCCESS'));
     } else {
         warn_exit(do_lang_tempcode('OVERWRITE_ERROR'));
     }
     return new ocp_tempcode();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:71,代码来源:filedump.php

示例14: forum_authorise_login


//.........这里部分代码省略.........
     }
     // Check password
     if (!$skip_auth) {
         // Choose a compatibility screen.
         // Note that almost all cookie logins are the same. This is because the cookie logins use OCF cookies, regardless of compatibility scheme.
         $password_compatibility_scheme = $row['m_password_compat_scheme'];
         switch ($password_compatibility_scheme) {
             case 'remote':
                 // This will work too - we're logging in with the username of a remote profile, so no resynching will happen
             // This will work too - we're logging in with the username of a remote profile, so no resynching will happen
             case '':
                 // ocPortal style salted MD5 algorithm
                 if ($cookie_login) {
                     if ($password_hashed !== $row['m_pass_hash_salted']) {
                         require_code('tempcode');
                         // This can be incidental even in fast AJAX scripts, if an old invalid cookie is present, so we need tempcode for do_lang_tempcode
                         $out['error'] = do_lang_tempcode('USER_BAD_PASSWORD');
                         return $out;
                     }
                 } else {
                     if (md5($row['m_pass_salt'] . $password_hashed) !== $row['m_pass_hash_salted']) {
                         $out['error'] = do_lang_tempcode('USER_BAD_PASSWORD');
                         return $out;
                     }
                 }
                 break;
             case 'plain':
                 if ($password_hashed !== md5($row['m_pass_hash_salted'])) {
                     $out['error'] = do_lang_tempcode('USER_BAD_PASSWORD');
                     return $out;
                 }
                 break;
             case 'md5':
                 // Old style plain md5		(also works if both are unhashed: used for LDAP)
                 if ($password_hashed !== $row['m_pass_hash_salted'] && $password_hashed != '!!!') {
                     $out['error'] = do_lang_tempcode('USER_BAD_PASSWORD');
                     return $out;
                 }
                 break;
                 /*		case 'httpauth':
                 				// This is handled in get_member()  */
                 break;
             case 'ldap':
                 if ($password_hashed !== $row['m_pass_hash_salted']) {
                     $out['error'] = do_lang_tempcode('USER_BAD_PASSWORD');
                     return $out;
                 }
                 break;
             default:
                 $path = get_file_base() . '/sources_custom/hooks/systems/ocf_auth/' . $password_compatibility_scheme . '.php';
                 if (!file_exists($path)) {
                     $path = get_file_base() . '/sources/hooks/systems/ocf_auth/' . $password_compatibility_scheme . '.php';
                 }
                 if (!file_exists($path)) {
                     $out['error'] = do_lang_tempcode('UNKNOWN_AUTH_SCHEME_IN_DB');
                     return $out;
                 }
                 require_code('hooks/systems/ocf_auth/' . $password_compatibility_scheme);
                 $ob = object_factory('Hook_ocf_auth_' . $password_compatibility_scheme);
                 $error = $ob->auth($username, $userid, $password_hashed, $password_raw, $cookie_login, $row);
                 if (!is_null($error)) {
                     $out['error'] = $error;
                     return $out;
                 }
                 break;
         }
     }
     // Ok, authorised basically, but we need to see if this is a valid login IP
     if (ocf_get_best_group_property($this->get_members_groups($row['id']), 'enquire_on_new_ips') == 1) {
         global $SENT_OUT_VALIDATE_NOTICE;
         $ip = get_ip_address(3);
         $test2 = $this->connection->query_value_null_ok('f_member_known_login_ips', 'i_val_code', array('i_member_id' => $row['id'], 'i_ip' => $ip));
         if ((is_null($test2) || $test2 != '') && !compare_ip_address($ip, $row['m_ip_address'])) {
             if (!$SENT_OUT_VALIDATE_NOTICE) {
                 if (!is_null($test2)) {
                     $this->connection->query_delete('f_member_known_login_ips', array('i_member_id' => $row['id'], 'i_ip' => $ip), '', 1);
                 }
                 $code = !is_null($test2) ? $test2 : uniqid('', true);
                 $this->connection->query_insert('f_member_known_login_ips', array('i_val_code' => $code, 'i_member_id' => $row['id'], 'i_ip' => $ip));
                 $url = find_script('validateip') . '?code=' . $code;
                 $url_simple = find_script('validateip');
                 require_code('comcode');
                 $mail = do_lang('IP_VERIFY_MAIL', comcode_escape($url), comcode_escape(get_ip_address()), array($url_simple, $code), get_lang($row['id']));
                 $email_address = $row['m_email_address'];
                 if ($email_address == '') {
                     $email_address = get_option('staff_address');
                 }
                 if (running_script('index')) {
                     mail_wrap(do_lang('IP_VERIFY_MAIL_SUBJECT', NULL, NULL, NULL, get_lang($row['id'])), $mail, array($email_address), $row['m_username'], '', '', 1);
                 }
                 $SENT_OUT_VALIDATE_NOTICE = true;
             }
             $out['error'] = do_lang_tempcode('REQUIRES_IP_VALIDATION');
             return $out;
         }
     }
     $this->ocf_flood_control($row['id']);
     $out['id'] = $row['id'];
     return $out;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:ocf.php

示例15: dispatch_news_notification

/**
 * Send out a notification of some new news.
 *
 * @param  AUTO_LINK		The ID of the news
 * @param  SHORT_TEXT	The title
 * @param  AUTO_LINK		The main news category
 */
function dispatch_news_notification($id, $title, $main_news_category)
{
    $self_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $id), get_module_zone('news'), NULL, false, false, true);
    $is_blog = !is_null($GLOBALS['SITE_DB']->query_value('news_categories', 'nc_owner', array('id' => $main_news_category)));
    require_code('notifications');
    require_lang('news');
    if ($is_blog) {
        $subject = do_lang('BLOG_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $title);
        $mail = do_lang('BLOG_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($title), array($self_url->evaluate()));
        dispatch_notification('news_entry', strval($main_news_category), $subject, $mail);
    } else {
        $subject = do_lang('NEWS_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $title);
        $mail = do_lang('NEWS_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($title), array($self_url->evaluate()));
        dispatch_notification('news_entry', strval($main_news_category), $subject, $mail);
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:23,代码来源:news.php


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