Пример #1
0
 public function send($message, $list)
 {
     $webRequest = new WebRequest();
     $params = array("profileId" => $this->profileId, "user" => $this->user, "pwd" => $this->pwd, "senderId" => $this->senderId, "mobileno" => implode(",", $list), "msgtext" => "this is a test message");
     $result = $webRequest->get("http://bulksmsindia.mobi/sendurlcomma.aspx?", $params);
     return $result;
 }
Пример #2
0
 public static function getErrorDisplay($arguments)
 {
     $smarty = $arguments[1];
     $error = WebRequest::get("lgerror") or "";
     $smarty->assign("lgerror", $error);
     return true;
 }
 protected function runPage()
 {
     if (WebRequest::get("showall") === "yes") {
         $phpinfo_parts = INFO_ALL;
         $linktarget = "?showall=no";
     } else {
         $phpinfo_parts = INFO_VARIABLES;
         $linktarget = "?showall=yes";
     }
     ob_clean();
     phpinfo($phpinfo_parts);
     $pinfo = ob_get_contents();
     ob_clean();
     if (WebRequest::get("showall") === "yes") {
         $pinfo1 = explode("<table", $pinfo, 2);
         $pinfo = "<table" . $pinfo1[1];
         $pinfo1 = explode("<h2>PHP License</h2>", $pinfo);
         $pinfo = $pinfo1[0];
     } else {
         $pinfo1 = explode("<h2>", $pinfo);
         $pinfo = "<h2>" . $pinfo1[1];
         $pinfo1 = explode("<br />", $pinfo);
         $pinfo = $pinfo1[0];
     }
     $pinfo = str_replace('class="e"', 'style="background-color: #ccccff; font-weight: bold; color: #000000;border: 1px solid #000000; font-size: 75%; vertical-align: baseline;"', $pinfo);
     $pinfo = str_replace('class="v"', 'style="background-color: #cccccc; color: #000000;border: 1px solid #000000; font-size: 75%; vertical-align: baseline;"', $pinfo);
     $pinfo = str_replace('<table ', '<table style="border-collapse: collapse;font-family: sans-serif;" ', $pinfo);
     $this->mSmarty->assign("content", "<a href=\"{$linktarget}\">Toggle all/variables</a>" . $pinfo);
 }
 protected function runPage()
 {
     $action = WebRequest::get("action");
     switch ($action) {
         case "view":
             self::checkAccess("view-bill");
             $this->showViewBillPage();
             break;
         case "edit":
             self::checkAccess("edit-bill");
             $this->showEditBillItemPage();
             break;
         case "add":
             self::checkAccess("append-bill");
             $this->showAddBillItemPage();
             break;
         case "pay":
             self::checkAccess("pay-bill");
             $this->doPayBillAction();
             break;
         case "del":
             self::checkAccess("remove-bill-item");
             $this->doRemoveBillItemAction();
             break;
     }
 }
 protected function runPage()
 {
     $this->mSubMenu = array("MPageSystemUserList" => array("title" => "mpage-user-list", "link" => "/SystemUsers?action=list"), "MPageCreateUser" => array("title" => "mpage-user-create", "link" => "/SystemUsers?action=create"));
     $action = WebRequest::get("action");
     switch ($action) {
         case "changepw":
             self::checkAccess("edit-systemuser-password");
             $this->showChangePasswordPage();
             break;
         case "del":
             self::checkAccess("delete-systemuser");
             $this->doDeleteUserAction();
             break;
         case "create":
             self::checkAccess("create-systemuser");
             $this->showCreateUserPage();
             break;
         case "changeaccess":
             self::checkAccess("edit-systemuser-access");
             $this->showChangeAccessPage();
             break;
         case "list":
         default:
             $this->showListUserPage();
             break;
     }
 }
 protected function runPage()
 {
     $this->mSubMenu = array("MPageCustomersList" => array("title" => "mpage-customers-list", "link" => "/Customers?action=list"), "MPageCustomersCreate" => array("title" => "mpage-customers-create", "link" => "/Customers?action=create"));
     $action = WebRequest::get("action");
     switch ($action) {
         case "del":
             self::checkAccess("delete-customer");
             $this->doDeleteCustomerAction();
             break;
         case "rsconfirm":
             $this->doResendCustomerAction();
             break;
         case "edit":
             self::checkAccess("edit-customer");
             $this->showEditCustomerPage();
             break;
         case "create":
             self::checkAccess("create-customer");
             $this->showCreateCustomerPage();
             break;
         case "list":
         default:
             $this->showListCustomerPage();
             break;
     }
 }
 protected function runPage()
 {
     global $cWebPath;
     $this->mStyles[] = $cWebPath . '/style/jsDatePick_ltr.min.css';
     $this->mScripts[] = $cWebPath . '/scripts/jsDatePick.full.1.3.js';
     $this->mSubMenu = array("MPageBookingsList" => array("title" => "mpage-bookings-list", "link" => "/Bookings?action=list"), "MPageBookingsCreate" => array("title" => "mpage-bookings-create", "link" => "/Bookings?action=create"));
     $action = WebRequest::get("action");
     switch ($action) {
         case "del":
             self::checkAccess("delete-booking");
             $this->doDeleteBookingAction();
             break;
         case "edit":
             self::checkAccess("edit-booking");
             $this->showEditBookingPage();
             break;
         case "create":
             self::checkAccess("create-booking");
             $this->showCreateBookingPage();
             break;
         case "list":
         default:
             $this->showListBookingsPage();
             break;
     }
 }
 protected function runPage()
 {
     try {
         $id = WebRequest::getInt("id");
         $hash = WebRequest::get("hash");
         // data validation
         $customer = Customer::getById($id);
         if ($customer == null) {
             throw new NonexistantObjectException();
         }
         $customer->confirmEmail($hash);
         // save
         $customer->save();
         Session::setLoggedInCustomer($id);
         $this->mSmarty->assign("content", Message::getMessage("mail-confirmed"));
     } catch (NonexistantObjectException $ex) {
         global $cScriptPath;
         $this->mHeaders[] = "Location: {$cScriptPath}";
     }
 }
Пример #9
0
 protected function runPage()
 {
     $this->mSubMenu = array("MPageRoomsList" => array("title" => "mpage-rooms-list", "link" => "/Rooms?action=list"), "MPageRoomsCreate" => array("title" => "mpage-rooms-create", "link" => "/Rooms?action=create"));
     $action = WebRequest::get("action");
     switch ($action) {
         case "del":
             self::checkAccess("delete-room");
             $this->doDeleteRoomAction();
             break;
         case "edit":
             self::checkAccess("edit-room");
             $this->showEditRoomPage();
             break;
         case "create":
             self::checkAccess("create-room");
             $this->showCreateRoomPage();
             break;
         case "list":
         default:
             $this->showListRoomPage();
             break;
     }
 }
 protected function runPage()
 {
     if (Session::isCustomerLoggedIn()) {
         global $cWebPath;
         // redirect to main page
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
         return;
     }
     if (WebRequest::wasPosted()) {
         if (WebRequest::get("id") && WebRequest::get("hash")) {
             // setting password
             $id = WebRequest::get("id");
             $hash = WebRequest::get("hash");
             $customer = Customer::getById($id);
             try {
                 if ($customer->getMailChecksum() != $hash) {
                     throw new InvalidChecksumException();
                 }
                 $suPassword = WebRequest::post("suPassword");
                 $suConfirm = WebRequest::post("suConfirm");
                 // validation
                 if ($suPassword == "") {
                     throw new CreateCustomerException("Password not specified");
                 }
                 if ($suConfirm == "") {
                     throw new CreateCustomerException("Confirmed password not specified");
                 }
                 if ($suPassword != $suConfirm) {
                     throw new CreateCustomerException("Password mismatch");
                 }
                 // validation
                 if ($suPassword != "" && $suPassword == $suConfirm) {
                     $customer->setPassword($suPassword);
                 }
                 $customer->save();
                 // log them in
                 Session::setLoggedInCustomer($id);
                 // redirect to main page
                 global $cWebPath;
                 $this->mHeaders[] = "HTTP/1.1 303 See Other";
                 $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
             } catch (CreateCustomerException $ex) {
                 $this->mBasePage = "changePassword.tpl";
                 $this->error($ex->getMessage());
             } catch (InvalidChecksumException $ex) {
                 $this->mBasePage = "changePassword.tpl";
                 $this->error($ex->getMessage());
             }
         } else {
             // requesting
             try {
                 $suEmail = WebRequest::post("suEmail");
                 // validation
                 if ($suEmail == "") {
                     throw new CreateCustomerException("Email not specified");
                 }
                 $customer = Customer::getByEmail($suEmail);
                 if ($customer == null) {
                     throw new NonexistantObjectException();
                 }
                 $customer->sendPasswordReset();
                 $this->mBasePage = "forgotpassword.tpl";
                 // TODO: show some confirmation, check email, etc
             } catch (CreateCustomerException $ex) {
                 $this->mBasePage = "forgottenpassword.tpl";
                 $this->error($ex->getMessage());
             } catch (NonexistantObjectException $ex) {
                 $this->mBasePage = "forgottenpassword.tpl";
                 $this->error("nonexistant object");
             }
         }
     } else {
         if (WebRequest::get("id") && WebRequest::get("hash")) {
             // show reset password form
             try {
                 $id = WebRequest::get("id");
                 $hash = WebRequest::get("hash");
                 $customer = Customer::getById($id);
                 if ($customer->getMailChecksum() != $hash) {
                     throw new InvalidChecksumException();
                 }
                 $this->mBasePage = "changePassword.tpl";
                 $this->mSmarty->assign("cpid", $id);
                 $this->mSmarty->assign("cphash", $hash);
             } catch (InvalidChecksumException $ex) {
                 $this->mBasePage = "forgottenpassword.tpl";
                 $this->error("invalid checksum");
             }
         } else {
             // show request form
             $this->mBasePage = "forgottenpassword.tpl";
             return;
         }
     }
 }
Пример #11
0
 public static function getActiveLanguage()
 {
     global $cAvailableLanguages;
     // look in the order of most volatile first - if we find something, use it.
     // request cache
     if (self::$requestLanguage != "") {
         return self::$requestLanguage;
     }
     // get parameter
     $getParam = WebRequest::get("lang");
     if ($getParam != false) {
         // check value is in list of allowed values
         if (array_key_exists($getParam, $cAvailableLanguages)) {
             // save local cache for other messages this request
             self::$requestLanguage = $getParam;
             // set a cookie to persist that option for this session (do we want
             // this option to set the preferences too?)
             WebRequest::setCookie("lang", $getParam);
             // use this value.
             return $getParam;
         }
     }
     // cookie
     $cookie = WebRequest::getCookie("lang");
     if ($cookie != false) {
         // check value is in list of allowed values
         if (array_key_exists($cookie, $cAvailableLanguages)) {
             // save local cache for other messages this request
             self::$requestLanguage = $cookie;
             // use this value.
             return $cookie;
         }
     }
     // user preference
     // site default
     return "en-GB";
 }
Пример #12
0
 /**
  * @covers ByJG\Util\WebRequest::curlInit
  */
 public function testCurlException()
 {
     $this->object = new WebRequest('http://laloiuyakkkall.iiiuqq/');
     $this->setExpectedException('\\ByJG\\Util\\CurlException');
     $this->object->get();
 }
 protected function runPage()
 {
     // try to get more access than we may have.
     try {
         self::checkAccess('edit-language-messages');
         $this->mSmarty->assign("readonly", '');
     } catch (AccessDeniedException $ex) {
         // caution: if you're copying this, this is a hack to make sure
         //			users know they don't have the access to do this, not
         // 			to actually stop them from doing it, though it will have
         // 			that effect to the non-tech-savvy.
         $this->mSmarty->assign("readonly", 'disabled="disabled"');
     }
     global $cWebPath;
     $this->mStyles[] = $cWebPath . "/style/pager.css";
     if (WebRequest::wasPosted()) {
         self::checkAccess("edit-language-messages");
         $this->save();
         global $cWebPath;
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/management.php/Languages";
         return;
     }
     $this->mBasePage = "mgmt/lang.tpl";
     $keys = array();
     $filterUnset = false;
     if (WebRequest::get("showall")) {
         if (WebRequest::get("showall") == "unset") {
             $filterUnset = true;
         }
         $keys = Message::getMessageKeys();
     } else {
         if (WebRequest::get("prefix")) {
             $keys = Message::getMessageKeys();
             $keys = array_filter($keys, function ($value) {
                 $prefix = WebRequest::get("prefix");
                 return substr($value, 0, strlen($prefix)) == $prefix;
             });
         }
     }
     if (count($keys) > 0) {
         $this->mSmarty->assign("showtable", 1);
         global $cAvailableLanguages;
         // retrieve the message table as an array (of message keys) of arrays
         // (of languages) of arrays (of id/current content)
         $messagetable = array();
         foreach ($keys as $mkey) {
             $completelySet = true;
             $messagetable[$mkey] = array();
             foreach ($cAvailableLanguages as $lang => $langname) {
                 $message = Message::getByName($mkey, $lang);
                 if ($message->getContent() == "&lt;{$lang}:{$mkey}&gt;") {
                     if ($lang == Message::getActiveLanguage()) {
                         $completelySet = false;
                     }
                 }
                 $messagetable[$mkey][$lang] = array("id" => $message->getId(), "content" => $message->getContent());
             }
             if ($filterUnset && $completelySet) {
                 unset($messagetable[$mkey]);
             }
         }
         $this->mSmarty->assign("languagetable", $messagetable);
         $this->mSmarty->assign("languages", $cAvailableLanguages);
     } else {
         $this->mSmarty->assign("showtable", 0);
     }
 }