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


PHP COM_showMessageText函数代码示例

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


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

示例1: MG_saveEnroll

function MG_saveEnroll()
{
    global $_CONF, $_MG_CONF, $_MG_USERPREFS, $_TABLES, $_USER, $LANG_MG03;
    if ($_MG_CONF['member_albums'] != 1) {
        echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
        exit;
    }
    if (!isset($_MG_CONF['member_quota'])) {
        $_MG_CONF['member_quota'] = 0;
    }
    $sql = "SELECT album_id FROM {$_TABLES['mg_albums']} WHERE owner_id=" . (int) $_USER['uid'] . " AND album_parent=" . $_MG_CONF['member_album_root'];
    $result = DB_query($sql);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        $display = MG_siteHeader();
        $display .= COM_showMessageText($LANG_MG03['existing_member_album'], '', true);
        $display .= MG_siteFooter();
        echo $display;
        exit;
    }
    $uid = (int) $_USER['uid'];
    $aid = plugin_user_create_mediagallery($uid, 1);
    $result = DB_query("UPDATE {$_TABLES['mg_userprefs']} SET member_gallery=1,quota=" . $_MG_CONF['member_quota'] . " WHERE uid=" . $uid, 1);
    $affected = DB_affectedRows($result);
    if (DB_error()) {
        $sql = "INSERT INTO {$_TABLES['mg_userprefs']} (uid, active, display_rows, display_columns, mp3_player, playback_mode, tn_size, quota, member_gallery) VALUES (" . $uid . ",1,0,0,-1,-1,-1," . $_MG_CONF['member_quota'] . ",1)";
        DB_query($sql, 1);
    }
    CACHE_remove_instance('menu');
    echo COM_refresh($_MG_CONF['site_url'] . '/album.php?aid=' . $aid);
    exit;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:32,代码来源:enroll.php

示例2: MG_invalidRequest

function MG_invalidRequest()
{
    global $LANG_MG02;
    $display = COM_showMessageText($LANG_MG02['generic_error']);
    $display = MG_createHTMLDocument($display);
    COM_output($display);
    exit;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:8,代码来源:admin.php

示例3: checkAccessRights

 /**
  * Check for access rights
  */
 public static function checkAccessRights()
 {
     global $MESSAGE, $_USER;
     if (!SEC_hasRights('language.edit')) {
         $content = COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
         $display = COM_createHTMLDocument($content, array('pagetitle' => $MESSAGE[30]));
         COM_accessLog("User {$_USER['username']} tried to illegally access the language administration screen.");
         COM_output($display);
         exit;
     }
 }
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:14,代码来源:language.class.php

示例4: MG_initAlbums

// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.          |
// |                                                                          |
// +--------------------------------------------------------------------------+
//
require_once '../../../lib-common.php';
require_once '../../auth.inc.php';
require_once $_CONF['path'] . 'plugins/mediagallery/include/init.php';
require_once $_MG_CONF['path_admin'] . 'navigation.php';
require_once $_CONF['path'] . 'plugins/mediagallery/include/classFrame.php';
MG_initAlbums();
// Only let admin users access this page
if (!SEC_hasRights('mediagallery.config')) {
    // Someone is trying to illegally access this page
    COM_errorLog("Someone has tried to illegally access the Media Gallery Configuration page.  User id: {$_USER['uid']}, Username: {$_USER['username']}", 1);
    $display = COM_siteHeader();
    $display .= COM_showMessageText($LANG_MG00['access_denied_msg'], $LANG_MG00['access_denied'], true);
    $display .= COM_siteFooter(true);
    echo $display;
    exit;
}
function MG_editConfig($msgString = '')
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_DIRECTION, $LANG04;
    $retval = '';
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file('admin', 'cfgedit.thtml');
    $T->set_var('site_url', $_MG_CONF['site_url']);
    if ($msgString != '') {
        $T->set_var('feedback', $msgString);
    }
    if (!isset($_MG_CONF['rating_max'])) {
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:cfgedit.php

示例5: handleIconUpload

/**
 * Upload new topic icon, replaces previous icon if one exists
 *
 * @param    string $tid ID of topic to prepend to filename
 * @return   string          filename of new photo (empty = no new photo)
 */
function handleIconUpload($tid)
{
    global $_CONF, $_TABLES, $LANG27;
    $upload = new Upload();
    if (!empty($_CONF['image_lib'])) {
        if ($_CONF['image_lib'] == 'imagemagick') {
            // Using imagemagick
            $upload->setMogrifyPath($_CONF['path_to_mogrify']);
        } elseif ($_CONF['image_lib'] == 'netpbm') {
            // using netPBM
            $upload->setNetPBM($_CONF['path_to_netpbm']);
        } elseif ($_CONF['image_lib'] == 'gdlib') {
            // using the GD library
            $upload->setGDLib();
        }
        $upload->setAutomaticResize(true);
        if (isset($_CONF['debug_image_upload']) && $_CONF['debug_image_upload']) {
            $upload->setLogFile($_CONF['path'] . 'logs/error.log');
            $upload->setDebug(true);
        }
        if (isset($_CONF['jpeg_quality'])) {
            $upload->setJpegQuality($_CONF['jpeg_quality']);
        }
    }
    $upload->setAllowedMimeTypes(array('image/gif' => '.gif', 'image/jpeg' => '.jpg,.jpeg', 'image/pjpeg' => '.jpg,.jpeg', 'image/x-png' => '.png', 'image/png' => '.png'));
    if (!$upload->setPath($_CONF['path_images'] . 'topics')) {
        $display = COM_showMessageText($upload->printErrors(false), $LANG27[29]);
        $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG27[29]));
        COM_output($display);
        exit;
        // don't return
    }
    $filename = '';
    // see if user wants to upload a (new) icon
    $newIcon = $_FILES['newicon'];
    if (!empty($newIcon['name'])) {
        $pos = strrpos($newIcon['name'], '.') + 1;
        $fExtension = substr($newIcon['name'], $pos);
        $filename = 'topic_' . $tid . '.' . $fExtension;
    }
    // do the upload
    if (!empty($filename)) {
        $upload->setFileNames($filename);
        $upload->setPerms('0644');
        if ($_CONF['max_topicicon_width'] > 0 && $_CONF['max_topicicon_height'] > 0) {
            $upload->setMaxDimensions($_CONF['max_topicicon_width'], $_CONF['max_topicicon_height']);
        } else {
            $upload->setMaxDimensions($_CONF['max_image_width'], $_CONF['max_image_height']);
        }
        if ($_CONF['max_topicicon_size'] > 0) {
            $upload->setMaxFileSize($_CONF['max_topicicon_size']);
        } else {
            $upload->setMaxFileSize($_CONF['max_image_size']);
        }
        $upload->uploadFiles();
        if ($upload->areErrors()) {
            $display = COM_showMessageText($upload->printErrors(false), $LANG27[29]);
            $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG27[29]));
            COM_output($display);
            exit;
            // don't return
        }
        if (strpos($_CONF['path_images'], $_CONF['path_html']) === 0) {
            $filename = substr($_CONF['path_images'], strlen($_CONF['path_html']) - 1) . 'topics/' . $filename;
        } else {
            /**
             * Not really used when the 'path_images' is outside of the webroot.
             * Let's at least extract the name of the images directory then.
             */
            $images = 'images';
            $parts = explode('/', $_CONF['path_images']);
            if (count($parts) > 1) {
                $cnt = count($parts);
                // e.g. from /path/to/myimages/ would extract "myimages"
                if (empty($parts[$cnt - 1]) && !empty($parts[$cnt - 2])) {
                    $images = $parts[$cnt - 2];
                }
                $filename = '/' . $images . '/topics/' . $filename;
            }
        }
    }
    return $filename;
}
开发者ID:mystralkk,项目名称:geeklog,代码行数:89,代码来源:topic.php

示例6: COM_applyFilter

$album_id = COM_applyFilter($_GET['aid'], true);
$media_id = COM_applyFilter($_GET['mid']);
$T = new Template(MG_getTemplatePath($album_id));
$T->set_file('page', 'view_image.thtml');
$T->set_var('header', $LANG_MG00['plugin']);
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('plugin', 'mediagallery');
//
// -- Verify that image really does belong to this album
//
$sql = "SELECT * FROM " . $_TABLES['mg_media_albums'] . " WHERE media_id='" . DB_escapeString($mid) . "' AND album_id='" . intval($aid) . "'";
$result = DB_query($sql);
if (DB_numRows($result) < 1) {
    die("ERROR #2");
}
// Get Album Info...
$sql = "SELECT * FROM " . $_TABLES['mg_albums'] . " WHERE album_id=" . intval($album_id);
$result = DB_query($sql);
$row = DB_fetchArray($result);
// Check access rights
$access = SEC_hasAccess($row['owner_id'], $row['group_id'], $row['perm_owner'], $row['perm_group'], $row['perm_members'], $row['perm_anon']);
if ($access == 0) {
    $display .= COM_siteHeader('menu') . COM_showMessageText($LANG_MG00['access_denied_msg'], $LANG_ACCESS['accessdenied'], true) . COM_siteFooter();
    echo $display;
    exit;
}
$sql = "SELECT * FROM " . $_TABLES['mg_media'] . " WHERE media_id='" . DB_escapeString($media_id) . "'";
$result = DB_query($sql);
$row = DB_fetchArray($result);
echo '<img src="' . $_MG_CONF['mediaobjects_url'] . '/disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.jpg' . '">';
exit;
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:media_popup.php

示例7: plugin_main

/**
* Show main plugin screen: installed and uninstalled plugins, upload form
*
* @param    string  $message    (optional) message to display
* @param    string  $token      an optional csrf token
* @return   string              HTML for the plugin screen
*
*/
function plugin_main($message = '', $token = '')
{
    global $LANG32;
    $retval = '';
    $retval .= COM_siteHeader('menu', $LANG32[5]);
    if (!empty($message)) {
        $retval .= COM_showMessageText($message);
    } else {
        $retval .= COM_showMessageFromParameter();
    }
    if (empty($token)) {
        $token = SEC_createToken();
    }
    $retval .= listplugins($token);
    if (SEC_hasRights('plugin.install')) {
        $retval .= show_newplugins($token);
    }
    // Show the upload form or an error message
    $retval .= plugin_show_uploadform($token);
    $retval .= COM_siteFooter();
    return $retval;
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:30,代码来源:plugins.php

示例8: COM_showMessageText

// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
require_once '../../../lib-common.php';
require_once '../../auth.inc.php';
require_once $_CONF['path'] . 'plugins/downloads/include/functions.php';
if (!SEC_hasRights('downloads.edit')) {
    $display = COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
    $display = DLM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
    COM_accessLog("User {$_USER['username']} tried to illegally access the downloads temporary file.");
    COM_output($display);
    exit;
}
COM_setArgNames(array('id'));
$lid = addslashes(COM_applyFilter(COM_getArgument('id')));
$result = DB_query("SELECT url, date FROM {$_TABLES['downloadsubmission']} WHERE lid='{$lid}'");
list($url, $date) = DB_fetchArray($result);
$filepath = $_DLM_CONF['path_filestore'] . 'tmp' . date('YmdHis', $date) . DLM_createSafeFileName($url);
if (file_exists($filepath)) {
    header('Content-Disposition: attachment; filename="' . $url . '"');
    header('Content-Type: application/octet-stream');
    header('Content-Description: File Transfer');
    header('Content-Transfer-Encoding: binary');
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:31,代码来源:tmpfile.php

示例9: _mg_savecomment

/**
 * Plugin function that is called after comment form is submitted.
 * Needs to at least save the comment and check return value.
 * Add any additional logic your plugin may need to perform on comments.
 *
 * $title       comment title
 * $comment     comment text
 * $id          Item id to which $cid belongs
 * $pid         comment parent
 * $postmode    'html' or 'text'
 *
 */
function _mg_savecomment($title, $comment, $id, $pid, $postmode)
{
    global $_CONF, $_MG_CONF, $_TABLES, $LANG03;
    $retval = '';
    $title = strip_tags($title);
    $pid = COM_applyFilter($pid, true);
    $postmode = COM_applyFilter($postmode);
    $ret = CMT_saveComment($title, $comment, $id, $pid, 'mediagallery', $postmode);
    if ($ret > 0) {
        $retval = '';
        if (SESS_isSet('glfusion.commentpresave.error')) {
            $retval = COM_showMessageText(SESS_getVar('glfusion.commentpresave.error'), '', true);
            SESS_unSet('glfusion.commentpresave.error');
        }
        $retval .= CMT_commentform($title, $comment, $id, $pid, 'mediagallery', $LANG03[14], $postmode);
        return $retval;
    } else {
        $comments = DB_count($_TABLES['comments'], array('sid', 'type'), array(DB_escapeString($id), 'mediagallery'));
        DB_change($_TABLES['mg_media'], 'media_comments', $comments, 'media_id', DB_escapeString($id));
        return COM_refresh($_MG_CONF['site_url'] . "/media.php?s={$id}#comments");
    }
}
开发者ID:spacequad,项目名称:glfusion,代码行数:34,代码来源:comment.inc.php

示例10: savesubmission

/**
* This will save a submission
*
* @param    string  $type   Type of submission we are dealing with
* @param    array   $A      Data for that submission
*
*/
function savesubmission($type, $A)
{
    global $_CONF, $_TABLES, $LANG12;
    COM_clearSpeedlimit($_CONF['speedlimit'], 'submit');
    $last = COM_checkSpeedlimit('submit');
    if ($last > 0) {
        $retval = COM_showMessageText($LANG12[30] . $last . $LANG12[31], $LANG12[26]);
        $retval = COM_createHTMLDocument($retval);
        return $retval;
    }
    if (!empty($type) && $type !== 'story') {
        // Update the submitspeedlimit for user - assuming Plugin approves
        // submission record
        COM_updateSpeedlimit('submit');
        // see if this is a submission that needs to be handled by a plugin
        // and should include its own redirect
        $retval = PLG_saveSubmission($type, $A);
        if ($retval === false) {
            COM_errorLog("Could not save your submission. Bad type: {$type}");
        } elseif (empty($retval)) {
            // plugin should include its own redirect - but in case handle
            // it here and redirect to the main page
            PLG_submissionSaved($type);
            COM_redirect($_CONF['site_url'] . '/index.php');
        } else {
            PLG_submissionSaved($type);
            return $retval;
        }
    }
    if (!empty($A['title']) && !empty($A['introtext']) && TOPIC_checkTopicSelectionControl()) {
        $retval = savestory($A);
        PLG_submissionSaved($type);
    } else {
        $retval = COM_showMessageText($LANG12[23], $LANG12[22]) . submissionform($type);
        $retval = COM_createHTMLDocument($retval);
    }
    return $retval;
}
开发者ID:mystralkk,项目名称:geeklog,代码行数:45,代码来源:submit.php

示例11: mgAlbum

    $retval .= $options;
    $retval .= '</select>' . LB;
    $retval .= '<input type="hidden" name="album_id" value="0"' . XHTML . '>' . LB;
    $retval .= '<input type="submit" value="' . $LANG_MG03['go'] . '"' . XHTML . '>' . LB;
    $retval .= '</div></form>' . LB;
    return $retval;
}
/*
* Main
*/
$album_id = 0;
$root_album = new mgAlbum(0);
// root album
if ($root_album->access == 0 || $root_album->hidden == 1 && $root_album->access != 3) {
    COM_errorLog("Media Gallery Error - User attempted to view an album that does not exist.");
    $display = COM_showMessageText($LANG_MG02['albumaccessdeny']);
    $display = MG_createHTMLDocument($display);
    COM_output($display);
    exit;
}
if ($_MG_CONF['usage_tracking']) {
    MG_updateUsage('MediaGallery', 'Main Menu', '', 0);
}
// initialize variables
$page = isset($_GET['page']) ? COM_applyFilter($_GET['page'], true) : 0;
$columns_per_page = $root_album->display_columns;
$rows_per_page = $root_album->display_rows;
$media_per_page = $columns_per_page * $rows_per_page;
if ($page != 0) {
    $page = $page - 1;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:31,代码来源:index.php

示例12: PLUGINS_remove

/**
* Remove a plugin that is sitting in the public/private tree.
* If they exist, the following directories are deleted recursively:
*
* 1. public_html/admin/plugins/{pi_name}
* 2. public_html/{pi_name}
* 3. private/plugins/{pi_name}
*
* @param    pi_name   string   name of the plugin to remove
* @return             string   HTML for error or success message
*
*/
function PLUGINS_remove($pi_name)
{
    global $_CONF, $LANG32;
    $retval = '';
    if (strlen($pi_name) == 0) {
        $retval .= COM_showMessageText($LANG32[12], $LANG32[13], true);
        COM_errorLog($LANG32[12]);
        return $retval;
    }
    COM_errorLog("Removing the {$pi_name} plugin file structure");
    $msg = '';
    if (PLG_remove($pi_name)) {
        COM_errorLog("Plugin removal was successful.");
        $msg = 116;
        $retval .= COM_showMessage(116);
    } else {
        COM_errorLog("Error removing the plugin file structure - the web server may not have sufficient permissions");
        $msg = 95;
        $retval .= COM_showMessage(95);
    }
    CTL_clearCache();
    if ($msg != '') {
        COM_setMessage($msg);
        $refreshURL = $_CONF['site_admin_url'] . '/plugins.php';
    } else {
        $refreshURL = $_CONF['site_admin_url'] . '/plugins.php';
    }
    echo COM_refresh($refreshURL);
    exit;
}
开发者ID:NewRoute,项目名称:glfusion,代码行数:42,代码来源:plugins.php

示例13: COM_applyFilter

 case 'dooptimize':
     $startwith = '';
     if (isset($_GET['startwith'])) {
         $startwith = COM_applyFilter($_GET['startwith']);
     }
     $pagetitle = $LANG_DB_BACKUP['optimize_title'];
     if (!empty($startwith) || SEC_checkToken()) {
         $failures = 0;
         if (isset($_GET['failures'])) {
             $failures = COM_applyFilter($_GET['failures'], true);
         }
         $num_errors = DBADMIN_dooptimize($startwith, $failures);
         if ($num_errors == 0) {
             $page .= COM_showMessageText($LANG_DB_BACKUP['optimize_success']);
         } else {
             $page .= COM_showMessageText($LANG_DB_BACKUP['optimize_success'] . ' ' . $LANG_DB_BACKUP['table_issues'], '', true, 'error');
         }
         $page .= DBADMIN_list();
     }
     break;
 case 'saveconfig':
     $items = array();
     // Get the excluded tables into a serialized string
     $tables = explode('|', $_POST['groupmembers']);
     $items['_dbback_exclude'] = DB_escapeString(@serialize($tables));
     $items['_dbback_files'] = (int) $_POST['db_backup_maxfiles'];
     /* ---
             if (isset($_POST['disable_cron'])) {
                 $str = '-1';
             } else {
                 $str = (int)$_POST['db_backup_interval'];
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:31,代码来源:database.php

示例14: MG_watermarkUpload

function MG_watermarkUpload($actionURL = '')
{
    global $_USER, $_CONF, $_MG_CONF, $LANG_MG00, $LANG_MG01;
    $root_album = new mgAlbum(0);
    if ($actionURL == '') {
        $actionURL = $_MG_CONF['site_url'] . '/admin.php';
    }
    $retval = '';
    $T = COM_newTemplate(MG_getTemplatePath(0));
    $T->set_file('upload', 'wm_upload.thtml');
    if ($root_album->access != 3 && !$root_album->owner_id) {
        COM_errorLog("Someone has tried to illegally edit media in Media Gallery. " . "User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
        return COM_showMessageText($LANG_MG00['access_denied_msg']);
    }
    // check the php.ini for the settings...
    $post_max_size = ini_get('post_max_size');
    $upload_max_filesize = ini_get('upload_max_filesize');
    $html_max_filesize = 65536;
    $warning = sprintf($LANG_MG01['upload_warning'], $upload_max_filesize, $post_max_size);
    $T->set_var(array('start_block' => COM_startBlock($LANG_MG01['watermark_upload']), 'end_block' => COM_endBlock(), 's_form_action' => $_MG_CONF['site_url'] . '/admin.php', 'action' => 'wm_upload', 'lang_wmupload_help' => $LANG_MG01['wm_upload_help'], 'lang_watermark_upload' => $LANG_MG01['watermark_upload'], 'lang_file' => $LANG_MG01['file'], 'lang_description' => $LANG_MG01['description'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'max_file_size' => '<input type="hidden" name="MAX_FILE_SIZE" value="' . $html_max_filesize . '"' . XHTML . '>', 'lang_warning' => $warning));
    $T->set_block('upload', 'public-access');
    if ($root_album->owner_id) {
        $T->set_var('lang_public_access', $LANG_MG01['public_access']);
        $T->set_var('public_access', '<input type="checkbox" name="wm_public" id="wm_public" value="1"' . XHTML . '>');
        $T->parse('public-access', 'public-access');
    } else {
        $T->set_var('public-access', '');
    }
    $retval .= $T->finish($T->parse('output', 'upload'));
    return $retval;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:31,代码来源:lib-watermark.php

示例15: savepoll

/**
* Saves a poll
*
* Saves a poll topic and potential answers to the database
*
* @param    string  $pid            Poll topic ID
* @param    string  $old_pid        Previous poll topic ID
* @param    array   $Q              Array of poll questions
* @param    string  $mainpage       Checkbox: poll appears on homepage
* @param    string  $topic          The text for the topic
* @param    string  $meta_description
* @param    string  $meta_keywords
* @param    int     $statuscode     (unused)
* @param    string  $open           Checkbox: poll open for voting
* @param    string  $hideresults    Checkbox: hide results until closed
* @param    int     $commentcode    Indicates if users can comment on poll
* @param    array   $A              Array of possible answers
* @param    array   $V              Array of vote per each answer
* @param    array   $R              Array of remark per each answer
* @param    int     $owner_id       ID of poll owner
* @param    int     $group_id       ID of group poll belongs to
* @param    int     $perm_owner     Permissions the owner has on poll
* @param    int     $perm_grup      Permissions the group has on poll
* @param    int     $perm_members   Permissions logged in members have on poll
* @param    int     $perm_anon      Permissions anonymous users have on poll
* @return   string                  HTML redirect or error message
*
*/
function savepoll($pid, $old_pid, $Q, $mainpage, $topic, $meta_description, $meta_keywords, $statuscode, $open, $hideresults, $commentcode, $A, $V, $R, $owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon)
{
    global $_CONF, $_TABLES, $_USER, $LANG21, $LANG25, $MESSAGE, $_POLL_VERBOSE, $_PO_CONF;
    $retval = '';
    // Convert array values to numeric permission values
    list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($perm_owner, $perm_group, $perm_members, $perm_anon);
    $topic = COM_stripslashes($topic);
    $meta_description = strip_tags(COM_stripslashes($meta_description));
    $meta_keywords = strip_tags(COM_stripslashes($meta_keywords));
    $pid = COM_sanitizeID($pid);
    $old_pid = COM_sanitizeID($old_pid);
    if (empty($pid)) {
        if (empty($old_pid)) {
            $pid = COM_makeSid();
        } else {
            $pid = $old_pid;
        }
    }
    // check if any question was entered
    if (empty($topic) or count($Q) == 0 or strlen($Q[0]) == 0 or strlen($A[0][0]) == 0) {
        $retval .= COM_siteHeader('menu', $LANG25[5]);
        $retval .= COM_startBlock($LANG21[32], '', COM_getBlockTemplate('_msg_block', 'header'));
        $retval .= $LANG25[2];
        $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
        $retval .= COM_siteFooter();
        return $retval;
    }
    if (!SEC_checkToken()) {
        COM_accessLog("User {$_USER['username']} tried to save poll {$pid} and failed CSRF checks.");
        return COM_refresh($_CONF['site_admin_url'] . '/plugins/polls/index.php');
    }
    // check for poll id change
    if (!empty($old_pid) && $pid != $old_pid) {
        // check if new pid is already in use
        if (DB_count($_TABLES['polltopics'], 'pid', $pid) > 0) {
            // TBD: abort, display editor with all content intact again
            $pid = $old_pid;
            // for now ...
        }
    }
    // start processing the poll topic
    if ($_POLL_VERBOSE) {
        COM_errorLog('**** Inside savepoll() in ' . $_CONF['site_admin_url'] . '/plugins/polls/index.php ***');
    }
    $access = 0;
    if (DB_count($_TABLES['polltopics'], 'pid', $pid) > 0) {
        $result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['polltopics']} WHERE pid = '{$pid}'");
        $P = DB_fetchArray($result);
        $access = SEC_hasAccess($P['owner_id'], $P['group_id'], $P['perm_owner'], $P['perm_group'], $P['perm_members'], $P['perm_anon']);
    } else {
        $access = SEC_hasAccess($owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon);
    }
    if ($access < 3 || !SEC_inGroup($group_id)) {
        $display .= COM_siteHeader('menu', $MESSAGE[30]) . COM_showMessageText($MESSAGE[29], $MESSAGE[30]) . COM_siteFooter();
        COM_accessLog("User {$_USER['username']} tried to illegally submit or edit poll {$pid}.");
        COM_output($display);
        exit;
    }
    if (empty($voters)) {
        $voters = 0;
    }
    if ($_POLL_VERBOSE) {
        COM_errorLog('owner permissions: ' . $perm_owner, 1);
        COM_errorLog('group permissions: ' . $perm_group, 1);
        COM_errorLog('member permissions: ' . $perm_members, 1);
        COM_errorLog('anonymous permissions: ' . $perm_anon, 1);
    }
    // we delete everything and re-create it with the input from the form
    $del_pid = $pid;
    if (!empty($old_pid) && $pid != $old_pid) {
        $del_pid = $old_pid;
        // delete by old pid, create using new pid below
//.........这里部分代码省略.........
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:index.php


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