public function updateTime($id, $requestData)
 {
     $task = Tasks::findOrFail($id);
     $input = array_replace($requestData->all(), ['fk_task_id' => "{$task->id}"]);
     TaskTime::create($input);
     $activityinput = array_merge(['text' => Auth()->user()->name . ' Inserted a new time for this task', 'user_id' => Auth()->id(), 'type' => 'task', 'type_id' => $id]);
     Activity::create($activityinput);
 }
 /**
  * Store a newly review to user
  *
  * @param ReviewRequest $request
  * @return Response
  */
 public function postReview($username, ReviewRequest $request)
 {
     $input = array_add($request->all(), 'author_id', Auth()->user()->id);
     $user = $this->userRepository->findByUsername($username);
     $review = new Review();
     $review->storeReviewForUser($user->id, $input['author_id'], $input['comment'], $input['rating']);
     return Redirect()->route('profile_reviews', $user->username);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     //$articles = Article::latest('published_at')->where('published_at', '<=', Carbon::now())->get();
     $articles = Auth()->user();
     /*      $article = $articles->first();
             $article->title = 'Updated title';
             $article->save();*/
     return view('blog.blogPage');
 }
 public function updateAssign($id, $requestData)
 {
     $lead = Leads::findOrFail($id);
     $input = $requestData->get('fk_user_id_assign');
     $input = array_replace($requestData->all());
     $lead->fill($input)->save();
     $insertedName = $lead->assignee->name;
     $activityinput = array_merge(['text' => auth()->user()->name . ' assigned lead to ' . $insertedName, 'user_id' => Auth()->id(), 'type' => 'lead', 'type_id' => $id]);
     Activity::create($activityinput);
 }
Example #5
0
function AuthComment($type)
{
    $getsession = Auth($type);
    if (!empty($getsession)) {
        return $getsession;
    } else {
        $key = 'comment_author_' . $type;
        $getcookie = isset($_COOKIE[COOKIE_PRE . $key]) ? $_COOKIE[COOKIE_PRE . $key] : '';
        return $getcookie;
    }
}
Example #6
0
 /**
  * Handle the event.
  *
  * @param  ClientAction  $event
  * @return void
  */
 public function handle(ClientAction $event)
 {
     $client = $event->getClient();
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.client.created', ['company' => $client->company_name, 'assignee' => $client->AssignedUser->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Client::class, 'type_id' => $client->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $lead = Leads::findOrFail($request->id);
     $settings = Settings::all();
     $isAdmin = Auth()->user()->hasRole('administrator');
     $settingscomplete = $settings[0]['lead_assign_allowed'];
     if ($isAdmin) {
         return $next($request);
     }
     if ($settingscomplete == 1 && Auth()->user()->id == $lead->fk_user_id_assign) {
         Session()->flash('flash_message_warning', 'Not allowed to create lead');
         return redirect()->back();
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $task = Tasks::findOrFail($request->id);
     $settings = Settings::all();
     $isAdmin = Auth()->user()->hasRole('administrator');
     $settingscomplete = $settings[0]['task_assign_allowed'];
     if ($isAdmin) {
         return $next($request);
     }
     if ($settingscomplete == 1 && Auth()->user()->id != $task->fk_user_id_assign) {
         Session()->flash('flash_message_warning', 'Only assigned user are allowed to do this');
         return redirect()->back();
     }
     return $next($request);
 }
Example #9
0
function Authenticate($client)
{
    if (isset($_SESSION['service_token'])) {
        $token = $_SESSION['service_token'];
        if ($client->getAuth()->isAccessTokenExpired()) {
            $token = Auth($client);
            $_SESSION['service_token'] = $token;
        } else {
            $client->setAccessToken($_SESSION['service_token']);
        }
    } else {
        $token = Auth($client);
        $_SESSION['service_token'] = $token;
    }
    return $token;
}
Example #10
0
 public function store()
 {
     $validator = Validator::make(Input::all(), ['nameaccount' => 'required|min:6', 'numberaccount' => 'required|min:27|max:34']);
     if ($validator->passes()) {
         //            $wallet = UserDeposit::where('user_id','=',Auth()->user()->getAuthIdentifier())->first();
         $nameAccount = Input::get('nameaccount');
         $numberAccount = Input::get('numberaccount');
         if ($wallet = BitcoinAccount::create(array('user_id' => Auth()->user()->getAuthIdentifier(), 'name' => $nameAccount, 'number_account' => $numberAccount, 'status' => 'pending', 'balance_in' => 0, 'balance_out' => 0))) {
             //si se guardo la informacion ahoa si muevo el archivo
             return redirect()->route('wallets.index');
         } else {
             return redirect()->route('wallets.index')->withErrors($validator);
         }
     } else {
         return redirect()->route('wallets.index')->withErrors($validator);
     }
 }
Example #11
0
 public function create()
 {
     //获取所有分类
     $getCate = Cate::all();
     $cates = array();
     foreach ($getCate as $k => $v) {
         $cates[$v->id] = $v->name;
     }
     $teams = array();
     $teams[0] = '非团队博文';
     $teamMembers = TeamMember::where('user_id', \Auth()->user()->id)->get();
     foreach ($teamMembers as $teamMember) {
         $team = Team::findOrFail($teamMember->team_id);
         $teams[$team->id] = $team->title;
     }
     return view('member.articles.create', compact('cates', 'teams'));
 }
 public static function ArticlesForSites()
 {
     $args = json_decode(UrlVar('json', '{}'));
     $sites = array();
     if (is_array($args->sites)) {
         foreach ($args->sites as $id) {
             $site = MapController::LoadMapItem((int) $id);
             if (Auth('read', $site, 'mapitem')) {
                 $sites[] = array_merge(array('id' => $site->getId(), 'name' => $site->getName()), self::ItemMetadata($site));
             } else {
                 echo json_encode(array('success' => false, 'message' => 'invalid id:' . $id . ' in list, or no access'), JSON_PRETTY_PRINT);
                 return;
             }
         }
     }
     echo json_encode(array('sites' => $sites, 'success' => true), JSON_PRETTY_PRINT);
 }
 /**
  * Get the array representation of the notification.
  *
  * @param  mixed  $notifiable
  * @return array
  */
 public function toArray($notifiable)
 {
     switch ($this->action) {
         case 'created':
             $text = lang::get('misc.notifications.task.created', ['title' => $this->task->title, 'creator' => $this->task->taskCreator->name]);
             break;
         case 'updated_status':
             $text = lang::get('misc.notifications.task.status', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
             break;
         case 'updated_time':
             $text = lang::get('misc.notifications.task.time', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = lang::get('misc.notifications.task.assign', ['title' => $this->task->title, 'username' => Auth()->user()->name]);
             break;
         default:
             break;
     }
     return ['assigned_user' => $notifiable->id, 'created_user' => $this->task->fk_user_id_created, 'message' => $text, 'type' => Tasks::class, 'type_id' => $this->task->id, 'url' => url('tasks/' . $this->task->id), 'action' => $this->action];
 }
Example #14
0
 function __construct()
 {
     $pagine_repo = new PagineRepo();
     $contenuti_footer = $pagine_repo->getContentForPage('index');
     view()->share('contenuti_footer', $contenuti_footer);
     view()->share('user', \Auth()->user());
     if (\Auth::user()) {
         view()->share('user_role', array_pluck(\Auth::user()->roles()->get(), 'name')[0]);
     }
     view()->share('menu', MenuItems::all()->keyBy('slug'));
     if (Session::has('locale')) {
         $locale = Session::get('locale');
     } else {
         $locale = 'it';
     }
     \App::setLocale($locale);
     Session::put('locale', $locale);
     // dd(\App::getLocale($locale));
     view()->share('text', Config::get('traduzioni.' . $locale));
     Session::put('currentPage', '');
 }
Example #15
0
 /**
  * Handle the event.
  *
  * @param  TaskAction  $event
  * @return void
  */
 public function handle(TaskAction $event)
 {
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.task.created', ['title' => $event->getTask()->title, 'creator' => $event->getTask()->taskCreator->name, 'assignee' => $event->getTask()->assignee->name]);
             break;
         case 'updated_status':
             $text = Lang::get('misc.log.task.status', ['username' => Auth()->user()->name]);
             break;
         case 'updated_time':
             $text = Lang::get('misc.log.task.time', ['username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = Lang::get('misc.log.task.assign', ['username' => Auth()->user()->name, 'assignee' => $event->getTask()->assignee->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Tasks::class, 'type_id' => $event->getTask()->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
Example #16
0
 /**
  * Handle the event.
  *
  * @param  LeadAction  $event
  * @return void
  */
 public function handle(LeadAction $event)
 {
     switch ($event->getAction()) {
         case 'created':
             $text = Lang::get('misc.log.lead.created', ['title' => $event->getLead()->title, 'creator' => $event->getLead()->createdBy->name, 'assignee' => $event->getLead()->assignee->name]);
             break;
         case 'updated_status':
             $text = Lang::get('misc.log.lead.status', ['username' => Auth()->user()->name]);
             break;
         case 'updated_deadline':
             $text = Lang::get('misc.log.lead.deadline', ['username' => Auth()->user()->name]);
             break;
         case 'updated_assign':
             $text = Lang::get('misc.log.lead.assign', ['username' => Auth()->user()->name, 'assignee' => $event->getLead()->assignee->name]);
             break;
         default:
             break;
     }
     $activityinput = array_merge(['text' => $text, 'user_id' => Auth()->id(), 'type' => Leads::class, 'type_id' => $event->getLead()->id, 'action' => $event->getAction()]);
     Activity::create($activityinput);
 }
Example #17
0
<?php

include __DIR__ . '/common.php';
require __DIR__ . '/language/' . ForumLanguage . '/new.php';
Auth(1, 0, true);
$Error = '';
$Title = '';
$Content = '';
$TagsArray = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    SetStyle('api', 'API');
    if (!ReferCheck($_POST['FormHash'])) {
        AlertMsg($Lang['Error_Unknown_Referer'], $Lang['Error_Unknown_Referer'], 403);
    }
    if ($TimeStamp - $CurUserInfo['LastPostTime'] <= 5) {
        //发帖至少要间隔5秒
        AlertMsg($Lang['Posting_Too_Often'], $Lang['Posting_Too_Often']);
    }
    $Title = Request('Post', 'Title');
    $Content = Request('Post', 'Content');
    $TagsArray = $_POST['Tag'];
    if ($Title) {
        if (strlen($Title) <= $Config['MaxTitleChars'] || strlen($Content) <= $Config['MaxPostChars']) {
            if (!empty($TagsArray) && !in_array('', $TagsArray) && count($TagsArray) <= $Config["MaxTagsNum"]) {
                //获取已存在的标签
                $TagsExistArray = $DB->query("SELECT ID,Name FROM `" . $Prefix . "tags` WHERE `Name` in (?)", $TagsArray);
                $TagsExist = ArrayColumn($TagsExistArray, 'Name');
                $TagsID = ArrayColumn($TagsExistArray, 'ID');
                //var_dump($TagsExist);
                $NewTags = TagsDiff($TagsArray, $TagsExist);
                //新建不存在的标签
Example #18
0
             }
         }
         $TagsLists1 = $DB->column("SELECT Name FROM " . $Prefix . "tags Where Name IN (?)", $SQLParameters);
         $TagsLists2 = $DB->column("SELECT Title FROM " . $Prefix . "dict Where Title IN (?) Group By Title", $SQLParameters);
         //$TagsLists2 = array();
         $TagsLists = array_merge($TagsLists1, array_diff($TagsLists2, $TagsLists1));
         if ($TagsLists) {
             $tags['status'] = 1;
             rsort($TagsLists);
             $tags['lists'] = $TagsLists;
         }
     }
     echo json_encode($tags);
     break;
 case 'tag_autocomplete':
     Auth(1);
     $Keyword = $_POST['query'];
     $Response = array();
     $Response['query'] = 'Unit';
     $Result = $DB->column("SELECT Title FROM " . $Prefix . "dict WHERE Title LIKE :Keyword limit 10", array("Keyword" => $Keyword . "%"));
     if ($Result) {
         foreach ($Result as $key => $val) {
             $Response['suggestions'][] = array('value' => $val, 'data' => $val);
         }
     }
     echo json_encode($Response);
     break;
 case 'check_username':
     break;
 case 'get_post':
     $PostId = intval($_POST['PostId']);
 public function edit(Request $request)
 {
     \DB::beginTransaction();
     //var_dump($request->all()); die();
     $oProd = Product::find($request->input('product_id'));
     //si viene el prod y ademas es prod con variantes
     if (!empty($oProd) && $oProd->hasVariants == 1) {
         $variant = $this->variantRepo->findV($request->input('id'));
         if ($request->input('autogenerado') === true) {
             $sku = \DB::table('variants')->max('sku');
             if (!empty($sku)) {
                 $sku = $sku + 1;
             } else {
                 $sku = 1000;
                 //inicializar el sku;
             }
             $request->merge(array('sku' => $sku));
         } else {
         }
         $request->merge(array('user_id' => Auth()->user()->id));
         $managerVar = new VariantManager($variant, $request->except('stock', 'detAtr', 'presentation_base_object', 'presentations'));
         $managerVar->save();
         $oProd->quantVar = $oProd->quantVar + 1;
         $oProd->save();
         //================================ VARIANTES==============================//
         //$variant->presentation()->detach();
         foreach ($request->input('presentations') as $presentation) {
             $presentation['variant_id'] = $variant->id;
             $presentation['presentation_id'] = $presentation['id'];
             $oPres = new DetPresRepo();
             //$oStock = $stockRepo->getModel()->where('variant_id',$stock['variant_id'])->where('warehouse_id',$stock['warehouse_id'])->first();
             $obj = $oPres->getModel()->where('variant_id', $presentation['variant_id'])->where('presentation_id', $presentation['presentation_id'])->first();
             if (!isset($obj->id)) {
                 $presManager = new DetPresManager($oPres->getModel(), $presentation);
                 $presManager->save();
             } else {
                 $presManager = new DetPresManager($obj, $presentation);
                 $presManager->save();
             }
             //$presManager = new DetPresManager($oPres->getModel(),$presentation);
             //$presManager->save();
         }
         $variant->atributes()->detach();
         foreach ($request->input('detAtr') as $detAtr) {
             if (!empty($detAtr['descripcion'])) {
                 $detAtr['variant_id'] = $variant->id;
                 $oDetAtr = new DetAtrRepo();
                 $detAtrManager = new DetAtrManager($oDetAtr->getModel(), $detAtr);
                 $detAtrManager->save();
             }
         }
         if ($request->input('track') == 1) {
             //if (empty($variant->warehouse())) {
             //var_dump( $variant->stock ); die();
             //$variant->warehouse()->detach();
             foreach ($request->input('stock') as $stock) {
                 if (isset($stock['stockActual']) && $stock['stockActual'] == null && $stock['stockActual'] == '') {
                     $stock['stockActual'] = 0;
                 }
                 if (isset($stock['stockMin']) && $stock['stockMin'] == null && $stock['stockMin'] == '') {
                     $stock['stockMin'] = 0;
                 }
                 if (isset($stock['stockMinSoles']) && $stock['stockMinSoles'] == null && $stock['stockMinSoles'] == '') {
                     $stock['stockMinSoles'] = 0;
                 }
                 $stock['variant_id'] = $variant->id;
                 $oStock = new StockRepo();
                 //var_dump($stock['variant_id']);
                 //var_dump($stock['warehouse_id']);
                 $obj = $oStock->getModel()->where('variant_id', $stock['variant_id'])->where('warehouse_id', $stock['warehouse_id'])->first();
                 if (!isset($obj->id)) {
                     $stockManager = new StockManager($oStock->getModel(), $stock);
                     $stockManager->save();
                 } else {
                     $stockManager = new StockManager($obj, $stock);
                     $stockManager->save();
                 }
                 //print_r($obj->id); die();
             }
             //}
         }
         \DB::commit();
         return response()->json(['estado' => true, 'nombres' => $variant->nombre]);
     } else {
         return response()->json(['estado' => 'Prod sin variantes']);
     }
     //================================./VARIANTES==============================//
 }
Example #20
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/getWebAuth.php";
use Dropbox as dbx;
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
session_start();
//var_dump($_GET);
function Auth()
{
    list($accessToken, $userId, $urlState) = getWebAuth()->finish($_GET);
    assert($urlState === null);
    // Since we didn't pass anything in start()
    $_SESSION['accessToken'] = $accessToken;
    $start = 'http://localhost:8888/';
    header("Location: {$start}");
    return $accessToken;
}
Auth();
Example #21
0
<?php

include dirname(__FILE__) . '/common.php';
require dirname(__FILE__) . '/language/' . ForumLanguage . '/dashboard.php';
Auth(5);
$BasicMessage = '';
$PageMessage = '';
$AdvancedMessage = '';
$OauthMessage = '';
$CacheMessage = '';
$Action = Request('Post', 'Action', false);
$OauthData = json_decode($Config['CacheOauth'], true);
$OauthData = $OauthData ? $OauthData : array();
$OauthConfig = json_decode(preg_replace("/\\/\\*[\\s\\S]+?\\*\\//", "", file_get_contents("includes/Oauth.config.json")), true);
switch ($Action) {
    case 'Cache':
        set_time_limit(0);
        UpdateConfig(array('NumFiles' => intval($DB->single('SELECT count(ID) FROM ' . $Prefix . 'upload')), 'NumTopics' => intval($DB->single('SELECT count(*) FROM ' . $Prefix . 'topics WHERE IsDel=0')), 'NumPosts' => intval($DB->single('SELECT sum(Replies) FROM ' . $Prefix . 'topics WHERE IsDel=0')), 'NumUsers' => intval($DB->single('SELECT count(ID) FROM ' . $Prefix . 'users')), 'NumTags' => intval($DB->single('SELECT count(ID) FROM ' . $Prefix . 'tags'))));
        $DB->query('UPDATE ' . $Prefix . 'users u 
			SET u.Topics=(SELECT count(*) FROM ' . $Prefix . 'topics t 
				WHERE t.UserName=u.UserName and IsDel=0),
			u.Replies=(SELECT count(*) FROM ' . $Prefix . 'posts p 
				WHERE p.UserName=u.UserName and p.IsTopic=0),
			u.Followers=(SELECT count(*) FROM ' . $Prefix . 'favorites f 
				WHERE f.FavoriteID=u.ID and Type=3)
		');
        $DB->query('UPDATE ' . $Prefix . 'topics t 
			SET t.Replies=(SELECT count(*) FROM ' . $Prefix . 'posts p 
				WHERE p.TopicID=t.ID and p.IsTopic=0 and p.IsDel=0),
			t.Favorites=(SELECT count(*) FROM ' . $Prefix . 'favorites f 
				WHERE f.FavoriteID=t.ID and Type=1)
Example #22
0
                 $MUploadResult = $UploadIcon->Resize(48, 'upload/tag/middle/' . $ID . '.png', 90);
                 $SUploadResult = $UploadIcon->Resize(24, 'upload/tag/small/' . $ID . '.png', 90);
                 if ($LUploadResult && $MUploadResult && $SUploadResult) {
                     $SetTagIconStatus = $TagInfo['Icon'] == 0 ? $DB->query('UPDATE ' . $Prefix . 'tags SET Icon = 1 Where ID=:TagID', array('TagID' => $ID)) : true;
                     $Message = $SetTagIconStatus ? $Lang['Icon_Upload_Success'] : $Lang['Icon_Upload_Failure'];
                 } else {
                     $Message = $Lang['Icon_Upload_Failure'];
                 }
             } else {
                 $Message = $Lang['Icon_Is_Oversize'];
             }
             break;
             // 禁用/启用该标签
         // 禁用/启用该标签
         case 'SwitchStatus':
             Auth(4);
             if ($DB->query('UPDATE ' . $Prefix . 'tags SET IsEnabled = :IsEnabled WHERE ID=:TagID', array('TagID' => $ID, 'IsEnabled' => $TagInfo['IsEnabled'] ? 0 : 1))) {
                 $Message = $TagInfo['IsEnabled'] ? $Lang['Enable_Tag'] : $Lang['Disable_Tag'];
             } else {
                 AlertMsg('Bad Request', 'Bad Request');
             }
             break;
         default:
             AlertMsg('Bad Request', 'Bad Request');
             break;
     }
     break;
     //Error
 //Error
 default:
     AlertMsg('Bad Request', 'Bad Request');
Example #23
0
      <aside class="main-sidebar" >
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
          <!-- Sidebar user panel -->
          <div class="user-panel">
            <div class="pull-left image">
              <img src="{{Auth()->user()->image}}" class="img-circle" alt="User Image" />
            </div>
            <div class="pull-left info">
              <p>@if(!empty(Auth()->user())){{Auth()->user()->name}} @else Not user @endif</p>

              <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
            </div>
          </div>
          <?php 
$role = Auth()->user()->role_id;
?>
          <!-- sidebar menu: : style can be found in sidebar.less -->
          <ul class="sidebar-menu">
            <li class="header">Navegación</li>
            <li><a href="/"><i class="fa fa-home"></i> <span>Home</span></a></li>

            @if($role == 1)
            <li class="treeview">
              <a href="#">
                <i class="fa fa-wrench"></i>
                <span>Configuración</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                <li class=""><a href="/users" ><i class="fa fa-circle-o"></i>Usuarios</a></li>
Example #24
0
 public function cashOut()
 {
     //        echo 'peticion de sacar dinero';
     $validator = Validator::make(Input::all(), ['inputLableautyRadio' => 'required', 'amount' => 'required|min:1', 'bitcoinacount' => 'required']);
     $cartera = Input::get('inputLableautyRadio');
     $cantidad = Input::get('amount');
     $bitcoinacount = Input::get('bitcoinacount');
     echo '<br>' . $cantidad . '<br>';
     echo '<br>' . $bitcoinacount . '<br>';
     //        dd($cartera);
     if ($cartera == 'utilities' | $cartera == 'commission') {
         //VALIDO QUE SEA UNA CUENTA VALIDA Y NO OTRA
         if ($validator->passes()) {
             //SI LOS DATOS SON CORRECTOS
             $a = new DateTime("-30 days");
             $fecha = $a->setTime(0, 0, 0);
             $restriccion = UserCashout::where('created_at', '>', $fecha)->get();
             //saco una consulta con 30 dias atras
             //                dd($restriccion);
             if ($restriccion != null && $restriccion->count() > 0) {
                 //valido que no hayan pasado menos de 30 dias
                 //                    dd('todavia no pasan los 30 dias de espera');
                 $validator->errors()->add('nfondos', 'you have to wait 30 days after each withdrawal');
                 //AGREGO UN ERROR A MANO
                 return redirect()->route('wallets.cashout')->withErrors($validator);
             } else {
                 //si esta vacio es que no ha echo un retiro 30 DIAS
                 $wallet = UserWallet::where('user_id', '=', Auth()->user()->getAuthIdentifier())->first();
                 //            $wallet= UserWallet::where('user_id','=','Auth()->user()->getAuthIdentifier()')->get();
                 if ($wallet != null && $wallet[$cartera] > 100) {
                     //valido que tenga fondos
                     //                        dd('si tiene fondos');
                     if ($cantidad < $wallet[$cartera] && $cantidad >= 100) {
                         //reviso que sea mayor a 100 y menor o igual a lo que tiene
                         //                            dd('si se puede pagar ');
                         $comision = $cantidad * 0.03;
                         $cantidad = $cantidad - $comision;
                         // SACO LA CUENTA DE BITCOIN
                         $cuenta = BitcoinAccount::where('user_id', Auth()->user()->getAuthIdentifier())->WHERE('id', $bitcoinacount)->get(['name', 'id', 'user_id']);
                         $a = $cuenta[0]['original']['name'];
                         echo '<br>' . $a . '<br>';
                         echo '<br>' . $cuenta[0]['original']['name'] . '<br>';
                         $cashout = UserCashout::create(array('user_id' => $cuenta[0]['original']['user_id'], 'bitcoin_id' => $cuenta[0]['original']['id'], 'from' => $cartera, 'amount' => $cantidad, 'status' => 'pending', 'note' => '{}'));
                         //                            dd($cashout);
                         //                            $validator->errors()->add('nfondos',"don't have funds");
                         return redirect()->route('wallets.cashout');
                     } else {
                         //                            dd('no se puede pagar');
                         $validator->errors()->add('nfondos', "don't have funds ");
                         return redirect()->route('wallets.cashout')->withErrors($validator);
                     }
                 } else {
                     //si no tiene fondos lo regreso al menu
                     //                        dd('no hay nada');
                     $validator->errors()->add('nfondos', "don't have funds");
                     return redirect()->route('wallets.cashout')->withErrors($validator);
                 }
             }
         } else {
             //                dd($validator);
             return redirect()->route('wallets.cashout')->withErrors($validator);
         }
     } else {
         //FIN DEL IF QUE VALIDA QUE SEA UNA CUENTA VALIDA
         return redirect()->route('wallets.cashout')->withErrors($validator);
     }
 }
 public function store(Request $r)
 {
     $data = $r->all();
     User::where('id', Auth()->user()->id)->update(['fname' => $data['fname'], 'lname' => $data['lname']]);
     return Response::json(['message' => 'Salvarea a avut loc cu succes', 'code' => 200]);
 }
 public function edit(Request $request)
 {
     \DB::beginTransaction();
     //$customer = $this->customerRepo->find($request->id);
     //$manager = new CustomerManager($customer,$request->except('fechaNac'));
     //$manager->save();
     $product = $this->productRepo->find($request->id);
     //$detPres = $this->detPres->getModel();
     if ($request->input('estado') == 1) {
     } else {
         $request->merge(array('estado' => '0'));
     }
     if ($request->input('hasVariants') == 1) {
     } else {
         $request->merge(array('hasVariants' => '0'));
     }
     if ($request->input('track') == 1) {
     } else {
         $request->merge(array('track' => '0'));
     }
     $request->merge(array('user_id' => Auth()->user()->id));
     //var_dump($request->all());die();
     $managerPro = new ProductManager($product, $request->except('sku', 'suppPri', 'markup', 'price', 'track'));
     //================================PROD CON VARIANTES==============================//
     if ($request->input('hasVariants') === true) {
         $managerPro->save();
         $request->merge(array('product_id' => $product->id));
         $product->quantVar = 0;
         //cantidad de variantes igual a 0;
         $product->save();
         //$managerVar = new VariantManager($variant,$request->only('sku','suppPri','markup','price','track','product_id'));
         //$managerVar->save();
         //================================./PROD CON VARIANTES==============================//
         //================================PROD SIN VARIANTES==============================//
     } elseif ($request->input('hasVariants') === '0') {
         $managerPro->save();
         $request->merge(array('product_id' => $product->id));
         if ($request->input('autogenerado') === true) {
             $sku = \DB::table('variants')->max('sku');
             if (!empty($sku)) {
                 $sku = $sku + 1;
             } else {
                 $sku = 1000;
                 //inicializar el sku;
             }
             $request->merge(array('sku' => $sku));
         } else {
         }
         $product->quantVar = 0;
         //aunq presenta una fila en la tabla variantes por defecto
         $product->save();
         $variant = $this->variantRepo->getModel()->where('product_id', $product->id)->first();
         $managerVar = new VariantManager($variant, $request->only('sku', 'suppPri', 'markup', 'price', 'track', 'codigo', 'product_id', 'user_id'));
         $managerVar->save();
         //var_dump($request->input('presentations')); die();
         //$variant->presentation()->detach();
         foreach ($request->input('presentations') as $presentation) {
             //var_dump('o'); die();
             $presentation['variant_id'] = $variant->id;
             $presentation['presentation_id'] = $presentation['id'];
             /*$detpresRepo = new DetPresRepo();
               //$oPres = $detpresRepo->getModel()->where('presentation_id',$presentation['presentation_id'])->where('variant_id',$presentation['variant_id'])->first();
               $oPres = $detpresRepo->getModel();
               $presManager = new DetPresManager($oPres,$presentation);
               $presManager->save();*/
             $oPres = new DetPresRepo();
             //$oStock = $stockRepo->getModel()->where('variant_id',$stock['variant_id'])->where('warehouse_id',$stock['warehouse_id'])->first();
             $obj = $oPres->getModel()->where('variant_id', $presentation['variant_id'])->where('presentation_id', $presentation['presentation_id'])->first();
             if (!isset($obj->id)) {
                 $presManager = new DetPresManager($oPres->getModel(), $presentation);
                 $presManager->save();
             } else {
                 $presManager = new DetPresManager($obj, $presentation);
                 $presManager->save();
             }
         }
         if ($request->input('track') == 1) {
             //$variant->warehouse()->detach();
             foreach ($request->input('stock') as $stock) {
                 if (isset($stock['stockActual']) && $stock['stockActual'] == null) {
                     $stock['stockActual'] = 0;
                 }
                 if (isset($stock['stockMin']) && $stock['stockMin'] == null) {
                     $stock['stockMin'] = 0;
                 }
                 if (isset($stock['stockMinSoles']) && $stock['stockMinSoles'] == null) {
                     $stock['stockMinSoles'] = 0;
                 }
                 $stock['variant_id'] = $variant->id;
                 $stockRepo = new StockRepo();
                 //$oStock = $stockRepo->getModel()->where('variant_id',$stock['variant_id'])->where('warehouse_id',$stock['warehouse_id'])->first();
                 $obj = $stockRepo->getModel()->where('variant_id', $stock['variant_id'])->where('warehouse_id', $stock['warehouse_id'])->first();
                 if (!isset($obj->id)) {
                     $stockManager = new StockManager($stockRepo->getModel(), $stock);
                     $stockManager->save();
                 } else {
                     $stockManager = new StockManager($obj, $stock);
                     $stockManager->save();
                 }
                 /*$oStock = $stockRepo->getModel();
                   $stockManager = new StockManager($oStock, $stock);
                   $stockManager->save();
                   */
             }
         }
     }
     //================================./PROD SIN VARIANTES==============================//
     //================================ADD IMAGE TO PROD==============================//
     if ($request->has('image') and substr($request->input('image'), 5, 5) === 'image') {
         $image = $request->input('image');
         $mime = $this->get_string_between($image, '/', ';');
         $image = base64_decode(preg_replace('#^data:image/\\w+;base64,#i', '', $image));
         Image::make($image)->resize(200, 200)->save('images/products/' . $product->id . '.' . $mime);
         $product->image = '/images/products/' . $product->id . '.' . $mime;
         $product->save();
     }
     //================================./ADD IMAGE TO PROD==============================//
     \DB::commit();
     return response()->json(['estado' => true, 'nombres' => $product->nombre]);
 }
                       aria-expanded="false">Store <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="{!! @url('admin/product') !!}" title="Product">Product</a></li>
                        <li><a href="{!! @url('admin/category') !!}" title="Category">Category</a></li>
                        <li><a href="{!! @url('admin/pages') !!}" title="Pages">Pages</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="{!! url('/admin/settings') !!}">Settings</a></li>
                    </ul>
                </li>
                <!--<li><a href="{!! @url('admin/customer-group') !!}" title="Customer Group">Customer Group</a></li>-->
            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li><a href="{!! url('/') !!}" target="_blank" title="View site">View Site</a></li>
                <?php 
if (!Auth()->check()) {
    ?>
                    <li><a href="{!! url('/admin/login') !!}">Login</a></li>


                <?php 
} else {
    ?>
                    <li role="presentation" class="dropdown">
                        <a href="{!! url('/customer/account') !!}" title="My Account"  class="dropdown-toggle" data-toggle="dropdown" >
                            My Account <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li ><a href="{!! url('/admin/user/edit-account') !!}" title="Edit Account">Edit Account</a></li>

                            <li><a href="{!! url('/admin/logout') !!}">Logout</a></li>
Example #28
0
  </head>

  <body>

    <div class="container">

      <form class="form-signin" action="index.php" method="post">
        <label for="login" class="sr-only">Логин</label>
        <input type="text" id="login" name="login" class="form-control" placeholder="Логин" required autofocus>
        <label for="inputPassword" class="sr-only">Пароль</label>
        <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Пароль" required>
        <button class="btn btn-lg btn-primary btn-block" type="submit" name="AuthSubmit" value="TRUE">Войти</button>
        
        <?php 
if ($_POST['AuthSubmit']) {
    $auth_result = Auth();
    echo $auth_result;
} else {
    echo "авторизуйтесь";
}
?>
        
      </form>

    </div> <!-- /container -->


    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>
Example #29
0
File: data.php Project: milkae/Php
    }
    if (!chdir("./_users/{$_SESSION['uname']}/temp")) {
        respondError("Can't change working path to the temporary directory (username: {$_SESSION['uname']})");
    }
}
require __INC__ . '/crypt.php';
if ($act) {
    if ($fn = $_GET['file']) {
        if (!preg_match('/^[0-9a-z\\.\\-]+$/i', $fn)) {
            respond('Bad file name requested');
        }
    }
    switch ($act) {
        case 'auth':
            require __INC__ . '/auth.php';
            if ($t = Auth($_POST['uname'], $_POST['passwd'])) {
                respondError($t);
            }
            respond($config, TRUE);
        case 'ver':
            respond(array('version' => VERSION), FALSE);
        case 'upload':
            if (!isset($_FILES['Filedata'])) {
                exit("The file was not uploaded. Please make sure 'post_max_size' directive in php.ini is set to a high enough value.");
            } else {
                if ($_FILES['Filedata']['error'] > 0) {
                    $e = array(1 => "The uploaded file exceeds the 'upload_max_filesize' directive in php.ini file.", 2 => "The uploaded file exceeds the 'upload_max_filesize' or 'post_max_size' directive in php.ini file.", 3 => 'The uploaded file was only partially uploaded.', 4 => 'No file was uploaded.', 6 => 'Missing a temporary folder.', 7 => 'Failed to write file to disk.', 8 => 'A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.');
                    exit($e[$_FILES['Filedata']['error']]);
                } else {
                    $fn = uniqid('u-');
                    if (move_uploaded_file($_FILES['Filedata']['tmp_name'], $fn)) {
Example #30
0
} elseif ($act == "timeout") {
    $USERID = $s->data['UserID'];
    $msg = "Sesión cerrada por tiempo inactividad";
    conectado(0, $USERID, $s->data['UserNom']);
    logger($USERID, $msg);
    session_unset();
    session_destroy();
    $s->expire();
}
if (isset($_POST['method'])) {
    /*
    Form was submitted, let's validate and test authentication.
    */
    if (Validate()) {
        /*/echo "validando<br>";*/
        if (Auth()) {
            /*/echo "autorizando<br>";*/
            /*
                  Use the session to "remember" that the user is logged in already.*/
            $s->data['logged_in'] = true;
            if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
                $ip = $_SERVER['HTTP_CLIENT_IP'];
            } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
            } else {
                $ip = $_SERVER['REMOTE_ADDR'];
            }
            for ($x = 1; $x <= 255; $x++) {
                $tmp = "192.168.1." . $x;
                $rango[$tmp] = $tmp;
            }