本文整理汇总了PHP中PclErrorString函数的典型用法代码示例。如果您正苦于以下问题:PHP PclErrorString函数的具体用法?PHP PclErrorString怎么用?PHP PclErrorString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PclErrorString函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorInfo
function errorInfo($p_full = false)
{
if (PCLZIP_ERROR_EXTERNAL == 1) {
return PclErrorString();
} else {
if ($p_full) {
return $this->errorName(true) . " : " . $this->error_string;
} else {
return $this->error_string . " [code " . $this->error_code . "]";
}
}
}
示例2: PclTarHandleExtension
function PclTarHandleExtension($p_tarname)
{
TrFctStart(__FILE__, __LINE__, "PclTarHandleExtension", "tar={$p_tarname}");
// ----- Look for file extension
if (substr($p_tarname, -7) == ".tar.gz" || substr($p_tarname, -4) == ".tgz") {
TrFctMessage(__FILE__, __LINE__, 2, "Archive is a gzip tar");
$v_tar_mode = "tgz";
} else {
if (substr($p_tarname, -4) == ".tar") {
TrFctMessage(__FILE__, __LINE__, 2, "Archive is a tar");
$v_tar_mode = "tar";
} else {
// ----- Error log
PclErrorLog(-9, "Invalid archive extension");
TrFctMessage(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
$v_tar_mode = "";
}
}
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_tar_mode);
return $v_tar_mode;
}
示例3: pluginProcessUpload
function pluginProcessUpload()
{
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
exit;
}
$fl = e107::getFile();
$data = $fl->getUploaded(e_TEMP);
$mes = e107::getMessage();
if (empty($data[0]['error'])) {
if ($fl->unzipArchive($data[0]['name'], 'plugin')) {
$mes->addSuccess(EPL_ADLAN_43);
} else {
$mes->addError(EPL_ADLAN_97);
}
}
// $data = process_uploaded_files(e_TEMP);
// print_a($data);
echo $mes->render();
return;
// ----------------- Everything below is unused.
extract($_FILES);
/* check if e_PLUGIN dir is writable ... */
if (!is_writable(e_PLUGIN)) {
// still not writable - spawn error message
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
} else {
// e_PLUGIN is writable
require_once e_HANDLER . "upload_handler.php";
$fileName = $file_userfile['name'][0];
$fileSize = $file_userfile['size'][0];
$fileType = $file_userfile['type'][0];
if (strstr($file_userfile['type'][0], "gzip")) {
$fileType = "tar";
} else {
if (strstr($file_userfile['type'][0], "zip")) {
$fileType = "zip";
} else {
// not zip or tar - spawn error message
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
return false;
}
}
if ($fileSize) {
$uploaded = file_upload(e_PLUGIN);
$archiveName = $uploaded[0]['name'];
// attempt to unarchive
if ($fileType == "zip") {
require_once e_HANDLER . "pclzip.lib.php";
$archive = new PclZip(e_PLUGIN . $archiveName);
$unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666);
} else {
require_once e_HANDLER . "pcltar.lib.php";
$unarc = $fileList = PclTarExtract($archiveName, e_PLUGIN);
}
if (!$unarc) {
// unarc failed ...
if ($fileType == "zip") {
$error = EPL_ADLAN_46 . " '" . $archive->errorName(TRUE) . "'";
} else {
$error = EPL_ADLAN_47 . PclErrorString() . ", " . EPL_ADLAN_48 . intval(PclErrorCode());
}
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42 . " " . $archiveName . " " . $error);
require_once "footer.php";
exit;
}
// ok it looks like the unarc succeeded - continue */
// get folder name ...
$folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
if (file_exists(e_PLUGIN . $folderName . "/plugin.php") || file_exists(e_PLUGIN . $folderName . "/plugin.xml")) {
/* upload is a plugin */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
} elseif (file_exists(e_PLUGIN . $folderName . "/theme.php") || file_exists(e_PLUGIN . $folderName . "/theme.xml")) {
/* upload is a menu */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
} else {
/* upload is unlocatable */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_98 . ' ' . $fileList[0]['stored_filename']);
}
/* attempt to delete uploaded archive */
@unlink(e_PLUGIN . $archiveName);
}
}
}
示例4: pluginProcessUpload
function pluginProcessUpload()
{
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
exit;
}
extract($_FILES);
/* check if e_PLUGIN dir is writable ... */
if (!is_writable(e_PLUGIN)) {
/* still not writable - spawn error message */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
} else {
/* e_PLUGIN is writable - continue */
require_once e_HANDLER . "upload_handler.php";
$fileName = $file_userfile['name'][0];
$fileSize = $file_userfile['size'][0];
$fileType = $file_userfile['type'][0];
if (strstr($file_userfile['type'][0], "gzip")) {
$fileType = "tar";
} else {
if (strstr($file_userfile['type'][0], "zip")) {
$fileType = "zip";
} else {
/* not zip or tar - spawn error message */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
require_once "footer.php";
exit;
}
}
if ($fileSize) {
$uploaded = file_upload(e_PLUGIN);
$archiveName = $uploaded[0]['name'];
/* attempt to unarchive ... */
if ($fileType == "zip") {
require_once e_HANDLER . "pclzip.lib.php";
$archive = new PclZip(e_PLUGIN . $archiveName);
$unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666);
} else {
require_once e_HANDLER . "pcltar.lib.php";
$unarc = $fileList = PclTarExtract($archiveName, e_PLUGIN);
}
if (!$unarc) {
/* unarc failed ... */
if ($fileType == "zip") {
$error = EPL_ADLAN_46 . " '" . $archive->errorName(TRUE) . "'";
} else {
$error = EPL_ADLAN_47 . PclErrorString() . ", " . EPL_ADLAN_48 . intval(PclErrorCode());
}
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42 . " " . $archiveName . " " . $error);
require_once "footer.php";
exit;
}
/* ok it looks like the unarc succeeded - continue */
/* get folder name ... */
$folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
if (file_exists(e_PLUGIN . $folderName . "/plugin.php") || file_exists(e_PLUGIN . $folderName . "/plugin.xml")) {
/* upload is a plugin */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
} elseif (file_exists(e_PLUGIN . $folderName . "/theme.php") || file_exists(e_PLUGIN . $folderName . "/theme.xml")) {
/* upload is a menu */
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
} else {
/* upload is unlocatable */
e107::getRender()->tablerender(EPL_ADLAN_40, 'Unknown file: ' . $fileList[0]['stored_filename']);
}
/* attempt to delete uploaded archive */
@unlink(e_PLUGIN . $archiveName);
}
}
}
示例5: extractArchive
/**
* Extracts the package archive file
* @return boolean True on success, False on error
*/
function extractArchive()
{
global $mosConfig_absolute_path;
// Common functions for the installer(s)
// Extract functions
require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pcltrace.lib.php';
require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pcltar.lib.php';
$base_Dir = mosPathName($mosConfig_absolute_path . '/media');
$archivename = $base_Dir . $this->installArchive();
$tmpdir = uniqid('install_');
$extractdir = mosPathName($base_Dir . $tmpdir);
$archivename = mosPathName($archivename, false);
$this->unpackDir($extractdir);
// Find the extension of the file
$fileext = substr(strrchr(basename($this->installArchive()), '.'), 1);
if ($fileext == 'gz' || $fileext == 'tar') {
$result = PclTarExtract($archivename, $extractdir);
if (!$result) {
$this->setError(1, 'Tar Extract Error "' . PclErrorString() . '" Code ' . intval(PclErrorCode()));
return false;
}
$this->installDir($extractdir);
} else {
$zipfile = new PclZip($archivename);
if ($this->isWindows()) {
define('OS_WINDOWS', 1);
} else {
define('OS_WINDOWS', 0);
}
$ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
if ($ret == 0) {
$this->setError(1, 'Unrecoverable error "' . $zipfile->errorName(true) . '"');
return false;
}
$this->installDir($extractdir);
}
// Try to find the correct install dir. in case that the package have subdirs
// Save the install dir for later cleanup
$filesindir = mosReadDirectory($this->installDir(), '');
if (count($filesindir) == 1) {
if (is_dir($extractdir . $filesindir[0])) {
$this->installDir(mosPathName($extractdir . $filesindir[0]));
}
}
return true;
}
示例6: extractArchive
function extractArchive()
{
global $mosConfig_absolute_path;
$base_Dir = $this->pathName($mosConfig_absolute_path . "/media/");
$archivename = $base_Dir . $this->installArchive();
$tmpdir = uniqid("install_");
if ($this->isWindows()) {
$extractdir = str_replace('/', '\\', $this->pathName($base_Dir . "{$tmpdir}"));
$archivename = str_replace('/', '\\', $archivename);
} else {
$extractdir = str_replace('\\', '/', $this->pathName($base_Dir . "{$tmpdir}"));
$archivename = str_replace('\\', '/', $archivename);
}
$this->unpackDir($extractdir);
// Find the extension of the file
$fileext = substr(strrchr(basename($this->installArchive()), '.'), 1);
if ($fileext == "gz" || $fileext == "tar") {
PclTarExtract($archivename, $extractdir);
if (PclErrorCode() != 1) {
echo "<font color=\"red\">" . PclErrorString() . "<br />Updater - error</font>";
TrDisplay();
exit;
}
$this->installDir($extractdir);
} else {
$zipfile = new PclZip($archivename);
if ($this->isWindows()) {
define('OS_WINDOWS', 1);
} else {
define('OS_WINDOWS', 0);
}
$ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
if ($ret == 0) {
$this->setError(1, "Unrecoverable error '" . $zipfile->errorName(true) . "'", "Updater - error");
return false;
}
$this->installDir($extractdir);
}
// Try to find the correct install dir. in case that the package have subdirs
// Save the install dir for later cleanup
$filesindir = $this->readDirectory($this->installDir(), "");
if (count($filesindir) == 1) {
if (is_dir($extractdir . $filesindir[0])) {
$this->installDir($extractdir . $filesindir[0]);
}
}
return true;
}
示例7: errorInfo
public function errorInfo($p_full = false)
{
if (PCLZIP_ERROR_EXTERNAL == 1) {
return PclErrorString();
} else {
if ($p_full) {
return $this->errorName(true) . ' : ' . $this->error_string;
} else {
return $this->error_string . ' [code ' . $this->error_code . ']';
}
}
}
示例8: teleporter_http_charger_tgz
/**
* Charger un tgz à partir d'un tableau d'options descriptives
*
* @uses http_deballe_recherche_racine()
* @link http://www.phpconcept.net/pcltar Utilise la librairie PclTar
*
* @param array $quoi
* Tableau d'options
* @return array|bool|int|string
* En cas de réussite, Tableau décrivant le zip, avec les index suivant :
* - files : la liste des fichiers présents dans le zip,
* - size : la taille décompressée
* - compressed_size : la taille compressée
* - dirname : répertoire où les fichiers devront être décompréssés
* - tmpname : répertoire temporaire où les fichiers sont décompressés
* - target : cible sur laquelle décompresser les fichiers...
*/
function teleporter_http_charger_tgz($quoi = array())
{
if (!$quoi) {
return false;
}
foreach (array('remove' => '', 'rename' => array(), 'edit' => array(), 'root_extract' => false, 'tmp' => sous_repertoire(_DIR_CACHE, 'chargeur')) as $opt => $def) {
isset($quoi[$opt]) || ($quoi[$opt] = $def);
}
if (!@file_exists($fichier = $quoi['fichier'])) {
return 0;
}
include_spip('inc/pcltar');
$racine = '';
if ($list = PclTarList($fichier)) {
$racine = http_deballe_recherche_racine($list);
$quoi['remove'] = $racine;
} else {
spip_log('charger_decompresser erreur lecture liste tar ' . PclErrorString() . ' pour paquet: ' . $quoi['archive'], "teleport" . _LOG_ERREUR);
return PclErrorString();
}
// si pas de racine commune, reprendre le nom du fichier zip
// en lui enlevant la racine h+md5 qui le prefixe eventuellement
// cf action/charger_plugin L74
if (!strlen($nom = basename($racine))) {
$nom = preg_replace(",^h[0-9a-f]{8}-,i", "", basename($fichier, '.zip'));
}
$dir_export = $quoi['root_extract'] ? $quoi['dest'] : $quoi['dest'] . $nom;
$dir_export = rtrim($dir_export, '/') . '/';
$tmpname = $quoi['tmp'] . $nom . '/';
// choisir la cible selon si on veut vraiment extraire ou pas
$target = $quoi['extract'] ? $dir_export : $tmpname;
// ici, il faut vider le rep cible si il existe deja, non ?
if (is_dir($target)) {
supprimer_repertoire($target);
}
$ok = PclTarExtract($fichier, $target, $quoi['remove']);
if ($ok == 0) {
spip_log('charger_decompresser erreur tar ' . PclErrorString() . ' pour paquet: ' . $quoi['archive'], "teleport" . _LOG_ERREUR);
return PclErrorString();
}
spip_log('charger_decompresser OK pour paquet: ' . $quoi['archive'], "teleport");
$size = $compressed_size = 0;
$removex = ',^' . preg_quote($quoi['remove'], ',') . ',';
foreach ($list as $a => $f) {
$size += $f['size'];
$compressed_size += $f['compressed_size'];
$list[$a] = preg_replace($removex, '', $f['filename']);
}
// Indiquer par un fichier install.log
// a la racine que c'est chargeur qui a installe ce plugin
ecrire_fichier($target . 'install.log', "installation: charger_plugin\n" . "date: " . gmdate('Y-m-d\\TH:i:s\\Z', time()) . "\n" . "source: " . $quoi['archive'] . "\n");
return array('files' => $list, 'size' => $size, 'compressed_size' => $compressed_size, 'dirname' => $dir_export, 'tmpname' => $tmpname, 'target' => $target);
}
示例9: PclTarHandlerDirCheck
function PclTarHandlerDirCheck($p_dir)
{
$v_result = 1;
TrFctStart(__FILE__, __LINE__, "PclTarHandlerDirCheck", "{$p_dir}");
// ----- Check the directory availability
if (is_dir($p_dir) || $p_dir == "") {
TrFctEnd(__FILE__, __LINE__, "'{$p_dir}' is a directory");
return 1;
}
// ----- Look for file alone
/*
if (!strstr("$p_dir", "/"))
{
TrFctEnd(__FILE__, __LINE__, "'$p_dir' is a file with no directory");
return 1;
}
*/
// ----- Extract parent directory
$p_parent_dir = dirname($p_dir);
//TrFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
// ----- Just a check
if ($p_parent_dir != $p_dir) {
// ----- Look for parent directory
if ($p_parent_dir != "") {
if (($v_result = PclTarHandlerDirCheck($p_parent_dir)) != 1) {
TrFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
}
}
// ----- Create the directory
//TrFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
if (!@mkdir($p_dir, 0777)) {
// ----- Error log
PclErrorLog(-8, "Unable to create directory '{$p_dir}'");
// ----- Return
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
return PclErrorCode();
}
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_result, "Directory '{$p_dir}' created");
return $v_result;
}
示例10: position
}
# TODO: This should be a regex to make sure the file is in the right position (<pluginname>/<pluginname>.yaml)
if (strpos($value,$u_plugin_name.'.yaml')!==false){
$yaml_index = $key;
}
}
# TODO: We should extract the yaml file if it exists and validate it.
if ($yaml_index===false){
$rejected = true;
$rej_reason = $lang['plugins-rejmetadata'];
}
if (!$rejected){
if (!(is_array(PclTarExtract($tmp_file, '../../plugins/')))){
#TODO: If the new plugin is already activated we should update the DB with the new yaml info.
$rejected = true;
$rej_reason = $lang['plugins-rejarchprob'].' '.PclErrorString(PclErrorCode());
}
}
}
}
else {
$rejected = true;
$rej_reason = $lang['plugins-rejfileprob'];
}
}
}
else {
$rejected = true;
$rej_reason = $lang['plugins-rejfileprob'];
}
示例11: themeUpload
function themeUpload()
{
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
exit;
}
$mes = e107::getMessage();
$ns = e107::getRender();
extract($_FILES);
if (!is_writable(e_THEME)) {
// $ns->tablerender(TPVLAN_16, TPVLAN_20);
$mes->add(TPVLAN_20, E_MESSAGE_INFO);
return FALSE;
} else {
require_once e_HANDLER . "upload_handler.php";
$fileName = $file_userfile['name'][0];
$fileSize = $file_userfile['size'][0];
$fileType = $file_userfile['type'][0];
if (strstr($file_userfile['type'][0], "gzip")) {
$fileType = "tar";
} else {
if (strstr($file_userfile['type'][0], "zip")) {
$fileType = "zip";
} else {
$mes->add(TPVLAN_17, E_MESSAGE_ERROR);
// $ns->tablerender(TPVLAN_16, TPVLAN_17);
// require_once("footer.php");
return FALSE;
}
}
if ($fileSize) {
$uploaded = file_upload(e_THEME);
$archiveName = $uploaded[0]['name'];
if ($fileType == "zip") {
require_once e_HANDLER . "pclzip.lib.php";
$archive = new PclZip(e_THEME . $archiveName);
$unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0666);
} else {
require_once e_HANDLER . "pcltar.lib.php";
$unarc = $fileList = PclTarExtract($archiveName, e_THEME);
}
if (!$unarc) {
if ($fileType == "zip") {
$error = TPVLAN_46 . " '" . $archive->errorName(TRUE) . "'";
} else {
$error = TPVLAN_47 . PclErrorString() . ", " . TPVLAN_48 . intval(PclErrorCode());
}
$mes->add(TPVLAN_18 . " " . $archiveName . " " . $error, E_MESSAGE_ERROR);
// $ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error);
return FALSE;
}
$folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
$mes->add(TPVLAN_19, E_MESSAGE_SUCCESS);
if (varset($_POST['setUploadTheme'])) {
$themeArray = $this->getThemes();
$this->id = $themeArray[$folderName]['id'];
$this->setTheme();
}
// $ns->tablerender(TPVLAN_16, "<div class='center'>".TPVLAN_19."</div>");
@unlink(e_THEME . $archiveName);
}
}
}
示例12: privDirCheck
function privDirCheck($p_dir, $p_is_dir=false)
{
$v_result = 1;
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
// ----- Remove the final '/'
if (($p_is_dir) && (substr($p_dir, -1)=='/'))
{
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
}
PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
// ----- Check the directory availability
if ((is_dir($p_dir)) || ($p_dir == ""))
{
PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
return 1;
}
// ----- Extract parent directory
$p_parent_dir = dirname($p_dir);
PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
// ----- Just a check
if ($p_parent_dir != $p_dir)
{
// ----- Look for parent directory
if ($p_parent_dir != "")
{
if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
{
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
}
}
// ----- Create the directory
PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
if (!@mkdir($p_dir, 0777))
{
// ----- Error log
PclErrorLog(-8, "Unable to create directory '$p_dir'");
// ----- Return
PclTraceFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
return PclErrorCode();
}
// ----- Return
PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
return $v_result;
}
示例13: PclTarHandleExtension
function PclTarHandleExtension($p_tarname)
{
TrFctStart(__FILE__, __LINE__, "PclTarHandleExtension", "tar={$p_tarname}");
// ----- Look for file extension
// NET2FTP
// This is because net2ftp adds a .txt extension to all uploaded files while they reside on the *web* server
$p_tarname = substr($p_tarname, 0, strlen($p_tarname) - 4);
if (substr($p_tarname, -7) == ".tar.gz" || substr($p_tarname, -4) == ".tgz") {
TrFctMessage(__FILE__, __LINE__, 2, "Archive is a gzip tar");
$v_tar_mode = "tgz";
} else {
if (substr($p_tarname, -4) == ".tar") {
TrFctMessage(__FILE__, __LINE__, 2, "Archive is a tar");
$v_tar_mode = "tar";
} else {
// ----- Error log
PclErrorLog(-9, "Invalid archive extension");
TrFctMessage(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
$v_tar_mode = "";
}
}
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_tar_mode);
return $v_tar_mode;
}