• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP md5_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $remoteFilename = 'http://get.insight.sensiolabs.com/insight.phar';
     $localFilename = $_SERVER['argv'][0];
     $tempFilename = basename($localFilename, '.phar') . '-temp.phar';
     try {
         copy($remoteFilename, $tempFilename);
         if (md5_file($localFilename) == md5_file($tempFilename)) {
             $output->writeln('<info>insight is already up to date.</info>');
             unlink($tempFilename);
             return;
         }
         chmod($tempFilename, 0777 & ~umask());
         // test the phar validity
         $phar = new \Phar($tempFilename);
         // free the variable to unlock the file
         unset($phar);
         rename($tempFilename, $localFilename);
         $output->writeln('<info>insight updated.</info>');
     } catch (\Exception $e) {
         if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
             throw $e;
         }
         unlink($tempFilename);
         $output->writeln('<error>The download is corrupt (' . $e->getMessage() . ').</error>');
         $output->writeln('<error>Please re-run the self-update command to try again.</error>');
     }
 }
开发者ID:ftdysa,项目名称:insight,代码行数:31,代码来源:SelfUpdateCommand.php


示例2: buildjs

function buildjs()
{
    $t = $_GET["t"];
    $time = time();
    $MEPOST = 0;
    header("content-type: application/x-javascript");
    $tpl = new templates();
    $page = CurrentPageName();
    $array = unserialize(@file_get_contents($GLOBALS["CACHEFILE"]));
    $prc = intval($array["POURC"]);
    $title = $tpl->javascript_parse_text($array["TEXT"]);
    $md5file = trim(md5_file($GLOBALS["LOGSFILES"]));
    echo "// CACHE FILE: {$GLOBALS["CACHEFILE"]} {$prc}%\n";
    echo "// LOGS FILE: {$GLOBALS["LOGSFILES"]} - {$md5file} " . strlen($md5file) . "\n";
    if ($prc == 0) {
        if (strlen($md5file) < 32) {
            echo "\n\t// PRC = {$prc} ; md5file={$md5file}\n\tfunction Start{$time}(){\n\t\t\tif(!RTMMailOpen()){return;}\n\t\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
            return;
        }
    }
    if ($md5file != $_GET["md5file"]) {
        echo "\n\tvar xStart{$time}= function (obj) {\n\t\tif(!document.getElementById('text-{$t}')){return;}\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){\n\t\t\tdocument.getElementById('text-{$t}').value=res;\n\t\t}\t\t\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$md5file}');\n\t}\t\t\n\t\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Filllogs', 'yes');\n\t\tXHR.appendData('t', '{$t}');\n\t\tXHR.setLockOff();\n\t\tXHR.sendAndLoad('{$page}', 'POST',xStart{$time},false); \n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    if ($prc > 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\tdocument.getElementById('title-{$t}').style.border='1px solid #C60000';\n\t\tdocument.getElementById('title-{$t}').style.color='#C60000';\n\t\t\$('#progress-{$t}').progressbar({ value: 100 });\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    if ($prc == 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\t\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\t\tRTMMailHide();\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    echo "\t\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1500);\n";
}
开发者ID:articatech,项目名称:artica,代码行数:34,代码来源:squid.global.wl.center.progress.php


示例3: beforeSave

 public function beforeSave()
 {
     $path = $this->getRealPath();
     if (!$this->md5 && $this->path && file_exists($path)) {
         $this->md5 = md5_file($path);
     }
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:7,代码来源:File.php


示例4: testIfWillDeleteEmbeddedImage

 public function testIfWillDeleteEmbeddedImage()
 {
     $fileName = __DIR__ . '/logo-1024.png';
     $md5 = md5_file($fileName);
     // NOTE: Must work fine even if _id is not set
     $model = new ModelWithEmbeddedImage();
     $model->file = new Image();
     $model->file->set($fileName);
     $em = new EntityManager($model);
     $em->save();
     $finder = new Finder($model);
     $found = $finder->findByPk($model->_id);
     /* @var $found ModelWithEmbeddedImage */
     $file = $found->file->get()->getBytes();
     $this->assertSame($md5, md5($file));
     // Resize image
     $params = new ImageParams();
     $params->width = 100;
     $params->height = 100;
     $resized = $found->file->get($params)->getBytes();
     // Check if was resized
     $this->assertTrue($file > $resized);
     $mangan = new Mangan();
     $gfs = $mangan->getDbInstance()->getGridFS();
     $tmp = $mangan->getDbInstance()->getGridFS(File::TmpPrefix);
     $criteria = ['parentId' => $found->file->_id];
     $this->assertSame(1, $gfs->count($criteria));
     $this->assertSame(1, $tmp->count($criteria));
     $deleted = $found->delete();
     $this->assertTrue($deleted);
     $this->assertSame(0, $gfs->count($criteria));
     $this->assertSame(0, $tmp->count($criteria));
 }
开发者ID:maslosoft,项目名称:mangantest,代码行数:33,代码来源:EmbeddedFileTest.php


示例5: mise_a_jour_ecran_securite

/**
 * Mise a jour automatisee de l'ecran de securite
 * On se base sur le filemtime de l'ecran source avec un en-tete if_modified_since
 * Mais on fournit aussi le md5 de notre ecran actuel et la version branche de SPIP
 * Cela peut permettre de diffuser un ecran different selon la version de SPIP si besoin
 * ou de ne repondre une 304 que si le md5 est bon
 */
function mise_a_jour_ecran_securite()
{
    // TODO : url https avec verification du certificat
    return;
    // si l'ecran n'est pas deja present ou pas updatable, sortir
    if (!_URL_ECRAN_SECURITE or !file_exists($filename = _DIR_ETC . "ecran_securite.php") or !is_writable($filename) or !($last_modified = filemtime($filename)) or !($md5 = md5_file($filename))) {
        return false;
    }
    include_spip('inc/distant');
    $tmp_file = _DIR_TMP . "ecran_securite.php";
    $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5);
    $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']);
    $res = recuperer_url($url, array('if_modified_since' => $last_modified, 'file' => $tmp_file));
    // si il y a une version plus recente que l'on a recu correctement
    if ($res['status'] == 200 and $res['length'] and $tmp_file = $res['file']) {
        if ($md5 !== md5_file($tmp_file)) {
            // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale
            include_once $tmp_file;
            // ok, on le copie a la place de l'ecran existant
            // en backupant l'ecran avant, au cas ou
            @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified));
            @rename($tmp_file, $filename);
        } else {
            @unlink($tmp_file);
        }
    }
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:34,代码来源:mise_a_jour.php


示例6: afterValidate

 public function afterValidate($event)
 {
     $this->prepareDataDirectory();
     $file = CUploadedFile::getInstanceByName($this->uploadInstance);
     if ($file instanceof CUploadedFile && $file->getError() == UPLOAD_ERR_OK && !$this->Owner->hasErrors()) {
         $uniqueFilename = P3StringHelper::generateUniqueFilename($file->getName());
         $fullFilePath = $this->_fullDataPath . DIRECTORY_SEPARATOR . $uniqueFilename;
         $relativeFilePath = $this->_relativeDataPath . DIRECTORY_SEPARATOR . $uniqueFilename;
         if ($file->saveAs($fullFilePath)) {
             #echo $fullFilePath;exit;
             if (!$this->Owner->isNewRecord) {
                 $this->deleteFile($this->Owner->path);
             }
             if (!$this->Owner->title) {
                 $this->Owner->title = P3StringHelper::cleanName($file->name, 32);
             }
             $this->Owner->path = $relativeFilePath;
             $this->Owner->mimeType = $file->type;
             $this->Owner->size = $file->size;
             $this->Owner->originalName = $file->name;
             $this->Owner->md5 = md5_file($fullFilePath);
         } else {
             $this->Owner->addError('filePath', 'File uploaded failed!');
         }
     } else {
         if ($this->Owner->isNewRecord) {
             #$this->Owner->addError('filePath', 'No file uploaded!');
             Yii::trace('No file uploaded!');
         }
     }
 }
开发者ID:ranvirp,项目名称:rdp,代码行数:31,代码来源:P3FileUploadBehavior.php


示例7: scan_file_lists

/**
 * 文件扫描
 * @param $filepath     目录
 * @param $subdir       是否搜索子目录
 * @param $ex           搜索扩展
 * @param $isdir        是否只搜索目录
 * @param $md5			是否生成MD5验证码
 * @param $enforcement  强制更新缓存
 */
function scan_file_lists($filepath, $subdir = 1, $ex = '', $isdir = 0, $md5 = 0, $enforcement = 0)
{
    static $file_list = array();
    if ($enforcement) {
        $file_list = array();
    }
    $flags = $isdir ? GLOB_ONLYDIR : 0;
    $list = glob($filepath . '*' . (!empty($ex) && empty($subdir) ? '.' . $ex : ''), $flags);
    if (!empty($ex)) {
        $ex_num = strlen($ex);
    }
    foreach ($list as $k => $v) {
        $v1 = str_replace(PHPCMS_PATH, '', $v);
        if ($subdir && is_dir($v)) {
            scan_file_lists($v . DIRECTORY_SEPARATOR, $subdir, $ex, $isdir, $md5);
            continue;
        }
        if (!empty($ex) && strtolower(substr($v, -$ex_num, $ex_num)) == $ex) {
            if ($md5) {
                $file_list[$v1] = md5_file($v);
            } else {
                $file_list[] = $v1;
            }
            continue;
        } elseif (!empty($ex) && strtolower(substr($v, -$ex_num, $ex_num)) != $ex) {
            unset($list[$k]);
            continue;
        }
    }
    return $file_list;
}
开发者ID:klj123wan,项目名称:czsz,代码行数:40,代码来源:global.func.php


示例8: getMD5Hash

/** 
 * Function which will return the hash after passing through all folders and subfolders within it. 
 * @param $dir - Starting folder to scan
 * @param $excludeFileList - List of filenames to exclude from scan
 * @param $excludeExtensionList - List of extensions to exclude from scan  
 * @return Final MD5 of all files scanned.
 */
function getMD5Hash($dir, $excludeFileList, $excludeExtensionList)
{
    if (!is_dir($dir)) {
        return false;
    }
    $fileMD5list = array();
    $d = dir($dir);
    while (false !== ($entry = $d->read())) {
        if ($entry != '.' && $entry != '..') {
            if (is_dir($dir . '/' . $entry)) {
                $fileMD5list[] = getMD5Hash($dir . '/' . $entry, $excludeFileList, $excludeExtensionList);
            } else {
                if (stripos($excludeFileList, $entry) === false) {
                    $extension = end(explode('.', $entry));
                    //get the file extension
                    if (stripos($excludeExtensionList, $extension) === false) {
                        $fileMD5list[] = md5_file($dir . '/' . $entry);
                        //Prepare list to MD5 only allowed
                    }
                }
            }
        }
    }
    $d->close();
    return md5(implode('', $fileMD5list));
    //Return final MD5 of all files
}
开发者ID:angelesramil79,项目名称:projects,代码行数:34,代码来源:websitecds.php


示例9: check_new_file

 private static function check_new_file($old_image, $new_image)
 {
     if (md5_file($old_image) == md5_file($new_image) || filesize($old_image) == filesize($new_image)) {
         return 0;
     }
     return 1;
 }
开发者ID:kidambimanoj,项目名称:FollowU,代码行数:7,代码来源:PhotoDownloader.php


示例10: hashName

 /**
  * Get a filename for the file that is the MD5 hash of the contents.
  *
  * @param  string  $path
  * @return string
  */
 public function hashName($path = null)
 {
     if ($path) {
         $path = rtrim($path, '/') . '/';
     }
     return $path . md5_file($this->path()) . '.' . $this->extension();
 }
开发者ID:yipersevere,项目名称:2016UndergraduationCoursework,代码行数:13,代码来源:UploadedFile.php


示例11: moveUploadedFile

 public function moveUploadedFile(UploadedFile $file, $uploadBasePath, $relativePath, $fileName)
 {
     $originalName = $file->getFilename();
     // use filemtime() to have a more determenistic way to determine the subpath, otherwise its hard to test.
     // $relativePath = date('Y-m', filemtime($file->getPath()));
     $targetFileName = $relativePath . DIRECTORY_SEPARATOR . $originalName;
     $targetFilePath = $uploadBasePath . DIRECTORY_SEPARATOR . $targetFileName;
     $ext = $file->getExtension();
     $i = 1;
     while (file_exists($targetFilePath) && md5_file($file->getPath()) != md5_file($targetFilePath)) {
         if ($ext) {
             $prev = $i == 1 ? "" : $i;
             $targetFilePath = $targetFilePath . str_replace($prev . $ext, $i++ . $ext, $targetFilePath);
         } else {
             $targetFilePath = $targetFilePath . $i++;
         }
     }
     $targetDir = $uploadBasePath . DIRECTORY_SEPARATOR . $relativePath;
     if (!is_dir($targetDir)) {
         $ret = mkdir($targetDir, umask(), true);
         if (!$ret) {
             throw new \RuntimeException("Could not create target directory to move temporary file into.");
         }
     }
     //$file->move($targetDir, basename($targetFilePath));
     //$file->move($targetDir, basename($fileName.'.'.$ext));
     $file->move($targetDir, basename($fileName));
     return str_replace($uploadBasePath . DIRECTORY_SEPARATOR, "", $targetFilePath);
 }
开发者ID:alangalipaud,项目名称:ProjetQCM,代码行数:29,代码来源:UploadFileMover.php


示例12: downloadPlugin

 public function downloadPlugin($name, $url, $signature)
 {
     if (is_dir(ipFile("Plugin/{$name}/"))) {
         Service::deactivatePlugin($name);
         Helper::removeDir(ipFile("Plugin/{$name}/"));
     }
     //download plugin
     $net = new \Ip\Internal\NetHelper();
     $pluginTempFilename = $net->downloadFile($url, ipFile('file/secure/tmp/'), $name . '.zip');
     if (!$pluginTempFilename) {
         throw new \Ip\Exception('Plugin file download failed.');
     }
     $archivePath = ipFile('file/secure/tmp/' . $pluginTempFilename);
     //check signature
     $fileMd5 = md5_file($archivePath);
     $rsa = new \Crypt_RSA();
     $rsa->loadKey($this->publicKey);
     $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
     $verified = $rsa->verify($fileMd5, base64_decode($signature));
     if (!$verified) {
         throw new \Ip\Exception('Plugin signature verification failed.');
     }
     //extract
     $secureTmpDir = ipFile('file/secure/tmp/');
     $tmpExtractedDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $secureTmpDir);
     \Ip\Internal\Helper\Zip::extract($secureTmpDir . $pluginTempFilename, $secureTmpDir . $tmpExtractedDir);
     unlink($archivePath);
     //install
     $extractedDir = $this->getFirstDir($secureTmpDir . $tmpExtractedDir);
     $installDir = Model::pluginInstallDir();
     $newPluginDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $installDir);
     rename($secureTmpDir . $tmpExtractedDir . '/' . $extractedDir, $installDir . $newPluginDir);
     Service::activatePlugin($name);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:34,代码来源:PluginDownloader.php


示例13: stat

 function stat($file, $md5 = true, $sha1 = true)
 {
     $rval = array();
     foreach (stat($file) as $i => $v) {
         if (is_numeric($i)) {
             continue;
         }
         $rval[$i] = $v;
     }
     $rval['type'] = filetype($file);
     if ($rval['type'] == 'file') {
         if ($md5) {
             $rval['md5'] = md5_file($file);
         }
         if ($sha1) {
             $rval['sha1'] = sha1_file($file);
         }
     }
     $dir = $this->dir;
     if (0 !== strpos($file, $dir) && 'wp-config.php' == basename($file)) {
         $dir = explode(DIRECTORY_SEPARATOR, $dir);
         array_pop($dir);
         $dir = implode(DIRECTORY_SEPARATOR, $dir);
     }
     $rval['path'] = str_replace($dir, '', $file);
     return $rval;
 }
开发者ID:roblarsen,项目名称:jquery-wp-content,代码行数:27,代码来源:class.vaultpress-filesystem.php


示例14: resourceCache

 public function resourceCache($file)
 {
     // Second to cache
     $STC = 86400;
     // Greenwich Mean Time
     $GMT = gmdate("D, d M Y H:i:s", time() + $STC) . " GMT";
     // Last Modified
     $lastModified = filemtime($file);
     // Get a unique hash of this file (etag)
     $etagFile = md5_file($file);
     // Get the HTTP_IF_MODIFIED_SINCE header if set
     $ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false;
     // Get the HTTP_IF_NONE_MATCH header if set (etag: unique file hash)
     $etagHeader = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? trim($_SERVER['HTTP_IF_NONE_MATCH']) : false;
     // Set etag-header
     header("Etag: {$etagFile}");
     // Set last-modified header
     header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastModified) . " GMT");
     header("Expires: {$GMT}");
     header("Pragma: cache");
     // Make sure caching is turned on
     header("Cache-Control: public, max-age={$STC}");
     // Check if page has changed. If not, send 304 and exit
     if (@strtotime($ifModifiedSince) == $lastModified || $etagHeader == $etagFile) {
         header("HTTP/1.1 304 Not Modified");
         exit;
     }
 }
开发者ID:letid,项目名称:framework,代码行数:28,代码来源:response.php


示例15: testCorrectWorkflow

 /**
  * Testing correct create models
  *
  * @dataProvider dataProviderForCorrectWorkflow
  */
 public function testCorrectWorkflow($columns, $primaryKey, $rowTemplatePath, $tableTemplatePath)
 {
     $container = new \Mockery\Container();
     $templateRow = $container->mock('\\Bluzman\\Generator\\Template\\RowTemplate')->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $templateRow->shouldReceive('getDefaultTemplateData')->atLeast(1)->andReturn($this->dataForTemplate)->getMock();
     $templateTable = $container->mock('\\Bluzman\\Generator\\Template\\TableTemplate')->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $templateTable->shouldReceive('getDefaultTemplateData')->atLeast(1)->andReturn($this->dataForTemplate)->getMock();
     $command = $container->mock('\\Bluzman\\Command\\Init\\ModelCommand[getPrimaryKey, getColumns, getObjTemplate]')->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $command->shouldReceive('getPrimaryKey')->atLeast(1)->andReturn($primaryKey)->getMock();
     $command->shouldReceive('getColumns')->atLeast(1)->andReturn($columns)->getMock();
     $command->shouldReceive('getObjTemplate')->withArgs(['RowTemplate'])->andReturn($templateRow)->getMock();
     $command->shouldReceive('getObjTemplate')->withArgs(['TableTemplate'])->andReturn($templateTable)->getMock();
     $this->getApplication()->addCommands([$command]);
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName(), '--name' => $this->name, '--table' => $this->table]);
     // check that all went well
     $this->assertTrue($command->verify());
     $display = $commandTester->getDisplay();
     // check all messages were displayed
     $this->assertRegExp('/Running "init:model" command/', $display);
     $this->assertRegExp('/has been successfully created/', $display);
     $table = $this->modelPath . DS . 'Table.php';
     $row = $this->modelPath . DS . 'Row.php';
     $this->assertFileExists($table);
     $this->assertEquals(md5_file($table), md5_file($tableTemplatePath));
     $this->assertFileExists($row);
     $this->assertEquals(md5_file($row), md5_file($rowTemplatePath));
 }
开发者ID:bluzphp,项目名称:bluzman,代码行数:33,代码来源:ModelCommandTest.php


示例16: stuff

 public function stuff()
 {
     // check the upload form was actually submitted else print the form
     isset($_POST['submit_x']) or $this->error('the upload form is needed', $this->uploadForm);
     // check for PHP's built-in uploading this->errors
     $_FILES[$this->fieldname]['error'] == 0 or $this->error($this->errors[$_FILES[$this->fieldname]['error']], $this->uploadForm);
     // check that the file we are working on really was the subject of an HTTP upload
     @is_uploaded_file($_FILES[$this->fieldname]['tmp_name']) or $this->error('not an HTTP upload', $this->uploadForm);
     // Get the image type
     $extension = $this->getImageExtension($_FILES[$this->fieldname]['tmp_name']);
     if ($extension === false) {
         $this->error('only image uploads are allowed', $this->uploadForm);
     }
     // make a unique filename for the uploaded file and check it is not already
     // taken...
     $md5 = md5_file($_FILES[$this->fieldname]['tmp_name']);
     $fname = $md5 . '.' . $extension;
     if (file_exists($uploadFilename = $this->uploadsDirectory . $fname)) {
         $this->error('We already have that one!<br/>Be more original next time.', $this->uploadForm);
     }
     // now let's move the file to its final location and allocate the new filename to it
     @move_uploaded_file($_FILES[$this->fieldname]['tmp_name'], $uploadFilename) or $this->error('receiving directory insufficient permission', $this->uploadForm);
     $user_data = $this->getUserData();
     $sql = "SELECT id from users where username = '" . addslashes($user_data['username']) . "';";
     $user_id = $this->db->select_one($sql);
     if (!$user_id) {
         $user_id = $this->db->insert_array('users', $user_data);
     }
     $image_id = $this->saveImageToDB($md5, $extension, $user_id, $create_time);
     return $image_id;
 }
开发者ID:smoovej,项目名称:braincrave,代码行数:31,代码来源:ImageStuffer.php


示例17: backup

 public function backup($tempDir, $connection)
 {
     //$service = App::make('Tee\Backup\Services\BackupService');
     $databaseBackup = new \Tee\Backup\Package\Database();
     $databaseBackup->connection = $connection;
     $info = Config::get("database.connections.{$connection}");
     if (!$info) {
         throw new \Exception("Connection {$connection} not found");
     }
     if ($info['driver'] == 'mysql') {
         $databaseBackup->filename = md5($connection) . '.sql';
         $filename = "{$tempDir}/" . $databaseBackup->filename;
         $this->dumpMysqlDatabase($info, $filename);
     } else {
         if ($info['driver'] == 'sqlite') {
             $databaseBackup->filename = md5($connection) . '.sqlite';
             $filename = "{$tempDir}/" . $databaseBackup->filename;
             $this->dumpSqliteDatabase($info, $filename);
         } else {
             throw new \Exception("Backup not avaliable to driver: {$info['driver']}");
         }
     }
     $databaseBackup->md5 = md5_file($filename);
     return $databaseBackup;
 }
开发者ID:teewebapp,项目名称:backup,代码行数:25,代码来源:Backup.php


示例18: saveMultipleImages

 /**
  * 
  * @param string $paramName
  * @return ArrayCollection
  */
 public function saveMultipleImages($paramName = 'files')
 {
     $time = new \DateTime();
     $list = new ArrayCollection();
     foreach ($_FILES[$paramName]['name'] as $i => $v) {
         $name = $_FILES[$paramName]['name'][$i];
         $name2 = strtolower($name);
         $type = $_FILES[$paramName]['type'][$i];
         $tmp = $_FILES[$paramName]['tmp_name'][$i];
         $error = $_FILES[$paramName]['error'][$i];
         $size = $_FILES[$paramName]['size'][$i];
         $md5 = md5_file($tmp);
         $image = new Image();
         $md5Check = $this->findOneBy(array('md5' => $md5));
         if (empty($md5Check)) {
             $image->setMd5($md5);
             $image->setSizeKb(floatval($size / 1024));
             $image->setKey($this->getAvailableKey());
             move_uploaded_file($tmp, realpath(PUBLIC_PATH . '/uploaded-images') . '/' . $image->getKey());
         } else {
             $image->setReferenceImage($md5Check);
         }
         $image->setName(basename($name));
         $image->setUploadedTime($time);
         $this->save($image);
         $list->add($image);
     }
     return $list;
 }
开发者ID:jay45,项目名称:porn,代码行数:34,代码来源:ImageRepository.php


示例19: _scan

 /**
  * Helper function to traverse the directories. Called initially by scan()
  *
  * @param string $dir
  */
 private function _scan($dir)
 {
     if (in_array($dir, $this->exclusions)) {
         return;
     }
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($filename = readdir($dh)) !== false) {
                 if (substr($filename, 0, 1) == '.') {
                     continue;
                 }
                 $path = $dir . '/' . $filename;
                 if (is_dir($path)) {
                     $this->numDirectories++;
                     $this->_scan($path);
                 } else {
                     $this->numFiles++;
                     if (is_readable($path)) {
                         $md5 = md5_file($path);
                         $path = substr($path, strlen($this->rootDir) + 1);
                         fwrite($this->logFile, "{$md5}:{$path}\n");
                     }
                 }
             }
             closedir($dh);
         }
     }
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:33,代码来源:support.inc.php


示例20: getHash

 /**
  * @return string
  */
 public function getHash()
 {
     if ($this->_hash === null) {
         $this->_hash = md5(implode('|', array($this->_user, $this->_scope, $this->_onBehalfOfUser, md5_file($this->_keyFile))));
     }
     return $this->_hash;
 }
开发者ID:performics,项目名称:ga-cli-api,代码行数:10,代码来源:GoogleJWTRequestBuilder.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mdate函数代码示例发布时间:2022-05-15
下一篇:
PHP md5Verify函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap