Пример #1
0
/**
 * Function is responsible for setting the current page. this function will
 * use the information provided in the requested string.
 *
 */
function five_request()
{
    //initializing
    global $page;
    $page = 'main';
    $get = BRequest::get('get');
    if ($tmp = BRequest::getVar('page')) {
        $page = $tmp;
    }
}
Пример #2
0
/**
 * Function is responsible for validating a safe file and saving it to the 
 * associated directory, then returning the target path
 * 
 * @param array $fileArray
 * @param string $type
 * @param string $directory
 * @return string
 */
function save_file($fileArray, $type = null, $directory = '')
{
    //reasons to fail
    if (!BRequest::get('files', false) || !is_array($fileArray)) {
        return false;
    }
    if (!file_is_safe($fileArray, $type)) {
        return false;
    }
    //initializing
    $parts = pathinfo($fileArray['name']);
    $original_name = $parts['basename'];
    $target_path = FivePath::clean(strtolower(UPLOADS . DS . $directory . DS . create_guid() . '.' . $parts['extension']));
    if (!move_uploaded_file($fileArray['tmp_name'], $target_path)) {
        return false;
    }
    //success
    return str_replace(ABSPATH, '', $target_path);
}
Пример #3
0
<?php

/**
 * @Author	Jonathon byrd
 * @link http://www.5twentystudios.com
 * @Package Five Twenty CMS
 * @SubPackage PublicMarketSpace
 * @Since 1.0.0
 * @copyright  Copyright (C) 2011 5Twenty Studios
 * 
 */
defined('ABSPATH') or die("Cannot access pages directly.");
if (BRequest::get('post', false)) {
    do_action('authenticate', BRequest::getVar('username'), BRequest::getVar('passwd'), BRequest::getVar('remember'));
}
//redirect if successful
if (is_user_logged_in()) {
    redirect(Router::url(array('controller' => 'user', 'action' => 'profile')));
}
require $view;
 * @SubPackage PublicMarketSpace
 * @Since 1.0.0
 * @copyright  Copyright (C) 2011 5Twenty Studios
 * 
 */
defined('ABSPATH') or die("Cannot access pages directly.");
//redirect if successful
if (!is_user_logged_in()) {
    redirect(Router::url(array('controller' => 'user', 'action' => 'login')));
}
// initializing
$business = FiveTable::getInstance('business');
$business->loadByUserID(get_current_user_id());
$transaction = FiveTable::getInstance('transaction');
$has = true;
if ($post = BRequest::get('post', false)) {
    if (!BRequest::getVar('agree', false)) {
        set_error('Please make sure that you agree with the Terms of Use.');
        $has = false;
    }
    if (!$business->save($post)) {
        set_error($business->getErrors());
        $has = false;
    }
    if (!$transaction->bind($post, array(), false)) {
        set_error($transaction->getErrors());
        $has = false;
    } elseif (!$transaction->save($post)) {
        set_error($transaction->getErrors());
        $has = false;
    }
Пример #5
0
 /**
  * Save the User Profile
  * 
  * This function is responsible for saving the user fields upon post. SO
  * LONG AS, the user is already logged in. This does not create a new user.
  * 
  * @return boolean
  * @since 1.2
  */
 function save_user_profile()
 {
     //initializing variables
     $user =& get_user(BRequest::getVar('user_id'));
     //reasons to fail
     //handling any required actions
     if (!is_user_logged_in()) {
         return false;
     }
     if (BRequest::getVar('action', false) != 'edit') {
         return false;
     }
     if (!wp_verify_nonce(BRequest::getVar("user_meta_box_nonce"), basename(__FILE__))) {
         return false;
     }
     //initializing variables
     $data = BRequest::get('post');
     $data['ID'] = $user->ID;
     //loading libraries
     require_once ABSPATH . WPINC . DS . 'registration.php';
     //doing all the saves
     if (!save_useremail()) {
         $data['user_email'] = $user->user_email;
     }
     if (wp_insert_user($data) && save_userpw($data['pass1'], $data['pass2']) && save_user_meta_data($data['ID'])) {
         set_notification('Profile has been updated');
     }
     return true;
 }