function DropTables() { $moderator = new Moderator(); $moderator->SetDatabase($this); $moderator->Drop(); $message = new Message(); $message->SetDatabase($this); $message->Drop(); $topic = new Topic(); $topic->SetDatabase($this); $topic->Drop(); $user_info = new UserInfo(); $user_info->SetDatabase($this); $user_info->Drop(); $session = new Session(); $session->SetDatabase($this); $session->Drop(); $new = new News(); $new->SetDatabase($this); $new->Drop(); $shout = new Shout(); $shout->SetDatabase($this); $shout->Drop(); $paragraph = new Paragraph(); $paragraph->SetDatabase($this); $paragraph->Drop(); $privilege = new Privilege(); $privilege->SetDatabase($this); $privilege->Drop(); $role = new Role(); $role->SetDatabase($this); $role->Drop(); $menu_item = new MenuItem(); $menu_item->SetDatabase($this); $menu_item->Drop(); $module = new Module(); $module->SetDatabase($this); $module->Drop(); $page = new Page(); $page->SetDatabase($this); $page->Drop(); $article = new Article(); $article->SetDatabase($this); $article->Drop(); $subject = new Subject(); $subject->SetDatabase($this); $subject->Drop(); $menu = new Menu(); $menu->SetDatabase($this); $menu->Drop(); $profile = new Profile(); $profile->SetDatabase($this); $profile->Drop(); $user = new User(); $user->SetDatabase($this); $user->Drop(); }
public function executeNew(sfWebRequest $request) { $isModerator = $request->getParameter('type') == 'animator' ? true : false; $this->isModerator = $isModerator; $moderator = new Moderator(); $login = new Login(); $login->setIsModerator($isModerator); $moderator->setLogin($login); $this->form = new ModeratorForm($moderator, array('new' => true)); }
public static function is_moderator($course) { $player = self::get_user_logged_in(); if ($player) { $moderators = Moderator::find_by_course($course); return in_array($player->id, $moderators); } return false; }
public function authenticateModerator() { if (Utils::isValidEmailAddress($this->username)) { $moderator = new Moderator(); $moderator->email = $this->username; $moderators = $moderator->find(); if (!empty($moderators)) { $myModerator = $moderators[0]; if (md5($this->password) == $myModerator->password) { $this->id = $myModerator->id; //$this->setState("isModerator", true); $this->setState("role", self::MODERATOR); Yii::app()->user->login($this, 24 * 3600); return true; } else { return false; } } } }
/** * Attempts to save new course and redirect to the newly created course. */ public static function store() { $player = self::get_user_logged_in(); if (!$player) { View::make('player/login.html', array('error' => 'Vain kirjautuneet käyttäjät voivat lisätä ratoja.')); } $params = $_POST; $params['url'] = self::fix_url($params['url']); $params['mapLink'] = self::fix_url($params['mapLink']); $attributes = array('name' => $params['name'], 'description' => $params['description'], 'address' => $params['address'], 'mapLink' => $params['mapLink'], 'url' => $params['url']); $course = new Course($attributes); $errors = $course->errors(); if (count($errors) == 0) { $course->save(); Hole::create_holes($params['holes'], $course->id); Moderator::add_as_moderator($course->id, $player->id); Redirect::to('/course/' . $course->id . '/edit', array('message' => 'Rata lisätty, täydennä vielä väylien tiedot.')); } else { View::make('course/new.html', array('errors' => $errors, 'attributes' => $attributes)); } }
<tr> <td bgcolor="#FFFFFF" width="60%" valign="top" align="left"> <a href="/pages/pgForumTopics.php?p_topc_id=<?php echo $data1["topc_id"]; ?> "><?php echo $data1["topc_title"]; ?> </a> - <?php echo $data1["topc_text"]; ?> <br> Moderadores: <?php $moderator = new Moderator(); $moderator->SetDatabase($database); $moderator->SetTopic($data1["topc_id"]); $result2 = $moderator->SelectByTopic(); $html = ""; while ($data2 = $database->FetchArray($result2)) { $html = $html . $data2["usif_nick"] . ", "; } echo substr($html, 0, strlen($html) - 2); ?> </td> <td bgcolor="#FFFFFF" width="10%" valign="middle" align="center"> <?php
protected $isLogged; public function login() { echo "You Logged in"; $this->isLogged = true; } public function logout() { echo "You Logged out"; $this->isLogged = false; } public function setValues($l, $p, $e, $r) { $this->login = $l; $this->password = $p; $this->email = $e; $this->rating = $r; } } class Admin extends User { } class Moderator extends User { } $john = new Admin(); $mike = new Moderator(); $john->setValues('John', '123', '*****@*****.**', '10'); $mike->setValues('Mike', '456', '*****@*****.**', '9'); echo "<pre>"; var_dump($john, $mike);
/** * Thread Class constructor - This builds all essential data on load. */ public function __construct() { global $locale, $userdata, $settings, $forum_settings; // exit no.1 if (!isset($_GET['thread_id']) && !isnum($_GET['thread_id'])) { redirect(INFUSIONS . 'forum/index.php'); } $thread_data = \PHPFusion\Forums\Functions::get_thread($_GET['thread_id']); // fetch query and define iMOD if (!empty($thread_data)) { $thread_stat = self::get_thread_stats($_GET['thread_id']); // get post_count, lastpost_id, first_post_id. if ($thread_data['forum_type'] == 1) { redirect(INFUSIONS . 'forum/index.php'); } if ($thread_stat['post_count'] < 1) { redirect(INFUSIONS . 'forum/index.php'); } // Set meta add_to_meta($locale['forum_0000']); if ($thread_data['forum_description'] !== '') { add_to_meta('description', $thread_data['forum_description']); } if ($thread_data['forum_meta'] !== '') { add_to_meta('keywords', $thread_data['forum_meta']); } add_to_title($thread_data['thread_subject']); // Set Forum Breadcrumbs $this->forum_index = dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'); add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php', 'title' => $locale['forum_0000'])); forum_breadcrumbs($this->forum_index, $thread_data['forum_id']); add_breadcrumb(array('link' => INFUSIONS . 'forum/viewthread.php?forum_id=' . $thread_data['forum_id'] . '&thread_id=' . $thread_data['thread_id'], 'title' => $thread_data['thread_subject'])); $this->setThreadPermission($thread_data); // Sanitizes $_GETs $_GET['forum_id'] = $thread_data['forum_id']; /** * Generate User Tracked Buttons */ $this->thread_info['buttons']['notify'] = array(); if ($this->getThreadPermission("can_access")) { // only member can track the thread if ($thread_data['user_tracked']) { $this->thread_info['buttons']['notify'] = array('link' => INFUSIONS . "forum/postify.php?post=off&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'], 'title' => $locale['forum_0174']); } else { $this->thread_info['buttons']['notify'] = array('link' => INFUSIONS . "forum/postify.php?post=on&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'], 'title' => $locale['forum_0175']); } } /** * Generate Quick Reply Form */ $qr_form = ""; if ($this->getThreadPermission("can_reply") == TRUE && $thread_data['forum_quick_edit'] == TRUE) { $qr_form = "<!--sub_forum_thread-->\n"; $form_url = INFUSIONS . "forum/viewthread.php?thread_id=" . $thread_data['thread_id']; $qr_form .= openform('quick_reply_form', 'post', $form_url, array('class' => 'm-b-20 m-t-20')); $qr_form .= "<h4 class='m-t-20 pull-left'>" . $locale['forum_0168'] . "</h4>\n"; $qr_form .= form_textarea('post_message', $locale['forum_0601'], '', array('bbcode' => true, 'required' => true, 'autosize' => true, 'preview' => true, 'form_name' => 'quick_reply_form')); $qr_form .= "<div class='m-t-10 pull-right'>\n"; $qr_form .= form_button('post_quick_reply', $locale['forum_0172'], $locale['forum_0172'], array('class' => 'btn-primary btn-sm m-r-10')); $qr_form .= "</div>\n"; $qr_form .= "<div class='overflow-hide'>\n"; $qr_form .= form_checkbox('post_smileys', $locale['forum_0169'], '', array('class' => 'm-b-0')); if (array_key_exists("user_sig", $userdata) && $userdata['user_sig']) { $qr_form .= form_checkbox('post_showsig', $locale['forum_0170'], '1', array('class' => 'm-b-0')); } if ($forum_settings['thread_notify']) { $qr_form .= form_checkbox('notify_me', $locale['forum_0171'], $thread_data['user_tracked'], array('class' => 'm-b-0')); } $qr_form .= "</div>\n"; $qr_form .= closeform(); } /** * Generate Poll Form */ $poll = array(); $poll_form = ""; if ($this->getThreadPermission("can_access") && $thread_data['thread_poll'] == TRUE) { $poll_result = dbquery("SELECT\n\t\t\t\tpoll_opts.*, poll.forum_poll_title, poll.forum_poll_votes\n\t\t\t\tFROM " . DB_FORUM_POLL_OPTIONS . " poll_opts\n\t\t\t\tINNER JOIN " . DB_FORUM_POLLS . " poll using (thread_id)\n\t\t\t\tWHERE poll.thread_id='" . intval($thread_data['thread_id']) . "'\n\t\t\t\t"); if (dbrows($poll_result) > 0) { $i = 0; // Construct poll data - model while ($pdata = dbarray($poll_result)) { if ($i == 0) { $poll['forum_poll_title'] = $pdata['forum_poll_title']; $poll['forum_poll_votes'] = $pdata['forum_poll_votes']; $poll['forum_poll_max_options'] = dbrows($poll_result); } $poll['forum_poll_options'][$pdata['forum_poll_option_id']] = $pdata; $i++; } // SQL cast poll vote if (isset($_POST['poll_option']) && isnum($_POST['poll_option']) && $_POST['poll_option'] <= $poll['forum_poll_max_options']) { if ($this->getThreadPermission("can_vote_poll") == TRUE) { $pollInput['poll_option_id'] = stripinput($_POST['poll_option']); global $defender; if ($defender->safe()) { dbquery("UPDATE " . DB_FORUM_POLL_OPTIONS . " SET forum_poll_option_votes=forum_poll_option_votes+1 WHERE thread_id='" . intval($thread_data['thread_id']) . "' AND forum_poll_option_id='" . intval($pollInput['poll_option_id']) . "'"); dbquery("UPDATE " . DB_FORUM_POLLS . " SET forum_poll_votes=forum_poll_votes+1 WHERE thread_id='" . intval($thread_data['thread_id']) . "'"); dbquery("INSERT INTO " . DB_FORUM_POLL_VOTERS . " (thread_id, forum_vote_user_id, forum_vote_user_ip, forum_vote_user_ip_type) VALUES ('" . $thread_data['thread_id'] . "', '" . $userdata['user_id'] . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')"); addNotice('success', $locale['forum_0614']); redirect(INFUSIONS . "forum/viewthread.php?forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']); } else { addNotice("danger", "You are not eligible to cast a vote in the poll."); } } } $poll_form_start = ""; $poll_form_end = ""; if ($this->getThreadPermission("can_vote_poll")) { $poll_form_start = openform("poll_vote_form", "post", INFUSIONS . "forum/viewthread.php?thread_id=" . $thread_data['thread_id']); $poll_form_end = form_button('vote', $locale['forum_2010'], 'vote', array('class' => 'btn btn-sm btn-primary m-l-20 ')); $poll_form_end .= closeform(); } // need to fix security. if ($this->getThreadPermission("can_edit_poll")) { $poll_form .= "<div class='pull-right btn-group'>\n"; $poll_form .= "<a class='btn btn-sm btn-default' href='" . INFUSIONS . "forum/viewthread.php?action=editpoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "'>" . $locale['forum_0603'] . "</a>\n"; $poll_form .= "<a class='btn btn-sm btn-default' href='" . INFUSIONS . "forum/viewthread.php?action=deletepoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "' onclick='confirm('" . $locale['forum_0616'] . "');'>" . $locale['delete'] . "</a>\n"; $poll_form .= "</div>\n"; } $poll_form .= $poll_form_start; $poll_form .= "<h3 class='strong m-b-10'><i class='fa fa-fw fa-pie-chart fa-lg'></i>" . $locale['forum_0377'] . " : " . $poll['forum_poll_title'] . "</h3>\n"; $poll_form .= "<ul class='p-l-20 p-t-0'>\n"; if (!empty($poll['forum_poll_options'])) { $i = 1; $vote_options = $poll['forum_poll_options']; foreach ($vote_options as $poll_option) { if ($this->getThreadPermission("can_vote_poll") == TRUE) { $poll_form .= "<li><label for='opt-" . $i . "'><input id='opt-" . $i . "' type='radio' name='poll_option' value='" . $i . "' class='m-r-20'> <span class='m-l-10'>" . $poll_option['forum_poll_option_text'] . "</span>\n</label></li>\n"; } else { $option_votes = $poll['forum_poll_votes'] ? number_format(100 / $poll['forum_poll_votes'] * $poll_option['forum_poll_option_votes']) : 0; $poll_form .= progress_bar($option_votes, $poll_option['forum_poll_option_text'], '', '10px'); } $i++; } } $poll_form .= "</ul>\n"; $poll_form .= $poll_form_end; } } /** * Generate Attachment */ $attachments = array(); if ($this->getThreadPermission("can_download_attach") == TRUE) { $a_result = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE thread_id='" . intval($thread_data['thread_id']) . "' ORDER BY post_id ASC"); if (dbrows($a_result) > 0) { while ($a_data = dbarray($a_result)) { if (file_exists(INFUSIONS . "forum/attachments/" . $a_data['attach_name'])) { //$this->thread_info['attachments'][$a_data['post_id']][] = $a_data; $attachments[$a_data['post_id']][] = $a_data; } } } } /** * Generate Mod Form */ if (iMOD) { // need to wrap with issets? $mod = new Moderator(); $mod->setForumId($thread_data['forum_id']); $mod->setThreadId($thread_data['thread_id']); $mod->set_modActions(); /** * Thread moderation form template */ $this->thread_info['mod_options'] = array('renew' => $locale['forum_0207'], 'delete' => $locale['forum_0201'], $thread_data['thread_locked'] ? "unlock" : "lock" => $thread_data['thread_locked'] ? $locale['forum_0203'] : $locale['forum_0202'], $thread_data['thread_sticky'] ? "nonsticky" : "sticky" => $thread_data['thread_sticky'] ? $locale['forum_0205'] : $locale['forum_0204'], 'move' => $locale['forum_0206']); $addition = isset($_GET['rowstart']) ? "&rowstart=" . intval($_GET['rowstart']) : ""; $this->thread_info['form_action'] = INFUSIONS . "forum/viewthread.php?thread_id=" . intval($thread_data['thread_id']) . $addition; $this->thread_info['open_post_form'] = openform('moderator_menu', 'post', $this->thread_info['form_action']); $this->thread_info['close_post_form'] = closeform(); /* * <a id='check' class='btn button btn-sm btn-default text-dark' href='#' onclick=\"javascript:setChecked('mod_form','delete_post[]',1);return false;\">".$locale['forum_0080']."</a>\n <a id='uncheck' class='btn button btn-sm btn-default text-dark' href='#' onclick=\"javascript:setChecked('mod_form','delete_post[]',0);return false;\">".$locale['forum_0081']."</a>\n */ $this->thread_info['mod_form'] = "\n\t\t\t\t<div class='list-group-item'>\n\n\t\t\t\t\t<div class='btn-group m-r-10'>\n\n\t\t\t\t\t\t" . form_button("check_all", $locale['forum_0080'], $locale['forum_0080'], array('class' => 'btn-default btn-sm', "type" => "button")) . "\n\t\t\t\t\t\t" . form_button("check_none", $locale['forum_0081'], $locale['forum_0080'], array('class' => 'btn-default btn-sm', "type" => "button")) . "\n\t\t\t\t\t</div>\n\n\t\t\t\t\t" . form_button('move_posts', $locale['forum_0176'], $locale['forum_0176'], array('class' => 'btn-default btn-sm m-r-10')) . "\n\t\t\t\t\t" . form_button('delete_posts', $locale['forum_0177'], $locale['forum_0177'], array('class' => 'btn-default btn-sm')) . "\n\t\t\t\t\t<div class='pull-right'>\n\t\t\t\t\t\t" . form_button('go', $locale['forum_0208'], $locale['forum_0208'], array('class' => 'btn-default pull-right btn-sm m-t-0 m-l-10')) . "\n\t\t\t\t\t\t" . form_select('step', '', '', array('options' => $this->thread_info['mod_options'], 'placeholder' => $locale['forum_0200'], 'width' => '250px', 'allowclear' => 1, 'class' => 'm-b-0 m-t-5', 'inline' => 1)) . "\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n"; add_to_jquery("\n\t\t\t\t\$('#check_all').bind('click', function() {\n\t\t\t\t var thread_posts = \$('#moderator_menu input:checkbox').prop('checked', true);\n\t\t\t\t});\n\t\t\t\t\$('#check_none').bind('click', function() {\n\t\t\t\t var thread_posts = \$('#moderator_menu input:checkbox').prop('checked', false); });\n\t\t\t\t"); } $this->thread_info += array("thread" => $thread_data, "thread_id" => $thread_data['thread_id'], "forum_id" => $thread_data['forum_id'], "forum_cat" => isset($_GET['forum_cat']) && verify_forum($_GET['forum_cat']) ? $_GET['forum_cat'] : 0, "forum_branch" => isset($_GET['forum_branch']) && verify_forum($_GET['forum_branch']) ? $_GET['forum_branch'] : 0, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&forum_id=" . $thread_data['forum_id'] . "&forum_cat=" . $thread_data['forum_cat'] . "&forum_branch=" . $thread_data['forum_branch'], "title" => $thread_data['forum_name']), "post_id" => isset($_GET['post_id']) && verify_post($_GET['post_id']) ? $_GET['post_id'] : 0, "pid" => isset($_GET['pid']) && isnum($_GET['pid']) ? $_GET['pid'] : 0, "section" => isset($_GET['section']) ? $_GET['section'] : '', "forum_moderators" => Functions::parse_forumMods($thread_data['forum_mods']), "max_post_items" => $thread_stat['post_count'], "post_firstpost" => $thread_stat['first_post_id'], "post_lastpost" => $thread_stat['last_post_id'], "posts_per_page" => $forum_settings['posts_per_page'], "threads_per_page" => $forum_settings['threads_per_page'], "lastvisited" => isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time(), "allowed_post_filters" => array('oldest', 'latest', 'high'), "attachtypes" => explode(",", $forum_settings['forum_attachtypes']), "quick_reply_form" => $qr_form, "poll_form" => $poll_form, "post-filters" => "", 'mod_options' => array(), 'form_action' => '', 'open_post_form' => '', 'close_post_form' => '', 'mod_form' => ''); /** * Generate All Thread Buttons */ $this->thread_info['buttons'] += array("print" => array("link" => BASEDIR . "print.php?type=F&item_id=" . $thread_data['thread_id'] . "&rowstart=" . $_GET['rowstart'], "title" => $locale['forum_0178']), "newthread" => $this->getThreadPermission("can_post") == TRUE ? array("link" => INFUSIONS . "forum/newthread.php?forum_id=" . $thread_data['forum_id'], "title" => $locale['forum_0264']) : array(), "reply" => $this->getThreadPermission("can_reply") == TRUE ? array("link" => INFUSIONS . "forum/viewthread.php?action=reply&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'], "title" => $locale['forum_0360']) : array(), "poll" => $this->getThreadPermission("can_create_poll") == TRUE ? array("link" => INFUSIONS . "forum/viewthread.php?action=newpoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'], "title" => $locale['forum_0366']) : array()); /** * Generate Post Filters */ $this->thread_info['post-filters'][0] = array('value' => INFUSIONS . 'forum/viewthread.php?thread_id=' . $thread_data['thread_id'] . '&section=oldest', 'locale' => $locale['forum_0180']); $this->thread_info['post-filters'][1] = array('value' => INFUSIONS . 'forum/viewthread.php?thread_id=' . $thread_data['thread_id'] . '&section=latest', 'locale' => $locale['forum_0181']); if ($this->getThreadPermission("can_rate") == TRUE) { $this->thread_info['allowed-post-filters'][2] = 'high'; $this->thread_info['post-filters'][2] = array('value' => INFUSIONS . 'forum/viewthread.php?thread_id=' . $this->thread_info['thread_id'] . '&section=high', 'locale' => $locale['forum_0182']); } $this->handle_quick_reply(); $this->get_thread_post(); //self::set_ThreadJs(); // execute in the end. //self::set_ForumPostDB(); } else { redirect(FORUM . 'index.php'); } }
die; } if ($req == "tickets" && $id) { $info["ticket"] = Db::query("SELECT * FROM zz_tickets WHERE id = :id", array(":id" => $id), 0); $info["replies"] = Db::query("SELECT * FROM zz_tickets_replies WHERE belongsTo = :id", array(":id" => $id), 0); } elseif ($req == "tickets") { $limit = 30; $offset = ($page - 1) * $limit; $info = Db::query("SELECT * FROM zz_tickets WHERE killID = 0 ORDER BY status DESC, datePosted DESC LIMIT {$offset}, {$limit}", array(), 0); foreach ($info as $key => $val) { if ($val["tags"]) { $info[$key]["tags"] = explode(",", $val["tags"]); } } } elseif ($req == "users") { $info = Moderator::getUsers($page); } if ($req == "reportedkills" && $id) { $info["ticket"] = Db::query("SELECT * FROM zz_tickets WHERE id = :id", array(":id" => $id), 0); $info["replies"] = Db::query("SELECT * FROM zz_tickets_replies WHERE belongsTo = :id", array(":id" => $id), 0); } elseif ($req == "reportedkills") { $limit = 30; $offset = ($page - 1) * $limit; $info = Db::query("SELECT * FROM zz_tickets WHERE killID != 0 ORDER BY status DESC LIMIT {$offset}, {$limit}", array(), 0); foreach ($info as $key => $val) { if ($val["tags"]) { $info[$key]["tags"] = explode(",", $val["tags"]); } } } $app->render("moderator/moderator.html", array("id" => $id, "info" => $info, "key" => $req, "url" => "moderator", "message" => $message, "page" => $page));
public function edit($record) { if ($this->isLoggedIn()) { return sprintf("'%s', '#%s' numarali icerigi duzenledi.", $this->username, $record); } } } $admin = new Admin("Admin", "admin[at]harunyasar[.]com", "13gojira13"); $admin->login(); echo $admin->ban("Moderator"); // 'Admin', 'Moderator' adli kullanicinin erisimini yasakladi. echo "<br />"; echo $admin->post("Kurallar"); // 'Admin', 'Kurallar' baslikli yeni bir icerik yaratti. echo "<br />"; $moderator = new Moderator("Moredator", "moderator[at]harunyasar[.]com", "54godzilla54"); $moderator->login(); echo $moderator->edit(1349); // 'Moredator', '#1349' numarali icerigi duzenledi. echo "<br />"; echo $moderator->post("Uyari"); // 'Moredator', 'Uyari' baslikli yeni bir icerik yaratti. echo "<br />"; echo $moderator->logout(); // 'Moredator' adli kullanici cikis yapti. echo "<br />"; $user = new User("User", "user[at]harunyasar[.]com", "18user81"); $user->login(); echo $user->post("Lorem ipsum dolor sit amet."); // 'User', 'Lorem ipsum dolor sit amet.' baslikli yeni bir icerik yaratti. echo $user->edit(54);
$user_info = new UserInfo(); $user_info->SetDatabase($database); $user_info->Create(); break; case 18: $topic = new Topic(); $topic->SetDatabase($database); $topic->Create(); break; case 19: $c_message = new Message(); $c_message->SetDatabase($database); $c_message->Create(); break; case 20: $moderator = new Moderator(); $moderator->SetDatabase($database); $moderator->Create(); break; /* case 21: $user = new User(); $user->SetDatabase($database); $user->SetUsername("admin"); $user->SetPassword("schifer211276"); $user->SetActive(1); $user->Encrypt(); $user->Insert();
$menu_item = new MenuItem(); $menu_item->SetDatabase($database); $menu_item->Backup($handle1, $handle2); $shout = new Shout(); $shout->SetDatabase($database); $shout->Backup($handle1, $handle2); $user_info = new UserInfo(); $user_info->SetDatabase($database); $user_info->Backup($handle1, $handle2); $topic = new Topic(); $topic->SetDatabase($database); $topic->Backup($handle1, $handle2); $c_message = new Message(); $c_message->SetDatabase($database); $c_message->Backup($handle1, $handle2); $moderator = new Moderator(); $moderator->SetDatabase($database); $moderator->Backup($handle1, $handle2); fclose($handle1); fclose($handle2); $message_position = 1; $message = "Arquivo criado com sucesso!"; } } ?> <html> <head> <title>Schifer's</title> <link rel="stylesheet" type="text/css" href="/schifers/css/schifers.css"> <script language="Javascript">
<form name="form_query" method="post"> <tr> <td bgcolor="#EEEEEE" width="100%" valign="top" class="form_title" colspan="2"> Moderadores </td> </tr> <tr> <td bgcolor="#FFFFFF" width="30%" valign="center" align="right"> Id: </td> <td bgcolor="#FFFFFF" width="70%" valign="center" align="left"> <select name="p_modr_id"> <option value="">Selecione</option> <?php $moderator = new Moderator(); $moderator->SetDatabase($database); $result = $moderator->SelectCombo(); while ($data = $database->FetchArray($result)) { $modr_id = $data["modr_id"]; $user = $data["user_username"]; $topic = $data["topc_title"]; echo "<option value=\"" . $modr_id . "\">" . $user . " - " . $topic . "</option>"; } ?> </select> </td> </tr> <tr> <td bgcolor="#FFFFFF" width="100%" valign="center" align="center" colspan="2">
public function executeStepThree(sfWebRequest $request) { $error = 0; $configuration = sfProjectConfiguration::getActive(); $db = new sfDatabaseManager($configuration); foreach ($db->getNames() as $connection) { try { @$db->getDatabase($connection)->getConnection(); } catch (Exception $e) { $error = 1; } } if ($error == 1) { $this->getUser()->setFlash('error', $e->getMessage()); $this->redirect('firstBoot/stepOne'); } $moderator = new Moderator(); $login = new Login(); $login->setIsModerator(true); $moderator->setLogin($login); $this->form = new ModeratorForm($moderator, array('new' => true)); }
} } if ($action == 3) { $moderator = new Moderator(); $moderator->SetDatabase($database); $moderator->SetId($modr_id); $moderator->SetTopic($modr_topc_id); $moderator->SetUser($modr_user_id); if ($moderator->Update()) { $message = $screen_module_name . " alterado com sucesso."; } else { $message = "Problemas na operação."; } } if ($action == 4) { $moderator = new Moderator(); $moderator->SetDatabase($database); $moderator->SetId($modr_id); if ($moderator->Delete()) { $message = $screen_module_name . " excluído com sucesso."; $modr_id = ""; $modr_topc_id = ""; $modr_user_id = ""; } else { $message = "Problemas na operação."; } } } ?> <html>