Exemplo n.º 1
0
function FlashChatBridge_user_showChat()
{
    // perform permission check
    if (!SecurityUtil::checkPermission('FlashChatBridge::', '::', ACCESS_READ)) {
        return LogUtil::registerPermissionError();
    }
    $popup = FormUtil::getPassedValue('popup', false);
    // Security check
    $render =& pnRender::getInstance('FlashChatBridge', false);
    $UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
    $client_type = FormUtil::getPassedValue('client_type', 'standard');
    $settings = pnModGetVar('FlashChatBridge');
    $settings['init_user'] = $UserVars['uname'];
    $settings['init_password'] = $UserVars['pass'];
    if ($settings['autosize'] == 1) {
        $settings['width'] = "100%";
        $settings['height'] = "100%";
    }
    if ($popup) {
        $settings['width'] = "100%";
        $settings['height'] = "100%";
        $render->assign('settings', $settings);
        $chat = $render->fetch("flashchatbridge_user_chat_{$client_type}.htm");
        $render->assign('chat', $chat);
        echo $render->fetch('flashchatbridge_user_popup.htm');
        exit;
    } else {
        $render->assign('settings', $settings);
        return $render->fetch("flashchatbridge_user_chat_{$client_type}.htm");
    }
}
Exemplo n.º 2
0
 public function index()
 {
     echo "{" + "name" + ":" + "huangzhen" + "," + "age" + ":" + "23" + "}";
     if ('6' == SessionUtil::get('user_id')) {
         echo 'f**k';
     }
 }
 public function handleForm(Context $context, $action)
 {
     if ($action == "createReservation") {
         if (isset($_POST['equip_id']) && $_POST['equip_id'] != "" && (isset($_POST['start_date']) && $_POST['start_date'] != "") && (isset($_POST['length']) && $_POST['length'] != "")) {
             $equipId = $_POST['equip_id'];
             $equip = EquipmentDao::getEquipmentByID($equipId);
             if ($equip != null) {
                 if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
                     $startDate = $_POST['start_date'];
                     $endDate = DateUtil::incrementDate($startDate, $_POST['length']);
                     $reservations = ReservationDao::getReservationsForEquipmentByDate($equipId, $startDate, $endDate);
                     if (count($reservations) == 0) {
                         $user = UserDao::getUserByUsername(SessionUtil::getUsername());
                         $reservation = ReservationDao::createReservation($user->id, $equipId, $_POST['length'], $startDate, $endDate, $_POST['user_comment']);
                         EmailUtil::sendNewReservationNotices($user, $reservation);
                     } else {
                         $context->addError("Reservations already exist during selected dates ({$startDate} and {$endDate}).");
                     }
                 } else {
                     $context->addError("Cannot reserve equipment (User Level).");
                 }
             } else {
                 $context->addError("No such equipment.");
             }
         } else {
             $context->addError("Required Field Left Blank.");
         }
     } else {
         $context->addError("Incorrect Action.");
     }
 }
Exemplo n.º 4
0
 public function __toString()
 {
     if (SessionUtil::getUserlevel() >= RES_USERLEVEL_ADMIN) {
         return "<a href=\"./index.php?pageid=editUser&userid=" . $this->id . "\">" . $this->name . "</a>";
     }
     return $this->name;
 }
Exemplo n.º 5
0
 public function __construct($className_, $tableName)
 {
     $this->className = $className_;
     $this->tableName = $tableName;
     $sessionUtil = SessionUtil::getInstance();
     $this->companySeq = $sessionUtil->getAdminLoggedInCompanySeq();
 }
 public function handleForm($context, $action)
 {
     if ($action == "createAd") {
         if (isset($_POST['start']) && $_POST['start'] != "" && (isset($_POST['size']) && $_POST['size'] != "") && (isset($_POST['name']) && $_POST['name'] != "") && (isset($_POST['url']) && $_POST['url'] != "")) {
             $start = $_POST['start'];
             $dayOfWeek = date("D", strtotime($start));
             if ($dayOfWeek == "Mon") {
                 $splitStart = explode("/", $start);
                 $mysqlStart = $splitStart[2] . "-" . $splitStart[0] . "-" . $splitStart[1];
                 if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
                     $filename = $this->saveSampleImage($context, $_FILES['image'], SessionUtil::getUsername());
                     if ($filename != "") {
                         WebAdDao::createWebAd($_POST['name'], $mysqlStart, $_POST['size'], $filename, $_POST['url']);
                     } else {
                         $context->addError("Error Uploading File, Please Try Again.");
                     }
                 } else {
                     $context->addError("No File Uploaded.");
                 }
             } else {
                 $context->addError("Starting Date Not a Monday.");
             }
         } else {
             $context->addError("Required Field Left Blank.");
         }
     } else {
         $context->addError("Incorrect Action.");
     }
 }
 private function getCheckinRow(Reservation $reservation)
 {
     if (SessionUtil::getUserlevel() == RES_USERLEVEL_ADMIN) {
         return "<tr>\n\t\t\t\t\t\n\t\t\t\t\t<form action=\"./index.php?pageid=viewReservation\" method=\"POST\">\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t" . $this->getCheckinCell($reservation) . "\n\t\t\t\t\t</td>\n\t\t\t\t\t</form>\n\t\t\t\t\t<form action=\"./index.php?pageid=viewReservation\" method=\"POST\" onSubmit=\"return confirm('Are you sure you want to delete this reservation?')\">\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"delete\" name=\"action\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"" . $reservation->id . "\" name=\"resid\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"Delete\">\n\t\t\t\t\t</td>\n\t\t\t\t\t</form>\n\t\t\t\t\t<form action=\"./index.php?pageid=viewReservation\" method=\"POST\">\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"" . $reservation->id . "\" name=\"resid\">\n\t\t\t\t\t\t<select name=\"status\">\n\t\t\t\t\t\t\t<option value=\"" . RES_STATUS_CONFIRMED . "\">Approve</option>\n\t\t\t\t\t\t\t<option value=\"" . RES_STATUS_DENIED . "\">Deny</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"updateStatus\" name=\"action\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"" . $reservation->id . "\" name=\"resid\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"Update\">\n\t\t\t\t\t</td>\n\t\t\t\t\t</form>\n\t\t\t\t\t\n\t\t\t\t</tr>";
     } else {
         return "";
     }
 }
Exemplo n.º 8
0
 public function generateHTML()
 {
     if (SessionUtil::getUserlevel() >= $this->getMinimumUserLevel()) {
         return $this->layout->generateHTML();
     } else {
         return $this->userLevelErrorLayout->generateHTML();
     }
 }
Exemplo n.º 9
0
 public function onKernelRequestSessionExpire(GetResponseEvent $event)
 {
     if (\SessionUtil::hasExpired()) {
         // Session has expired, display warning
         $response = new Response(\ModUtil::apiFunc('ZikulaUsersModule', 'user', 'expiredsession'), 403);
         $this->setResponse($event, $response);
     }
 }
Exemplo n.º 10
0
 public static function contentMainEditExpandAll($belowPageId = null)
 {
     $expandedPageIds = SessionUtil::getVar('contentExpandedPageIds', array());
     foreach (Content_Util::contentMainEditGetPagesList($belowPageId) as $page) {
         $expandedPageIds[$page['id']] = 1;
     }
     SessionUtil::setVar('contentExpandedPageIds', $expandedPageIds);
 }
 function generateHTML()
 {
     $user = UserDao::getUserByUsername(SessionUtil::getUsername());
     $changePasswordRows = "";
     if (Config::login_type == LOGIN_TYPE_DB) {
         $changePasswordRows = "\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td class=\"centeredcellbold\">Change Password</td>\n\t\t\t\t<td class=\"centeredcellbold\">Current Password</td>\n\t\t\t\t<td class=\"centeredcellbold\">New Password</td>\n\t\t\t\t<td class=\"centeredcellbold\">Confirm Password</td>\n\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<form action=\"./index.php?pageid=savepassword\" method=\"POST\"><td class=\"centeredcellbold\"><input type=\"submit\" value=\"Save Password\"></td>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"password\" name=\"curpass\"></td>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"password\" name=\"newpass\"></th>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"password\" name=\"confpass\"></td></form>\n\t\t\t\n\t\t\t\t</tr>";
     }
     return "<center><h3>My Account</h3>" . $this->context->getErrorHTML() . "</center>\n\t\t\t\n\t\t\t<table class=\"myaccount\">\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">Edit User Information</td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Username</td>\n\t\t\t\t\t<td colspan=3 class=\"centeredcell\">" . $user->username . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\n\t\t\t\t<tr>\n\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Name</th>\n\t\t\t\t\t<td colspan=3 class=\"centeredcell\">" . $user->name . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\n\t\t\t\t" . $changePasswordRows . "\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<form action=\"./index.php?pageid=saveemail\" method=\"POST\">\n\t\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Email</th><td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"email\" size=30 value=\"" . $user->email . "\"><input type=\"submit\" value=\"Save Email\"></td></form>\n\t\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Warnings</th>\n\t\t\t\t\t<td class=\"centeredcellbold\" colspan=3><a href=\"./index.php?pageid=viewMyWarnings\">" . WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) . "(" . WarningDao::getWarningCountForUser($user->id) . ")</a></td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t\t\n\t\t\t</table>";
 }
Exemplo n.º 12
0
 /**
  * Event: 'frontcontroller.predispatch'.
  *
  * @param GenericEvent $event
  *
  * @return void
  */
 public function sessionExpired(GenericEvent $event)
 {
     if (\SessionUtil::hasExpired()) {
         // Session has expired, display warning
         header('HTTP/1.0 403 Access Denied');
         $return = \ModUtil::apiFunc('UsersModule', 'user', 'expiredsession');
         \System::shutdown();
     }
 }
Exemplo n.º 13
0
 function __construct()
 {
     // Set Token
     if (SessionUtil::session('token')) {
         $this->token = SessionUtil::session('token');
     }
     //Set the loggedIn
     $this->loggedIn = SessionUtil::session('loggedIn');
 }
Exemplo n.º 14
0
 /**
  * Event: 'frontcontroller.predispatch'.
  *
  * @param Zikula_Event $event
  *
  * @return void
  */
 public function sessionExpired(Zikula_Event $event)
 {
     if (SessionUtil::hasExpired()) {
         // Session has expired, display warning
         header('HTTP/1.0 403 Access Denied');
         echo ModUtil::apiFunc('Users', 'user', 'expiredsession');
         Zikula_View_Theme::getInstance()->themefooter();
         System::shutdown();
     }
 }
 public function handleClientDesign(Context $context)
 {
     $insertDate = explode('/', $_POST['insertdate']);
     $mysqlFormattedDate = $insertDate[2] . "-" . $insertDate[1] . "-" . $insertDate[0];
     $clientId = ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername()))->getID();
     $filename = $this->saveSampleImage($context, $_FILES['sampleimage'], $clientId);
     if ($filename != "") {
         InsertionOrderDao::createForClientWithImage(ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername()))->getID(), $mysqlFormattedDate, $_POST['design'], $_POST['color'], $_POST['columns'], $_POST['height'], $_POST['inserts'], $_POST['placements'], $filename);
     }
 }
Exemplo n.º 16
0
 public function generateHTML()
 {
     if (!SessionUtil::isLoggedIn() && $this->layout->getBody() instanceof LoginBody) {
         return $this->layout->generateHTML();
     } else {
         if (SessionUtil::isLoggedIn() && SessionUtil::getUserlevel() >= $this->getMinimumUserLevel()) {
             return $this->layout->generateHTML();
         } else {
             return $this->userLevelErrorLayout->generateHTML();
         }
     }
 }
Exemplo n.º 17
0
 public static function login($username, $password)
 {
     $user_table = new UserTable();
     $result = $user_table->select($username, $password);
     if ($result != false) {
         // 设置Session
         SessionUtil::set(array('is_login' => true, 'user_id' => $result['user_id'], 'user_login' => $result['user_login'], 'user_name' => $result['user_name'], 'user_phone' => $result['user_phone'], 'user_email' => $result['user_email'], 'user_type' => $result['user_type'], 'user_authority' => SQLUtil::get_authority($result['user_type'], $result['user_authority'])));
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 18
0
 public function generateClientHTML()
 {
     $adRep = new AdRep(1, "Andrew Melton", "*****@*****.**", "804-267-0327");
     $status = new Status(1, "Design", "Your ad has been aproved and is being designed.");
     $designStatus = new Status(1, "To Be Designed", "A designer is working on your ad.");
     $billingStatus = new Status(1, "Paid", "");
     $orders = InsertionOrderDao::getOrdersByClientID(ClientDao::getClientByLogin(LoginDao::getLoginByUsername(SessionUtil::getUsername()))->getID());
     $ordersHTML = "";
     foreach ($orders as $order) {
         $ordersHTML = $ordersHTML . $order->generateDualRowHTML();
     }
     return "<br />\n\t\t\t\t<div id=\"insertsheader\">\n\t\t\t\t<table id=\"report2\" border=\"0\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<th class=\"adrep\">Your Ad Rep</th>\n\t\t\t\t\t\t<th class=\"created\">Created</th>\n\t\t\t\t\t\t<th class=\"updated\">Updated</th>\n\t\t\t\t\t\t<th class=\"issue\">Issue</th>\n\t\t\t\t\t\t<th class=\"status\">Status</th>\n\t\t\t\t\t\t<th class=\"designstatus\">Design-Status</th>\n\t\t\t\t\t\t<th class=\"billingstatus\">Billing</th>\n\t\t\t\t\t\t<!--<th class=\"arrow\"></th>-->\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t\t<div id=\"contentdiv\" class=\"scroll\">\n\t\t\t\t\n\t\t\t\t\t<table id=\"report\" border=\"0\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . $ordersHTML . "\n\t\t\t\t\t\n\t\t\t\t\t</table>\n\t\t\t\t\n\t\t\t\t</div>";
 }
Exemplo n.º 19
0
 public function generateHTML()
 {
     $username = SessionUtil::getUsername();
     $user = UserDao::getUserByUsername($username);
     $reservations = ReservationDao::getReservationsForUser($user->id, 5);
     $reservationHTML = "";
     foreach ($reservations as $res) {
         $status = $res->getModStatusString();
         $equipment = EquipmentDao::getEquipmentByID($res->equipId);
         $reservationHTML = $reservationHTML . "<tr>\n\t\t\t\n\t\t\t\t\t<td class=\"myequip" . $status . "\">" . $equipment->name . "</td>\n\t\t\t\t\t<td class=\"myequip" . $status . "\">" . $status . "</td>\n\t\t\t\t\t<td class=\"myequip" . $status . "\">" . $res->startDate . "</td>\n\t\t\t\t\t<td class=\"myequip" . $status . "\">" . $res->endDate . "</td>\n\t\t\t\t\t<td class=\"myequip" . $status . "\"><a href=\"./index.php?pageid=viewReservation&resid=" . $res->id . "\">View</a></td>\n\t\t\t\t\t\t\n\t\t\t\t</tr>";
     }
     return OfficeHourCalendar::HTML . "<h3>Your Reservations</h3>\n\t\t\n\t\t<table class=\"myequip\">\n\t\t\n\t\t\t<tr>\n\t\t\n\t\t\t\t<td class=\"header\">Equipment Name</td>\n\t\t\t\t<td class=\"header\">Status</td>\n\t\t\t\t<td class=\"header\">Check-out Date</td>\n\t\t\t\t<td class=\"header\">Due Date</td>\n\t\t\t\t<td class=\"header\">-</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t" . $reservationHTML . "\n\t\n\t\t</table>";
 }
 public function generateHTML()
 {
     $user = UserDao::getUserByUsername(SessionUtil::getUsername());
     $warnings = WarningDao::getAllWarningsForUser($user->id);
     $options = "";
     foreach ($warnings as $warning) {
         $options .= $warning->toOptionHTML();
     }
     $warningSelect = "You have no warnings. :)";
     if ($options != "") {
         $warningSelect = "<form action=\"./index.php\" method=\"GET\">" . "<input type=\"hidden\" name=\"pageid\" value=\"viewWarning\" />" . "<select name=\"warnid\">" . $options . "</select>" . "<input type=\"submit\" value=\"View\" />" . "</form>";
     }
     return "<center><h3>View My Warnings</h3></center>" . $warningSelect;
 }
Exemplo n.º 21
0
 public function handleForm($context, $action)
 {
     if ($action == "login") {
         $login = LoginDao::authUser($_POST['username'], $_POST['password']);
         if ($login) {
             SessionUtil::login($login);
             $context->setPageID("home");
         } else {
             $context->addError("Incorrect Login");
         }
     } else {
         $context->addError("Incorrect Action.");
     }
 }
Exemplo n.º 22
0
 /**
  * Return an array of items to show in the your account panel.
  *
  * @return   array   indexed array of items
  */
 public function getall($args)
 {
     $items = array();
     // Create an array of links to return
     if (SecurityUtil::checkPermission('Categories::', '::', ACCESS_EDIT) && $this->getVar('allowusercatedit')) {
         $referer = System::serverGetVar('HTTP_REFERER');
         if (strpos($referer, 'module=Categories') === false) {
             SessionUtil::setVar('categories_referer', $referer);
         }
         $items['0'] = array('url' => ModUtil::url('Categories', 'user', 'edituser'), 'module' => 'Categories', 'title' => $this->__('Categories manager'), 'icon' => 'admin.png');
     }
     // Return the items
     return $items;
 }
Exemplo n.º 23
0
 function generateHTML()
 {
     $login = LoginDao::getLoginByUsername(SessionUtil::getUsername());
     if ($login->getType() == Login::CLIENT) {
         $client = ClientDao::getClientByLogin($login);
         return $this->context->getErrorHTML() . "<div class=\"centered\">\n\t\t\n\t\t\t\t<h3>Login</h3>\n\t\t\t\t\n\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"changePassword\" />\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Repeat Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"repeatpassword\" placeholder=\"Repeat Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<input type=\"submit\" value=\"Change Password\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<h3>Account Info</h3>\n\t\t\t\t\n\t\t\t\t<div style=\"width: 45%; margin-left: auto; margin-right: auto;\">\n\t\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t\t<div style=\"float: left; text-align: left;\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"updateAccount\" />\n\t\t\t\t\t\t\t<label for=\"name\" class=\"above\">Name</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"name\" placeholder=\"Name\" value=\"" . $client->getName() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<label for=\"email\" class=\"above\">Email</label>\n\t\t\t\t\t\t\t<input type=\"email\" name=\"email\" placeholder=\"Email\" value=\"" . $client->getEmail() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<label for=\"phone\" class=\"above\">Phone</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"phone\" placeholder=\"Phone\" value=\"" . $client->getPhone() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div style=\"float: right; text-align: right;\">\n\t\t\t\t\t\t\t<br /><label for=\"address\" class=\"above\">Address</label>\n\t\t\t\t\t\t\t<textarea name=\"address\" rows=\"3\" cols=\"23\" class=\"text bluefocus\">" . $client->getAddress() . "</textarea>\n\t\t\t\t\t\t\t<br /><br /><input type=\"submit\" value=\"Update Account\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t</div>";
     } else {
         if ($login->getType() == Login::ADREP) {
             $adrep = AdRepDao::getAdRepByLogin($login);
             return $this->context->getErrorHTML() . "<div class=\"centered\">\n\t\t\n\t\t\t\t<h3>Login Info</h3>\n\t\t\t\t\n\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"changePassword\" />\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Repeat Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"repeatpassword\" placeholder=\"Repeat Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<input type=\"submit\" value=\"Change Password\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<h3>Account Info (Ad Rep)</h3>\n\t\t\t\t\n\t\t\t\t<div style=\"width: 45%; margin-left: auto; margin-right: auto;\">\n\t\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t\t<div style=\"float: left; text-align: left;\">\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"updateAccount\" />\n\t\t\t\t\t\t\t<label for=\"name\" class=\"above\">Name</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"name\" placeholder=\"Name\" value=\"" . $adrep->getName() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<label for=\"email\" class=\"above\">Email</label>\n\t\t\t\t\t\t\t<input type=\"email\" name=\"email\" placeholder=\"Email\" value=\"" . $adrep->getEmail() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div style=\"float: right; text-align: right;\">\n\t\t\t\t\t\t\t<label for=\"phone\" class=\"above\">Phone</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"phone\" placeholder=\"Phone\" value=\"" . $adrep->getPhone() . "\" class=\"text bluefocus\"/>\n\t\t\t\t\t\t\t<br /><br /><input type=\"submit\" value=\"Update Account\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t</div>";
         } else {
             return $this->context->getErrorHTML() . "<div class=\"centered\">\n\t\t\t\n\t\t\t\t<h3>Login Info</h3>\n\t\t\t\t\n\t\t\t\t<form action=\"./index.php?pageid=myAccount\" method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"changePassword\" />\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<label for=\"password\" class=\"sameline\">Repeat Password</label>\n\t\t\t\t\t<input type=\"password\" name=\"repeatpassword\" placeholder=\"Repeat Password\" class=\"text bluefocus\"/>\n\t\t\t\t\t<input type=\"submit\" value=\"Change Password\" class=\"stdbutton bluefocus\"/>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t\t<h3>Account Info</h3>\n\t\t\t\t\n\t\t\t\t<div class=\"centered error\">Unknown Account Type</div>\n\t\t\t\n\t\t\t</div>";
         }
     }
 }
 public function generateHTML()
 {
     $user = UserDao::getUserByUsername(SessionUtil::getUsername());
     if (WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) > RES_WARNING_MAX_ACTIVE) {
         $this->context->addError("You have too many Active Warnings (more than " . RES_WARNING_MAX_ACTIVE . ") on your account to place Reservations.");
         return $this->context->getErrorHTML() . $this->context->getMessagesHTML();
     }
     //TODO: do we need this?
     $allEquipment = EquipmentDao::getAllEquipment();
     $equipArray = array();
     //^^^^^^^^^^^^^^^^^^^^^^^^^^
     $page = "";
     $success = false;
     if (isset($_POST['equip_id']) && $_POST['equip_id'] != "") {
         if (count($this->context->getErrors()) == 0) {
             $page = "Successfully Created Reservation.";
             $success = true;
         } else {
             $_GET['equipid'] = $_POST['equip_id'];
         }
     }
     if (!$success && isset($_GET['equipid']) && $_GET['equipid'] != "") {
         $equip = EquipmentDao::getEquipmentByID($_GET['equipid']);
         if ($equip != null) {
             if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
                 $lengthOptions = "";
                 for ($i = 1; $i <= $equip->maxLength; $i++) {
                     if ($i > 1) {
                         $lengthOptions = $lengthOptions . "<option value=\"" . $i . "\">" . $i . " Days</option>";
                     } else {
                         $lengthOptions = $lengthOptions . "<option value=\"" . $i . "\">" . $i . " Day</option>";
                     }
                 }
                 $page = "\n\n\t\t<form name=\"reservation\" action=\"./index.php?pageid=placeReservation\" method=\"POST\" onsubmit=\"return checkDate();\">\n\t\t<input type=\"hidden\" name=\"action\" value=\"createReservation\">\n\t\t<input type=\"hidden\" name=\"equip_id\" value=\"" . $_GET['equipid'] . "\">\n\t\t<table class=\"reservation\">\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"header\">Reserve the " . $equip->name . "</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td class=\"centeredcellbold\">Date (YYYY-MM-DD)</td>\n\t\t\t\t<td class=\"centeredcell\">\n\t\t\t\t\t<input type=\"text\" readonly name=\"start_date\" id=\"startdate\" class=\"date\" value=\"blah\"/>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"centeredcellbold\">Length</td>\n\t\t\t\t<td class=\"centeredcell\"><select name=\"length\">" . $lengthOptions . "</select></td>\n\t\t\n\t\t\t</tr>\n\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">User Comment</th>\n\t\t\t\t<td class=\"centeredcell\" colspan=3><textarea rows=5 cols=45 name=\"user_comment\"></textarea></td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcell\"><input type=\"submit\" value=\"Reserve\"></td>\n\t\t\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t</table>\n\t\t\t</form></div>";
             } else {
                 $this->context->addError("Cannot reserve equipment (User Level).");
             }
         } else {
             $this->context->addError("No equipment with ID '" . $_GET['equipid'] . "'.");
         }
     } else {
         if (!$success) {
             $this->context->addError("No equipment selected.");
         }
     }
     return "<center><h3>Place Reservation</h3>" . $this->context->getErrorHTML() . "</center>" . $page;
 }
 public function handleForm(Context $context, $action)
 {
     if (UserDao::getUserByUsername(SessionUtil::getUsername())->userlevel == RES_USERLEVEL_ADMIN) {
         if ($action == "deleteWarning") {
             $warning = WarningDao::getWarningByID($_POST['warnId']);
             if ($warning != null) {
                 WarningDao::deleteWarning($warning->id);
                 $context->addMessage("Successfully deleted warning.");
             } else {
                 $context->addError("No such warning.");
             }
         } else {
             $context->addError("Incorrect Action.");
         }
     } else {
         $context->addError("Not Authorized.");
     }
 }
 public function generateHTML()
 {
     $myuser = UserDao::getUserByUsername(SessionUtil::getUsername());
     $user = UserDao::getUserByID($_GET['userid']);
     if ($myuser->userlevel < RES_USERLEVEL_ADMIN) {
         $this->context->addError("Not Authorized.");
         return $this->context->getErrorHTML();
     }
     $warnings = WarningDao::getAllWarningsForUser($user->id);
     $options = "";
     foreach ($warnings as $warning) {
         $options .= $warning->toOptionHTML();
     }
     $warningSelect = $user . " has no warnings.";
     if ($options != "") {
         $warningSelect = "<form action=\"./index.php\" method=\"GET\">" . "<input type=\"hidden\" name=\"pageid\" value=\"viewWarning\" />" . "<select name=\"warnid\">" . $options . "</select>" . "<input type=\"submit\" value=\"View\" />" . "</form>";
     }
     return "<center><h3>View Warnings For " . $user . "</h3></center>" . $warningSelect;
 }
Exemplo n.º 27
0
 public function handleForm($context, $action)
 {
     if ($action == "login") {
         $ldapAuthed = LDAPUtil::authLDAPUser($_POST['username'], $_POST['password']);
         if ($ldapAuthed) {
             $user = WebAdUserDao::getWebAdUserByUsername($_POST['username']);
             if ($user != null && $user instanceof WebAdUser) {
                 SessionUtil::setUsername($user->getUsername());
                 $context->setPageID("home");
             } else {
                 $context->addError("Incorrect Login");
             }
         } else {
             $context->addError("Incorrect Login");
         }
     } else {
         $context->addError("Incorrect Action.");
     }
 }
Exemplo n.º 28
0
/**
 * display block
 *
 * @param        array       $blockinfo     a blockinfo structure
 * @return       output      the rendered bock
 */
function FlashChatBridge_Bannerchatblock_display($blockinfo)
{
    if (!SecurityUtil::checkPermission('FlashChatBridge:Bannerchatblock:', "::", ACCESS_READ)) {
        return false;
    }
    if (!pnModAvailable('FlashChatBridge') || !pnUserLoggedIn()) {
        return false;
    }
    $render = pnRender::getInstance('FlashChatBridge', false);
    $UserVars = pnUserGetVars(SessionUtil::getVar('uid'));
    $settings = pnModGetVar('FlashChatBridge');
    $settings['init_user'] = $UserVars['uname'];
    $settings['init_password'] = $UserVars['pass'];
    $settings['width'] = "100%";
    $settings['height'] = "150";
    $render->assign('settings', $settings);
    $blockinfo['content'] = $render->fetch('flashchatbridge_user_chat_banner.htm');
    return pnBlockThemeBlock($blockinfo);
}
Exemplo n.º 29
0
/**
 * Content
 *
 * @copyright (C) 2007-2010, Content Development Team
 * @link http://github.com/zikula-modules/Content
 * @license See license.txt
 */
function smarty_function_contenteditthis($params, $view)
{
    $dom = ZLanguage::getModuleDomain('Content');
    $data = $params['data'];
    $type = $params['type'];
    $access = $params['access'];
    if (!$access['pageEditAllowed']) {
        return '';
    }
    $editmode = SessionUtil::getVar('ContentEditMode');
    $vars = $view->get_template_vars();
    if ($vars['preview']) {
        return '';
    }
    $html = '';
    if ($type == 'page') {
        // Unused ...
        $html = '<div class="content-editthis">';
        $url = DataUtil::formatForDisplay(ModUtil::url('Content', 'admin', 'editPage', array('pid' => $data['id'], 'back' => 1)));
        $translateurl = DataUtil::formatForDisplay(ModUtil::url('Content', 'admin', 'translatePage', array('pid' => $data['id'], 'back' => 1)));
        $html .= "<a href=\"{$url}\">" . __("Edit this page", $dom) . "</a>";
        if ($vars['multilingual'] == 1) {
            $html .= "| <a href=\"{$translateurl}\">" . __("Translate this page", $dom) . "</a>";
        }
        $html .= '</div>';
    } elseif ($type == 'content' && $editmode) {
        $html = '<div class="content-editthis">';
        $url = DataUtil::formatForDisplay(ModUtil::url('Content', 'admin', 'editContent', array('cid' => $data['id'], 'back' => 1)));
        $translateurl = DataUtil::formatForDisplay(ModUtil::url('Content', 'admin', 'translateContent', array('cid' => $data['id'], 'back' => 1)));
        $edittext = __f('Edit this: %1$s [ID%2$s]', array($data['title'], $data['id']), $dom);
        $html .= "<a href=\"{$url}\" title=\"" . __("Click to edit this content item", $dom) . "\">" . $edittext . "</a> ";
        if ($vars['multilingual'] == 1) {
            $html .= "<a href=\"{$translateurl}\">" . __("Translate", $dom) . "</a>";
        }
        $html .= '</div>';
    }
    if (isset($params['assign'])) {
        $smarty->assign($params['assign'], $html);
    } else {
        return $html;
    }
}
Exemplo n.º 30
0
/**
 * Zikula_View block to implement group checks in a template.
 *
 * Available attributes:
 *  - gid (numeric) The ID number of the group to be tested.
 *
 * Example:
 * <pre>
 * {checkgroup gid='1'}
 *   do some stuff now we have permission
 * {/checkgroup}
 * </pre>.
 *
 * @param array       $params  All attributes passed to this function from the template.
 * @param string      $content The content between the block tags.
 * @param Zikula_View $view    Reference to the {@link Zikula_View} object.
 *
 * @return string|boolean|void The content of the matching case.
 *                             If the user is a member of the group specified by the gid,
 *                             then the content contained in the block, otherwise null,
 *                             false on error.
 */
function smarty_block_checkgroup($params, $content, Zikula_View $view)
{
    // check if there is something between the tags
    if (is_null($content)) {
        return;
    }
    // check our input
    if (!isset($params['gid'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_block_checkgroup', 'component')));
        return false;
    }
    $uid = SessionUtil::getVar('uid');
    if (empty($uid)) {
        return;
    }
    if (!ModUtil::apiFunc('Groups', 'user', 'isgroupmember', array('uid' => $uid, 'gid' => $params['gid']))) {
        return;
    }
    return $content;
}