Example #1
0
 /**
  * Build Slack Attachment payload
  *
  * @param Exception $e
  *
  * @return Attachment
  */
 protected function buildAttachment($e)
 {
     if (!$e instanceof Exception) {
         throw new InvalidArgumentException(sprintf("Expecting instance of \\Exception, %s given.", gettype($e)));
     }
     $eClass = get_class($e);
     $username = auth()->check() ? auth()->user()->username : '******';
     $email = auth()->check() ? auth()->user()->email : 'no-such-user';
     $route = Route::getCurrentRoute() ?: 'not-existing-route';
     return new Attachment(['fallback' => null, 'text' => "{$e->getMessage()} {$eClass}: {$e->getLine()}", 'fields' => [new AttachmentField(['title' => 'Time', 'value' => Carbon::now('Asia/Seoul')->toDateTimeString(), 'short' => true]), new AttachmentField(['title' => 'User', 'value' => "<" . 'http:' . get_profile_url($email) . "|{$username}>", 'short' => true]), new AttachmentField(['title' => 'Route', 'value' => $route, 'short' => true]), new AttachmentField(['title' => 'Class', 'value' => "{$eClass}: {$e->getLine()}"]), new AttachmentField(['title' => 'File', 'value' => $e->getFile()]), new AttachmentField(['title' => 'Message', 'value' => $e->getMessage()]), new AttachmentField(['title' => 'Remote IP', 'value' => Request::ip()]), new AttachmentField(['title' => 'Request Url', 'value' => sprintf("%s %s", Request::method(), Request::fullUrl())]), new AttachmentField(['title' => 'Request Headers', 'value' => Request::header()]), new AttachmentField(['title' => 'Request Content', 'value' => Request::instance()->getContent() ?: json_encode(Request::all())])]]);
 }
Example #2
0
File: mc.php Project: rjha/sc
function fetch_page_email($pageNo)
{
    $DOT = ".";
    $g_ofile = "mc.page" . $pageNo . $DOT . "email";
    $fhandle = fopen($g_ofile, "w");
    //get page
    $pageUrl = "http://www.mediaclubofindia.com/profiles/friend/list?page=" . $pageNo;
    $pageHtml = fetch_page($pageUrl);
    printf("page = %s \n", $pageUrl);
    $profiles = get_profile_url($pageHtml);
    //print_r($profiles); exit ;
    foreach ($profiles as $profile) {
        $buffer = get_profile_email($profile);
        fwrite($fhandle, $buffer);
    }
}
Example #3
0
function main_loop()
{
    global $g_root;
    global $g_ofile;
    $fhandle = fopen($g_ofile, "w");
    //rajeev - till 1000
    for ($page = 201; $page <= 300; $page++) {
        $pageUrl = $g_root . $page;
        $profiles = get_profile_url($pageUrl);
        foreach ($profiles as $profile) {
            $data = get_profile_email($profile);
            $buffer = NULL;
            if (empty($data) || is_null($data)) {
                $buffer = sprintf("__NO_DATA__ %s \n", $profile);
            } else {
                $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]);
            }
            fwrite($fhandle, $buffer);
        }
    }
    //close resources
    fclose($fhandle);
}
Example #4
0
File: profiles.php Project: rjha/sc
function main_loop()
{
    $root = "http://toostep.com/knowledge/a/all/popular/";
    $ofile = "toostep.email";
    $fhandle = fopen($ofile, "a");
    //rajeev - till 1000
    for ($page = 101; $page <= 200; $page++) {
        $pageUrl = $root . $page;
        $profiles = get_profile_url($pageUrl);
        foreach ($profiles as $profile) {
            $data = get_profile_email($profile);
            $buffer = NULL;
            if (empty($data) || is_null($data)) {
                $buffer = sprintf("__NO_DATA__ %s \n", $profile);
            } else {
                $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]);
            }
            fwrite($fhandle, $buffer);
        }
    }
    //close resources
    fclose($fhandle);
}
Example #5
0
function run_on_name($ch, $name, $pageNo)
{
    global $g_debug;
    $DOT = ".";
    $g_ofile = urlencode($name) . $DOT . time() . $DOT . "email";
    $fhandle = fopen($g_ofile, "w");
    while (1) {
        $dtime = time() . "999";
        $params = array("pageNo" => $pageNo, "type" => "page", "archive" => "0", "d" => $dtime);
        $qstring = http_build_query($params);
        $pageUrl = "http://toostep.com/searchUserAjax.html?" . $qstring;
        if ($g_debug) {
            print_r($params);
            printf("page = %s \n", $pageUrl);
        }
        $pageHtml = do_post($ch, $pageUrl, $name);
        if ($g_debug) {
            echo $pageHtml;
        }
        $profiles = get_profile_url($pageHtml);
        if (sizeof($profiles) == 0) {
            fclose($fhandle);
            //name processing finished
            return;
        }
        //print_r($profiles); exit ;
        //use profiles to get emails
        foreach ($profiles as $profile) {
            $data = get_profile_email($profile);
            $buffer = NULL;
            if (empty($data) || is_null($data)) {
                $buffer = sprintf("__NO_DATA__ %s \n", $profile);
            } else {
                $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]);
            }
            fwrite($fhandle, $buffer);
        }
        $pageNo++;
    }
}
 /**
  * Prints the users profile link
  * 
  * @param unknown_type $user_id
  * @return null
  * @since 1.2
  */
 function profile_url($user_id = null)
 {
     echo get_profile_url($user_id);
 }
Example #7
0
function ferinagreeting()
{
    if (get_wp_session('ferinauser')) {
        $namagw = __('Hi Member', 'ferina');
        $firsturl = '<a href="' . get_profile_url() . '">' . __('My Account', 'ferina') . '</a>';
        $secondurl = '<a href="#" title="' . __('Logout', 'ferina') . '" id="menu-account-logout">' . __('Logout', 'ferina') . '</a>';
    } else {
        $namagw = __('My Account', 'ferina');
        $firsturl = '<a title="' . __('Login', 'ferina') . '" id="menu-account-login" href="#">' . __('Login', 'ferina') . '</a>';
        $secondurl = '<a title="' . __('Register', 'ferina') . '" id="menu-account-register" class="Open_reg" href="#">' . __('Register', 'ferina') . '</a>';
    }
    return array('greeting' => $namagw, 'urlsatu' => $firsturl, 'urldua' => $secondurl);
}
Example #8
0
File: ns.php Project: rjha/sc
function run_on_name($name, $pageNo, $lookup)
{
    global $g_debug;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20100101 Firefox/10.0.7 Iceweasel/10.0.7");
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $prefix = date("d-M-y");
    $g_ofile = $prefix . "/" . $name . ".email." . time();
    if (!file_exists(dirname($g_ofile))) {
        mkdir(dirname($g_ofile), 0755, true);
    }
    $fhandle = fopen($g_ofile, "w");
    while (1) {
        $dtime = time() . "999";
        $params = array("pageNo" => $pageNo, "type" => "page", "archive" => "0", "d" => $dtime);
        $qstring = http_build_query($params);
        $pageUrl = "http://toostep.com/searchUserAjax.html?" . $qstring;
        $pageHtml = do_post($ch, $pageUrl, $name);
        if ($g_debug) {
            printf(" \n\n ------ dumping search page having profiles ----- \n\n");
            echo $pageHtml;
        }
        $profiles = get_profile_url($pageHtml);
        if (sizeof($profiles) == 0) {
            //free resources
            curl_close($ch);
            fclose($fhandle);
            //name processing finished
            return;
        }
        if ($g_debug) {
            printf(" \n\n ------- dumping extracted profiles from search page ----- \n\n ");
            print_r($profiles);
        }
        //use profiles to get emails
        foreach ($profiles as $profile) {
            $data = get_profile_email($profile);
            $buffer = NULL;
            if (empty($data) || is_null($data)) {
                $buffer = sprintf("__NO_DATA__ %s \n", $profile);
            } else {
                $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]);
            }
            fwrite($fhandle, $buffer);
            if ($g_debug) {
                printf(" \n ----- wrote [%s] ----- \n ", $buffer);
            }
        }
        printf("processed %s - page %s \n", $name, $pageNo);
        $pageNo++;
        $lookup[$name] = $pageNo;
        //save name -page_no to disk
        save_lookup($lookup);
    }
}