/** * Upload a FTP to a remote server * * @param array $filedata * @param object $file * @return bool */ function ftp_upload_attachment(&$filedata, &$file) { global $user, $phpbb_root_path, $phpEx, $config; $user->add_lang('mods/ftp_attach'); $transfer = ftp_object($filedata); if (!$transfer) { return false; } if (!$transfer->copy_file($phpbb_root_path . $config['upload_path'] . '/' . $file->get('realname'), $file->get('realname'))) { $filedata['error'][] = $user->lang['FTP_ATTACH_COPY_ERR']; $file->remove(); return false; } // Need also to move the thumbnail :) if ($filedata['thumbnail']) { if (!$transfer->copy_file($file->get('destination_path') . '/thumb_' . $file->get('realname'), 'thumb_' . $file->get('realname'))) { $filedata['error'][] = $user->lang['FTP_ATTACH_COPY_THUMB_ERR']; $file->remove(); return false; } // Need also to remove the thumbnail @unlink($file->get('destination_path') . '/thumb_' . $file->get('realname')); } $file->remove(); return true; }
/** * @return void */ public function logout() { $this->session->remove('user_id'); $this->session->remove('user_agent'); $this->session->remove('uid'); $this->unsetUser(); $this->loggedIn = false; }
/** * {@inheritDoc} * * @param mixed $key */ protected function clearPersistentData($key) { if (!in_array($key, self::$kSupportedKeys)) { self::errorLog('Unsupported key passed to clearPersistentData.'); return; } $sessionVarName = $this->constructSessionVariableName($key); $this->session->remove($sessionVarName); }
/** * Unset a parent. * * @param pbject $parent The parent instance to unset. * @return self */ public function removeParent($parent) { $this->_parents->remove($parent); if ($this->_parents->count() === 0) { $this->collector()->remove($this->uuid()); } return $this; }
/** * Remove a cache * * @param string $id cache id to remove * @return boolean true if ok */ public function remove($id) { if (!$this->_options['caching']) { return true; } self::_validateIdOrTag($id); return $this->_backend->remove($id); }
/** * Update the cron job with the last time it was ran and the next time we need to run the cron. * We also add it into the cron log and clear the cron cache so a new cache can be created. * * @param int $iId ID for the cron * @param int $iTime Time stamp of when the next run must be executed */ private function _update($iId, $iTime) { // Update the time stamp for the current run and next run Phpfox_Database::instance()->update(Phpfox::getT('cron'), array('next_run' => $iTime, 'last_run' => PHPFOX_TIME), 'cron_id = ' . (int) $iId); // Store into the log Phpfox_Database::instance()->insert(Phpfox::getT('cron_log'), array('cron_id' => $iId, 'time_stamp' => PHPFOX_TIME)); // Clear the cache $this->_oCache->remove('cron'); }
/** * Remove a cache * * @param string $id Cache id to remove * @return boolean True if ok */ public function remove($id) { if (!$this->_options['caching']) { return true; } $id = $this->_id($id); // cache id may need prefix self::_validateIdOrTag($id); return $this->_backend->remove($id); }
/** * Renders shortcode * * @param object $attrs Attributes collection * @param string $content Shortcode content * @param string $tag Shortcode tag * @return void */ public function render($attrs, $content = null, $tag) { if ($attrs->get('id')) { // Set video $attrs->set('source', 'youtube'); // Making sure 'url' doesn't exist $attrs->remove('url'); (new View())->render($this->getTemplatePath(), $attrs->getAll()); } }
/** * Remove an item from the cache. * * @param string $key * @return bool */ public function forget($key) { @(list($group, $name) = $this->id($key)); $this->engine->setOption('cacheDir', $this->directory . DS . $group . DS); $success = $this->engine->remove($name, $group); if ($success == true) { return $success; } return false; }
/** * @codeCoverageIgnore * check to see if the asset is actually a symlink * and if so, has it gone passed the cache? * * @return bool */ public function checkLink($linkPath) { if (is_link($linkPath)) { $linkData = lstat($linkPath); if ($linkData['ctime'] + $this->cacheTime <= time()) { $this->fileSystem->remove($linkPath); return false; } } return true; }
/** * Remove a cached data file by id and group * * @param string $id The cache data id * @param string $group The cache data group * * @return boolean True on success, false otherwise * * @since 11.1 */ public function remove($id, $group) { self::$CacheLiteInstance->setOption('cacheDir', $this->_root . '/' . $group . '/'); $this->_getCacheId($id, $group); $success = self::$CacheLiteInstance->remove($this->rawname, $group); if ($success == true) { return $success; } else { return false; } }
/** * 删除数据 * * @author young * @name 删除数据 * @version 2013.11.14 young * @return JsonModel */ public function removeAction() { $_id = $this->params()->fromPost('_id', null); try { $_id = Json::decode($_id, Json::TYPE_ARRAY); } catch (\Exception $e) { return $this->msg(false, '无效的json字符串'); } if (!is_array($_id)) { return $this->msg(false, '请选择你要删除的项'); } foreach ($_id as $row) { $this->_data->remove(array('_id' => myMongoId($row))); } return $this->msg(true, '删除数据成功'); }
/** * Process Entity arranges * @param Project $project * @param bool $remove * @return mixed */ protected function processProjectDeletionFinalize(Project $project, $remove = true) { $returnValues['slot_name'] = 'proc'; try { // Finalizing process if (!$remove) { // Unset Local DB VCS related datas $project->setGitLabProjectId(null); $project->setGitLabHttpUrlToRepo(null); $project->setGitLabSshUrlToRepo(null); $project->setGitLabWebUrl(null); $project->setGitLabNamespace(null); $project->setGitNbCommits(null); $project->setGitCommitLastUpdate(null); // Unset Local DB PM related datas $project->setRedmineProjectId(null); $project->setRedmineProjectIdentifier(null); $project->setRedmineWebUrl(null); // Unser local DB QA related datas $project->setSonarProjectId(null); $project->setSonarProjectKey(null); $project->setSonarProjectUrl(null); // Other $project->setActive(false); // Remove project CIs $cis = $this->em->getRepository('SpiritDevDBoxPortalBundle:ContinuousIntegration')->findBy(array('project' => $project)); foreach ($cis as $ci) { $this->em->remove($ci); } } else { // Removing project $this->em->remove($project); } // Updating datas $this->em->flush(); $returnValues['data'][] = $this->setRetVal('Entity updated', 'bool', true); // Send user mail + team mail ? $this->mailer->processProjectDeletionSendMail($project); $returnValues['data'][] = $this->setRetVal('Mail sent', 'bool', true); $this->session->getFlashBag()->set('success', 'flashbag.demand.processing_deletion_project.success'); } catch (\Exception $e) { $returnValues['data'][] = $this->setRetVal('Entity updated', 'bool', false); // $returnValues['data'][] = $this->setRetVal('Mail sent', 'bool', false); $this->session->getFlashBag()->set('error', 'flashbag.demand.processing_deletion_project.error'); } return $returnValues; }
/** * Хук обработки формы Страницы * * @param object $Form * @param boolean $is_valid * @param object $result */ public function hookFormResultPage($Form, $is_valid, $result) { // Если идёт редактирование страницы, тогда удаляем поле if ($Form->object() instanceof Page) { $Form->remove('menu_item_autoadd'); } elseif ($result) { // Если было выбрано значение (не равно 0) и такое меню существует в базе if ($result->menu_item_autoadd && ($menu = menu($result->menu_item_autoadd))) { $menu_item = new Menu_Db_Item(); $menu_item->menu_id = $menu->id; $menu_item->label = $result->name; // по умолчанию совпадает с именем страницы, но после можно исправить после при редактировании меню // Внимание! Создаём объект Page для получения ссылки, но не сохраняем его! $menu_item->link = l($result->link); $menu_item->save(); // Можно и insert(), но через save() система сама определяет вставлять новое значение или обновлять уже выбранное } } }
/** * Remove a cache * * @param string $id cache id to remove * @return boolean true if ok */ public function remove($id) { /*******把更新的写入数据库,安徽汽车网用 start***** $cacheOptions=$this->_options; if (strpos($_SERVER['HTTP_HOST'],'ahauto')){ $cacheCode=new cacheCode(); if ($cacheOptions['lifetime']==14400){ $cacheType='longCache'; }elseif ($cacheOptions['lifetime']==360){ $cacheType='shortCache'; }else { $cacheType='permanentCache'; } $cacheCode->add('',$id,'',$cacheType,0); } *******把更新的写入数据库,安徽汽车网用 end*****/ if (!$this->_options['caching']) { return true; } self::_validateIdOrTag($id); return $this->_backend->remove($id); }
/** * Process queue * * @return bool */ public function process() { if ($this->error() || !$this->initialize()) { return false; } while (!$this->queue->isEmpty()) { $this->queue->read(); if ($this->queue->error()) { $this->error('Read queue messages failure,error:' . $this->queue->error()); Logger::error($this->error()); return false; } while (($message = $this->queue->pop()) !== null) { $error = false; $mid = key($message); $content = trim($message[$mid]); $lines = explode("\n", $content); foreach ($lines as $line) { if (DEBUG) { $timestart = microtime(true); } if (!$this->doProcess($line)) { $error = true; continue; } if (DEBUG) { $timeend = microtime(true); Logger::trace('Process successful,time uered: ' . round($timeend - $timestart, 3)); } } if (!$error) { $this->queue->remove($mid); } } } return $this->finalize(); }
/** * 删除数据集合的索引 * * @author young * @name 删除数据集合的索引 * @version 2013.12.22 young */ public function removeAction() { $_id = $this->params()->fromPost('_id', null); try { $_id = Json::decode($_id, Json::TYPE_ARRAY); } catch (\Exception $e) { return $this->msg(false, '无效的json字符串'); } if (!is_array($_id)) { return $this->msg(false, '请选择你要删除的项'); } foreach ($_id as $row) { $index = $this->_model->findOne(array('_id' => myMongoId($row))); if ($index == null) { return $this->msg(false, '无效的索引'); } $keys = Json::decode($index['keys']); if (!$this->_targetCollection->deleteIndex($keys)) { return $this->msg(false, '删除索引失败'); } $this->_model->remove(array('_id' => myMongoId($row))); } return $this->msg(true, '删除索引成功'); }
/** * (@inheritdoc) */ protected function remove($key) { $this->session->remove($key); }
/** * 注销 * * @param string $name */ public function unRegister($name) { $this->registry->remove($name); }
/** * Session destroy handler * * @access protected * @param string $id * @return boolean */ function _destroy($id) { return (bool)$this->_driverInstance->remove($id,'AK_SESSIONS'); }
/** * Remove cache for specified $key value * * @param string $key serialize name uniquely identifying content * * @return object CacheInterface * @since 1.0.0 */ public function remove($key = null) { return $this->adapter->remove($key); }
/** * @access public * @return string */ public function __toString() { if ($this->headers->get('Content-Type') == null) { $this->headers->set('Content-Type', 'application/octet-stream'); } $body = $this->body; if ($this->isMultiPart()) { $this->boundary = '--=_Part_' . md5(microtime()); $this->headers->get('Content-Type')->param('boundary', $this->boundary); if ($body != '') { $body .= "\r\n\r\n"; } foreach ($this->subparts as $subpart) { $body .= '--' . $this->boundary . "\r\n"; $body .= !is_string($subpart) ? $subpart->__toString() : $subpart; $body .= "\r\n"; } $body .= '--' . $this->boundary . "--\r\n"; } else { if ($encoding = $this->headers->get('Content-Transfer-Encoding')) { $encoding = strtolower($encoding->value); } if (!in_array($encoding, array('7bit', '8bit', 'quoted-printable', 'base64', 'binary'))) { $this->headers->remove('Content-Transfer-Encoding'); $encoding = '7bit'; } switch ($encoding) { case 'quoted-printable': /** * Encodage en chaîne à guillemets * * @see RFC 2045#6.7 */ $body = Mime::quotedPrintableEncode($body); break; case 'base64': /** * Encodage en base64 * * @see RFC 2045#6.8 */ $body = rtrim(chunk_split(base64_encode($body))); break; case '7bit': case '8bit': $body = preg_replace("/\r\n?|\n/", "\r\n", $body); /** * Limitation sur les longueurs des lignes de texte. * La limite basse est de 78 caractères par ligne. * En tout état de cause, chaque ligne ne DOIT PAS * faire plus de 998 caractères. * * @see RFC 2822#2.1.1 */ $body = Mime::wordwrap($body, $this->wraptext ? 78 : 998); break; } } return $this->headers->__toString() . "\r\n" . $body; }
/** * If this is an inverse side association complete the owning side. * * @param string $field * @param ClassMetadata $target_class * @param object $target_object * @param bool $null Whether to remove the association */ protected function completeOwningSide($field, $target_class, $target_object, $null = false) { $metadata = $this->_metadata(); // Add this object on the owning side aswell, for obvious infinite recursion // reasons this is only done when called on the inverse side. if ($metadata->isAssociationInverseSide($field)) { $mapped_by = $metadata->getAssociationMappedByTargetField($field); $target_metadata = \D::manager()->getClassMetadata($target_class); if ($null === true) { if ($target_metadata->isCollectionValuedAssociation($mapped_by)) { $target_object->remove($mapped_by, $this); } else { $target_object->set($mapped_by, null); } } else { if (!is_null($target_object)) { $setter = $target_metadata->isCollectionValuedAssociation($mapped_by) ? "add" : "set"; $target_object->{$setter}($mapped_by, $this); } } } }
/** * Tratamiento de formulario de datos de perfil * * @param object $user instancia de Model\User (por referencia) * @param object $vip instancia de Model\User\Vip (por referencia) * @param array $errors (por referencia) * @param string $log_action (por referencia) * @return boolean si se guarda bien */ public static function process_profile(&$user, &$vip, &$errors, &$log_action) { $fields = array('user_name' => 'name', 'user_location' => 'location', 'user_avatar' => 'avatar', 'user_about' => 'about', 'user_keywords' => 'keywords', 'user_contribution' => 'contribution', 'user_facebook' => 'facebook', 'user_google' => 'google', 'user_twitter' => 'twitter', 'user_identica' => 'identica', 'user_linkedin' => 'linkedin'); foreach ($fields as $fieldPost => $fieldTable) { if (isset($_POST[$fieldPost])) { $user->{$fieldTable} = $_POST[$fieldPost]; } } // Avatar if (isset($_FILES['avatar_upload']) && $_FILES['avatar_upload']['error'] != UPLOAD_ERR_NO_FILE) { $user->avatar = $_FILES['avatar_upload']; } // tratar si quitan la imagen if (!empty($_POST['avatar-' . $user->avatar->id . '-remove'])) { $user->avatar->remove(); $user->avatar = ''; } // Tratamiento de la imagen vip mediante el modelo User\Vip if ($vip instanceof Model\User\Vip) { if (isset($_FILES['avatar_upload']) && $_FILES['avatar_upload']['error'] != UPLOAD_ERR_NO_FILE) { $vip->image = $_FILES['vip_image_upload']; $vip->save($errors); } // tratar si quitan la imagen vip if ($vip->image instanceof Image && !empty($_POST['vip_image-' . $vip->image->id . '-remove'])) { $vip->image->remove(); $vip->remove(); } } // ojo si es receptor de pruebas, no machacarlo if (in_array('15', $user->interests)) { $_POST['user_interests'][] = '15'; } $user->interests = $_POST['user_interests']; //tratar webs existentes foreach ($user->webs as $i => &$web) { // luego aplicar los cambios if (isset($_POST['web-' . $web->id . '-url'])) { $web->url = $_POST['web-' . $web->id . '-url']; } //quitar las que quiten if (!empty($_POST['web-' . $web->id . '-remove'])) { unset($user->webs[$i]); } } //tratar nueva web if (!empty($_POST['web-add'])) { $user->webs[] = new Model\User\Web(array('url' => 'http://')); } /// este es el único save que se lanza desde un metodo process_ if ($user->save($errors)) { $log_action = 'Actualizado su perfil'; // Message::Info(Text::get('user-profile-saved')); $user = Model\User::flush(); return true; } else { $log_action = '¡ERROR! al actualizar su perfil'; Message::Error(Text::get('user-save-fail')); return false; } }
/** * Unset a parent. * * @param pbject $parent The parent instance to remove. * @return self */ public function removeParent($parent) { $this->_parents->remove($parent); return $this; }
/** * Release all resource after process end * Call by destruct * * @return void */ protected function __release() { // release global space for vars $this->global->remove(); // release shared space for vars $this->shared->remove(); // remove mutex for lock @sem_remove($this->mutex); }
/** * Remove a cache item * * @access public * @param string $id Cache id * @param string $group Name of the cache group * @return boolean True if no problem */ function remove($id, $group = 'default') { return $this->cache_enabled ? $this->_driverInstance->remove($id, $group) : true; }
/** * Remove row(s) from database * @return mixed array / boolean */ public function remove($filters) { return $this->collection->remove($filters); }
/** * Removes an existing row from a table, referenced by the row key * * @access public * @param string $key row id to remove * @return object PEAR_Error on failure */ function removeKey($key) { return $this->_dba->remove($key); }
/** * Drop the cache file corresponding to the given method call * * NB : The '___' at the end of the method name is to avoid collisions with * XMLRPC __call() * * @param string $methodName called method * @param array $parameters parameters of the called method */ public function dropCacheFile___($methodName, $parameters) { $id = $this->_makeCacheId___($methodName, $parameters); $this->_cacheObject->remove($id, $this->_defaultCacheGroup); }