コード例 #1
0
ファイル: deal.php プロジェクト: jechiy/xiu-cms
function add_or_edit_link()
{
    global $smarty, $lang;
    $lin_id = post('lin_id');
    $lin_word = post('lin_word');
    $lin_url = post('lin_url');
    $lin_img = post('lin_img');
    $lin_title = post('lin_title');
    if ($lin_img == 'http://' || $lin_img == '') {
        $lin_img = 'none';
    }
    $obj = new link();
    $obj->set_value('lin_word', $lin_word);
    $obj->set_value('lin_url', $lin_url);
    $obj->set_value('lin_img', $lin_img);
    $obj->set_value('lin_title', $lin_title);
    if ($lin_id != '') {
        $obj->set_where("lin_id = {$lin_id}");
        $obj->edit();
        $info_text = '修改友情链接成功';
    } else {
        $obj->set_value('lin_lang', S_LANG);
        $obj->add();
        $info_text = '添加友情链接成功';
    }
    $smarty->assign('info_text', $info_text);
    $smarty->assign('link_text', $lang['return_list']);
    $smarty->assign('link_href', url(array('channel' => 'service', 'mod' => 'link_list')));
}
コード例 #2
0
ファイル: index.php プロジェクト: playgamelxh/lxh
function createPayQRcode($url, $data)
{
    header("Content-Type: image/png");
    $img = post($url, $data);
    echo $img;
    exit;
}
コード例 #3
0
ファイル: Signup.php プロジェクト: jhenahan/mailchimp-plugin
 public function onSignup()
 {
     $settings = Settings::instance();
     if (!$settings->api_key) {
         throw new ApplicationException('MailChimp API key is not configured.');
     }
     /*
      * Validate input
      */
     $data = post();
     $rules = ['email' => 'required|email|min:2|max:64'];
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         throw new ValidationException($validation);
     }
     /*
      * Sign up to Mailchimp via the API
      */
     require_once plugins_path() . '/rainlab/mailchimp/vendor/MCAPI.class.php';
     $api = new \MCAPI($settings->api_key);
     $this->page['error'] = null;
     $mergeVars = '';
     if (isset($data['merge']) && is_array($data['merge']) && count($data['merge'])) {
         $mergeVars = $data['merge'];
     }
     if ($api->listSubscribe($this->property('list'), post('email'), $mergeVars) !== true) {
         $this->page['error'] = $api->errorMessage;
     }
 }
コード例 #4
0
 public function onUpdate()
 {
     $filter = post('filter');
     $results = $this->getResults($filter);
     $this->page['results'] = $results;
     return ['#activity-stream' => $this->renderPartial('@default')];
 }
コード例 #5
0
 function install()
 {
     //bind password
     $password = post("adminpassword1");
     //create important vars
     $salt = rand(0, 99999);
     $md5_password = md5($salt . $password);
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "user");
     DB::query("CREATE TABLE " . DB_PREFIX . "user(\r\n                user_id int(11) NOT NULL AUTO_INCREMENT,\r\n                name varchar(90) NOT NULL,\r\n                salt int(5) NOT NULL default '0',\r\n                password varchar(32) NOT NULL default '0',\r\n                email varchar(255) NOT NULL,\r\n                last_ip varchar(255) NOT NULL default '127.0.0.1',\r\n                data_login int(15) NULL,\r\n                status int(1) NOT NULL default 1,\r\n                activation_code varchar(40) NULL,\r\n                lang_id varchar(2) NOT NULL default 'EN',\r\n                PRIMARY KEY (user_id)\r\n                ) ENGINE=MyISAM");
     DB::insert(DB_PREFIX . "user", array("name" => post("adminname"), "salt" => "{$salt}", "password" => "{$md5_password}", "email" => post("adminemail", FILTER_SANITIZE_EMAIL), "status" => 3));
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "user_where_is");
     DB::query("CREATE TABLE " . DB_PREFIX . "user_where_is ( \r\n            user_where_is_id int(11) NOT NULL AUTO_INCREMENT,\r\n            user_id int(11) NOT NULL,\r\n            guest_id int(11) NOT NULL,\r\n            ip varchar(20) NOT NULL default '127.0.0.1',\r\n            name varchar(90) NOT NULL,\r\n            sid varchar(32) NOT NULL,\r\n            url varchar(255) NOT NULL,\r\n            id int(11) NOT NULL,\r\n            file varchar(255) NOT NULL,\r\n            os varchar(255) NOT NULL,\r\n            browser varchar(255) NOT NULL,\r\n            time int(15) NOT NULL , \r\n            time_first_click int(15) NOT NULL,\r\n            country_code varchar(2) NOT NULL,\r\n            country_name varchar(90) NOT NULL,\r\n            region_code varchar(15) NOT NULL,\r\n            region_name varchar(255) NOT NULL,\r\n            city_name varchar(255) NOT NULL,\r\n            zip varchar(20) NOT NULL,\r\n            latitude varchar(55) NOT NULL,\r\n            longitude varchar(55) NOT NULL,\r\n            timezone_name varchar(255) NOT NULL,\r\n            gmt_offset varchar(255) NOT NULL,\r\n            PRIMARY KEY (user_where_is_id)\r\n            ) ENGINE=MyISAM");
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "usergroup");
     DB::query("CREATE TABLE " . DB_PREFIX . "usergroup(\r\n            group_id int(11) NOT NULL AUTO_INCREMENT,\r\n            parent_id int(11) NOT NULL,\r\n            name varchar(255) NOT NULL,\r\n            position int(11) NOT NULL,\r\n            nuser int(11) NOT NULL,\r\n            PRIMARY KEY (group_id)\r\n            ) ENGINE=MyISAM");
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "usergroup_user");
     DB::query("CREATE TABLE " . DB_PREFIX . "usergroup_user(\r\n            group_id int(11) NOT NULL,\r\n            user_id int(11) NOT NULL,\r\n            PRIMARY KEY (group_id , user_id)\r\n            ) ENGINE=MyISAM");
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "user_localization");
     DB::query("CREATE TABLE " . DB_PREFIX . "user_localization(\r\n            user_localization_id int(11) NOT NULL AUTO_INCREMENT,\r\n            ip varchar(20) NOT NULL DEFAULT '127.0.0.1',\r\n            sid varchar(32) NOT NULL,\r\n            user_id int(11) NOT NULL,\r\n            guest_id int(11) NOT NULL,\r\n            name varchar(90) NOT NULL,\r\n            url varchar(255) NOT NULL,\r\n            id int(11) NOT NULL,\r\n            file varchar(255) NOT NULL,\r\n            os varchar(255) NOT NULL,\r\n            browser varchar(255) NOT NULL,\r\n            time int(15) NOT NULL,\r\n            time_first_click int(15) NOT NULL,\r\n            country_code varchar(2) NOT NULL,\r\n            country_name varchar(90) NOT NULL,\r\n            region_code varchar(15) NOT NULL,\r\n            region_name varchar(255) NOT NULL,\r\n            city_name varchar(255) NOT NULL,\r\n            zip varchar(20) NOT NULL,\r\n            latitude varchar(55) NOT NULL,\r\n            longitude varchar(55) NOT NULL,\r\n            timezone_name varchar(255) NOT NULL,\r\n            gmt_offset varchar(255) NOT NULL,\r\n            PRIMARY KEY (user_localization_id)\r\n            )");
     $querys = DB::get_executed_query();
     $html_message = '<br /><strong>Install Complete!!!<br /></strong> Please Delete: <br /><strong>' . CONTROLLERS_DIR . 'install
         </strong><br />Please read next steps in the "Install-notes" <br />';
     if ($querys == 11) {
         echo draw_msg($html_message, INFO, true);
     } else {
         echo draw_msg("ERROR", ERROR, true);
     }
 }
コード例 #6
0
ファイル: change_skin.php プロジェクト: adamjdev/Mineskull
function set_skin($username, $password, $skin)
{
    $login_url = "https://minecraft.net/login";
    $skin_url = "https://minecraft.net/profile/skin";
    //first, login to Minecraft.net
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null");
    curl_setopt($ch, CURLOPT_HEADER, true);
    $fields = array("username" => urlencode($username), "password" => urlencode($password));
    post($ch, $fields);
    curl_exec($ch);
    //Then, load the profile page to retrieve authenticityToken
    curl_setopt($ch, CURLOPT_URL, $skin_url);
    $result = curl_exec($ch);
    $token = get_string_between($result, 'name="authenticityToken" value="', '">');
    //finally, post the skin update
    $headers = array("Content-Type:multipart/form-data");
    // cURL headers for file uploading
    $fields = array("model" => "steve", "skin" => "@{$skin}", "authenticityToken" => $token);
    $options = array(CURLOPT_URL => $skin_url, CURLOPT_HEADER => true, CURLOPT_POST => 1, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $fields, CURLOPT_RETURNTRANSFER => true);
    // cURL options
    curl_setopt_array($ch, $options);
    $result = urldecode(curl_exec($ch));
    curl_close($ch);
    if (strlen(strstr($result, "success=Your skin has been changed! It will take a couple of seconds for it to update.")) > 0) {
        return true;
    } else {
        return false;
    }
}
コード例 #7
0
 public function testPostWithinMockedEnvironment()
 {
     $posted = post('some_post_field');
     $this->assertEquals('Bob', $posted);
     $default = post('blah_doesnt_exist', 7777);
     $this->assertEquals(7777, $default);
 }
コード例 #8
0
ファイル: alumni.php プロジェクト: rochimeiji96/hubin
 function aksi($id)
 {
     // Add
     if (post('add')) {
         $data = array('title_posting' => post('title_posting'), 'content_posting' => post('content_posting'), 'date_posting' => date('Y-m-d'));
         $this->db->insert('posting', $data);
         $this->all->setMsg('success', 'Berhasil tambah posting');
         $_POST = '';
     }
     // Edit
     if (post('edit')) {
         $data = array('title_posting' => post('title_posting'), 'content_posting' => post('content_posting'), 'date_posting' => date('Y-m-d'));
         $this->db->where('id_posting', $id);
         $this->db->update('posting', $data);
         $this->all->setMsg('success', 'Berhasil edit posting');
     }
     // Status
     if (post('status')) {
         $this->db->where('id_siswa', post('id'));
         $this->db->update('siswa', array('status' => post('status')));
     }
     // Delete
     if (post('delete')) {
         $this->db->where('id_posting', post('id'));
         $this->db->delete(post('delete'));
     }
 }
コード例 #9
0
 private function _check()
 {
     if (!array_diff(array_keys($args = array_intersect_key(post(), array_flip(func_get_args()))), func_get_args())) {
         return $args;
     }
     throw new Exception(NeoFrag::UNFOUND);
 }
コード例 #10
0
 /**
  * Create a comment
  *
  **/
 function save()
 {
     $out = array();
     // Sanitize
     $serial_number = post('serial_number');
     $section = post('section');
     $text = post('text');
     $html = post('html');
     if ($serial_number and $section and $text) {
         if (authorized_for_serial($serial_number)) {
             $comment = new Comment_model();
             $comment->retrieve_record($serial_number, 'section=?', array($section));
             $comment->serial_number = $serial_number;
             $comment->section = $section;
             $comment->text = $text;
             $comment->html = $html;
             $comment->user = $_SESSION['user'];
             $comment->timestamp = time();
             $comment->save();
             $out['status'] = 'saved';
         } else {
             $out['status'] = 'error';
             $out['msg'] = 'Not authorized for this serial';
         }
     } else {
         $out['status'] = 'error';
         $out['msg'] = 'Missing data';
     }
     $obj = new View();
     $obj->view('json', array('msg' => $out));
 }
コード例 #11
0
ファイル: Option.php プロジェクト: Wilkins/herisson-wordpress
 /**
  * Creates the options admin page and manages the update of options.
  * 
  * This is the default Action
  *
  * @return void
  */
 function indexAction()
 {
     if (post('action') == 'index') {
         $options = get_option('HerissonOptions');
         $new_options = array();
         foreach ($this->allowedoptions as $option) {
             $new_options[$option] = post($option);
         }
         $complete_options = array_merge($options, $new_options);
         if (!array_key_exists('privateKey', $complete_options)) {
             $encryption = Encryption::i()->generateKeyPairs();
             $complete_options['publicKey'] = $encryption->public;
             $complete_options['privateKey'] = $encryption->private;
             Message::i()->addError("<b>Warning</b> : public/private keys have been regenerated");
         }
         update_option('HerissonOptions', $complete_options);
     }
     // Check binaries paths
     $binaryTools = array('convert', 'wget', 'du', 'mv', 'uname');
     sort($binaryTools);
     $this->view->binaries = array();
     foreach ($binaryTools as $binary) {
         $this->view->binaries[$binary] = Shell::getPath($binary);
     }
     $this->view->platform = Shell::shellExec('uname', '-a');
     $this->view->screenshots = WpHerissonScreenshotsTable::getAll();
     $this->view->options = get_option('HerissonOptions');
 }
コード例 #12
0
 public function onSubscribe()
 {
     if (!($user = Auth::getUser())) {
         return;
     }
     $user->subscription(post('subscriptionType'))->withCoupon('code')->create(post('stripeToken'), ['email' => $user->email, 'metadata' => array_only($user->attributes, ['name', 'surname', 'phone', 'company', 'street_addr', 'city', 'zip'])]);
 }
コード例 #13
0
ファイル: Signup.php プロジェクト: aydancoskun/octobercms
 public function onSignup()
 {
     /*
      * Validate input
      */
     $data = ['email' => post('email'), 'first_name' => post('first_name'), 'last_name' => post('last_name')];
     $rules = ['email' => 'required|email|min:2|max:64'];
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         throw new ValidationException($validation);
     }
     try {
         /*
          * Create and add the subscriber
          */
         $isThrottled = $this->checkThrottle();
         if (!$isThrottled) {
             $subscriber = $this->listSubscribe($data);
             $requireConfirmation = !$subscriber->confirmed_at;
         } else {
             $requireConfirmation = null;
         }
         $this->page['error'] = null;
         $this->page['isThrottled'] = $isThrottled;
         $this->page['requireConfirmation'] = $requireConfirmation;
     } catch (Exception $ex) {
         $this->page['error'] = $ex->getMessage();
     }
 }
コード例 #14
0
ファイル: Messages.php プロジェクト: chiiiro/SSP-TwitterApp
 /**
  * Renders form for sending messages.
  * Sends message content to selected user.
  * If message is sent, user is notified.
  */
 public function action()
 {
     checkUnauthorizedAccess();
     $main = new Main();
     $body = new \templates\SendMessage();
     echo $main->setPageTitle("Send Message")->setBody($body);
     if (post('send')) {
         $senderID = UserRepository::getIdByUsername($_SESSION['username']);
         $recipientID = getIdFromURL();
         $content = htmlentities(trim(post('content')));
         //stvaranje poruke
         $message = new Message();
         $message->setSenderID($senderID);
         $message->setRecipientID($recipientID);
         $message->setContent($content);
         $message->setCreated(date('Y-m-d H:i:s'));
         try {
             //slanje poruke
             MessageRepository::sendMessage($message);
             ?>
             <script src="/TwitterApp/assets/js/messageSent.js"></script>
             <?php 
         } catch (\PDOException $e) {
             $e->getMessage();
         }
     }
 }
コード例 #15
0
ファイル: Response.php プロジェクト: openlss/lib-xport
 public static function _get()
 {
     if (!self::$inst) {
         self::$inst = new static(post('request'), post('data'));
     }
     return self::$inst;
 }
コード例 #16
0
ファイル: StoreFilters.php プロジェクト: Agroorama/plugins
 public function onGetfilters()
 {
     $data = post('filters');
     // $result = Product::leftJoin('fotis_reviews_prod_rates', 'tiipiik_catalog_products.id', '=', 'fotis_reviews_prod_rates.product_id');
     if (isset($data)) {
         //     foreach ($data as $object) {
         //         switch ($object['Name']) {
         //             case "FilterPrice":
         //                 $result = $result->where('price', '<=', $object['Value']);
         //                 break;
         //             case "FilterSI":
         //                 if ($object['Value'] == 0) {
         //                     $result = $result->where('index_rating', '=', null);
         //                 }else{
         //                     $result = $result->where('index_rating', '>=', $object['Value']);
         //                 }
         //                 break;
         //             default:
         //         }
         //     }
         //     $this->products = $result->get();
         $this->stores = Store::orderBy('products_number', 'desc')->take(2)->get();
     } else {
         $this->stores = Store::orderBy('products_number', 'asc')->take(2)->get();
         //     $this->products = Product::leftJoin('fotis_reviews_prod_rates', 'tiipiik_catalog_products.id', '=', 'fotis_reviews_prod_rates.product_id')->orderBy('price', 'desc')->get();
     }
 }
コード例 #17
0
ファイル: Director.php プロジェクト: viveleroi/AspenMSM
 /**
  * @abstract Saves page section data to the main section list, unique data to special tables
  * @param unknown_type $id
  * @return unknown
  */
 public function savePageSections($id)
 {
     $sections = array();
     $post = post()->getRawSource();
     if (isset($post['page_sections']) && is_array($post['page_sections'])) {
         // first, wipe all section content so that our saves are new
         foreach ($post['page_sections'] as $section) {
             if (array_key_exists($section['section_type'], $this->sections)) {
                 model()->open('section_' . $section['section_type'])->delete($id, 'page_id');
             }
         }
         // then, loop and save all sections
         foreach ($post['page_sections'] as $val) {
             if (array_key_exists($val['section_type'], $this->sections)) {
                 $section = $this->sections[$val['section_type']];
                 if (isset(app()->{$section['module']}) && method_exists(app()->{$section['module']}, 'saveSection')) {
                     $new_sections = app()->{$section['module']}->saveSection($val, $id);
                     $sections = array_merge($sections, $new_sections);
                 }
             }
         }
     }
     // return an array of section details, for saving in the section list table
     return $sections;
 }
コード例 #18
0
 /**
  * Try to perform a login, perform_login_if_requested will redirect as necessary
  */
 public function requestLogin()
 {
     $logged_out = in('logged_out');
     // Logout page redirected to this one, so display the message.
     $login_error_message = in('error');
     // Error to display after unsuccessful login and redirection.
     $is_logged_in = is_logged_in();
     $pass = post('pass');
     $username_requested = post('user');
     if ($logged_out) {
         logout_user();
         // Perform logout if requested!
     } else {
         if ($username_requested === null || $pass === null) {
             $login_error_message = 'No username or no password specified';
         }
     }
     if (!$login_error_message && !$is_logged_in) {
         $login_error_message = self::perform_login_if_requested($username_requested, $pass);
     }
     if ($login_error_message) {
         return new RedirectResponse('/login.php?error=' . url($login_error_message));
     } else {
         // Successful login, go to the main page
         return new RedirectResponse('/');
     }
 }
コード例 #19
0
ファイル: me.php プロジェクト: stas/facebook-ideas-app
 function add()
 {
     //Load the validation library
     $this->library('validation');
     $this->views['user_id'] = $this->user_id;
     $config = array();
     $config['title'] = 'required|max_length[150]';
     $config['text'] = 'required|max_length[2000]';
     if ($this->validation->run($config) == FALSE) {
         $views['failed'] = true;
         $this->views['content'] = $this->view('me/new_idea', $views);
         return;
     } else {
         $data = array('title' => post('title'), 'message' => post('text'), 'aid' => $this->user_id);
         $this->db->insert_idea($data);
         // Create a stream
         if (in_array('publish_stream', explode(',', $this->facebook->fb_params['ext_perms']))) {
             $message = "I published a new idea: " . post('title') . "!";
             /*
             $action_links = array(
             		      array(
             			'text' => '<fb:publisher-link>Check out Ideas App </fb:publisher-link>',
             			'href' => 'http://apps.facebook.com/'.$this->app_url.'/ideas/newest'
             		));
             */
             $this->facebook->api_client->stream_publish($message);
         }
     }
     $this->views['content'] = $this->view('me/idea_added');
     return TRUE;
 }
コード例 #20
0
ファイル: identity.php プロジェクト: martinkirov/intersango
function handle_uploaded_identity_docs()
{
    global $is_logged_in, $is_admin;
    ?>
    <div class='content_box'>
    <h3>Upload Results</h3>
<?php 
    if ($is_admin && isset($_POST['uid'])) {
        $uid = post('uid');
        if ($uid == '') {
            $uid = $is_logged_in;
        } else {
            get_openid_for_user($uid);
        }
        // will throw exception if user doesn't exist
    } else {
        $uid = $is_logged_in;
    }
    $uploaded = 0;
    for ($i = 0; $i < ID_FILE_UPLOAD_SLOTS; $i++) {
        $uploaded += upload_identity_doc($i, $uid);
    }
    echo "<p>" . _("Documents uploaded") . ": {$uploaded}</p>\n";
    echo "</div>\n";
    if ($uploaded && !$is_admin) {
        email_tech(_("User Uploaded New Identity Documents"), sprintf("%s\n\n%s", sprintf(_("User %s uploaded %s new file(s)."), $is_logged_in, $uploaded), sprintf("%s?page=docs&uid=%s", SITE_URL, $is_logged_in)));
    }
}
コード例 #21
0
 public function sendContactForm()
 {
     $is_mail_sent = false;
     // Get data
     $lastname = post('lastname');
     $firstname = post('firstname');
     $email = post('email');
     $subject = post('subject');
     $message_body = post('message');
     $inputs = ['lastname' => $lastname, 'firstname' => $firstname, 'email' => $email, 'subject' => $subject, 'message' => $message_body];
     $rules = ['lastname' => 'required', 'firstname' => 'required', 'email' => 'required|email', 'subject' => 'required', 'message' => 'required'];
     $messages = ['lastname.required' => 'contactForm.lastname_required', 'firstname.required' => 'contactForm.firstname_required', 'email.required' => 'contactForm.email_required', 'email.email' => 'contactForm.email_invalid', 'subject.required' => 'contactForm.subject_required', 'message.required' => 'contactForm.message_required'];
     // Data Validation
     $validator = Validator::make($inputs, $rules, $messages);
     if ($validator->fails()) {
         $messages = $validator->messages();
         $this->page["inputs"] = $inputs;
         $this->page["messages"] = $messages;
         return;
     }
     $data = compact('firstname', 'lastname', 'email', 'subject', 'message_body');
     $is_mail_sent = Mail::send('algad.bootstrap::mail.contactform.message', $data, function ($message) use($firstname, $lastname, $email) {
         $message->from($email, $firstname . " " . $lastname);
         $message->addReplyTo($email, $lastname . ' ' . $firstname);
         $message->to($this->getProperty('recipient_email'));
     });
     if ($is_mail_sent) {
         $this->page["contact_success_message"] = $this->getProperty('email_sent_confirmation');
     } else {
         $this->page["contact_error_message"] = $this->getProperty('email_sent_failed');
     }
 }
コード例 #22
0
 /**
  * Creates new Ticket and redirects to its page
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \ValidationException
  */
 public function onTicketCreate()
 {
     $data = post();
     $this->helpers->validateTicket($data);
     $creator = \Auth::getUser();
     $ticketPage = Settings::get('address');
     $newStatus = TicketStatus::where('name', 'New')->first()->id;
     $content = $this->purifyTicket($data['content']);
     $ticket = new Ticket();
     $ticket->hash_id = 'temp';
     $ticket->category_id = $data['category'];
     $ticket->creator_id = $creator->id;
     $ticket->email = $creator->email;
     $ticket->website = $data['website'];
     $ticket->topic = $data['topic'];
     $ticket->content = $content;
     $ticket->status = $newStatus;
     $ticket->save();
     $hashId = $this->helpers->generateHashId($ticket->id);
     $ticket->hash_id = $hashId;
     $ticket->save();
     $this->page['hash_id'] = $hashId;
     $this->helpers->newTicketHandler($hashId);
     $mailer = new SupportMailer();
     $address = Settings::get('address');
     $vars = ['ticket_number' => $ticket->hash_id, 'ticket_link' => $address . '/' . $ticket->hash_id];
     $mailer->sendAfterTicketCreated($creator->email, $vars);
     return \Redirect::to($ticketPage . $hashId);
 }
コード例 #23
0
ファイル: Session.php プロジェクト: creativemonday/FbHack
 /**
  * Log out the user
  *
  * Usage:
  *   <a data-request="onLogout">Sign out</a>
  *
  * With the optional redirect parameter:
  *   <a data-request="onLogout" data-request-data="redirect: '/good-bye'">Sign out</a>
  *
  */
 public function onLogout()
 {
     Auth::logout();
     $url = post('redirect', Request::fullUrl());
     Flash::success(Lang::get('rainlab.user::lang.session.logout'));
     return Redirect::to($url);
 }
コード例 #24
0
ファイル: Index.php プロジェクト: chiiiro/SSP-TwitterApp
 /**
  * Function renders main page and implements user login behaviour.
  * If user is already logged in, he will be redirected to his twitter wall.
  * If user doesn't exist or entered data is wrong, warning message will show.
  */
 public function action()
 {
     if (isLoggedIn()) {
         redirect(\route\Route::get("twitterWall")->generate(array("id" => UserRepository::getIdByUsername($_SESSION['username']))));
     }
     $main = new Main();
     $main->setPageTitle("Twitter App");
     $body = new \templates\Index();
     $main->setBody($body);
     echo $main;
     if (UserRepository::isLoggedIn()) {
         redirect(\route\Route::get("twitterWall")->generate());
     }
     if (post('login')) {
         $username = htmlentities(trim(post('username')));
         $password = htmlentities(trim(post('password')));
         $hashedPassword = hash_password($password);
         if (UserRepository::login($username, $hashedPassword)) {
             redirect(\route\Route::get("twitterWall")->generate(array("id" => UserRepository::getIdByUsername($_SESSION['username']))));
             exit;
         } else {
             ?>
             <script src="assets/js/loginError.js"></script>
             <?php 
         }
     }
 }
コード例 #25
0
ファイル: Addtowishlist.php プロジェクト: Agroorama/plugins
 public function onSavetoWishlist()
 {
     $user_email = post('user_email');
     $product_id = post('product_id');
     $product_title = post('product_title');
     $product_image = post('product_image');
     $product_url = post('product_slug');
     $tempdb = DB::table('fotis_wishlist_wishes')->where('user_email', $user_email)->where('product_id', $product_id)->first();
     if ($tempdb) {
         return 'Already';
     } else {
         $wishlist = new Wish();
         $wishlist->user_email = $user_email;
         $wishlist->product_id = $product_id;
         $wishlist->product_title = $product_title;
         $wishlist->product_image = $product_image;
         $wishlist->product_url = $product_url;
         $wishlist->save();
         // return [
         // 'User Mail' => $user_mail,
         // 'Product Id' => $product_id,
         // 'Image' => $image,
         // 'Wishlist' => 'insert'
         // ];
         DB::table('fotis_reviews_prod_rates')->where('product_id', $product_id)->increment('wishlist');
         // new
         return 'Added';
     }
 }
コード例 #26
0
 /**
  * Create a Tag
  *
  **/
 function save()
 {
     $out = array();
     // Sanitize
     $serial_number = post('serial_number');
     $tag = post('tag');
     if ($serial_number and $tag) {
         if (authorized_for_serial($serial_number)) {
             $tagm = new Tag_model();
             $tagm->retrieve_record($serial_number, 'tag=?', array($tag));
             $tagm->serial_number = $serial_number;
             $tagm->tag = $tag;
             $tagm->user = $_SESSION['user'];
             $tagm->timestamp = time();
             $tagm->save();
             $out = $tagm->rs;
         } else {
             $out['status'] = 'error';
             $out['msg'] = 'Not authorized for this serial';
         }
     } else {
         $out['status'] = 'error';
         $out['msg'] = 'Missing data';
     }
     $obj = new View();
     $obj->view('json', array('msg' => $out));
 }
コード例 #27
0
ファイル: heartbeats.php プロジェクト: dennydai/d-bot
function Heartbeats()
{
    $data = post('http://d1.web2.qq.com/channel/poll2', 'r={"ptwebqq":"","clientid":53999199,"psessionid":"","key":""}');
    if ($data == '{"errmsg":"","retcode":0}' . "\n") {
        Heartbeats();
        return;
    }
    $json = json_decode($data, true);
    $poll_type = $json['result'][0]['poll_type'];
    switch ($poll_type) {
        case 'message':
            $_content = $json['result'][0]['value']['content'];
            unset($_content[0]);
            $content = convert_multi_array($_content);
            $from_uin = $json['result'][0]['value']['from_uin'];
            post(ROOT_URL . 'WebQQ.php', json_encode(array('type' => 0, 'uin' => $from_uin, 'msg' => $content)));
            echo json_encode(array('type' => 0, 'uin' => $from_uin, 'msg' => $content));
            Heartbeats();
            break;
        case 'group_message':
            $_content = $json['result'][0]['value']['content'];
            unset($_content[0]);
            $content = convert_multi_array($_content);
            $from_uin = $json['result'][0]['value']['from_uin'];
            post(ROOT_URL . 'WebQQ.php', json_encode(array('type' => 0, 'uin' => $from_uin, 'msg' => $content)));
            echo json_encode(array('type' => 1, 'uin' => $from_uin, 'msg' => $content));
            Heartbeats();
            break;
        default:
            Heartbeats();
            break;
    }
}
コード例 #28
0
ファイル: index.php プロジェクト: EmuxEvans/wot_gateway
 public function responseMsg()
 {
     $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
     if (!empty($postStr)) {
         $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
         $fromUsername = $postObj->FromUserName;
         $toUsername = $postObj->ToUserName;
         //$keyword = trim($postObj->Content);
         $keyword = trim($postObj->EventKey);
         $time = time();
         $textTpl = "<xml>\n                        <ToUserName><![CDATA[%s]]></ToUserName>\n                        <FromUserName><![CDATA[%s]]></FromUserName>\n                        <CreateTime>%s</CreateTime>\n                        <MsgType><![CDATA[%s]]></MsgType>\n                        <Content><![CDATA[%s]]></Content>\n                        <FuncFlag>0</FuncFlag>\n                        </xml>";
         $contentStr = getmapping($keyword);
         if ($contentStr === "ok") {
             post();
         }
         //$url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx250d00817156085c&redirect_uri=http://lixiaopengtest.sinaapp.com/oauth2_openid.php&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
         //$contentStr ="<a href=".$url.">test</a>";
         //$this->deviceStatusSet();
         $msgType = "text";
         //$contentStr = date("Y-m-d H:i:s",time());
         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
         echo $resultStr;
     } else {
         echo "wrong";
         exit;
     }
 }
コード例 #29
0
ファイル: dashboard.php プロジェクト: rochimeiji96/hubin
 function aksi($id)
 {
     if (post('tentang_hubin')) {
         $data['content_hubin'] = post('tentang_hubin');
         $this->db->where('role_hubin', 'about');
         $this->db->update('hubin', $data);
         $this->all->setMsg('success', 'Berhasil Edit Tentang Hubin');
     }
     // Quick Register
     if (post('quick_reg')) {
         $data['config_kode'] = post('config_kode');
         $this->db->where('config_name', 'quick_register');
         $this->db->update('configs', $data);
         $this->all->setMsg('success', 'Berhasil Ubah Kode Quick Register');
     }
     if (post('id') == 'quick_register') {
         $this->db->where('config_name', 'quick_register');
         $this->db->update('configs', array('config_status' => post('status')));
     }
     if (post('change_password')) {
         $id_user = 2;
         $old_pass = $this->db->get_where('user', array('id_user' => $id_user))->row_array();
         if (sha1(post('old_pass')) == $old_pass['pass']) {
             $data = array('pass' => sha1(post('pass')));
             $this->db->where('id_user', $id_user);
             $this->db->update('user', $data);
             $this->all->setMsg('success', 'Berhasil edit password');
         } else {
             $this->all->setMsg('error', 'Old password salah');
         }
     }
 }
コード例 #30
0
ファイル: SendNewPassword.php プロジェクト: pckg/auth
 /**
  * @return mixed
  */
 public function execute()
 {
     $password = auth()->createPassword();
     foreach (config('pckg.auth.providers') as $providerKey => $providerConfig) {
         if (!$providerConfig['forgotPassword']) {
             continue;
         }
         /**
          * Create and set new provider.
          */
         $provider = Reflect::create($providerConfig['type'], [auth()]);
         $provider->setEntity($providerConfig['entity']);
         /**
          * If user doesnt exists, don't proceed with execution.
          */
         if (!($user = $provider->getUserByEmail(post('email')))) {
             continue;
         }
         $user->password = sha1($password . $providerConfig['hash']);
         $user->save();
         /**
          * Send email via queue.
          */
         email('password-update', new User($user), ['data' => ['password' => $password], 'fetch' => ['user' => [$user->getEntityClass() => $user->id]]]);
         return $this->successful();
     }
     return $this->error();
 }