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


PHP COM_truncate函数代码示例

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


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

示例1: USER_save

/**
* Saves user to the database
*
* @param    int     $uid            user id
* @return   string                  HTML redirect or error message
*
*/
function USER_save($uid)
{
    global $_CONF, $_TABLES, $_USER, $LANG28, $_USER_VERBOSE;
    $retval = '';
    $userChanged = false;
    if ($_USER_VERBOSE) {
        COM_errorLog("**** entering USER_save()****", 1);
    }
    if ($_USER_VERBOSE) {
        COM_errorLog("group size at beginning = " . sizeof($groups), 1);
    }
    $uid = COM_applyFilter($_POST['uid'], true);
    if ($uid == 0) {
        $uid = '';
    }
    $regdate = COM_applyFilter($_POST['regdate'], true);
    $username = trim($_POST['new_username']);
    $fullname = COM_truncate(trim(USER_sanitizeName($_POST['fullname'])), 80);
    $userstatus = COM_applyFilter($_POST['userstatus'], true);
    $oldstatus = COM_applyFilter($_POST['oldstatus'], true);
    $passwd = isset($_POST['newp']) ? trim($_POST['newp']) : '';
    $passwd_conf = isset($_POST['newp_conf']) ? trim($_POST['newp_conf']) : '';
    $cooktime = COM_applyFilter($_POST['cooktime'], true);
    $email = trim($_POST['email']);
    $email_conf = trim($_POST['email_conf']);
    $groups = $_POST['groups'];
    $homepage = trim($_POST['homepage']);
    $location = strip_tags(trim($_POST['location']));
    $photo = isset($_POST['photo']) ? $_POST['photo'] : '';
    $delete_photo = isset($_POST['delete_photo']) && $_POST['delete_photo'] == 'on' ? 1 : 0;
    $sig = trim($_POST['sig']);
    $about = trim($_POST['about']);
    $pgpkey = trim($_POST['pgpkey']);
    $language = isset($_POST['language']) ? trim(COM_applyFilter($_POST['language'])) : '';
    $theme = isset($_POST['theme']) ? trim(COM_applyFilter($_POST['theme'])) : '';
    $maxstories = COM_applyFilter($_POST['maxstories'], true);
    $tzid = COM_applyFilter($_POST['tzid']);
    $dfid = COM_applyFilter($_POST['dfid'], true);
    $search_fmt = COM_applyFilter($_POST['search_result_format']);
    $commentmode = COM_applyFilter($_POST['commentmode']);
    $commentorder = isset($_POST['commentorder']) && $_POST['commentorder'] == 'DESC' ? 'DESC' : 'ASC';
    $commentlimit = COM_applyFilter($_POST['commentlimit'], true);
    $emailfromuser = isset($_POST['emailfromuser']) && $_POST['emailfromuser'] == 'on' ? 1 : 0;
    $emailfromadmin = isset($_POST['emailfromadmin']) && $_POST['emailfromadmin'] == 'on' ? 1 : 0;
    $noicons = isset($_POST['noicons']) && $_POST['noicons'] == 'on' ? 1 : 0;
    $noboxes = isset($_POST['noboxes']) && $_POST['noboxes'] == 'on' ? 1 : 0;
    $showonline = isset($_POST['showonline']) && $_POST['showonline'] == 'on' ? 1 : 0;
    $topic_order = isset($_POST['topic_order']) && $_POST['topic_order'] == 'ASC' ? 'ASC' : 'DESC';
    $maxstories = COM_applyFilter($_POST['maxstories'], true);
    $newuser = COM_applyFilter($_POST['newuser'], true);
    $remoteuser = isset($_POST['remoteuser']) && $_POST['remoteuser'] == 'on' ? 1 : 0;
    $remoteusername = isset($_POST['remoteusername']) ? strip_tags(trim($_POST['remoteusername'])) : '';
    $remoteservice = isset($_POST['remoteservice']) ? COM_applyFilter($_POST['remoteservice']) : '';
    $social_services = SOC_followMeProfile($uid);
    foreach ($social_services as $service) {
        $service_input = $service['service'] . '_username';
        $_POST[$service_input] = strip_tags($_POST[$service_input]);
    }
    if ($uid == 1) {
        return USER_list();
    }
    if ($uid == '' || $uid < 2 || $newuser == 1) {
        if (empty($passwd) && $remoteuser == 0) {
            return USER_edit($uid, 504);
        }
        if (empty($email)) {
            return USER_edit($uid, 505);
        }
    }
    if ($username == '') {
        return USER_edit($uid, 506);
    }
    if (!USER_validateUsername($username)) {
        return USER_edit($uid, 512);
    }
    if ($email == '') {
        return USER_edit($uid, 507);
    }
    if ($passwd != $passwd_conf && $remoteuser == 0) {
        // passwords don't match
        return USER_edit($uid, 67);
    }
    if ($email != $email_conf) {
        return USER_edit($uid, 508);
    }
    // remote user checks
    if ($remoteuser == 1) {
        if ($remoteusername == '') {
            return USER_edit($uid, 513);
        }
        if ($remoteservice == '') {
            return USER_edit($uid, 514);
        }
//.........这里部分代码省略.........
开发者ID:spacequad,项目名称:glfusion,代码行数:101,代码来源:user.php

示例2: COM_truncate

     $moved = "";
 }
 if ($CONF_FORUM['show_subject_length'] > 0 and strlen($record['subject']) > $CONF_FORUM['show_subject_length']) {
     $subject = COM_truncate($record['subject'], $CONF_FORUM['show_subject_length'], '...');
 } else {
     $subject = $record['subject'];
 }
 if ($record['uid'] > 1) {
     $firstposterName = COM_getDisplayName($record['uid']);
 } else {
     $firstposterName = $record['name'];
 }
 $topicinfo = "<b>{$LANG_GF01['STARTEDBY']} {$firstposterName}, {$firstdate}</b><br" . XHTML . ">";
 $lastpostinfo = stripBBCode($lastpostinfo);
 // Simple function to strip out bbcode so tooltips display better
 $lastpostinfo = strip_tags(COM_truncate($record['comment'], $CONF_FORUM['contentinfo_numchars'], '...'));
 $lastpostinfo = htmlspecialchars($lastpostinfo);
 // Escape things like " so it displays properly in tooltip
 $topicinfo .= str_replace(LB, "<br" . XHTML . ">", forum_mb_wordwrap($lastpostinfo, $CONF_FORUM['linkinfo_width'], LB));
 if (function_exists('COM_getTooltip')) {
     $topiclink = "viewtopic.php?showtopic={$record['id']}";
     $tooltip_subject = COM_getTooltip($subject, $topicinfo, $topiclink);
     //$subject = '';
     $topiclisting->set_var('tooltip_subject', $tooltip_subject);
 }
 $topiclisting->set_var('topicinfo', $topicinfo);
 $topiclisting->parse('folderimg', $folderimg);
 $topiclisting->set_var('topic_id', $record['id']);
 $topiclisting->set_var('subject', $subject);
 $topiclisting->set_var('fullsubject', $record['subject']);
 $topiclisting->set_var('gotomsg', $gotomsg);
开发者ID:ivywe,项目名称:forum,代码行数:31,代码来源:index.php

示例3: showtopic


//.........这里部分代码省略.........
        // try to determine if we have an old post...
        if (strstr($showtopic['comment'], '<pre class="forumCode">') !== false) {
            $oldPost = 1;
        }
        if (strstr($showtopic['comment'], "[code]<code>") !== false) {
            $oldPost = 1;
        }
        if (strstr($showtopic['comment'], "<pre>") !== false) {
            $oldPost = 1;
        }
        if (stristr($showtopic['comment'], '[code') == false || stristr($showtopic['comment'], '[code]<code>') == true) {
            if (strstr($showtopic['comment'], "<pre>") !== false) {
                $oldPost = 1;
            }
            $showtopic['comment'] = str_replace('<pre>', '[code]', $showtopic['comment']);
            $showtopic['comment'] = str_replace('</pre>', '[/code]', $showtopic['comment']);
        }
        $showtopic['comment'] = str_ireplace("[code]<code>", '[code]', $showtopic['comment']);
        $showtopic['comment'] = str_ireplace("</code>[/code]", '[/code]', $showtopic['comment']);
        $showtopic['comment'] = str_replace(array("<br />\r\n", "<br />\n\r", "<br />\r", "<br />\n", "<br>\r\n", "<br>\n\r", "<br>\r", "<br>\n"), '<br' . XHTML . '>', $showtopic['comment']);
        $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=\\s(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']);
        /* Reformat code blocks - version 2.3.3 and prior */
        $showtopic['comment'] = str_replace('<pre class="forumCode">', '[code]', $showtopic['comment']);
        $showtopic['comment'] = preg_replace("/\\[QUOTE\\sBY=(.+?)\\]/i", "[QUOTE] Quote by \$1:", $showtopic['comment']);
        if ($oldPost) {
            if (strstr($showtopic['comment'], "\\'") !== false) {
                $showtopic['comment'] = stripslashes($showtopic['comment']);
            }
        }
    }
    $showtopic['comment'] = gf_formatTextBlock($showtopic['comment'], $showtopic['postmode'], $mode);
    $showtopic['subject'] = gf_formatTextBlock($showtopic['subject'], 'text', $mode);
    if ($CONF_FORUM['show_subject_length'] > 0 and strlen($showtopic['subject']) > $CONF_FORUM['show_subject_length']) {
        $showtopic['subject'] = COM_truncate("{$showtopic['subject']}", $CONF_FORUM['show_subject_length'], '...');
    }
    //$intervalTime = $mytimer->stopTimer();
    //COM_errorLog("Show Topic Display Time2: $intervalTime");
    if ($mode != 'preview' && $uservalid && !COM_isAnonUser() && $_USER['uid'] == $showtopic['uid']) {
        /* Check if user can still edit this post - within allowed edit timeframe */
        $editAllowed = false;
        if ($CONF_FORUM['allowed_editwindow'] > 0) {
            $t1 = $showtopic['date'];
            $t2 = $CONF_FORUM['allowed_editwindow'];
            if (time() - $t2 < $t1) {
                $editAllowed = true;
            }
        } else {
            $editAllowed = true;
        }
        if ($editAllowed) {
            $editlink = "{$_CONF['site_url']}/forum/createtopic.php?method=edit&amp;forum={$showtopic['forum']}&amp;id={$showtopic['id']}&amp;editid={$showtopic['id']}&amp;page={$page}";
            $editlinktext = $LANG_GF09['edit'];
            $topictemplate->set_var('editlink', $editlink);
            $topictemplate->set_var('editlinktext', $editlinktext);
            $topictemplate->set_var('LANG_edit', $LANG_GF01['EDITICON']);
            $topictemplate->parse('edittopic_link', 'edittopic_link');
        }
    }
    if ($highlight != '') {
        $showtopic['subject'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['subject']);
        $showtopic['comment'] = str_replace("{$highlight}", "<span class=\"highlight\">{$highlight}</span>", $showtopic['comment']);
    }
    if (!isset($showtopic['pid'])) {
        $showtopic['pid'] = 0;
    }
    if ($showtopic['pid'] == 0) {
开发者ID:ivywe,项目名称:forum,代码行数:67,代码来源:gf_showtopic.php

示例4: iTrunc

 /**
  * Truncates a string to a certain length at the most sensible point.
  * First, if there's a '.' character near the end of the string, the string is truncated after this character.
  * If there is no '.', the string is truncated after the last ' ' character.
  * If the string is truncated, " ..." is appended.
  * If the string is already shorter than $length, it is returned unchanged.
  *
  * @static
  * @param string    string A string to be truncated.
  * @param int        length the maximum length the string should be truncated to
  * @return string    the truncated string
  */
 function iTrunc($string, $length)
 {
     if (strlen($string) <= $length) {
         return $string;
     }
     $pos = strrpos($string, ".");
     if ($pos >= $length - 4) {
         $string = COM_truncate($string, $length - 4);
         $pos = strrpos($string, ".");
     }
     if ($pos >= $length * 0.4) {
         return COM_truncate($string, $pos + 1) . " ...";
     }
     $pos = strrpos($string, " ");
     if ($pos >= $length - 4) {
         $string = COM_truncate($string, $length - 4);
         $pos = strrpos($string, " ");
     }
     if ($pos >= $length * 0.4) {
         return COM_truncate($string, $pos) . " ...";
     }
     return COM_truncate($string, $length - 4) . " ...";
 }
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:35,代码来源:feedcreator.class.php

示例5: FF_showtopic


//.........这里部分代码省略.........
                $location = $userarray['location'];
                $cacheUserArray[$showtopic['uid']] = $userarray;
                $foundUser = 1;
            }
        }
    } else {
        if (!isset($_CONF['default_photo']) || $_CONF['default_photo'] == '') {
            $img = $_CONF['site_url'] . '/images/userphotos/default.jpg';
        } else {
            $img = $_CONF['default_photo'];
        }
        $avatar = '<img src="' . $img . '" alt="" title="" class="forum-userphoto" style="width:' . $_FF_CONF['avatar_width'] . 'px;"/>';
        $min_height = $min_height + 150;
    }
    if ($foundUser) {
        $userlink = '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&amp;uid=' . $showtopic['uid'] . '" ';
        $userlink .= 'class="authorname ' . $onetwo . '" rel="nofollow"><strong>' . $username . '</strong></a>';
        $uservalid = true;
        if ($userarray['sig'] != '' || $userarray['signature'] != '') {
            $sig = '';
            $sig .= FF_getSignature($userarray['sig'], $userarray['signature'], 'html');
            $min_height = $min_height + 30;
        }
    } else {
        $uservalid = false;
        $userlink = $LANG_GF01['ANON'] . $showtopic['name'];
    }
    if ($_FF_CONF['show_moods'] && $showtopic['mood'] != "") {
        $moodimage = '<img style="vertical-align:middle;" src="' . _ff_getImage($showtopic['mood'], 'moods') . '" title="' . $showtopic['mood'] . '" alt=""/><br/>';
        $min_height = $min_height + 30;
    }
    $showtopic['comment'] = FF_formatTextBlock($showtopic['comment'], $showtopic['postmode'], $mode, $showtopic['status']);
    $showtopic['subject'] = @htmlspecialchars(strip_tags($showtopic['subject']), ENT_QUOTES, COM_getEncodingt());
    $showtopic['subject'] = COM_truncate($showtopic['subject'], $_FF_CONF['show_subject_length'], '...');
    if ($mode != 'preview' && $uservalid && !COM_isAnonUser() && (isset($_USER['uid']) && $_USER['uid'] == $showtopic['uid'])) {
        /* Check if user can still edit this post - within allowed edit timeframe */
        $editAllowed = false;
        if ($_FF_CONF['allowed_editwindow'] > 0) {
            $t1 = $showtopic['date'];
            $t2 = $_FF_CONF['allowed_editwindow'];
            if (time() - $t2 < $t1) {
                $editAllowed = true;
            }
        } else {
            $editAllowed = true;
        }
        if ($editAllowed) {
            $editlink = $_CONF['site_url'] . '/forum/createtopic.php?mode=edittopic&amp;forum=' . $showtopic['forum'] . '&amp;id=' . $showtopic['id'] . '&amp;editid=' . $showtopic['id'] . '&amp;page=' . $page;
            $editlinkimg = '<img src="' . _ff_getImage('edit_button') . '" style="vertical-align:middle;" alt="' . $LANG_GF01['EDITICON'] . '" title="' . $LANG_GF01['EDITICON'] . '"/>';
            $topictemplate->set_var(array('editlink' => $editlink, 'editlinkimg' => $editlinkimg, 'LANG_edit' => $LANG_GF01['EDITICON']));
        }
    } else {
        $topictemplate->set_var(array('editlink' => '', 'editlinkimg' => '', 'LANG_edit' => ''));
    }
    if ($highlight != '') {
        $showtopic['subject'] = str_replace("{$highlight}", "<span class=\"b\">{$highlight}</span>", $showtopic['subject']);
        $showtopic['comment'] = str_replace("{$highlight}", "<span class=\"b\">{$highlight}</span>", $showtopic['comment']);
    }
    if ($showtopic['pid'] == 0) {
        $replytopicid = $showtopic['id'];
        $is_lockedtopic = $showtopic['locked'];
        $views = $showtopic['views'];
        $topictemplate->set_var('read_msg', sprintf($LANG_GF02['msg49'], $views));
        if ($is_lockedtopic) {
            $topictemplate->set_var('locked_icon', '<img src="' . _ff_getImage('padlock') . '" title="' . $LANG_GF02['msg114'] . '" alt=""/>');
        }
开发者ID:spacequad,项目名称:glfusion,代码行数:67,代码来源:topic.inc.php

示例6: ADMIN_getListField_moderation

/**
 * used for the lists of submissions and draft stories in admin/moderation.php
 *
 * @param  string $fieldName
 * @param  string $fieldValue
 * @param  array  $A
 * @param  array  $icon_arr
 * @return string
 */
function ADMIN_getListField_moderation($fieldName, $fieldValue, $A, $icon_arr)
{
    global $_CONF, $_TABLES, $LANG_ADMIN;
    $type = '';
    if (isset($A['_moderation_type'])) {
        $type = $A['_moderation_type'];
    }
    switch ($fieldName) {
        case 'edit':
            $retval = COM_createLink($icon_arr['edit'], $A['edit']);
            break;
        case 'delete':
            $retval = "<input type=\"radio\" name=\"action[{$A['row']}]\" value=\"delete\"" . XHTML . ">";
            break;
        case 'approve':
            $retval = "<input type=\"radio\" name=\"action[{$A['row']}]\" value=\"approve\"" . XHTML . ">" . "<input type=\"hidden\" name=\"id[{$A['row']}]\" value=\"{$A[0]}\"" . XHTML . ">";
            break;
        case 'day':
            $retval = strftime($_CONF['daytime'], $A['day']);
            break;
        case 'tid':
            $retval = DB_getItem($_TABLES['topics'], 'topic', "tid = '{$A['tid']}'");
            break;
        case 'uid':
            $name = '';
            if ($A['uid'] == 1) {
                $name = htmlspecialchars(COM_stripslashes(DB_getItem($_TABLES['commentsubmissions'], 'name', "cid = '{$A['id']}'")));
            }
            if (empty($name)) {
                $name = COM_getDisplayName($A['uid']);
            }
            if ($A['uid'] == 1) {
                $retval = $name;
            } else {
                $retval = COM_createLink($name, $_CONF['site_url'] . '/users.php?mode=profile&amp;uid=' . $A['uid']);
            }
            break;
        case 'publishfuture':
            if (!SEC_inGroup('Comment Submitters', $A['uid']) && $A['uid'] > 1) {
                $retval = "<input type=\"checkbox\" name=\"publishfuture[]\" value=\"{$A['uid']}\"" . XHTML . ">";
            } else {
                $retval = $LANG_ADMIN['na'];
            }
            break;
        default:
            if ($fieldName == 4 && ($type === 'story' || $type === 'story_draft')) {
                $retval = TOPIC_getTopicAdminColumn('article', $A[0]);
            } elseif ($fieldName == 2 && $type === 'comment') {
                $commentText = COM_getTextContent($A['comment']);
                $excerpt = htmlspecialchars(COM_truncate($commentText, 140, '...'));
                // try to provide a link to the parent item (e.g. article, poll)
                $info = PLG_getItemInfo($A['type'], $A['sid'], 'title,url');
                if (empty($info) || empty($info[0]) || empty($info[1])) {
                    // if not available, display excerpt from the comment
                    $retval = htmlspecialchars(COM_truncate($commentText, 40, '...'));
                    if (strlen($commentText) > 40) {
                        $retval = '<span title="' . $excerpt . '">' . $retval . '</span>';
                    }
                } else {
                    $retval = COM_createLink($info[0], $info[1], array('title' => $excerpt));
                }
            } else {
                $retval = COM_makeClickableLinks(stripslashes($fieldValue));
            }
            break;
    }
    return $retval;
}
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:77,代码来源:lib-admin.php

示例7: plugin_getrelateditems_story

/**
 * Return list of articles for the Related Items block
 *
 * @param    array $tids list of topic ids
 * @param    int   $max  maximum number of items to return
 * @param    int   $trim max length of text
 * @return   array   array of links to related articles with unix timestamp as key
 */
function plugin_getrelateditems_story($tids, $max, $trim)
{
    global $_CONF, $_TABLES;
    $where_sql = '';
    $archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
    if (!empty($archivetid)) {
        $where_sql = " AND (ta.tid <> '{$archivetid}')";
    }
    // Find the newest stories the user has access too
    $sql = "SELECT sid, title, UNIX_TIMESTAMP(date) s_date\n        FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta\n        WHERE ta.type = 'article' AND ta.id = sid AND (ta.tid IN ('" . implode("','", $tids) . "'))\n        AND (date <= NOW()) AND (draft_flag = 0)" . $where_sql . COM_getPermSQL('AND') . COM_getLangSQL('sid', 'AND') . "\n        GROUP BY sid ORDER BY s_date DESC LIMIT {$max}";
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    $newstories = array();
    if ($nrows > 0) {
        for ($x = 0; $x < $nrows; $x++) {
            $A = DB_fetchArray($result);
            $url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']);
            $title = COM_undoSpecialChars(stripslashes($A['title']));
            if ($trim > 0) {
                $titletouse = COM_truncate($title, $trim, '...');
            } else {
                $titletouse = $title;
            }
            if ($title != $titletouse) {
                $attr = array('title' => htmlspecialchars($title));
            } else {
                $attr = array();
            }
            $astory = str_replace('$', '&#36;', $titletouse);
            $astory = str_replace(' ', '&nbsp;', $astory);
            $newstories[$A['s_date']] = COM_createLink($astory, $url, $attr);
        }
    }
    return $newstories;
}
开发者ID:mystralkk,项目名称:geeklog,代码行数:43,代码来源:lib-story.php

示例8: DB_query

     $subject = '';
     $is_forum = $LANG_GF02['msg138'];
     $topic_link = '<a href="' . $_CONF['site_url'] . '/forum/index.php?forum=' . $forum_id . '" title="' . $subject . '">' . $subject . '</a>';
 } else {
     if ($topic_id < 0) {
         $neg_subscription = true;
         $topic_id = -$topic_id;
     } else {
         $neg_subscription = false;
     }
     $result = DB_query("SELECT subject,name,replies,views,uid,id FROM {$_TABLES['forum_topic']} WHERE id = '{$topic_id}'");
     $A = DB_fetchArray($result);
     if ($A['subject'] == '') {
         $subject = $LANG_GF01['MISSINGSUBJECT'];
     } elseif (strlen($A['subject']) > 50) {
         $subject = htmlspecialchars(COM_truncate($A['subject'], 50, '...'), ENT_QUOTES, $CONF_FORUM['charset']);
     } else {
         $subject = htmlspecialchars($A['subject'], ENT_QUOTES, $CONF_FORUM['charset']);
     }
     $topic_link = '<a href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $topic_id . '" title="';
     $topic_link .= $subject . '">' . $subject . '</a>';
 }
 $report->set_var('id', $notify_recid);
 $report->set_var('csscode', $i % 2 + 1);
 $report->set_var('forum', $forum_name);
 $report->set_var('linksubject', htmlspecialchars($subject, ENT_QUOTES, $CONF_FORUM['charset']));
 $report->set_var('is_forum', $is_forum);
 $report->set_var('topic_link', $topic_link);
 $report->set_var('topicauthor', $A['name']);
 $report->set_var('date_added', $date_added);
 $report->set_var('uid', $A['uid']);
开发者ID:ivywe,项目名称:forum,代码行数:31,代码来源:notify.php

示例9: getPath_ul

 function getPath_ul($hot = 0, $sortOrder = 0, $page = 0)
 {
     global $MG_albums, $_MG_CONF;
     $path = '<li>' . ($hot ? '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&amp;sort=' . $sortOrder . '&amp;page=' . $page . '">' : '') . ($_MG_CONF['truncate_breadcrumb'] > 0 ? COM_truncate(strip_tags($this->title), $_MG_CONF['truncate_breadcrumb'], '...') : strip_tags($this->title)) . '</li>';
     $tree = $MG_albums[$this->parent];
     while ($tree->id != 0) {
         $path = '<li><a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $tree->id . '&amp;sort=' . $sortOrder . '">' . ($_MG_CONF['truncate_breadcrumb'] > 0 ? COM_truncate(strip_tags($tree->title), $_MG_CONF['truncate_breadcrumb'], '...') : strip_tags($tree->title)) . '</a></li>' . $path;
         $tree = $MG_albums[$tree->parent];
     }
     return $path;
 }
开发者ID:spacequad,项目名称:glfusion,代码行数:11,代码来源:classAlbum.php

示例10: COM_makeClickableLinksCallback

/**
* Callback function to help format links in COM_makeClickableLinks
*
* @param    string  $http   set to 'http://' when not already in the url
* @param    string  $link   the url
* @return   string          link enclosed in <a>...</a> tags
*
*/
function COM_makeClickableLinksCallback($http, $link)
{
    global $_CONF;
    static $encoding = null;
    if ($encoding === null) {
        $encoding = COM_getEncodingt();
    }
    if (substr($link, -1) === '.') {
        $link = substr($link, 0, -1);
        $end = '.';
    } else {
        $end = '';
    }
    if (isset($_CONF['linktext_maxlen']) && $_CONF['linktext_maxlen'] > 0) {
        $text = COM_truncate($link, $_CONF['linktext_maxlen'], '...', 10);
    } else {
        $text = $link;
    }
    $text = htmlspecialchars($text, ENT_QUOTES, $encoding);
    return '<a href="' . $http . $link . '">' . $text . '</a>' . $end;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:29,代码来源:lib-common.php

示例11: PLG_checkforSpam

     // Check for SPAM
     $spamcheck = '<h1>' . $_POST['subject'] . '</h1><p>' . $_POST['comment'] . '</p>';
     $result = PLG_checkforSpam($spamcheck, $_CONF['spamx']);
     // Now check the result and redirect to index.php if spam action was taken
     if ($result > 0) {
         // then tell them to get lost ...
         $display .= COM_showMessage($result, 'spamx');
         $display = gf_createHTMLDocument($display);
         COM_output($display);
         exit;
     }
 }
 $postmode = gf_chkpostmode($postmode, $mode_switch);
 $subject = gf_preparefordb(strip_tags($_POST['subject']), 'text');
 if (strlen($subject) > 100) {
     $subject = COM_truncate($subject, 99, '...');
 }
 $comment = gf_preparefordb($_POST['comment'], $postmode);
 $locked = 0;
 $sticky = 0;
 if ($_POST['modedit'] == 1) {
     if ($_POST['locked_switch'] == 1) {
         $locked = 1;
     }
     if ($_POST['sticky_switch'] == 1) {
         $sticky = 1;
     }
 }
 $fields = "forum,name,date,lastupdated,subject,comment,postmode,ip,mood,uid,pid,sticky,locked";
 $sql = "INSERT INTO {$_TABLES['forum_topic']} ({$fields}) ";
 $sql .= "VALUES ('{$forum}','{$name}','{$date}',{$date},'{$subject}','{$comment}', ";
开发者ID:milk54,项目名称:geeklog-japan,代码行数:31,代码来源:createtopic.php

示例12: BLOCK_getListField

/**
 * return a field value for the block administration list
 *
 */
function BLOCK_getListField($fieldname, $fieldvalue, $A, $icon_arr, $token)
{
    global $_CONF, $LANG_ADMIN, $LANG21, $_IMAGE_TYPE;
    $retval = false;
    $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
    $enabled = $A['is_enabled'] == 1 ? true : false;
    if ($access > 0 && BLOCK_hasTopicAccess($A['tid']) > 0) {
        switch ($fieldname) {
            case 'edit':
                $retval = '';
                if ($access == 3) {
                    $attr['title'] = $LANG_ADMIN['edit'];
                    $retval .= COM_createLink($icon_arr['edit'], $_CONF['site_admin_url'] . '/block.php?edit=x&amp;bid=' . $A['bid'], $attr);
                }
                break;
            case 'blockorder':
                $order = $A['blockorder'];
                $retval = $enabled ? $order : '<span class="disabledfield">' . $order . '</span>';
                break;
            case 'move':
                if ($access == 3) {
                    if ($A['onleft'] == 1) {
                        $side = $LANG21[40];
                        $blockcontrol_image = 'block-right.' . $_IMAGE_TYPE;
                        $moveTitleMsg = $LANG21[59];
                        $switchside = '1';
                    } else {
                        $blockcontrol_image = 'block-left.' . $_IMAGE_TYPE;
                        $moveTitleMsg = $LANG21[60];
                        $switchside = '0';
                    }
                    $retval .= "<img src=\"{$_CONF['layout_url']}/images/admin/{$blockcontrol_image}\" width=\"45\" height=\"20\" usemap=\"#arrow{$A['bid']}\" alt=\"\">" . "<map id=\"arrow{$A['bid']}\" name=\"arrow{$A['bid']}\">" . "<area coords=\"0,0,12,20\"  title=\"{$LANG21[58]}\" href=\"{$_CONF['site_admin_url']}/block.php?move=1&amp;bid={$A['bid']}&amp;where=up&amp;" . CSRF_TOKEN . "={$token}\" alt=\"{$LANG21[58]}\">" . "<area coords=\"13,0,29,20\" title=\"{$moveTitleMsg}\" href=\"{$_CONF['site_admin_url']}/block.php?move=1&amp;bid={$A['bid']}&amp;where={$switchside}&amp;" . CSRF_TOKEN . "={$token}\" alt=\"{$moveTitleMsg}\">" . "<area coords=\"30,0,43,20\" title=\"{$LANG21[57]}\" href=\"{$_CONF['site_admin_url']}/block.php?move=1&amp;bid={$A['bid']}&amp;where=dn&amp;" . CSRF_TOKEN . "={$token}\" alt=\"{$LANG21[57]}\">" . "</map>";
                }
                break;
            case 'name':
                $name = COM_truncate($A['name'], 20, ' ...', true);
                $retval = $enabled ? $name : '<span class="disabledfield">' . $name . '</span>';
                break;
            case 'title':
                $title = COM_truncate(strip_tags($A['title']), 20, ' ...', true);
                $retval = $enabled ? $title : '<span class="disabledfield">' . $title . '</span>';
                break;
            case 'tid':
                $topic = COM_truncate($A['tid'], 20, ' ...', true);
                $retval = $enabled ? $topic : '<span class="disabledfield">' . $topic . '</span>';
                break;
            case 'delete':
                $retval = '';
                if ($access == 3 && $A['type'] != 'gldefault') {
                    $attr['title'] = $LANG_ADMIN['delete'];
                    $attr['onclick'] = "return confirm('" . $LANG21[69] . "');";
                    $retval .= COM_createLink($icon_arr['delete'], $_CONF['site_admin_url'] . '/block.php' . '?delete=x&amp;bid=' . $A['bid'] . '&amp;' . CSRF_TOKEN . '=' . $token, $attr);
                }
                break;
            case 'is_enabled':
                if ($access == 3) {
                    if ($enabled) {
                        $switch = ' checked="checked"';
                        $title = 'title="' . $LANG_ADMIN['disable'] . '" ';
                    } else {
                        $title = 'title="' . $LANG_ADMIN['enable'] . '" ';
                        $switch = '';
                    }
                    $retval = '<input class="blk-clicker" type="checkbox" id="enabledblocks[' . $A['bid'] . ']" name="enabledblocks[' . $A['bid'] . ']" ' . $title . 'onclick="submit()" value="' . $A['bid'] . '"' . $switch . '>';
                    $retval .= '<input type="hidden" name="bidarray[' . $A['bid'] . ']" value="' . $A['onleft'] . '" >';
                }
                break;
            default:
                $retval = $enabled ? $fieldvalue : '<span class="disabledfield">' . $fieldvalue . '</span>';
                break;
        }
    }
    return $retval;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:78,代码来源:block.php

示例13: EVLIST_monthview

/**
*   Display a monthly calendar.
*   Dates that have events scheduled are highlighted.
*
*   @param  integer $year   Year to display, default is current year
*   @param  integer $month  Starting month
*   @param  integer $day    Starting day
*   @param  integer $cat    Event category
*   @plaram integer $cal    Calendar ID
*   @return string          HTML for calendar page
*/
function EVLIST_monthview($year = 0, $month = 0, $day = 0, $cat = 0, $cal = 0, $opt = '')
{
    global $_CONF, $_EV_CONF, $LANG_MONTH;
    EVLIST_setViewSession('month', $year, $month, $day);
    $retval = '';
    list($currentyear, $currentmonth, $currentday) = explode('-', $_EV_CONF['_today']);
    // Default to the current month
    if ($year == 0) {
        $year = $currentyear;
    }
    if ($month == 0) {
        $month = $currentmonth;
    }
    if ($day == 0) {
        $day = $currentday;
    }
    $cat = (int) $cat;
    $cal = (int) $cal;
    // Set the calendar header.
    $cal_header = EVLIST_calHeader($year, $month, $day, 'month', $cat, $cal);
    // Get all the dates in the month
    $calendarView = Date_Calc::getCalendarMonth($month, $year, '%Y-%m-%d');
    $x = count($calendarView) - 1;
    $y = count($calendarView[$x]) - 1;
    $starting_date = $calendarView[0][0];
    $ending_date = $calendarView[$x][$y];
    $daynames = EVLIST_getDayNames();
    $events = EVLIST_getEvents($starting_date, $ending_date, array('cat' => $cat, 'cal' => $cal));
    $nextmonth = $month + 1;
    $nextyear = $year;
    if ($nextmonth > 12) {
        $nextmonth = 1;
        $nextyear = $year + 1;
    }
    $prevmonth = $month - 1;
    $prevyear = $year;
    if ($prevmonth < 1) {
        $prevmonth = 12;
        $prevyear = $year - 1;
    }
    $tplpath = EVLIST_PI_PATH . '/templates/monthview';
    $tpl = 'monthview';
    if ($opt == 'print') {
        $tpl .= '_print';
    } elseif ($_EV_CONF['cal_tmpl'] == 'json') {
        $tpl .= '_json';
    }
    $T = new Template($tplpath);
    $T->set_file(array('monthview' => $tpl . '.thtml', 'allday_event' => 'event_allday.thtml', 'timed_event' => 'event_timed.thtml'));
    foreach ($daynames as $key => $dayname) {
        $T->set_var('dayname' . $key, $dayname);
    }
    list($y, $m, $d) = explode('-', $starting_date);
    $weekOfYear = Date_Calc::weekOfYear($d, $m, $y);
    $calendars_used = array();
    $i = 0;
    $T->set_block('monthview', 'weekBlock', 'wBlock');
    foreach ($calendarView as $weeknum => $weekdata) {
        list($weekYear, $weekMonth, $weekDay) = explode('-', $weekdata[0]);
        $T->set_var(array('wyear' => $weekYear, 'wmonth' => $weekMonth, 'wday' => $weekDay, 'urlfilt_cat' => $cat, 'urlfilt_cal' => $cal, 'weeknum' => $weekOfYear, $tplx => 'true'));
        $weekOfYear++;
        foreach ($weekdata as $daynum => $daydata) {
            list($y, $m, $d) = explode('-', $daydata);
            if ($daydata == $_EV_CONF['_today']) {
                $dayclass = 'today';
            } elseif ($m == $month) {
                $dayclass = 'on';
            } else {
                $dayclass = 'other-month';
            }
            $T->set_var('cal_day_anchortags', COM_createLink(sprintf("%02d", $d), EVLIST_URL . '/index.php?view=day&amp;' . "cat={$cat}&amp;cal={$cal}" . "&amp;day={$d}&amp;month={$m}&amp;year={$y}", array('class' => 'cal-date')));
            if (!isset($events[$daydata])) {
                // Just to avoid foreach() errors
                $events[$daydata] = array();
            }
            $dayentries = '';
            $T->clear_var('cal_day_entries');
            $T->set_block('monthview', 'dayBlock', 'dBlock');
            foreach ($events[$daydata] as $event) {
                if (empty($event['title'])) {
                    continue;
                }
                $ev_hover = '';
                $ev_title = COM_truncate($event['title'], 40, '...');
                // Sanitize fields for display.  No HTML in the popup.
                $title = htmlentities(strip_tags($event['title']));
                $summary = htmlentities(strip_tags($event['summary']));
                // add the calendar to the array to create the JS checkboxes
                $calendars_used[$event['cal_id']] = array('cal_name' => $event['cal_name'], 'cal_ena_ical' => $event['cal_ena_ical'], 'cal_id' => $event['cal_id'], 'fgcolor' => $event['fgcolor'], 'bgcolor' => $event['bgcolor']);
//.........这里部分代码省略.........
开发者ID:NewRoute,项目名称:evlist,代码行数:101,代码来源:evlist_views.inc.php

示例14: buildAlbumBox

 function buildAlbumBox(&$album_selectbox, $selected, $access = 1, $hide = 0, $type = 'upload', $level = 0)
 {
     global $_USER, $_MG_CONF;
     $_MG_USERPREFS = MG_getUserPrefs();
     $mgadmin = SEC_hasRights('mediagallery.admin');
     $count = 0;
     $indent = '';
     $z = 0;
     while ($z < $level) {
         $indent .= "&nbsp;&nbsp;&nbsp;&nbsp;";
         $z++;
     }
     if ($type == 'upload') {
         if ($_MG_CONF['member_albums'] && $this->isMemberAlbum() && $this->owner_id == $_USER['uid'] && $_MG_USERPREFS['active'] || $this->member_uploads && $this->access >= 2 || $this->access >= $access || $mgadmin) {
             if ($this->id != $hide) {
                 if (!$this->hidden || $this->hidden && $mgadmin) {
                     if ($this->id != 0) {
                         $album_selectbox .= '<option value="' . $this->id . '"' . ($this->id == $selected ? ' selected="selected" ' : '') . '>' . $indent;
                         $tatitle = strip_tags($this->title);
                         if (strlen($tatitle) > 50) {
                             $aTitle = COM_truncate($tatitle, 50) . '...';
                         } else {
                             $aTitle = $tatitle;
                         }
                         $album_selectbox .= $aTitle . '</option>';
                         $count++;
                     }
                 }
             }
         }
     }
     if ($type == 'edit') {
         if ($this->id == $selected || $_MG_CONF['member_albums'] && $_MG_CONF['member_album_root'] == $this->id && $_MG_CONF['member_create_new'] && $_MG_USERPREFS['active'] || $this->access >= $access) {
             if ($this->id != $hide) {
                 if (!$this->hidden || $mgadmin) {
                     $album_selectbox .= '<option value="' . $this->id . '"' . ($this->id == $selected ? ' selected="selected" ' : '') . '>' . $indent;
                     $tatitle = strip_tags($this->title);
                     if (strlen($tatitle) > 50) {
                         $aTitle = COM_truncate($tatitle, 50) . '...';
                     } else {
                         $aTitle = $tatitle;
                     }
                     //$aTitle = $tatitle; //  . '(' . $this->access . ')';
                     $album_selectbox .= $aTitle . '</option>';
                     $count++;
                 }
             }
         }
     }
     if ($type == 'create') {
         if ($_MG_CONF['member_albums'] && $_MG_CONF['member_album_root'] == $this->id && $_MG_CONF['member_create_new'] && $_MG_USERPREFS['active'] || $this->access >= $access) {
             if ($this->id != $hide) {
                 if (!$this->hidden || $this->hidden && $mgadmin) {
                     if ($this->id != 0 || ($mgadmin || $_MG_CONF['member_albums'] == 1 && $_MG_CONF['member_album_root'] == 0 && $_MG_CONF['member_create_new'])) {
                         $album_selectbox .= '<option value="' . $this->id . '"' . ($this->id == $selected ? ' selected="selected" ' : '') . '>' . $indent;
                         $tatitle = strip_tags($this->title);
                         if (strlen($tatitle) > 50) {
                             $aTitle = COM_truncate($tatitle, 50) . '...';
                         } else {
                             $aTitle = $tatitle;
                         }
                         $album_selectbox .= $aTitle . '</option>';
                         $count++;
                     }
                 }
             }
         }
     }
     if ($type == 'manage') {
         if ($this->access >= $access) {
             if (!$this->hidden || $this->hidden && $mgadmin) {
                 if ($this->id != 0 || ($mgadmin || $_MG_CONF['member_albums'] == 1 && $_MG_CONF['member_album_root'] == 0 && $_MG_CONF['member_create_new'])) {
                     $album_selectbox .= '<option ' . ($this->id == $hide ? 'disabled="disabled" ' : '') . ' value="' . $this->id . '"' . ($this->id == $selected && $this->id != $hide ? ' selected="selected" ' : '') . '>' . $indent;
                     $tatitle = strip_tags($this->title);
                     if (strlen($tatitle) > 50) {
                         $aTitle = COM_truncate($tatitle, 50) . '...';
                     } else {
                         $aTitle = $tatitle;
                     }
                     $album_selectbox .= $aTitle . '</option>';
                     $count++;
                 }
             }
         }
     }
     if ($this->id != $hide || $this->id == $hide && $type == 'manage') {
         $children = $this->getChildren();
         foreach ($children as $child) {
             $child_album = new mgAlbum($child);
             $count += $child_album->buildAlbumBox($album_selectbox, $selected, $access, $hide, $type, $level + 1);
         }
     }
     return $count;
 }
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:94,代码来源:classAlbum.php

示例15: phpblock_storypicker

function phpblock_storypicker()
{
    global $_TABLES, $_CONF, $topic;
    $LANG_STORYPICKER = array('choose' => 'Choose a story');
    $max_stories = 5;
    //how many stories to display in the list
    $topicsql = '';
    $sid = '';
    if (isset($_GET['story'])) {
        $sid = COM_applyFilter($_GET['story']);
        $stopic = DB_getItem($_TABLES['stories'], 'tid', 'sid = \'' . DB_escapeString($sid) . '\'');
        if (!empty($stopic)) {
            $topic = $stopic;
        } else {
            $sid = '';
        }
    }
    if (empty($topic)) {
        if (isset($_GET['topic'])) {
            $topic = COM_applyFilter($_GET['topic']);
        } elseif (isset($_POST['topic'])) {
            $topic = COM_applyFilter($_POST['topic']);
        } else {
            $topic = '';
        }
    }
    if (!empty($topic)) {
        $topicsql = " AND tid = '" . DB_escapeString($topic) . "'";
    }
    if (empty($topicsql)) {
        $topic = DB_getItem($_TABLES['topics'], 'tid', 'archive_flag = 1');
        if (empty($topic)) {
            $topicsql = '';
        } else {
            $topicsql = " AND tid <> '" . DB_escapeString($topic) . "'";
        }
    }
    $sql = 'SELECT sid, title FROM ' . $_TABLES['stories'] . ' WHERE draft_flag = 0 AND date <= now()' . COM_getPermSQL(' AND') . COM_getTopicSQL(' AND') . $topicsql . ' ORDER BY date DESC LIMIT ' . $max_stories;
    $res = DB_query($sql);
    $list = '';
    while ($A = DB_fetchArray($res)) {
        $url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']);
        $list .= '<li><a href=' . $url . '>' . htmlspecialchars(COM_truncate($A['title'], 41, '...')) . "</a></li>\n";
    }
    return $list;
}
开发者ID:NewRoute,项目名称:glfusion,代码行数:46,代码来源:lib-glfusion.php


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