Exemplo n.º 1
0
 public function webinfo()
 {
     set_time_limit(0);
     $this->load->library('My_Webmaster');
     $return_data = array('status' => 0);
     if ($this->form_validation->run('website_info') == TRUE) {
         $url = strtolower(rtrim($this->secure_data($this->input->post('domain')), '/'));
         $langArr = $this->config->item('langArr');
         $lang = $this->secure_data($this->input->post('lang'));
         if (!array_key_exists($lang, $langArr)) {
             $lang = 'en';
         }
         $domain = addhttp($url);
         /*$parse = parse_url($domain);
         		$host = preg_replace('#^www\.(.+\.)#i', '$1', $parse['host']);
         		$ip = gethostbyname($host);
         		
         		$domain_access = $parse['scheme'].'://'.$host;
         		echo $domain_access; exit;*/
         $ip = gethostbyname($url);
         $webmaster = new My_Webmaster();
         $return_data = $webmaster->insert($domain, $ip, $lang);
         $return_data['url'] = base_url() . 'web/index/' . md5($return_data['wid']);
     } else {
         $return_data['message'] = validation_errors();
     }
     echo json_encode($return_data);
     exit;
 }
Exemplo n.º 2
0
 public function analyticsmonth()
 {
     set_time_limit(0);
     $runby = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'CLI';
     $cdt = array('runat' => date('Y-m-d H:i:s', time()), 'path' => 'mycron/analyticsmonth', 'runby' => $runby);
     $this->common_model->insert($cdt, 'croncheck');
     //$lang = $this->config->item('langshort');
     $this->load->library('My_Webmaster');
     $webmaster = new My_Webmaster();
     $month_initial = strtotime(date('Y-m-01 00:00:00'));
     $cond_user = array('where' => array('user_type' => 2), 'result' => 1);
     $users = $this->common_model->get_rows($cond_user, 'users');
     foreach ($users as $user) {
         $qry = "SELECT ca_website.* FROM ca_website " . "WHERE ca_website.id IN (SELECT MAX(`cw`.`id`) from `ca_website` as `cw` WHERE `cw`.`user_id` = ? GROUP BY cw.md5domain, cw.lang) " . "ORDER BY ca_website.modified desc";
         $websites = $this->db->query($qry, array($user['id']))->result_array();
         foreach ($websites as $website) {
             // Add condition - Done
             $last_modified = strtotime($website['modified']);
             //if(1)
             if ($last_modified < $month_initial) {
                 $domain = addhttp($website['domain']);
                 $ip = gethostbyname($website['domain']);
                 $lang = $website['lang'];
                 $inserted_data = $webmaster->insert($domain, $ip, $lang, $user['id']);
                 //echo "<pre>"; print_r($inserted_data); echo "</pre>";
                 $this->domain = $website['domain'];
                 $this->website = $inserted_data['inserted_data']['ca_website'];
                 $this->wid = $inserted_data['wid'];
                 $this->thumbnail = WebsiteThumbnail::getUrl(array('{{Url}}' => $this->domain, '{{Size}}' => 'l'));
                 $this->cloud = $inserted_data['inserted_data']['ca_cloud'];
                 $this->content = $inserted_data['inserted_data']['ca_content'];
                 $this->document = $inserted_data['inserted_data']['ca_document'];
                 $this->isseter = $inserted_data['inserted_data']['ca_issetobject'];
                 $this->links = $inserted_data['inserted_data']['ca_links'];
                 $this->meta = $inserted_data['inserted_data']['ca_metatags'];
                 $this->w3c = $inserted_data['inserted_data']['ca_w3c'];
                 $this->misc = $inserted_data['inserted_data']['ca_misc'];
                 $this->pageSpeed = $inserted_data['inserted_data']['ca_pagespeed'];
                 $this->grader = $inserted_data['inserted_data']['sg_info'];
                 $this->content['headings'] = @(array) json_decode($this->content['headings'], true);
                 $this->links['links'] = @(array) json_decode($this->links['links'], true);
                 $this->cloud['words'] = Utils::shuffle_assoc(@(array) json_decode($this->cloud['words'], true));
                 $this->cloud['matrix'] = @(array) json_decode($this->cloud['matrix'], true);
                 $this->meta['ogproperties'] = @(array) json_decode($this->meta['ogproperties'], true);
                 $this->content['deprecated'] = @(array) json_decode($this->content['deprecated'], true);
                 if ($this->misc) {
                     $this->misc['sitemap'] = @(array) json_decode($this->misc['sitemap'], true);
                     $this->misc['analytics'] = @(array) json_decode($this->misc['analytics'], true);
                 }
                 if ($this->pageSpeed) {
                     $pagespeed = $this->pageSpeed['data'];
                     $this->pageSpeed = @json_decode($pagespeed, true);
                 }
                 $this->strtime = strtotime($this->website['modified']);
                 $this->generated['A'] = date("A", $this->strtime);
                 $this->generated['Y'] = date("Y", $this->strtime);
                 $this->generated['M'] = date("M", $this->strtime);
                 $this->generated['d'] = date("d", $this->strtime);
                 $this->generated['H'] = date("H", $this->strtime);
                 $this->generated['i'] = date("i", $this->strtime);
                 $this->diff = time() - $this->strtime;
                 $pdf_path = FCPATH . '/assets/uploads/pdf/';
                 $pdf_name = $this->cronoutputpdf($pdf_path, 'web/pdf', array('F'));
                 $this->common_model->update_table(array('saved' => 1, 'pdf' => $pdf_name), array('id' => $this->wid), 'ca_website');
             }
         }
     }
 }
Exemplo n.º 3
0
 public function webinfo()
 {
     set_time_limit(0);
     $this->load->library('My_Webmaster');
     $return_data = array('status' => 0);
     $validation_obj = 'website_lead_info';
     $leadprocess = $this->secure_data($this->input->post('leadprocess'));
     if ($leadprocess == 1) {
         $validation_obj = 'website_lead_process';
     }
     if ($this->form_validation->run($validation_obj) == TRUE) {
         $mid = $this->secure_data($this->input->post('uid'));
         $user_data = getDbData('users', array('md5(id)' => $mid));
         if ($user_data) {
             $url = strtolower(rtrim($this->secure_data($this->input->post('domain')), '/'));
             $langArr = $this->config->item('langArr');
             $lang = $this->secure_data($this->input->post('lang'));
             if (!array_key_exists($lang, $langArr)) {
                 $lang = 'en';
             }
             $domain = addhttp($url);
             $ip = gethostbyname($url);
             $name = $this->secure_data($this->input->post('name'));
             $email = $this->secure_data($this->input->post('email'));
             $webmaster = new My_Webmaster();
             $webmaster->leadActive($name, $email);
             $inserted_data = $webmaster->insert($domain, $ip, $lang, $user_data['id']);
             //$return_data['url'] = base_url().'web/index/'.md5($return_data['wid']);
             // Insert in lead table
             if ($leadprocess != 1) {
                 $speed = '';
                 $pagespeed_data = json_decode($inserted_data['inserted_data']['ca_pagespeed']['data'], 1);
                 if (array_key_exists('mobile', $pagespeed_data)) {
                     $speed .= $pagespeed_data['mobile']['ruleGroups']['SPEED']['score'];
                     $speed .= '|' . $pagespeed_data['mobile']['ruleGroups']['USABILITY']['score'];
                 }
                 if (array_key_exists('desktop', $pagespeed_data)) {
                     $speed .= $speed !== '' ? '|' : '';
                     $speed .= $pagespeed_data['desktop']['ruleGroups']['SPEED']['score'];
                 }
                 $db_lead = array('agent_id' => $user_data['id'], 'web_id' => $inserted_data['wid'], 'name' => $name, 'email' => $email, 'domain' => $inserted_data['inserted_data']['ca_website']['domain'], 'language' => $lang, 'seo_score' => round($inserted_data['inserted_data']['ca_website']['score']), 'speed' => $speed, 'date' => date('Y-m-d H:i:s', time()));
                 $this->common_model->insert($db_lead, "leads");
             }
             $this->website = $inserted_data['inserted_data']['ca_website'];
             $this->domain = $this->website['domain'];
             $this->wid = $inserted_data['wid'];
             $this->thumbnail = WebsiteThumbnail::getUrl(array('{{Url}}' => $this->domain, '{{Size}}' => 'l'));
             $this->cloud = $inserted_data['inserted_data']['ca_cloud'];
             $this->content = $inserted_data['inserted_data']['ca_content'];
             $this->document = $inserted_data['inserted_data']['ca_document'];
             $this->isseter = $inserted_data['inserted_data']['ca_issetobject'];
             $this->links = $inserted_data['inserted_data']['ca_links'];
             $this->meta = $inserted_data['inserted_data']['ca_metatags'];
             $this->w3c = $inserted_data['inserted_data']['ca_w3c'];
             $this->misc = $inserted_data['inserted_data']['ca_misc'];
             $this->pageSpeed = $inserted_data['inserted_data']['ca_pagespeed'];
             $this->grader = $inserted_data['inserted_data']['sg_info'];
             $this->content['headings'] = @(array) json_decode($this->content['headings'], true);
             $this->links['links'] = @(array) json_decode($this->links['links'], true);
             $this->cloud['words'] = Utils::shuffle_assoc(@(array) json_decode($this->cloud['words'], true));
             $this->cloud['matrix'] = @(array) json_decode($this->cloud['matrix'], true);
             $this->meta['ogproperties'] = @(array) json_decode($this->meta['ogproperties'], true);
             $this->content['deprecated'] = @(array) json_decode($this->content['deprecated'], true);
             if ($this->misc) {
                 $this->misc['sitemap'] = @(array) json_decode($this->misc['sitemap'], true);
                 $this->misc['analytics'] = @(array) json_decode($this->misc['analytics'], true);
             }
             if ($this->pageSpeed) {
                 $pagespeed = $this->pageSpeed['data'];
                 $this->pageSpeed = @json_decode($pagespeed, true);
             }
             $this->strtime = strtotime($this->website['modified']);
             $this->generated['A'] = date("A", $this->strtime);
             $this->generated['Y'] = date("Y", $this->strtime);
             $this->generated['M'] = date("M", $this->strtime);
             $this->generated['d'] = date("d", $this->strtime);
             $this->generated['H'] = date("H", $this->strtime);
             $this->generated['i'] = date("i", $this->strtime);
             $this->diff = time() - $this->strtime;
             $pdf_path = FCPATH . '/assets/uploads/pdf/';
             $pdf_name = $this->cronoutputpdf($pdf_path, 'web/pdf', array('F'));
             $this->common_model->update_table(array('saved' => 1, 'pdf' => $pdf_name), array('id' => $this->wid), 'ca_website');
             // Send email with attachment
             $attachment = $pdf_path . $pdf_name;
             $this->email_send('lead-user', array('to' => $email, 'subject' => 'Audit for ' . $this->domain, 'name' => $name, 'domain' => $this->domain, 'attachments' => array($attachment)));
             // TODO: Show summary - Done
             $html = $this->load->view('leads/summary', array('website' => $this->website, "pageSpeed" => $this->pageSpeed, "grader" => $this->grader, "wid" => $this->wid), TRUE);
             $return_data['html'] = $html;
             $return_data['thumbnail'] = $this->thumbnail;
             $return_data['id'] = $this->wid;
             $return_data['status'] = 1;
             $return_data['message'] = "we will send the results to you on email";
         } else {
             $return_data['message'] = 'This agent is not exists.';
         }
     } else {
         $return_data['message'] = validation_errors();
     }
     echo json_encode($return_data);
     exit;
 }
Exemplo n.º 4
0
 public function webinfo()
 {
     set_time_limit(0);
     $this->check_post_ajax_request();
     $this->load->library('My_Webmaster');
     $return_data = array('status' => 0);
     $user_id = $this->session->userdata('user_id');
     $md5domain = $this->secure_data($this->input->post('md5domain'));
     //$lang = $this->config->item('langshort');
     $website_data = getDbData('ca_website', array('md5(id)' => $md5domain, 'user_id' => $user_id));
     if ($website_data) {
         $url = $website_data['domain'];
         $lang = $website_data['lang'];
         $domain = addhttp($url);
         $ip = gethostbyname($url);
         $webmaster = new My_Webmaster();
         $return_data = $webmaster->insert($domain, $ip, $lang);
         $return_data['url'] = base_url() . 'web/index/' . md5($return_data['wid']);
     } else {
         $return_data['message'] = 'An error occured';
     }
     echo json_encode($return_data);
     exit;
 }