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


PHP SEC_setDefaultPermissions函数代码示例

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


在下文中一共展示了SEC_setDefaultPermissions函数的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: _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

示例3: plugin_postinstall_nexproject

/**
* Plugin postinstall
*
* We're inserting our default data here since it depends on other stuff that
* has to happen first ...
*
* @return   boolean     true = proceed with install, false = an error occured
*
*/
function plugin_postinstall_nexproject($pi_name)
{
    global $_DB_dbms, $_CONF, $_DB_table_prefix, $_TABLES;
    require_once $_CONF['path'] . 'plugins/nexproject/nexproject.php';
    // fix nexproject block group ownership
    $blockAdminGroup = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Block Admin'");
    if ($blockAdminGroup > 0) {
        // set the block's permissions
        $A = array();
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_block']);
        // ... and make it the last block on the right side
        $result = DB_query("SELECT MAX(blockorder) FROM {$_TABLES['blocks']} WHERE onleft = 0");
        list($order) = DB_fetchArray($result);
        $order += 10;
        DB_query("UPDATE {$_TABLES['blocks']} SET group_id = {$blockAdminGroup}, blockorder = {$order}, perm_owner = {$A['perm_owner']}, perm_group = {$A['perm_group']}, perm_members = {$A['perm_members']}, perm_anon = {$A['perm_anon']} WHERE (type = 'phpblock') AND (phpblockfn = 'phpblock_nexproject')");
    }
    $nexfile = true;
    if (!function_exists("fm_createCategory")) {
        //COM_errorLog ('The nexFile plugin is not installed.  Please install it before continuing', 1);
        //echo COM_refresh ($_CONF['site_admin_url'] . '/plugins.php?msg=2&plugin='.$pi_name);
        //exit(0);
        $nexfile = false;
    }
    $forum = true;
    if (!function_exists("forum_addForum")) {
        //COM_errorLog ('The forum plugin is not installed.  Please install it before continuing', 1);
        //echo COM_refresh ($_CONF['site_admin_url'] . '/plugins.php?msg=4&plugin='.$pi_name);
        //exit(0);
        $forum = false;
    }
    //And now, install the lookup lists and add nxprj config values to house the nexlist items
    $sql = "insert into {$_TABLES['nexlist']} (plugin, category, name, description, listfields, edit_perms, view_perms, active)\r\n    values (    'all','nexPro',    'Locations',    'List of locations', 1, 1, 2, 1);";
    $res = DB_query($sql);
    $locID = DB_insertId();
    $sql = "insert into {$_TABLES['nexlist']} (plugin, category, name, description, listfields, edit_perms, view_perms, active)\r\n    values ('all','nexPro','Departments','List of Departments', 1, 1, 2, 1);";
    $res = DB_query($sql);
    $deptID = DB_insertId();
    $sql = "insert into {$_TABLES['nexlist']} (plugin, category, name, description, listfields, edit_perms, view_perms, active)\r\n    values ('all','nexPro', 'Categories','List of Categories', 1, 1, 2, 1);";
    $res = DB_query($sql);
    $catID = DB_insertId();
    $sql = "INSERT INTO {$_TABLES['nexlist']} (plugin, category, name, description, listfields, edit_perms, view_perms, active)\r\n    VALUES ('all', 'nexPro', 'Objectives', 'List of Project Objectives', 1, 1, 2, 1);";
    $res = DB_query($sql);
    $objID = DB_insertId();
    /* create lookuplist Fields for list definitions */
    $_PRJSQL[] = "insert into {$_TABLES['nexlistfields']} (lid, fieldname) values('{$locID}','Location' )";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistfields']} (lid, fieldname) values('{$deptID}','Department' )";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistfields']} (lid, fieldname) values('{$catID}','Department' )";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistfields']} (lid, fieldname) values('{$objID}','Objective' )";
    /* create lookuplist list records for each definition */
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 10, 'Toronto',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 20, 'Hong Kong',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 30, 'Brisbane',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 40, 'Tokyo',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 50, 'New York',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 60, 'San Fransisco',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$locID}', 70, 'London',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 10, 'Sales',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 20, 'Information Technology',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 30, 'Marketing',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 40, 'Finance',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 50, 'Operations',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 60, 'Legal',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$deptID}', 70, 'Revenue',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 10, 'Revenue',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 20, 'Safety',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 30, 'Environment',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 40, 'Training',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 50, 'Product Development',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 60, 'Branding',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 70, 'Investment',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) values ('{$catID}', 80, 'Capital Expenditure',1)";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) VALUES ('{$objID}', 90, 'Business Growth', 1);";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) VALUES ('{$objID}', 100, 'Product Development', 1);";
    $_PRJSQL[] = "insert into {$_TABLES['nexlistitems']} (lid, itemorder, value, active) VALUES ('{$objID}', 110, 'Objective 3', 1);";
    foreach ($_PRJSQL as $sql) {
        DB_query($sql);
        if (DB_error()) {
            $err = 1;
        }
    }
    $c = config::get_instance();
    $c->add('prj_list', NULL, 'fieldset', 0, 1, NULL, 0, true, 'nexproject');
    $c->add('nexlist_locations', $locID, 'text', 0, 1, 0, 150, true, 'nexproject');
    $c->add('nexlist_departments', $deptID, 'text', 0, 1, 0, 160, true, 'nexproject');
    $c->add('nexlist_category', $catID, 'text', 0, 1, 0, 170, true, 'nexproject');
    $c->add('nexlist_objective', $objID, 'text', 0, 1, 0, 180, true, 'nexproject');
    //we are assuming that nexfile and the forum are installed here.  We cannot get this far if they werent!
    //the first thing we do is create a new nexFile category which will be used as the base category ID to dump files into for projects
    if ($nexfile) {
        $arr = fm_createCategory(0, 'nexProject Category', 'This base category is used by the nexProject plugin to create document repositories for each project.', true);
        //config parms for this
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:autoinstall.php

示例4: staticpageeditor_form

/**
* Displays the static page editor form
*
* @param    array   $A      Data to display
* @return   string          HTML for the static page editor
*
*/
function staticpageeditor_form($A)
{
    global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id, $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG01, $LANG24, $LANG_postmodes, $MESSAGE, $_IMAGE_TYPE, $_SCRIPTS;
    if (!empty($sp_id) && $mode == 'edit') {
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
    } else {
        if ($mode != 'clone') {
            $A['sp_inblock'] = $_SP_CONF['in_block'];
        }
        $A['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['Static Page Admin'])) {
            $A['group_id'] = $_GROUPS['Static Page Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('staticpages.edit');
        }
        SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']);
        $access = 3;
        if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
            $A['advanced_editor_mode'] = 1;
        }
    }
    $retval = '';
    $sp_template = COM_newTemplate(CTL_plugin_templatePath('staticpages', 'admin'));
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        $sp_template->set_file('form', 'editor_advanced.thtml');
        // Shouldn't really have to check if anonymous user but who knows...
        if (COM_isAnonUser()) {
            $link_message = "";
        } else {
            $link_message = $LANG01[138];
        }
        $sp_template->set_var('noscript', COM_getNoScript(false, '', $link_message));
        // Setup Advanced Editor
        COM_setupAdvancedEditor('/staticpages/adveditor.js', 'staticpages.edit');
        $sp_template->set_var('lang_expandhelp', $LANG24[67]);
        $sp_template->set_var('lang_reducehelp', $LANG24[68]);
        $sp_template->set_var('lang_toolbar', $LANG24[70]);
        $sp_template->set_var('toolbar1', $LANG24[71]);
        $sp_template->set_var('toolbar2', $LANG24[72]);
        $sp_template->set_var('toolbar3', $LANG24[73]);
        $sp_template->set_var('toolbar4', $LANG24[74]);
        $sp_template->set_var('toolbar5', $LANG24[75]);
        $sp_template->set_var('lang_nojavascript', $LANG24[77]);
        $sp_template->set_var('lang_postmode', $LANG24[4]);
        if (isset($A['postmode']) && $A['postmode'] == 'adveditor') {
            $sp_template->set_var('show_adveditor', '');
            $sp_template->set_var('show_htmleditor', 'none');
        } else {
            $sp_template->set_var('show_adveditor', 'none');
            $sp_template->set_var('show_htmleditor', '');
        }
        $post_options = '<option value="html" selected="selected">' . $LANG_postmodes['html'] . '</option>';
        if (isset($A['postmode']) && $A['postmode'] == 'adveditor') {
            $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>';
        } else {
            $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>';
        }
        $sp_template->set_var('post_options', $post_options);
        $sp_template->set_var('change_editormode', 'onchange="change_editmode(this);"');
    } else {
        $sp_template->set_file('form', 'editor.thtml');
    }
    // Add JavaScript
    if ($_CONF['titletoid']) {
        $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js');
        $sp_template->set_var('titletoid', true);
    }
    $sp_template->set_var('lang_mode', $LANG24[3]);
    $sp_template->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $A['commentcode']));
    $sp_template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $sp_template->set_var('lang_owner', $LANG_ACCESS['owner']);
    $owner_name = COM_getDisplayName($A['owner_id']);
    $owner_username = DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}");
    $sp_template->set_var('owner_id', $A['owner_id']);
    $sp_template->set_var('owner', $owner_name);
    $sp_template->set_var('owner_name', $owner_name);
    $sp_template->set_var('owner_username', $owner_username);
    if ($A['owner_id'] > 1) {
        $profile_link = $_CONF['site_url'] . '/users.php?mode=profile&amp;uid=' . $A['owner_id'];
        $sp_template->set_var('start_owner_anchortag', '<a href="' . $profile_link . '">');
        $sp_template->set_var('end_owner_anchortag', '</a>');
        $sp_template->set_var('owner_link', COM_createLink($owner_name, $profile_link));
        $photo = '';
        if ($_CONF['allow_user_photo']) {
            $photo = DB_getItem($_TABLES['users'], 'photo', "uid = {$A['owner_id']}");
            if (!empty($photo)) {
                $camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . XHTML . '>';
                $sp_template->set_var('camera_icon', COM_createLink($camera_icon, $profile_link));
            }
        }
        if (empty($photo)) {
            $sp_template->set_var('camera_icon', '');
        }
//.........这里部分代码省略.........
开发者ID:milk54,项目名称:geeklog-japan,代码行数:101,代码来源:index.php

示例5: 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

示例6: editlink

/**
* Shows the links editor
*
* @param  string  $mode   Used to see if we are moderating a link or simply editing one
* @param  string  $lid    ID of link to edit
* @global array core config vars
* @global array core group data
* @global array core table data
* @global array core user data
* @global array links plugin config vars
* @global array links plugin lang vars
* @global array core lang access vars
* @return string HTML for the link editor form
*
*/
function editlink($mode, $lid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $_LI_CONF, $LANG_LINKS_ADMIN, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
    $retval = '';
    $link_templates = COM_newTemplate(CTL_plugin_templatePath('links', 'admin'));
    $link_templates->set_file('editor', 'linkeditor.thtml');
    $link_templates->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]);
    $link_templates->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]);
    $link_templates->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]);
    $link_templates->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]);
    $link_templates->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]);
    $link_templates->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]);
    $link_templates->set_var('lang_admin_home', $LANG_ADMIN['admin_home']);
    $link_templates->set_var('instructions', $LANG_LINKS_ADMIN[29]);
    if ($mode != 'editsubmission' and !empty($lid)) {
        $result = DB_query("SELECT * FROM {$_TABLES['links']} WHERE lid ='{$lid}'");
        if (DB_numRows($result) !== 1) {
            $msg = COM_showMessageText($LANG_LINKS_ADMIN[25], $LANG_LINKS_ADMIN[24]);
            return $msg;
        }
        $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_showMessageText($LANG_LINKS_ADMIN[17], $LANG_LINKS_ADMIN[16]);
            COM_accessLog("User {$_USER['username']} tried to illegally submit or edit link {$lid}.");
            return $retval;
        }
    } else {
        if ($mode == 'editsubmission') {
            $result = DB_query("SELECT * FROM {$_TABLES['linksubmission']} WHERE lid = '{$lid}'");
            $A = DB_fetchArray($result);
        } else {
            $A['lid'] = COM_makesid();
            $A['cid'] = '';
            $A['url'] = '';
            $A['description'] = '';
            $A['title'] = '';
            $A['owner_id'] = $_USER['uid'];
        }
        $A['hits'] = 0;
        if (isset($_GROUPS['Links Admin'])) {
            $A['group_id'] = $_GROUPS['Links Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('links.edit');
        }
        SEC_setDefaultPermissions($A, $_LI_CONF['default_permissions']);
        $access = 3;
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG_LINKS_ADMIN[1], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    $link_templates->set_var('link_id', $A['lid']);
    if (!empty($lid) && SEC_hasRights('links.edit')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $link_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $link_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        if ($mode == 'editsubmission') {
            $link_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>');
        }
    }
    $link_templates->set_var('lang_linktitle', $LANG_LINKS_ADMIN[3]);
    $link_templates->set_var('link_title', htmlspecialchars(stripslashes($A['title'])));
    $link_templates->set_var('lang_linkid', $LANG_LINKS_ADMIN[2]);
    $link_templates->set_var('lang_linkurl', $LANG_LINKS_ADMIN[4]);
    $link_templates->set_var('max_url_length', 255);
    $link_templates->set_var('link_url', $A['url']);
    $link_templates->set_var('lang_includehttp', $LANG_LINKS_ADMIN[6]);
    $link_templates->set_var('lang_category', $LANG_LINKS_ADMIN[5]);
    $othercategory = links_select_box(3, $A['cid']);
    $link_templates->set_var('category_options', $othercategory);
    $link_templates->set_var('lang_ifotherspecify', $LANG_LINKS_ADMIN[20]);
    $link_templates->set_var('category', $othercategory);
    $link_templates->set_var('lang_linkhits', $LANG_LINKS_ADMIN[8]);
    $link_templates->set_var('link_hits', $A['hits']);
    $link_templates->set_var('lang_linkdescription', $LANG_LINKS_ADMIN[9]);
    $link_templates->set_var('link_description', stripslashes($A['description']));
    $allowed = COM_allowedHTML('links.edit') . COM_allowedAutotags();
    $link_templates->set_var('lang_allowed_html', $allowed);
    $link_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $link_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    // user access info
    $link_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $link_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
//.........这里部分代码省略.........
开发者ID:milk54,项目名称:geeklog-japan,代码行数:101,代码来源:index.php

示例7: getUserMarkerForm


//.........这里部分代码省略.........
        if ($_MAPS_CONF['fax'] == 1) {
            $template->set_var('fax', '<input type="text" name="fax" value="' . $marker['fax'] . '" size="20" maxlength="20">');
        } else {
            $template->set_var('fax', $LANG_MAPS_1['not_use_see_config']);
        }
        $template->set_var('web_label', $LANG_MAPS_1['web_label']);
        if ($_MAPS_CONF['web'] == 1) {
            $template->set_var('web', '<input type="text" name="web" value="' . stripslashes($marker['web']) . '" size="80" maxlength="255">');
        } else {
            $template->set_var('web', $LANG_MAPS_1['not_use_see_config']);
        }
        //Tab ressources
        $template->set_var('ressources_tab', $LANG_MAPS_1['ressources_tab']);
        $template->set_var('max_char', $LANG_MAPS_1['max_char']);
        $arr = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
        $ressources = '';
        foreach ($arr as &$value) {
            if ($_MAPS_CONF['item_' . $value] == '') {
                $template->set_var('item_' . $value . '_label', '');
                $template->set_var('item_' . $value, '');
                $ressources .= '';
            } else {
                $template->set_var('item_' . $value . '_label', $_MAPS_CONF['item_' . $value]);
                $template->set_var('item_' . $value, $marker['item_' . $value]);
                $ressources .= '<p>' . $_MAPS_CONF['item_' . $value] . ' <input type"text" name="item_' . $value . '" size="80" maxlength="255" value="' . $marker['item_' . $value] . '"></p>';
            }
        }
        if ($ressources == '') {
            $ressources = $LANG_MAPS_1['empty_ressources'];
        }
        $template->set_var('ressources', $ressources);
        // Permissions
        if ($marker['perm_owner'] == '') {
            SEC_setDefaultPermissions($marker, $_MAPS_CONF['default_permissions']);
        }
        $template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
        $template->set_var('lang_owner', $LANG_ACCESS['owner']);
        if ($marker['owner_id'] == '') {
            $marker['owner_id'] = $_USER['uid'];
        }
        $ownername = COM_getDisplayName($marker['owner_id']);
        $template->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$marker['owner_id']}"));
        $template->set_var('owner_name', $ownername);
        $template->set_var('owner', $ownername);
        $template->set_var('owner_id', $marker['owner_id']);
        if ($marker['group_id'] == '') {
            $marker['group_id'] = $_GROUPS['Maps Admin'];
        }
        $template->set_var('lang_group', $LANG_ACCESS['group']);
        //Todo make group = maps.admin
        $access = 3;
        $template->set_var('group_dropdown', SEC_getGroupDropdown($marker['group_id'], $access));
        $template->set_var('permissions_editor', SEC_getPermissionsHTML($marker['perm_owner'], $marker['perm_group'], $marker['perm_members'], $marker['perm_anon']));
        $template->set_var('lang_permissions', $LANG_ACCESS['permissions']);
        $template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
        $template->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
        $template->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
        //Form validation
        $template->set_var('submission', $marker['submission']);
        $template->set_var('save_button', $LANG_MAPS_1['save_button']);
        $template->set_var('delete_button', $LANG_MAPS_1['delete_button']);
        $template->set_var('ok_button', $LANG_MAPS_1['ok_button']);
        $template->set_var('mkid', '<input type="hidden" name="mkid" value="' . $marker['mkid'] . '" />');
        $display .= $template->parse('output', 'map');
    }
    $display .= COM_endBlock();
开发者ID:ivywe,项目名称:maps,代码行数:67,代码来源:markers.php

示例8: 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

示例9: 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

示例10: 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

示例11: PAYPAL_getProductForm


//.........这里部分代码省略.........
    $template->set_var('per_item', $LANG_PAYPAL_ADMIN['per_item']);
    //shipping
    $template->set_var('shipping_type', $LANG_PAYPAL_ADMIN['shipping_type']);
    $template->set_var('shipping_type_ini', $product['shipping_type']);
    $shipping_options = '';
    if ($product['shipping_type'] == 0) {
        $selected0 = ' selected="selected"';
        $selected1 = '';
    } else {
        $selected1 = ' selected="selected"';
        $selected0 = '';
    }
    $shipping_options .= '<option value="0"' . $selected0 . '>' . $LANG_PAYPAL_ADMIN['shipping_options'][0] . '</option>';
    $shipping_options .= '<option value="1"' . $selected1 . '>' . $LANG_PAYPAL_ADMIN['shipping_options'][1] . '</option>';
    $template->set_var('shipping_options', $shipping_options);
    $template->set_var('yes', $LANG_PAYPAL_1['yes']);
    $template->set_var('no', $LANG_PAYPAL_1['no']);
    $template->set_var('save_button', $LANG_PAYPAL_1['save_button']);
    $template->set_var('delete_button', $LANG_PAYPAL_1['delete_button']);
    $template->set_var('ok_button', $LANG_PAYPAL_1['ok_button']);
    $template->set_var('required_field', $LANG_PAYPAL_1['required_field']);
    if ($product['product_type'] == 1) {
        $template->set_var('download_yes', ' selected');
        $template->set_var('download_no', '');
    } else {
        $template->set_var('download_yes', '');
        $template->set_var('download_no', ' selected');
    }
    $template->set_var('file', $product['file']);
    $template->set_var('expiration', $product['expiration']);
    //Subscription
    $type != 'subscription' ? $template->set_var('display_subscription', 'display:none;') : $template->set_var('display_subscription', '');
    $template->set_var('subscription_product_label', $LANG_PAYPAL_1['subscription_label']);
    $template->set_var('duration_label', $LANG_PAYPAL_1['duration_label']);
    $template->set_var('duration', $product['duration']);
    $product['duration_type'] == 'day' ? $template->set_var('sel_day', ' selected="selected"') : '';
    $template->set_var('day', $LANG_PAYPAL_1['day']);
    $product['duration_type'] == 'week' ? $template->set_var('sel_week', ' selected="selected"') : '';
    $template->set_var('week', $LANG_PAYPAL_1['week']);
    $product['duration_type'] == 'month' ? $template->set_var('sel_month', ' selected="selected"') : '';
    $template->set_var('month', $LANG_PAYPAL_1['month']);
    $product['duration_type'] == 'year' ? $template->set_var('sel_year', ' selected="selected"') : '';
    $template->set_var('year', $LANG_PAYPAL_1['year']);
    //Recurrent
    if ($type != 'recurrent') {
        $template->set_var('display_recurrent', 'display:none;');
        $template->set_var('add_to_group_label', $LANG_PAYPAL_1['recurrent_add_to_group']);
    } else {
        $template->set_var('display_recurrent', '');
    }
    $template->set_var('recurrent_product_label', $LANG_PAYPAL_1['recurrent_product_label']);
    $template->set_var('add_to_group_label', $LANG_PAYPAL_1['recurrent_add_to_group']);
    $template->set_var('period_label', $LANG_PAYPAL_1['period_label']);
    $template->set_var('billing_label', $LANG_PAYPAL_1['billing_label']);
    $template->set_var('billingamt', $product['billingamt']);
    $template->set_var('frequency_label', $LANG_PAYPAL_1['frequency_label']);
    $template->set_var('frequency_help', $LANG_PAYPAL_1['frequency_help']);
    $template->set_var('duration_recurrent', $product['duration']);
    $product['duration_type'] == 'Day' ? $template->set_var('sel_recurrent_day', ' selected="selected"') : '';
    $template->set_var('recurrent_day', $LANG_PAYPAL_1['recurrent_day']);
    $product['duration_type'] == 'Week' ? $template->set_var('sel_recurrent_week', ' selected="selected"') : '';
    $template->set_var('recurrent_week', $LANG_PAYPAL_1['recurrent_week']);
    $product['duration_type'] == 'SemiMonth' ? $template->set_var('sel_recurrent_semimonth', ' selected="selected"') : '';
    $template->set_var('recurrent_semimonth', $LANG_PAYPAL_1['recurrent_semimonth']);
    $product['duration_type'] == 'Month' ? $template->set_var('sel_recurrent_month', ' selected="selected"') : '';
    $template->set_var('recurrent_month', $LANG_PAYPAL_1['recurrent_month']);
    $product['duration_type'] == 'Year' ? $template->set_var('sel_recurrent_year', ' selected="selected"') : '';
    $template->set_var('recurrent_year', $LANG_PAYPAL_1['recurrent_year']);
    //Group select list
    $template->set_var('add_to_group_options', COM_optionList($_TABLES['groups'], 'grp_id,grp_name', $product['add_to_group'], 1));
    // Permissions
    if ($product['perm_owner'] == '') {
        SEC_setDefaultPermissions($product, $_PAY_CONF['default_permissions']);
    }
    $template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $template->set_var('lang_owner', $LANG_ACCESS['owner']);
    if ($product['owner_id'] == '') {
        $product['owner_id'] = $_USER['uid'];
    }
    $ownername = COM_getDisplayName($product['owner_id']);
    $template->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$product['owner_id']}"));
    $template->set_var('owner_name', $ownername);
    $template->set_var('owner', $ownername);
    $template->set_var('owner_id', $product['owner_id']);
    if ($product['group_id'] == '') {
        $product['group_id'] = $_GROUPS['Paypal Admin'];
    }
    $template->set_var('lang_group', $LANG_ACCESS['group']);
    //Todo make group = paypal.admin
    $access = 3;
    $template->set_var('group_dropdown', SEC_getGroupDropdown($product['group_id'], $access));
    $template->set_var('permissions_editor', SEC_getPermissionsHTML($product['perm_owner'], $product['perm_group'], $product['perm_members'], $product['perm_anon']));
    $template->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $template->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $template->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $display .= $template->parse('output', 'product');
    $display .= COM_endBlock();
    return $display;
}
开发者ID:Geeklog-Plugins,项目名称:paypal,代码行数:101,代码来源:product_edit.php

示例12: fncSave


//.........这里部分代码省略.........
    // 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}'";
        } else {
            $values .= ",FROM_UNIXTIME('{$comment_expire}')";
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:67,代码来源:data.php

示例13: fncEdit


//.........这里部分代码省略.........
            $id = 0;
            $code = "";
            $title = "";
            $description = "";
            $defaulttemplatesdirectory = null;
            $hits = 0;
            $comments = 0;
            $comment_expire_flag = 0;
            $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
            $comment_expire_year = date('Y', $w);
            $comment_expire_month = date('m', $w);
            $comment_expire_day = date('d', $w);
            $comment_expire_hour = 0;
            $comment_expire_minute = 0;
            $commentcode = $_DATABOX_CONF['commentcode'];
            $trackbackcode = $_CONF[trackback_code];
            $cache_time = $_DATABOX_CONF[default_cache_time];
            $meta_description = "";
            $meta_keywords = "";
            $language_id = "";
            $category = "";
            $additionfields = array();
            $additionfields_fnm = array();
            //@@@@@
            $additionfields_del = array();
            $additionfields_date = "";
            $additionfields = DATABOX_getadditiondatas(0, $pi_name);
            //
            $owner_id = $_USER['uid'];
            //@@@@@
            //$group_id =SEC_getFeatureGroup('databox.admin', $_USER['uid']);;
            $group_id = $_DATABOX_CONF['grp_id_default'];
            $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['admin_draft_default'];
            //編集日付
            $modified_month = date('m');
            $modified_day = date('d');
            $modified_year = date('Y');
            $modified_hour = date('H');
            $modified_minute = date('i');
            //作成日付
            $created = 0;
            $created_un = 0;
            //公開日
            $released_month = $modified_month;
            $released_day = $modified_day;
            $released_year = $modified_year;
            $released_hour = $modified_hour;
            $released_minute = $modified_minute;
            //公開終了日
            $expired_flag = 0;
            $w = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
            $expired_year = date('Y', $w);
            $expired_month = date('m', $w);
            $expired_day = date('d', $w);
            $expired_hour = 0;
            $expired_minute = 0;
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:67,代码来源:data.php

示例14: DLM_convertData


//.........这里部分代码省略.........
        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);
            if (!$_SUCCESS) {
                $retval .= '<p>' . $_LANG_CONV['unable_to_conv_catimg'] . $catimg_src . '</p>' . LB;
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:67,代码来源:fm2dm.php

示例15: plugin_postinstall

/**
* When the install went through, give the plugin a chance for any
* plugin-specific post-install fixes
*
* @return   boolean     true = proceed with install, false = an error occured
*
*/
function plugin_postinstall()
{
    global $_CONF, $_TABLES;
    // fix Polls block group ownership
    $blockAdminGroup = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Block Admin'");
    if ($blockAdminGroup > 0) {
        // set the block's permissions
        $A = array();
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_block']);
        // ... and make it the last block on the right side
        $result = DB_query("SELECT MAX(blockorder) FROM {$_TABLES['blocks']} WHERE onleft = 0");
        list($order) = DB_fetchArray($result);
        $order += 10;
        DB_query("UPDATE {$_TABLES['blocks']} SET group_id = {$blockAdminGroup}, blockorder = {$order}, perm_owner = {$A['perm_owner']}, perm_group = {$A['perm_group']}, perm_members = {$A['perm_members']}, perm_anon = {$A['perm_anon']} WHERE (type = 'phpblock') AND (phpblockfn = 'phpblock_polls')");
        return true;
    }
    return false;
}
开发者ID:hostellerie,项目名称:nexpro,代码行数:25,代码来源:install.php


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