private function _deleteImageCaptcha($resutls) { foreach ($resutls as $capcha) { removeFile(BASEPATH . '../public/capchas/' . $capcha->captcha_time . ".jpg"); $this->db->delete($this->_table, array("captcha_id" => $capcha->captcha_id)); } }
function com_install() { global $cloneManifest, $mainframe, $cloneParent; $session =& JFactory::getSession(); $si = new SubInstaller(); $ret = $si->install(); $errorArray = $si->getError(); $session->set('jsn_install_error', $errorArray); $document =& $cloneManifest->document; $version =& $document->getElementByPath('version'); $edition =& $document->getElementByPath('edition'); $version = $version->data(); $edition = str_replace(' ', '_', JString::strtolower($edition->data())); $packageFile = JPATH_ROOT . DS . 'tmp' . DS . 'jsn_imageshow_' . $edition . '_' . $version . '_install.zip'; $packageExtDir = $cloneParent->getPath('source'); $flagInstallation = false; $disable = ''; $resultCheckManifestFile = checkManifestFileExist(); if ($resultCheckManifestFile == true) { $objUpgradeHelper = new JSNUpgradeHelper($cloneManifest); $objUpgradeHelper->executeUpgrade(); $objUpgradeDBUtil = new JSNISUpgradeDBUtil($cloneManifest); $objUpgradeDBUtil->executeUpgradeDB(); } if (!$cloneParent->copyManifest()) { $cloneParent->abort(JText::_('Component') . ' ' . JText::_('Install') . ': ' . JText::_('Could not copy setup file')); return false; } removeFile($packageFile); removeFolder($packageExtDir); $mainframe->redirect('index.php?option=com_imageshow&controller=installer&task=installcore'); }
function delete($id) { $customer = $this->getById($id); if (!empty($customer)) { removeFile(BASEPATH . "../public/images/upload/" . $customer['image']); return $this->db->delete($this->_table, array('id' => $id)); } return FALSE; }
function delete($id) { $customer = $this->getById($id); if (!empty($customer)) { removeFile(BASEPATH . "../public/images/products/" . $customer['logo']); return $this->db->delete("products", array('id' => $id)); } return FALSE; }
function edit($data, $code) { $array = array(); $array['content_en'] = $data['content_en']; $array['content_vi'] = $data['content_vi']; // upload image logo $image_logo = uploadFile("image", BASEPATH . "../public/images/statics/"); if (!empty($image_logo['file_name'])) { $array['image'] = $image_logo['file_name']; removeFile(BASEPATH . "../public/images/statics/" . $_POST['old_image']); } return $this->db->update('static_contents', $array, array('code' => $code)); }
public function route() { $action = 'upload'; if (isset($_GET['action'])) { $action = $_GET['action']; } //routing for different tasks switch ($action) { case 'upload': if (!empty($_FILES)) { $this->upload(); } break; case 'remove': $filename = $_GET['name']; removeFile($filename); break; case 'show': showFiles(); break; } }
function deldir($dir) { //先删除目录下的文件: $dh = opendir($dir); while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fullpath = $dir . "/" . $file; if (!is_dir($fullpath)) { removeFile($fullpath); } else { deldir($fullpath); } } } closedir($dh); //删除当前文件夹: if (rmdir($dir)) { return true; } else { return false; } }
function delete($id) { $realestate = $this->getById($id); if (!empty($realestate)) { if ($realestate['image'] != "") { $images = explode("&fieldbreak;", $realestate['image']); foreach ($images as $img) { removeFile(BASEPATH . "../upload/@files/" . $img); } } $this->db->delete('tags_estate', array('real_id' => $id)); return $this->db->delete($this->_table, array('id' => $id)); } return FALSE; }
/** * ===> The rest of functions is for XML version only. <=== * Update user's status * @comment - Refreshed */ function refreshUsersInfo($sId = "", $sMode = 'all') { global $aXmlTemplates; global $sModule; $iUpdateInterval = (int) getSettingValue($sModule, "updateInterval"); $iIdleTime = $iUpdateInterval * 3; $iDeleteTime = $iUpdateInterval * 6; $iCurrentTime = time(); //--- refresh current user's track ---// getResult("UPDATE `" . MODULE_DB_PREFIX . "CurrentUsers` SET `Status`='" . USER_STATUS_OLD . "', `When`='" . $iCurrentTime . "' WHERE `ID`='" . $sId . "' AND `Status`<>'" . USER_STATUS_KICK . "' AND (`Status` NOT IN('" . USER_STATUS_NEW . "', '" . USER_STATUS_TYPE . "', '" . USER_STATUS_ONLINE . "') || (" . $iCurrentTime . "-`When`)>" . $iUpdateInterval . ") LIMIT 1"); //--- refresh other users' states ---// getResult("UPDATE `" . MODULE_DB_PREFIX . "CurrentUsers` SET `When`=" . $iCurrentTime . ", `Status`='" . USER_STATUS_IDLE . "' WHERE `Status`<>'" . USER_STATUS_IDLE . "' AND `When`<=(" . ($iCurrentTime - $iIdleTime) . ")"); getResult("DELETE FROM `" . MODULE_DB_PREFIX . "RoomsUsers` WHERE `Status`='" . ROOM_STATUS_DELETE . "' AND `When`<=(" . ($iCurrentTime - $iDeleteTime) . ")"); $rFiles = getResult("SELECT `files`.`ID` AS `FileID` FROM `" . MODULE_DB_PREFIX . "Messages` AS `files` INNER JOIN `" . MODULE_DB_PREFIX . "CurrentUsers` AS `users` WHERE `files`.`Recipient`=`users`.`ID` AND `files`.`Type`='file' AND `users`.`Status`='" . USER_STATUS_IDLE . "' AND `users`.`When`<=" . ($iCurrentTime - $iDeleteTime)); while ($aFile = mysql_fetch_assoc($rFiles)) { removeFile($aFile['FileID']); } //--- delete idle users, whose track was not refreshed more than delete time ---// getResult("DELETE FROM `" . MODULE_DB_PREFIX . "CurrentUsers`, `" . MODULE_DB_PREFIX . "RoomsUsers` USING `" . MODULE_DB_PREFIX . "CurrentUsers`, `" . MODULE_DB_PREFIX . "RoomsUsers` WHERE `" . MODULE_DB_PREFIX . "CurrentUsers`.`ID`=`" . MODULE_DB_PREFIX . "RoomsUsers`.`User` AND `" . MODULE_DB_PREFIX . "CurrentUsers`.`Status`='" . USER_STATUS_IDLE . "' AND `" . MODULE_DB_PREFIX . "CurrentUsers`.`When`<=" . ($iCurrentTime - $iDeleteTime)); //--- delete old rooms ---// getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Rooms`, `" . MODULE_DB_PREFIX . "RoomsUsers` USING `" . MODULE_DB_PREFIX . "Rooms`,`" . MODULE_DB_PREFIX . "RoomsUsers` WHERE `" . MODULE_DB_PREFIX . "Rooms`.`ID`=`" . MODULE_DB_PREFIX . "RoomsUsers`.`Room` AND `" . MODULE_DB_PREFIX . "Rooms`.`Status`='" . ROOM_STATUS_DELETE . "' AND `" . MODULE_DB_PREFIX . "Rooms`.`When`<=(" . ($iCurrentTime - $iDeleteTime) . ")"); //--- delete empty rooms ---// if (getSettingValue($sModule, "removeRooms") == TRUE_VAL) { $aIds = getAdminIds(); $sIds = count($aIds) > 0 ? " AND `OwnerID` NOT IN (" . implode(',', $aIds) . ")" : ""; $rResult = getResult("SELECT DISTINCT(`Room`) FROM `" . MODULE_DB_PREFIX . "RoomsUsers`"); $aFullRooms = array(); $iCount = mysql_num_rows($rResult); for ($i = 0; $i < $iCount; $i++) { $aFullRoom = mysql_fetch_assoc($rResult); $aFullRooms[] = $aFullRoom['Room']; } $sFullRooms = count($aFullRooms) > 0 ? "`ID` NOT IN(" . implode(',', $aFullRooms) . ") AND " : ""; getResult("UPDATE `" . MODULE_DB_PREFIX . "Rooms` SET `Status`='" . ROOM_STATUS_DELETE . "', `When`=" . $iCurrentTime . " WHERE " . $sFullRooms . "`OwnerID`<>0" . $sIds); } //--- delete old messages ---// getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Messages` WHERE `Type`='text' AND `When`<=(" . ($iCurrentTime - $iDeleteTime) . ")"); //--- Get information about users in the chat ---// switch ($sMode) { case 'update': $rRes = getResult("SELECT ccu.`ID` AS `ID`, ccu.`Nick` AS `Nick`, ccu.`Sex` AS `Sex`, ccu.`Age` AS `Age`, ccu.`Desc` AS `Desc`, ccu.`Photo` AS `Photo`, ccu.`Profile` AS `Profile`, ccu.`Status` AS `Status`, ccu.`Online` AS `Online`, rp.`Type` AS `Type` FROM `" . MODULE_DB_PREFIX . "Profiles` AS rp, `" . MODULE_DB_PREFIX . "CurrentUsers` AS ccu WHERE rp.`ID`=ccu.`ID` ORDER BY ccu.`When`"); while ($aUser = mysql_fetch_assoc($rRes)) { if ($aUser['ID'] == $sId && !($aUser['Status'] == USER_STATUS_KICK || $aUser['Status'] == USER_STATUS_TYPE)) { continue; } switch ($aUser['Status']) { case USER_STATUS_NEW: $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status'], $aUser['Nick'], $aUser['Sex'], $aUser['Age'], stripslashes($aUser['Desc']), $aUser['Photo'], $aUser['Profile'], $aUser['Type'], $aUser['Online']); break; case USER_STATUS_TYPE: $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status'], $aUser['Type']); break; case USER_STATUS_ONLINE: $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status'], $aUser['Type'], $aUser['Online']); break; case USER_STATUS_IDLE: case USER_STATUS_KICK: $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status']); break; } } break; case 'all': $iRunTime = isset($_REQUEST['_t']) ? floor($_REQUEST['_t'] / 1000) : 0; $iCurrentTime -= $iRunTime; $rRes = getResult("SELECT ccu.`ID` AS `ID`, ccu.`Nick` AS `Nick`, ccu.`Sex` AS `Sex`, ccu.`Age` AS `Age`, ccu.`Desc` AS `Desc`, ccu.`Photo` AS `Photo`, ccu.`Profile` AS `Profile`, ccu.`Online` AS `Online`, rp.`Type` AS `Type`, (" . $iCurrentTime . "-`ccu`.`Start`) AS `Time` FROM `" . MODULE_DB_PREFIX . "Profiles` AS rp, `" . MODULE_DB_PREFIX . "CurrentUsers` AS ccu WHERE rp.`ID`=ccu.`ID` AND ccu.`Status` NOT IN ('" . USER_STATUS_IDLE . "', '" . USER_STATUS_KICK . "') AND rp.`Banned`='" . FALSE_VAL . "' ORDER BY ccu.`When`"); while ($aUser = mysql_fetch_assoc($rRes)) { $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], USER_STATUS_NEW, $aUser['Nick'], $aUser['Sex'], $aUser['Age'], stripslashes($aUser['Desc']), $aUser['Photo'], $aUser['Profile'], $aUser['Type'], $aUser['Online'], $aUser['Time']); } break; } return makeGroup($sContent, "users"); }
/** * 清除当前2小时以前的临时图片 * @param string $dir 目录路径 * @return void */ function clearTempImage($path = '') { global $_FANWE; if ($path == '') { $_FANWE['clear_image_count'] = 0; } $max_time = mktime(date('H') - 2, 0, 0, date('m'), date('d'), date('Y')) - date('Z'); $basepath = FANWE_ROOT . 'public/upload/temp/'; $paths = array(); if ($path != '') { $currentpath = str_replace($basepath, '', $path); $paths = explode('/', $currentpath); $year = (int) $paths[0]; $month = isset($paths[1]) ? (int) $paths[1] : 1; $day = isset($paths[2]) ? (int) $paths[2] : 1; $hours = isset($paths[3]) ? (int) $paths[3] : 0; $day_time = mktime($hours, 0, 0, $month, $day, $year) - date('Z'); if ($max_time <= $day_time) { return; } $currentpath .= '/'; } else { $currentpath = ''; } $dir = $basepath . $currentpath; $directory = dir($dir); while ($entry = @$directory->read()) { if ($_FANWE['clear_image_count'] >= 50) { break; } if ($entry != '.' && $entry != '..') { $filename = $dir . $entry; if (is_dir($filename)) { clearTempImage($filename); @rmdir($filename); } if (is_file($filename)) { removeFile($filename); $_FANWE['clear_image_count']++; } } } $directory->close(); }
validate(); if (defined("VALIDATED")) { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_LISTEN || $_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_LOGIN) { listenXML(); if (STATS_ACTIVE && !LOGIN) { $STATS->ProcessAction(ST_ACTION_LOG_STATUS, array($INTERNAL[CALLER_SYSTEM_ID])); } } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_INIT_UPLOAD) { initUpload(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SEND_FILE) { receiveFile(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_REMOVE_FILE) { removeFile(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SET_IDLE) { require LIVEZILLA_PATH . "_lib/functions.internal.man.inc.php"; setIdle($_POST[POST_INTERN_SERVER_IDLE]); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_SEND_RESOURCES) { require LIVEZILLA_PATH . "_lib/functions.internal.process.inc.php"; processUpdateReport(); processArchiveChats(); processResources(); } else { if ($_POST[POST_INTERN_SERVER_ACTION] == INTERN_ACTION_REPORTS) { require LIVEZILLA_PATH . "_lib/functions.internal.process.inc.php"; require LIVEZILLA_PATH . "_lib/functions.internal.build.inc.php"; processUpdateReport();
$_REQUEST['section'] = 'documents'; $_REQUEST['uploaded_file'] = $cid[0]; $GLOBALS['section'] = 'documents'; $GLOBALS['uploaded_file'] = $cid[0]; include_once $_DOCMAN->getPath('includes', 'documents'); break; case "upload": $step = JRequest::getInt('step', 1); $method = JRequest::getCmd('radiobutton', null, 'post'); if (!$method) { $method = JRequest::getCmd('method', 'http'); } uploadWizard($step, $method, $old_filename); break; case "remove": removeFile($cid); break; case "update": uploadWizard(2, 'http', $old_filename); break; case "show": default: showFiles(); } function showFiles() { global $option, $section; global $_DOCMAN; $database = JFactory::getDBO(); $mainframe = JFactory::getApplication(); $limit = $mainframe->getCfg('list_limit');
/** * 清除指定目录下的文件 * * @param string $dir * 目录路径 * @return void */ function clearDir($dir, $is_del_dir = false) { if (!file_exists($dir)) { return; } $directory = dir($dir); while ($entry = $directory->read()) { if ($entry != '.' && $entry != '..') { $filename = $dir . '/' . $entry; if (is_dir($filename)) { clearDir($filename, $is_del_dir); } if (is_file($filename)) { removeFile($filename); } } } $directory->close(); if ($is_del_dir) { @rmdir($dir); } }
function play($file) { $app = Slim\Slim::getInstance(); $log = $app->getLog(); $log->info("-> playFile: {$file}"); $out = ''; $info = pathinfo($file); $picture_extensions = array("jpg", "JPG", "png"); $extension = $info['extension']; $title = basename($file, '.' . $extension); if (in_array($extension, $picture_extensions)) { //shell_exec ('cp ' . escapeshellarg($file) . ' /tmp/fim_current'); $out = 'Not implemented'; } else { exec('pgrep omxplayer.bin', $pids); if (empty($pids)) { @unlink(FIFO); posix_mkfifo(FIFO, 0777); chmod(FIFO, 0777); shell_exec('./etc/omx_runner.sh ' . escapeshellarg($file) . ' ' . getOmxplayerOptions()); setCurrent($file); removeFile($file); setWatchdog('PLAY'); $out = 'Now playing: ' . basename($title); } else { send('q'); $out = play($file); } } return $out; }
$currentDirectory = $baseDirectory; if ($relativeDirectory != '') { $currentDirectory .= "/" . $relativeDirectory . "/"; } $column = $_POST['column'] ? $_POST['column'] : "name"; $order = $_POST['order'] ? $_POST['order'] : "ascending"; $message = ""; $errorMessage = ""; if ($task == "createFolder") { $message .= createNewFolder($currentDirectory, $newFolder); } if (isset($_POST['submitUpload'])) { $message .= uploadFile($_FILES["uploadFile"], $currentDirectory); } if ($task == "removeFile") { $message .= removeFile($currentDirectory, $deleteFile); } if ($task == "renameFile") { $message .= renameFile($currentDirectory, $renameFrom, $renameTo); } $directoryList = getDirectoryList($currentDirectory); $fileList = getFileList($currentDirectory); $navigationList["Fnow"] = str_replace('\\', '/', pFNOW); $navigationList["base"] = $cfg['base_directory']; $navigationList["relative"] = $relativeDirectory; $navigationList["column"] = $column; $navigationList["order"] = $order; $navigationList["pathData"] = $def['DIRECTORY']; $directoryListXML = setDirectoryListXML($currentDirectory, $navigationList, $directoryList, $fileList, $message); $result = processTransformation($directoryListXML, pFNOW . "/xsl/directoryList.xsl"); print $result;
echo "test queryFileList interface..."; $list_ret = $client->queryFileList($token, $ftype, 0, 10); if ($list_ret->result->ret == $SUCCESS) { echo "queryFileList is ok. "; var_dump($list_ret->files); } else { echo "<b>queryFileList is error. </b>"; echo $list_ret->result->msg; echo "<br />"; echo $list_ret->result->ret; echo "<br />"; } require_once __DIR__ . '/lib/basic.class.php'; echo "====333==<br />"; $filepath = '/data/html/www/netdisk_api/test11.jpg'; removeFile($filepath); $offerset = 0; $total = $qfile_ret->finfo->filesize; $readlen = 1000; while ($offerset <= $total) { $download_arr['objid'] = $testfile; $download_arr['offerset'] = $offerset; $download_arr['reqlen'] = $readlen; $download_arr['type'] = $ftype; $download_param = new \proto\DownloadParam($download_arr); $download = $client->downloadFile($token, $download_param); var_dump($download->result); if ($download->result->ret == 0) { $offerset = $offerset + $readlen; file_put_contents($filepath, $download->bin, FILE_APPEND | LOCK_EX); } else {
} if (empty($sContactId)) { $sFileName = time(); } else { getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Messages`(`ContactID`, `Message`, `Type`, `When`) VALUES('" . $sContactId . "', '" . $sMessage . "', 'file', '" . time() . "')"); $sFileName = getLastInsertId(); } $sFileName .= ".file"; if (!@rename($sFilePath, $sFilesPath . $sFileName)) { break; } $sContents = parseXml($aXmlTemplates['result'], $sFileName, SUCCESS_VAL); break; case 'removeFile': $sId = str_replace(".file", "", $sId); removeFile($sId); break; /** * >>> ACTIONS FOR INVITE <<< * Check for pending messages for given user */ /** * >>> ACTIONS FOR INVITE <<< * Check for pending messages for given user */ case 'updateInvite': $aMsg = getArray("SELECT `SenderID`, `Message` FROM `" . MODULE_DB_PREFIX . "Pendings` WHERE `RecipientID`='" . $sRspId . "' ORDER BY `ID` DESC LIMIT 1"); //--- if there is a message return it and some information about it's author ---// if (!empty($aMsg['SenderID'])) { $aUserInfo = getUserInfo($aMsg['SenderID']); $sContents = parseXml($aXmlTemplates['result'], TRUE_VAL, $aMsg['Message'], $aMsg['SenderID'], $aUserInfo['nick'], $aUserInfo['photo'], $aUserInfo['profile']);
/** * 删除前台管理锁定 * @return void */ function deleteManageLock($module, $id) { $module = strtolower($module); $lock_file = PUBLIC_ROOT . './manage/' . $module . '/' . $id . '.lock'; removeFile($lock_file); }
* DESCRIPTION: Updates the file status * PARAMETERS: api/files/setStatus.php <apikey> <path> <user> <status> */ if (isset($_GET['path']) and isset($_GET['user'])) { // --> begin authentication $havePermission = false; if (isset($_GET['apikey'])) { $auth = (string) $_GET['apikey']; $havePermission = $auth == $apikey; } else { $havePermission = $_SESSION["email"] == $_GET['user']; } // --> end authentication if (!$havePermission) { echo json_encode(array("result" => "permissionDenied")); } else { $path = (string) $_GET['path']; $user = (string) $_GET['user']; $modification = getFileModification($path, $user); $who = getFileComputers($path, $user); $size = getFileSize($path, $user); if (count($who) > 0) { requestFileDelete($modification, $who); } // please don't remove space from the usage removeFile($path, $user); echo json_encode(array("result" => "ok")); } } else { echo json_encode(array("result" => "missingParams")); }
<span class="true">■</span>删除成功 <span class="false">■</span>删除异常 HTML; $i = 0; while ($i < count($_SESSION['path'])) { echo <<<HTML <div class="big_board"><div class="board_title"></div></div> HTML; if (is_dir(_decode($_SESSION['path'][$i])) == true) { removeDir(_decode($_SESSION['path'][$i])); if (file_exists(_decode($_SESSION['path'][$i])) == false) { echo '[dir]<span class="true">' . _decode($_SESSION['path'][$i]) . '</span>'; } else { echo '[dir]<span class="false">' . _decode($_SESSION['path'][$i]) . '</span>'; } } if (is_file(_decode($_SESSION['path'][$i])) == true) { if (removeFile(_decode($_SESSION['path'][$i])) == true) { echo '[file]<span class="true">' . _decode($_SESSION['path'][$i]) . '</span>'; } else { echo '[file]<span class="false">' . _decode($_SESSION['path'][$i]) . '</span>'; } } $i++; } } echo <<<HTML <div class="big_board"><div class="board_title">By:Admin@Aite.Me</div></div> </body> </html> HTML; unset($_SESSION['path']);
public function deleteObject($bucket_name, $object_name) { $Connection = isset($this->ceph_conn) ? $this->ceph_conn : $this->connectionCeph(); $user = new UserService(); $fileinfo = self::queryFile($bucket_name, ${$object_name}); if ($Connection->if_object_exists($bucket_name, $object_name)) { $res = $Connection->delete_object($bucket_name, $object_name); if (!$res->isOK()) { return false; } } elseif ($Connection->if_object_exists($bucket_name, $object_name . '~')) { $upload = $user->queryUserUploadId(session('userid'), $object_name); $Connection->abort_multipart_upload($bucket_name, $object_name . '~', $upload['uploadid']); $res = $Connection->delete_object($bucket_name, $object_name . '~'); if (!$res->isOK()) { return false; } } $user->deleteUserUploadMarker(session('userid'), $object_name); $part_file_path = session('user_upload_path') . DIRECTORY_SEPARATOR . $object_name . '~' . DIRECTORY_SEPARATOR; removeFile($part_file_path); if ($fileinfo['status'] == 0) { $filesize = $fileinfo['filesize']; $user_space = $user->querySpace(session('userid')); $user->updateUserUspace(session('userid'), $user_space['uspace'] - intval($filesize)); } return true; }