public function update() { $backup = new Backup($this->registry); $update = new Update($this->registry); //$backup->run(); $update->run(); }
private function Update() { $Update = new Update(); $Update->ExeUpdate(self::entidade, $this->dados, "WHERE id = :id", "id={$this->id}"); if ($Update->getRowCount() >= 1) { $this->error = ["O registro de <b>{$this->dados['nome']}</b> foi atualizado com sucesso!", WS_ACCEPT]; $this->result = true; } }
public function postNewsPost() { $posted = Input::get(); $update = new Update(); $update->message = $posted['message']; $update->date = $posted['date']; $update->save(); return Redirect::to('admin/news')->with('success', 'New update has been posted'); }
public static function getByVersionNumber($version) { $upd = new Update(); $updates = $upd->getLocalAvailableUpdates(); foreach ($updates as $up) { if ($up->getUpdateVersion() == $version) { return $up; } } }
public function ApTrabalho($Cod) { $this->Cod = $Cod; $update = new Update(); $Dados = ["status" => "A"]; $update->ExeUpdate('trabalhos', $Dados, "where codigo = :c", "c={$this->Cod}"); if ($update->getResult()) { echo "<script>alert('Trabalho Aprovado Com Sucesso!');</script>"; echo "<script>window.location.assign('painel/submetidos.php')</script>"; } }
public function testChecarSeOSqlRetornaCorretoComWhere() { $update = new Update(); $where = new Where(); $where->set('id', '=', 1); $update->where($where); $fields = ['name' => 'Erik']; $update->fields($fields); $sql = $update->sql(); $this->assertEquals('UPDATE `users` SET `name`=:name WHERE `id`=:id;', $sql); }
function admin_controller() { global $mysqli, $session, $route, $updatelogin; // Allow for special admin session if updatelogin property is set to true in settings.php // Its important to use this with care and set updatelogin to false or remove from settings // after the update is complete. if ($updatelogin || $session['admin']) { $sessionadmin = true; } // if ($session['userid']==4) $sessionadmin = true; if ($sessionadmin) { if ($route->action == 'view') { $result = view("Modules/admin/admin_main_view.php", array()); } if ($route->action == 'db') { $applychanges = get('apply'); if (!$applychanges) { $applychanges = false; } else { $applychanges = true; } require "Modules/admin/update_class.php"; require_once "Lib/dbschemasetup.php"; $update = new Update($mysqli); $updates = array(); $updates[] = array('title' => "Database schema", 'description' => "", 'operations' => db_schema_setup($mysqli, load_db_schema(), $applychanges)); if (!$updates[0]['operations']) { // In future versions we could check against db version number as to what updates should be applied $updates[] = $update->u0001($applychanges); //$updates[] = $update->u0002($applychanges); $updates[] = $update->u0003($applychanges); $updates[] = $update->u0004($applychanges); } $result = view("Modules/admin/update_view.php", array('applychanges' => $applychanges, 'updates' => $updates)); } if ($route->action == 'users' && $session['write'] && $session['admin']) { $result = view("Modules/admin/userlist_view.php", array()); } if ($route->action == 'userlist' && $session['write'] && $session['admin']) { $data = array(); $result = $mysqli->query("SELECT id,username,email FROM users"); while ($row = $result->fetch_object()) { $data[] = $row; } $result = $data; } if ($route->action == 'setuser' && $session['write'] && $session['admin']) { $_SESSION['userid'] = intval(get('id')); header("Location: ../user/view"); } } return array('content' => $result); }
public function ModelUpdate($id, array $dados) { $this->instituicao = (int) $id; $this->data = $dados; $update = new Update(); $update->Updater(self::Entity, $this->data, 'where instituicao_id = :id', "id={$this->instituicao}"); if ($update->getResult()) { $this->result = true; } else { $this->result = false; } }
private function Update() { $Update = new Update(); $Update->ExeUpdate(self::entidade, $this->dados, "WHERE id = :id", "id={$this->id}"); if ($Update->getResult()) { $this->error = ["A Pessoa <b>{$this->dados['nome']}</b> foi atualizada com sucesso!", WS_ACCEPT]; $this->result = true; } else { $this->error = ["Não foi possivel atualizar", WS_ERROR]; $this->result = false; } }
public function ModelUpdate($id, array $dados) { $this->rota = (int) $id; $this->data = $dados; $dataRota = array('rota_instituicoes' => json_encode($this->data['escolas']), 'tb_veiculos_veiculo_id' => (int) $this->data['rota_veiculo'], 'rota_inicio' => date('Y-m-d', strtotime(str_replace(array('/', '_', ' '), '-', $this->data['inicio']))), 'rota_fim' => date('Y-m-d', strtotime(str_replace(array('/', '_', ' '), '-', $this->data['fim']))), 'rota_saida' => (int) $this->data['rota_inicio'], 'rota_chegada' => (int) $this->data['rota_fim'], 'rota_observacoes' => $this->data['observacoes']); $update = new Update(); $update->Updater(self::Entity, $dataRota, 'where rota_id = :id', "id={$this->rota}"); if ($update->getResult()) { $this->result = true; } else { $this->result = false; } }
public function ModelUpdate($id, array $dados) { $this->motorista = (int) $id; $this->data = $dados; $this->data['motorista_nome_url'] = Asserts::CheckName($this->data['motorista_nome']); $update = new Update(); $update->Updater(self::Entity, $this->data, 'where motorista_id = :id', "id={$this->motorista}"); if ($update->getResult()) { $this->result = true; } else { $this->result = false; } }
public function actionDashboard() { $update = new Update(); $messages = $update->getMessages(); foreach ($messages as $message) { Yii::app()->user->setFlash('error', "<h3>" . $message["title"] . "</h3><br>" . $message["data"]); } if (isset($_POST['Widget'])) { $user = User::model()->findByPk(Yii::app()->user->id); $user->saveWidget($_POST['Widget']); Yii::app()->end(); } $this->render('dashboard', array()); }
public function GravarTrabalho() { $this->dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); if (isset($_FILES['fileUpload'])) { $nome = $this->dados['titulo']; $ext = strtolower(substr($_FILES['fileUpload']['name'], -4)); //Pegando extensão do arquivo $new_name = $nome . $ext; //Definindo um novo nome para o arquivo $this->LinkAnexo = $new_name; $dir = 'uploads/'; //Diretório para uploads move_uploaded_file($_FILES['fileUpload']['tmp_name'], $dir . $new_name); //Fazer upload do arquivo } else { echo "<script>alert('nao foi possivel anexar o arquivo!');</script>"; } if ($this->dados['tipoAtividade'] == "Palestra") { $tipoA = 1; } elseif ($this->dados['tipoAtividade'] == "MiniCurso") { $tipoA = 2; } else { $tipoA = 3; } //atualiza pessoa $updateP = new Update(); $dadosUp = ["curriculo" => $this->dados['perfil'], "nivel" => 1, "telefone" => $this->dados['telefone']]; $updateP->ExeUpdate('pessoas', $dadosUp, "where codigo = :id", "id={$this->dados['idPes']}"); //cadastra Trabalho $cadastrarT = new Create(); $Dados = ["resumo" => $this->dados['resumo'], "data_submetido" => date("Y-m-d"), "tipo_atividade" => $tipoA, "anexo" => $this->LinkAnexo, "status" => "N", "titulo" => $this->dados['titulo']]; $cadastrarT->ExeCreate('trabalhos', $Dados); $this->idT = $cadastrarT->getResult(); // Vincula o auto trabalho $cadastraAT = new Create(); $DadosAT = ["codigo_trabalho" => (int) $this->idT, "codigo_autor" => (int) $this->dados['idPes'], "codigo_evento" => 1]; $cadastraAT->ExeCreate('autor_trabalho', $DadosAT); // pega dados da pessoa $pessoa = new Read(); $pessoa->ExeRead('pessoas', "where codigo = :id", "id={$this->dados['idPes']}"); foreach ($pessoa->getResult() as $resulPes) { extract($resulPes); //Enviar o Email. $enviarEmail = new Email(); $DadosEmail = ["Assunto" => "Confirmação da Submição de Trabalho DeepDay", "Mensagem" => "Seu Trabalho foi submetido com sucesso.", "RemetenteNome" => "Equipe DeepDay", "RemetenteEmail" => "*****@*****.**", "DestinoNome" => $nome, "DestinoEmail" => $email]; $enviarEmail->Enviar($DadosEmail); } echo "<script>alert('Seu trabalho foi submetido com sucesso!');</script>"; echo "<script>window.location.assign('" . BASE . "/painel')</script>"; }
public function ModelUpdate($id, array $dados) { $this->aluno = (int) $id; $this->data = $dados; $this->data['aluno_nome_url'] = Asserts::CheckName($this->data['aluno_nome']); $this->data['aluno_nascimento'] = date('Y-m-d', strtotime(str_replace(array('/', '_'), '-', $this->data['aluno_nascimento']))); $update = new Update(); $update->Updater(self::Entity, $this->data, 'where aluno_id = :id', "id={$this->aluno}"); if ($update->getResult()) { $this->result = true; } else { $this->result = false; } }
public function setVaga($veiculo) { $read = new Read(); $read->Reader(self::Entity, 'where veiculo_id = :id', "id={$veiculo}"); if ($read->getResult()) { $vagas = (int) $read->getResult()[0]['veiculo_vagas']; if (0 < $vagas) { $update = new Update(); $update->Updater('tb_veiculos', array('veiculo_vagas' => $vagas - 1), 'where veiculo_id = :id', "id={$veiculo}"); return true; } else { return false; } } }
/** * Проверка номера версии в репозитории Github * @return integer */ public static function check_version() { $respoonse = self::request('https://raw.githubusercontent.com/:rep/:branch/cms/application/bootstrap.php'); preg_match('/define\\(\'CMS_VERSION\'\\,[\\t\\ ]*\'([0-9\\.]+)\'\\)\\;/i', $respoonse, $matches); self::$_remove_version = $matches[1]; return version_compare(CMS_VERSION, self::$_remove_version); }
public function doWork($object) { $this->insert_id = NULL; parent::doWork($object); $object->setId($this->insert_id); return $this->insert_id; }
public function action_update_check() { // add an extra GUID, in addition to the one in our .xml file to pretend a theme was registered Update::add('Test', '10cbaf18-bdd2-48e1-b0d3-e1853a4c649d', '3.0.2'); // add an extra GUID, in addition to the one in our .xml file to pretend a plugin was registered Update::add('Test', '7a0313be-d8e3-11d1-8314-0800200c9a66', '0.9'); }
public function view() { Loader::library('update'); $this->set('latest_version', Update::getLatestAvailableVersionNumber()); $tp = new TaskPermission(); $updates = 0; $local = array(); $remote = array(); if ($tp->canInstallPackages()) { $local = Package::getLocalUpgradeablePackages(); $remote = Package::getRemotelyUpgradeablePackages(); } // now we strip out any dupes for the total $updates = 0; $localHandles = array(); foreach ($local as $_pkg) { $updates++; $localHandles[] = $_pkg->getPackageHandle(); } foreach ($remote as $_pkg) { if (!in_array($_pkg->getPackageHandle(), $localHandles)) { $updates++; } } $this->set('updates', $updates); }
public static function fromResponse($data) { $arrayOfUpdates = array(); foreach ($data as $update) { $arrayOfUpdates[] = Update::fromResponse($update); } return $arrayOfUpdates; }
public function getApplicationUpdateInformation() { $r = Cache::get('APP_UPDATE_INFO', false); if (!is_object($r)) { $r = Update::getLatestAvailableUpdate(); } return $r; }
/** * @covers Zend\Db\Sql\Update::getSqlString * @todo Implement testGetSqlString(). */ public function testGetSqlString() { $this->update->table('foo') ->set(array('bar' => 'baz')) ->where('x = y'); $this->assertEquals('UPDATE "foo" SET "bar" = \'baz\' WHERE x = y', $this->update->getSqlString()); }
private function __construct() { $data = DataTable::constructFromCsvFile(new CsvFile('data/updates.csv'))->get(); foreach ($data as $row) { $year = $row['year']; $month = $row['month']; $day = $row['day']; $version = $year . '-' . $month . '-' . $day; $change = $row['change']; if (!isset($this->updates[$version])) { $update = new Update($year, $month, $day); $this->updates[$version] = $update; $this->latest_version = $update->getVersion(); } $this->updates[$version]->addChange($change); } }
/** * Display a listing of the resource. * * @return Response */ public function index($id) { $update = Update::get(); $latest = null; foreach ($update as $time) { $latest = $time->time; } return View::make('article')->with('id', $id)->with('latest', $latest); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $update = Update::get(); $latest = null; foreach ($update as $time) { $latest = $time->time; } echo $latest; }
public function run() { // $faker = Faker::create(); // foreach(range(1, 10) as $index) // { // Update::create([ // ]); // } $updates = new Update(); $updates->pitch_id = 1; $updates->update = "We are half way to our sales goal! We are so proud of everyone's involvement. Tell your friends. More is on the way."; $updates->user_id = 1; $updates->save(); $updates = new Update(); $updates->pitch_id = 1; $updates->update = "We will be showing a new video this week showing our brewery facility. Get excited."; $updates->user_id = 1; $updates->save(); }
public function run() { $log = new Logging(); // $parenClass = new ParentClass(); // set path and name of log file (optional) $log->lfile('log.txt'); $json = file_get_contents('php://input'); $log->lwrite("post: " . $json); $update = new Update($json); $message = $update->getMessage(); $chat = $message->getChat(); $chat_id = $chat->getId(); $text = $message->getText(); $client = new Client(); $client->sendMessage($chat_id, $text, null, null, null); $client->sendLocation($chat_id, 53.480759, -2.242631, null, null); $client->sendPhoto($chat_id, 'pic.jpg', 'sweety', null, null); $log->lclose(); }
public static function fromParamArgs(array $args, $class = null) { if (!$args) { throw new \InvalidArgumentException("Args missing for update"); } $cnt = count($args); if ($cnt == 1) { return $args[0] instanceof self ? $args[0] : new Update($args[0]); } elseif ($cnt == 2 || $cnt == 3) { if (!is_array($args[0]) && !is_string($args[0])) { throw new \InvalidArgumentException("Set must be an array or string"); } $query = new Update(); $query->set = array_shift($args); $query->setParams($args); return $query; } else { throw new \InvalidArgumentException("Unknown args count {$cnt}"); } }
function ol_search_open_learn_cron() { require 'update_cron.class.php'; //$db_handle = mysql_connect(DB_HOST.":".DB_PORT, DB_USER, DB_PASSWORD); //$db_found = mysql_select_db(DB_NAME, $db_handle); global $db; $db_handle = $db; //Create object of update class which is used for updating database $obj = new Update(); $qry = "SELECT * FROM " . TABLE_PREFIX . "config WHERE name='ol_last_updation'"; $r1 = mysql_query($qry, $db_handle); $res1 = mysql_fetch_assoc($r1); $qry = "SELECT * FROM " . TABLE_PREFIX . "config WHERE name='ol_url'"; $r2 = mysql_query($qry, $db_handle); $res2 = mysql_fetch_assoc($r2); $qry = "SELECT * FROM " . TABLE_PREFIX . "config WHERE name='ol_base_url'"; $r3 = mysql_query($qry, $db_handle); $res3 = mysql_fetch_assoc($r3); $obj->parse($res1['value'], $res2['value'], $db_handle, TABLE_PREFIX, $res3['value']); }
public static function update($updateID = null) { if ($updateID == null) { return null; } $update = Update::load($updateID); // $user = User::load($update->getCreatorID()); // $username = $user->getUsername(); $title = $update->getTitle(); $accepted = Accepted::load($update->getAcceptedID()); return array_merge(self::task($accepted->getTaskID()), self::oneCrumb($title, Url::update($updateID))); }