Exemplo n.º 1
0
 public function update(Link $link, Request $request)
 {
     //dd($request->all());
     $this->validate($request, ['name' => 'required|min:2', 'url' => 'required|url', 'status' => 'required|in:0,1']);
     $input = $request->except('_token');
     $link->update(['name' => $input['name'], 'url' => $input['url'], 'description' => $input['description'], 'status' => $input['status']]);
     Flash::success('لینک با موفقیت ویرایش گردید');
     return redirect(route('xadmin.link.index'));
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\Prospect $request)
 {
     $activity = Activity::find($request->get('activity_id'));
     $prospect = new Prospect($request->all());
     $activity->prospects()->save($prospect);
     if ($request->has('links')) {
         foreach ($request->get('links') as $link) {
             $type = LinkType::findOrFail($link['type_id']);
             $link = new Link(['url' => $link['url']]);
             $link->prospect()->associate($prospect);
             $link->type()->associate($type);
             $link->save();
         }
     }
     return response()->json($prospect);
 }
Exemplo n.º 3
0
 public function pesok()
 {
     $category = Category::where('sef', '=', 'catalogs')->first();
     $path = explode("?", substr($_SERVER['REQUEST_URI'], 1));
     $link = Link::where('url', $path[0])->first();
     // удалить первый слеш из URI и вернуть строку до первого вхождения знака ?
     // иначе на второй и следующей странице пагинации переменная $link будет содержать всякий хлам
     // типа ?page=4 и естесственно в БД такой ссылки не найдется
     $img = File::allFiles(public_path() . '/img/risunki/pesok');
     // pagination нашел тута  http://psampaz.github.io/custom-data-pagination-with-laravel-5/
     //Get current page form url e.g. &page=6
     $currentPage = LengthAwarePaginator::resolveCurrentPage();
     if (is_null($currentPage)) {
         $currentPage = 1;
     }
     //Create a new Laravel collection from the array data
     $collection = new Collection($img);
     //Define how many items we want to be visible in each page
     $perPage = 20;
     //Slice the collection to get the items to display in current page
     $currentPageImgResults = $collection->slice(($currentPage - 1) * $perPage, $perPage)->all();
     //Create our paginator and pass it to the view
     $paginatedImgResults = new LengthAwarePaginator($currentPageImgResults, count($collection), $perPage);
     $paginatedImgResults->setPath('peskostrujnie-risunki');
     return view('links.pesok')->withCategory($category)->withLink($link)->withImg($paginatedImgResults)->withPath($path);
 }
Exemplo n.º 4
0
 public function boot()
 {
     // validator for alphabetic characters and spaces http://blog.elenakolevska.com/laravel-alpha-validator-that-allows-spaces/
     // It matches unicode characters, so even João Gabriel won't have his name marked as invalid anymore :)
     Validator::extend('alpha_spaces', function ($attribute, $value, $parameters, $validator) {
         return preg_match('/^[\\pL\\s]+$/u', $value);
     });
     // элементы шаблона сайта
     view()->composer('modules.topmenu', function ($view) {
         $view->withTree(Category::descendantsOf(1)->toTree());
     });
     view()->composer('modules.mainmenu', function ($view) {
         $view->withTree(Category::descendantsOf(1)->toTree());
     });
     view()->composer('modules.breadcrumbs', function ($view) {
         $urlarr = explode('?', $_SERVER['REQUEST_URI']);
         // получаем массив сегментов URI без ?
         $urlget = array_shift($urlarr);
         // получаем первый элемент до ?
         $urllist = explode('/', $urlget);
         // получаем массив сегментов URI без слеша
         $lastbread = array_pop($urllist);
         // получаем последний элемент массива (после последнего слеша)
         $view->withLastbread($lastbread);
     });
     view()->composer('modules.popular', function ($view) {
         $view->withPopular(Link::orderBy('hits', 'desc')->take(5)->get());
     });
     view()->composer('modules.lastnews', function ($view) {
         $view->withLastnews(News::orderBy('created_at', 'desc')->take(5)->get());
     });
 }
Exemplo n.º 5
0
 /**
  * [showRefLink description]
  * Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
  *
  * @param [text] $link [referral link]
  *
  * @return [json] [all info abou the link]
  */
 public function showRefLink($link = null)
 {
     //  // If it has a Sponsor Cookie
     if (\Cookie::has('sponsor')) {
         return Redirect::to('/');
         // Load Referral Link View
     }
     if (is_null($link)) {
         return Redirect::to('/');
         // Redirect To HomePage
     }
     try {
         // If has $Link then Look in Database if Exist
         $link = Link::findByLink($link)->load('user.profile');
         $link = $link->toArray();
         // Note Cookie Wont Be Created if Exceeded More than 4kb
         \Cookie::queue('sponsor', $link, 2628000);
         // Return Referral View with Variable Link
         return Redirect::to('/')->with('link', $link);
         // If No Record Found Throw Exception!
     } catch (ModelNotFoundException $e) {
         // Return Back to Home
         return Redirect::to('/');
         // return view('nosponsor');
     }
 }
Exemplo n.º 6
0
 /**
  * Display a listing of the resource.
  *
  * @param $id
  * @return Response
  */
 public function detail($id)
 {
     $sPage = 'detail';
     $folio = Folio::FindOrFail($id);
     $link = Link::where('id_folio', $id)->get();
     $ids = Folio::count();
     return view('pages.detail', compact('sPage', 'folio', 'link', 'ids'));
 }
Exemplo n.º 7
0
 public function index()
 {
     $filter = $this->topic->present()->getTopicFilter();
     $topics = $this->topic->getTopicsWithFilter($filter);
     $nodes = Node::allLevelUp();
     $links = Link::remember(1440)->get();
     return view('topics.index', compact('topics', 'nodes', 'links'));
 }
Exemplo n.º 8
0
    /**
     * Show the application welcome screen to the user.
     *
     * @return Response
     */
    public function index()
    {
        // sql query to get database size{}
        $dataSize = DB::select('SELECT round(((data_length + index_length))) "size"
		 FROM information_schema.TABLES
		 WHERE table_schema = "saveurl" AND table_name = "links"');
        $numberOfLinks = Link::all()->count();
        return view('welcome')->with('numberOfLinks', $numberOfLinks)->with('dataSize', $dataSize[0]->size);
    }
Exemplo n.º 9
0
 /**
  * Display Backend Area.
  */
 public function backend()
 {
     $users = User::where('id', '<>', 1)->get();
     $categories = Category::all();
     $projects = Project::all();
     $images = Image::all();
     $links = Link::all();
     return view('pages/backend/index')->with('users', $users)->with('categories', $categories)->with('projects', $projects)->with('links', $links)->with('images', $images);
 }
Exemplo n.º 10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('links')->insert(['link' => 'masterpowers', 'user_id' => 1, 'sp_link_id' => null, 'active' => true, 'date_activated' => \Carbon\Carbon::now(), 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     $faker = Faker\Factory::create();
     // Link::truncate();
     foreach (range(1, 50) as $index) {
         Link::create(['link' => str_replace('.', '_', $faker->unique()->userName), 'user_id' => $index + 1, 'sp_link_id' => $index, 'sp_user_id' => $index, 'active' => true, 'date_activated' => \Carbon\Carbon::now(), 'created_at' => \Carbon\Carbon::now(), 'updated_at' => \Carbon\Carbon::now()]);
     }
 }
Exemplo n.º 11
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //Getting the link to be edited so the form-model binder can pre-populate the form fields with old values
     $link = \App\Link::find($id);
     //Getting all parent links
     $links = (new \App\Link())->where('parent_id', '=', '0')->get();
     //Generating the dropdown list for parent pages as follows ['0' => 'No Parent', '1' => 'First Parent']
     $dropdown_links = dropdown_generator($links, ['id' => 'title'], ['0' => 'No Parent']);
     return view('panel.links.edit', compact('link', 'dropdown_links'));
 }
Exemplo n.º 12
0
 public function deleteLink(Request $request)
 {
     // delete link if only the link belongs to the loggedin user
     $linkId = $request->get('id');
     $linkObject = Link::find($linkId);
     $linkObjectUserId = $linkObject->user_id;
     if ($linkObjectUserId == Auth::user()->id) {
         $linkObject->delete();
     }
 }
 public function index(urlRequest $request)
 {
     $search = $request->query('q');
     $filter = $this->topic->present()->getTopicFilter();
     $topics = $this->topic->getTopicsSearchWithFilter($filter)->search($search)->paginate(20);
     $nodes = Node::allLevelUp();
     $links = Link::all();
     $this->setupLayout();
     return view('topics.index', compact('topics', 'nodes', 'links'));
 }
Exemplo n.º 14
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($lid)
 {
     $directCount = Link::where('sp_link_id', $lid)->count();
     $ten = new Ten();
     $ten->link_id = $lid;
     $ten->min_direct = $directCount;
     $ten->save();
     $cardline = new Cardline();
     $cardline->link_id = $lid;
     $ten->cardpoints()->save($cardline);
 }
Exemplo n.º 15
0
 public function apiRegister(Request $request)
 {
     $validator = $this->registrar->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $this->auth->login($this->registrar->create($request->all()));
     $api_token = Str::random(60);
     User::where('id', $this->auth->user()->id)->update(['api_token' => $api_token]);
     $links = Link::where('user_id', $this->auth->user()->id)->with('user')->orderBy('created_at', 'desc')->get();
     return response()->json(['status' => 'success', 'user' => $this->auth->user(), 'links' => $links, 'api_token' => $api_token]);
 }
Exemplo n.º 16
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('link', function ($value) {
         return Link::findOrFail($value);
     });
     $router->bind('news', function ($value) {
         //news is name of wildcard
         return News::findOrFail($value);
     });
 }
Exemplo n.º 17
0
 public function compose($view)
 {
     $frontend = new Fluent();
     if (Auth::check()) {
         $frontend->user = new UserPresenter(Auth::user());
     }
     $frontend->links = Cache::get('links', function () {
         $links = least('array', [Link::all()->toArray(), []]);
         Cache::put('links', $links, 60000);
         return $links;
     });
     $view->with('frontend', $frontend);
 }
Exemplo n.º 18
0
 private function storeLink(Request $request, $serial_id)
 {
     $link = strtolower($request->get('lastlink'));
     $title = !empty($request->get('titlelink')) ? strtolower($request->get('titlelink')) : null;
     $season = strtolower($request->get('season'));
     $serie = strtolower($request->get('serie'));
     $user_id = $request->user()->id;
     if (!empty($link) && !empty($serial_id)) {
         $Link = Link::where(['serial_id' => $serial_id, 'url' => $link])->get();
         // Если такой ссылки нет в базе даных
         if (!$Link->count()) {
             $NewLink = new Link();
             $NewLink->user_id = $user_id;
             $NewLink->serial_id = $serial_id;
             $NewLink->url = $link;
             $NewLink->season = $season;
             $NewLink->serie = $serie;
             $NewLink->title = $title;
             $NewLink->save();
         }
     } else {
         return response(['message' => 'Не обнаружена ссылка и/или ид сериала'], 422)->header('Content-Type', 'application/json');
     }
 }
 /**
  * 
  * @return type
  */
 public function getUrls()
 {
     $keyword = Request::input('keyword');
     if ($keyword == '') {
         return Response::json(array('success' => false, 'error' => 'Please enter a keyword'), 400);
     }
     $keyword = Keyword::where('value', '=', $keyword)->first();
     if ($keyword == '') {
         return Response::json(array('success' => false, 'error' => 'No urls found for the keyword'), 400);
     }
     $urls = Link::where('keyword_id', '=', $keyword->id)->paginate(10);
     if (Request::ajax()) {
         return Response::json(View::make('partials.url-list', array('urls' => $urls))->render());
     }
 }
Exemplo n.º 20
0
 public function __construct()
 {
     $this->tags = Tag::with(['articles' => function ($query) {
         $query->select('id');
     }])->get();
     $settings = Setting::lists('value', 'name')->toArray();
     $this->setting = (object) $settings;
     $this->links = Link::all()->sortBy('sort');
     /*$this->tags=Tag::select([
           'tags.*',
           \DB::raw('ifnull(count(article_tag.tag_id),0) as count')
       ])->join('article_tag','tags.id','=','article_tag.tag_id')
       ->join('articles','articles.id','=','article_tag.article_id')
       ->where('articles.deleted_at',null)
       ->groupBy('article_tag.tag_id')
       ->get();*/
 }
Exemplo n.º 21
0
 public function freeCycle()
 {
     $card = $this->freeShuffle();
     $lid = $card->link_id;
     $directCount = $card->min_direct;
     $newCard = new static();
     $newCard->link_id = $lid;
     $newCard->min_direct = $directCount;
     $newCard->save();
     $cardline = new Cardline();
     $cardline->link_id = $lid;
     $newCard->cardpoints()->save($cardline);
     $this->deactivate($lid);
     // This will Broadcast To the Front End!
     $username = \App\Link::find($lid)->user->username;
     $data = ['event' => 'UserSignedUp', 'data' => ['username' => $username]];
     \PHPRedis::publish('rfn-chanel', json_encode($data));
 }
Exemplo n.º 22
0
 public function destroy($id)
 {
     $company = Company::find($id);
     $campains = Campain::where('company_id', '=', $id)->get();
     if (count($campains) > 0) {
         foreach ($campains as $campain) {
             $links = Link::where('campain_id', '=', $campain->id)->get();
             if (count($links) > 0) {
                 foreach ($links as $link) {
                     $link->delete();
                 }
             }
             $campain->delete();
         }
     }
     $company->delete();
     return redirect('company/');
 }
Exemplo n.º 23
0
 public function postBatch($act = 'update')
 {
     $result = false;
     switch ($act) {
         case 'delete':
             $ids = \Request::input('ids');
             $idsArr = explode(',', $ids);
             $result = Link::whereIn('id', $idsArr)->delete();
             break;
     }
     $msg = [];
     if ($result) {
         $msg['status'] = 'success';
     } else {
         $msg['status'] = 'failed';
     }
     return response(json_encode($msg))->header('Content-Type', 'application/json');
 }
Exemplo n.º 24
0
 public function index()
 {
     $churches = Link::where('type_id', 1)->get();
     $weeklyAnnouncements = Link::where('type_id', 2)->get();
     $blendingCenter = Link::where('type_id', 3)->get();
     $addressBooks = Link::where('type_id', 4)->get();
     $gospelRoom = Link::where('type_id', 5)->get();
     $lsm = Link::where('type_id', 6)->get();
     $fttCenter = Link::where('type_id', 7)->get();
     $lifeEducation = Link::where('type_id', 8)->get();
     $mttCenter = Link::where('type_id', 9)->get();
     $truth = Link::where('type_id', 10)->get();
     $emanna = Link::where('type_id', 11)->get();
     $churchHistory = Link::where('type_id', 12)->get();
     $japaneseSites = Link::where('type_id', 13)->get();
     $englishSites = Link::where('type_id', 14)->get();
     // $entries = FileEntry::latest()->take(10)->get();
     return view('welcome.index', compact('churches', 'weeklyAnnouncements', 'blendingCenter', 'addressBooks', 'gospelRoom', 'lsm', 'fttCenter', 'lifeEducation', 'mttCenter', 'truth', 'emanna', 'churchHistory', 'japaneseSites', 'englishSites'));
     // return $blendingCenter;
 }
Exemplo n.º 25
0
 /**
  * [showRefLink description]
  * Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
  *
  * @param [text] $link [referral link]
  *
  * @return [json] [all info about the link]
  */
 public function showRefLink($link = null)
 {
     //  // If it has a Sponsor Cookie
     if (\Cookie::has('sponsor')) {
         $cookie = \Cookie::get('sponsor');
         $link = $cookie['link'];
         $link = Link::findByLink($link)->load('user.profile');
         $product = Product::find(1);
         return view('pages.referralLink')->with(compact('link', 'product'));
     }
     // Check if the Provided Link is Valid  Redirect to Home if Invalid Link!
     try {
         $link = Link::findByLink($link);
         $sp_lid = $link->id;
         // If Sponsor is Not Active LeapFrog to ActiveSponsor
         if (!$link->active) {
             $sp_lid = $link->activeSponsor($sp_lid);
         }
         // Load User Profile
         $link = Link::find($sp_lid)->load('user.profile');
         $splink = [];
         $splink['id'] = $link->id;
         $splink['user_id'] = $link->user_id;
         $splink['link'] = $link->link;
         // Load Product
         $product = Product::find(1);
         // Assign $splink to the cookie
         // Note Cookie Wont Be Created if Exceeded More than 4kb
         // Cookie set Forever / 5 Years or until Cache Clear
         // No Needed To Return With Cookie if it is Queue
         $cookie = \Cookie::queue('sponsor', $splink, 2628000);
         // Return Referral View with Variable Link
         return view('pages.referralLink')->with(compact('link', 'product'));
         // LINK PROVIDED IS INVALID REDIRECT HOME
     } catch (ModelNotFoundException $e) {
         return Redirect::to('/');
     }
 }
 public function index(Request $request)
 {
     $serial = $request->get('serial');
     $serial_id = strtolower($serial['serial_id']);
     $count_rand = 2;
     $rand = [];
     $result = [];
     $all = Link::where(['serial_id' => $serial_id]);
     $just = $all->where(['serial_id' => $serial_id])->get()->toArray();
     if (count($just)) {
         $count_rand = $count_rand <= count($just) ? $count_rand : count($just);
         $rand = $count_rand ? array_rand($just, $count_rand) : [];
         // array_rand может возвращать только число (не в масссиве)
         if (is_array($rand) && count($rand)) {
             foreach ($rand as $key => $value) {
                 $result[] = $just[$value];
             }
         } elseif (is_integer($rand)) {
             $result[] = $just[$rand];
         }
     }
     return response()->json($result);
 }
Exemplo n.º 27
0
 public function searchUser()
 {
     // If Cookie is Present Dont Load Any Data!
     if (Cookie::has('sponsor')) {
         $cookie = Cookie::get('sponsor');
         $link = $cookie['link'];
         $message = 'Loading... ' . $link . '\'s Sponsor Link';
         // Return as an Error Code LOCK!
         return response()->json(['cookie' => true, 'message' => $message, 'link' => $link], 423);
     }
     // If No Cookie Is Present
     try {
         $link = Input::get('q');
         $splinkdata = Link::findByLink($link)->load('user.profile');
         $cookie = $splinkdata->toArray();
         $message = 'Loading... ' . $splinkdata['link'] . '\'s Sponsor Link';
         return response()->json(['cookie' => false, 'splinkdata' => $splinkdata, 'message' => $message], 200)->withCookie(\Cookie::forever('sponsor', $cookie));
     } catch (ModelNotFoundException $e) {
         $link = Input::get('q');
         $message = 'Can\'t Find ' . $link . ' in Database';
         return response()->json(['cookie' => false, 'message' => $message, 'link' => $link], 400);
     }
 }
Exemplo n.º 28
0
 /**
  * Display the JSON of the specified link
  *
  * @return Response
  */
 public function link($id)
 {
     $link = Link::find($id);
     return $link;
 }
Exemplo n.º 29
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $link = Link::where('link_name', $id)->where('user_id', Auth::user()->id)->first();
     $link->delete();
     return Redirect::to('/gtl');
 }
Exemplo n.º 30
0
 /**
  * @return category page single link url data eg.mobile, email etc
  */
 public function getData()
 {
     $link = Link::first();
     //$ua = 'Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16.0 (ROBOT)';
     $client = new Client();
     $client->setHeader('User-Agent', "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36");
     //Set proxy using tor
     $guzzleClient = new \GuzzleHttp\Client(['curl' => [CURLOPT_PROXY => '127.0.0.1:9050', CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5]]);
     $client->setClient($guzzleClient);
     $crawler = $client->request('GET', $link->url);
     //$button = $crawler->filter('.reply_button');
     $isBlock = $crawler->filter('p')->text();
     $isRun = true;
     $i = 0;
     while ($isRun) {
         if (strpos($isBlock, 'blocked') != false) {
             $this->torNew();
             //return $this->getIndex();
             $crawler = $client->request('GET', $link->url);
             $isBlock = $crawler->filter('p')->text();
         } else {
             $lnk = $crawler->selectLink('reply')->link();
             $crawler = $client->click($lnk);
             if ($crawler->filterXpath("//div[@class='captcha']")->count()) {
                 $this->torNew();
             } else {
                 var_dump($crawler->html());
                 $title = $crawler->filter('title')->text();
                 $mobile = $crawler->filter('.mobile-only')->first()->text();
                 $email = $crawler->filter('.mailapp')->first()->text();
                 echo $link->url . ' ' . $title . ' ' . $mobile . ' ' . $email;
                 Scrap::create(['url' => $link->url, 'title' => $title, 'email' => $email, 'phone' => $mobile]);
                 $isRun = false;
             }
         }
     }
     //End While
     // $crawler->filter('a.i')->each(function ($node) {
     // 	    $url = $node->attr("href")."\n";
     // 	    //$link = $node->filter('a')->first();
     // 	    $text = $node->text();
     // 	    $fullUrl = "http://auburn.craigslist.org".$url;
     // 	    //$scrap::create(['url' => $url, 'title' => $text ]);
     // 	   	Link::create(['url'=>$fullUrl, 'title'=> $text]);
     // 	    var_dump($url);
     // 	    $this->tor_new_identity();
     // });
 }