public function byAlpha() { $CRs = new CR($this->db); $this->f3->set('list', $CRs->byAlpha(), 86400); $this->f3->set('site_title', 'Tous les CRs | CROTYpedia'); $this->f3->set('view', 'cr/index.htm', 86400); }
public function index() { $CRs = new CR($this->db); $Actus = new Actu($this->db); $Streams = new Stream($this->db); $this->f3->set('actus', $Actus->all(10)); $this->f3->set('streams', $Streams->find(NULL, array('order' => 'twitch_username ASC'))); $this->f3->set('crs', $CRs->all(10)); $this->f3->set('site_title', 'Un torrent d\'informations — thetartuffebay.org'); $this->f3->set('page_head', 'Le premier site d\'information des tartuffes :o'); $this->f3->set('view', 'home.htm'); }
public function view() { $CR = new CR($this->db); $myCr = $CR->byUserName($this->f3->get('PARAMS.name')); $this->f3->set('list_cr', $myCr); $Stream = new Stream($this->db); $this->f3->set('list_stream', $myStream = $Stream->byUserName($this->f3->get('PARAMS.name'))); if (!count($myCr) && !count($myStream)) { $this->f3->error(404); //$this->f3->reroute('@home'); } $this->f3->set('site_title', 'Les CRs, Streams, Actus de ' . $this->f3->get('PARAMS.name') . ' | thetartuffebay.org'); $this->f3->set('view', 'profil/view.htm'); }
public function crotyPostProcess() { $CR = new CR($this->db); $NotProcessed = $CR->find(array('processed = ?', 0)); //print_r($NotProcessedActus); libxml_use_internal_errors(true); ob_start(); foreach ($NotProcessed as $NP) { //print_r($NP); echo "========\nDEBUT\n\n"; $process = $NP->processRawContent(array('content_raw' => $NP->content_raw)); $NP->hfr_cat_id = 5; $NP->hfr_subcat_id = 249; $NP->hfr_topic_id = 177180; //$NPA->hfr_page_id $NP->hfr_post_id = $process['hfr_post_id']; $NP->hfr_user_id = $process['hfr_user_id']; $NP->username = $process['username']; $NP->date_modified = date('Y-m-d H:i:s'); $NP->date_posted = $process['date_posted']; $NP->content = $process['content']; $NP->active = 1; $NP->save(); echo "\n\n\n\n\n"; } $myStr = ob_get_contents(); ob_end_clean(); libxml_use_internal_errors(false); echo $myStr; }
/** * The URL Loader * * Thou shalt not call superglobals directly * * @return array|mixed */ private static function loadUrl() { $uri = filter_input(INPUT_SERVER, 'REQUEST_URI'); if (ENCRYPTURL == '1') { $uri = CR::decrypt($uri); } BASEDIR == '/' || ($uri = str_replace(BASEDIR, '', $uri)); $uri = explode('/', $uri); array_walk($uri, function (&$item) { strpos($item, '?') === false || ($item = substr($item, 0, strpos($item, '?'))); }); String::arrayTrimNumericIndexed($uri); self::$uri = $uri; }
public function APICrParse() { $postdata = file_get_contents("php://input"); $request = json_decode($postdata, true); ob_start(); $this->APICrParseInternal($request); $myStr = ob_get_contents(); ob_end_clean(); $cr = json_decode($myStr, true)['data']; //print_r($cr); //on vérifie si il est pas déjà en base $CRs = new CR($this->db); $CRs->load(array('hfr_post_id = ?', $cr['hfr_post_id'])); if ($CRs->id) { header("HTTP/1.1 405 Not Found"); echo 'CR déjà en base :) > <a target="_blank" href="/crotypedia/' . $CRs->id . '">voir sur le site</a>'; exit; } $cr['content'] = $cr['content_raw']; $this->f3->set('cr', $cr); echo Template::instance()->render('cr/view.htm'); }
/** * Creates a new connection from * encrypted string in the * Connection Resource List * * @param $name - Nome da Conexão * @param $data - String criptografada com os dados */ public function createNewConnection($name, $data) { $data = CR::decrypt($data); $json = json_decode($data, true); if ($json) { $this->connections[$name] = $json; } }
/** * POST Method to create new user */ public function postAddUser() { $post = $this->getPost(); if (!$this->validatePost('name', 'user', 'pass')) { return RestServer::throwError(Language::CANNOT_BE_BLANK('Name, User and Pass'), 400); } $userData = array('name' => $post['name'], 'username' => $post['user'], 'passwd' => CR::encrypt($post['pass']), 'email' => $post['email']); $this->newModel('auth'); $this->model('auth')->insertUser($userData); if (!$this->model('auth')->queryOk()) { if ($this->model('auth')->getErrorCode() == 23000) { return RestServer::throwError(Language::USER_ALREADY_TAKEN(), 400); } else { return RestServer::throwError(Language::QUERY_ERROR(), 500); } } return RestServer::response(array('status' => 200, 'uid' => $this->model('auth')->getLastInsertId(), 'message' => 'User created!'), 200); }
/** * Loads the API Authentication File with * encrypted code */ private function loadAthentication() { $authFile = IFCDIR . '/data/' . md5(ORBIT_ID); if (!file_exists($authFile)) { return; } $content = file_get_contents($authFile); $content = CR::decrypt($content); $data = json_decode($content, true); if (!$data) { return; } foreach (array('id', 'secret') as $item) { if (!isset($data[$item])) { return; } else { $this->{$item} = $data[$item]; } } }