/** * This method determines what should be done with a given file and adds * it via {@link GroupTest::addTestFile()} if necessary. * * This method should be overriden to provide custom matching criteria, * such as pattern matching, recursive matching, etc. For an example, see * {@link SimplePatternCollector::_handle()}. * * @param object $test Group test with {@link GroupTest::addTestFile()} method. * @param string $filename A filename as generated by {@link collect()} * @see collect() * @access protected */ protected function handle(&$test, $file) { if (is_dir($file)) { return; } $test->addFile($file); }
/** * Generates the header * * @return string The header */ public function getDisplay() { $retval = ''; if (!$this->_headerIsSent) { if (!$this->_isAjax && $this->_isEnabled) { $this->sendHttpHeaders(); $retval .= $this->_getHtmlStart(); $retval .= $this->_getMetaTags(); $retval .= $this->_getLinkTags(); $retval .= $this->getTitleTag(); // The user preferences have been merged at this point // so we can conditionally add CodeMirror if ($GLOBALS['cfg']['CodemirrorEnable']) { $this->_scripts->addFile('codemirror/lib/codemirror.js'); $this->_scripts->addFile('codemirror/mode/sql/sql.js'); $this->_scripts->addFile('codemirror/addon/runmode/runmode.js'); } if ($this->_userprefsOfferImport) { $this->_scripts->addFile('config.js'); } $retval .= $this->_scripts->getDisplay(); $retval .= $this->_getBodyStart(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $nav = new PMA_Navigation(); $retval .= $nav->getDisplay(); } // Include possible custom headers if (file_exists(CUSTOM_HEADER_FILE)) { $retval .= '<div id="pma_header">'; ob_start(); include CUSTOM_HEADER_FILE; $retval .= ob_get_contents(); ob_end_clean(); $retval .= '</div>'; } // offer to load user preferences from localStorage if ($this->_userprefsOfferImport) { include_once './libraries/user_preferences.lib.php'; $retval .= PMA_userprefsAutoloadGetHeader(); } // pass configuration for hint tooltip display // (to be used by PMA_tooltip() in js/functions.js) if (!$GLOBALS['cfg']['ShowHint']) { $retval .= '<span id="no_hint" class="hide"></span>'; } $retval .= $this->_getWarnings(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $retval .= $this->_menu->getDisplay(); $retval .= sprintf('<a id="goto_pagetop" href="#" title="%s">%s</a>', __('Click on the bar to scroll to top of page'), PMA_Util::getImage('s_top.png')); } $retval .= '<div id="page_content">'; $retval .= $this->getMessage(); } if ($this->_isEnabled && empty($_REQUEST['recent_table'])) { $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']); } } return $retval; }
/** * Compress data into the archive * * @param string $sFile Name of the ZIP file * @param string $sFolder Name of the folder we are going to compress. Must be located within the "file/cache/" folder. * @return mixed Returns the full path to the newly created ZIP file. */ public function compress($sFile, $sFolder) { // Create random ZIP $sArchive = PHPFOX_DIR_CACHE . md5((is_array($sFile) ? serialize($sFile) : $sFile) . Phpfox::getParam('core.salt') . PHPFOX_TIME) . '.zip'; chdir(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS); if (is_object($this->_oZip)) { if ($this->_oZip->open($sArchive, ZipArchive::CREATE)) { $aFiles = Phpfox::getLib('file')->getAllFiles(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS); foreach ($aFiles as $sNewFile) { $sNewFile = str_replace(PHPFOX_DIR_CACHE . $sFolder . PHPFOX_DS, '', $sNewFile); $this->_oZip->addFile($sNewFile); } $this->_oZip->close(); } } else { shell_exec(Phpfox::getParam('core.zip_path') . ' -r ' . escapeshellarg($sArchive) . ' ./'); } chdir(PHPFOX_DIR); return $sArchive; }
/** * Test check mimes * * @param array $file - list of file data * @param array $mimes - list of allowed MIME-types * * @dataProvider providerCheckMimes * * @return void */ public function test1CheckMimes($file, $mimes) { $this->uploader->addFile($file); $this->uploader->setMimes($mimes); $this->callMethod($this->uploader, 'checkMimes'); $this->assertCount(0, $this->uploader->getErrors()); $file['type'] = 'image/gif'; $this->uploader->addFile($file); $this->callMethod($this->uploader, 'checkMimes'); $this->assertCount(1, $this->uploader->getErrors()); }
/** * Add file to zip archive * * @param string $file File to add to archive * @param string $location Location in archive * * @return void */ public function addFile($file, $location = null) { if (!file_exists($file)) { return; } if (is_dir($file)) { return $this->addDir($file, $location); } if (substr($location, -1) != DIRECTORY_SEPARATOR) { $location .= DIRECTORY_SEPARATOR; } if (!@$this->zip->addFile($file, $location . pathinfo($file, PATHINFO_BASENAME)) === true) { throw new \Exception("Could not add {$file} to archive", 3); } }
public function saveFile(Form $addForm) { $params = $this->getRequest()->getParams(); $values = $addForm->getValues(); $id = $params['id']; try { if ($this->gallery->addFile($id, $values['file_id'])) { $this->flashMessage('Image added into the gallery.', 'ok'); } else { $this->flashMessage('Image is already in gallery.'); } } catch (DibiException $e) { $this->flashMessage('Error' . $e, 'err'); } $this->redirect('this'); }
/** * Add item to zip archive * * @param string $file File to add (realpath) * @param bool $flatroot (optional) If true, source directory will be not included * @param string $base (optional) Base to record in zip file * * @throws \Comodojo\Exception\ZipException */ private function addItem($file, $flatroot = false, $base = null) { $file = is_null($this->path) ? $file : $this->path . $file; $real_file = str_replace('\\', '/', realpath($file)); $real_name = basename($real_file); if (!is_null($base)) { if ($real_name[0] == "." and in_array($this->skip_mode, array("HIDDEN", "ALL"))) { return; } if ($real_name[0] == "." and @$real_name[1] == "_" and in_array($this->skip_mode, array("COMODOJO", "ALL"))) { return; } } if (is_dir($real_file)) { if (!$flatroot) { $folder_target = is_null($base) ? $real_name : $base . $real_name; $new_folder = $this->zip_archive->addEmptyDir($folder_target); if ($new_folder === false) { throw new ZipException(self::getStatus($this->zip_archive->status)); } } else { $folder_target = null; } foreach (new \DirectoryIterator($real_file) as $path) { if ($path->isDot()) { continue; } $file_real = $path->getPathname(); $base = is_null($folder_target) ? null : $folder_target . "/"; try { $this->addItem($file_real, false, $base); } catch (ZipException $ze) { throw $ze; } } } else { if (is_file($real_file)) { $file_target = is_null($base) ? $real_name : $base . $real_name; $add_file = $this->zip_archive->addFile($real_file, $file_target); if ($add_file === false) { throw new ZipException(self::getStatus($this->zip_archive->status)); } } else { return; } } }
/** * Generates the header * * @return string The header */ public function getDisplay() { $retval = ''; if (!$this->_headerIsSent) { if (!$this->_isAjax && $this->_isEnabled) { $this->sendHttpHeaders(); $retval .= $this->_getHtmlStart(); $retval .= $this->_getMetaTags(); $retval .= $this->_getLinkTags(); $retval .= $this->_getTitleTag(); $title = PMA_sanitize(PMA_escapeJsString($this->_getPageTitle()), false, true); $this->_scripts->addCode("if (typeof(parent.document) != 'undefined'" . " && typeof(parent.document) != 'unknown'" . " && typeof(parent.document.title) == 'string')" . "{" . "parent.document.title = '{$title}'" . "}"); if ($this->_userprefsOfferImport) { $this->_scripts->addFile('config.js'); } $retval .= $this->_scripts->getDisplay(); $retval .= $this->_getBodyStart(); // Include possible custom headers if (file_exists(CUSTOM_HEADER_FILE)) { ob_start(); include CUSTOM_HEADER_FILE; $retval .= ob_get_contents(); ob_end_clean(); } // offer to load user preferences from localStorage if ($this->_userprefsOfferImport) { include_once './libraries/user_preferences.lib.php'; $retval .= PMA_userprefsAutoloadGetHeader(); } // pass configuration for hint tooltip display // (to be used by PMA_createqTip in js/functions.js) if (!$GLOBALS['cfg']['ShowHint']) { $retval .= '<span id="no_hint" class="hide"></span>'; } $retval .= $this->_getWarnings(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $retval .= $this->_menu->getDisplay(); } $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']); } } return $retval; }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \Models\Note (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setUserId($this->getUserId()); $copyObj->setImportance($this->getImportance()); $copyObj->setTitle($this->getTitle()); $copyObj->setDeadline($this->getDeadline()); $copyObj->setCategoryId($this->getCategoryId()); $copyObj->setState($this->getState()); $copyObj->setRepeatAfter($this->getRepeatAfter()); $copyObj->setDoneAt($this->getDoneAt()); $copyObj->setPublic($this->getPublic()); $copyObj->setDescription($this->getDescription()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getSubNotes() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addSubNote($relObj->copy($deepCopy)); } } foreach ($this->getFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFile($relObj->copy($deepCopy)); } } foreach ($this->getNotifications() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addNotification($relObj->copy($deepCopy)); } } foreach ($this->getComments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addComment($relObj->copy($deepCopy)); } } foreach ($this->getShareds() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addShared($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * アップロードファイルパラメーター初期化. * * @param object $objUpFile SC_UploadFileのインスタンス. * @return void */ function lfInitUploadFile(&$objUpFile) { $objUpFile->addFile("プラグイン", 'plugin_file', array('tar', 'tar.gz'), TEMPLATE_SIZE, true, 0, 0, false); }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of sfGuardUser (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setUsername($this->getUsername()); $copyObj->setAlgorithm($this->getAlgorithm()); $copyObj->setSalt($this->getSalt()); $copyObj->setPassword($this->getPassword()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setLastLogin($this->getLastLogin()); $copyObj->setIsActive($this->getIsActive()); $copyObj->setIsSuperAdmin($this->getIsSuperAdmin()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getBranchs() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addBranch($relObj->copy($deepCopy)); } } foreach ($this->getCommentsRelatedByUserId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCommentRelatedByUserId($relObj->copy($deepCopy)); } } foreach ($this->getCommentsRelatedByCheckUserId() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCommentRelatedByCheckUserId($relObj->copy($deepCopy)); } } foreach ($this->getFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFile($relObj->copy($deepCopy)); } } foreach ($this->getProfiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProfile($relObj->copy($deepCopy)); } } foreach ($this->getStatusActions() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addStatusAction($relObj->copy($deepCopy)); } } foreach ($this->getsfGuardUserPermissions() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addsfGuardUserPermission($relObj->copy($deepCopy)); } } foreach ($this->getsfGuardUserGroups() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addsfGuardUserGroup($relObj->copy($deepCopy)); } } foreach ($this->getsfGuardRememberKeys() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addsfGuardRememberKey($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Track (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setFingerprint($this->fingerprint); $copyObj->setInserted($this->inserted); $copyObj->setUpdated($this->updated); $copyObj->setMbid($this->mbid); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getFeaturevectors() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFeaturevector($relObj->copy($deepCopy)); } } foreach ($this->getFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFile($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value }
/** * アップロードファイルパラメーター情報の初期化 * - ダウンロード商品ファイル用 * * @param object $objDownFile SC_UploadFileインスタンス * @return void */ function lfInitDownFile(&$objDownFile) { $objDownFile->addFile(t('c_File for download sales_01'), 'down_file', explode(',', DOWNLOAD_EXTENSION), DOWN_SIZE, true, 0, 0); }
/** * アップロードファイルパラメーター情報の初期化 * - 画像ファイル用 * * @param object $objUpFile SC_UploadFileインスタンス * @return void */ function lfInitFile(&$objUpFile) { $objUpFile->addFile('一覧-メイン画像', 'main_list_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $objUpFile->addFile('詳細-メイン画像', 'main_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT); $objUpFile->addFile('詳細-メイン拡大画像', 'main_large_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT); for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { $objUpFile->addFile("詳細-サブ画像{$cnt}", "sub_image{$cnt}", array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_WIDTH, NORMAL_SUBIMAGE_HEIGHT); $objUpFile->addFile("詳細-サブ拡大画像{$cnt}", "sub_large_image{$cnt}", array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_SUBIMAGE_WIDTH, LARGE_SUBIMAGE_HEIGHT); } }
/** * zip the directory * @param string $dir * @param object $zip * @return mixed */ private function Zip($dir, &$zip) { $cnt = 0; $pos = mb_strlen($dir) + 1; // remove part of the path $itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD); foreach ($itr as $fle => $spl) { if ($spl->isFile()) { $nme = str_replace(self::DS, '/', substr($fle, $pos)); // normalize localname if ($zip->addFile($fle, $nme)) { // add a file $cnt++; } else { $cnt = $fle; // couldn't add the file break; } } } return $cnt; }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of Branch (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setRepositoryId($this->getRepositoryId()); $copyObj->setName($this->getName()); $copyObj->setBaseBranchName($this->getBaseBranchName()); $copyObj->setCommitReference($this->getCommitReference()); $copyObj->setLastCommit($this->getLastCommit()); $copyObj->setLastCommitDesc($this->getLastCommitDesc()); $copyObj->setIsBlacklisted($this->getIsBlacklisted()); $copyObj->setReviewRequest($this->getReviewRequest()); $copyObj->setStatus($this->getStatus()); $copyObj->setCommitStatusChanged($this->getCommitStatusChanged()); $copyObj->setUserStatusChanged($this->getUserStatusChanged()); $copyObj->setDateStatusChanged($this->getDateStatusChanged()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getComments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addComment($relObj->copy($deepCopy)); } } foreach ($this->getFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFile($relObj->copy($deepCopy)); } } foreach ($this->getStatusActions() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addStatusAction($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * アップロードファイルパラメーター情報の初期化 * - ダウンロード商品ファイル用 * * @param object $objDownFile SC_UploadFileインスタンス * @return void */ function lfInitDownFile(&$objDownFile) { $objDownFile->addFile('ダウンロード販売用ファイル', 'down_file', explode(',', DOWNLOAD_EXTENSION), DOWN_SIZE, true, 0, 0); }
/** * Add from a node. * * @param object $phar The Phar class. * @param object $node The node to add. * @param string $prefix The prefix of the structure. * * @return void */ function buildFromNode(&$phar, $node, $prefix = '') { $nodeName = $node->nodeName; if ($nodeName !== 'dir' && $nodeName !== 'file') { // Invalid node. return; } $path = $prefix . $node->getAttribute('name'); if ($node->getAttribute('role') === 'php' || $node->getAttribute('role') === 'data') { $path = ltrim($path, '/'); $phar->addFile(realpath(__DIR__ . '/../' . $path), $path); $phar[$path]->compress(Phar::GZ); } if ($nodeName === 'dir') { // Descend into the depths. $path = rtrim($path, '/') . '/'; $children = $node->childNodes; $childLn = $children->length; for ($c = 0; $c < $childLn; $c++) { $child = $children->item($c); buildFromNode($phar, $child, $path); } } }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \Models\Pack (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setName($this->getName()); $copyObj->setDescription($this->getDescription()); $copyObj->setPrivate($this->getPrivate()); $copyObj->setOwnerId($this->getOwnerId()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getPackPermissions() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addPackPermission($relObj->copy($deepCopy)); } } foreach ($this->getFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFile($relObj->copy($deepCopy)); } } foreach ($this->getComments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addComment($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
/** * Export files and add to bagit. * * @param integer $asset_id * @param integer $total_size * @param integer $total_files * @param object $bagit_lib * * @return boolean */ function do_export($asset_id, &$total_size, &$total_files, $bagit_lib) { make_dir($this->temp_path); $this->export_pbcore_premis->asset_id = $asset_id; $this->export_pbcore_premis->is_pbcore_export = TRUE; $this->export_pbcore_premis->make_xml(); $file_name = $this->export_pbcore_premis->make_file_name(); $path = "{$this->temp_path}{$file_name}_pbcore.xml"; $this->export_pbcore_premis->format_xml($path); $total_size = $total_size + filesize($path); $total_files++; $bagit_lib->addFile($path, "{$file_name}/{$file_name}_pbcore.xml"); $this->export_pbcore_premis->is_pbcore_export = FALSE; $result = $this->export_pbcore_premis->make_xml(); if ($result) { $file_name = $this->export_pbcore_premis->make_file_name(); $path = "{$this->temp_path}{$file_name}_premis.xml"; $this->export_pbcore_premis->format_xml($path); $bagit_lib->addFile($path, "{$file_name}/{$file_name}_premis.xml"); $total_size = $total_size + filesize($path); $total_files++; } unset($this->export_pbcore_premis->xml); return TRUE; }
/** * Sets the image filename to be uploaded. * * @param mixed $file Filename of image. * * @return void */ public function setImage($file) { $this->httpRequest->addFile('media', $file); }
/** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of \App\Propel\FileType (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setFileTypeCode($this->getFileTypeCode()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); foreach ($this->getFiles() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFile($relObj->copy($deepCopy)); } } foreach ($this->getFileTypeI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addFileTypeI18n($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setFileTypeId(NULL); // this is a auto-increment column, so set to default value } }