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


PHP prepare_string函数代码示例

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


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

示例1: getUserSecondaryGroups

 /* Secondary groups management */
 if ($FH->isUpdated("secondary")) {
     $old = getUserSecondaryGroups($uid);
     $new = $FH->getValue('secondary');
     foreach (array_diff($old, $new) as $group) {
         del_member($group, $uid);
         callPluginFunction("delUserFromGroup", array($uid, $group));
     }
     foreach (array_diff($new, $old) as $group) {
         add_member($group, $uid);
         callPluginFunction("addUserToGroup", array($uid, $group));
     }
 }
 /* Password change management */
 if ($mode == 'edit' && $FH->getValue('pass')) {
     $ret = callPluginFunction("changeUserPasswd", array(array($uid, prepare_string($FH->getValue('pass')))));
     if (isXMLRPCError()) {
         $error .= _("Password not updated") . "<br />";
     } else {
         $result .= _("Password updated") . "<br />";
     }
 }
 /* Global disable account */
 if ($mode == 'edit') {
     if ($FH->getPostValue('disableAccount')) {
         $ret = callPluginFunction("disableUser", array($uid));
         foreach ($ret as $plugin => $err) {
             if ($err != 0 && $err != NULL) {
                 $result .= sprintf(_("Failed to disable user in %s plugin"), $plugin) . "<br />";
             }
         }
开发者ID:pulse-project,项目名称:pulse,代码行数:31,代码来源:edit.php

示例2: prepare_string

     $width = $filter->get('width-i', 'INTEGER');
     $height = $filter->get('height-i', 'INTEGER');
 }
 if ($name == '') {
     $errors[] = $lang['album.name_empty'];
     $err['name'] = 1;
 }
 if ($category == '0') {
     $errors[] = $lang['album.category_empty'];
     $err['category'] = 1;
 }
 if ($tags == '') {
     $errors[] = $lang['album.tags_empty'];
     $err['tags'] = 1;
 } else {
     $tags = prepare_string($tags, false);
 }
 if ($type == '') {
     $errors[] = $lang['album.type_empty'];
     $err['type'] = 1;
 }
 if (!$errors) {
     $src = $config['BASE_DIR'] . '/tmp/albums/' . $pid . '_' . $random . '.jpg';
     $dst = $config['BASE_DIR'] . '/media/albums/' . $aid . '.jpg';
     if (file_exists($src) && is_file($src)) {
         $image = new VImageConv();
         $image->process($src, $dst, 'EXACT', $width, $height);
         $image->crop($x, $y, $width, $height, true);
         unlink($src);
     }
     $type = ($type == 'public' or $type == 'private') ? $type : 'public';
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:edit.php

示例3: show_msg

            $data['status'] = 1;
            $data['code'] = $code;
            $data['cid'] = $cid;
            $data['gid'] = $gid;
            $data['msg'] = show_msg($lang['global.comment_success']);
            $_SESSION['g_comment_added'] = time();
            $sql = "SELECT g.title, s.username, s.email, u.game_comment\n                       FROM game AS g, signup AS s, users_prefs AS u \n                       WHERE g.GID = " . $gid . "\n                       AND g.UID = s.UID\n                       AND s.UID = u.UID \n                       LIMIT 1";
            $data['debug'] = $sql;
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() === 1) {
                $prefs_g_comment = $rs->fields['game_comment'];
                if ($prefs_g_comment == '1') {
                    $email = $rs->fields['email'];
                    $username = $rs->fields['username'];
                    $title = $rs->fields['title'];
                    require $config['BASE_DIR'] . '/classes/file.class.php';
                    require $config['BASE_DIR'] . '/classes/email.class.php';
                    $game_link = $config['BASE_URL'] . '/game/' . $gid . '/' . prepare_string($title);
                    $search = array('{$username}', '{$site_title}', '{$site_name}', '{$baseurl}', '{$game_link}');
                    $replace = array($_SESSION['username'], $config['site_title'], $config['site_name'], $config['BASE_URL'], $game_link);
                    $mail = new VMail();
                    $mail->sendPredefined($email, 'game_comment', $search, $replace);
                }
            }
        }
    } else {
        $data['msg'] = show_err($lang['ajax.game_comment_login']);
    }
}
echo json_encode($data);
die;
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:game_comment.php

示例4: intval

             $image->process($src, $dst, 'MAX_WIDTH', 960, 0);
             $image->resize(true, true);
         }
     }
 }
 $src = $config['BASE_DIR'] . '/media/photos/tmb/' . $album_cover_id . '.jpg';
 $dst = $config['BASE_DIR'] . '/media/albums/' . $album_id . '.jpg';
 $image->process($src, $dst, 'MAX_WIDTH', 400, 0);
 $image->resize(true, true);
 $sql = "UPDATE albums SET total_photos = " . intval($photos) . " WHERE AID = " . $album_id . " LIMIT 1";
 $conn->execute($sql);
 $sql = "UPDATE channel SET total_albums = total_albums+1 WHERE CHID = " . $category . " LIMIT 1";
 $conn->execute($sql);
 $sql = "UPDATE signup SET total_albums = total_albums+1, points = points+5 WHERE UID = " . $uid . " LIMIT 1";
 $conn->execute($sql);
 $album_url = $config['BASE_URL'] . '/album/' . $album_id . '/' . prepare_string($name);
 $album_link = '<a href="' . $album_url . '">' . $album_url . '</a>';
 $search = array('{$site_title}', '{$site_name}', '{$username}', '{$album_link}', '{$baseurl}');
 $replace = array($config['site_title'], $config['site_name'], $_SESSION['username'], $album_link, $config['BASE_URL']);
 $mail = new VMail();
 if ($config['approve'] == '0') {
     $mail->sendPredefined($_SESSION['email'], 'photo_approve', $search, $replace);
 } else {
     $mail->sendPredefined($_SESSION['email'], 'photo_upload', $search, $replace);
 }
 $album['name'] = '';
 $album['category'] = 0;
 $album['tags'] = '';
 $album['anonymous'] = 'no';
 $album['type'] = 'public';
 if ($config['approve_photos'] == '1') {
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:photo.php

示例5: add_user

/**
 * add a user
 * @param $login user's login
 * @param $pass user's pass
 * @param $firstname user's firstname
 * @param $name user's name
 * @param $homedir user home directory
 */
function add_user($login, $pass, $firstname, $name, $homedir, $createhomedir, $ownHomeDir, $primaryGroup = "")
{
    $param = array($login, prepare_string($pass), $firstname, $name, $homedir, $createhomedir, $ownHomeDir, $primaryGroup);
    $ret = xmlCall("base.createUser", $param);
    if ($ret == 5) {
        $msg = sprintf(_("User %s created but password is not valid regarding your password policies.<br/><strong>You must change the user password.</strong>"), $login) . "<br />";
        return array("code" => $ret, "info" => $msg);
    } else {
        if ($ret == 10) {
            $msg = _("You cannot add more users.") . "<br />";
            new NotifyWidgetFailure($msg);
            header('Location: ' . urlStrRedirect("base/users/index"));
            exit;
        } else {
            $msg = sprintf(_("User %s successfully created"), $login) . "<br />";
            return array("code" => $ret, "info" => $msg);
        }
    }
}
开发者ID:sebastiendu,项目名称:mmc,代码行数:27,代码来源:users-xmlrpc.inc.php

示例6: time

            $code .= '</div>';
            $code .= '<div class="clear"></div>';
            $code .= '</div>';
            $code .= '</div>';
            $data['code'] = $code;
            $data['cid'] = $cid;
            $data['bid'] = $bid;
            $_SESSION['b_comment_added'] = time();
            $sql = "SELECT b.UID, b.title, s.email, u.blog_comment  \n                       FROM blog AS b, users_prefs AS u, signup AS s \n                       WHERE b.BID = " . $bid . " \n                       AND b.UID = u.UID \n                       AND b.UID = s.UID \n                       LIMIT 1";
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() === 1) {
                $prefs_b_comment = $rs->fields['blog_comment'];
                if ($prefs_b_comment == '1') {
                    $email = $rs->fields['email'];
                    $title = $rs->fields['title'];
                    require $config['BASE_DIR'] . '/classes/file.class.php';
                    require $config['BASE_DIR'] . '/classes/email.class.php';
                    $blog_link = '<a href="' . $config['BASE_URL'] . '/blog/' . $bid . '/' . prepare_string($title) . '">' . $config['BASE_URL'] . '/blog/' . $bid . '/' . prepare_string($title) . '</a>';
                    $search = array('{$username}', '{$site_title}', '{$site_name}', '{$baseurl}', '{$blog_link}');
                    $replace = array($_SESSION['username'], $config['site_title'], $config['site_name'], $config['BASE_URL'], $blog_link);
                    $mail = new VMail();
                    $mail->sendPredefined($email, 'blog_comment', $search, $replace);
                }
            }
        }
    } else {
        $data['msg'] = $lang['ajax.comment_login'];
    }
}
echo json_encode($data);
die;
开发者ID:ecr007,项目名称:pr0n,代码行数:31,代码来源:blog_comment.php

示例7: extract_sentences

/**
 * extract_sentences
 * 
 * takes a string, cleans it, then returns a substring, 
 * ensuring that only complete sentences are returned and
 * the string is at least $min_words long
 *
 * @param 	string	$string		the original string
 * @param 	int		$min_words	the minimum words to be included in the returned string
 * @return	string	$extract	the resulting extract
 */
function extract_sentences($string, $min_words = 50)
{
    $string = prepare_string($string);
    // prepare string
    $words = explode(' ', $string);
    // split string into words
    // recompile into a string with min number of words
    $init_string = implode(" ", array_slice($words, 0, $min_words - 1));
    $init_size = strlen($init_string);
    // count initial string length (in characters)
    $stop = strcspn($string, ".!?", $init_size);
    // get the next chunk of text, stopping at sentence terminator
    $stop = $init_size + $stop + 1;
    // this calculates the final length of the string
    $extract = substr($string, 0, $stop);
    // finally we get the substring
    return $extract;
}
开发者ID:justincawthorne,项目名称:mt-test,代码行数:29,代码来源:controller_functions.php

示例8: foreach

    if (!empty($details['summary'])) {
        echo '
		<itunes:subtitle text="' . $details['summary'] . '"/>';
    }
    // itunes summary
    if (!empty($details['description'])) {
        echo '
		<itunes:summary text="' . $details['description'] . '"/>';
    }
    echo '
		<itunes:explicit>no</itunes:explicit>';
}
// loop through content
foreach ($feed_content as $item) {
    $item_title = $item['title'];
    $item_description = empty($item['summary']) ? create_summary($item['body']) : prepare_string($item['summary']);
    $item_body = '';
    // show complete article?
    if (!empty($config['admin']['complete_feed'])) {
        $body_text = "<p><strong>" . $item_description . "</strong></p>";
        $body_text .= strip_inline_styles($item['body']);
        $item_body = "<content:encoded><![CDATA[" . $body_text . "]]></content:encoded>";
    }
    $item_date = date('r', strtotime($item['date_uploaded']));
    // start output to browser
    echo '
		<item>
			<title>' . $item_title . '</title>
			<description>' . $item_description . '</description>
			' . $item_body . '
			<link>' . $item['link'] . '</link>';
开发者ID:justincawthorne,项目名称:mt-test,代码行数:31,代码来源:rss-xml.php

示例9: mysql_real_escape_string

                $sql_add[] = "'" . mysql_real_escape_string($user) . "'";
            }
            $sql = "SELECT email FROM signup WHERE username in (" . implode(',', $sql_add) . ")";
            $rs = $conn->execute($sql);
            $users_emails = $rs->getrows();
            foreach ($users_emails as $user) {
                $emails[] = $user['email'];
            }
        }
        if (!$emails) {
            $data['msg'] = show_err_mb($lang['ajax.share_recipient_valid']);
        } else {
            $sql = "SELECT title FROM game WHERE GID = " . $game_id . " LIMIT 1";
            $rs = $conn->execute($sql);
            if ($conn->Affected_Rows() == 1) {
                $title = $rs->fields['title'];
                $url = '<a href="' . $config['BASE_URL'] . '/game/' . $game_id . '/' . prepare_string($title) . '">' . $config['BASE_URL'] . '/game/' . $game_id . '/' . prepare_string($title) . '</a>';
                $search = array('{$site_name}', '{$site_title}', '{$sender_name}', '{$message}', '{$baseurl}', '{$game_link}');
                $replace = array($config['site_name'], $config['site_title'], $from, $message, $config['BASE_URL'], $url);
                $mail = new VMail();
                $mail->sendPredefined($emails, 'share_game', $search, $replace);
                $data['status'] = 1;
                $data['msg'] = show_msg_mb($lang['ajax.share_success']);
            } else {
                $data['msg'] = show_err_mb($lang['ajax.share_game_failed']);
            }
        }
    }
}
echo json_encode($data);
die;
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:share_game.php

示例10: wikipedia_track_search

function wikipedia_track_search($track, $trackartist)
{
    debuglog("Searching Wikipedia for " . $track . " (song) by " . $trackartist, "WIKIPEDIA TRACK");
    $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($track . " (song)") . '&srprop=score&format=xml');
    $albuminfo = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
    // Comments assume the following:
    // track is 'A Track'
    // artist is 'An Artist'
    $page = null;
    // Look for 'A Track (An Artist song)'
    foreach ($albuminfo->query->search->p as $id) {
        $searchstring = prepare_string($track) . '\\s+\\(' . prepare_string($trackartist) . ' song\\)';
        // debuglog("1. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
        if (preg_match('/^\\s*' . $searchstring . '/i', $id['title'])) {
            debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
            $page = $id['title'];
            break;
        }
    }
    // Look for 'A Track (song)'
    if ($page == null) {
        foreach ($albuminfo->query->search->p as $id) {
            $searchstring = prepare_string($track) . '\\s+\\(song\\)';
            // debuglog("2. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
            if (preg_match('/^\\s*' . $searchstring . '/i', $id['title'])) {
                debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
                $page = $id['title'];
                break;
            }
        }
    }
    // Look for 'A Track'
    if ($page == null) {
        foreach ($albuminfo->query->search->p as $id) {
            $searchstring = prepare_string($track);
            // debuglog("3. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
            if (preg_match('/^\\s*' . $searchstring . '\\s*$/i', $id['title'])) {
                debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
                $page = $id['title'];
                break;
            }
        }
    }
    if ($page == null) {
        debuglog("Searching Wikipedia for " . $track, "WIKIPEDIA TRACK");
        $xml = wikipedia_request('http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . rawurlencode($track) . '&srprop=score&format=xml');
        $album2info = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        foreach ($album2info->query->search->p as $id) {
            $searchstring = prepare_string($track);
            // debuglog("3. Checking page ".$id['title']." against ".$searchstring, "WIKIDEBUG");
            if (preg_match('/^\\s*' . $searchstring . '\\s*$/i', $id['title'])) {
                debuglog("Found Page : " . $id['title'], "WIKIPEDIA");
                $page = $id['title'];
                break;
            }
        }
    }
    if ($page == null) {
        return null;
    }
    debuglog("Track search found page " . $page, "WIKIPEDIA TRACK");
    return get_wikipedia_page(preg_replace('/ /', '_', $page), "en.wikipedia.org", true);
}
开发者ID:cyrilix,项目名称:rompr,代码行数:63,代码来源:info_wikipedia.php

示例11: foreach

<xml>
    <videos>
    <?php 
foreach ($videos as $video) {
    ?>
        <video>
            <title><?php 
    echo $video['title'];
    ?>
</title>
            <duration><?php 
    echo duration($video['duration']);
    ?>
</duration>
            <url><?php 
    echo $config['BASE_URL'] . '/video/' . $video['VID'] . '/' . prepare_string($video['title']);
    ?>
</url>
			<image><?php 
    echo get_thumb_url($video['VID']) . '/1.jpg';
    ?>
</image>
            <desc><?php 
    echo htmlspecialchars($video['description'], ENT_QUOTES, 'UTF-8');
    ?>
</desc>
            <stars><?php 
    echo $video['rate'];
    ?>
</stars>
        </video>
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:related.php

示例12: VImageConv

 $game_tmb_path = $config['BASE_DIR'] . '/media/games/tmb/orig/' . $game_tmb_file;
 if (!move_uploaded_file($_FILES['game_thumb_file']['tmp_name'], $game_tmb_path)) {
     $errors[] = $lang['upload.game_thumb_failed'];
 }
 if (!$errors) {
     require $config['BASE_DIR'] . '/classes/image.class.php';
     $src = $game_tmb_path;
     $dst = $config['BASE_DIR'] . '/media/games/tmb/' . $game_tmb_file;
     $image = new VImageConv();
     $image->process($src, $dst, 'MAX_WIDTH', 256, 144);
     $image->canvas(256, 144, '000000', true);
     $sql = "UPDATE game_categories SET total_games = total_games+1 WHERE category_id = " . $category . " LIMIT 1";
     $conn->execute($sql);
     $sql = "UPDATE signup SET total_games = total_games+1, points = points+5 WHERE UID = " . $uid . " LIMIT 1";
     $conn->execute($sql);
     $game_url = $config['BASE_URL'] . '/game/' . $game_id . '/' . prepare_string($title);
     $game_link = '<a href="' . $game_url . '">' . $game_url . '</a>';
     $search = array('{$site_title}', '{$site_name}', '{$username}', '{$game_link}', '{$baseurl}');
     $replace = array($config['site_title'], $config['site_name'], $_SESSION['username'], $game_link, $config['BASE_URL']);
     $mail = new VMail();
     if ($config['approve_games'] == '0') {
         $mail->sendPredefined($_SESSION['email'], 'game_approve', $search, $replace);
     } else {
         $mail->sendPredefined($_SESSION['email'], 'game_upload', $search, $replace);
     }
     $game['title'] = '';
     $game['category'] = '';
     $game['keywords'] = '';
     $game['privacy'] = 'public';
     $game['anonymous'] = 'no';
     if ($config['approve_games'] == '1') {
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:game.php

示例13: strpos

 $duration = $vidinfo['ID_LENGTH'];
 $height = $vidinfo['ID_VIDEO_HEIGHT'];
 $width = $vidinfo['ID_VIDEO_WIDTH'];
 $fps = $vidinfo['ID_VIDEO_FPS'];
 $id_video_format = $vidinfo['ID_VIDEO_FORMAT'];
 $cgi = strpos(php_sapi_name(), 'cgi') ? 'env -i ' : NULL;
 // Proc
 $cmd = $cgi . $config['phppath'] . " " . $config['BASE_DIR'] . "/scripts/convert_videos.php" . " " . $vdoname . " " . $video_id . " " . $vdo_path . "";
 log_conversion($config['LOG_DIR'] . '/' . $video_id . '.log', $cmd);
 $lg = $config['LOG_DIR'] . '/' . $video_id . '.log2';
 run_in_background($cmd . ' > ' . $lg);
 $duration = get_video_duration($vdo_path, $video_id);
 $vkey = substr(md5($video_id), 11, 20);
 $sql = "UPDATE video SET duration = '" . mysql_real_escape_string($duration) . "', vkey = '" . $vkey . "',\n                                            vdoname = '" . mysql_real_escape_string($vdoname) . "', flvdoname = '" . mysql_real_escape_string($flvdoname) . "'\n                           WHERE VID = " . intval($video_id) . " LIMIT 1";
 $conn->execute($sql);
 $video_url = $config['BASE_URL'] . '/video/' . $video_id . '/' . prepare_string($title);
 $video_link = '<a href="' . $video_url . '">' . $video_url . '</a>';
 $sql = "SELECT sv.SUID, s.username, s.email FROM video_subscribe AS sv, signup AS s\n                           WHERE sv.UID = " . $uid . " AND sv.UID = s.UID";
 $rs = $conn->execute($sql);
 if ($conn->Affected_Rows() > 0) {
     $subscribers = $rs->getrows();
     $mail = new VMail();
     $mail->setNoReply();
     $sql = "SELECT * FROM emailinfo WHERE email_id = 'subscribe_email' LIMIT 1";
     $rs = $conn->execute($sql);
     $email_path = $config['BASE_DIR'] . '/templates/' . $rs->fields['email_path'];
     $sender = $anonymous == 'yes' ? 'anonymous' : $_SESSION['username'];
     $mail->Subject = str_replace('$sender_name', $sender, $rs->fields['email_subject']);
     foreach ($subscribers as $subscriber) {
         $smarty->assign('video_link', $video_link);
         $smarty->assign('username', $subscriber['username']);
开发者ID:humor-zo,项目名称:chaofan,代码行数:31,代码来源:video.php

示例14: header

 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
if ($_SESSION["AUTH_METHOD"] == "login" || isset($_POST["bback"])) {
    header("Location: " . urlStrRedirect("base/users/index"));
    exit;
}
require "modules/base/includes/users.inc.php";
require "graph/header.inc.php";
require "localSidebar.php";
require "graph/navbar.inc.php";
$user = $_SESSION["login"];
$p = new PageGenerator(_("Reset your password"));
$p->setSideMenu($sidemenu);
$p->display();
if (isset($_POST["bchpasswd"]) && $_POST["newpass"] != "" && $_POST["newpass"] == $_POST["confpass"]) {
    callPluginFunction("changeUserPasswd", array(array($user, prepare_string($_POST["newpass"]), "", False)));
    if (!isXMLRPCError()) {
        $n = new NotifyWidgetSuccess(_("Your password has been changed."));
    }
    header("Location: " . urlStrRedirect("base/users/index"));
    exit;
} else {
    ?>
<form action="<?php 
    echo "main.php?module=base&submod=users&action=resetpasswd";
    ?>
" method="post">
<p><?php 
    echo _("You are going to change your password");
    ?>
</p>
开发者ID:sebastiendu,项目名称:mmc,代码行数:31,代码来源:resetpasswd.php

示例15: addSmbAttr

function addSmbAttr($uid, $passwd)
{
    return xmlCall("samba.addSmbAttr", array($uid, prepare_string($passwd)));
}
开发者ID:sebastiendu,项目名称:mmc,代码行数:4,代码来源:user-xmlrpc.inc.php


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