예제 #1
0
}
switch ($mode) {
    case "show":
        $showprofile = true;
        $profile = get_user_profile($uid);
        $acList = get_user_achievements($uid, $owngroupids);
        if ($_SESSION['back'] != $_SERVER['PHP_SELF'] . "?mode=edit" && $_SESSION['back'] != $_SERVER['PHP_SELF'] && !strpos($_SESSION['back'], "expenses.php")) {
            $_SESSION['pshow_back'] = $_SESSION['back'];
            $backurl = $_SESSION['pshow_back'];
        } else {
            $backurl = $_SESSION['pshow_back'];
        }
        break;
    case "edit":
        $editprofile = true;
        $profile = get_user_profile($uid);
        $backurl = $_SERVER['PHP_SELF'];
        break;
    case "validate":
        include "inc/email_validator.php";
        // validate fields
        $errorString = "";
        if ($_POST['token'] != $_SESSION['token']) {
            $errorString[] = "Invalid token! (what are you doing??)<br />";
        }
        $token_age = time() - $_SESSION['token_time'];
        // force to resubmit after 5 minutes
        if ($token_age > 300) {
            $errorString[] = "Timout value exceeded, resubmit<br />";
        }
        if ($_POST['realname'] != $user->data['real_name'] && !is_valid_real_name($_POST['realname']) && $_POST['realname'] != "") {
예제 #2
0
function mail_expense($description, $amount, $type, $timestamp, $booker_userid, $groupid, $members, $eventid, $deposit = 0)
{
    if (!preg_match("/(,|\\.)/", $amount)) {
        $amount .= ".00";
    } elseif (preg_match("/,/", $amount)) {
        $amount = str_replace(",", ".", $amount);
    }
    $userList = array();
    foreach ($members as $id) {
        $userList[$id] = get_user_profile($id);
    }
    $allgroupmembers = get_groupmembers($groupid, false, true);
    $groupdetails = get_groupdetails($groupid);
    $balancelist = array_sort(get_group_balance_list($groupdetails), 'unformatted_balance', SORT_DESC);
    if ($deposit == 0) {
        $p1 = date('l jS \\of F Y');
        $p3 = number_format($amount, DECIMALS, DSEP, TSEP);
        $p4 = '';
        if (!empty($eventid)) {
            $eventdetails = get_eventdetails($eventid);
            $p4 = " for event \"{$eventdetails['eventname']}\"";
        }
        $p5 = $description;
        $p7 = number_format($amount / count($members), DECIMALS, DSEP, TSEP);
        $message = "On {1} {2} booked an expense of &#8364; {3}{4} with description \"{5}\".<br /><br />";
        $message .= "You were listed as a participant, together with {6}.<br /><br />";
        $message .= "The costs per person are &#8364; {7} making your balance &#8364; {8} which comes to position {9} in the group. ";
        $message .= "The balance list is now: <br /><br />{10}";
        $message .= "<br /><br /><a href=\"" . LOGIN_URL . "\">Going Dutch</a>";
        $from = '*****@*****.**';
        $from_name = 'Going Dutch';
        $subject = "Going Dutch expense booked in group \"{$groupdetails['name']}\"";
        $subject = addslashes($subject);
        foreach ($userList as $user) {
            // skip user if prefs are not set
            if (!isset($user['name_format']) || !isset($user['email_notify'])) {
                continue;
            }
            if ($user['user_id'] == $booker_userid) {
                $p2 = 'you have';
            } else {
                $p2 = format_name($user['name_format'], $userList[$booker_userid]['username'], $userList[$booker_userid]['realname']) . ' has';
            }
            $others = '';
            foreach ($members as $participant) {
                if ($participant != $user['user_id']) {
                    $others .= ', ' . format_name($user['name_format'], $userList[$participant]['username'], $userList[$participant]['realname']);
                }
            }
            //
            $p6 = preg_replace('/(.*),/', '$1 and', trim($others, ', '));
            //$text = preg_replace('/(.*),/','$1 and',$text)
            $p8 = $balancelist[$user['user_id']]['balance'];
            $i = 1;
            foreach ($balancelist as $key => $val) {
                if ($key == $user['user_id']) {
                    break;
                }
                $i++;
            }
            $p9 = $i;
            $tablehtml = create_memberlist_html_table($balancelist, $allgroupmembers, $user['name_format'], SORT_DESC);
            $p10 = $tablehtml;
            $a = 1;
            $body = str_format($message, $p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9, $p10);
            $pp = $amount / count($members);
            $floatval = floatval($user['email_notify']);
            if ($user['email_notify'] != '-1' && $pp >= $floatval) {
                // exec($command, $output = array());
                // smtpmailer($user['email'], $from, $from_name, $subject, $body, $replyto = '', $sendas='to');
                $replyto = '';
                $sendas = 'to';
                $background_mailfile = dirname(__FILE__) . '/background_mailer.php';
                //$output = '/var/log/test';
                $output = '/dev/null';
                $body = addslashes($body);
                $cmd = "/usr/bin/php5 {$background_mailfile} {$user['email']} {$from} \"{$from_name}\" \"{$subject}\" \"{$body}\" \"{$replyto}\" \"{$sendas}\"";
                //exec("/usr/bin/php {$background_mailfile} {$user['email']} {$from} {$from_name} {$subject} {$body} {$replyto} {$sendas} > {$ouput} &");
                exec("{$cmd} > {$output} &");
                //exec("/usr/bin/php {$background_mailfile} {$user['email']} {$from} \"{$from_name}\" \"{$subject}\" \"{$body}\" \"{$replyto}\" \"{$sendas}\" > {$output} &");
            }
        }
        //
        //      foreach ($members as $key => $value) {
        //
        //      }
        //$mysqldate = date('Y-m-d H:i:s', $timestamp);
        $sql = "INSERT INTO expenses (type, user_id, group_id, description, amount, expense_date, event_id, timestamp, currency) \n            VALUES ('{$type}', '{$userid}', '{$groupid}', '{$description}', '{$amount}', FROM_UNIXTIME({$timestamp}), {$eventid}, CURRENT_TIMESTAMP , '1')";
        //    if (!$result = mysql_query($sql)) {
        //      return false;
        //    } else {
        //      $expenseid = mysql_insert_id();
        //      foreach ($members as $key => $value) {
        //        $sql = "INSERT INTO users_expenses (`user_id` , `expense_id`) VALUES ('$value', '$expenseid')";
        //        if (!$result = mysql_query($sql)) {
        //          $inserterror = true;
        //        }
        //      }
        //      if ($inserterror)
        //        return false;
        //      return true;
        //    }
    } else {
        // making a deposit
        // for each person, make an expense with only deposit holder ($userid) as recipient
        // first register deposit to get a deposit id
        //    $sql = "INSERT INTO deposits (holder, description) VALUES ($userid, '$description')";
        //    if (!$result = mysql_query($sql)) {
        //      return false;
        //    } else {
        //      $depositid = mysql_insert_id();
        //    }
        //
        //    foreach ($members as $key => $value) {
        //      $sql = "INSERT INTO expenses (type, user_id, group_id, description, amount, expense_date, event_id, timestamp, currency, deposit_id)
        //            VALUES ('$type', '$value', '$groupid', '$description', '$amount', FROM_UNIXTIME($timestamp), $eventid, CURRENT_TIMESTAMP , '1', $depositid)";
        //      if (!$result = mysql_query($sql)) {
        //        return false;
        //      } else {
        //        $expenseid = mysql_insert_id();
        //        $sql = "INSERT INTO users_expenses (`user_id` , `expense_id`) VALUES ('$userid', '$expenseid')";
        //        if (!$result = mysql_query($sql)) {
        //          $inserterror = true;
        //        }
        //      }
        //    }
    }
    if ($inserterror) {
        return false;
    }
    return true;
}
<?php

//
require 'page_top.html';
print '<h2>Engagement Account</h2>';
require '../config.php';
require '../db_lib.php';
$db = new db();
// Display a single user based on the $engagement_user_id
// $engagement_user_id is stored in config.php
require '../get_user_profile.php';
$users = get_user_profile($engagement_user_id);
require 'display_users.php';
// Display a single tweet based on the $engagement_user_id
require '../get_last_tweet.php';
$tweets = get_last_tweet($engagement_user_id);
require 'display_tweets.php';
require 'page_bottom.html';
//
require '../config.php';
require '../db_lib.php';
$db = new db();
require 'page_top.html';
print '<link rel="stylesheet" type="text/css" media="all" href="user_profile.css" />';
// Confirm that a user_id argument was passed in URL
if (!isset($_GET['user_id'])) {
    print 'User id is required';
    exit;
}
// Convert to integer before using in SQL query
$user_id = intval($_GET['user_id']);
require '../get_user_profile.php';
$user = get_user_profile($user_id);
if (sizeof(user) == 0) {
    print "User not found";
    exit;
}
// Only one user is returned, so extract its row
$user_row = $user[0];
$screen_name = $user_row['screen_name'];
print '<h2>Profile of: @' . $screen_name . '</h2>';
// Display user's account profile
print '<div class="column">';
print '<div><div id="user_image"><img src="' . $user_row['profile_image_url'] . '"></div>';
if ($user_row['protected']) {
    print '<img src="images/protected.png" alt="Account is protected" title="Account is protected" style="margin-bottom: -1px;"/> ';
}
if ($user_row['suspended']) {
예제 #5
0
"><?php 
        echo $news->title;
        ?>
</a></h4><?php 
    }
    ?>
			<img src="<?php 
    echo assets_url('uploads/' . $news->image);
    ?>
" alt="<?php 
    echo $news->title;
    ?>
" class="img-responsive" />
			<p class="alert alert-warning author-info">
				<?php 
    $author = get_user_profile($news->iduser);
    echo ($author->gravatar_email ? '<img src="' . get_gravatar($author->gravatar_email, 16) . '" class="gravatar" title="' . ($author->display_name ? $author->display_name : $author->first_name . ' ' . substr($author->last_name, 0, 1)) . '" /> ' : '<i class="fa fa-fw fa-user"></i> ') . ($author ? $author->display_name : $author->first_name . ' ' . substr($author->last_name, 0, 1));
    ?>
				<i class="fa fa-fw fa-calendar-o"></i> <?php 
    echo date('d M, Y h:i a', strtotime($news->add_date));
    ?>
			</p>
			<div class="news-excerpt">
				<?php 
    echo substr(strip_tags($news->body), 0, $length);
    ?>
 ... <a href="<?php 
    echo base_url('news/detail/' . $news->idpost);
    ?>
">read more <i class="fa fa-fw fa-external-link"></i></a>
			</div>
예제 #6
0
        $obj->save();
        render_json($obj->toArray());
    });
    $app->get('/signin/:id', function ($id) use($app) {
        $helphour = helpHourQuery::create()->findPk($id);
        if (!require_authenticated(false, $helphour->getUser()->getNetid())) {
            return;
        }
        if (signin_helphour($helphour)) {
            render_json("Signed in correctly.");
        } else {
            render_json("Already signed in or other error.");
        }
    });
});
$app->get('/whoami', function () use($app) {
    $who = get_loggedin_info();
    $who['profile'] = get_user_profile($who['username'])->toArray();
    render_json($who);
});
$app->post('/contact', function () use($app) {
    $data = $app->request->getBody();
    if (!$data) {
        $app->stop();
    }
    $data = json_decode($data, true);
    $data['fromName'] = array_key_exists('fromName', $data) ? $data['fromName'] : "Anonymous";
    $data['fromEmail'] = array_key_exists('fromEmail', $data) ? $data['fromEmail'] : "anon@anon";
    send_contactform_email($data['fromName'], $data['fromEmail'], $data['message']);
});
$app->run();
예제 #7
0
파일: index.php 프로젝트: juliosolis/verge
    User::logout();
    $app->redirect('/');
});
function get_user_profile($app)
{
    $app->set('user', User::get_by_username($app->request('username')));
    $app->set('is_current_user', $app->request('username') == User::current_user() ? true : false);
    $app->set('posts', Post::get_posts_by_user($app->request('username'), $app->request('skip') ? $app->request('skip') : 0));
    $app->set('post_count', Post::get_post_count_by_user($app->request('username')));
}
get('/user/:username', function ($app) {
    get_user_profile($app);
    $app->render('user/profile');
});
get('/user/:username/:skip', function ($app) {
    get_user_profile($app);
    $app->render('user/_posts', false);
});
post('/post', function ($app) {
    if (User::is_authenticated()) {
        $post = new Post();
        $post->content = $app->form('content');
        $post->create();
        $app->redirect('/user/' . User::current_user());
    } else {
        $app->set('error', 'You must be logged in to do that.');
        $app->render('user/login');
    }
});
delete('/post/delete/:id/:rev', function ($app) {
    $post = new Post();
예제 #8
0
<?php

require_once "header.php";
require_once "function.php";
require_once "sidemenu.php";
?>

<?php 
if (!isset($_GET['id'])) {
    echo "<script>window.location='index.php';</script>";
    exit;
}
$job = job_type($_GET['id']);
$project = get_project_details($_GET['id']);
$total_mp = total_mp_pmb($_GET['id']);
$project_job = get_user_profile($_GET['id']);
if ($project['username'] == NULL) {
    echo "<script>window.location='index.php'</script>";
    exit;
}
?>

<SCRIPT>
function GetXmlHttpObject()
{
var XMLHttpRequestObject=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  XMLHttpRequestObject=new XMLHttpRequest();
  }
예제 #9
0
 public function pdf($idpost)
 {
     $post = $this->news->get($idpost);
     if (!$post) {
         $this->template->alert('Could not load the requested item', 'warning');
         redirect('news');
         return;
     }
     $data['title'] = $post->title . ' | News Portal';
     $data['news'] = $post;
     $data['author'] = get_user_profile($data['news']->iduser);
     $data['sidebar'] = FALSE;
     $data['template_name'] = $this->template->get();
     $data['pdf'] = TRUE;
     $this->load->library('pdf');
     $this->pdf->generate($this->template->get() . '/layout', array('data' => $data, 'view' => $this->template->get() . '/news/detail'));
     $this->pdf->Output("news_" . $idpost . ".pdf", "D");
 }
예제 #10
0
    } else {
        if ($res == 2) {
            $_SESSION["message"] = "You already sent friend request";
            echo $_SESSION["message"];
        } else {
            $_SESSION["message"] = "Friend request failed";
            echo $_SESSION["message"];
        }
    }
    redirect_to("user_profile.php?user_name={$user_request}");
}
?>
		  
			<?php 
$user_name = $_GET["user_name"];
$result = get_user_profile($user_name);
$row = mysqli_fetch_assoc($result);
$friend_list = $row["friends"];
$friend_list = trim($friend_list);
$friend_list = explode(' ', $friend_list);
echo "<table class=\"profile\">";
if (isset($row["profile_pic"]) && !empty($row["profile_pic"])) {
    echo "<tr><td>Profile Pic</td>";
    $pic = $row["profile_pic"];
    echo '<td><img src="' . PATH . $pic . '" height=80 width="100" /></td></tr>';
} else {
    echo "<tr><td>Profile Pic</td>";
    echo '<td><img src="images/default_pic.jpeg" height=60 /></td></tr>';
}
echo "<tr><td>Name</td>";
echo "<td>{$row['name']}</td></tr>";
예제 #11
0
</table>    
<table width="40%" border="0" align="right">
  <tr height="20" bgcolor="#dde1e8">
	    <!--Verified Webmaster-->
	<td align="center">
		<table align="right" border="0">
		<tr height="20" bgcolor="#dde1e8">
			<td>&nbsp;<b>Webmasters</b></td>
			<td>&nbsp;<b>Ratings</b></td>
			<td>&nbsp;<b>Reviews</b></td>
		</tr>
		<?php 
$sql = "SELECT *,date_format(users.created_time,'%m/%d/%Y') as created_time FROM `users` ";
$link = mysql_query($sql, $_SESSION['cn']) or die("Error cetified_members.php:" . mysql_error());
while ($row = mysql_fetch_assoc($link)) {
    $user_account = get_user_profile($row['username']);
    foreach ($user_account as $web) {
        if ($web['user_type'] == "w" && $web['certified'] == "1") {
            echo "\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td>&nbsp;<b><font color=\"#0000FF\">" . strtoupper($web['username']) . "</font></b></td>\r\n\t\t\t\t\t\t\t<td>&nbsp;" . $web['total_rating'] . "</td>\r\n\t\t\t\t\t\t\t<td>&nbsp;" . $web['reviews'] . "</td>\r\n\t\t\t\t\t\t</tr>";
        }
    }
}
?>
		</table>
   </td>
  </tr>
</table>
</td>
</tr>
</table>
<?php 
예제 #12
0
} else {
    $mode = "show";
}
if (isset($_SESSION['back'])) {
    $url = $_SESSION['back'];
} else {
    $host = $_SERVER['HTTP_HOST'];
    $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
    $extra = LOGINPAGE;
    $url = "http://{$host}{$uri}/{$extra}";
}
switch ($mode) {
    case "show":
        $showprofile = true;
        $profile = get_user_profile($user->data['user_id']);
        break;
    case "edit":
        $editprofile = true;
        $profile = get_user_profile($user->data['user_id']);
        $backurl = $url;
        break;
}
// start HTML output
print_header();
$topbar['title'] = "Profile";
$topbar['leftnav'][0]['name'] = "Back";
$topbar['leftnav'][0]['url'] = $url;
print_topbar($topbar);
print_body_start();
print_profile_html($profile, $user->data['user_id']);
print_footer($user, 6);