• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP my_strlen函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tags_validate

function tags_validate(&$datahandler)
{
    global $mybb, $db, $thread, $lang;
    if ($mybb->settings['tags_enabled'] == 0 || tags_in_disforum($datahandler->fid) || $mybb->settings['tags_groups'] != -1 && !is_member($mybb->settings['tags_groups'])) {
        return;
    }
    $lang->load('tags');
    $mybb->settings['tags_max_thread'] = (int) $mybb->settings['tags_max_thread'];
    if ($mybb->get_input('tags') != '' && ($datahandler->action == 'thread' || is_array($thread) && $datahandler->data['pid'] == $thread['firstpost'])) {
        $tags_value = $mybb->get_input('tags');
        $tags_value = tags_string2tag($tags_value);
        $tags = explode(',', $tags_value);
        if (count($tags) > $mybb->settings['tags_max_thread'] && $mybb->settings['tags_max_thread'] > 0) {
            $lang->many_tags = $lang->sprintf($lang->many_tags, $mybb->settings['tags_max_thread']);
            $datahandler->set_error($lang->many_tags);
            return;
        }
        foreach ($tags as $tag) {
            if (my_strlen($tag) > 0 && my_strlen($tag) < $mybb->settings['tags_minchars']) {
                $datahandler->set_error($lang->tags_too_short);
                return;
            } elseif (my_strlen($tag) > $mybb->settings['tags_maxchars'] && $mybb->settings['tags_maxchars'] > 0) {
                $datahandler->set_error($lang->tags_too_long);
                return;
            }
        }
    }
}
开发者ID:ATofighi,项目名称:MyBB-Tags,代码行数:28,代码来源:datahandler_post.php


示例2: verify_subject

 /**
  * Verifies a private message subject.
  *
  * @return boolean True when valid, false when invalid.
  */
 function verify_subject()
 {
     $subject =& $this->data['subject'];
     // Subject is over 85 characters, too long.
     if (my_strlen($subject) > 85) {
         $this->set_error("too_long_subject");
         return false;
     }
     // No subject, apply the default [no subject]
     if (!trim_blank_chrs($subject)) {
         $this->set_error("missing_subject");
         return false;
     }
     return true;
 }
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:20,代码来源:pm.php


示例3: countWord

 function countWord($string)
 {
     //출처 http://php.net/manual/en/function.str-word-count.php
     // Return the number of words in a string.
     $string = str_replace("&#039;", "'", $string);
     $t = array(' ', "\t", '=', '+', '-', '*', '/', '\\', ',', '.', ';', ':', '[', ']', '{', '}', '(', ')', '<', '>', '&', '%', '$', '@', '#', '^', '!', '?', '~');
     // separators
     $string = str_replace($t, " ", $string);
     $string = trim(preg_replace("/\\s+/", " ", $string));
     $num = 0;
     if (my_strlen($string) > 0) {
         $word_array = explode(" ", $string);
         $num = count($word_array);
     }
     return $num;
 }
开发者ID:kimjbrandon,项目名称:restAPI,代码行数:16,代码来源:order_model.php


示例4: array

    }
    $xml = "<?xml version=\"1.0\" encoding=\"{$lang->settings['charset']}\"?" . ">\n";
    $xml = "<usergroups version=\"{$mybb->version_code}\" exported=\"" . TIME_NOW . "\">\n";
    $query = $db->simple_select("usergroups", "*", $gidwhere, array('order_by' => 'gid', 'order_dir' => 'ASC'));
    while ($usergroup = $db->fetch_array($query)) {
        $xml .= "\t\t<usergroup>\n";
        foreach ($usergroup as $key => $value) {
            $value = str_replace(']]>', ']]]]><![CDATA[>', $value);
            $xml .= "\t\t\t<{$key}><![CDATA[{$value}]]></{$key}>\n";
        }
        $xml .= "\t\t</usergroup>\n";
    }
    $xml .= "</usergroups>";
    $mybb->settings['bbname'] = urlencode($mybb->settings['bbname']);
    header("Content-disposition: filename=" . $mybb->settings['bbname'] . "-usergroups.xml");
    header("Content-Length: " . my_strlen($xml));
    header("Content-type: unknown/unknown");
    header("Pragma: no-cache");
    header("Expires: 0");
    $plugins->run_hooks("admin_user_groups_export_end");
    echo $xml;
    exit;
}
if ($mybb->input['action'] == "approve_join_request") {
    $plugins->run_hooks("admin_user_groups_approve_join_request");
    $query = $db->simple_select("joinrequests", "*", "rid='" . $mybb->input['rid'] . "'");
    $request = $db->fetch_array($query);
    if (!$request['rid']) {
        flash_message($lang->error_invalid_join_request, 'error');
        admin_redirect("index.php?module=user-groups");
    }
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:groups.php


示例5: eval

     echo $error;
     exit;
 }
 // This user is trying to give a positive reputation, but positive reps have been disabled.
 if ($mybb->get_input('reputation', MyBB::INPUT_INT) > 0 && $mybb->settings['posrep'] != 1) {
     $message = $lang->add_positive_disabled;
     if ($mybb->input['nomodal']) {
         eval("\$error = \"" . $templates->get("reputation_add_error_nomodal", 1, 0) . "\";");
     } else {
         eval("\$error = \"" . $templates->get("reputation_add_error", 1, 0) . "\";");
     }
     echo $error;
     exit;
 }
 // The length of the comment is too long
 if (my_strlen($mybb->input['comments']) > $mybb->settings['maxreplength']) {
     $message = $lang->sprintf($lang->add_toolong, $mybb->settings['maxreplength']);
     if ($mybb->input['nomodal']) {
         eval("\$error = \"" . $templates->get("reputation_add_error_nomodal", 1, 0) . "\";");
     } else {
         eval("\$error = \"" . $templates->get("reputation_add_error", 1, 0) . "\";");
     }
     echo $error;
     exit;
 }
 // Build array of reputation data.
 $reputation = array("uid" => $uid, "adduid" => $mybb->user['uid'], "pid" => $mybb->get_input('pid', MyBB::INPUT_INT), "reputation" => $mybb->get_input('reputation', MyBB::INPUT_INT), "dateline" => TIME_NOW, "comments" => $db->escape_string($mybb->input['comments']));
 $plugins->run_hooks("reputation_do_add_process");
 // Updating an existing reputation
 if (!empty($existing_reputation['uid'])) {
     $db->update_query("reputation", $reputation, "rid='" . $existing_reputation['rid'] . "'");
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:31,代码来源:reputation.php


示例6: verify_profile_fields

 /**
  * Verifies if a profile fields are filled in correctly.
  *
  * @return boolean True when valid, false when invalid.
  */
 function verify_profile_fields()
 {
     global $db, $cache;
     $user =& $this->data;
     $profile_fields =& $this->data['profile_fields'];
     // Loop through profile fields checking if they exist or not and are filled in.
     $userfields = array();
     $comma = '';
     // Fetch all profile fields first.
     $pfcache = $cache->read('profilefields');
     if (is_array($pfcache)) {
         // Then loop through the profile fields.
         foreach ($pfcache as $profilefield) {
             if (isset($this->data['profile_fields_editable']) || isset($this->data['registration']) && ($profilefield['required'] == 1 || $profilefield['registration'] == 1)) {
                 $profilefield['editableby'] = -1;
             }
             if (!is_member($profilefield['editableby'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups']))) {
                 continue;
             }
             // Does this field have a minimum post count?
             if (!isset($this->data['profile_fields_editable']) && !empty($profilefield['postnum']) && $profilefield['postnum'] > $user['postnum']) {
                 continue;
             }
             $profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
             $thing = explode("\n", $profilefield['type'], "2");
             $type = trim($thing[0]);
             $field = "fid{$profilefield['fid']}";
             if (!isset($profile_fields[$field])) {
                 $profile_fields[$field] = '';
             }
             // If the profile field is required, but not filled in, present error.
             if ($type != "multiselect" && $type != "checkbox") {
                 if (trim($profile_fields[$field]) == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php") {
                     $this->set_error('missing_required_profile_field', array($profilefield['name']));
                 }
             } elseif (($type == "multiselect" || $type == "checkbox") && $profile_fields[$field] == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php") {
                 $this->set_error('missing_required_profile_field', array($profilefield['name']));
             }
             // Sort out multiselect/checkbox profile fields.
             $options = '';
             if (($type == "multiselect" || $type == "checkbox") && is_array($profile_fields[$field])) {
                 $expoptions = explode("\n", $thing[1]);
                 $expoptions = array_map('trim', $expoptions);
                 foreach ($profile_fields[$field] as $value) {
                     if (!in_array(htmlspecialchars_uni($value), $expoptions)) {
                         $this->set_error('bad_profile_field_values', array($profilefield['name']));
                     }
                     if ($options) {
                         $options .= "\n";
                     }
                     $options .= $db->escape_string($value);
                 }
             } elseif ($type == "select" || $type == "radio") {
                 $expoptions = explode("\n", $thing[1]);
                 $expoptions = array_map('trim', $expoptions);
                 if (!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && trim($profile_fields[$field]) != "") {
                     $this->set_error('bad_profile_field_values', array($profilefield['name']));
                 }
                 $options = $db->escape_string($profile_fields[$field]);
             } else {
                 if ($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $profilefield['maxlength']) {
                     $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength']));
                 }
                 if (!empty($profilefield['regex']) && !preg_match("#" . $profilefield['regex'] . "#i", $profile_fields[$field])) {
                     $this->set_error('bad_profile_field_value', array($profilefield['name']));
                 }
                 $options = $db->escape_string($profile_fields[$field]);
             }
             $user['user_fields'][$field] = $options;
         }
     }
     return true;
 }
开发者ID:olada,项目名称:mybbintegrator,代码行数:78,代码来源:user.php


示例7: htmlspecialchars_uni

        $message['subject'] = $parser->parse_badwords($message['subject']);
        if (my_strlen($message['subject']) > 50) {
            $message['subject'] = htmlspecialchars_uni(my_substr($message['subject'], 0, 50) . "...");
        } else {
            $message['subject'] = htmlspecialchars_uni($message['subject']);
        }
        if ($message['folder'] != "3") {
            $senddate = my_date('relative', $message['dateline']);
        } else {
            $senddate = $lang->not_sent;
        }
        $foldername = $foldernames[$message['folder']];
        // What we do here is parse the post using our post parser, then strip the tags from it
        $parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
        $message['message'] = strip_tags($parser->parse_message($message['message'], $parser_options));
        if (my_strlen($message['message']) > 200) {
            $message['message'] = my_substr($message['message'], 0, 200) . "...";
        }
        eval("\$messagelist .= \"" . $templates->get("private_search_messagebit") . "\";");
    }
    if ($db->num_rows($query) == 0) {
        eval("\$messagelist = \"" . $templates->get("private_search_results_nomessages") . "\";");
    }
    $plugins->run_hooks("private_results_end");
    eval("\$results = \"" . $templates->get("private_search_results") . "\";");
    output_page($results);
}
if ($mybb->input['action'] == "advanced_search") {
    $plugins->run_hooks("private_advanced_search");
    eval("\$advanced_search = \"" . $templates->get("private_advanced_search") . "\";");
    output_page($advanced_search);
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:private.php


示例8: IN

 $totalposts_query = $db->simple_select("posts", "fid,message", "uid='" . $user['uid'] . "' AND pid NOT IN(" . implode(',', $firstposts) . ")");
 while ($post = $db->fetch_array($totalposts_query)) {
     if ($mybb->settings['newpoints_income_newpost'] == 0) {
         continue;
     }
     if (!$allforumrules[$post['fid']]) {
         $allforumrules[$post['fid']]['rate'] = 1;
     }
     // no rule set so default income rate is 1
     // if the forum rate is 0, nothing is going to be added so let's just skip to the next post
     if ($allforumrules[$post['fid']]['rate'] == 0) {
         continue;
     }
     // calculate points ber character bonus
     // let's see if the number of characters in the post is greater than the minimum characters
     if (($charcount = my_strlen($post['message'])) >= $mybb->settings['newpoints_income_minchar']) {
         $bonus = $charcount * $mybb->settings['newpoints_income_perchar'];
     } else {
         $bonus = 0;
     }
     // give points to the poster
     $points += ($mybb->settings['newpoints_income_newpost'] + $bonus) * $allforumrules[$post['fid']]['rate'];
     $thread = get_thread($post['tid']);
     if ($thread['uid'] != $user['uid']) {
         // we are not the thread started so give points to him/her
         if ($mybb->settings['newpoints_income_perreply'] != 0) {
             newpoints_addpoints($thread['uid'], $mybb->settings['newpoints_income_perreply'], $allforumrules[$post['fid']]['rate'], $grouprules['rate']);
         }
     }
 }
 // poll votes
开发者ID:ambsalinas,项目名称:anima,代码行数:31,代码来源:maintenance.php


示例9: eval

         } else {
             eval("\$latest_post = \"" . $templates->get("modcp_awaitingmoderation_none") . "\";");
         }
         eval("\$awaitingposts = \"" . $templates->get("modcp_awaitingposts") . "\";");
     }
     if ($nummodqueuethreads > 0 || $mybb->usergroup['issupermod'] == 1) {
         $query = $db->simple_select("threads", "COUNT(tid) AS unapprovedthreads", "visible='0' {$flist_queue_threads}");
         $unapproved_threads = $db->fetch_field($query, "unapprovedthreads");
         if ($unapproved_threads > 0) {
             $query = $db->simple_select("threads", "tid, subject, uid, username, dateline", "visible='0' {$flist_queue_threads}", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => 1));
             $thread = $db->fetch_array($query);
             $thread['date'] = my_date('relative', $thread['dateline']);
             $thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
             $thread['link'] = get_thread_link($thread['tid']);
             $thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
             if (my_strlen($thread['subject']) > 25) {
                 $post['subject'] = my_substr($thread['subject'], 0, 25) . "...";
             }
             $thread['subject'] = htmlspecialchars_uni($thread['subject']);
             $thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);
             $unapproved_threads = my_number_format($unapproved_threads);
             eval("\$latest_thread = \"" . $templates->get("modcp_lastthread") . "\";");
         } else {
             eval("\$latest_thread = \"" . $templates->get("modcp_awaitingmoderation_none") . "\";");
         }
         eval("\$awaitingthreads = \"" . $templates->get("modcp_awaitingthreads") . "\";");
     }
     if (!empty($awaitingattachments) || !empty($awaitingposts) || !empty($awaitingthreads)) {
         eval("\$awaitingmoderation = \"" . $templates->get("modcp_awaitingmoderation") . "\";");
     }
 }
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:modcp.php


示例10: get_post_icons

                 $postoptions_subscriptionmethod_dont = "checked=\"checked\"";
             }
         }
     }
 }
 if ($forum['allowpicons'] != 0) {
     $posticons = get_post_icons();
 }
 // No subject?
 if (!isset($subject)) {
     if (!empty($mybb->input['subject'])) {
         $subject = $mybb->get_input('subject');
     } else {
         $subject = $thread['subject'];
         // Subject too long? Shorten it to avoid error message
         if (my_strlen($subject) > 85) {
             $subject = my_substr($subject, 0, 82) . '...';
         }
         $subject = "RE: " . $subject;
     }
 }
 // Preview a post that was written.
 $preview = '';
 if (!empty($mybb->input['previewpost'])) {
     // If this isn't a logged in user, then we need to do some special validation.
     if ($mybb->user['uid'] == 0) {
         // If they didn't specify a username then give them "Guest"
         if (!$mybb->get_input('username')) {
             $username = $lang->guest;
         } else {
             $username = $mybb->get_input('username');
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:newreply.php


示例11: google_seo_url_truncate

/**
 * Truncate too long URLs.
 *
 * @param string The string to be truncated.
 * @param string The word separator.
 * @param int The soft limit.
 * @param int The hard limit.
 * @return string truncated string
 */
function google_seo_url_truncate($str)
{
    global $settings;
    $separator = $settings['google_seo_url_separator'];
    $soft = $settings['google_seo_url_length_soft'];
    $hard = $settings['google_seo_url_length_hard'];
    // Cut off word past soft limit.
    if ($soft && my_strlen($str) > $soft) {
        // Search the separator after the soft limit.
        $part = my_substr($str, $soft);
        $pos = my_strpos($part, $separator);
        if ($pos === 0 || $pos > 0) {
            $str = my_substr($str, 0, $soft + $pos);
        }
    }
    // Truncate hard limit.
    if ($hard && my_strlen($str) > $hard) {
        $str = my_substr($str, 0, $hard);
    }
    return $str;
}
开发者ID:learnix-xx,项目名称:MyBB-Google-SEO,代码行数:30,代码来源:url.php


示例12: count

     break;
 }
 // Any events on this specific day?
 if (is_array($events_cache) && array_key_exists("{$day}-{$calendar_month}-{$calendar_year}", $events_cache)) {
     $total_events = count($events_cache["{$day}-{$calendar_month}-{$calendar_year}"]);
     if ($total_events > $calendar['eventlimit'] && $calendar['eventlimit'] != 0) {
         if ($total_events > 1) {
             $day_events = "<div style=\"margin-bottom: 4px;\"><a href=\"" . get_calendar_link($calendar['cid'], $calendar_year, $calendar_month, $day) . "\" class=\"smalltext\">{$total_events} {$lang->events}</a></div>\n";
         } else {
             $day_events = "<div style=\"margin-bottom: 4px;\"><a href=\"" . get_calendar_link($calendar['cid'], $calendar_year, $calendar_month, $day) . "\" class=\"smalltext\">1 {$lang->event}</a></div>\n";
         }
     } else {
         foreach ($events_cache["{$day}-{$calendar_month}-{$calendar_year}"] as $event) {
             $event['eventlink'] = get_event_link($event['eid']);
             $event['fullname'] = htmlspecialchars_uni($event['name']);
             if (my_strlen($event['name']) > 15) {
                 $event['name'] = my_substr($event['name'], 0, 15) . "...";
             }
             $event['name'] = htmlspecialchars_uni($event['name']);
             if ($event['private'] == 1) {
                 $event_class = " private_event";
             } else {
                 $event_class = " public_event";
             }
             if ($event['visible'] == 0) {
                 $event_class .= " trow_shaded";
             }
             eval("\$day_events .= \"" . $templates->get("calendar_eventbit") . "\";");
         }
     }
 }
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:calendar.php


示例13: draw_string

/**
 * Writes text to the image.
 *
 * @param resource $im The image.
 * @param string $string The string to be written
 *
 * @return bool False if string is empty, true otherwise
 */
function draw_string(&$im, $string)
{
    global $use_ttf, $min_size, $max_size, $min_angle, $max_angle, $ttf_fonts, $img_height, $img_width;
    if (empty($string)) {
        return false;
    }
    $spacing = $img_width / my_strlen($string);
    $string_length = my_strlen($string);
    for ($i = 0; $i < $string_length; ++$i) {
        // Using TTF fonts
        if ($use_ttf) {
            // Select a random font size
            $font_size = my_rand($min_size, $max_size);
            // Select a random font
            $font = array_rand($ttf_fonts);
            $font = $ttf_fonts[$font];
            // Select a random rotation
            $rotation = my_rand($min_angle, $max_angle);
            // Set the colour
            $r = my_rand(0, 200);
            $g = my_rand(0, 200);
            $b = my_rand(0, 200);
            $color = imagecolorallocate($im, $r, $g, $b);
            // Fetch the dimensions of the character being added
            $dimensions = imageftbbox($font_size, $rotation, $font, $string[$i], array());
            $string_width = $dimensions[2] - $dimensions[0];
            $string_height = $dimensions[3] - $dimensions[5];
            // Calculate character offsets
            //$pos_x = $pos_x + $string_width + ($string_width/4);
            $pos_x = $spacing / 4 + $i * $spacing;
            $pos_y = ceil($img_height - $string_height / 2);
            // Draw a shadow
            $shadow_x = my_rand(-3, 3) + $pos_x;
            $shadow_y = my_rand(-3, 3) + $pos_y;
            $shadow_color = imagecolorallocate($im, $r + 20, $g + 20, $b + 20);
            imagefttext($im, $font_size, $rotation, $shadow_x, $shadow_y, $shadow_color, $font, $string[$i], array());
            // Write the character to the image
            imagefttext($im, $font_size, $rotation, $pos_x, $pos_y, $color, $font, $string[$i], array());
        } else {
            // Get width/height of the character
            $string_width = imagefontwidth(5);
            $string_height = imagefontheight(5);
            // Calculate character offsets
            $pos_x = $spacing / 4 + $i * $spacing;
            $pos_y = $img_height / 2 - $string_height - 10 + my_rand(-3, 3);
            // Create a temporary image for this character
            if (gd_version() >= 2) {
                $temp_im = imagecreatetruecolor(15, 20);
            } else {
                $temp_im = imagecreate(15, 20);
            }
            $bg_color = imagecolorallocate($temp_im, 255, 255, 255);
            imagefill($temp_im, 0, 0, $bg_color);
            imagecolortransparent($temp_im, $bg_color);
            // Set the colour
            $r = my_rand(0, 200);
            $g = my_rand(0, 200);
            $b = my_rand(0, 200);
            $color = imagecolorallocate($temp_im, $r, $g, $b);
            // Draw a shadow
            $shadow_x = my_rand(-1, 1);
            $shadow_y = my_rand(-1, 1);
            $shadow_color = imagecolorallocate($temp_im, $r + 50, $g + 50, $b + 50);
            imagestring($temp_im, 5, 1 + $shadow_x, 1 + $shadow_y, $string[$i], $shadow_color);
            imagestring($temp_im, 5, 1, 1, $string[$i], $color);
            // Copy to main image
            imagecopyresized($im, $temp_im, $pos_x, $pos_y, 0, 0, 40, 55, 15, 20);
            imagedestroy($temp_im);
        }
    }
    return true;
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:80,代码来源:captcha.php


示例14: get_forum_link

     $post['forumlink'] = "<a href=\"" . get_forum_link($post['fid']) . "\">" . $forumcache[$post['fid']]['name'] . "</a>";
 } else {
     $post['forumlink'] = "";
 }
 if (!$post['subject']) {
     $post['subject'] = $post['message'];
 }
 if (my_strlen($post['subject']) > 50) {
     $post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50) . "...");
 } else {
     $post['subject'] = htmlspecialchars_uni($post['subject']);
 }
 // What we do here is parse the post using our post parser, then strip the tags from it
 $parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
 $post['message'] = strip_tags($parser->parse_message($post['message'], $parser_options));
 if (my_strlen($post['message']) > 200) {
     $prev = my_substr($post['message'], 0, 200) . "...";
 } else {
     $prev = $post['message'];
 }
 $posted = my_date($mybb->settings['dateformat'], $post['dateline']) . ", " . my_date($mybb->settings['timeformat'], $post['dateline']);
 $thread_url = get_thread_link($post['tid']);
 $post_url = get_post_link($post['pid'], $post['tid']);
 // Inline post moderation
 $inline_mod_checkbox = '';
 if ($is_supermod || is_moderator($post['fid'])) {
     eval("\$inline_mod_checkbox = \"" . $templates->get("search_results_posts_inlinecheck") . "\";");
 } elseif ($is_mod) {
     eval("\$inline_mod_checkbox = \"" . $templates->get("search_results_posts_nocheck") . "\";");
 }
 $plugins->run_hooks("search_results_post");
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:31,代码来源:search.php


示例15: retrieve_buddylist_from_db

 public function retrieve_buddylist_from_db($page, $memprofile)
 {
     global $db, $settings;
     $page = (int) $page;
     $buddylist = array();
     $count = count(array_filter(explode(",", $memprofile["buddylist"])));
     $limit = is_numeric($settings["mpbuddylistrecord"]) ? (int) $settings["mpbuddylistrecord"] : 4;
     $membuddylistarray = array_slice(explode(",", $memprofile["buddylist"]), ($page - 1) * $limit, $limit);
     $membuddylist = implode(",", $membuddylistarray);
     if (my_strlen(trim($membuddylist)) != 0) {
         $query = $db->simple_select("users", "*", "uid IN ({$membuddylist})", array("limit" => $limit));
         while ($buddy = $db->fetch_array($query)) {
             $buddylist[] = $buddy;
         }
         /* saving up a query */
     }
     return $this->buddylist_process($buddylist, $count, $memprofile, $limit, $page);
 }
开发者ID:medbenji,项目名称:MyProfile,代码行数:18,代码来源:myprofilebuddylist.class.php


示例16: verify_profile_fields

 /**
  * Verifies if a profile fields are filled in correctly.
  *
  * @return boolean True when valid, false when invalid.
  */
 function verify_profile_fields()
 {
     global $db;
     $user =& $this->data;
     $profile_fields =& $this->data['profile_fields'];
     // Loop through profile fields checking if they exist or not and are filled in.
     $userfields = array();
     $comma = '';
     $editable = '';
     if (!$this->data['profile_fields_editable']) {
         $editable = "editable=1";
     }
     // Fetch all profile fields first.
     $options = array('order_by' => 'disporder');
     $query = $db->simple_select('profilefields', 'name, postnum, type, fid, required, maxlength', $editable, $options);
     // Then loop through the profile fields.
     while ($profilefield = $db->fetch_array($query)) {
         // Does this field have a minimum post count?
         if (!$this->data['profile_fields_editable'] && !empty($profilefield['postnum']) && $profilefield['postnum'] > $user['postnum']) {
             continue;
         }
         $profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
         $thing = explode("\n", $profilefield['type'], "2");
         $type = trim($thing[0]);
         $field = "fid{$profilefield['fid']}";
         // If the profile field is required, but not filled in, present error.
         if ($type != "multiselect" && $type != "checkbox") {
             if (trim($profile_fields[$field]) == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php") {
                 $this->set_error('missing_required_profile_field', array($profilefield['name']));
             }
         } elseif (($type == "multiselect" || $type == "checkbox") && $profile_fields[$field] == "" && $profilefield['required'] == 1 && !defined('IN_ADMINCP') && THIS_SCRIPT != "modcp.php") {
             $this->set_error('missing_required_profile_field', array($profilefield['name']));
         }
         // Sort out multiselect/checkbox profile fields.
         $options = '';
         if (($type == "multiselect" || $type == "checkbox") && is_array($profile_fields[$field])) {
             $expoptions = explode("\n", $thing[1]);
             $expoptions = array_map('trim', $expoptions);
             foreach ($profile_fields[$field] as $value) {
                 if (!in_array(htmlspecialchars_uni($value), $expoptions)) {
                     $this->set_error('bad_profile_field_values', array($profilefield['name']));
                 }
                 if ($options) {
                     $options .= "\n";
                 }
                 $options .= $db->escape_string($value);
             }
         } elseif ($type == "select" || $type == "radio") {
             $expoptions = explode("\n", $thing[1]);
             $expoptions = array_map('trim', $expoptions);
             if (!in_array(htmlspecialchars_uni($profile_fields[$field]), $expoptions) && trim($profile_fields[$field]) != "") {
                 $this->set_error('bad_profile_field_values', array($profilefield['name']));
             }
             $options = $db->escape_string($profile_fields[$field]);
         } elseif ($type == "textarea") {
             if ($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $profilefield['maxlength']) {
                 $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength']));
             }
             $options = $db->escape_string($profile_fields[$field]);
         } else {
             if ($profilefield['maxlength'] > 0 && my_strlen($profile_fields[$field]) > $profilefield['maxlength']) {
                 $this->set_error('max_limit_reached', array($profilefield['name'], $profilefield['maxlength']));
             }
             $options = $db->escape_string($profile_fields[$field]);
         }
         $user['user_fields'][$field] = $options;
     }
     return true;
 }
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:74,代码来源:user.php


示例17: error

 if (!isset($postoptions['public']) || $postoptions['public'] != '1') {
     $postoptions['public'] = 0;
 }
 if (!isset($postoptions['closed']) || $postoptions['closed'] != '1') {
     $postoptions['closed'] = 0;
 }
 $optioncount = "0";
 $options = $mybb->input['options'];
 for ($i = 1; $i <= $numoptions; ++$i) {
     if (!isset($options[$i])) {
         $options[$i] = '';
     }
     if (trim($options[$i]) != '') {
         $optioncount++;
     }
     if (my_strlen($options[$i]) > $mybb->settings['polloptionlimit'] && $mybb->settings['polloptionlimit'] != 0) {
         $lengtherror = 1;
         break;
     }
 }
 if (isset($lengtherror)) {
     error($lang->error_polloptiontoolong);
 }
 $mybb->input['question'] = $mybb->get_input('question');
 if (trim($mybb->input['question']) == '' || $optioncount < 2) {
     error($lang->error_noquestionoptions);
 }
 $optionslist = '';
 $voteslist = '';
 $numvotes = '';
 $votes = $mybb->input['votes'];
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:polls.php


示例18: mycode_parse_img

 /**
  * Parses IMG MyCode.
  *
  * @param string The URL to the image
  * @param array Optional array of dimensions
  */
 function mycode_parse_img($url, $dimensions = array(), $align = '')
 {
     global $lang;
     $url = trim($url);
     $url = str_replace("\n", "", $url);
     $url = str_replace("\r", "", $url);
     if (!empty($this->options['allow_html'])) {
         $url = $this->parse_html($url);
     }
     $css_align = '';
     if ($align == "right") {
         $css_align = " style=\"float: right;\"";
     } else {
         if ($align == "left") {
             $css_align = " style=\"float: left;\"";
         }
     }
     $alt = basename($url);
     $alt = htmlspecialchars_decode($alt);
     if (my_strlen($alt) > 55) {
         $alt = my_substr($alt, 0, 40) . '...' . my_substr($alt, -10);
     }
     $alt = htmlspecialchars_uni($alt);
     $alt = $lang->sprintf($lang->posted_image, $alt);
     if (isset($dimensions[0]) && $dimensions[0] > 0 && isset($dimensions[1]) && $dimensions[1] > 0) {
         return "<img src=\"{$url}\" width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
     } else {
         return "<img src=\"{$url}\" border=\"0\" alt=\"{$alt}\"{$css_align} />";
     }
 }
开发者ID:olada,项目名称:mybbintegrator,代码行数:36,代码来源:class_parser.php


示例19: firstpreview_pm

function firstpreview_pm()
{
    global $mybb, $db, $charset, $headerinclude, $header;
    $header = '<div class="arrow-down"></div>' . $header;
    // Add jQuery and noConflict for MyBB 1.6.*
    $jquery = '';
    $noconflict = '';
    if ($mybb->version < "1.7.0") {
        $jquery = '<script type="text/javascript">
//<![CDATA[
if (!window.jQuery)
{
document.write(unescape("%3Cscript src=\\"http://code.jquery.com/jquery-latest.min.js\\" type=\\"text/javascript\\"%3E%3C/script%3E"));
}
//]]>
</script>';
        $noconflict = 'jQuery.noConflict();';
    }
    // Background color
    $bg_color = '#aaaaaa';
    if (isset($mybb->settings['firstpreview_bg']) && preg_match('/^#([0-9a-f]{1,6})$/i', $mybb->settings['firstpreview_bg'])) {
        $bg_color = htmlspecialchars_uni($mybb->settings['firstpreview_bg']);
    }
    // Close button
    $close_preview = '#close_preview{display:none;cursor:pointer;background:#000;color:#fff;float:right;font-size:1em;font-weight:bold;text-align:center;width:20px;height:20px;border-radius:5px}';
    if (isset($mybb->settings['firstpreview_close']) && $mybb->settings['firstpreview_close'] == 1) {
        $close_preview = '#close_preview{cursor:pointer;background:#000;color:#fff;float:right;font-size:1em;font-weight:bold;text-align:center;width:20px;height:20px;border-radius:5px}';
    }
    // Insert the code
    $headerinclude .= '
	<!-- start: first_preview_plugin -->
	<style type="text/css">
	.modal_firstpost{text-align:left;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;border:1px solid ' . $bgcolor . ';display:none;position:absolute;z-index:29000;width:390px;height:180px;overflow:hidden}
	.fpreview{z-index:29001;width:390px;height:180px;overflow:auto;background:' . $bg_color . '}
	.arrow-down{display:none;position:absolute;z-index:28999;width:0;height:0;border-left:20px solid transparent;border-right:20px solid transparent;border-top:20px solid ' . $bg_color . '}
	.prev_content{padding:10px;height:auto;word-wrap:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;-o-hyphens:auto;hyphens:auto;background:none}
	' . $close_preview . '
	</style>
	' . $jquery . '
	<script type="text/javascript">
	//<![CDATA[
	' . $noconflict . '
	<!--
	if(use_xmlhttprequest == 1) {
		jQuery(document).ready(function(e){e(".pmprev").on("touchenter mouseenter",function(){id=e(this).attr("id");pmid=id.replace(/[^\\d.]/g,"");var t=e(this).offset().left;var n=e(this).offset().top-200;showPost=setTimeout(function(){e.ajax({url:"private.php?pmid="+pmid+"&firstpm=1",type:"post",complete:function(t){e(".modal_firstpost").html(t.responseText)}});e(".modal_firstpost").fadeIn("slow");e(".modal_firstpost").css("top",n);e(".modal_firstpost").css("left",t);e(".arrow-down").fadeIn("slow");e(".arrow-down").css("top",n+180);e(".arrow-down").css("left",t+20);},1500)});e(".pmprev").on("mouseleave touchleave touchend",function(){clearTimeout(showPost);});e(".modal_firstpost").on("mouseleave touchmove",function(){e(".modal_firstpost").fadeOut("slow");e(".arrow-down").fadeOut("fast")});e(".modal_firstpost").on("click", "#close_preview", function(){e(".modal_firstpost").fadeOut("slow");e(".arrow-down").fadeOut("fast")})});
	}
	//]]>
	</scri 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP my_strpos函数代码示例发布时间:2022-05-15
下一篇:
PHP my_string_limit_words函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap