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


PHP serendipity_checkPermission函数代码示例

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


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

示例1: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $title);
     $login_url = $this->get_config('login_url');
     $logout_url = $this->get_config('logout_url');
     if ($login_url == "") {
         $login_url = serendipity_currentURL();
     }
     if ($logout_url == "") {
         $logout_url = serendipity_currentURL();
     }
     if (isset($serendipity['POST']['action']) && !isset($serendipity['POST']['logout']) && !serendipity_userLoggedIn()) {
         echo '<div class="serendipity_center serendipity_msg_important">' . WRONG_USERNAME_OR_PASSWORD . '</div>';
     } elseif (serendipity_userLoggedIn()) {
         echo '<div class="serendipity_center">' . WELCOME_BACK . ' ' . $_SESSION['serendipityUser'] . '</div>';
         echo '<form id="loginform" action="' . $logout_url . '" method="post">';
         echo '<input type="hidden" name="serendipity[logout]" value="true" />';
         echo '<input type="submit" name="serendipity[action]" value="' . LOGOUT . ' &gt;" />';
         $show_entry = false;
         $show_media = false;
         if (function_exists('serendipity_checkPermission')) {
             if (serendipity_checkPermission('adminEntries')) {
                 $show_entry = true;
             }
             if (serendipity_checkPermission('adminImages') && serendipity_checkPermission('adminImagesAdd')) {
                 $show_media = true;
             }
         } elseif (!$serendipity['no_create']) {
             $show_entry = true;
             $show_media = true;
         }
         if ($show_entry) {
             echo '<div class="loginform_link_entry"><a href="' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=entries&amp;serendipity[adminAction]=new">' . NEW_ENTRY . '</a></div>';
         }
         if ($show_media) {
             echo '<div class="loginform_link_media"><a href="' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=media&amp;serendipity[adminAction]=addSelect">' . ADD_MEDIA . '</a></div>';
         }
         echo '</form>';
         return true;
     }
     // Logout is performed in bundled event plugin!
     echo '<form id="loginform" action="' . $login_url . '" method="post">';
     echo '<fieldset id="loginform_userdata" style="border: none;">';
     echo '<label for="username">' . USERNAME . '</label>';
     echo '<input id="username" type="text" name="serendipity[user]" value="" />';
     echo '<label for="s9ypassw">' . PASSWORD . '</label>';
     echo '<input id="s9ypassw" type="password" name="serendipity[pass]" value="" />';
     echo '</fieldset>';
     echo '<fieldset id="loginform_login" style="border: none;">';
     echo '<input id="autologin" type="checkbox" name="serendipity[auto]" /><label for="autologin"> ' . AUTOMATIC_LOGIN . '</label>';
     echo '<input type="submit" id="loginform_submit" name="serendipity[action]" value="' . LOGIN . ' &gt;" />';
     echo '</fieldset>';
     echo '</form>';
     if (class_exists('serendipity_event_forgotpassword')) {
         echo '<div class="forgot_password"><a href="' . $serendipity['baseURL'] . '/serendipity_admin.php?forgotpassword=1">' . PLUGIN_EVENT_FORGOTPASSWORD_LOST_PASSWORD . '</a></div>';
     }
     return true;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:59,代码来源:serendipity_plugin_loginform.php

示例2: check

 function check()
 {
     global $serendipity;
     if (function_exists('serendipity_checkPermission')) {
         return serendipity_checkPermission('adminCategories');
     } elseif ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:11,代码来源:serendipity_event_assigncategories.php

示例3: serendipity_approveComment

/**
* Approve a comment
*
* LONG
*
* @access public
* @param  int         The ID of the comment to approve
* @param  int         The ID of the entry a comment belongs to
* @param  boolean     Whether to force approving a comment despite of its current status
* @param  boolean     If set to true, a comment will be moderated instead of approved.
+ * @param  string     The 32 character token [if using token based moderation]
* @return boolean     Success or failure
*/
function serendipity_approveComment($cid, $entry_id, $force = false, $moderate = false, $token = false)
{
    global $serendipity;
    $goodtoken = serendipity_checkCommentToken($token, $cid);
    /* Get data about the comment, we need this query because this function can be called from anywhere */
    /* This also makes sure we are either the author of the comment, or a USERLEVEL_ADMIN */
    $sql = "SELECT c.*, e.title, a.email as authoremail, a.mail_comments, e.timestamp AS entry_timestamp, e.last_modified AS entry_last_modified\n                FROM {$serendipity['dbPrefix']}comments c\n                LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)\n                LEFT JOIN {$serendipity['dbPrefix']}authors a ON (e.authorid = a.authorid)\n                WHERE c.id = '" . (int) $cid . "'\n                    " . (!serendipity_checkPermission('adminEntriesMaintainOthers') && $force !== true && !$goodtoken ? "AND e.authorid = '" . (int) $serendipity['authorid'] . "'" : '') . "\n                    " . ($force === true ? "" : "AND status = 'pending'");
    $rs = serendipity_db_query($sql, true);
    if ($moderate) {
        $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = " . (int) $cid;
    } else {
        $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = " . (int) $cid;
    }
    serendipity_db_query($sql);
    $field = $rs['type'] == 'NORMAL' ? 'comments' : 'trackbacks';
    // Check when the entry was published. If it is older than max_last_modified allows, the last_modified date of that entry
    // will not be pushed. With this we make sure that an RSS feed will not be updated on a client's reader and marked as new
    // only because someone made an comment to an old entry.
    if ($rs['entry_timestamp'] > time() - $serendipity['max_last_modified']) {
        $lm = time();
    } else {
        $lm = (int) $rs['entry_last_modified'];
    }
    $counter_comments = serendipity_db_query("SELECT count(id) AS counter \n                                                FROM {$serendipity['dbPrefix']}comments \n                                               WHERE status = 'approved' \n                                                 AND type   = 'NORMAL'\n                                                 AND entry_id = " . (int) $entry_id . "\n                                            GROUP BY entry_id", true);
    $counter_tb = serendipity_db_query("SELECT count(id) AS counter \n                                          FROM {$serendipity['dbPrefix']}comments \n                                         WHERE status = 'approved' \n                                           AND (type = 'TRACKBACK' or type = 'PINGBACK')\n                                           AND entry_id = " . (int) $entry_id . "\n                                      GROUP BY entry_id", true);
    $query = "UPDATE {$serendipity['dbPrefix']}entries \n                 SET comments      = " . (int) $counter_comments['counter'] . ",\n                     trackbacks    = " . (int) $counter_tb['counter'] . ", \n                     last_modified = " . $lm . " \n               WHERE id = " . (int) $entry_id;
    serendipity_db_query($query);
    /* It's already approved, don't spam people */
    if ($rs === false) {
        return false;
    }
    if (!$moderate) {
        if ($serendipity['allowSubscriptions'] === 'fulltext') {
            serendipity_mailSubscribers($entry_id, $rs['author'], $rs['email'], $rs['title'], $rs['authoremail'], $cid, $rs['body']);
        } elseif (serendipity_db_bool($serendipity['allowSubscriptions'])) {
            serendipity_mailSubscribers($entry_id, $rs['author'], $rs['email'], $rs['title'], $rs['authoremail'], $cid);
        }
        serendipity_plugin_api::hook_event('backend_approvecomment', $rs);
    }
    return true;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:54,代码来源:functions_comments.inc.php

示例4: serendipity_checkDirUpload

/**
 * Checks whether a user has access to write into a directory
 *
 * @access public
 * @param   string Directory to check
 * @return  boolean
 */
function serendipity_checkDirUpload($dir)
{
    global $serendipity;
    /*
    if (serendipity_checkPermission('adminImagesMaintainOthers')) {
        return true;
    }
    */
    $allowed = serendipity_ACLGet(0, 'directory', 'write', $dir);
    $mygroups = serendipity_checkPermission(null, null, true);
    // Usergroup "0" always means that access is granted. If no array exists, no ACL restrictions have been set and all is fine.
    if (!is_array($allowed) || isset($allowed[0])) {
        return true;
    }
    if (!is_array($mygroups)) {
        return true;
    }
    foreach ($mygroups as $grpid => $grp) {
        if (isset($allowed[$grpid])) {
            return true;
            break;
        }
    }
    return false;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:32,代码来源:functions_images.inc.php

示例5: serendipity_parseTemplate

if ($serendipity['GET']['adminAction'] == 'save' && serendipity_checkFormToken()) {
    $config = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE);
    if ((!serendipity_checkPermission('adminUsersEditUserlevel') || !serendipity_checkPermission('adminUsersMaintainOthers')) && (int) $_POST['userlevel'] > $serendipity['serendipityUserlevel']) {
        echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . CREATE_NOT_AUTHORIZED_USERLEVEL . '</div>';
    } elseif (empty($_POST['username'])) {
        echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . USERCONF_CHECK_USERNAME_ERROR . '</div>';
    } elseif (!empty($_POST['password']) && $_POST['check_password'] != $_SESSION['serendipityPassword'] && serendipity_passwordhash($_POST['check_password']) != $_SESSION['serendipityPassword']) {
        echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . USERCONF_CHECK_PASSWORD_ERROR . '</div>';
    } else {
        $valid_groups = serendipity_getGroups($serendipity['authorid'], true);
        foreach ($config as $category) {
            foreach ($category['items'] as $item) {
                if (in_array('groups', $item['flags'])) {
                    if (serendipity_checkPermission('adminUsersMaintainOthers')) {
                        // Void, no fixing neccessarry
                    } elseif (serendipity_checkPermission('adminUsersMaintainSame')) {
                        if (!is_array($_POST[$item['var']])) {
                            continue;
                        }
                        // Check that no user may assign groups he's not allowed to.
                        foreach ($_POST[$item['var']] as $groupkey => $groupval) {
                            if (in_array($groupval, $valid_groups)) {
                                continue;
                            } elseif ($groupval == 2 && in_array(3, $valid_groups)) {
                                // Admin is allowed to assign users to chief editors
                                continue;
                            } elseif ($groupval == 1 && in_array(2, $valid_groups)) {
                                // Chief is allowed to assign users to editors
                                continue;
                            }
                            unset($_POST[$item['var']][$groupkey]);
开发者ID:rustyx,项目名称:Serendipity,代码行数:31,代码来源:personal.inc.php

示例6: show_plugins

/**
 * Show the list of plugins
 *
 * Shows a HTML list of all installed plugins, complete with config/delete/sort order options
 *
 * @access public
 * @param  boolean  Indicates if event plugins (TRUE) or sidebar plugins (FALSE) shall be shown
 * @return null
 */
function show_plugins($event_only = false, $sidebars = null)
{
    global $serendipity;
    $sql_filter = '';
    if (is_array($sidebars)) {
        foreach ($sidebars as $sidebar) {
            $up = strtoupper($sidebar);
            if ($sidebar == 'hide') {
                $opts[$sidebar] = HIDDEN;
            } elseif (defined('SIDEBAR_' . $up)) {
                $opts[$sidebar] = constant('SIDEBAR_' . $up);
            } elseif (defined($up)) {
                $opts[$sidebar] = constant($up);
            } else {
                $opts[$sidebar] = $up;
            }
            $sql_filter .= "AND placement != '" . serendipity_db_escape_string($sidebar) . "' ";
        }
    }
    if (!$event_only) {
        $sql = "SELECT * from {$serendipity['dbPrefix']}plugins\n                   WHERE placement != 'event'\n                     AND placement != 'eventh'\n                         " . $sql_filter;
        $invisible_plugins = serendipity_db_query($sql);
        if (is_array($invisible_plugins)) {
            $sidebars[] = 'NONE';
            $opts['NONE'] = NONE;
        }
    }
    $opts['event'] = PLUGIN_ACTIVE;
    $opts['eventh'] = PLUGIN_INACTIVE;
    $data['event_only'] = $event_only;
    if (!$event_only) {
        $data['is_first'] = true;
    }
    $data['serendipity_setFormToken'] = serendipity_setFormToken();
    $data['serendipity_setFormTokenUrl'] = serendipity_setFormToken('url');
    /* Block display the plugins per placement location. */
    if ($event_only) {
        $plugin_placements = array('event', 'eventh');
    } else {
        $plugin_placements = $sidebars;
    }
    $data['plugin_placements'] = $plugin_placements;
    static $users = array();
    if (empty($users)) {
        $users = serendipity_fetchUsers('', 'hidden');
    }
    $data['users'] = $users;
    $i = 0;
    foreach ($plugin_placements as $plugin_placement) {
        if (!$event_only && $plugin_placement == 'NONE') {
            $is_invisible = true;
        } else {
            $is_invisible = false;
        }
        $data['placement'][$plugin_placement]['ptitle'] = $ptitle = $opts[$plugin_placement];
        $data['placement'][$plugin_placement]['pid'] = $pid = $plugin_placement;
        if ($is_invisible) {
            $plugins = $invisible_plugins;
        } else {
            $plugins = serendipity_plugin_api::enum_plugins($plugin_placement);
        }
        if (!is_array($plugins)) {
            continue;
        }
        $sort_idx = 0;
        foreach ($plugins as $plugin_data) {
            $i++;
            $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']);
            $key = urlencode($plugin_data['name']);
            $css_key = 's9ycid' . str_replace('%', '-', $key);
            $is_plugin_owner = $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers');
            $is_plugin_editable = $is_plugin_owner || $plugin_data['authorid'] == '0';
            $cname = explode(':', $plugin_data['name']);
            if (!is_object($plugin)) {
                $name = $title = ERROR . '!';
                $desc = ERROR . ': ' . $plugin_data['name'];
                $can_configure = false;
            } else {
                /* query for its name, description and configuration data */
                $bag = new serendipity_property_bag();
                $plugin->introspect($bag);
                $name = serendipity_specialchars($bag->get('name'));
                $desc = '<details class="plugin_data">';
                $desc .= '<summary><var class="perm_name">' . $cname[0] . '</var></summary>';
                $desc .= '<div class="plugin_desc clearfix">' . serendipity_specialchars($bag->get('description')) . '</div>';
                $desc .= '<span class="block_level">' . VERSION . ': ' . $bag->get('version') . '</span>';
                $desc .= '</details>';
                $title = serendipity_plugin_api::get_plugin_title($plugin, '[' . $name . ']');
                if ($bag->is_set('configuration') && ($plugin->protected === FALSE || $plugin_data['authorid'] == '0' || $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) {
                    $can_configure = true;
                } else {
//.........这里部分代码省略.........
开发者ID:amirchrist,项目名称:Serendipity,代码行数:101,代码来源:functions_plugins_admin.inc.php

示例7: serendipity_hasPluginPermissions

/**
 * Check if a member of a group has permissions to execute a plugin
 *
 * @param string    Pluginname
 * @param int       ID of the group of which the members should be checked
 * @return boolean
 */
function serendipity_hasPluginPermissions($plugin, $groupid = null)
{
    static $forbidden = null;
    global $serendipity;
    if (empty($serendipity['authorid'])) {
        return true;
    }
    if ($forbidden === null || $groupid !== null && !isset($forbidden[$groupid])) {
        $forbidden = array();
        if ($groupid === null) {
            $groups = serendipity_checkPermission(null, null, 'all');
        } else {
            $groups = array($groupid => serendipity_fetchGroup($groupid));
        }
        foreach ($groups as $idx => $group) {
            if ($idx == 'membership') {
                continue;
            }
            foreach ($group as $key => $val) {
                if (substr($key, 0, 2) == 'f_') {
                    $forbidden[$groupid][$key] = true;
                }
            }
        }
    }
    if (isset($forbidden[$groupid]['f_' . $plugin])) {
        return false;
    } else {
        return true;
    }
}
开发者ID:beealone,项目名称:Serendipity,代码行数:38,代码来源:functions_config.inc.php

示例8: event_hook


//.........这里部分代码省略.........
                            if (is_array($eventData)) {
                                $eventData['clean_page'] = true;
                            } else {
                                $eventData = array('clean_page' => true);
                            }
                            $this->showPasswordForm = true;
                        }
                    }
                    if ($addData['preview'] && is_array($serendipity['POST']['properties']) && count($serendipity['POST']['properties']) > 0) {
                        $parr = array();
                        $supported_properties = serendipity_event_entryproperties::getSupportedProperties();
                        foreach ($supported_properties as $prop_key) {
                            if (isset($serendipity['POST']['properties'][$prop_key])) {
                                $eventData[0]['properties']['ep_' . $prop_key] = $serendipity['POST']['properties'][$prop_key];
                            }
                        }
                    }
                    break;
                case 'entries_header':
                    if ($this->showPasswordForm) {
                        echo $this->showPasswordform();
                    }
                    break;
                case 'frontend_fetchentries':
                case 'frontend_fetchentry':
                    $joins = array();
                    $conds = array();
                    if (!$ext_joins) {
                        return true;
                    }
                    if ($_SESSION['serendipityAuthedUser'] === true) {
                        $conds[] = " (ep_access.property IS NULL OR ep_access.value = 'member' OR ep_access.value = 'public' OR (ep_access.value = 'private' AND e.authorid = " . (int) $serendipity['authorid'] . ")) ";
                        if ($use_groups) {
                            $mygroups = serendipity_checkPermission(null, null, true);
                            $groupcond = array();
                            foreach ((array) $mygroups as $mygroup) {
                                $groupcond[] .= "ep_access_groups.value LIKE '%;{$mygroup};%'";
                            }
                            if (count($groupcond) > 0) {
                                $conds[] = " (ep_access_groups.property IS NULL OR (ep_access.value = 'member' AND (" . implode(' OR ', $groupcond) . ")))";
                            }
                        }
                        if ($use_users) {
                            $conds[] = " (ep_access_users.property IS NULL OR (ep_access.value = 'member' AND (ep_access_users.value LIKE '%;" . (int) $serendipity['authorid'] . ";%' OR e.authorid = " . (int) $serendipity['authorid'] . "))) ";
                        }
                    } else {
                        $conds[] = " (ep_access.property IS NULL OR ep_access.value = 'public')";
                    }
                    if (!isset($serendipity['GET']['viewAuthor']) && !isset($serendipity['plugin_vars']['tag']) && !isset($serendipity['GET']['category']) && !isset($serendipity['GET']['adminModule']) && $event == 'frontend_fetchentries' && $addData['source'] != 'search') {
                        $conds[] = " (ep_no_frontpage.property IS NULL OR ep_no_frontpage.value != 'true') ";
                        $joins[] = " LEFT OUTER JOIN {$serendipity['dbPrefix']}entryproperties ep_no_frontpage\n                                                  ON (e.id = ep_no_frontpage.entryid AND ep_no_frontpage.property = 'ep_no_frontpage')";
                    }
                    if (count($conds) > 0) {
                        $cond = implode(' AND ', $conds);
                        if (empty($eventData['and'])) {
                            $eventData['and'] = " WHERE {$cond} ";
                        } else {
                            $eventData['and'] .= " AND {$cond} ";
                        }
                    }
                    $conds = array();
                    if ((!isset($addData['noSticky']) || $addData['noSticky'] !== true) && !isset($serendipity['skipSticky'])) {
                        $conds[] = 'ep_sticky.value AS orderkey,';
                    } else {
                        $conds[] = 'e.isdraft AS orderkey,';
                    }
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:67,代码来源:serendipity_event_entryproperties.php

示例9:

</a></li>
<?php 
                }
                if (serendipity_checkPermission('adminImport')) {
                    ?>
                        <li class="serendipitySideBarMenuLink serendipitySideBarMenuUserManagementLinks"><a href="serendipity_admin.php?serendipity[adminModule]=import"><?php 
                    echo IMPORT_ENTRIES;
                    ?>
</a></li>
                        <li class="serendipitySideBarMenuLink serendipitySideBarMenuUserManagementLinks"><a href="serendipity_admin.php?serendipity[adminModule]=export"><?php 
                    echo EXPORT_ENTRIES;
                    ?>
</a></li>
<?php 
                }
                if (serendipity_checkPermission('siteConfiguration') || serendipity_checkPermission('blogConfiguration')) {
                    ?>
                        <li class="serendipitySideBarMenuLink serendipitySideBarMenuUserManagementLinks"><a href="serendipity_admin.php?serendipity[adminModule]=integrity"><?php 
                    echo INTEGRITY;
                    ?>
</a></li>
<?php 
                }
                ?>
                        <?php 
                if ($serendipity['no_create'] !== true) {
                    serendipity_plugin_api::hook_event('backend_sidebar_admin', $serendipity);
                }
                ?>
                        <li class="serendipitySideBarMenuFoot serendipitySideBarMenuUserManagement" style="display:none"></li>
                    </ul>
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:serendipity_admin.php

示例10: showMediaLibrary

function showMediaLibrary($messages = false, $addvar_check = false)
{
    global $serendipity;
    if (!serendipity_checkPermission('adminImagesView')) {
        return;
    }
    if (!empty($messages)) {
        echo '<div class="imageMessage"><ul>';
        foreach ($messages as $message) {
            echo '<li>' . $message . '</li>';
        }
        echo '</ul></div>';
    }
    // After upload, do not show the list to be able to proceed to
    // media selection.
    if ($addvar_check && !empty($GLOBALS['image_selector_addvars'])) {
        return true;
    }
    ?>
<script type="text/javascript" language="javascript">
    <!--
        function rename(id, fname) {
            if(newname = prompt('<?php 
    echo ENTER_NEW_NAME;
    ?>
' + fname, fname)) {
                location.href='?<?php 
    echo serendipity_setFormToken('url');
    ?>
&serendipity[adminModule]=images&serendipity[adminAction]=rename&serendipity[fid]='+ escape(id) + '&serendipity[newname]='+ escape(newname);
            }
        }
    //-->
</script>

<?php 
    if (!isset($serendipity['thumbPerPage'])) {
        $serendipity['thumbPerPage'] = 2;
    }
    serendipity_displayImageList(isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1, $serendipity['thumbPerPage'], true);
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:41,代码来源:images.inc.php

示例11: ceil

$totalComments = $sql['total'];
$pages = $commentsPerPage == COMMENTS_FILTER_ALL ? 1 : ceil($totalComments / (int) $commentsPerPage);
$page = (int) $serendipity['GET']['page'];
if ($page == 0 || $page > $pages) {
    $page = 1;
}
$linkPrevious = 'serendipity_admin.php?serendipity[adminModule]=comments&amp;serendipity[page]=' . ($page - 1) . $searchString;
$linkNext = 'serendipity_admin.php?serendipity[adminModule]=comments&amp;serendipity[page]=' . ($page + 1) . $searchString;
$filter_vals = array(10, 20, 50, COMMENTS_FILTER_ALL);
if ($commentsPerPage == COMMENTS_FILTER_ALL) {
    $limit = '';
} else {
    $limit = serendipity_db_limit_sql(serendipity_db_limit(($page - 1) * (int) $commentsPerPage, (int) $commentsPerPage));
}
$sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c\n                                LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)\n                                WHERE 1 = 1 " . ($c_type !== null ? " AND c.type = '{$c_type}' " : '') . $and . (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int) $serendipity['authorid'] : '') . "\n                                ORDER BY c.id DESC {$limit}");
if (serendipity_checkPermission('adminComments')) {
    ob_start();
    # This event has to get send here so the spamblock-plugin can block an author now and the comment_page show that on this pageload
    serendipity_plugin_api::hook_event('backend_comments_top', $sql);
    $data['backend_comments_top'] = ob_get_contents();
    ob_end_clean();
}
$data['commentsPerPage'] = $commentsPerPage;
$data['totalComments'] = $totalComments;
$data['pages'] = $pages;
$data['page'] = $page;
$data['linkPrevious'] = $linkPrevious;
$data['linkNext'] = $linkNext;
$data['searchString'] = $searchString;
$data['filter_vals'] = $filter_vals;
$data['sql'] = $sql;
开发者ID:amirchrist,项目名称:Serendipity,代码行数:31,代码来源:comments.inc.php

示例12: displayManageTags

    /**
     * event hook: backend_sidebar_entries_event_display_managetags
     *  uses global object array eventData
     */
    function displayManageTags()
    {
        global $serendipity;
        if ($this->get_config('dbversion', 1) != 2) {
            $this->install();
            $this->set_config('dbversion', 2);
        }
        $full_permission = serendipity_checkPermission('adminPlugins');
        // AFAIS, BY USERLEVEL permission checks are being deprecated
        if ($serendipity['version'][0] < 2) {
            ?>

            <div style="border: 1px solid #000;" class="freetagMenu">
            <ul>

<?php 
        } else {
            ?>

            <h2><?php 
            echo PLUGIN_EVENT_FREETAG_MANAGETAGS;
            ?>
</h2>

            <div class="freetagMenu">
                <ul class="plainList clearfix">

<?php 
        }
        ?>

                    <li><a class="button_link" href="<?php 
        echo FREETAG_MANAGE_URL;
        ?>
&amp;serendipity[tagview]=all" title="<?php 
        echo PLUGIN_EVENT_FREETAG_MANAGE_ALL;
        ?>
">ALL</a></li>
                    <li><a class="button_link" href="<?php 
        echo FREETAG_MANAGE_URL;
        ?>
&amp;serendipity[tagview]=leaf" title="<?php 
        echo PLUGIN_EVENT_FREETAG_MANAGE_LEAF;
        ?>
">LEAF</a></li>
<?php 
        if ($full_permission === true) {
            ?>
                    <li><a class="button_link" href="<?php 
            echo FREETAG_MANAGE_URL;
            ?>
&amp;serendipity[tagview]=entryuntagged" title="<?php 
            echo PLUGIN_EVENT_FREETAG_MANAGE_UNTAGGED;
            ?>
">NOTAG</a></li>
                    <li><a class="button_link" href="<?php 
            echo FREETAG_MANAGE_URL;
            ?>
&amp;serendipity[tagview]=entryleaf" title="<?php 
            echo PLUGIN_EVENT_FREETAG_MANAGE_LEAFTAGGED;
            ?>
">LEAFTAG</a></li>
                    <li><a class="button_link" href="<?php 
            echo FREETAG_MANAGE_URL;
            ?>
&amp;serendipity[tagview]=keywords" title="<?php 
            echo PLUGIN_EVENT_FREETAG_KEYWORDS;
            ?>
">KEYWORD</a></li>
                    <li><a class="button_link" href="<?php 
            echo FREETAG_MANAGE_URL;
            ?>
&amp;serendipity[tagview]=cat2tag" title="<?php 
            echo PLUGIN_EVENT_FREETAG_GLOBALLINKS;
            ?>
">CAT2TAG</a></li>
                    <li><a class="button_link" href="<?php 
            echo FREETAG_MANAGE_URL;
            ?>
&amp;serendipity[tagview]=tagupdate" onclick="return confirm('<?php 
            echo htmlspecialchars(PLUGIN_EVENT_FREETAG_REBUILD_DESC, ENT_COMPAT, LANG_CHARSET);
            ?>
');" title="<?php 
            echo PLUGIN_EVENT_FREETAG_REBUILD;
            ?>
">AUTOTAG</a></li>
                    <li><a class="button_link" href="<?php 
            echo FREETAG_MANAGE_URL;
            ?>
&amp;serendipity[tagview]=cleanupmappings" title="<?php 
            echo PLUGIN_EVENT_FREETAG_MANAGE_CLEANUP;
            ?>
">CLEAN</a></li>
<?php 
        }
        ?>
//.........这里部分代码省略.........
开发者ID:ophian,项目名称:serendipity_event_freetag,代码行数:101,代码来源:serendipity_event_freetag.php

示例13: serendipity_db_query

/* Paging */
$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE 1 = 1 " . ($c_type !== null ? " AND c.type = '{$c_type}' " : '') . $and, true);
$totalComments = $sql['total'];
$pages = $commentsPerPage == COMMENTS_FILTER_ALL ? 1 : ceil($totalComments / (int) $commentsPerPage);
$page = (int) $serendipity['GET']['page'];
if ($page == 0 || $page > $pages) {
    $page = 1;
}
$linkPrevious = 'serendipity_admin.php?serendipity[adminModule]=comments&amp;serendipity[page]=' . ($page - 1) . $searchString;
$linkNext = 'serendipity_admin.php?serendipity[adminModule]=comments&amp;serendipity[page]=' . ($page + 1) . $searchString;
if ($commentsPerPage == COMMENTS_FILTER_ALL) {
    $limit = '';
} else {
    $limit = serendipity_db_limit_sql(serendipity_db_limit(($page - 1) * (int) $commentsPerPage, (int) $commentsPerPage));
}
$sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c\n                                LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)\n                                WHERE 1 = 1 " . ($c_type !== null ? " AND c.type = '{$c_type}' " : '') . $and . (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int) $serendipity['authorid'] : '') . "\n                                ORDER BY c.id DESC {$limit}");
if (!empty($errormsg)) {
    echo '<p class="serendipityAdminMsgError serendipity_backend_msg_notice"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . $errormsg . '</p>';
}
// closing admin messages
?>
<script type="text/javascript">
function FT_toggle(id) {
    if ( document.getElementById(id + '_full').style.display == '' ) {
        document.getElementById(id + '_full').style.display='none';
        document.getElementById(id + '_summary').style.display='';
        document.getElementById(id + '_text').innerHTML = '<?php 
echo VIEW_FULL;
?>
';
    } else {
开发者ID:rustyx,项目名称:Serendipity,代码行数:31,代码来源:comments.inc.php

示例14: sprintf

         $data['messages'] = '<span class="msg_notice"><span class="icon-info-circled"></span> ' . MEDIA_RESIZE_EXISTS . '</span>';
     } else {
         $data['print_SCALING_IMAGE'] = sprintf(SCALING_IMAGE, $file['path'] . $file['name'] . '.' . $file['extension'], (int) $serendipity['GET']['width'], (int) $serendipity['GET']['height']);
         $data['extraParems'] = serendipity_generateImageSelectorParems();
         $scaleImg = serendipity_scaleImg($serendipity['GET']['fid'], $serendipity['GET']['width'], $serendipity['GET']['height']);
         if (!empty($scaleImg) && is_string($scaleImg)) {
             $data['scaleImgError'] = $scaleImg;
         }
         $data['is_done'] = true;
     }
     // fall back
     $data['showML'] = showMediaLibrary();
     break;
 case 'scaleSelect':
     $file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']);
     if (!is_array($file) || !serendipity_checkPermission('adminImagesDelete') || !serendipity_checkPermission('adminImagesMaintainOthers') && $file['authorid'] != '0' && $file['authorid'] != $serendipity['authorid']) {
         return;
     }
     $data['extraParems'] = serendipity_generateImageSelectorParems('form');
     $data['case_scaleSelect'] = true;
     $s = getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . ($file['extension'] ? '.' . $file['extension'] : ""));
     $data['img_width'] = $s[0];
     $data['img_height'] = $s[1];
     $data['print_RESIZE_BLAHBLAH'] = sprintf(RESIZE_BLAHBLAH, serendipity_specialchars($serendipity['GET']['fname']));
     $data['print_ORIGINAL_SIZE'] = sprintf(ORIGINAL_SIZE, $s[0], $s[1]);
     $data['formtoken'] = serendipity_setFormToken();
     $data['file'] = $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . ($file['extension'] ? '.' . $file['extension'] : "");
     break;
 case 'choose':
     $file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']);
     $media['file'] =& $file;
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:31,代码来源:images.inc.php

示例15: event_hook

 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'external_plugin':
                 //catch learnAction here because the GET-Params prevent
                 //the normal switch/case to find this
                 if (strpos($eventData, 'learnAction') !== false) {
                     if (!serendipity_checkPermission('adminComments')) {
                         return;
                     }
                     $this->learnAction($_REQUEST['id'], $_REQUEST['category'], $_REQUEST['action'], $_REQUEST['entry_id']);
                     echo DONE;
                     return true;
                     break;
                 }
                 switch ($eventData) {
                     case 'learncomment':
                         if (!serendipity_checkPermission('adminComments')) {
                             break;
                         }
                         $category = $_REQUEST['category'];
                         $ids = $_REQUEST['id'];
                         $ids = explode(';', $ids);
                         foreach ($ids as $id) {
                             $comment = $this->getComment($id);
                             if (is_array($comment)) {
                                 $comment = $comment['0'];
                                 $entry_id = $comment['entry_id'];
                             }
                             $this->startLearn($comment, $category);
                             //Ham shall be approved, Spam deleted
                             if ($category == 'ham') {
                                 serendipity_approveComment($id, $entry_id);
                             } elseif ($category == 'spam') {
                                 if ($this->get_config('method', 'moderate') == 'custom') {
                                     $spamBarrier = min(array($this->get_config('moderateBarrier', 70) / 100, $this->get_config('blockBarrier', 90) / 100));
                                 } else {
                                     $spamBarrier = 0.7;
                                 }
                                 //spam shall not get through the filter twice - so make sure, it really is marked as spam
                                 $loop = 0;
                                 while ($this->startClassify($comment) < $spamBarrier && $loop < 5) {
                                     $this->startLearn($comment, $category);
                                     //prevent infinite loop
                                     $loop++;
                                 }
                                 if ($this->get_config('recycler', true)) {
                                     $this->recycleComment($id, $entry_id);
                                 }
                                 serendipity_deleteComment($id, $entry_id);
                             }
                         }
                         break;
                     case 'spamblock_bayes.load.gif':
                         header('Content-Type: image/gif');
                         echo file_get_contents(dirname(__FILE__) . '/img/spamblock_bayes.load.gif');
                         break;
                     case 'spamblock_bayes.spam.png':
                         header('Content-Type: image/png');
                         echo file_get_contents(dirname(__FILE__) . '/img/spamblock_bayes.spam.png');
                         break;
                     case 'jquery.tablesorter.js':
                         header('Content-Type: text/javascript');
                         echo file_get_contents(dirname(__FILE__) . '/jquery.tablesorter.js');
                         break;
                     case 'jquery.heatcolor.js':
                         header('Content-Type: text/javascript');
                         echo file_get_contents(dirname(__FILE__) . '/jquery.heatcolor.js');
                         break;
                     case 'jquery.excerpt.js':
                         header('Content-Type: text/javascript');
                         echo file_get_contents(dirname(__FILE__) . '/jquery.excerpt.js');
                         break;
                     case 'serendipity_event_spamblock_bayes.js':
                         header('Content-Type: text/javascript');
                         echo file_get_contents(dirname(__FILE__) . '/serendipity_event_spamblock_bayes.js');
                         break;
                     case 'getRating':
                         $ids = $_REQUEST['id'];
                         $ids = explode(';', $ids);
                         //we get the comments in wrong order
                         $comments = array_reverse($this->getComment($ids));
                         $i = 0;
                         foreach ($comments as $comment) {
                             $ratings .= preg_replace('/\\..*/', '', $this->startClassify($comment) * 100) . '%;' . $ids[$i] . ';';
                             $i++;
                         }
                         echo $ratings;
                         break;
                     case 'bayesMenuLearn':
                         if (!serendipity_checkPermission('adminComments')) {
                             break;
                         }
                         //the POST-Data of the form is almost exactly like the result of the database-query
                         $comment = $_POST;
                         if (serendipity_db_bool($comment['ham'])) {
                             $category = 'ham';
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_spamblock_bayes.php


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