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


PHP SEC_getFeatureGroup函数代码示例

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


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

示例1: BLOCK_edit

/**
* Shows the block editor
*
* This will show a block edit form.  If this is a glFusion default block it will
* send it off to BLOCK_editDefault().
*
* @param    string  $bid    ID of block to edit
* @param    array   $B      An array of block fields (optional)
* @return   string          HTML for block editor
*
*/
function BLOCK_edit($bid = '', $B = array())
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG01, $LANG21, $LANG24, $LANG_ACCESS, $LANG_ADMIN, $LANG_postmodes, $MESSAGE, $_IMAGE_TYPE;
    USES_lib_admin();
    $retval = '';
    $A = array();
    if (!empty($bid)) {
        $result = DB_query("SELECT * FROM {$_TABLES['blocks']} WHERE bid ='" . DB_escapeString($bid) . "'");
        $A = DB_fetchArray($result);
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access == 2 || $access == 0 || BLOCK_hasTopicAccess($A['tid']) < 3) {
            $retval .= COM_showMessageText($LANG21[45], $LANG_ACCESS['accessdenied'], true);
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit block " . $bid);
            return $retval;
        }
        if ($A['type'] == 'gldefault') {
            $retval .= BLOCK_editDefault($A, $access);
            return $retval;
        }
    } else {
        $A['bid'] = isset($B['bid']) ? $B['bid'] : 0;
        $A['is_enabled'] = isset($B['is_enabled']) ? $B['is_enabled'] : 1;
        $A['name'] = isset($B['name']) ? $B['name'] : '';
        $A['type'] = isset($B['type']) ? $B['type'] : 'normal';
        $A['title'] = isset($B['title']) ? $B['title'] : '';
        $A['tid'] = isset($B['tid']) ? $B['tid'] : 'All';
        $A['blockorder'] = isset($B['blockorder']) ? $B['blockorder'] : 0;
        $A['content'] = isset($B['content']) ? $B['content'] : '';
        $A['allow_autotags'] = isset($B['allow_autotags']) && $B['allow_autotags'] == 1 ? 1 : 0;
        $A['rdfurl'] = isset($B['rdfurl']) ? $B['rdfurl'] : '';
        $A['rdfupdated'] = isset($B['rdfupdated']) ? $B['rdfupdated'] : '';
        $A['rdflimit'] = isset($B['rdflimit']) ? $B['rdflimit'] : 0;
        $A['onleft'] = isset($B['onleft']) ? $B['onleft'] : 0;
        $A['phpblockfn'] = isset($B['phpblockfn']) ? $B['phpblockfn'] : '';
        $A['help'] = isset($B['help']) ? $B['help'] : '';
        $A['owner_id'] = isset($B['owner_id']) ? $B['owner_id'] : $_USER['uid'];
        if (isset($B['group_id'])) {
            $A['group_id'] = $B['group_id'];
        } else {
            if (isset($_GROUPS['Block Admin'])) {
                $A['group_id'] = $_GROUPS['Block Admin'];
            } else {
                $A['group_id'] = SEC_getFeatureGroup('block.edit');
            }
        }
        if (isset($B['perm_owner'])) {
            $A['perm_owner'] = SEC_getPermissionValue($B['perm_owner']);
            $A['perm_group'] = SEC_getPermissionValue($B['perm_group']);
            $A['perm_members'] = SEC_getPermissionValue($B['perm_members']);
            $A['perm_anon'] = SEC_getPermissionValue($B['perm_anon']);
        } else {
            SEC_setDefaultPermissions($A, $_CONF['default_permissions_block']);
        }
        $access = 3;
    }
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/block.php', 'text' => $LANG_ADMIN['block_list']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $block_templates = new Template($_CONF['path_layout'] . 'admin/block');
    $block_templates->set_file('editor', 'blockeditor.thtml');
    $block_templates->set_var('start_block_editor', COM_startBlock($LANG21[3], '', COM_getBlockTemplate('_admin_block', 'header')));
    if (!empty($bid) && SEC_hasrights('block.delete')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s >';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $block_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $block_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $block_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
        $block_templates->set_var('lang_delete_confirm', $MESSAGE[76]);
    }
    $block_templates->set_var('block_bid', $A['bid']);
    // standard Admin strings
    $block_templates->set_var('lang_blocktitle', $LANG_ADMIN['title']);
    $block_templates->set_var('lang_enabled', $LANG_ADMIN['enabled']);
    $block_templates->set_var('lang_blockhelpurl', $LANG_ADMIN['help_url']);
    $block_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
    $block_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $block_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $block_templates->set_var('lang_blocktype', $LANG_ADMIN['type']);
    $block_templates->set_var('lang_allowed_html', $LANG01[123]);
    $block_templates->set_var('block_title', htmlspecialchars($A['title'], ENT_QUOTES, COM_getEncodingt()));
    $block_templates->set_var('lang_enabled', $LANG21[53]);
    if ($A['is_enabled'] == 1) {
        $block_templates->set_var('is_enabled', 'checked="checked"');
    } else {
        $block_templates->set_var('is_enabled', '');
    }
    $block_templates->set_var('block_help', $A['help']);
    $block_templates->set_var('lang_includehttp', $LANG21[51]);
    $block_templates->set_var('lang_explanation', $LANG21[52]);
    $block_templates->set_var('block_name', $A['name']);
    $block_templates->set_var('lang_blockname', $LANG21[48]);
//.........这里部分代码省略.........
开发者ID:spacequad,项目名称:glfusion,代码行数:101,代码来源:block.php

示例2: adEdit


//.........这里部分代码省略.........
        $A['price'] = '';
        $A['url'] = '';
        $A['exp_date'] = '';
        $A['add_date'] = time();
        $A['ad_type'] = 0;
        $A['perm_owner'] = $_CONF_ADVT['default_permissions'][0];
        $A['perm_group'] = $_CONF_ADVT['default_permissions'][1];
        $A['perm_members'] = $_CONF_ADVT['default_permissions'][2];
        $A['perm_anon'] = $_CONF_ADVT['default_permissions'][3];
        $A['uid'] = $_USER['uid'];
        if (isset($_REQUEST['cat'])) {
            $A['cat_id'] = intval($_REQUEST['cat']);
        } else {
            $A['cat_id'] = 0;
        }
        $catsql = "SELECT cat_id,perm_anon,keywords\n                    FROM {$_TABLES['ad_category']} ";
        if ($A['cat_id'] > 0) {
            $catsql .= "WHERE cat_id = {$A['cat_id']} ";
        } else {
            $catsql .= "ORDER BY cat_name ASC ";
        }
        $catsql .= "LIMIT 1";
        $r = DB_query($catsql, 1);
        if ($r && DB_numRows($r) > 0) {
            $row = DB_fetchArray($r, false);
            $A['cat_id'] = $row['cat_id'];
            $A['keywords'] = trim($row['keywords']);
        } else {
            $A['cat_id'] = 0;
            $A['keywords'] = '';
        }
        $A['owner_id'] = $_USER['uid'];
        // Set ad owner to current user for new ads
        $A['group_id'] = isset($_GROUPS['classifieds Admin']) ? $_GROUPS['classifieds Admin'] : SEC_getFeatureGroup('classifieds.edit');
        $A['exp_sent'] = 0;
        // set expiration & duration info for a new ad
        $T->set_var('expiration_date', $LANG_ADVT['runfor']);
        // "run for: X days"
        $comments_enabled = $_CONF_ADVT['commentsupport'] == 1 ? 0 : 1;
        $T->set_var("sel_{$comments_enabled}", 'selected');
        if ($_CONF_ADVT['purchase_enabled']) {
            USES_classifieds_class_userinfo();
            $User = new adUserInfo();
            $T->set_var('days', min($_CONF_ADVT['default_duration'], $User->getMaxDays()));
        } else {
            $T->set_var('days', $_CONF_ADVT['default_duration']);
        }
        $photocount = 0;
        // No photos yet with a new ad
    } else {
        // This is an existing ad with values already in $A
        $T->set_var('expiration_date', $LANG_ADVT['expiration']);
        $T->set_var('days', '0');
        // Disable the perm_anon checkbox if it's disabled by the category.
        if (!$admin && DB_getItem($_TABLES['ad_category'], 'perm_anon', "cat_id='{$A['cat_id']}'") == '0') {
            $T->set_var('vis_disabled', 'disabled');
        }
        // get the photo information
        $sql = "SELECT photo_id, filename \n                FROM {$_TABLES['ad_photo']} \n                WHERE ad_id='{$A['ad_id']}'";
        $photo = DB_query($sql, 1);
        // save the count of photos for later use
        if ($photo) {
            $photocount = DB_numRows($photo);
        } else {
            $photocount = 0;
        }
开发者ID:NewRoute,项目名称:classifieds,代码行数:67,代码来源:edit.php

示例3: _initVars

 function _initVars()
 {
     global $_USER, $_GROUPS, $_DLM_CONF, $mytree;
     $this->_cid = $this->_createID();
     $this->_old_cid = '';
     $this->_pid = $mytree->getRootid();
     $this->_is_enabled = 1;
     $this->_title = '';
     $this->_imgurl = '';
     $this->_corder = 0;
     $this->_owner_id = $_USER['uid'];
     if (isset($_GROUPS['Downloads Admin'])) {
         $this->_group_id = $_GROUPS['Downloads Admin'];
     } else {
         $this->_group_id = SEC_getFeatureGroup('downloads.edit');
     }
     SEC_setDefaultPermissions($A, $_DLM_CONF['default_permissions']);
     foreach ($A as $key => $val) {
         $this->{'_' . $key} = $val;
     }
 }
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:21,代码来源:category.class.php

示例4: service_submit_staticpages

/**
 * Submit static page. The page is updated if it exists, or a new one is created
 *
 * @param   array   args     Contains all the data provided by the client
 * @param   string  &output  OUTPUT parameter containing the returned text
 * @param   string  &svc_msg OUTPUT parameter containing any service messages
 * @return  int		     Response code as defined in lib-plugins.php
 */
function service_submit_staticpages($args, &$output, &$svc_msg)
{
    global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG12, $LANG_STATIC, $LANG_LOGIN, $_GROUPS, $_SP_CONF;
    $output = '';
    if (!SEC_hasRights('staticpages.edit')) {
        $output = COM_siteHeader('menu', $LANG_STATIC['access_denied']);
        $output .= COM_showMessageText($LANG_STATIC['access_denied_msg'], $LANG_STATIC['access_denied'], true);
        $output .= COM_siteFooter();
        return PLG_RET_AUTH_FAILED;
    }
    if (defined('DEMO_MODE')) {
        $output = COM_siteHeader('menu');
        $output .= COM_showMessageText('Option disabled in Demo Mode', 'Option disabled in Demo Mode', true);
        $output .= COM_siteFooter();
        return PLG_REG_AUTH_FAILED;
    }
    $gl_edit = false;
    if (isset($args['gl_edit'])) {
        $gl_edit = $args['gl_edit'];
    }
    if ($gl_edit) {
        // This is EDIT mode, so there should be an sp_old_id
        if (empty($args['sp_old_id'])) {
            if (!empty($args['id'])) {
                $args['sp_old_id'] = $args['id'];
            } else {
                return PLG_RET_ERROR;
            }
            if (empty($args['sp_id'])) {
                $args['sp_id'] = $args['sp_old_id'];
            }
        }
    } else {
        if (empty($args['sp_id']) && !empty($args['id'])) {
            $args['sp_id'] = $args['id'];
        }
    }
    if (empty($args['sp_uid'])) {
        $args['sp_uid'] = $_USER['uid'];
    }
    if (empty($args['sp_title']) && !empty($args['title'])) {
        $args['sp_title'] = $args['title'];
    }
    if (empty($args['sp_content']) && !empty($args['content'])) {
        $args['sp_content'] = $args['content'];
    }
    if (isset($args['category']) && is_array($args['category']) && !empty($args['category'][0])) {
        $args['sp_tid'] = $args['category'][0];
    }
    if (!isset($args['owner_id'])) {
        $args['owner_id'] = $_USER['uid'];
    }
    if (empty($args['group_id'])) {
        $args['group_id'] = SEC_getFeatureGroup('staticpages.edit', $_USER['uid']);
    }
    $args['sp_id'] = COM_sanitizeID($args['sp_id']);
    if (!$gl_edit) {
        if (strlen($args['sp_id']) > STATICPAGE_MAX_ID_LENGTH) {
            if (function_exists('WS_makeId')) {
                $args['sp_id'] = WS_makeId($slug, STATICPAGE_MAX_ID_LENGTH);
            } else {
                $args['sp_id'] = COM_makeSid();
            }
        }
    }
    // Apply filters to the parameters passed by the webservice
    if ($args['gl_svc']) {
        $par_str = array('mode', 'sp_id', 'sp_old_id', 'sp_tid', 'sp_format', 'postmode');
        $par_num = array('sp_uid', 'sp_hits', 'owner_id', 'group_id', 'sp_where', 'sp_php', 'commentcode', 'sp_search', 'sp_status');
        foreach ($par_str as $str) {
            if (isset($args[$str])) {
                $args[$str] = COM_applyBasicFilter($args[$str]);
            } else {
                $args[$str] = '';
            }
        }
        foreach ($par_num as $num) {
            if (isset($args[$num])) {
                $args[$num] = COM_applyBasicFilter($args[$num], true);
            } else {
                $args[$num] = 0;
            }
        }
    }
    // START: Staticpages defaults
    if ($args['sp_status'] != 1) {
        $args['sp_status'] = 0;
    }
    if (empty($args['sp_format'])) {
        $args['sp_format'] = 'allblocks';
    }
    if (empty($args['sp_tid'])) {
//.........这里部分代码省略.........
开发者ID:JohnToro,项目名称:glfusion,代码行数:101,代码来源:services.inc.php

示例5: PAGE_form

/**
* Displays the static page form
*
* @param    array   $A      Data to display
* @param    string  $error  Error message to display
*
*/
function PAGE_form($A, $error = false)
{
    global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $action, $sp_id, $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG24, $LANG_postmodes, $MESSAGE;
    USES_lib_admin();
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/staticpages/index.php', 'text' => $LANG_STATIC['page_list']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $template_path = staticpages_templatePath('admin');
    if (!empty($sp_id) && ($action == 'edit' || $action == 'clone')) {
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
    } else {
        $A['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['staticpages Admin'])) {
            $A['group_id'] = $_GROUPS['staticpages Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('staticpages.edit');
        }
        SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']);
        $access = 3;
    }
    $retval = '';
    if (empty($A['owner_id'])) {
        $error = COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header'));
        $error .= $LANG_STATIC['deny_msg'];
        $error .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
    }
    if ($error) {
        $retval .= $error . '<br/><br/>';
    } else {
        $sp_template = new Template($template_path);
        $sp_template->set_file('form', 'editor.thtml');
        $sp_template->set_var('lang_mode', $LANG24[3]);
        $sp_template->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $A['commentcode']));
        $ownername = COM_getDisplayName($A['owner_id']);
        $sp_template->set_var(array('sp_search_checked' => $A['sp_search'] == 1 ? ' checked="checked"' : '', 'sp_status_checked' => $A['sp_status'] == 1 ? ' checked="checked"' : '', 'lang_accessrights' => $LANG_ACCESS['accessrights'], 'lang_owner' => $LANG_ACCESS['owner'], 'owner_username' => DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"), 'owner_name' => $ownername, 'owner' => $ownername, 'owner_id' => $A['owner_id'], 'lang_group' => $LANG_ACCESS['group'], 'group_dropdown' => SEC_getGroupDropdown($A['group_id'], $access), 'permissions_editor' => SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']), 'lang_permissions' => $LANG_ACCESS['permissions'], 'lang_perm_key' => $LANG_ACCESS['permissionskey'], 'permissions_msg' => $LANG_ACCESS['permmsg'], 'start_block_editor' => COM_startBlock($LANG_STATIC['staticpages'] . ' :: ' . $LANG_STATIC['staticpageeditor'], '', COM_getBlockTemplate('_admin_block', 'header')), 'lang_save' => $LANG_ADMIN['save'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'lang_preview' => $LANG_ADMIN['preview'], 'lang_editor' => $LANG_STATIC['staticpageeditor'], 'lang_attributes' => $LANG_STATIC['attributes']));
        if (SEC_hasRights('staticpages.delete') && $action != 'clone' && !empty($A['sp_old_id'])) {
            $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s/>';
            $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
            $sp_template->set_var('delete_option', sprintf($delbutton, $jsconfirm));
            $sp_template->set_var('delete_button', true);
            $sp_template->set_var('lang_delete_confirm', $MESSAGE[76]);
            $sp_template->set_var('lang_delete', $LANG_ADMIN['delete']);
            $sp_template->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        } else {
            $sp_template->set_var('delete_option', '');
        }
        $sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']);
        $sp_template->set_var('username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['sp_uid']}"));
        $authorname = COM_getDisplayName($A['sp_uid']);
        $sp_template->set_var('name', $authorname);
        $sp_template->set_var('author', $authorname);
        $sp_template->set_var('lang_url', $LANG_STATIC['url']);
        $sp_template->set_var('lang_id', $LANG_STATIC['id']);
        $sp_template->set_var('sp_uid', $A['sp_uid']);
        $sp_template->set_var('sp_id', $A['sp_id']);
        $sp_template->set_var('sp_old_id', $A['sp_old_id']);
        $sp_template->set_var('example_url', COM_buildURL($_CONF['site_url'] . '/page.php?page=' . $A['sp_id']));
        $sp_template->set_var('lang_centerblock', $LANG_STATIC['centerblock']);
        $sp_template->set_var('lang_centerblock_help', $LANG_ADMIN['help_url']);
        $sp_template->set_var('lang_centerblock_include', $LANG21[51]);
        $sp_template->set_var('lang_centerblock_desc', $LANG21[52]);
        $sp_template->set_var('centerblock_help', $A['sp_help']);
        $sp_template->set_var('lang_centerblock_msg', $LANG_STATIC['centerblock_msg']);
        if (isset($A['sp_centerblock']) && $A['sp_centerblock'] == 1) {
            $sp_template->set_var('centerblock_checked', 'checked="checked"');
        } else {
            $sp_template->set_var('centerblock_checked', '');
        }
        $sp_template->set_var('lang_topic', $LANG_STATIC['topic']);
        $sp_template->set_var('lang_position', $LANG_STATIC['position']);
        $current_topic = '';
        if (isset($A['sp_tid'])) {
            $current_topic = $A['sp_tid'];
        }
        if (empty($current_topic)) {
            $current_topic = 'none';
        }
        $topics = COM_topicList('tid,topic', $current_topic, 1, true);
        $alltopics = '<option value="all"';
        if ($current_topic == 'all') {
            $alltopics .= ' selected="selected"';
        }
        $alltopics .= '>' . $LANG_STATIC['all_topics'] . '</option>' . LB;
        $allnhp = '<option value="allnhp"';
        if ($current_topic == 'allnhp') {
            $allnhp .= ' selected="selected"';
        }
        $allnhp .= '>' . $LANG_STATIC['allnhp_topics'] . '</option>' . LB;
        $notopic = '<option value="none"';
        if ($current_topic == 'none') {
            $notopic .= ' selected="selected"';
        }
        $notopic .= '>' . $LANG_STATIC['no_topic'] . '</option>' . LB;
        $sp_template->set_var('topic_selection', '<select name="sp_tid">' . $alltopics . $allnhp . $notopic . $topics . '</select>');
        $position = '<select name="sp_where">';
//.........这里部分代码省略.........
开发者ID:NewRoute,项目名称:glfusion,代码行数:101,代码来源:index.php

示例6: edittopic

/**
* Show topic administration form
*
* @param    string  tid     ID of topic to edit
* @return   string          HTML for the topic editor
*
*/
function edittopic($tid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG27, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
    $retval = '';
    if (empty($tid)) {
        // new topic - set defaults
        $A = array();
        $A['tid'] = '';
        $A['topic'] = '';
        $A['sortnum'] = 0;
        $A['limitnews'] = '';
        // leave empty!
        $A['is_default'] = 0;
        $A['archive_flag'] = 0;
    } else {
        $result = DB_query("SELECT * FROM {$_TABLES['topics']} WHERE tid ='{$tid}'");
        $A = DB_fetchArray($result);
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access == 0 or $access == 2) {
            $retval .= COM_startBlock($LANG27[12], '', COM_getBlockTemplate('_msg_block', 'header'));
            $retval .= $LANG27[13];
            $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit topic {$tid}.");
            return $retval;
        }
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG27[1], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    if (!is_array($A) || empty($A['owner_id'])) {
        $A['owner_id'] = $_USER['uid'];
        // this is the one instance where we default the group
        // most topics should belong to the Topic Admin group
        if (isset($_GROUPS['Topic Admin'])) {
            $A['group_id'] = $_GROUPS['Topic Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('topic.edit');
        }
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_topic']);
        $access = 3;
    }
    $topic_templates = new Template($_CONF['path_layout'] . 'admin/topic');
    $topic_templates->set_file('editor', 'topiceditor.thtml');
    $topic_templates->set_var('xhtml', XHTML);
    $topic_templates->set_var('site_url', $_CONF['site_url']);
    $topic_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $topic_templates->set_var('layout_url', $_CONF['layout_url']);
    if (!empty($tid) && SEC_hasRights('topic.edit')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $topic_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $topic_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $topic_templates->set_var('warning_msg', $LANG27[6]);
    }
    $topic_templates->set_var('lang_topicid', $LANG27[2]);
    $topic_templates->set_var('topic_id', $A['tid']);
    $topic_templates->set_var('lang_donotusespaces', $LANG27[5]);
    $topic_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $topic_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $topic_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $topic_templates->set_var('owner_name', $ownername);
    $topic_templates->set_var('owner', $ownername);
    $topic_templates->set_var('owner_id', $A['owner_id']);
    $topic_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $topic_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $topic_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $topic_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $topic_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $topic_templates->set_var('lang_permissions_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    // show sort order only if they specified sortnum as the sort method
    if ($_CONF['sortmethod'] != 'alpha') {
        $topic_templates->set_var('lang_sortorder', $LANG27[10]);
        if ($A['sortnum'] == 0) {
            $A['sortnum'] = '';
        }
        $topic_templates->set_var('sort_order', '<input type="text" size="3" maxlength="3" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
    } else {
        $topic_templates->set_var('lang_sortorder', $LANG27[14]);
        $topic_templates->set_var('sort_order', $LANG27[15]);
    }
    $topic_templates->set_var('lang_storiesperpage', $LANG27[11]);
    if ($A['limitnews'] == 0) {
        $topic_templates->set_var('story_limit', '');
    } else {
        $topic_templates->set_var('story_limit', $A['limitnews']);
    }
    $topic_templates->set_var('default_limit', $_CONF['limitnews']);
    $topic_templates->set_var('lang_defaultis', $LANG27[16]);
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:topic.php

示例7: loadFromDatabase

 /**
  * Load a Story object from the sid specified, returning a status result.
  * The result will either be a permission denied message, invalid SID
  * message, or a loaded ok message. If it's loaded ok, then we've got all
  * the exciting gubbins here.
  *
  * Only used from story admin and submit.php!
  *
  * @param $sid  string  Story Identifier, valid glFusion story id from the db.
  * @return Integer from a constant.
  */
 function loadFromDatabase($sid, $mode = 'edit')
 {
     global $_TABLES, $_CONF, $_USER, $_GROUPS;
     $dtPublish = new Date('now', $_USER['tzid']);
     $dtExpire = new Date('now', $_USER['tzid']);
     $dtCmtclose = new Date('now', $_USER['tzid']);
     $sid = DB_escapeString(COM_applyFilter($sid));
     if (!empty($sid) && ($mode == 'edit' || $mode == 'view' || $mode == 'clone')) {
         $sql = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) as expireunix, UNIX_TIMESTAMP(s.comment_expire) as cmt_expire_unix, " . "u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t " . "WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND (sid = '{$sid}')";
     } elseif (!empty($sid) && $mode == 'moderate') {
         $sql = 'SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, ' . 'u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl, t.group_id, ' . 't.perm_owner, t.perm_group, t.perm_members, t.perm_anon ' . 'FROM ' . $_TABLES['storysubmission'] . ' AS s, ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topics'] . ' AS t WHERE (s.uid = u.uid) AND' . ' (s.tid = t.tid) AND (sid = \'' . $sid . '\')';
     } elseif ($mode == 'edit') {
         $this->_sid = COM_makesid();
         $this->_old_sid = $this->_sid;
         if (isset($_CONF['draft_flag'])) {
             $this->_draft_flag = $_CONF['draft_flag'];
         } else {
             $this->_draft_flag = 0;
         }
         if (isset($_CONF['show_topic_icon'])) {
             $this->_show_topic_icon = $_CONF['show_topic_icon'];
         } else {
             $this->_show_topic_icon = 1;
         }
         if (COM_isAnonUser()) {
             $this->_uid = 1;
         } else {
             $this->_uid = $_USER['uid'];
         }
         $this->_date = $dtPublish->toUnix();
         $this->_expire = $dtExpire->toUnix();
         if ($_CONF['article_comment_close_enabled']) {
             $this->_comment_expire = $dtCmtclose->toUnix() + $_CONF['article_comment_close_days'] * 86400;
         } else {
             $this->_comment_expire = 0;
         }
         $this->_commentcode = $_CONF['comment_code'];
         $this->_trackbackcode = $_CONF['trackback_code'];
         $this->_title = '';
         $this->_introtext = '';
         $this->_bodytext = '';
         if (isset($_CONF['frontpage'])) {
             $this->_frontpage = $_CONF['frontpage'];
         } else {
             $this->_frontpage = 1;
         }
         $this->_hits = 0;
         $this->_rating = 0.0;
         $this->_votes = 0;
         $this->_comments = 0;
         $this->_trackbacks = 0;
         $this->_numemails = 0;
         if ($_CONF['postmode'] != 'plaintext') {
             $this->_postmode = 'html';
         } else {
             $this->_postmode = $_CONF['postmode'];
         }
         $this->_statuscode = 0;
         $this->_featured = 0;
         if (COM_isAnonUser()) {
             $this->_owner_id = 1;
         } else {
             $this->_owner_id = $_USER['uid'];
         }
         if (isset($_GROUPS['Story Admin'])) {
             $this->_group_id = $_GROUPS['Story Admin'];
         } else {
             $this->_group_id = SEC_getFeatureGroup('story.edit');
         }
         $array = array();
         SEC_setDefaultPermissions($array, $_CONF['default_permissions_story']);
         $this->_perm_owner = $array['perm_owner'];
         $this->_perm_group = $array['perm_group'];
         $this->_perm_anon = $array['perm_anon'];
         $this->_perm_members = $array['perm_members'];
     } else {
         $this->loadFromArgsArray($_POST);
     }
     /* if we have SQL, load from it */
     if (!empty($sql)) {
         $result = DB_query($sql);
         if ($result) {
             $story = DB_fetchArray($result, false);
             if ($story == null) {
                 return STORY_INVALID_SID;
             }
             $this->loadFromArray($story);
             if (!isset($story['owner_id'])) {
                 $story['owner_id'] = 1;
//.........这里部分代码省略.........
开发者ID:NewRoute,项目名称:glfusion,代码行数:101,代码来源:story.class.php

示例8: editblock

/**
* Shows the block editor
*
* This will show a block edit form.  If this is a Geeklog default block it will
* send it off to editdefaultblock.
*
* @param    string  $bid    ID of block to edit
* @return   string          HTML for block editor
*
*/
function editblock($bid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG01, $LANG21, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS;
    $retval = '';
    if (!empty($bid)) {
        $sql['mysql'] = "SELECT * FROM {$_TABLES['blocks']} WHERE bid ='{$bid}'";
        $sql['mssql'] = "SELECT bid, is_enabled, name, type, title, blockorder, cast(content as text) as content, rdfurl, ";
        $sql['mssql'] .= "rdfupdated, rdflimit, onleft, phpblockfn, help, owner_id,group_id, ";
        $sql['mssql'] .= "perm_owner, perm_group, perm_members, perm_anon, allow_autotags, cache_time FROM {$_TABLES['blocks']} WHERE bid ='{$bid}'";
        $sql['pgsql'] = "SELECT * FROM {$_TABLES['blocks']} WHERE bid ='{$bid}'";
        $result = DB_query($sql);
        $A = DB_fetchArray($result);
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access == 2 || $access == 0 || TOPIC_hasMultiTopicAccess('block', $bid) < 3) {
            $retval .= COM_showMessageText($LANG21[45], $LANG_ACCESS['accessdenied']);
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit block {$bid}.");
            return $retval;
        }
        if ($A['type'] == 'gldefault') {
            $retval .= editdefaultblock($A, $access);
            return $retval;
        }
    } else {
        $A['bid'] = 0;
        $A['is_enabled'] = 1;
        $A['name'] = '';
        $A['type'] = 'normal';
        $A['title'] = '';
        $A['tid'] = '';
        $A['blockorder'] = 0;
        $A['cache_time'] = $_CONF['default_cache_time_block'];
        $A['content'] = '';
        $A['allow_autotags'] = 0;
        $A['rdfurl'] = '';
        $A['rdfupdated'] = '';
        $A['rdflimit'] = 0;
        $A['onleft'] = 0;
        $A['phpblockfn'] = '';
        $A['help'] = '';
        $A['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['Block Admin'])) {
            $A['group_id'] = $_GROUPS['Block Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('block.edit');
        }
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_block']);
        $access = 3;
        if ($_POST['mode'] == $LANG_ADMIN['save'] && !empty($LANG_ADMIN['save'])) {
            overridePostdata($A);
        }
    }
    $token = SEC_createToken();
    $block_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/block');
    $block_templates->set_file('editor', 'blockeditor.thtml');
    $block_start = COM_startBlock($LANG21[3], '', COM_getBlockTemplate('_admin_block', 'header'));
    $block_start .= LB . SEC_getTokenExpiryNotice($token);
    $block_templates->set_var('start_block_editor', $block_start);
    if (!empty($bid) && SEC_hasrights('block.delete')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $block_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $block_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $block_templates->set_var('allow_delete', true);
        $block_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
        $block_templates->set_var('confirm_message', $MESSAGE[76]);
    }
    $block_templates->set_var('block_bid', $A['bid']);
    // standard Admin strings
    $block_templates->set_var('lang_blocktitle', $LANG_ADMIN['title']);
    $block_templates->set_var('lang_enabled', $LANG_ADMIN['enabled']);
    $block_templates->set_var('lang_blockhelpurl', $LANG_ADMIN['help_url']);
    $block_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
    $block_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $block_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $block_templates->set_var('lang_blocktype', $LANG_ADMIN['type']);
    $block_templates->set_var('lang_allowed_html', $LANG01[123]);
    $block_templates->set_var('block_title', stripslashes($A['title']));
    $block_templates->set_var('lang_enabled', $LANG21[53]);
    if ($A['is_enabled'] == 1) {
        $block_templates->set_var('is_enabled', 'checked="checked"');
    } else {
        $block_templates->set_var('is_enabled', '');
    }
    $block_templates->set_var('block_help', $A['help']);
    $block_templates->set_var('lang_includehttp', $LANG21[51]);
    $block_templates->set_var('lang_explanation', $LANG21[52]);
    $block_templates->set_var('block_name', $A['name']);
    $block_templates->set_var('lang_blockname', $LANG21[48]);
    $block_templates->set_var('lang_nospaces', $LANG21[49]);
    $block_templates->set_var('topic_selection', TOPIC_getTopicSelectionControl('block', $A['bid'], true, true));
//.........这里部分代码省略.........
开发者ID:ivywe,项目名称:geeklog,代码行数:101,代码来源:block.php

示例9: editblock

/**
* Shows the block editor
*
* This will show a block edit form.  If this is a Geeklog default block it will
* send it off to editdefaultblock.
*
* @param    string  $bid    ID of block to edit
* @return   string          HTML for block editor
*
*/
function editblock($bid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG01, $LANG21, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
    $retval = '';
    if (!empty($bid)) {
        $sql['mysql'] = "SELECT * FROM {$_TABLES['blocks']} WHERE bid ='{$bid}'";
        $sql['mssql'] = "SELECT bid, is_enabled, name, type, title, tid, blockorder, cast(content as text) as content, rdfurl, ";
        $sql['mssql'] .= "rdfupdated, rdflimit, onleft, phpblockfn, help, owner_id,group_id, ";
        $sql['mssql'] .= "perm_owner, perm_group, perm_members, perm_anon, allow_autotags FROM {$_TABLES['blocks']} WHERE bid ='{$bid}'";
        $result = DB_query($sql);
        $A = DB_fetchArray($result);
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access == 2 || $access == 0 || hasBlockTopicAccess($A['tid']) < 3) {
            $retval .= COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG21[45] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit block {$bid}.");
            return $retval;
        }
        if ($A['type'] == 'gldefault') {
            $retval .= editdefaultblock($A, $access);
            return $retval;
        }
    } else {
        $A['bid'] = 0;
        $A['is_enabled'] = 1;
        $A['name'] = '';
        $A['type'] = 'normal';
        $A['title'] = '';
        $A['tid'] = 'All';
        $A['blockorder'] = 0;
        $A['content'] = '';
        $A['allow_autotags'] = 0;
        $A['rdfurl'] = '';
        $A['rdfupdated'] = '';
        $A['rdflimit'] = 0;
        $A['onleft'] = 0;
        $A['phpblockfn'] = '';
        $A['help'] = '';
        $A['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['Block Admin'])) {
            $A['group_id'] = $_GROUPS['Block Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('block.edit');
        }
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_block']);
        $access = 3;
    }
    $token = SEC_createToken();
    $block_templates = new Template($_CONF['path_layout'] . 'admin/block');
    $block_templates->set_file('editor', 'blockeditor.thtml');
    $block_templates->set_var('site_url', $_CONF['site_url']);
    $block_templates->set_var('xhtml', XHTML);
    $block_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $block_templates->set_var('layout_url', $_CONF['layout_url']);
    $block_start = COM_startBlock($LANG21[3], '', COM_getBlockTemplate('_admin_block', 'header'));
    $block_start .= LB . SEC_getTokenExpiryNotice($token);
    $block_templates->set_var('start_block_editor', $block_start);
    if (!empty($bid) && SEC_hasrights('block.delete')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $block_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $block_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    }
    $block_templates->set_var('block_bid', $A['bid']);
    // standard Admin strings
    $block_templates->set_var('lang_blocktitle', $LANG_ADMIN['title']);
    $block_templates->set_var('lang_enabled', $LANG_ADMIN['enabled']);
    $block_templates->set_var('lang_blockhelpurl', $LANG_ADMIN['help_url']);
    $block_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
    $block_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $block_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $block_templates->set_var('lang_blocktype', $LANG_ADMIN['type']);
    $block_templates->set_var('lang_allowed_html', $LANG01[123]);
    $block_templates->set_var('block_title', stripslashes($A['title']));
    $block_templates->set_var('lang_enabled', $LANG21[53]);
    if ($A['is_enabled'] == 1) {
        $block_templates->set_var('is_enabled', 'checked="checked"');
    } else {
        $block_templates->set_var('is_enabled', '');
    }
    $block_templates->set_var('block_help', $A['help']);
    $block_templates->set_var('lang_includehttp', $LANG21[51]);
    $block_templates->set_var('lang_explanation', $LANG21[52]);
    $block_templates->set_var('block_name', $A['name']);
    $block_templates->set_var('lang_blockname', $LANG21[48]);
    $block_templates->set_var('lang_nospaces', $LANG21[49]);
    $block_templates->set_var('lang_all', $LANG21[7]);
    $block_templates->set_var('lang_homeonly', $LANG21[43]);
    if ($A['tid'] == 'all') {
        $block_templates->set_var('all_selected', 'selected="selected"');
    } else {
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:block.php

示例10: CMED_editMenuitem

function CMED_editMenuitem($mid, $mode = 'edit', $A = array())
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $_PLUGINS, $_CMED_CONF, $LANG_CMED_EDITOR, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
    $retval = '';
    if ($mode == 'edit' || $mode == 'clone') {
        if (empty($A)) {
            $result = DB_query("SELECT * FROM {$_TABLES['menuitems']} WHERE mid ='{$mid}'");
            $A = DB_fetchArray($result);
        }
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access < 3 || CMED_hasMenuitemTopicAccess($A['tid']) < 3) {
            $retval .= COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG_CMED_EDITOR['message_access1'] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit menuitem {$mid}.");
            return $retval;
        }
        $selpmid = CMED_makeSelBox($A['pmid']);
    }
    if ($mode == 'clone') {
        preg_match('/(.*)_clone_(.+)/', $A['mid'], $match);
        $label = empty($match[1]) ? $A['mid'] : $match[1];
        $A['mid'] = CMED_createMenuitemID($label . '_clone_');
        $A['type'] = 'custom';
        $access = 3;
    }
    if ($mode == 'create') {
        $A['mid'] = CMED_createMenuitemID();
        $A['pmid'] = '';
        $A['is_enabled'] = 1;
        $A['type'] = 'custom';
        $A['mode'] = 'fixation';
        $A['label'] = '';
        $A['label_var'] = '';
        $A['php_function'] = '';
        $A['tid'] = 'all';
        $A['url'] = '';
        $A['icon_url'] = '';
        $A['menuorder'] = 0;
        $A['pattern'] = '';
        $A['is_preg'] = 0;
        $A['class_name'] = '';
        $selpmid = CMED_makeSelBox();
        $A['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['CustomMenu Admin'])) {
            $A['group_id'] = $_GROUPS['CustomMenu Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('custommenu.admin');
        }
        SEC_setDefaultPermissions($A, $_CMED_CONF['default_permissions']);
        $access = 3;
    }
    $T = COM_newTemplate($_CMED_CONF['path_layout']);
    $T->set_file('editor', 'menueditor.thtml');
    $T->set_var('icon_url', plugin_geticon_custommenu());
    $retval .= COM_startBlock($LANG_CMED_EDITOR['custommenueditor'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $v = $mode == 'create' || $mode == 'clone' || $A['type'] == 'gldefault' || $A['type'] == 'plugin' && in_array($A['mid'], $_PLUGINS) ? UC_DISABLED : '';
    $T->set_var('delete_disabled', $v);
    foreach ($LANG_CMED_EDITOR as $key => $val) {
        $T->set_var('lang_' . $key, $val);
    }
    $v = ($mode == 'create' or $mode == 'clone') ? 'save' : 'update';
    $T->set_var('lang_save', $LANG_CMED_EDITOR[$v]);
    $T->set_var('val_title_fixation', stripslashes($A['label']));
    $T->set_var('val_title_variable', stripslashes($A['label_var']));
    $T->set_var('val_php_function', stripslashes($A['php_function']));
    $T->set_var('val_is_enabled', $A['is_enabled'] == 1 ? UC_CHECKED : '');
    $T->set_var('val_menuitemurl', $A['url']);
    $T->set_var('val_icon_url', $A['icon_url']);
    $T->set_var('val_mid', $A['mid']);
    $T->set_var('val_pmid', $A['pmid']);
    $T->set_var('selpmid', $selpmid);
    $T->set_var('val_old_mid', $A['mid']);
    $T->set_var('val_menuorder', $A['menuorder']);
    $T->set_var('val_type', $A['type']);
    $T->set_var('val_pattern', stripslashes($A['pattern']));
    $T->set_var('val_is_preg', $A['is_preg'] == 1 ? UC_CHECKED : '');
    $T->set_var('val_class_name', stripslashes($A['class_name']));
    $v = $A['type'] == 'gldefault' || $A['type'] == 'plugin' ? UC_READONLY : '';
    $T->set_var('mid_readonly', $v);
    $T->set_var($A['tid'] . '_selected', UC_SELECTED);
    $T->set_var('topic_options', COM_topicList('tid,topic', $A['tid'], 1, true));
    $T->set_var('lang_type', $LANG_CMED_EDITOR['type_' . $A['type']]);
    $T->set_var($A['type'] . '_selected', UC_SELECTED);
    $T->set_var('val_mode_' . $A['mode'], UC_SELECTED);
    // user access info
    $T->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $T->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $T->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $T->set_var('owner_name', $ownername);
    $T->set_var('owner', $ownername);
    $T->set_var('owner_id', $A['owner_id']);
    $T->set_var('lang_group', $LANG_ACCESS['group']);
    $T->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $T->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $T->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']);
    $T->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    $T->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']);
    if (!defined(CSRF_TOKEN)) {
        define('CSRF_TOKEN', 'token');
    }
//.........这里部分代码省略.........
开发者ID:milk54,项目名称:geeklog-japan,代码行数:101,代码来源:index.php

示例11: fncSave


//.........这里部分代码省略.........
        return $retval;
    }
    // CHECK おわり
    //-----
    // 新規登録時
    if ($new_flg) {
        $w = DB_getItem($_TABLES['DATABOX_base'], "max(id)", "1=1");
        if ($w == "") {
            $w = 0;
        }
        $id = $w + 1;
    }
    $fields = LB . "id";
    $values = LB . "{$id}";
    if ($new_flg) {
        if ($_DATABOX_CONF['datacode']) {
            $code = "000000" . date(Ymdhis);
        }
        $created = COM_convertDate2Timestamp(date("Y-m-d"), date("H:i::00"));
        $modified = $created;
        $released = $created;
        $commentcode = $_DATABOX_CONF['commentcode'];
        $trackbackcode = $_CONF[trackback_code];
        $comment_expire = '0000-00-00 00:00:00';
        $expired = '0000-00-00 00:00:00';
        //
        $defaulttemplatesdirectory = null;
        $draft_flag = $_DATABOX_CONF['user_draft_default'];
        $draft_flag = $_DATABOX_CONF['user_draft_default'];
        //---
        $meta_description = "";
        $meta_keywords = "";
        $owner_id = $_USER['uid'];
        $group_id = SEC_getFeatureGroup('databox.admin', $_USER['uid']);
        $array = array();
        SEC_setDefaultPermissions($array, $_DATABOX_CONF['default_permissions']);
        $perm_owner = $array['perm_owner'];
        $perm_group = $array['perm_group'];
        $perm_anon = $array['perm_anon'];
        $perm_members = $array['perm_members'];
        $draft_flag = $_DATABOX_CONF['user_draft_default'];
        $cache_time = $_DATABOX_CONF['default_cache_time'];
        //-----
        $fields .= ",defaulttemplatesdirectory";
        //
        $values .= ",'{$defaulttemplatesdirectory}'";
        $fields .= ",draft_flag";
        $values .= ",{$draft_flag}";
        $fields .= ",cache_time";
        $values .= ",{$cache_time}";
        $fields .= ",meta_description";
        //
        $values .= ",'{$meta_description}'";
        $fields .= ",meta_keywords";
        //
        $values .= ",'{$meta_keywords}'";
        $fields .= ",commentcode";
        //
        $values .= ",{$commentcode}";
        $fields .= ",trackbackcode";
        //
        $values .= ",{$trackbackcode}";
        $fields .= ",comment_expire";
        //
        if ($comment_expire == '0000-00-00 00:00:00') {
            $values .= ",'{$comment_expire}'";
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:67,代码来源:data.php

示例12: DLM_convertData


//.........这里部分代码省略.........
    if ($count > 0) {
        $retval .= '<p>' . $_LANG_CONV['del_dm_history_data'] . '</p>' . LB;
        DB_query("DELETE FROM {$_TABLES['downloadhistories']}");
        if (DB_error()) {
            $retval .= '<p>' . $_LANG_CONV['db_error'] . '</p>' . LB;
            $_SUCCESS = false;
            return $retval;
        }
    }
    $sql = "SELECT COUNT(*) FROM {$_TABLES['downloadsubmission']}";
    list($count) = DB_fetchArray(DB_query($sql));
    if (DB_error()) {
        $retval .= '<p>' . $_LANG_CONV['db_error'] . '</p>' . LB;
        $_SUCCESS = false;
        return $retval;
    }
    $retval .= '<p>' . $_LANG_CONV['num_dm_submission_data'] . $count . '</p>' . LB;
    if ($count > 0) {
        $retval .= '<p>' . $_LANG_CONV['del_dm_submission_data'] . '</p>' . LB;
        DB_query("DELETE FROM {$_TABLES['downloadsubmission']}");
        if (DB_error()) {
            $retval .= '<p>' . $_LANG_CONV['db_error'] . '</p>' . LB;
            $_SUCCESS = false;
            return $retval;
        }
    }
    if (!$_SUCCESS) {
        return $retval;
    }
    $owner_id = $_USER['uid'];
    if (isset($_GROUPS['Downloads Admin'])) {
        $group_id = $_GROUPS['Downloads Admin'];
    } else {
        $group_id = SEC_getFeatureGroup('downloads.edit');
    }
    SEC_setDefaultPermissions($P, $_DLM_CONF['default_permissions']);
    foreach ($P as $key => $val) {
        ${$key} = $val;
    }
    $sql = "SELECT * FROM {$_FM_TABLES['filemgmt_cat']}";
    $result = DB_query($sql);
    if (DB_error()) {
        $retval .= '<p>' . $_LANG_CONV['db_error'] . '</p>' . LB;
        $_SUCCESS = false;
        return $retval;
    }
    $corder = 0;
    while ($A = DB_fetchArray($result)) {
        foreach ($A as $key => $val) {
            ${$key} = $val;
        }
        if ($pid == 0) {
            $pid = ROOTID;
        }
        $corder += 10;
        $is_enabled = 1;
        if (!empty($imgurl)) {
            $imgurl = rawurldecode($imgurl);
            $catimg_src = $_FM_CONF['filemgmt_SnapCat'] . $imgurl;
            if (!is_readable($catimg_src)) {
                $retval .= '<p>' . $_LANG_CONV['unable_to_read_catimg'] . $catimg_src . '</p>' . LB;
                $_SUCCESS = false;
                return $retval;
            }
            $catimg_dest = $_DLM_CONF['path_snapcat'] . DLM_createSafeFileName(DLM_createCatImgFilename($imgurl));
            $_SUCCESS = DLM_copyFile_fm2dm($catimg_src, $catimg_dest);
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:67,代码来源:fm2dm.php

示例13: service_submit_story

/**
 * Submit a new or updated story. The story is updated if it exists, or a new one is created
 *
 * @param   array   args    Contains all the data provided by the client
 * @param   string  &output OUTPUT parameter containing the returned text
 * @return  int		    Response code as defined in lib-plugins.php
 */
function service_submit_story($args, &$output, &$svc_msg)
{
    global $_CONF, $_TABLES, $_USER, $LANG24, $MESSAGE, $_GROUPS;
    if (!SEC_hasRights('story.edit')) {
        $output .= COM_showMessageText($MESSAGE[31], $MESSAGE[30], true);
        return PLG_RET_AUTH_FAILED;
    }
    $gl_edit = false;
    if (isset($args['gl_edit'])) {
        $gl_edit = $args['gl_edit'];
    }
    if ($gl_edit) {
        /* This is EDIT mode, so there should be an old sid */
        if (empty($args['old_sid'])) {
            if (!empty($args['id'])) {
                $args['old_sid'] = $args['id'];
            } else {
                return PLG_RET_ERROR;
            }
            if (empty($args['sid'])) {
                $args['sid'] = $args['old_sid'];
            }
        }
    } else {
        if (empty($args['sid']) && !empty($args['id'])) {
            $args['sid'] = $args['id'];
        }
    }
    /* Store the first CATEGORY as the Topic ID */
    if (!empty($args['category'][0])) {
        $args['tid'] = $args['category'][0];
    }
    $content = '';
    if (!empty($args['content'])) {
        $content = $args['content'];
    } else {
        if (!empty($args['summary'])) {
            $content = $args['summary'];
        }
    }
    if (!empty($content)) {
        $parts = explode('[page_break]', $content);
        if (count($parts) == 1) {
            $args['introtext'] = $content;
            $args['bodytext'] = '';
        } else {
            $args['introtext'] = array_shift($parts);
            $args['bodytext'] = implode('[page_break]', $parts);
        }
    }
    /* Apply filters to the parameters passed by the webservice */
    if ($args['gl_svc']) {
        if (isset($args['mode'])) {
            $args['mode'] = COM_applyBasicFilter($args['mode']);
        }
        if (isset($args['editopt'])) {
            $args['editopt'] = COM_applyBasicFilter($args['editopt']);
        }
    }
    /* - START: Set all the defaults - */
    if (empty($args['tid'])) {
        // see if we have a default topic
        $topic = DB_getItem($_TABLES['topics'], 'tid', 'is_default = 1' . COM_getPermSQL('AND'));
        if (!empty($topic)) {
            $args['tid'] = $topic;
        } else {
            // otherwise, just use the first one
            $o = array();
            $s = array();
            if (service_getTopicList_story(array('gl_svc' => true), $o, $s) == PLG_RET_OK) {
                $args['tid'] = $o[0];
            } else {
                $svc_msg['error_desc'] = 'No topics available';
                return PLG_RET_ERROR;
            }
        }
    }
    if (empty($args['owner_id'])) {
        $args['owner_id'] = $_USER['uid'];
    }
    if (empty($args['group_id'])) {
        $args['group_id'] = SEC_getFeatureGroup('story.edit', $_USER['uid']);
    }
    if (isset($args['alternate_id']) && $args['tid'] == $args['alternate_id']) {
        $args['alternate_id'] = NULL;
    }
    if (empty($args['postmode'])) {
        $args['postmode'] = $_CONF['postmode'];
        if (!empty($args['content_type'])) {
            if ($args['content_type'] == 'text') {
                $args['postmode'] = 'text';
            } else {
                if ($args['content_type'] == 'html' || $args['content_type'] == 'xhtml') {
//.........这里部分代码省略.........
开发者ID:NewRoute,项目名称:glfusion,代码行数:101,代码来源:lib-story.php

示例14: loadFromDatabase

 /**
  * Load a Story object from the sid specified, returning a status result.
  * The result will either be a permission denied message, invalid SID
  * message, or a loaded ok message. If it's loaded ok, then we've got all
  * the exciting gubbins here.
  *
  * Only used from story admin and submit.php!
  *
  * @param $sid  string  Story Identifier, valid geeklog story id from the db.
  * @return Integer from a constant.
  */
 function loadFromDatabase($sid, $mode = 'edit')
 {
     global $_TABLES, $_CONF, $_USER;
     $sid = addslashes(COM_applyFilter($sid));
     if (!empty($sid) && ($mode == 'edit' || $mode == 'view')) {
         $sql = array();
         $sql['mysql'] = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, " . "u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t " . "WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND (sid = '{$sid}')";
         $sql['mssql'] = "SELECT STRAIGHT_JOIN s.sid, s.uid, s.draft_flag, s.tid, s.date, s.title, CAST(s.introtext AS text) AS introtext, CAST(s.bodytext AS text) AS bodytext, s.hits, s.numemails, s.comments, s.trackbacks, s.related, s.featured, s.show_topic_icon, s.commentcode, s.trackbackcode, s.statuscode, s.expire, s.postmode, s.frontpage, s.owner_id, s.group_id, s.perm_owner, s.perm_group, s.perm_members, s.perm_anon, s.advanced_editor_mode, " . " UNIX_TIMESTAMP(s.date) AS unixdate, UNIX_TIMESTAMP(s.expire) AS expireunix, UNIX_TIMESTAMP(s.comment_expire) AS cmt_expire_unix, " . "u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t " . "WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND (sid = '{$sid}')";
     } elseif (!empty($sid) && $mode == 'editsubmission') {
         $sql = 'SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, ' . 'u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl, t.group_id, ' . 't.perm_owner, t.perm_group, t.perm_members, t.perm_anon ' . 'FROM ' . $_TABLES['storysubmission'] . ' AS s, ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topics'] . ' AS t WHERE (s.uid = u.uid) AND' . ' (s.tid = t.tid) AND (sid = \'' . $sid . '\')';
     } elseif ($mode == 'edit') {
         $this->_sid = COM_makesid();
         $this->_old_sid = $this->_sid;
         if (isset($_CONF['draft_flag'])) {
             $this->_draft_flag = $_CONF['draft_flag'];
         } else {
             $this->_draft_flag = 0;
         }
         if (isset($_CONF['show_topic_icon'])) {
             $this->_show_topic_icon = $_CONF['show_topic_icon'];
         } else {
             $this->_show_topic_icon = 1;
         }
         if (COM_isAnonUser()) {
             $this->_uid = 1;
         } else {
             $this->_uid = $_USER['uid'];
         }
         $this->_date = time();
         $this->_expire = time();
         if ($_CONF['article_comment_close_enabled']) {
             $this->_comment_expire = time() + $_CONF['article_comment_close_days'] * 86400;
         } else {
             $this->_comment_expire = 0;
         }
         $this->_commentcode = $_CONF['comment_code'];
         $this->_trackbackcode = $_CONF['trackback_code'];
         $this->_title = '';
         $this->_meta_description = '';
         $this->_meta_keywords = '';
         $this->_introtext = '';
         $this->_bodytext = '';
         if (isset($_CONF['frontpage'])) {
             $this->_frontpage = $_CONF['frontpage'];
         } else {
             $this->_frontpage = 1;
         }
         $this->_hits = 0;
         $this->_comments = 0;
         $this->_trackbacks = 0;
         $this->_numemails = 0;
         if (isset($_CONF['advanced_editor']) && $_CONF['advanced_editor'] && $_CONF['postmode'] != 'plaintext') {
             $this->_advanced_editor_mode = 1;
             $this->_postmode = 'adveditor';
         } else {
             $this->_postmode = $_CONF['postmode'];
             $this->_advanced_editor_mode = 0;
         }
         $this->_statuscode = 0;
         $this->_featured = 0;
         if (COM_isAnonUser()) {
             $this->_owner_id = 1;
         } else {
             $this->_owner_id = $_USER['uid'];
         }
         if (isset($_GROUPS['Story Admin'])) {
             $this->_group_id = $_GROUPS['Story Admin'];
         } else {
             $this->_group_id = SEC_getFeatureGroup('story.edit');
         }
         $array = array();
         SEC_setDefaultPermissions($array, $_CONF['default_permissions_story']);
         $this->_perm_owner = $array['perm_owner'];
         $this->_perm_group = $array['perm_group'];
         $this->_perm_anon = $array['perm_anon'];
         $this->_perm_members = $array['perm_members'];
     } else {
         $this->loadFromArgsArray($_POST);
     }
     /* if we have SQL, load from it */
     if (!empty($sql)) {
         $result = DB_query($sql);
         if ($result) {
             $story = DB_fetchArray($result, false);
             if ($story == null) {
                 return STORY_INVALID_SID;
             }
             $this->loadFromArray($story);
             if (!isset($story['owner_id'])) {
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:story.class.php

示例15: loadFromDatabase


//.........这里部分代码省略.........
         $this->_page_title = '';
         $this->_meta_description = '';
         $this->_meta_keywords = '';
         $this->_introtext = '';
         $this->_bodytext = '';
         if (isset($_CONF['frontpage'])) {
             $this->_frontpage = $_CONF['frontpage'];
         } else {
             $this->_frontpage = 1;
         }
         $this->_text_version = GLTEXT_LATEST_VERSION;
         $this->_hits = 0;
         $this->_comments = 0;
         $this->_trackbacks = 0;
         $this->_numemails = 0;
         if ($_CONF['advanced_editor'] && $_USER['advanced_editor'] && $_CONF['postmode'] !== 'plaintext' && $_CONF['postmode'] !== 'wikitext') {
             $this->_advanced_editor_mode = 1;
             $this->_postmode = 'adveditor';
         } else {
             $this->_postmode = $_CONF['postmode'];
             $this->_advanced_editor_mode = 0;
         }
         $this->_statuscode = 0;
         $this->_featured = 0;
         $this->_cache_time = $_CONF['default_cache_time_article'];
         if (COM_isAnonUser()) {
             $this->_owner_id = 1;
         } else {
             $this->_owner_id = $_USER['uid'];
         }
         if (isset($_GROUPS['Story Admin'])) {
             $this->_group_id = $_GROUPS['Story Admin'];
         } else {
             $this->_group_id = SEC_getFeatureGroup('story.edit');
         }
         $array = array();
         SEC_setDefaultPermissions($array, $_CONF['default_permissions_story']);
         $this->_perm_owner = $array['perm_owner'];
         $this->_perm_group = $array['perm_group'];
         $this->_perm_anon = $array['perm_anon'];
         $this->_perm_members = $array['perm_members'];
     } else {
         $this->loadFromArgsArray($_POST);
     }
     // if we have SQL, load from it
     if (!empty($sql)) {
         $result = DB_query($sql);
         if ($result) {
             $story = DB_fetchArray($result, false);
             if ($story == null) {
                 return STORY_INVALID_SID;
             }
             $this->loadFromArray($story);
             /**
              * The above SQL also got the story owner's username etc. from
              * the DB. If the user doing the cloning is different from the
              * original author, we need to fix those here.
              */
             if ($mode === 'clone' && $this->_uid != $_USER['uid']) {
                 $this->_uid = $_USER['uid'];
                 $story['owner_id'] = $this->_uid;
                 $uResult = DB_query("SELECT username, fullname, photo, email FROM {$_TABLES['users']} WHERE uid = {$_USER['uid']}");
                 list($this->_username, $this->_fullname, $this->_photo, $this->_email) = DB_fetchArray($uResult);
             }
             if (!isset($story['owner_id'])) {
                 $story['owner_id'] = 1;
开发者ID:mystralkk,项目名称:geeklog,代码行数:67,代码来源:story.class.php


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