public function form() { $this->views = new Views(new Template("admin")); Phalanx::loadClasses('Mailing'); $this->views->data = Mailing::get($this->get->id); $this->views->display('mailing_form.phtml'); }
public function show() { $this->views = new Views(new Template("admin")); Phalanx::loadClasses('BillBoard'); $this->views->data = BillBoard::get(); $this->views->display('billboard_list.phtml'); }
public function form() { $this->views = new Views(new Template("admin")); Phalanx::loadClasses('PressReleases'); $this->views->data = PressReleases::get($this->get->id); $this->views->display('pressreleases_form.phtml'); }
public static function get_profile($u, $privacy = true, $badges = true, $social_networks = true, $friends = true, $exp = true, $aditional_info = true, $gamertags = true) { Phalanx::loadClasses('Privacy', 'Badges', 'Friendship', 'SocialNetwork', 'Posts', 'GamerTags'); $m = Model::Factory('user u'); $m->where("login='******'"); $user = $m->get(); if (!$user) { return false; } # Em alguns casos, não é necessário utilizarmos todos os dados do usuário if ($privacy) { $user->privacy = Privacy::from_user($user->id); } if ($badges) { $user->badges = Badges::from_user($user->id); } if ($social_networks) { $user->social_networks = SocialNetwork::from_user($user->id); } if ($friends) { $user->friends = Friendship::from_user($user->id, 12); } if ($exp) { $user->experience = self::experience($user->id); } if ($aditional_info) { $user->aditional_info = self::other_data($user->id); } if ($gamertags) { $user->gamertags = GamerTags::from_user($user->id); } return $user; }
public function form() { $this->views = new Views(new Template("admin")); Phalanx::loadClasses('News'); $this->views->data = News::get($this->get->id); $this->views->display('news_form.phtml'); }
public static function from_user($uid, $list_id = false) { $m = Model::Factory('user_lists', true, 0); if ($list_id === false) { $m = Model::Factory('user_lists', true, 0, 'lists_' . $uid); $m->where("user_id='{$uid}'"); } else { $m->where("user_id='{$uid}' AND id='{$list_id}'"); } $lists = $m->all(); $return = array(); if (is_array($lists)) { foreach ($lists as $list) { $o = new stdClass(); $o->id = $list->id; $o->name = $list->name; $c = Model::Factory('user_lists_has_category ulhc')->fields('ulhc.category_id AS id')->where("ulhc.user_lists_id='{$list->id}'")->all(); if ($c) { Phalanx::loadClasses('PostCategory'); $categories = array(); foreach ($c as $category) { $categories[] = PostCategory::translate($category->id); } $o->categories = $categories; } $o->social_networks = Model::Factory('user_lists_has_social_network ulhsn')->fields('sn.id AS id', 'sn.name')->innerJoin('social_network sn', 'ulhsn.social_network_id = sn.id')->where("ulhsn.user_lists_id='{$list->id}'")->all(); $return[] = $o; } } if ($list_id) { return $return[0]; } else { return $return; } }
public function SendCancelAccountMail() { if ($this->session->took_the_first_step_to_cancel != 'yes') { Request::redirect(HOST . 'perfil/configuracoes/cancelar-conta'); return; } $v = new Views(); $v->link = HOST . 'perfil/configuracoes/cancelar-conta/confirmar?token=' . md5(date('Ymd') . $this->session->user->id . $this->session->user->login . $this->session->user->login . 'Na0NERDNa0CANC3LAAC0NTaCARa'); $v->username = $this->session->user->login; $message = $v->render('mail/cancel_account_request.phtml'); Phalanx::loadExtension('phpmailer'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail_status = true; try { $mail->AddReplyTo(MAIL_FROM, MAIL_ALIAS); $mail->AddAddress($this->session->user->email, $this->session->user->login); $mail->Subject = 'SkyNerd: Pedido de cancelamento de conta'; $mail->MsgHTML($message); $mail->Send(); } catch (phpmailerException $e) { $mail_status = false; print_r($mail); } if ($mail_status) { $this->session->message = 'AccountCancelationRequestReceived'; } else { $this->session->message = ''; } Request::redirect(HOST . 'perfil/configuracoes'); }
private function send_password_reset_email($token, $email, $login) { $v = new Views(); $v->username = $login; $v->link = HOST . 'esqueci-minha-senha/' . $token . '/'; $message = $v->render('mail/password_change_request.phtml'); Phalanx::loadExtension('phpmailer'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail_status = true; try { $mail->AddReplyTo(MAIL_FROM, MAIL_ALIAS); $mail->AddAddress($email, $login); $mail->Subject = 'SkyNerd: Troca de senha'; $mail->MsgHTML($message); $mail->Send(); } catch (phpmailerException $e) { $mail_status = false; var_dump($mail); } if ($mail_status) { $this->session->message = 'PasswordChangeEmailSent'; } else { $this->session->message = 'PasswordChangeEmailNOTSent'; } Request::redirect(HOST . 'login'); }
public function ShowAll() { Phalanx::loadClasses('Accounting'); $current_year = $this->get->year ? $this->get->year : date('Y'); $this->views->data = Accounting::getByYear($current_year); $this->views->current_year = $current_year; $this->views->display('accounting_list.phtml'); }
public function adopted() { Phalanx::loadClasses('Cats'); $this->views = new Views(new Template("admin")); $this->views->special = 1; $this->views->data = Cats::get_adopted(1, $this->session->user->id); $this->views->display('adopted_cat_list.phtml'); }
public function check() { Phalanx::loadController('public.LoginController'); $loginController = new LoginController(); if (!($loginController->isLoggedIn() && in_array($this->session->user->id, array(26, 66382, 66380, 65, 1300, 83922, 95394, 138505)))) { Request::redirect(HOST); } }
public function init() { $this->session = new Session(); $this->get = Request::get(); $this->post = Request::post(); $this->views = new Views(new Template("admin")); Phalanx::loadClasses('Posts'); }
public function init() { $this->post = Request::post(true, REPLACE); $this->files = Request::files(); $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $this->isLoggedIn = $loginController->isLoggedIn(); }
public function init() { $this->get = Request::get(); $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $this->isLoggedIn = $loginController->checkStatus(); Phalanx::loadClasses('Posts', 'Notification'); }
public function init() { Phalanx::loadController("admin.AdminLoginController"); $alc = new AdminLoginController(); $alc->check(); $this->session = new Session(); $this->get = Request::get(); $this->post = Request::post(); $this->views = new Views(new Template("admin")); }
public function init() { $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); $this->post = Request::post(); $this->files = Request::files(); $this->get = Request::get(); $this->views = new Views(new Template("default")); }
public function ShowDebit() { $year = $this->get->year ? $this->get->year : date('Y'); Phalanx::loadClasses('public.Accounting'); // $this->views = new Views(new Template("public")); $template = new Template("public", "novo/default.phtml"); $this->views = new Views($template); $this->views->current_year = $year; $this->views->data = Accounting::getAccounting($year, "<"); $this->views->display('novo/accounting_d.phtml'); }
public function logout() { Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); if ($this->session->accept_token != REQUEST_TOKEN) { Request::redirect(HOST . 'login'); } SocialNetwork::unlink_account($this->session->user->id, SocialNetwork::FACEBOOK); Request::redirect(HOST . 'perfil/configuracoes'); }
public function init() { Phalanx::loadClasses('Users'); $this->get = Request::get(); $this->post = Request::post(); $this->session = new Session(); if ($this->session->logged_in !== true) { Request::redirect(HOST . 'adm/login'); } define("PERMISSIONS", $this->session->user->level); }
public function init() { $this->get = Request::get(); $this->post = Request::post(); $this->files = Request::files(); $this->session = new Session(); if ($this->session->logged_in !== true) { Request::redirect(HOST . 'adm/login'); } Phalanx::loadClasses('Godfather'); }
public function saveSharingOptions() { Phalanx::loadClasses('SocialNetwork'); if (!is_object($this->post->facebook_options)) { $this->post->facebook_options = new stdClass(); } if (!is_object($this->post->twitter_options)) { $this->post->twitter_options = new stdClass(); } SocialNetwork::saveOptions($this->session->user->id, SocialNetwork::FACEBOOK, $this->post->facebook_options); SocialNetwork::saveOptions($this->session->user->id, SocialNetwork::TWITTER, $this->post->twitter_options); }
function formatRow($row) { $type = implode(", ", Phalanx::getTypeNames(isset($row->ps_blocker_hit) ? $row->ps_blocker_hit : $row->ps_blocker_type)); $username = $row->ps_blocked_user; $timestamp = $this->app->wg->Lang->timeanddate($row->ps_timestamp); $oWiki = WikiFactory::getWikiById($row->ps_wiki_id); $url = isset($row->ps_referrer) ? $row->ps_referrer : ""; $url = empty($url) && isset($oWiki) ? $oWiki->city_url : $url; $html = Html::openElement('li'); $html .= wfMsgExt('phalanx-stats-row', array('parseinline'), $type, $username, $url, $timestamp); $html .= Html::closeElement('li'); return $html; }
public function feed() { Phalanx::loadClasses('SocialNetwork'); $token = SocialNetwork::get_access_token(1, INSTAGRAM); $token = json_decode($token); $instagram = new Instagram($this->config); $instagram->setAccessToken($token->access_token); $popular = $instagram->getUserFeed(); $response = json_decode($popular, true); foreach ($response['data'] as $each) { echo "<img src='{$each['images']['thumbnail']['url']}'>"; } }
private function blockStats($blockId) { $this->wg->Out->setPageTitle(sprintf("%s #%s", wfMsg('phalanx-stats-title'), $blockId)); $data = Phalanx::newFromId($blockId); if (!isset($data["id"])) { $this->wg->Out->addWikiMsg('phalanx-stats-block-notfound', $blockId); return; } $data['author_id'] = User::newFromId($data['author_id'])->getName(); $data['timestamp'] = $this->wg->Lang->timeanddate($data['timestamp']); if ($data['expire'] == null) { $data['expire'] = 'infinite'; } else { $data['expire'] = $this->wg->Lang->timeanddate($data['expire']); } $data['regex'] = $data['regex'] ? 'Yes' : 'No'; $data['case'] = $data['case'] ? 'Yes' : 'No'; $data['exact'] = $data['exact'] ? 'Yes' : 'No'; $data['lang'] = empty($data['lang']) ? 'All' : $data['lang']; if ($data['type'] & Phalanx::TYPE_EMAIL && !$this->wg->User->isAllowed('phalanxemailblock')) { /* hide email from non-privildged users */ $data['text'] = wfMsg('phalanx-email-filter-hidden'); } $data['type'] = implode(', ', Phalanx::getTypeNames($data['type'])); /* stats table */ $headers = array(wfMsg('phalanx-stats-table-id'), wfMsg('phalanx-stats-table-user'), wfMsg('phalanx-stats-table-type'), wfMsg('phalanx-stats-table-create'), wfMsg('phalanx-stats-table-expire'), wfMsg('phalanx-stats-table-exact'), wfMsg('phalanx-stats-table-regex'), wfMsg('phalanx-stats-table-case'), wfMsg('phalanx-stats-table-language')); $tableAttribs = array('class' => 'wikitable', 'width' => '100%'); /* pull these out of the array, so they dont get used in the top rows */ $row = $data->toArray(); unset($row['text']); unset($row['reason']); unset($row['comment']); unset($row['ip_hex']); // parse block comment if ($data['comment'] != '') { $comment = ParserPool::parse($data['comment'], $this->wg->Title, new ParserOptions())->getText(); } else { $comment = ''; } $table = Xml::buildTable(array($row), $tableAttribs, $headers); $table = str_replace("</table>", "", $table); $table .= "<tr><th>" . wfMsg('phalanx-stats-table-text') . "</th><td colspan='8'>" . htmlspecialchars($data['text']) . "</td></tr>"; $table .= "<tr><th>" . wfMsg('phalanx-stats-table-reason') . "</th><td colspan='8'>{$data['reason']}</td></tr>"; $table .= "<tr><th>" . wfMsg('phalanx-stats-table-comment') . "</th><td colspan='8'>{$comment}</td></tr>"; $table .= "</table>"; $this->setVal('table', $table); $this->setVal('editUrl', $this->phalanxTitle->getLocalUrl(array('id' => $data['id']))); /* match statistics */ $pager = new PhalanxStatsPager($blockId); $this->setVal('statsPager', $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar()); }
public function callback() { $m = Model::Factory('user'); $m->where("id='{$this->get->uid}'"); $data = $m->get(); $expected_token = md5(date('Ymd') . $data->id . $data->login . $data->login . 'COMPRABASTANTEAQUINERD'); if ($expected_token == $this->get->token) { Phalanx::loadClasses('SocialNetwork'); SocialNetwork::activate_account($this->session->user->id, NERDSTORE); Request::redirect(HOST . 'perfil/configuracoes'); } else { Request::redirect(HOST . 'perfil/configuracoes'); } }
public static function approve($uid, $fid) { $m = Model::Factory('friendship'); $m->status = 1; $m->where("user_id='{$uid}' AND friend_id='{$fid}'"); $data = $m->update(); if ($data) { Model::ExecuteQuery("UPDATE user_data SET friend_count=friend_count+1 WHERE user_id='{$uid}' OR user_id='{$fid}'"); Phalanx::loadClasses('Notification'); $n = new Notification(Notification::BEFRIENDED, $fid, $fid, $uid); return true; } return false; }
public function init() { Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); $this->session = new Session(); #Goodbye, XSS if ($this->session->accept_token != REQUEST_TOKEN) { Request::redirect(HOST . 'login'); return; } $this->get = Request::get(); $this->post = Request::post(); }
public function init() { $this->post = Request::post(); $this->session = new Session(); Phalanx::loadController('LoginController'); $loginController = new LoginController(); $loginController->checkStatus(); Phalanx::loadClasses('Friendship', 'Timeline', 'Notification', 'Message'); #Goodbye, XSS if ($this->session->accept_token != REQUEST_TOKEN) { Request::redirect(HOST . 'login'); return; } }
function formatRow($row) { $type = implode(", ", Phalanx::getTypeNames(isset($row->ps_blocker_hit) ? $row->ps_blocker_hit : $row->ps_blocker_type)); $username = $row->ps_blocked_user; $timestamp = $this->app->wg->Lang->timeanddate($row->ps_timestamp); $url = $row->ps_referrer; $blockId = (int) $row->ps_blocker_id; # block $phalanxUrl = $this->mSkin->makeLinkObj($this->mTitle, $blockId, 'id=' . $blockId); # stats $statsUrl = $this->mSkin->makeLinkObj($this->mTitleStats, wfMsg('phalanx-link-stats'), 'blockId=' . $blockId); $html = Html::openElement('li'); $html .= wfMsgExt('phalanx-stats-row-per-wiki', array('parseinline', 'replaceafter'), $type, $username, $phalanxUrl, $timestamp, $statsUrl, $url); $html .= Html::closeElement('li'); return $html; }
public function form() { Phalanx::loadClasses('Users'); Phalanx::loadClasses('Godfather'); $this->views = new Views(new Template("admin")); if (isset($this->get->cat_id)) { $this->views->data = Cats::get_details($this->get->cat_id); $this->views->title = "Gatos (Editando Registro)"; } else { $this->views->title = "Gatos (Adicionar)"; } $this->views->godfathers = Godfather::get_all(NULL, NULL, "nome ASC"); $this->views->data->godfathers_list = unserialize($this->views->data->godfathers_list); $this->views->users = Users::get(); $this->views->display('cats_form.phtml'); }