本文整理汇总了PHP中DataHandler::removeDobleBars方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::removeDobleBars方法的具体用法?PHP DataHandler::removeDobleBars怎么用?PHP DataHandler::removeDobleBars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::removeDobleBars方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
public function insert()
{
//inicia um retorno de ReturnResultVO
$ReturnResultVO = new ReturnResultVO();
//pega os dados baseado na infoPost
$VO = new FileVO();
if ($this->infoPost->file_info_id) {
$VO->setId($this->infoPost->file_info_id, TRUE);
}
$VO->setActive($this->infoPost->file_info_active);
$VO->setName($this->infoPost->file_info_name);
$VO->setDescription($this->infoPost->file_info_description);
$VO->setType($this->infoPost->file_info_type);
$VO->setAuthor($this->infoPost->file_info_author);
$VO->setLocale($this->infoPost->file_info_locale);
$VO->setOrder($this->infoPost->file_info_order);
//("JÁ") gera id para criar pasta onde vai ser guardado o arquivo
$ReturnResultFileVO = $VO->commit();
if ($ReturnResultFileVO->success) {
$ReturnResultFileVO->result = $VO->getId();
} else {
//erro, os motivos estão na ReturnResultVO abaixo
return $ReturnResultFileVO;
}
//pega o id da file
$FILE_ID = $VO->getId();
$ReturnResultFileVO = new ReturnResultVO();
if (isset($this->infoPost->file_data) && !$this->infoPost->file_info_id > 0) {
set_time_limit(0);
$sentFileData = $this->infoPost->file_data;
//$_FILES['Filedata'];
$name = $sentFileData['name'];
// extens�o enviada
$sentExtension = DataHandler::returnExtensionOfFile($name);
// remove caracteres escrotos
$name = DataHandler::returnFilenameWithoutExtension($name);
$name = DataHandler::removeAccent($name);
$name = DataHandler::removeSpecialCharacters($name);
$name = trim(substr($name, 0, 80));
switch ($sentFileData["type"]) {
case "text/plain":
$extension = "txt";
break;
default:
$extension = strtolower($sentExtension);
break;
}
//verifica se a pasta existe, se não existir, inventa
DataHandler::createFolderIfNotExist($this->defaultFolderForNewFiles);
// pasta de upload de files está no config.php
$tempFolder = DataHandler::removeDobleBars($this->defaultFolderForNewFiles . "/" . $FILE_ID);
DataHandler::createFolderIfNotExist($tempFolder);
$tempUrl = $tempFolder . "/" . strtolower($name . "." . $extension);
$i = 2;
while (file_exists($tempUrl)) {
$tempUrl = $tempFolder . "/" . strtolower($name . "-" . $i . "." . $extension);
$i++;
}
$VO->setUrl($tempUrl);
$ReturnResultFileVO = $VO->commit();
//Debug::li("aaa");
if ($ReturnResultFileVO->success) {
//incluir o vinculo com a linked_table e linked_table_id
//receber table
// table_id
if ($this->infoPost->table) {
$table = $this->infoPost->table;
$table_id = $this->infoPost->table_id;
include_once "library/facil3/core/dao/LinkDAO.class.php";
$LinkDAO = new LinkDAO();
//vincula a foto ao table e table_id enviado
$ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
if (!$ReturnResultVinculoVO->success) {
//deu erro ao vincular
$ReturnResultVO->success = false;
$ReturnResultVO->appendMessage($ReturnResultVinculoVO->array_messages);
return $ReturnResultVO;
}
} else {
$ReturnResultVO->addMessage(Translation::text("LibraryLanguage::WARNING_FILE_NO_LINKED_TABLE"));
}
//movendo o arquivo para sua respectiva pasta.
$localFile = $VO->getUrl();
if (!move_uploaded_file($sentFileData['tmp_name'], $localFile)) {
$ReturnResultVO->success = false;
$ReturnResultVO->addMessage(Translation::text("Arquivo não encontrado"));
return $ReturnResultVO;
} else {
$ReturnResultVO->success = TRUE;
$ReturnResultVO->result = $VO->getId();
$ReturnResultVO->addMessage(Translation::text("Arquivo gravado"));
}
} else {
return $ReturnResultFileVO;
}
return $ReturnResultVO;
} else {
$ReturnResultFileVO = new ReturnResultVO();
$ReturnResultFileVO->addMessage("Envie o Filedata");
// nao veio filedata
//.........这里部分代码省略.........
示例2: __construct
<?php
include_once "library/facil3/core/modules/category/dao/CategoryDAO.class.php";
include_once Config::FOLDER_APPLICATION . "modules/content/dao/ContentSiteDAO.class.php";
include_once "library/facil3/core/controller/interface/HTTPControllerInterface.class.php";
include_once Config::getFolderView("/content_module/HttpContentModule.class.php");
include_once "library/facil3/core/modules/file/dao/FileDAO.class.php";
include_once "library/facil3/navigation/http/HttpResult.class.php";
include_once DataHandler::removeDobleBars(Config::getFolderView() . "/HttpRoot.class.php");
/**
* @author Renato Miawaki
* @desc Controller central, se nenhuma outra controller for encontrada, esta controller é iniciada
* init é chamada caso nenhum metodo que combine com a requisição seja encontrada
*/
class Produtos
{
private $arrayRestFolder = array();
private $arrayVariable = array();
private $DAO;
public function __construct($arrayRestFolder)
{
Config::getConection();
$this->DAO = CategoryDAO::getInstance();
if ($arrayRestFolder != NULL) {
$this->arrayRestFolder = $arrayRestFolder;
$this->arrayVariable = Navigation::getVariableArraySlug($this->arrayRestFolder);
//$this->MenuController = new MenuController($this->arrayVariable);
}
}
/**
* para listagem de produtos
示例3: getHtml
function getHtml($templateItemSelecionado = "<li class=\"atual\">php[item]</li>", $templateItem = "<li><a href=\"php[link]\">php[item]</a></li>", $templateAnteriorAtivo = "<li class=\"ativo\"><a href=\"php[link]\"><</a></li>", $templateAnteriorInativo = "<li class=\"inativo\">anterior</li>", $templateProximoAtivo = "<li class=\"ativo\"><a href=\"php[link]\">></a></li>", $templateProximoInativo = "<li class=\"inativo\">próximo</li>", $templateSeparador = " ", $templatePaginacao = "<ul class=\"paginacao\"> \r\n\t\t\t\t\t\t\t\t\tphp[primeiro]\r\n\t\t\t\t\t\t\t\t\tphp[anterior]\r\n\t\t\t\t\t\t\t\t\tphp[paginacao]\r\n\t\t\t\t\t\t\t\t\tphp[proximo]\r\n\t\t\t\t\t\t\t\t\tphp[ultimo]\r\n\t\t\t\t\t\t\t\t\t</ul>", $linkAtual = "", $returnCleanIfDontNeedPages = TRUE, $templatePrimeiro = "<li class=\"ativo\"><a href=\"php[link]\"><<</a></li>", $templateUltimo = "<li class=\"ativo\"><a href=\"php[link]\">>></a></li>")
{
//devolve string
/*
public $paginaAtual_int;
public $limitePaginacao_int;
public $quantidadePorPagina_int;\
public $quantTotalResultados_int;
*/
// para uso do fácil
$paginaAtual = $this->paginaAtual_int;
$templateItemSelecionado = $templateItemSelecionado;
$templateItem = $templateItem;
$templateAnteriorAtivo = $templateAnteriorAtivo;
$templateAnteriorInativo = $templateAnteriorInativo;
$templateProximoAtivo = $templateProximoAtivo;
$templateProximoInativo = $templateProximoInativo;
$templateSeparador = $templateSeparador;
$templatePaginacao = $templatePaginacao;
$templateUltimo = $templateUltimo;
$templatePrimeiro = $templatePrimeiro;
$result = $templatePaginacao;
$quantTotalPagina = ceil($this->quantTotalResultados_int / $this->quantidadePorPagina_int);
$pagFinal = $quantTotalPagina;
$metadePaginacao = floor($this->limitePaginacao_int / 2);
$paginaInicial = 1;
if ($this->limitePaginacao_int > 0) {
// faz o calculo se tiver limite
if ($quantTotalPagina > $this->limitePaginacao_int) {
$paginaInicial = $this->paginaAtual_int - $metadePaginacao;
if ($paginaInicial < 1) {
$paginaInicial = 1;
}
}
}
if ($this->limitePaginacao_int > 0) {
//só faz o calculo se tiver limite
$paginaFinal = $paginaInicial + $this->limitePaginacao_int;
} else {
$paginaFinal = $quantTotalPagina;
}
//verificando se a página final não está acima da quantidade de resultados
if ($paginaFinal > $quantTotalPagina) {
$paginaFinal = $quantTotalPagina;
}
// montando o link do a href=''
if (empty($linkAtual)) {
$linkAtual = Config::getRootPath(DataHandler::removeDobleBars(str_replace(Config::getRootApplication(), "", $_SERVER["REQUEST_URI"])));
}
if ($returnCleanIfDontNeedPages && $this->quantTotalResultados_int <= $this->quantidadePorPagina_int) {
//se não precisar de paginação, e for enviado que quando isso acontecer retornar vazio, lá vai o vazio
return "";
}
$primeira = str_replace("/pag.{$paginaAtual}", "/pag.1", $linkAtual);
if ($paginaAtual > 1) {
$ultima = str_replace("/pag.{$paginaAtual}", "/pag." . $paginaFinal, $linkAtual);
} else {
$ultima = $linkAtual . "/pag." . $pagFinal;
}
//exit();
if (strpos($linkAtual, "/pag.{$paginaAtual}")) {
//entra aqui se existe a tag de página no padrao com a página atual setada
$anterior = str_replace("/pag.{$paginaAtual}", "/pag." . ($this->paginaAtual_int - 1), $linkAtual);
$proximo = str_replace("/pag.{$paginaAtual}", "/pag." . ($this->paginaAtual_int + 1), $linkAtual);
} else {
if (strpos($linkAtual, "/pag.")) {
//entra aqui se tiver em alguma página setada
$anterior = @ereg_replace("pag\\.[0-9]+", "pag." . ($this->paginaAtual_int - 1), $linkAtual);
$proximo = @ereg_replace("pag\\.[0-9]+", "pag." . ($this->paginaAtual_int + 1), $linkAtual);
} else {
//entra aqui se nunca foi setada nenhuma página
$anterior = $linkAtual . "/pag." . ($this->paginaAtual_int - 1);
$proximo = $linkAtual . "/pag." . ($this->paginaAtual_int + 1);
}
}
$anterior = str_replace("http://", "", $anterior);
$proximo = str_replace("http://", "", $proximo);
$primeira = str_replace("http://", "", $primeira);
$ultima = str_replace("http://", "", $ultima);
$anterior = str_replace("//", "/", $anterior);
$proximo = str_replace("//", "/", $proximo);
$primeira = str_replace("//", "/", $primeira);
$ultima = str_replace("//", "/", $ultima);
$anterior = "http://" . $anterior;
$proximo = "http://" . $proximo;
$primeira = "http://" . $primeira;
$ultima = "http://" . $ultima;
$temp_primeira = str_replace("php[link]", $primeira, $templatePrimeiro);
$temp_ultima = str_replace("php[link]", $ultima, $templateUltimo);
//definindo qual template usar para o botao anterior
$temp_anterior = "";
if ($this->paginaAtual_int > 1) {
//existe uma página proxima a esta
$temp_anterior = $templateAnteriorAtivo;
//echo Debug::li($temp_anterior);
$temp_anterior = str_replace("php[link]", $anterior, $temp_anterior);
//echo Debug::li($temp_anterior);
//exit();
} else {
$temp_anterior = $templateAnteriorInativo;
//.........这里部分代码省略.........
示例4: getAsset
/**
* retorna o caminho completo, levando em conta a config da url do template
* @param $relative_url string
* @return string
*/
public function getAsset($relative_url)
{
return DataHandler::removeDobleBars(Config::FOLDER_VIEW . "/" . $relative_url);
}
示例5: getAsset
public static function getAsset($relative_url)
{
return "http://" . DataHandler::removeDobleBars(Navigation::getURIDomain() . "/" . self::getAliasFolder() . "/" . self::$FOLDER_VIEW . "/" . $relative_url);
}
示例6: searchFile
/**
* @param $array_url retorno da Navigation::getUri
* @param $_startFolder string passe o caminho da view
* @return ReturnSearchClassVO
*/
private static function searchFile($array_url, $_startFolder = "")
{
//iniciando o objeto de retorno
$returnReturnSearchClassVO = new ReturnSearchClassVO();
$searchFileOrFolderName = "";
//($searchFileOrFolderName != "")?"/".DataHandler::removeSpecialCharacters($searchFileOrFolderName):"";
//array completa sem a parte filtrada da url
$array = $array_url;
//Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
$contador = 0;
//varredura de hierarquia invertida
for ($i = count($array) - 1; $i >= 0; $i--) {
//pegando o string path, tirando o ultimo folder, pois estara no lastFolder
$stringPath = implode("/", array_slice($array, 0, $i));
$stringPath = DataHandler::removeLastBar($stringPath);
$lastFolder = DataHandler::removeSpecialCharacters($array[$i]);
//criando a array (além dos limites) - que não foi tratada
$contador++;
$arrayRestFolder = array_slice($array, count($array) - $contador, count($array));
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
//echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ".$_startFolder."----".$stringPath." ");
$searchFileOrFolderName = "";
//verifica se tem CAMINHO/ultimaPasta.php
$caminhoBase = $_startFolder . "/" . trim($stringPath) . "/" . $lastFolder;
$caminhoBase = DataHandler::removeDobleBars(DataHandler::removeDobleBars($caminhoBase));
if (file_exists($caminhoBase . ".php")) {
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->className = "";
$returnReturnSearchClassVO->folder = "";
$returnReturnSearchClassVO->urlToInclude = $caminhoBase . ".php";
$returnReturnSearchClassVO->file = $lastFolder . ".php";
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
return $returnReturnSearchClassVO;
}
//verifica se existe CAMINHO/ultimaPasta/index.php
if (file_exists($caminhoBase . "/index.php")) {
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->className = "";
$returnReturnSearchClassVO->folder = "";
$returnReturnSearchClassVO->urlToInclude = $caminhoBase . "/index.php";
$returnReturnSearchClassVO->file = "index.php";
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
//echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ". $_startFolder.$stringPath."/index.php");
return $returnReturnSearchClassVO;
}
}
// end for($i = count($array)-1; $i >= 0; $i--){
return $returnReturnSearchClassVO;
}
示例7: __construct
<?php
include_once "library/facil3/core/modules/category/dao/CategoryDAO.class.php";
include_once "library/facil3/core/modules/content/dao/ContentDAO.class.php";
include_once "library/facil3/core/controller/interface/HTTPControllerInterface.class.php";
include_once DataHandler::removeDobleBars(Config::getFolderView() . "/content_module/HttpContentModule.class.php");
class ContentModule implements HTTPControllerInterface
{
private $arrayRestFolder;
private $arrayVariable;
private $DAO;
public function __construct($arrayRestFolder = NULL)
{
$this->DAO = new CategoryDAO();
if ($arrayRestFolder != NULL) {
$this->arrayRestFolder = $arrayRestFolder;
$this->arrayVariable = Navigation::getVariableArraySlug($this->arrayRestFolder);
}
}
/* (non-PHPdoc)
* @see library/facil3/core/controller/interface/HTTPControllerInterface#init()
*/
public function init()
{
//busca todas as paginas cadastradas na tabela content
$returnResult = new HttpResult();
//iniciando o resultado para o html
$retornoDaPaginaHTML = new HttpContentModule();
$slug_category = "404";
if (count($this->arrayRestFolder) > 0) {
$slug_category = $this->arrayRestFolder[0];
示例8: deleteDirectory
public static function deleteDirectory($urlOfDirectory)
{
$arrayExeptionFiles = array(".", "..");
try {
$result = DataHandler::listDirectory($urlOfDirectory);
foreach ($result as $item) {
$extencion = "";
if (preg_match("/\\./", $item)) {
//tem um ponto de extenção
$extencion = strtolower(DataHandler::returnExtensionOfFile($item));
}
$fileUrl = DataHandler::removeDobleBars($urlOfDirectory . "/" . $item);
if ($extencion == "") {
if (in_array($item, $arrayExeptionFiles)) {
//não fazer nada com esse
} else {
$newfolder = DataHandler::removeDobleBars($urlOfDirectory . "/" . $item);
//é um folder, vai varrer dentro do folder tb - recursivo
if (is_dir($newfolder)) {
//echo Debug::li("a pasta será varrida:".$newfolder);
self::deleteDirectory($newfolder);
} else {
unlink($newfolder);
}
}
} else {
//ve se é um arquivo a se deletar
unlink($fileUrl);
}
}
//deleta o próprio diretório enviado
rmdir($urlOfDirectory);
} catch (Exception $e) {
//mudinho
return FALSE;
}
}
示例9: __construct
<?php
include_once "library/facil3/core/controller/admin/DefautAdmin.php";
include_once "library/facil3/navigation/http/HttpResult.class.php";
include_once "library/facil3/core/controller/interface/HTTPControllerInterface.class.php";
include_once DataHandler::removeDobleBars(Config::getFolderView() . "/HttpRoot.class.php");
include_once DataHandler::removeDobleBars(Config::getFolderView() . "/client/HttpClientAjax.class.php");
include_once Config::FOLDER_APPLICATION . "modules/user_detail/dao/UserDetailDAO.class.php";
include_once Config::FOLDER_APPLICATION . "modules/user_detail/vo/UserDetailVO.class.php";
/**
* @author Renato Miawaki
* @desc Controller central, se nenhuma outra controller for encontrada, esta controller é iniciada
* init é chamada caso nenhum metodo que combine com a requisição seja encontrada
*/
class Admin extends DefautAdmin implements HTTPControllerInterface
{
protected $arrayRestFolder = array();
protected $arrayVariable = array();
public function __construct($arrayRestFolder = NULL)
{
if ($arrayRestFolder != NULL) {
$this->arrayRestFolder = $arrayRestFolder;
$this->arrayVariable = Navigation::getVariableArraySlug($this->arrayRestFolder);
}
parent::__construct();
}
public function init()
{
$returnResult = new HttpResult();
$returnResult->setSuccess(1);
//iniciando o resultado para o html
示例10: searchFileOrFolder
/**
* Retorna apenas 1 resultado dentro do ReturnSearchFileVO, os dados em ReturnSearchFileVO são todos referentes ao mesmo resultado
* @param $_startFolder string
* @param $searchClass string
* @return ReturnSearchClassVO
*/
public static function searchFileOrFolder($_urlToIgnore = "", $_startFolder = "", $search_file_mode = Navigation::SEARCH_FILE_MODE_FILE, $searchFileOrFolderName = "", $autoInclude = FALSE)
{
//iniciando o objeto de retorno
$returnReturnSearchClassVO = new ReturnSearchClassVO();
$searchFileOrFolderName = $searchFileOrFolderName != "" ? "/" . DataHandler::removeSpecialCharacters($searchFileOrFolderName) : "";
//array completa sem a parte filtrada da url
$array = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
//Debug::print_r($array);
$contador = 0;
//varredura de hierarquia invertida
for ($i = count($array) - 1; $i >= 0; $i--) {
//echo Debug::li($i." = valor de i ", FALSE, "FFFF00");
switch ($search_file_mode) {
case Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD:
$arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, FALSE, $i + 1);
//echo " valor de arrayRestFolder ";
//echo Debug::print_r($arrayRestFolder);
$stringPath = "";
if ($i > 0) {
$stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i - 1);
}
//echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF55");
$currentFolder = "";
if ($i < count($array)) {
$currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
}
//echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
$currentFolder = str_replace("/", "", $currentFolder);
//echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
//procurando folder
$searchFileOrFolderName = DataHandler::urlFolderNameToClassName($currentFolder);
//echo " valor de searchFileOrFolderName ";
//echo Debug::print_r($searchFileOrFolderName);
//echo "<br>";
$tempMetodo = "init";
if ($i + 1 < count($array)) {
$tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
}
//echo Debug::li("<b>tempMetodo:".$tempMetodo."</b>", false, NULL, NULL, "0000ff");
//echo $_startFolder.$stringPath."/".$searchFileOrFolderName.".php";
if (file_exists($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php")) {
//echo Debug::li("<b>A classe:".$_startFolder.$stringPath."/".$searchFileOrFolderName.".php </b>");
$returnReturnSearchClassVO->success = TRUE;
$returnReturnSearchClassVO->file = $searchFileOrFolderName . ".php";
$returnReturnSearchClassVO->folder = DataHandler::removeDobleBars($_startFolder . $stringPath . "/");
$returnReturnSearchClassVO->urlToInclude = DataHandler::removeDobleBars($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php");
$returnReturnSearchClassVO->className = $searchFileOrFolderName;
$returnReturnSearchClassVO->methodName = $tempMetodo;
$returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
$className = $returnReturnSearchClassVO->className;
if ($autoInclude) {
include_once $_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php";
//echo $className;
$classe = new $className();
//inicia o metodo como vazio
$returnReturnSearchClassVO->methodName = "init";
//Se existir uma pasta acima dessa, ve qual é pois pode ser tentativa de acessar metodo
if ($i + 1 < count($array)) {
//echo Debug::li(" >>>>> ".$array[$i+1]);
$tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
//verifica se o metodo existe
if (ClassHandler::isMethodPublic($classe, $tempMetodo)) {
$returnReturnSearchClassVO->methodName = $tempMetodo;
}
}
$metodo = $returnReturnSearchClassVO->methodName;
//echo $metodo;
return $classe->{$metodo}();
}
return $returnReturnSearchClassVO;
}
break;
case Navigation::SEARCH_FILE_MODE_FILE:
default:
$stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i + 1);
//echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
$stringPath = DataHandler::removeLastBar($stringPath);
//echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
$lastFolder = "";
if ($i + 1 < count($array)) {
$lastFolder = "/" . DataHandler::removeSpecialCharacters($array[$i + 1]);
}
//echo Debug::li($lastFolder." = valor de lastFolder ", FALSE, "FFFF00");
$currentFolder = "";
if ($i < count($array)) {
$currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
}
//echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF00");
//criando a array (além dos limites) - que não foi tratada
$contador++;
//echo Debug::li($contador." = valor de contador ", FALSE, "FFFF00");
$arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, count($array), count($array) - $contador);
//echo " valor de arrayRestFolder ";
//echo Debug::print_r($arrayRestFolder);
//.........这里部分代码省略.........
示例11: insert
/**
* recebe a imagem por post
* @return ReturnResultVO
*/
public function insert()
{
//inicia um retorno de ReturnResultVO
$ReturnResultVO = new ReturnResultVO();
//pega os dados baseado na infoPost
$VO = new ImageVO();
//var_dump($this->infoPost);
//exit();
if ($this->infoPost->image_info_id > 0) {
//passou o id, vai atualizar essa VO
// echo Debug::li("image_info_id >>>>>>>>>> ".$this->infoPost->image_info_id);
$VO->setId($this->infoPost->image_info_id, TRUE);
}
$VO->setActive($this->infoPost->image_info_active);
$VO->setName($this->infoPost->image_info_name);
$VO->setDescription($this->infoPost->image_info_description);
$VO->setType($this->infoPost->image_info_type);
$VO->setAuthor($this->infoPost->image_info_author);
$VO->setLocale($this->infoPost->image_info_locale);
$VO->setOrder($this->infoPost->image_info_order);
// var_dump($_FILES);
// var_dump($this->infoPost->file_data);
//comitando as infos enviadas, dados apenas
if ($VO->getId() > 0 || $this->infoPost->file_data['tmp_name']) {
//só comita a imagem se tiver ou id ou enviado o file_data, se não nem tem o que fazer
$ReturnResultImageVO = $VO->commit();
} else {
//nem enviou o id e nem o file_data, retorna
$ReturnResultVO->addMessage(Translation::text("Have nothing to commit."));
return $ReturnResultVO;
}
if ($ReturnResultImageVO->success) {
$ReturnResultImageVO->result = $VO->getId();
} else {
//erro, os motivos estão na ReturnResultVO abaixo
return $ReturnResultImageVO;
}
//pega o id da imagem
$IMAGE_ID = $VO->getId();
$ReturnResultImageVO = new ReturnResultVO();
//echo Debug::li("this->infoPost->file_data: ".$this->infoPost->file_data);
if (isset($this->infoPost->file_data) && $this->infoPost->file_data['tmp_name']) {
set_time_limit(0);
//var_dump($_FILES);
$sentFileData = $this->infoPost->file_data;
//$_FILES['Filedata'];
$name = $sentFileData['name'];
// extens�o enviada
$sentExtension = DataHandler::returnExtensionOfFile($name);
// remove caracteres escrotos
$name = DataHandler::returnFilenameWithoutExtension($name);
$name = DataHandler::removeAccent($name);
$name = DataHandler::removeSpecialCharacters($name);
$name = trim(substr($name, 0, 80));
switch ($sentFileData["type"]) {
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$extension = "jpg";
break;
case "image/gif":
$extension = "gif";
break;
case "image/png":
case "image/x-png":
$extension = "png";
break;
case "image/bmp":
$extension = "bmp";
break;
default:
$extension = strtolower($sentExtension);
break;
}
//verifica se a pasta existe, se não existir, inventa
DataHandler::createFolderIfNotExist($this->defaultFolderForNewImages);
// pasta de upload de imagens est� no config.php
$tempFolder = DataHandler::removeDobleBars($this->defaultFolderForNewImages . "/" . $IMAGE_ID);
DataHandler::createFolderIfNotExist($tempFolder);
//echo Debug::li("name: $name");
$tempUrl = $tempFolder . "/original_" . strtolower($name . "." . $extension);
//echo Debug::li("tempUrl: $tempUrl");
//exit();
$i = 2;
while (file_exists($tempUrl)) {
$tempUrl = $tempFolder . "/original_" . strtolower($name . "-" . $i . "." . $extension);
$i++;
}
$VO->setUrl($tempUrl);
$ReturnResultImageVO = $VO->commit();
//Debug::li("aaa");
//Debug::print_r($ReturnResultImageVO);
if ($ReturnResultImageVO->success) {
//incluir o vinculo com a linked_table e linked_table_id
//receber table
// table_id
//.........这里部分代码省略.........
示例12: __construct
<?php
include_once "library/facil3/navigation/http/HttpResult.class.php";
include_once "library/facil3/core/controller/interface/HTTPControllerInterface.class.php";
include_once DataHandler::removeDobleBars(Config::getFolderView() . "/client/account/PurchaseInfo.class.php");
include_once "library/facil3/core/acl/UserClient.php";
include_once "library/e_commerce/modules/coupon/dao/CouponDAO.class.php";
include_once "library/e_commerce/modules/coupon/vo/CouponVO.class.php";
include_once "library/e_commerce/modules/purchase/dao/PurchaseOrderDAO.class.php";
include_once "library/e_commerce/modules/money_history/MoneyHistory.class.php";
include_once 'view/democrart/client/account/MoneyHistoryInfo.class.php';
include_once 'library/democrart/modules/partner/dao/PartnerDAO.class.php';
include_once Config::FOLDER_APPLICATION . "controller/admin/default/Content.php";
include_once "library/facil3/core/modules/category/dao/CategoryDAO.class.php";
include_once Config::FOLDER_APPLICATION . "modules/content/vo/ContentSiteVO.class.php";
include_once "library/facil3/core/dao/LinkDAO.class.php";
class Account implements HTTPControllerInterface
{
private $arrayRestFolder = array();
private $arrayVariable = array();
private $DAO;
public function __construct($arrayRestFolder = NULL)
{
if (!UserClient::isAlive()) {
Navigation::redirect("client/login");
exit;
}
$id_user = UserClient::getId();
$PartnerDAO = PartnerDAO::getInstance();
$ReturnPartnerDAO = $PartnerDAO->selectById($id_user);
if ($ReturnPartnerDAO->success && count($ReturnPartnerDAO->result) > 0) {