示例#1
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     $file = array_key_exists('param', $map) ? $map['param'] : 'ocprocks';
     require_code('textfiles');
     require_lang('ocprocks');
     $place = _find_text_file_path($file, '');
     if (!file_exists($place)) {
         warn_exit(do_lang_tempcode('DIRECTORY_NOT_FOUND', escape_html($place)));
     }
     $edit_url = new ocp_tempcode();
     return do_template('BLOCK_MAIN_OCPROCKS', array('FILE' => $file, 'CONTENT' => apply_emoticons($this->get_random_line($place))));
 }
示例#2
0
 /**
  * Standard modular run function for OcCLE notification hooks.
  *
  * @param  ?integer	The "current" time on which to base queries (NULL: now)
  * @return ~array 		Array of section, type and message responses (false: nothing)
  */
 function run($timestamp = NULL)
 {
     if (is_null($timestamp)) {
         $timestamp = time();
     }
     $messages = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'occlechat WHERE c_incoming=1 AND c_timestamp>=' . strval((int) $timestamp));
     require_code('comcode_text');
     if (count($messages) > 0) {
         $_messages = array();
         foreach ($messages as $message) {
             $_messages[apply_emoticons($message['c_message'])] = $message['c_url'];
         }
         $GLOBALS['SITE_DB']->query('DELETE FROM ' . get_table_prefix() . 'occlechat WHERE c_timestamp>=' . strval((int) $timestamp));
         return array(do_lang('OCCLE'), do_lang('_NEW_OCCLECHAT_MESSAGES'), do_template('OCCLE_OCCLECHAT_NOTIFICATION', array('MESSAGE_COUNT' => integer_format(count($messages)), 'MESSAGES' => $_messages)));
     } else {
         return false;
     }
 }
示例#3
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('smilies', array('*'));
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['smiliecode'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => 'c016421840b36b3f70bf5da34740dfaf', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#4
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     $emoticons = $this->connection->query_select('smileys', array('*'), array('smstatus' => 0));
     $em = new ocp_tempcode();
     require_code('comcode_text');
     foreach ($emoticons as $emo) {
         $code = $emo['smcode'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#5
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('smilies', array('code'), NULL, 'GROUP BY code');
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['code'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '6eef1777ed25b62f2c47964eebb655ac', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#6
0
/**
 * Get a table of emoticons.
 *
 * @return tempcode		emotocons
 */
function placeholder_emoticon_chooser()
{
    $em = new ocp_tempcode();
    foreach (placeholder_emoticons() as $emo) {
        $code = $emo[2];
        $em->attach(do_lorem_template('EMOTICON_CLICK_CODE', array('_GUID' => '93968e9ff0308fff92d1d45e433557e2', 'FIELD_NAME' => 'post', 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
    }
    return $em;
}
/**
 * Get an emoticon chooser template.
 *
 * @param  object			Link to the real forum driver
 * @param  string			The ID of the form field the emoticon chooser adds to
 * @return tempcode		The emoticon chooser template
 */
function _helper_get_emoticon_chooser($this_ref, $field_name)
{
    $extra = has_specific_permission(get_member(), 'use_special_emoticons') ? '' : ' AND e_is_special=0';
    $emoticons = $this_ref->connection->query('SELECT * FROM ' . $this_ref->connection->get_table_prefix() . 'f_emoticons WHERE e_relevance_level=0' . $extra);
    $em = new ocp_tempcode();
    foreach ($emoticons as $emo) {
        $code = $emo['e_code'];
        if ($GLOBALS['XSS_DETECT']) {
            ocp_mark_as_escaped($code);
        }
        $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '1a75f914e09f2325ad96ad679bcffe88', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
    }
    return $em;
}
示例#8
0
文件: vb.php 项目: erico-deh/ocPortal
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('smilie', array('*'));
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['smilietext'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => 'a9dabba90bc5e781de02ab57ebfc6e8d', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#9
0
 /**
  * The UI to view a staff member.
  *
  * @return tempcode		The UI
  */
 function do_staff_member()
 {
     require_code('obfuscate');
     $username = get_param('id');
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('STAFF_TITLE', escape_html(get_site_name())))));
     $row_staff = $GLOBALS['FORUM_DRIVER']->pget_row($username);
     if (is_null($row_staff)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $id = $GLOBALS['FORUM_DRIVER']->pname_id($row_staff);
     $title = get_page_title('_STAFF', true, array(escape_html($username)));
     $_real_name = get_ocp_cpf('fullname', $id);
     if ($_real_name == '') {
         $real_name = do_lang_tempcode('_UNKNOWN');
         // Null should not happen, but sometimes things corrupt
     } else {
         $real_name = protect_from_escaping(escape_html($_real_name));
     }
     $_role = get_ocp_cpf('role', $id);
     if ($_role == '') {
         $role = do_lang_tempcode('_UNKNOWN');
         // Null should not happen, but sometimes things corrupt
     } else {
         require_code('comcode_text');
         $role = make_string_tempcode(apply_emoticons($_role));
     }
     $email_address = obfuscate_email_address($GLOBALS['FORUM_DRIVER']->pname_email($row_staff));
     $name = $GLOBALS['FORUM_DRIVER']->pname_name($row_staff);
     $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($id, false, true);
     $all_link = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
     return do_template('STAFF_SCREEN', array('_GUID' => 'fd149466f16722fcbcef0fba5685a895', 'TITLE' => $title, 'REAL_NAME' => $real_name, 'ROLE' => $role, 'ADDRESS' => $email_address, 'NAME' => $name, 'MEMBER_ID' => strval($id), 'PROFILE_URL' => $profile_url, 'ALL_LINK' => $all_link));
 }
示例#10
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('emoticons', array('*'));
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['emoticon_code'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '6b2c35bdeff421f1b8ee9313fc8a748b', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#11
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_emoticons WHERE e_relevance_level=0');
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['e_code'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '0b51492b6e170db4466be74fdf312260', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#12
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('smilies', array('*'), NULL, 'GROUP BY code');
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['code'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '37ca734c4aea443920632e36e48fabc0', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#13
0
/**
 * Convert the specified comcode (unknown format) into a tempcode tree. You shouldn't output the tempcode tree to the browser, as it looks really horrible. If you are in a rare case where you need to output directly (not through templates), you should call the evaluate method on the tempcode object, to convert it into a string.
 *
 * @param  LONG_TEXT		The comcode to convert
 * @param  ?MEMBER		The member the evaluation is running as. This is a security issue, and you should only run as an administrator if you have considered where the comcode came from carefully (NULL: current member)
 * @param  boolean		Whether to explicitly execute this with admin rights. There are a few rare situations where this should be done, for data you know didn't come from a member, but is being evaluated by one. Note that if this is passed false, and $source_member is an admin, it will be parsed using admin privileges anyway.
 * @param  ?integer		The position to conduct wordwrapping at (NULL: do not conduct word-wrapping)
 * @param  ?string		A special identifier that can identify this resource in a sea of our resources of this class; usually this can be ignored, but may be used to provide a binding between Javascript in evaluated comcode, and the surrounding environment (NULL: no explicit binding)
 * @param  ?object		The database connection to use (NULL: standard site connection)
 * @param  boolean		Whether to parse so as to create something that would fit inside a semihtml tag. It means we generate HTML, with Comcode written into it where the tag could never be reverse-converted (e.g. a block).
 * @param  boolean		Whether this is being pre-parsed, to pick up errors before row insertion.
 * @param  boolean		Whether to treat this whole thing as being wrapped in semihtml, but apply normal security otherwise.
 * @param  boolean		Whether we are only doing this parse to find the title structure
 * @param  boolean		Whether to only check the Comcode. It's best to use the check_comcode function which will in turn use this parameter.
 * @param  ?array			A list of words to highlight (NULL: none)
 * @param  ?MEMBER		The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (NULL: member evaluating)
 * @return tempcode		The tempcode generated
 */
function comcode_to_tempcode($comcode, $source_member = NULL, $as_admin = false, $wrap_pos = 60, $pass_id = NULL, $connection = NULL, $semiparse_mode = false, $preparse_mode = false, $is_all_semihtml = false, $structure_sweep = false, $check_only = false, $highlight_bits = NULL, $on_behalf_of_member = NULL)
{
    $matches = array();
    if (preg_match('#^\\{\\!([A-Z\\_]+)\\}$#', $comcode, $matches) != 0) {
        return do_lang_tempcode($matches[1]);
    }
    if ($semiparse_mode) {
        $wrap_pos = 100000;
    }
    $attachments = count($_FILES) != 0;
    foreach ($_POST as $key => $value) {
        if (!is_string($key)) {
            $key = strval($key);
        }
        if (preg_match('#^hidFileID\\_#i', $key) != 0) {
            $attachments = true;
        }
    }
    if ((!$attachments || $GLOBALS['IN_MINIKERNEL_VERSION'] == 1) && preg_match('#^[\\w\\d\\-\\_\\(\\) \\.,:;/"\\!\\?]*$#', $comcode) != 0 && strpos($comcode, '  ') === false && strpos($comcode, '://') === false && get_page_name() != 'search') {
        if (running_script('stress_test_loader')) {
            return make_string_tempcode(escape_html($comcode));
        }
        return make_string_tempcode(apply_emoticons(escape_html($comcode)));
    }
    require_code('comcode_renderer');
    return _comcode_to_tempcode($comcode, $source_member, $as_admin, $wrap_pos, $pass_id, $connection, $semiparse_mode, $preparse_mode, $is_all_semihtml, $structure_sweep, $check_only, $highlight_bits, $on_behalf_of_member);
}
示例#14
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('smileys', array('*'), array('hidden' => 0));
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $emo['code'];
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '93968e9ff0308fff92d1d45e433557e2', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }
示例#15
0
 /**
  * Get an emoticon chooser template.
  *
  * @param  string			The ID of the form field the emoticon chooser adds to
  * @return tempcode		The emoticon chooser template
  */
 function get_emoticon_chooser($field_name = 'post')
 {
     require_code('comcode_text');
     $emoticons = $this->connection->query_select('emoticons', array('*'), array('clickable' => 1));
     $em = new ocp_tempcode();
     foreach ($emoticons as $emo) {
         $code = $this->ipb_unescape($emo['typed']);
         $em->attach(do_template('EMOTICON_CLICK_CODE', array('_GUID' => '0d84b3bc399b53c6dda24ae6369e641d', 'FIELD_NAME' => $field_name, 'CODE' => $code, 'IMAGE' => apply_emoticons($code))));
     }
     return $em;
 }