/** * Deactivate a plugin * * @since 1.0 * * @param string $plugin_file Relative path to plugin * @return bool Whether plugin was deactivated */ function deactivate_plugin($plugin_file) { global $current_plugins; if (!isset($current_plugins[md5($plugin_file)])) { return false; } if (!validate_plugin($plugin_file)) { return false; } unset($current_plugins[md5($plugin_file)]); $data = new DataHandler(); $data->save('plugins.data', serialize($current_plugins)); return true; }
/** * @param $title * @param $description * @param $user_id * @param $t_id * @param $active * @return void */ public function addComments($title = NULL, $description = NULL, $user_id = NULL, $t_id = "insert", $active = NULL) { //se passar o p_id indica que está editando um term já existente //criando a array a ser inserida - usado como se fosse um mini VO $this->startCommentDAO(); $CommentVO = $this->CommentDAO->getItemVO(); $CommentVO->setStatus($t_id == "insert" || $t_id == NULL ? CommentDAO::STATUS_INSERT : CommentDAO::STATUS_UPDATE); $CommentVO->setTitle($title); $CommentVO->setDescription($description); $CommentVO->setUserId($user_id); $CommentVO->setTableId($this->id); $CommentVO->setTable($this->__table); $CommentVO->setActive($active); //verifica se deve c a array de parameter if ($this->id > 0) { //se já tem id é pq é um dado já cadastrado $this->getComments(); } //se não tem, então vai adicionar só os terms novos if (!count($this->__arrayComments) > 0) { //iniciando a array para demonstrar que já buscou ou tentou buscar $this->__arrayComments = array(); } $t_id = DataHandler::forceInt($t_id); if ($t_id > 0) { $CommentVO->setId($t_id); } $this->updateComment($CommentVO); //else { //push/ //echo "<li>adicionando".var_dump($CommentVO)."</li>"; //$this->__arrayComments[] = $CommentVO; //} //s vai realmente adicionar quando for chamado o metodo cadastrar() }
/** * Creation of the original image object. * * @return object of the image created. */ function createImage() { //est� conferindo o arquivo pela exten��o contando que foi conferido o tipo de arquivo ao recebe-lo $extensao = DataHandler::returnExtensionOfFile($this->image); // echo Debug::li(filetype($this->image)); // exit(); switch (strtolower($extensao)) { case 'jpg': case 'jpeg': return imagecreatefromjpeg($this->image); break; case 'gif': return imagecreatefromgif($this->image); break; case 'png': return imagecreatefrompng($this->image); break; case 'bmp': return imagecreatefromwbmp($this->image); break; default: return imagecreatefromjpeg($this->image); break; } }
public function setFetchArray($array) { //print_r($array); $this->id = DataHandler::getValueByArrayIndex($array, "id"); $this->active = DataHandler::getValueByArrayIndex($array, "active"); $this->name = DataHandler::getValueByArrayIndex($array, "name"); $this->title = DataHandler::getValueByArrayIndex($array, "title"); $this->hat = DataHandler::getValueByArrayIndex($array, "hat"); $this->description = DataHandler::getValueByArrayIndex($array, "description"); $this->content = DataHandler::getValueByArrayIndex($array, "content"); $this->author = DataHandler::getValueByArrayIndex($array, "author"); $this->template_url = DataHandler::getValueByArrayIndex($array, "template_url"); $this->slug = DataHandler::getValueByArrayIndex($array, "slug"); $this->key_words = DataHandler::getValueByArrayIndex($array, "key_words"); $this->date = DataHandler::getValueByArrayIndex($array, "date"); $this->date_in = DataHandler::getValueByArrayIndex($array, "date_in"); $this->date_out = DataHandler::getValueByArrayIndex($array, "date_out"); $this->order = DataHandler::getValueByArrayIndex($array, "order"); $this->request_table_id = DataHandler::getValueByArrayIndex($array, "table_id"); $this->request_table = DataHandler::getValueByArrayIndex($array, "table"); $this->request_content_id = DataHandler::getValueByArrayIndex($array, "content_id"); $this->request_slug = DataHandler::getValueByArrayIndex($array, "slug"); $this->request_locale = DataHandler::getValueByArrayIndex($array, "locale"); $this->request_quant_start = DataHandler::getValueByArrayIndex($array, "quant_start"); $this->request_quant_limit = DataHandler::getValueByArrayIndex($array, "quant_limit"); $this->request_type_of_return = DataHandler::getValueByArrayIndex($array, "type_of_return"); }
public function setFetchArray($array) { $this->image_info_id = DataHandler::getValueByArrayIndex($array, "image_info_id"); $this->image_info_type = DataHandler::getValueByArrayIndex($array, "image_info_type"); $this->image_info_active = DataHandler::getValueByArrayIndex($array, "image_info_active"); $this->image_info_url = DataHandler::getValueByArrayIndex($array, "image_info_url"); $this->image_info_name = DataHandler::getValueByArrayIndex($array, "image_info_name"); $this->image_info_description = DataHandler::getValueByArrayIndex($array, "image_info_description"); $this->image_info_order = DataHandler::getValueByArrayIndex($array, "image_info_order"); $this->image_info_locale = DataHandler::getValueByArrayIndex($array, "image_info_locale"); $this->image_info_author = DataHandler::getValueByArrayIndex($array, "image_info_author"); $this->request_image_id = DataHandler::getValueByArrayIndex($array, "image_id"); $this->request_image_url = DataHandler::getValueByArrayIndex($array, "image_url"); //abaixo, ATENÇÃO: Filedata $this->file_data = DataHandler::getValueByArrayIndex($array, "Filedata"); $this->file_url = DataHandler::getValueByArrayIndex($array, "file_url"); //info de requisição de thumb $this->request_max_width = DataHandler::getValueByArrayIndex($array, "max_width"); $this->request_max_height = DataHandler::getValueByArrayIndex($array, "max_height"); $this->request_crop = DataHandler::getValueByArrayIndex($array, "crop"); $this->request_direct_show = DataHandler::getValueByArrayIndex($array, "direct_show"); $this->request_natural_size = DataHandler::getValueByArrayIndex($array, "natural_size"); //info de vinculo $this->table = DataHandler::getValueByArrayIndex($array, "table"); $this->table_id = DataHandler::getValueByArrayIndex($array, "table_id"); }
public function setFetchArray($array) { //print_r($array); $this->host = DataHandler::getValueByArrayIndex($array, "host"); $this->smtp_auth = DataHandler::getValueByArrayIndex($array, "smtp_auth") == NULL ? FALSE : TRUE; $this->username = DataHandler::getValueByArrayIndex($array, "username"); $this->password = DataHandler::getValueByArrayIndex($array, "password"); $this->from = DataHandler::getValueByArrayIndex($array, "from"); $this->from_name = DataHandler::getValueByArrayIndex($array, "from_name"); $this->to = DataHandler::getValueByArrayIndex($array, "to"); $this->is_html = DataHandler::getValueByArrayIndex($array, "is_html") == NULL ? FALSE : TRUE; $this->subject = DataHandler::getValueByArrayIndex($array, "subject"); $this->add_address = DataHandler::getValueByArrayIndex($array, "add_address"); $this->body = DataHandler::getValueByArrayIndex($array, "body"); if (DataHandler::getValueByArrayIndex($array, "char_set") != NULL) { switch (strtolower(DataHandler::getValueByArrayIndex($array, "char_set"))) { case "iso-8859-1": $this->char_set = "ISO-8859-1"; break; case "utf-8": default: $this->char_set = "UTF-8"; break; } } }
public function setFetchArray($array) { //print_r($array); $this->captcha_code = DataHandler::getValueByArrayIndex($array, "captcha_code"); $this->captcha_image = DataHandler::getValueByArrayIndex($array, "captcha_image"); $this->captcha_value = DataHandler::getValueByArrayIndex($array, "captcha_value"); }
/** * busca todos os highlightss conforme requisições na HighlightsInfoPostVO * @return ReturnResultVO */ public function selectHighlights() { $table = DataHandler::forceString($this->HighlightsInfoPostVO->request_table); $table_id = DataHandler::forceInt($this->HighlightsInfoPostVO->request_table_id); $quant_start = DataHandler::forceInt($this->HighlightsInfoPostVO->request_quant_start); $quant_limit = DataHandler::forceInt($this->HighlightsInfoPostVO->request_quant_limit); $type_of_return = DataHandler::forceString($this->HighlightsInfoPostVO->request_type_of_return); $locale = DataHandler::forceString($this->HighlightsInfoPostVO->request_locale); // se nao foi passado table e table id naum da pra procurar if ($table == NULL && $table_id < 1) { $ReturnResultVO->success = FALSE; $ReturnResultVO->result = $this->array_highlights; $ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_HIGHLIGHTS_NOT_FOUND"); return $ReturnResultVO; } //inicia a LinkDAO para fazer a consulta $DAO = HighLightsDAO::getInstance(); //busca highlightss vinculados a tabela e tabela id passados $ReturnDataVO = $DAO->selectByTableId($table, $table_id, $type_of_return, "highlights", $quant_limit, $quant_start); if ($ReturnDataVO->success) { //Debug::print_r($ReturnDataVO);exit(); $ReturnResultVO->success = $ReturnDataVO->success; $ReturnResultVO->result = $ReturnDataVO->result; return $ReturnResultVO; } else { $ReturnResultVO->success = $ReturnDataVO->success; $ReturnResultVO->result = $this->array_highlights; $ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_HIGHLIGHTS_NOT_FOUND"); return $ReturnResultVO; } }
public function addVote($uID, $iStance, $iComment) { $input = array('stance' => $iStance, 'comment' => $iComment); $rtn = Validator::init('addVote', $input); if (is_array($rtn)) { foreach ($rtn as $key => $value) { if ($rtn[$key] != 'valid') { $flag = false; } } } else { return false; } if (!isset($flag)) { $rtn = DataHandler::insertRegVote($this->getID(), $uID, $iStance, $iComment); if ($rtn[0] == true) { if (is_numeric($rtn[1])) { array_push($this->voterefs, $rtn); CookiesManager::SetCookies($this->id, $rtn[1]); return true; } else { return false; } } else { return false; } } else { return 'Invalid Input'; } }
/** * @param string $LOCALE * @return stdClass */ public function toStdClass($LOCALE = NULL, $force = FALSE) { if (!$force && $this->__cacheObjReturn) { return $this->__cacheObjReturn; } $obj = new stdClass(); $arrayMetodos = get_class_methods($this); //filtra os metodos do tipo get // print_r($this->arrayMethodExeptionGET); // exit(); foreach ($arrayMetodos as $metodo) { if (!in_array($metodo, $this->arrayMethodExeptionGET) && @ereg("^get", $metodo)) { //da o nome do atributo para o mesmo nome do metodo publico get, só que sem o get $atributo = @ereg_replace("^get_", "", DataHandler::ecmaToUnderline($metodo)); //pegando o valor if ($LOCALE) { $tempValor = $this->{$metodo}($LOCALE); } else { $tempValor = $this->{$metodo}(); } //adiciona o atributo no objeto de retorno $obj->{$atributo} = $tempValor; } } $this->__cacheObjReturn = $obj; return $obj; }
/** * Constructor, duh. * * @since 1.0 * @uses $directory Holds the cache directory, which the constructor sets. * * @param string $directory */ public function __construct($directory = null, $expiration = 3600) { if ($directory === null) { $directory = get_option('cachedir'); } $this->expiration = (int) $expiration; parent::__construct($directory); }
/** * Returns an instance of the class if it has already been intantiated and stored, otherwise instantiates and stores self * * @param PDO $dbConnection A PDO connection to the main application database * @return self */ public static function get_instance(PDO $dbConnection = null) { if (self::$instance === null) { self::$instance = new self($dbConnection); return self::$instance; } return self::$instance; }
private function prepareCategories(&$array) { foreach ($array as $category) { $category->slug = DataHandler::strToURL($category->name); if (count($category->__array_category) > 0) { $this->prepareCategories($category->__array_category); } } }
public function index() { require_once '../application/services/DataHandler.php'; $data = array('id' => '1000202555', 'fb_sig_user' => '1000202555', 'call_id' => 'call1276839998658', 'swf_version' => 85); $testcase = new DataHandler(); $ret = $testcase->handle('retrieve_data', (object) $data, 'retrieve_data'); echo "<br>========handle==========="; print_r($ret); // $ret = $testcase->initUserMapData(); //echo '<pre>'; // echo "<br>========initUserMapData==========="; //print_r($ret); // unset($ret); // $ret = $testcase->getUserMaps(100020206); // echo '<pre>'; // echo "<br>========getUserMaps==========="; // print_r($ret); echo '</pre>'; }
function __construct($fileName) { // *** Open up the file $this->image = $this->openImage($fileName); // save the extension $this->extension_file = strtolower(DataHandler::returnExtensionOfFile($fileName)); // *** Get width and height $this->width = imagesx($this->image); $this->height = imagesy($this->image); }
/** * envie por post uma array de ids de files, só os ids * file/get_ziped_files */ public function getZipedFiles() { if (!UserClient::getId() > 0) { //nao tem permissao Navigation::redirect("405"); exit; } $array_file_ids = DataHandler::getValueByArrayIndex($_POST, "file_id"); //Debug::print_r($_REQUEST); $array_file_vo = array(); if (is_array($array_file_ids)) { foreach ($array_file_ids as $id) { $FileVO = new FileVO(); $Result = $FileVO->setId($id, TRUE); if ($Result->success == TRUE) { $array_file_vo[] = $FileVO; } } } else { //erro, não é uma array, verifica se pelo menos é 1 único id $id = DataHandler::forceInt($array_file_ids); if ($id > 0) { //é um id único $FileVO = new FileVO(); $Result = $FileVO->setId($id, TRUE); if ($Result->success == TRUE) { $array_file_vo[] = $FileVO; } } else { //erro mesmo, esse dado é zoado, estoura excessão throw new Exception("No ids sended", 404); exit; } } //a pasta zip precisa existir DataHandler::createFolderIfNotExist("upload/zip/"); //verifica o nome do arquivo baseado nos ids enviados conforme regra inventada agora $zip_name = "upload/zip/" . md5(implode("|", $array_file_ids)); DataHandler::createFolderIfNotExist($zip_name); $zip_name = $zip_name . "/teto.zip"; if (!file_exists($zip_name)) { //echo Debug::li($zip_name);exit(); $Zip = new ZipArchive(); $Zip->open($zip_name, ZipArchive::CREATE); foreach ($array_file_vo as $FileVO) { $url = $FileVO->getUrl(); $array = explode("/", $url); $file = $array[count($array) - 1]; $Zip->addFile($url, $file); } $Zip->close(); } header("Location: " . Config::getRootPath($zip_name)); exit; }
/** * Loops through locations, calls query method, and then calls db update method * * Loops though all locations, and for each query date set when the class was initialized, queries API for car rate, updates database, queries API for hotel rate, and updates database. * This takes a long time because of API call limits. * @deprecated For now the update script is setup the way it is so that the most current rates get pushed forward as soon as they're available, it * isn't ideal, but some larger decisions about the systems behavior need to be made before this gets addressed. */ private function update_car_and_hotel_rates() { $airports = $this->locations; $dates = $this->queryDates; $updateDayNumber = 0; //foreach date foreach ($dates as $startDate) { //foreach airport foreach ($airports as $airport => $airportData) { //query car rate $carRate = $this->get_car_rate($airportData['airport_code'], $startDate); //save car rate to database $this->dataHandler->update_carhotel_rate($airportData['airport_id'], 'car', $updateDayNumber, $carRate); //query hotel rate $hotelRates = $this->get_hotel_rate($airportData['airport_code'], $startDate); //save hotel rate to database $this->dataHandler->update_carhotel_rate($airportData['airport_id'], 'hotel', $updateDayNumber, $hotelRates['min'], $hotelRates['max']); } $updateDayNumber++; } }
/** * * @param (int) $quant_limite = NULL * @param (int) $quant_inicial = NULL * @return string */ public function limit($quant_limit = NULL, $quant_start = NULL) { //$quant_start $quant_limit = DataHandler::forceInt($quant_limit); $quant_limit = $quant_limit < 0 ? 0 : $quant_limit; $quant_start = DataHandler::forceInt($quant_start); $quant_start = $quant_start < 0 ? 0 : $quant_start; if ($quant_limit > 0) { return " LIMIT {$quant_start}, {$quant_limit} "; } return ""; }
public function add() { //name $nome = DataHandler::getValueByArrayIndex($_POST, "nome"); //title $sobreNome = DataHandler::getValueByArrayIndex($_POST, "sobreNome"); //author $email = DataHandler::getValueByArrayIndex($_POST, "email"); //hat $companhia = DataHandler::getValueByArrayIndex($_POST, "companhia"); //slug $profissao = DataHandler::getValueByArrayIndex($_POST, "provissao"); //key_words $arquiteto = DataHandler::getValueByArrayIndex($_POST, "arquiteto"); $erros = array(); //validação if (!Validation::validateEmail($email)) { $erros[] = "email inválido"; } if (!$nome) { $erros[] = "nome inválido"; } if (!$sobreNome) { $erros[] = "sobrenome incorreto"; } $ReturnResultVO = new ReturnResultVO($erros); if (!count($erros) > 0) { //nao tem erros na validação $ContentSiteVO = new ContentSiteVO(); $ContentSiteVO->setName($nome); $ContentSiteVO->setTitle($sobreNome); $ContentSiteVO->setAuthor($email); $ContentSiteVO->setHat($companhia); $ContentSiteVO->setSlug($profissao); $ContentSiteVO->setKeyWords($arquiteto); $ReturnResultVO = $ContentSiteVO->commit(); if ($ReturnResultVO->success) { //agora poe esse content na categoria correta $CategoryVO = new CategoryVO(); echo "id de category necessária para newslatter funcionar"; exit; $CategoryVO->setId(127, TRUE); if ($ContentSiteVO->getId() > 0) { $CategoryVO->addLink("newslatter", $ContentSiteVO->getId()); $CategoryVO->commit(); } } } echo $ReturnResultVO->toJson(); exit; }
/** * /backend/image/update/id.N/ * e por post enviar descricao * @return void da echo de string */ public function update() { $ReturnResultVO = new ReturnResultVO(); $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id")); $descricao = DataHandler::forceInt(DataHandler::getValueByArrayIndex($_POST, "descricao")); if ($id > 0) { $ImageVO = new ImageVO(); $ReturnResultVO = $ImageVO->setId($id, TRUE); if ($ReturnResultVO->success) { $ImageVO->setDescription($descricao); $ReturnResultVO = $ImageVO->commit(); } } echo $ReturnResultVO->toJson(); exit; }
public function check() { //busca o post $login = DataHandler::getValueByArrayIndex($_POST, "login"); $password = DataHandler::getValueByArrayIndex($_POST, "password"); //iniciando o retorno padrao em http client ajax $returnResult = new ReturnResultVO(); //se não validar retornar erro if (!Validation::blank($password, 1) && !Validation::blank($login, 1)) { $returnResult->success = 0; $returnResult->message = "Envie Login e Senha"; } else { //cadastra o usuario e os detalhes do mesmo $DAO = UserDetailDAO::getInstance(); $ReturnDataVO = $DAO->checkLogin($login, $password); //print_r($ReturnDataVO); if ($ReturnDataVO->success && count($ReturnDataVO->result) > 0) { if ($ReturnDataVO->result[0]->user_type_id == Config::ADMIN_USER_TYPE_ID || $ReturnDataVO->result[0]->user_type_id == Config::DEVELOPER_USER_TYPE_ID) { UserClient::setId($ReturnDataVO->result[0]->id); UserClient::setTypeId($ReturnDataVO->result[0]->user_type_id); UserClient::setActiveTime(time()); //setando sucesso true caso tenha dado certo $returnResult->success = $ReturnDataVO->success; $returnResult->message = "sucesso ao logar"; } else { //print_r($ReturnDataVO); $returnResult->success = 0; $returnResult->message = "Usuario sem permissão!"; } } else { //print_r($ReturnDataVO); $returnResult->success = 0; $returnResult->message = "Erro ao Logar!"; } } //Debug::print_r($returnResult); exit(); if ($returnResult->success) { if ($this->to != "") { Navigation::redirect($this->to); } else { Navigation::redirect("backend"); } } else { return $this->init($returnResult); } }
public function test_updateWarehouseData_notExists_notRegistered() { /** === Test Data === */ $STOCK_ITEM_ID = 21; $PRICE = 43.32; $PV = 54.32; /** === Setup Mocks === */ // $exist = $this->_repoWarehouseEntityStockItem->getById($stockItemRef); $this->mRepoWarehouseEntityStockItem->shouldReceive('getById')->once()->andReturn(null); // $this->_repoWarehouseEntityStockItem->create($bind); $this->mRepoWarehouseEntityStockItem->shouldReceive('create')->once(); // $registered = $this->_repoPvMod->getWarehousePv($stockItemRef); $this->mRepoPvMod->shouldReceive('getWarehousePv')->once()->andReturn(null); // $this->_repoPvMod->registerWarehousePv($stockItemRef, $pv); $this->mRepoPvMod->shouldReceive('registerWarehousePv')->once(); /** === Call and asserts === */ $this->obj->updateWarehouseData($STOCK_ITEM_ID, $PRICE, $PV); }
/** * para listagem de produtos */ public function init() { //lista todos produtos vinculados a categoria 2 $returnResult = new HttpResult(); //iniciando o resultado para o html $retornoDaPaginaHTML = new HttpRoot(); $arrayContentsVO = array(); //se foi passado o id da categoria entao vai buscar todos os contentents vinculados a mesma //echo Debug::li($this->category_id);exit(); $LinkDAO = LinkDAO::getInstance(); $category_id = 87; //categoria a que todos os equipes estão vinculados $returnDataVO = $LinkDAO->select(LinkDAO::RETURN_VO, "category", $category_id, "content", NULL, 1, NULL, NULL, $order_by = "order", $order_type = NULL); //verifica se o resultado é uma categoryVO if ($returnDataVO->success && count($returnDataVO->result) > 0) { foreach ($returnDataVO->result as $LinkVO) { //Debug::print_r($LinkVO); $tempReturnDataVO = $LinkVO->getLinkedVO(); //Debug::print_r($tempReturnDataVO);exit(); if ($tempReturnDataVO->success) { $stdClass = $tempReturnDataVO->result; //$stdClass->dads //Debug::print_r($stdClass); //$stdClass->files = $stdClass->getFiles(); if ($stdClass->active == 1) { $arrayContentsVO[] = $stdClass; } } } //exit(); } //Debug::print_r($arrayContentsVO); DataHandler::objectSort($arrayContentsVO, "title"); $retornoDaPaginaHTML->arrayContentsVO = $arrayContentsVO; $retornoDaPaginaHTML->array_segment = $this->getContents(125); $retornoDaPaginaHTML->array_estrutura = $this->getContents(126); //salvando o objeto de resultado de html no retorno $returnResult->setHttpContentResult($retornoDaPaginaHTML); //Debug::print_r($returnResult); //exit(); return $returnResult; }
public function setFetchArray($array) { //print_r($array); $this->file_info_id = DataHandler::getValueByArrayIndex($array, "file_info_id"); $this->file_info_type = DataHandler::getValueByArrayIndex($array, "file_info_type"); $this->file_info_active = DataHandler::getValueByArrayIndex($array, "file_info_active"); $this->file_info_url = DataHandler::getValueByArrayIndex($array, "file_info_url"); $this->file_info_name = DataHandler::getValueByArrayIndex($array, "file_info_name"); $this->file_info_description = DataHandler::getValueByArrayIndex($array, "file_info_description"); $this->file_info_order = DataHandler::getValueByArrayIndex($array, "file_info_order"); $this->file_info_locale = DataHandler::getValueByArrayIndex($array, "file_info_locale"); $this->file_info_author = DataHandler::getValueByArrayIndex($array, "file_info_author"); $this->request_file_id = DataHandler::getValueByArrayIndex($array, "file_id"); $this->request_file_url = DataHandler::getValueByArrayIndex($array, "file_url"); //abaixo, ATENÇÃO: Filedata recebe o arquivo a ser uplodado $this->file_data = DataHandler::getValueByArrayIndex($array, "Filedata"); $this->file_url = DataHandler::getValueByArrayIndex($array, "file_url"); //info de vinculo $this->table = DataHandler::getValueByArrayIndex($array, "table"); $this->table_id = DataHandler::getValueByArrayIndex($array, "table_id"); }
public function setFetchArray($array) { //print_r($array); $this->id = DataHandler::getValueByArrayIndex($array, "id"); $this->active = DataHandler::getValueByArrayIndex($array, "active"); $this->name = DataHandler::getValueByArrayIndex($array, "name"); $this->link = DataHandler::getValueByArrayIndex($array, "link"); $this->content = DataHandler::getValueByArrayIndex($array, "content"); $this->image_url = DataHandler::getValueByArrayIndex($array, "image_url"); $this->date = DataHandler::getValueByArrayIndex($array, "date"); $this->date_in = DataHandler::getValueByArrayIndex($array, "date_in"); $this->date_out = DataHandler::getValueByArrayIndex($array, "date_out"); $this->order = DataHandler::getValueByArrayIndex($array, "order"); $this->request_table_id = DataHandler::getValueByArrayIndex($array, "table_id"); $this->request_table = DataHandler::getValueByArrayIndex($array, "table"); $this->request_highlights_id = DataHandler::getValueByArrayIndex($array, "highlights_id"); $this->request_locale = DataHandler::getValueByArrayIndex($array, "locale"); $this->request_quant_start = DataHandler::getValueByArrayIndex($array, "quant_start"); $this->request_quant_limit = DataHandler::getValueByArrayIndex($array, "quant_limit"); $this->request_type_of_return = DataHandler::getValueByArrayIndex($array, "type_of_return"); }
public function check() { //busca o post $login = DataHandler::getValueByArrayIndex($_POST, "login"); $password = DataHandler::getValueByArrayIndex($_POST, "password"); //iniciando o retorno padrao em http client ajax $returnResult = new ReturnResultVO(); //se não validar retornar erro if (!Validation::blank($password, 1) && !Validation::blank($login, 1)) { $returnResult->success = 0; $returnResult->addMessage("Envie Login e Senha"); } else { //cadastra o usuario e os detalhes do mesmo $DAO = UserDetailDAO::getInstance(); $ReturnDataVO = $DAO->checkLogin($login, $password); if ($ReturnDataVO->success && count($ReturnDataVO->result) > 0) { UserClient::setId($ReturnDataVO->result[0]->id); UserClient::setTypeId($ReturnDataVO->result[0]->user_type_id); UserClient::setActiveTime(time()); //setando sucesso true caso tenha dado certo $returnResult->success = $ReturnDataVO->success; $message_success = file_get_contents(Config::getAsset("templates/login_sucesso.txt")); $returnResult->addMessage($message_success); } else { //print_r($ReturnDataVO); $returnResult->success = 0; $returnResult->addMessage("Erro ao Logar!"); } } if ($returnResult->success) { if ($this->to != "") { Navigation::redirect($this->to); } } echo $returnResult->toJson(); exit; }
function delete() { $image_id = DataHandler::getValueByArrayIndex($_POST, "id"); $ReturnResultVO = new ReturnResultVO(); if ($image_id > 0) { //vai deletar $ImageVO = new ImageVO(); $ImageVO->setId($image_id, TRUE); $ImageVO->delete(); $LinkDAO = LinkDAO::getInstance(); if (FALSE) { $LinkDAO = new LinkDAO(); } $ReturnDataVO = $LinkDAO->deleteAllFromLinkedTableAndLinkedTableId("image", $image_id); $ReturnResultVO->success = $ReturnDataVO->success; if ($ReturnResultVO->success) { $ReturnResultVO->addMessage(Translation::text("Image deleted successfully.")); } else { $ReturnResultVO->addMessage(Translation::text("Error when deleting image.")); } } echo $ReturnResultVO->toJson(); exit; }
/** * para adicionar ou atualizar parametros a uma tabela * * @param $type * @param $value * @param $t_id * @param $active * @return void */ public function addParamethers($type = NULL, $value = NULL, $t_id = "insert", $active = NULL) { //se passar o t_id indica que está editando um parametro já existente //criando a array a ser inserida - usado como se fosse um mini VO $this->startParametherDAO(); $ParametherVO = $this->ParametherDAO->getItemParametherVO(); $ParametherVO->setStatus($t_id == "insert" || $t_id == NULL ? ParametherDAO::STATUS_INSERT : ParametherDAO::STATUS_UPDATE); $ParametherVO->setType($type); $ParametherVO->setValueByType($ParametherVO->getType(), $value); $ParametherVO->setTableId($this->id); $ParametherVO->setTable($this->__table); $ParametherVO->setActive($active); //verifica se deve c a array de parameter if ($this->id > 0) { //se já tem id é pq é um dado já cadastrado $this->getParamethers(); } //se não tem, então vai adicionar só os terms novos if (!count($this->__arrayParamethers) > 0) { //iniciando a array para demonstrar que já buscou ou tentou buscar $this->__arrayParamethers = array(); } $t_id = DataHandler::forceInt($t_id); if ($t_id > 0) { $ParametherVO->setId($t_id); } $this->updateParamether($ParametherVO); //else { //push/ //echo "<li>adicionando".var_dump($ParametherVO)."</li>"; //$this->__arrayParamethers[] = $ParametherVO; //} //s vai realmente adicionar quando for chamado o metodo cadastrar() }
/** * Load plugins * * Loads in the activated plugins data then loads the plugins. */ function lilina_plugins_init() { $data = new DataHandler(); $plugins = $data->load('plugins.data'); if ($plugins === null) { return; } $plugins = unserialize($plugins); if (!is_array($plugins) || empty($plugins)) { return; } foreach ($plugins as $plugin) { if ('' !== $plugin && file_exists(LILINA_CONTENT_DIR . '/plugins/' . $plugin)) { include_once LILINA_CONTENT_DIR . '/plugins/' . $plugin; } } global $current_plugins; $current_plugins = $plugins; }
/** * @return $date (date) */ public function getDate() { return DataHandler::convertDateToBrazil($this->date); }