public function save_profile_list_data() { #Goodbye, XSS if ($this->session->accept_token != REQUEST_TOKEN) { Request::redirect(HOST . 'login'); return; } PhxMemcache::delete('lists_' . $this->session->user->id); Phalanx::loadClasses('Lists'); switch ($this->post->method) { case 'remove_list': Lists::remove($this->session->user->id, $this->post->list_id); header("Content-type:text/html;charset=utf-8"); $o->status = true; die(json_encode($o)); break; case 'add_list': $data = new stdClass(); $data->name = $this->post->list_title; $data->social_networks = $this->post->new_list_social_networks; $data->categories = $this->post->new_list_categories; $list_id = Lists::add($this->session->user->id, $data); header("Content-type:text/html;charset=utf-8"); $o->status = (bool) $list_id; die(json_encode($o)); break; } }
$data['error'] = "Error" . $_FILES['file']['error']; } else { $keys = array('title', 'description'); foreach ($keys as $key) { if (array_key_exists($key, $_POST)) { ${$key} = trim($_POST[$key]); } else { ${$key} = false; } } if ($title) { $store = new Lists(); $id = $store->last()->get('id'); if ($id < 0) { $id = 0; } else { $id = $id + 1; } $filename = "" . $id . '.' . get_file_extension($_FILES['file']['name']); $newname = BASEPATH . '/static/submissions/' . $filename; move_uploaded_file($_FILES['file']['tmp_name'], $newname); $store->add($id, $filename, $title, $description); header("Location: /index.php?id={$id}"); } else { $data['error'] = 'Please input the title.'; } } if (!array_key_exists('status', $_GET)) { $data['error'] = false; } print $twig->render('upload.html', $data);