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


PHP COM_sanitizeFilename函数代码示例

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


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

示例1: SECINT_cleanupFiles

/**
 * Helper function: Clean up any leftover files on failed re-authentication
 * When re-authentication fails, we need to clean up any files that may have
 * been rescued during the original POST request with the expired token. Note
 * that the uploaded files are now in the site's 'data' directory.
 *
 * @param    mixed $files original or recreated $_FILES array
 * @return   void
 * @access   private
 */
function SECINT_cleanupFiles($files)
{
    global $_CONF;
    // first, some sanity checks
    if (!is_array($files)) {
        if (empty($files)) {
            return;
            // nothing to do
        } else {
            $files = @unserialize($files);
        }
    }
    if (!is_array($files) || empty($files)) {
        return;
        // bogus
    }
    foreach ($files as $key => $value) {
        if (!empty($value['tmp_name'])) {
            // ignore path - file is in $_CONF['path_data']
            $filename = COM_sanitizeFilename(basename($value['tmp_name']), true);
            $orphan = $_CONF['path_data'] . $filename;
            if (file_exists($orphan)) {
                if (!@unlink($orphan)) {
                    COM_errorLog("SECINT_cleanupFile: Unable to remove file {$filename} from 'data' directory");
                }
            }
        }
    }
}
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:39,代码来源:lib-security.php

示例2: DBADMIN_backupTableAjax

function DBADMIN_backupTableAjax()
{
    global $_VARS;
    if (!COM_isAjax()) {
        die;
    }
    $retval = array();
    if (!isset($_VARS['_dbback_allstructs'])) {
        $_VARS['_dbback_allstructs'] = 0;
    }
    $filename = '';
    if (isset($_POST['backup_filename'])) {
        $filename = $_POST['backup_filename'];
        $filename = COM_sanitizeFilename($filename, true);
    }
    $table = COM_applyFilter($_POST['table']);
    if (isset($_POST['start'])) {
        $start = COM_applyFilter($_POST['start'], true);
    } else {
        $start = 0;
    }
    $backup = new dbBackup();
    $backup->setBackupFilename($filename);
    list($rc, $sessionCounter, $recordCounter) = $backup->backupTable($table, $_VARS['_dbback_allstructs'], $start);
    switch ($rc) {
        case 1:
            $retval['errorCode'] = 2;
            $retval['startrecord'] = $recordCounter;
            $retval['processed'] = $sessionCounter;
            $return["json"] = json_encode($retval);
            echo json_encode($return);
            exit;
        case -2:
            // serious error
            $retval['errorCode'] = 3;
            $return["json"] = json_encode($retval);
            echo json_encode($return);
            exit;
        default:
            $retval['errorCode'] = 0;
            $retval['processed'] = $sessionCounter;
            $return["json"] = json_encode($retval);
            echo json_encode($return);
            exit;
    }
    exit;
}
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:47,代码来源:database.php

示例3: CACHE_instance_filename

function CACHE_instance_filename($iid, $bypass_lang = false)
{
    global $TEMPLATE_OPTIONS, $_CONF;
    $path_cache = $TEMPLATE_OPTIONS['path_cache'];
    if (!$bypass_lang && $TEMPLATE_OPTIONS['cache_by_language']) {
        $path_cache .= $_CONF['language'] . '/';
    }
    $iid = COM_sanitizeFilename($iid, true);
    $filename = $path_cache . 'instance__' . $iid . '.php';
    return $filename;
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:11,代码来源:template.class.php

示例4: COM_showMessageText

require_once $_CONF['path_system'] . 'lib-admin.php';
if (!SEC_inGroup('Root')) {
    $display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
    $display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
    COM_accessLog("User {$_USER['username']} tried to illegally access the log viewer screen.");
    COM_output($display);
    exit;
}
if (isset($_GET['log'])) {
    $log = COM_applyFilter($_GET['log']);
} elseif (isset($_POST['log'])) {
    $log = COM_applyFilter($_POST['log']);
} else {
    $log = '';
}
$log = COM_sanitizeFilename($log, true);
if (empty($log)) {
    $log = 'error.log';
}
$display = '';
$menu_arr = array(array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
$display = COM_startBlock($LANG_LOGVIEW['log_viewer'], '', COM_getBlockTemplate('_admin_block', 'header')) . ADMIN_createMenu($menu_arr, $LANG_LOGVIEW['info'], $_CONF['layout_url'] . '/images/icons/log_viewer.' . $_IMAGE_TYPE);
$display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/logviewer.php" class="uk-form"><div>' . $LANG_LOGVIEW['logs'] . ':&nbsp;&nbsp;&nbsp;' . '<select name="log">';
foreach (glob($_CONF['path_log'] . '*.log') as $file) {
    $file = basename($file);
    $display .= '<option value="' . $file . '"';
    if ($log === $file) {
        $display .= ' selected="selected"';
    }
    $display .= '>' . $file . '</option>';
}
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:31,代码来源:logviewer.php

示例5: COM_getLanguage

/**
* Determine current language
*
* @return   string  name of the language file (minus the '.php' extension)
*
*/
function COM_getLanguage()
{
    global $_CONF, $_USER;
    $langfile = '';
    if (!empty($_USER['language'])) {
        $langfile = $_USER['language'];
    } elseif (!empty($_COOKIE[$_CONF['cookie_language']])) {
        $langfile = $_COOKIE[$_CONF['cookie_language']];
    } elseif (isset($_CONF['languages'])) {
        $langfile = COM_getLanguageFromBrowser();
    }
    $langfile = COM_sanitizeFilename($langfile);
    if (!empty($langfile)) {
        if (is_file($_CONF['path_language'] . $langfile . '.php')) {
            return $langfile;
        }
    }
    // if all else fails, return the default language
    return $_CONF['language'];
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:26,代码来源:lib-common.php

示例6: plugin_autoinstall

/**
* Prepare and perform plugin auto install
*
* @param    string  $plugin     Plugin name (internal name, i.e. directory name)
* @return   boolean             true on success, false otherwise
*
*/
function plugin_autoinstall($plugin)
{
    global $_CONF, $LANG32;
    $plugin = COM_applyFilter($plugin);
    $plugin = COM_sanitizeFilename($plugin);
    $autoinstall = $_CONF['path'] . 'plugins/' . $plugin . '/autoinstall.php';
    if (empty($plugin) || !file_exists($autoinstall)) {
        COM_errorLog('autoinstall.php not found', 1);
        return false;
    }
    require_once $autoinstall;
    $check_compatible = 'plugin_compatible_with_this_version_' . $plugin;
    if (function_exists($check_compatible)) {
        if (!$check_compatible($plugin)) {
            COM_errorLog($LANG32[9]);
            return false;
        }
    }
    $auto_install = 'plugin_autoinstall_' . $plugin;
    if (!function_exists($auto_install)) {
        COM_errorLog("Function '{$auto_install}' not found", 1);
        return false;
    }
    $inst_parms = $auto_install($plugin);
    if ($inst_parms === false || empty($inst_parms)) {
        COM_errorLog('No install parameters', 1);
        return false;
    }
    return plugin_do_autoinstall($plugin, $inst_parms);
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:37,代码来源:plugins.php

示例7: SEC_remoteAuthentication

/**
 * Check to see if we can authenticate this user with a remote server
 *
 * A user has not managed to login localy, but has an @ in their user
 * name and we have enabled distributed authentication. Firstly, try to
 * see if we have cached the module that we used to authenticate them
 * when they signed up (i.e. they've actualy changed their password
 * elsewhere and we need to synch.) If not, then try to authenticate
 * them with /every/ authentication module. If this suceeds, create
 * a user for them.
 *
 * @param  string  $loginname Their username
 * @param  string  $passwd The password entered
 * @param  string  $server The server portion of $username
 * @param  string  $uid OUTPUT parameter, pass it by ref to get uid back.
 * @return int     user status, -1 for fail.
 */
function SEC_remoteAuthentication(&$loginname, $passwd, $service, &$uid)
{
    global $_CONF, $_TABLES;
    /* First try a local cached login */
    $remoteusername = addslashes($loginname);
    $remoteservice = addslashes($service);
    $result = DB_query("SELECT passwd, status, uid FROM {$_TABLES['users']} WHERE remoteusername='{$remoteusername}' AND remoteservice='{$remoteservice}'");
    $tmp = DB_error();
    $nrows = DB_numRows($result);
    if ($tmp == 0 && $nrows == 1) {
        $U = DB_fetchArray($result);
        $uid = $U['uid'];
        $mypass = $U['passwd'];
        // also used to see if the user existed later.
        if ($mypass == SEC_encryptPassword($passwd)) {
            /* Valid password for cached user, return status */
            return $U['status'];
        }
    }
    $service = COM_sanitizeFilename($service);
    $servicefile = $_CONF['path_system'] . 'classes/authentication/' . $service . '.auth.class.php';
    if (file_exists($servicefile)) {
        require_once $servicefile;
        $authmodule = new $service();
        if ($authmodule->authenticate($loginname, $passwd)) {
            /* check to see if they have logged in before: */
            if (empty($mypass)) {
                // no such user, create them
                // Check to see if their remoteusername is unique locally
                $checkName = DB_getItem($_TABLES['users'], 'username', "username='{$remoteusername}'");
                if (!empty($checkName)) {
                    // no, call custom function.
                    if (function_exists('CUSTOM_uniqueRemoteUsername')) {
                        $loginname = CUSTOM_uniqueRemoteUsername($loginname, $service);
                    }
                }
                USER_createAccount($loginname, $authmodule->email, SEC_encryptPassword($passwd), $authmodule->fullname, $authmodule->homepage, $remoteusername, $remoteservice);
                $uid = DB_getItem($_TABLES['users'], 'uid', "remoteusername = '{$remoteusername}' AND remoteservice='{$remoteservice}'");
                // Store full remote account name:
                DB_query("UPDATE {$_TABLES['users']} SET remoteusername='{$remoteusername}', remoteservice='{$remoteservice}', status=3 WHERE uid='{$uid}'");
                // Add to remote users:
                $remote_grp = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='Remote Users'");
                DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id,ug_uid) VALUES ({$remote_grp}, {$uid})");
                return 3;
                // Remote auth precludes usersubmission,
                // and integrates user activation, see?
            } else {
                // user existed, update local password:
                DB_change($_TABLES['users'], 'passwd', SEC_encryptPassword($passwd), array('remoteusername', 'remoteservice'), array($remoteusername, $remoteservice));
                // and return their status
                return DB_getItem($_TABLES['users'], 'status', "remoteusername='{$remoteusername}' AND remoteservice='{$remoteservice}'");
            }
        } else {
            return -1;
        }
    } else {
        return -1;
    }
}
开发者ID:hostellerie,项目名称:nexpro,代码行数:76,代码来源:lib-security.php

示例8: foreach

         $display .= '<p>' . $LANG_PLUGINS[20] . '</p>' . LB . '<form action="install-plugins.php" method="POST">' . LB . '<input type="submit" class="button big-button" name="refresh" value="' . $LANG_PLUGINS[19] . '"' . XHTML . '>' . LB . '</form></p>' . LB;
     }
     break;
     /**
      * Step 2 - Install the selected plugins 
      */
 /**
  * Step 2 - Install the selected plugins 
  */
 case 2:
     $error = 0;
     foreach ($_POST['plugins'] as $plugin) {
         // If the plugin was selected to be installed
         if (isset($plugin['install']) && $plugin['install'] == 'on') {
             $pi_name = COM_applyFilter($plugin['name']);
             $pi_name = COM_sanitizeFilename($pi_name);
             $plugin_inst = $_CONF['path'] . 'plugins/' . $pi_name . '/autoinstall.php';
             if (file_exists($plugin_inst)) {
                 require_once $plugin_inst;
                 $check_compatible = 'plugin_compatible_with_this_version_' . $pi_name;
                 if (function_exists($check_compatible)) {
                     if (!$check_compatible($pi_name)) {
                         continue;
                         // with next plugin
                     }
                 }
                 $auto_install = 'plugin_autoinstall_' . $pi_name;
                 if (!function_exists($auto_install)) {
                     continue;
                     // with next plugin
                 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:31,代码来源:install-plugins.php

示例9: array

$expected = array('edit', 'pedit', 'save', 'psave', 'delete', 'list', 'cancel');
foreach ($expected as $provided) {
    if (isset($_POST[$provided])) {
        $action = $provided;
    } elseif (isset($_GET[$provided])) {
        $action = $provided;
    }
}
// parse parameter(s) we're likely going to use
$tag = '';
if (isset($_POST['tag'])) {
    $tag = COM_applyFilter($_POST['tag']);
} elseif (isset($_GET['tag'])) {
    $tag = COM_applyFilter($_GET['tag']);
}
$tag = COM_sanitizeFilename($tag);
if (isset($_POST['tagenabler']) && SEC_checkToken()) {
    $enabledtags = array();
    if (isset($_POST['enabledtags'])) {
        $enabledtags = $_POST['enabledtags'];
    }
    $tagarray = array();
    if (isset($_POST['tagarray'])) {
        $tagarray = $_POST['tagarray'];
    }
    AT_toggleStatus($enabledtags, $tagarray);
    $action = 'list';
}
$autotag_id = 0;
if (isset($_POST['autotag_id'])) {
    $autotag_id = COM_applyFilter($_POST['autotag_id']);
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:autotag.php

示例10: foreach

                     if ($filename == '') {
                         $value = '';
                     }
                     $_FILES[$fkey]['_data_dir'][$offset] = true;
                 }
                 $_FILES[$fkey][$key][$offset] = $value;
                 if (!isset($_FILES[$fkey]['tmp_name']) || !isset($_FILES[$fkey]['tmp_name'][$offset]) || !file_exists($_FILES[$fkey]['tmp_name'][$offset])) {
                     $_FILES[$fkey]['tmp_name'][$offset] = '';
                     $_FILES[$fkey]['error'][$offset] = 4;
                 }
             }
         }
     } else {
         foreach ($file as $key => $value) {
             if ($key == 'tmp_name') {
                 $filename = COM_sanitizeFilename(basename($value), true);
                 $value = $_CONF['path_data'] . 'temp/' . $filename;
                 if ($filename == '') {
                     $value = '';
                 }
                 // set _data_dir attribute to key upload class to not use move_uploaded_file()
                 $_FILES[$fkey]['_data_dir'] = true;
             }
             $_FILES[$fkey][$key] = $value;
         }
         if (!file_exists($_FILES[$fkey]['tmp_name'])) {
             $_FILES[$fkey]['tmp_name'] = '';
             $_FILES[$fkey]['error'] = 4;
         }
     }
 }
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:auth.inc.php

示例11: Save

 /**
  *  Save the current values to the database.
  *
  *  @param  array   $A      Optional array of values from $_POST
  *  @return boolean         True if no errors, False otherwise
  */
 public function Save($A = array())
 {
     global $_TABLES, $_PP_CONF;
     if (is_array($A)) {
         $this->SetVars($A);
     }
     // Handle image uploads.
     // We don't want to delete the existing image if one isn't
     // uploaded, we should leave it unchanged.  So we'll first
     // retrieve the existing image filename, if any.
     if (!$this->isNew) {
         $img_filename = DB_getItem($_TABLES['paypal.categories'], 'image', "cat_id='" . $this->cat_id . "'");
     } else {
         // New entry, assume no image
         $img_filename = '';
     }
     if (is_uploaded_file($_FILES['imagefile']['tmp_name'])) {
         $img_filename = rand(100, 999) . "_" . COM_sanitizeFilename($_FILES['imagefile']['name'], true);
         $status = IMG_resizeImage($_FILES['imagefile']['tmp_name'], $_PP_CONF['catimgpath'] . "/{$img_filename}", $_PP_CONF['max_thumb_size'], $_PP_CONF['max_thumb_size'], '', true);
         if ($status[0] == false) {
             $this->AddError('Error Moving Image');
         } else {
             // If a new image was uploaded, and this is an existing
             // category, then delete the old image file, if any.
             // The DB still has the old filename at this point.
             if (!$this->isNew) {
                 $this->DeleteImage(false);
             }
         }
     }
     $this->image = $img_filename;
     // Insert or update the record, as appropriate, as long as a
     // previous error didn't occur.
     if (empty($this->Errors)) {
         if ($this->isNew) {
             $sql1 = "INSERT INTO {$_TABLES['paypal.categories']} SET ";
             $sql3 = '';
         } else {
             $sql1 = "UPDATE {$_TABLES['paypal.categories']} SET ";
             $sql3 = " WHERE cat_id='{$this->cat_id}'";
         }
         $sql2 = "parent_id='" . $this->parent_id . "',\n                cat_name='" . DB_escapeString($this->cat_name) . "',\n                description='" . DB_escapeString($this->description) . "',\n                enabled='{$this->enabled}',\n                grp_access ='{$this->grp_access}',\n                image='" . DB_escapeString($this->image) . "'";
         $sql = $sql1 . $sql2 . $sql3;
         DB_query($sql);
         if (!DB_error()) {
             if ($this->isNew) {
                 $this->cat_id = DB_insertID();
             }
         } else {
             $this->AddError('Failed to insert or update record');
         }
     }
     if (empty($this->Errors)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:JohnToro,项目名称:paypal,代码行数:64,代码来源:category.class.php

示例12: savefeed

/**
* Save feed.
*
* @param    array    $A
* @return   string   HTML redirect on success or feed editor + error message
*
*/
function savefeed($A)
{
    global $_CONF, $_TABLES, $LANG33;
    foreach ($A as $name => $value) {
        $A[$name] = COM_stripslashes($value);
    }
    if (isset($A['is_enabled']) && $A['is_enabled'] == 'on') {
        $A['is_enabled'] = 1;
    } else {
        $A['is_enabled'] = 0;
    }
    // Make sure correct format returned and correct file extenstion
    $A['filename'] = COM_sanitizeFilename($A['filename'], true);
    $file_parts = pathinfo($A['filename']);
    $A['filename'] = '';
    // Clear out filename. If it doesn't get recreated then we know there is an error
    if (!empty($file_parts['filename'])) {
        $formats = find_feedFormats();
        foreach ($formats as $f) {
            if ($A['format'] == $f['name'] . '-' . $f['version']) {
                switch ($f['name']) {
                    case 'Atom':
                        if (!in_array(@$file_parts['extension'], array('atm', 'xml'))) {
                            $file_parts['extension'] = 'xml';
                        }
                        $A['filename'] = $file_parts['filename'] . '.' . $file_parts['extension'];
                        break;
                    case 'RSS':
                        if (!in_array(@$file_parts['extension'], array('rss', 'xml'))) {
                            $file_parts['extension'] = 'rss';
                        }
                        $A['filename'] = $file_parts['filename'] . '.' . $file_parts['extension'];
                        break;
                    case 'RDF':
                        $A['filename'] = $file_parts['filename'] . '.rdf';
                        break;
                }
            }
        }
    }
    if (empty($A['title']) || empty($A['description']) || empty($A['filename'])) {
        $retval = COM_showMessageText($LANG33[39], $LANG33[38]) . editfeed($A['fid'], $A['type']);
        $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG33[38]));
        return $retval;
    }
    $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['syndication']} WHERE filename = '{$A['filename']}' AND (fid <> '{$A['fid']}')");
    $C = DB_fetchArray($result);
    if ($C['count'] > 0) {
        $retval = COM_showMessageText($LANG33[51], $LANG33[52]) . editfeed($A['fid'], $A['type']);
        $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG33[52]));
        return $retval;
    }
    if ($A['limits'] <= 0) {
        $retval = COM_showMessageText($LANG33[40], $LANG33[38]) . editfeed($A['fid'], $A['type']);
        $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG33[38]));
        return $retval;
    }
    if ($A['limits_in'] == 1) {
        $A['limits'] .= 'h';
    }
    // we can compensate if these are missing ...
    if (!empty($A['charset'])) {
        $A['charset'] = preg_replace('/[^0-9a-zA-Z_\\-]/', '', $A['charset']);
    }
    if (empty($A['charset'])) {
        $A['charset'] = $_CONF['default_charset'];
        if (empty($A['charset'])) {
            $A['charset'] = 'UTF-8';
        }
    }
    if (!empty($A['language'])) {
        $A['language'] = preg_replace('/[^0-9a-zA-Z_\\.\\-]/', '', $A['language']);
    }
    if (empty($A['language'])) {
        $A['language'] = $_CONF['rdf_language'];
        if (empty($A['language'])) {
            $A['language'] = $_CONF['locale'];
        }
    }
    if (!empty($A['content_length'])) {
        $A['content_length'] = intval($A['content_length'], 10);
    }
    if (empty($A['content_length']) || $A['content_length'] < 0) {
        $A['content_length'] = 0;
    }
    foreach ($A as $name => $value) {
        $A[$name] = DB_escapeString($value);
    }
    DB_save($_TABLES['syndication'], 'fid,type,topic,header_tid,format,limits,content_length,title,description,feedlogo,filename,charset,language,is_enabled,updated,update_info', "{$A['fid']},'{$A['type']}','{$A['topic']}','{$A['header_tid']}','{$A['format']}','{$A['limits']}',{$A['content_length']},'{$A['title']}','{$A['description']}','{$A['feedlogo']}','{$A['filename']}','{$A['charset']}','{$A['language']}',{$A['is_enabled']},'0000-00-00 00:00:00',NULL");
    if ($A['fid'] == 0) {
        $A['fid'] = DB_insertId();
    }
    if ($A['is_enabled'] == 1) {
//.........这里部分代码省略.........
开发者ID:ivywe,项目名称:geeklog,代码行数:101,代码来源:syndication.php

示例13: copy

    // would have preferred rename (i.e. move), but ran into file permission
    // problems on www.geeklog.net ...
    copy($filename, $filemgmt_FileStore . 'tmp/' . $tmpfilename);
    $logourl = '';
    DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedetail']} (cid, title, url, homepage, version, size, platform, logourl, submitter, status, date, hits, rating, votes, comments) VALUES ('{$cid}', '{$title}', '{$url}', '{$homepage}', '{$version}', '{$size}', '{$tmpfilename}', '{$logourl}', '{$submitter}', 0, '{$date}', 0, 0, 0, '{$comments}')");
    $newid = DB_insertId();
    DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedesc']} (lid, description) VALUES ({$newid}, '{$description}')");
    return true;
}
// MAIN
$display = '';
$nightly = $_CONF['path_html'] . 'nightly/';
if (count($_GET) == 3) {
    if (isset($_GET['md5']) && isset($_GET['filename']) && isset($_GET['action'])) {
        if ($_GET['action'] == 'geeklog_release') {
            $filename = COM_sanitizeFilename($_GET['filename'], true);
            if (!empty($filename)) {
                if (substr($filename, 0, strlen('geeklog')) == 'geeklog') {
                    $filename = $nightly . $filename;
                    if (file_exists($filename)) {
                        $md5 = md5_file($filename);
                        if ($md5 == $_GET['md5']) {
                            COM_errorLog("Accepting submission of {$filename}");
                        } else {
                            unset($filename);
                            unset($md5);
                        }
                    } else {
                        unset($filename);
                    }
                } else {
开发者ID:Geeklog-Core,项目名称:tools,代码行数:31,代码来源:submit-local-file.php

示例14: downloader

* @author   Tony Bibbs, tony AT tonybibbs DOT com
*
*/
require_once 'lib-common.php';
require_once $_CONF['path_system'] . 'classes/downloader.class.php';
$downloader = new downloader();
$downloader->setLogFile($_CONF['path_log'] . 'error.log');
$downloader->setLogging(true);
$downloader->setAllowedExtensions(array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'png' => 'image/x-png'));
$mode = '';
if (isset($_GET['mode'])) {
    $mode = $_GET['mode'];
}
$image = '';
if (isset($_GET['image'])) {
    $image = COM_sanitizeFilename(COM_applyFilter($_GET['image']));
}
if (strstr($image, '..')) {
    // Can you believe this, some jackass tried to relative pathing to access
    // files they shouldn't have access to?
    COM_accessLog('Someone tried to illegally access files using getimage.php');
    exit;
}
// Set the path properly
switch ($mode) {
    case 'show':
    case 'articles':
        $downloader->setPath($_CONF['path_images'] . 'articles/');
        break;
    case 'topics':
        $downloader->setPath($_CONF['path_images'] . 'topics/');
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:getimage.php

示例15: SESS_completeLogin

 SESS_completeLogin($uid);
 $_GROUPS = SEC_getUserGroups($_USER['uid']);
 $_RIGHTS = explode(',', SEC_getUserPermissions());
 if ($_SYSTEM['admin_session'] > 0 && $local_login) {
     if (SEC_isModerator() || SEC_hasRights('story.edit,block.edit,topic.edit,user.edit,plugin.edit,user.mail,syndication.edit', 'OR') || count(PLG_getAdminOptions()) > 0) {
         $admin_token = SEC_createTokenGeneral('administration', $_SYSTEM['admin_session']);
         SEC_setCookie('token', $admin_token, 0, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], true);
     }
 }
 if (!isset($_USER['theme'])) {
     $_USER['theme'] = $_CONF['theme'];
     $_CONF['path_layout'] = $_CONF['path_themes'] . $_USER['theme'] . '/';
     $_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_USER['theme'];
     if ($_CONF['allow_user_themes'] == 1) {
         if (isset($_COOKIE[$_CONF['cookie_theme']])) {
             $theme = COM_sanitizeFilename($_COOKIE[$_CONF['cookie_theme']], true);
             if (is_dir($_CONF['path_themes'] . $theme)) {
                 $_USER['theme'] = $theme;
                 $_CONF['path_layout'] = $_CONF['path_themes'] . $theme . '/';
                 $_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $theme;
             }
         }
     }
 }
 COM_resetSpeedlimit('login');
 // we are now fully logged in, let's see if there is someplace we need to go....
 if (SESS_isSet('login_referer')) {
     $_SERVER['HTTP_REFERER'] = SESS_getVar('login_referer');
     SESS_unSet('login_referer');
 }
 if (!empty($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], '/users.php') === false && substr($_SERVER['HTTP_REFERER'], 0, strlen($_CONF['site_url'])) == $_CONF['site_url']) {
开发者ID:spacequad,项目名称:glfusion,代码行数:31,代码来源:users.php


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