Example #1
0
 public function isAuthorized()
 {
     if (Project::getInstance()->getCurUser()->id) {
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * Returns a project's release info from the update service.
  *
  * @param array $request
  *   A request array.
  *
  * @param bool $refresh
  *   Whether to discard cached object.
  *
  * @return \Drush\UpdateService\Project
  */
 public function get($request, $refresh = FALSE)
 {
     if ($refresh || !isset($this->cache[$request['name']])) {
         $project_release_info = Project::getInstance($request, $this->getCacheDuration());
         if ($project_release_info && !$project_release_info->isValid()) {
             $project_release_info = FALSE;
         }
         $this->cache[$request['name']] = $project_release_info;
     }
     return $this->cache[$request['name']];
 }
function showFavouritesPage()
{
    if (Users::isStudent()) {
        $my_id = Users::getMyId();
        $projects = Project::getInstance()->getFavouriteProjects();
        if ($projects) {
            echo "<ul>";
            foreach ($projects as $project) {
                echo "<li><a href='" . _WEB_URL . "/projects/browse?pid=" . $project->pid . "'>" . $project->title . "</a></li>";
            }
            echo "</ul>";
        } else {
            echo t('You have no projects marked as favourite yet. By browsing them you can mark them as you find them interesting');
        }
    } else {
        echo t('You must be a student to have kept a favourite list');
    }
}
Example #4
0
 /**
  * Получаем все планы в виде массива
  *
  * @param boolean $disabled выводить ли выключенные планы 
  * @return array
  */
 public function getAll($disabled = false)
 {
     $where = 'where 1=1 ';
     if ($disabled) {
         $where .= '';
     } else {
         $where .= ' and status="1"';
     }
     include_once LIB_ROOT . '/users/user.class.php';
     if (Project::getInstance()->getCurUser()->isAdmin()) {
         $where .= '';
     } elseif (Project::getInstance()->getCurUser()->monitor == 1) {
         $where .= ' and type in (1, 2)';
     } else {
         $where .= ' and type in (0, 2)';
     }
     $result = sql_query('select * from plans ' . $where . ' order by id');
     $plans = array();
     while ($row = mysql_fetch_assoc($result)) {
         $plans[] = $row;
     }
     return $plans;
 }
Example #5
0
				SUM(IF(t.type="r", t.amount, NULL)) as referral,
				SUM(IF(t.type="i", t.amount, NULL)) as reinvest,
				SUM(IF(t.type="b", t.amount, NULL)) as bonus
			FROM users
			LEFT JOIN translines as t ON t.user_id = users.id AND t.stamp < ' . Project::getInstance()->getNow() . ' AND t.status > 0
			GROUP BY users.id
			ORDER BY ' . (!empty($_REQUEST['order_by']) ? addslashes($_REQUEST['order_by']) : 'reg_date DESC') . '
			' . get_limit() . '
		');
        $users = array();
        while ($row = mysql_fetch_assoc($result)) {
            $row['ips'] = isset($ips[$row['id']]) ? $ips[$row['id']] : array();
            $row['bads'] = isset($bads[$row['id']]) ? intval($bads[$row['id']]) : 0;
            $row['ipsec'] = 0;
            $users[$row['id']] = $row;
        }
        foreach ($users_by_ips as $ip => $u_ids) {
            if (count($u_ids) > 1) {
                foreach ($u_ids as $u_id) {
                    if (!isset($users[$u_id])) {
                        continue;
                    }
                    $users[$u_id]['ipsec'] = 1;
                    $users[$u_id]['ips'][$ip] = '(' . implode(',', $u_ids) . ')';
                }
            }
        }
        Project::getInstance()->getSmarty()->assign('pagination', pagination(sql_get('SELECT FOUND_ROWS()')));
        Project::getInstance()->getSmarty()->assign('users', stripslashes_array($users));
        Project::getInstance()->getSmarty()->display('../default/admin/users.tpl');
}
Example #6
0
     echo "<div id='msg_{$target}'></div>";
     $form = drupal_get_form("vals_soc_project_form", '', $target, $org);
     renderForm($form, $target);
     break;
 case 'save':
     $type = altSubValue($_POST, 'type', '');
     $id = altSubValue($_POST, 'id', '');
     $draft = altSubValue($_POST, 'draft', false);
     $properties = Project::getInstance()->filterPostLite(Project::getInstance()->getKeylessFields(), $_POST);
     $properties['state'] = $draft ? 'draft' : 'pending';
     if (!$id) {
         $new = $properties['org_id'];
         $result = Project::getInstance()->addProject($properties);
     } else {
         $new = false;
         $result = Project::getInstance()->changeProject($properties, $id);
     }
     if ($result) {
         echo json_encode(array('result' => TRUE, 'id' => $id, 'type' => $type, 'new_tab' => !$id ? $properties['org_id'] : 0, 'extra' => $mine ? array('mine' => 1) : '', 'msg' => ($id ? tt('You succesfully changed the data of your %1$s', t_type($type)) : tt('You succesfully added your %1$s', t_type($type))) . (_DEBUG ? showDrupalMessages() : '')));
     } else {
         echo jsonBadResult();
     }
     break;
 case 'show':
     $show_last = altSubValue($_POST, 'new_tab', false);
     $owner_only = altSubValue($_POST, 'mine', false);
     showProjectPage($show_last, $owner_only);
     break;
 case 'edit':
     $type = altSubValue($_POST, 'type', '');
     $id = altSubValue($_POST, 'id', '');
Example #7
0
        $valid = false;
    }
    if ($_POST['login'] == $_POST['referral']) {
        $_POST['referral'] = '';
    }
    if ($valid) {
        $user = new User();
        $_POST['pm_member_id'] = !empty($_POST['pm_member_id']) ? $_POST['pm_member_id'] : '';
        $_POST['secpin'] = $_POST['secpin_signup'];
        $_POST['masterpin'] = $_POST['masterpin_signup'];
        $_POST['reg_date'] = Project::getInstance()->getNow();
        $user->setData(sql_escapeArray($_POST));
        $user->access = ACCESS_LEVEL_USER;
        $user->status = USER_STATUS_ACTIVE;
        if ($user_id = $user->save()) {
            $page_tpl = 'signup_ok.tpl';
            include_once LIB_ROOT . '/emails.class.php';
            $params = array('%user_fullname%' => $user->fullname, '%user_login%' => $user->login, '%user_password%' => $user->password, '%user_secpin%' => $user->secpin, '%user_masterpin%' => $user->masterpin, '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'));
            $email = new Emails($user_id, 'signup_notify', $params);
            $email->send();
        }
    } else {
        Project::getInstance()->getSmarty()->assign('signup', $_POST);
        $page_tpl = 'signup.tpl';
    }
} else {
    $page_tpl = 'signup.tpl';
    Project::getInstance()->getSmarty()->assign('signup', array($_SESSION['referral']));
}
Project::getInstance()->showPage($page_tpl);
Example #8
0
function showProposalsForProject($project_id, $show_only_mine)
{
    global $base_url;
    $url_type = (bool) $show_only_mine ? '/mine' : '';
    echo '<div id="baktoprops"><a href=" ' . $base_url . '/dashboard/proposals/browsebytype' . $url_type . '">' . t('Back to proposals overview') . '</a></div>';
    $project = Project::getInstance()->getProjectById($project_id);
    echo '<h2>' . t('Proposals for project idea \'' . $project['title']) . '\'</h2>';
    ?>
		<div id="TableContainer" style="width: 800px;"></div>
		<script type="text/javascript">

				jQuery(document).ready(function($){
					window.view_settings = {};

					function loadFilteredProposals(){
						$("#TableContainer").jtable("load", {
							project: <?php 
    echo $project_id;
    ?>
						});
					}

				    //Prepare jTable
					$("#TableContainer").jtable({
						paging: true,
						pageSize: 10,
						sorting: true,
						defaultSorting: "pid ASC",
						actions: {
							listAction: moduleUrl + "actions/proposal_actions.php?action=list_proposals"
						},
						fields: {
							proposal_id: {
								key: true,
								create: false,
								edit: false,
								list: false
							},
							owner_id: {
								title: "Student",
								width: "30%",
								display: function (data){
									var uname_text ='';
									if(data.record.name){
										uname_text = data.record.name;
									}else{
										uname_text = data.record.u_name;
									}
									if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==0){
										uname_text += "&nbsp;<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-link\" title=\"You have set this proposal as your interim favourite for your project idea.\">&nbsp;</span>";
									}
									if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==1){
										uname_text += "&nbsp;<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-check\" title=\"You have chosen to offer this student the project.\">&nbsp;</span>";
									}

									return uname_text;
								}
							},
							inst_id: {
								title: "Institute",
								width: "26%",
								create: false,
								edit: false,
								display: function (data){return data.record.i_name;}
							},
							solution_short : {
								//width: "2%",
		    					title: "Proposal details",
								sorting: false,
		    					display: function (data) {
			    					console.log(data.record);
		    						if(data.record.state == 'rejected'){
										return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
										"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
											"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
											"&nbsp;<span style=\"float:left;display:inline;\" class=\"\" title=\"You have rejected this proposal for your project idea.\">"+
											"&nbsp;&nbsp;<div style=\"display:inline;\">Rejected</div></span>";
		    						}
		    						else if(data.record.state == 'archived'){
										return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
										"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
											"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
											"&nbsp;<span style=\"float:left;display:inline;\" class=\"\" title=\"This proposal has been archived because another student accepted your offer or this student accepted another offer.\">"+
											"&nbsp;&nbsp;<div style=\"display:inline;\">Archived</div></span>";
		    						}
		    						else if(data.record.state == 'draft'){
										return "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
										"<span style=\"display:inline;\" class=\"\" title=\"This proposal is in draft mode and not yet visible.\">"+
										"&nbsp;&nbsp;<div style=\"display:inline;\">Draft only</div></span>";
		    						}
		    						else if(data.record.state == 'accepted'){
										return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
										"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
											"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
											"&nbsp;<span style=\"float:left;display:inline;\" class=\"\" title=\"This proposal has been accepted by the student as their final choice.\">"+
											"&nbsp;&nbsp;<div style=\"display:inline;\">Accepted</div></span>";

		    						}
									else if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==0){
										return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
										"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
											"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
											"&nbsp;<span style=\"float:left;display:inline;\" class=\"\" title=\"You have set this proposal as your interm favourite for your project idea.\">"+
											"&nbsp;&nbsp;<div style=\"display:inline;\">Interim</div></span>";
									}
									else if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==1){
											return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
											"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
												"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
												"&nbsp;<span style=\"float:left;display:inline;\" class=\"\" title=\"You have chosen to offer this student the project.\">"+
												"&nbsp;&nbsp;<div style=\"display:inline;\">Offered</div></span>";
									}
									else{
										return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
										"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
											"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
											"&nbsp;<span style=\"float:left;display:inline;\" class=\"\" title=\"This proposal is "+data.record.state+"\">"+
											"&nbsp;&nbsp;<div style=\"display:inline;\">"+data.record.state+"</div></span>";
									}
		    					},

		    					create: false,
		    					edit: false
							},
						},
					});
					//Load proposal list from server on initial page load
					loadFilteredProposals();
				});
			</script><?php 
}
Example #9
0
<?php

$ACCESS_LEVEL = 1;
include_once DOC_ROOT . '/includes/authorization.php';
Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser());
if (isset($_REQUEST['id'])) {
    $message = new UserMessage(intval($_REQUEST['id']));
    if ($message->id) {
        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'read') {
            Project::getInstance()->getSmarty()->assign('from', 'Support');
            Project::getInstance()->getSmarty()->assign('title', $message->title);
            Project::getInstance()->getSmarty()->assign('text', nl2br($message->message));
            Project::getInstance()->showPage('user/message.tpl');
            $message->readed = 1;
            $message->save();
        } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
            $message->delete();
            header('Location: /user/messages.php');
        }
    }
} else {
    $user_messages_list = new UserMessageList(Project::getInstance()->getCurUser());
    Project::getInstance()->getSmarty()->assign('messages', $user_messages_list->getList());
    Project::getInstance()->showPage('user/messages.tpl');
}
Example #10
0
						</form>
						<script language="Javascript">
						$("#pm_form").submit();
						</script>
					';
                    location($_SERVER['PHP_SELF'], $pm_form);
                } elseif ($_POST['source'] == 'LR') {
                    header('Location: https://sci.libertyreserve.com/?lr_acc=' . get_setting('lr_account_deposit') . '&lr_acc_from=' . $user['account'] . '&lr_amnt=' . floatval($_POST['amount']) . '&lr_currency=LRUSD&lr_comments=' . urlencode('Deposit for account: ' . $user['login']) . '&lr_success_url=' . urlencode('http' . (SSL ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/index.php?action=success') . '&lr_success_url_method=GET&lr_fail_url=' . urlencode('http' . (SSL ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/index.php?action=fail') . '&lr_fail_url_method=GET&lr_store=' . get_setting('lr_store') . '&lr_status_url=' . urlencode('http' . (SSL ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/status.php') . '&lr_status_url_method=GET&payment_id=' . sql_insert_id());
                }
            }
        } else {
            location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> Incorrect amount has been defined!</p>');
        }
    } else {
        location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> Investment plan does not exist!</p>');
    }
} else {
    $plans = array();
    $result = sql_query('
		SELECT 
			* 
		FROM plans 
		WHERE type in (' . (Project::getInstance()->getCurUser()->monitor ? '1, 2' : '0,2') . ')
		ORDER BY id
	');
    while ($row = mysql_fetch_assoc($result)) {
        $plans[] = $row;
    }
    Project::getInstance()->getSmarty()->assign('plans', stripslashes_array($plans));
    Project::getInstance()->showPage('user/deposit.tpl');
}
Example #11
0
                $params = array('%user_fullname%' => htmlspecialchars($user['fullname']), '%user_login%' => $user['login'], '%account%' => $user['account'], '%amount%' => floatval($_POST['amount']), '%batch%' => $reciept_id, '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
                $email = new Emails(Project::getInstance()->getCurUser()->id, 'withdrawal_notify', $params);
                $email->send();
            }
            location($_SERVER['PHP_SELF'], '<p class=imp><strong>Achievement:</strong> Operation has been completed, check your account!</p>');
        } else {
            //���� �� ������ ������, �� ���������� � bad_withdrawals
            $gw_balance = $gateway->getBalance($account);
            if (Project::getInstance()->getCurUser()->payment_system == 'PM') {
                $gw_balance = $gw_balance[get_setting('pm_account')];
            }
            sql_query('
				INSERT INTO bad_withdrawals 
				SET 
					id=0, 
					user_id="' . $user['id'] . '", 
					amount= "' . floatval($_POST['amount']) . '", 
					gw_balance="' . floatval($gw_balance) . '", 
					stamp="' . Project::getInstance()->getNow() . '"');
            location($_SERVER['PHP_SELF'], '<p class=imp><strong>Notification:</strong> The action can not be done, please try again later!</p>');
        }
    } else {
        location($_SERVER['PHP_SELF'], '<p class=imp><strong>Alert:</strong> You have defined not valid amount or your available balance is too low to request the withdrawal!');
    }
} else {
    if ($user['monitor'] == 1) {
        $balance = floatval($user['bonus'] + $user['reinvest'] > 0 ? $balance - ($user['bonus'] + $user['reinvest']) : $balance);
    }
    Project::getInstance()->getSmarty()->assign('balance', $balance);
    Project::getInstance()->showPage('user/withdraw.tpl');
}
Example #12
0
<?php

$ACCESS_LEVEL = ACCESS_LEVEL_GUEST;
include_once DOC_ROOT . '/includes/authorization.php';
if (AuthController::getInstance()->isAuthorized()) {
    $user = new User(Project::getInstance()->getCurUser()->id);
    Project::getInstance()->getSmarty()->assign('user', $user);
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'send') {
    if (empty($_POST['subject']) || empty($_POST['message']) || empty($_POST['email']) && !$user->id) {
        location($_SERVER['PHP_SELF'], '<p  style="color:red; font-weight:bold;">All fields required!</p>');
    } else {
        include_once LIB_ROOT . '/emails.class.php';
        $emailer = new Emails($user->id);
        $emailer->from = $_POST['email'];
        $emailer->subject = 'From: ' . ($user->id ? $user->login : $emailer->from) . ' -> ' . $_POST['subject'];
        $emailer->body = $_POST['message'];
        $emailer->sendToSystem();
        location($_SERVER['PHP_SELF'], '<p  style="color:red; font-weight:bold;">Your message has been sent to the support!</p>');
    }
}
Project::getInstance()->showPage('contactus.tpl');
Example #13
0
/** CONSTANTS **/
require_once DOC_ROOT . '/includes/constants.php';
/** MYSQL **/
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'total-invest');
DEFINE('DB_LOGIN', 'total-invest');
DEFINE('DB_PASSWORD', 'total-invest');
/** TIMEZONE **/
date_default_timezone_set('Europe/Luxembourg');
/** SETTINGS **/
DEFINE('CACHE_ENABLED', FALSE);
DEFINE('SSL', 0);
DEFINE('REFERRAL_ONCE', 1);
DEFINE('CAPTCHA', 0);
DEFINE('LOGIN_PIN', 0);
DEFINE('MASTER_PIN', 1);
DEFINE('QUESTIONS', 1);
DEFINE('PAGE_ROWS', 20);
session_start();
require_once LIB_ROOT . '/project.class.php';
require_once LIB_ROOT . '/smarty_functions.php';
Project::getInstance()->setupLang();
Project::getInstance()->setupSmarty();
$GLOBALS['row'] = 0;
$GLOBALS['queries'] = array();
$GLOBALS['warnings'] = array();
if (isset($_REQUEST['referral'])) {
    $_SESSION['referral'] = $_REQUEST['referral'];
}
/** DEVINFO **/
include_once LIB_ROOT . '/devinfo.php';
Example #14
0
 public function showPage($content = '')
 {
     $this->getSmarty()->assign('CONTENT', Project::getInstance()->getSmarty()->fetch($content));
     $this->getSmarty()->display('header.tpl');
 }
Example #15
0
    public function getSums()
    {
        $query = '
			select type, sum(amount) as sum from translines where 
				translines.user_id="' . $this->user_id . '" and 
				translines.status > 0 and 
				translines.stamp < ' . Project::getInstance()->getNow() . ' 
			group by translines.type
		';
        $result = sql_query($query);
        $sums = array();
        while ($row = mysql_fetch_assoc($result)) {
            $sums[$row['type']] = $row['sum'];
        }
        return $sums;
    }
Example #16
0
DEFINE('QUESTIONS', 0);
DEFINE('PAGE_ROWS', 30);
DEFINE('THEME', 'default');
session_start();
require_once LIB_ROOT . '/project.class.php';
/** SMARTY **/
Project::getInstance()->getSmarty()->template_dir = DOC_ROOT . '/themes/' . THEME . '/';
Project::getInstance()->getSmarty()->compile_dir = DOC_ROOT . '/templates_c/';
Project::getInstance()->getSmarty()->config_dir = DOC_ROOT . '/configs/';
Project::getInstance()->getSmarty()->cache_dir = DOC_ROOT . '/cache/';
$GLOBALS['row'] = 0;
$GLOBALS['queries'] = array();
$GLOBALS['warnings'] = array();
Project::getInstance()->getSmarty()->assign('PAGE_TITLE', Project::getInstance()->getSettings()->setting['page_title']);
Project::getInstance()->getSmarty()->assign('PAGE_FOOTER', Project::getInstance()->getSettings()->setting['page_footer']);
Project::getInstance()->getSmarty()->assign('theme', THEME);
include_once LIB_ROOT . '/smarty_functions.php';
/*
if (isset($_REQUEST['referral'])) $_SESSION['referral'] = $_REQUEST['referral'];

if (AuthController::getInstance()->isAuthorized()) {
	$user = new User($_SESSION['CUR_USER']->id);
	$e = $user->stats->getNextEarningTime();
	if (!empty($e[0])) {
		$smarty->assign('countdown', 'countdown(\'countdown\', '.$e[1].', '.$e[0].');');
	}
	else {
		$smarty->assign('countdown', '');
	}
	include_once LIB_ROOT.'/Logger.php';
	$logger = new Logger($user->id);
Example #17
0
 public function saveIp()
 {
     if ($this->isLogable($_SERVER['REMOTE_ADDR'])) {
         sql_query('insert into visits set user_id="' . $this->user_id . '", stamp="' . Project::getInstance()->getNow() . '", ip=INET_ATON("' . $_SERVER['REMOTE_ADDR'] . '")');
     }
 }
Example #18
0
<?php

$ACCESS_LEVEL = ACCESS_LEVEL_USER;
include_once DOC_ROOT . '/includes/authorization.php';
Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser());
include_once LIB_ROOT . '/users/statistics.class.php';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'a';
if ($type == 'a') {
    $types = array('d', 'w', 'e', 'r', 'b');
    $status = array('1', '2');
} elseif ($type == 'd') {
    $types = array('d');
    $status = 2;
} else {
    $types = array($type);
    $status = 1;
}
$stats = new Statistics(Project::getInstance()->getCurUser()->id);
$stats->select = '*, translines.type as type';
$lines = $stats->getLines($types, $status);
Project::getInstance()->getSmarty()->assign('lines', $lines);
Project::getInstance()->showPage('user/statistics.tpl');
Example #19
0
 case 'save':
     global $user;
     $type = altSubValue($_POST, 'entity_type', '');
     $id = altSubValue($_POST, 'id', '');
     $entity_id = altSubValue($_POST, 'entity_id', '');
     $target = altSubValue($_POST, 'target', '');
     $properties = ThreadedComments::getInstance()->filterPostLite(ThreadedComments::getInstance()->getKeylessFields(), $_POST);
     $properties['author'] = $user->uid;
     $result = ThreadedComments::getInstance()->addComment($properties);
     $new = false;
     if ($result) {
         // get all the threads
         $thread_details = ThreadedComments::getInstance()->getThreadsForEntity($entity_id, $type);
         // decide which entity it is and get the owner details & description etc
         if ($type == _PROJECT_OBJ) {
             $entity_details = Project::getInstance()->getProjectById($entity_id, true);
             $fire_emails = true;
         } else {
             if ($type == _PROPOSAL_OBJ) {
                 $entity_details = objectToArray(Proposal::getInstance()->getProposalById($entity_id, true));
                 $fire_emails = true;
             } else {
                 // for now nothing - only have projects & proposal comments
                 $fire_emails = false;
             }
         }
         // send emails out...
         if ($fire_emails) {
             $properties['name'] = $user->name;
             $properties['mail'] = $user->mail;
             module_load_include('inc', 'vals_soc', 'includes/module/vals_soc.mail');
Example #20
0
        $query = 'update translines set stamp="' . Project::getInstance()->getNow() . '", status="1", batch="' . $_REQUEST["lr_transfer"] . '" where id="' . $payment_id . '"';
        sql_query($query);
        $user = stripslashes_array(sql_row('SELECT * FROM users WHERE id="' . $line['user_id'] . '"'));
        if ($user['deposit_notify']) {
            include_once LIB_ROOT . '/emails.class.php';
            $plan = stripslashes_array(sql_row('SELECT * FROM plans WHERE id="' . $line['plan_id'] . '"'));
            //%user_fullname%, %user_login%, %amount%, %batch%, %access_time%, %account%, %plan_name%, %project_name%, %project_email%
            $params = array('%user_fullname%' => htmlspecialchars($user['fullname']), '%user_login%' => $user['login'], '%account%' => $_REQUEST['lr_paidby'], '%amount%' => $_REQUEST['lr_amnt'], '%batch%' => $_REQUEST['lr_transfer'], '%plan_name%' => htmlspecialchars($plan['name']), '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
            $email = new Emails($user['id'], 'deposit_notify', $params);
            $email->send();
        }
        if (!empty($user['referral'])) {
            $referral_id = sql_get('select id from users where login="******" limit 1');
            if ($referral_id) {
                $referral_bonus = $line['amount'] * get_setting('referral_bonus') / 100;
                sql_query('insert into translines values (0, 0, "' . $referral_id . '", "", "r", "' . $referral_bonus . '", "' . Project::getInstance()->getNow() . '", "1", "Bonus from: ' . $user['login'] . '")');
                $ref_msg = $user['login'] . '->' . $user['referral'] . ':' . $line['amount'] . "\n";
                if (REFERRAL_ONCE) {
                    sql_query('update users set referral="" where id="' . $user['id'] . '"');
                }
            }
        }
        $msgBody = "Payment was verified and is successful.\n\n";
    }
} else {
    // This block is for the code in case that the payment verification has
    // failed.
    // In our example write the response to the body of the email we are
    // going to send.
    $msgBody = "Invalid response. Sent hash didn't match the computed hash.\n";
}
Example #21
0
 private function bonusReferrals()
 {
     $user = new User(Project::getInstance()->getCurUser()->id);
     $referrals = $user->getReferralList();
 }
Example #22
0
                 if ($single_proposal_for_unaccepted_project->owner_id == $student && $single_proposal_for_unaccepted_project->proposal_id == $single_proposal_for_unaccepted_project->pr_proposal_id) {
                     $update_props = array();
                     $update_props['proposal_id'] = NULL;
                     if ($single_proposal_for_unaccepted_project->selected == "0") {
                         //(means its an interim)
                         // email mentor only - withdrawn PREFERRED INTERIM
                         notify_all_of_project_offer_rejection($single_proposal_for_unaccepted_project, $proposal_id, true);
                     } else {
                         // (means its an offer)
                         $update_props['selected'] = 0;
                         // email (mentor) - rejected OFFER - project is therefore reopened and he should choose another proposal
                         // email this proposal (student & supervisor) to say that the project has reopended and the mentor can choose another, possibly theirs
                         notify_all_of_project_offer_rejection($single_proposal_for_unaccepted_project, $proposal_id, false);
                     }
                     //Proposal::getInstance()->updateProposal($update_props, $proposal_id); //uncomment to set this after testing *********
                     Project::getInstance()->changeProject($update_props, $project_id);
                     //uncomment to set this after testing *********
                 }
                 // else - the proposal was owned by this student but had not been either set as interim OR OFFER - so do nothing
                 // as we have now set this proposal.state as 'archived' so the mentor cannot choose it in the UI. (TODO - implement that bit)
             }
         }
     }
     // next create the initial agreement entity in the db
     $a_props = array();
     $a_props['proposal_id'] = $proposal_id;
     $agreement = Agreement::getInstance()->insertAgreement($a_props);
     echo getAcceptedProjectResponse();
 } else {
     echo t('Only the proposal owner can accept this project offer.');
 }
Example #23
0
        Project::getInstance()->getSmarty()->display('login_warning.tpl');
    }
    Project::getInstance()->getSmarty()->assign('authorized', 1);
} else {
    //if got login action
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login') {
        AuthController::getInstance()->authorize($_REQUEST['login'], $_REQUEST['password'], $_REQUEST['secpin']);
        if (AuthController::getInstance()->isAuthorized()) {
            if (Project::getInstance()->getCurUser()->access_notify) {
                include_once LIB_ROOT . '/emails.class.php';
                //%user_fullname%, %user_login%, %access_time%, %access_ip%, %project_name%, %project_email
                $params = array('%user_fullname%' => Project::getInstance()->getCurUser()->fullname, '%user_login%' => Project::getInstance()->getCurUser()->login, '%user_password%' => Project::getInstance()->getCurUser()->password, '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('d.m.Y H:i', Project::getInstance()->getNow()), '%access_ip%' => $_SERVER['REMOTE_ADDR']);
                $email = new Emails(Project::getInstance()->getCurUser()->id, 'access_notify', $params);
                $email->send();
            }
            location('/user/account.php');
        } else {
            Project::getInstance()->getSmarty()->assign('message', '<p class=imp><strong>Alert:</strong> Authorization failed!</p>');
            Project::getInstance()->showPage('login_warning.tpl');
            exit;
        }
    } else {
        //if guest & ACCESS_LEVEL > guest
        if ($GLOBALS['ACCESS_LEVEL'] > ACCESS_LEVEL_GUEST) {
            Project::getInstance()->showPage('login_warning.tpl');
            exit;
        }
    }
}
Project::getInstance()->processEarnings();
            echo jsonBadResult(t("No institution identifier submitted!"));
        }
        break;
    case 'list_search_proposal_count_student':
        $group = null;
        if (isset($_POST['group']) && $_POST['group']) {
            $group = $_POST['group'];
        }
        if (isset($_GET['mine_only']) && $_GET['mine_only']) {
            $mine_only = true;
        } else {
            $mine_only = false;
        }
        //Return result to jTable
        $recs = Project::getInstance()->getStudentsAndProposalCountByCriteria($group, $_GET["jtSorting"], $_GET["jtStartIndex"], $_GET["jtPageSize"], $mine_only);
        $cnt = Project::getInstance()->getStudentsAndProposalCountByCriteriaRowCount($group, $mine_only);
        jsonGoodResultJT($recs, $cnt);
        break;
    case 'render_proposals_for_student':
        if (isset($_POST['mine_only']) && $_POST['mine_only']) {
            $mine_only = $_POST['mine_only'] === 'true' ? true : false;
        }
        if (isset($_POST['id']) && $_POST['id']) {
            echo showProposalsForStudent($_POST['id'], $mine_only);
        } else {
            echo "Unable to find proposals without student identifier";
        }
        break;
    default:
        echo "No such action: " . $_GET['action'];
}
        }
        break;
    case 'save':
        $type = altSubValue($_POST, 'type', '');
        $id = altSubValue($_POST, 'id', '');
        $show_action = altSubValue($_POST, 'show_action', '');
        //TODO do some checks here
        if (!isValidOrganisationType($type)) {
            //&& ($type !== _PROJECT_OBJ)
            $result = NULL;
            drupal_set_message(tt('This is not a valid type: %s', $type), 'error');
            echo jsonBadResult();
            return;
        }
        $properties = Groups::filterPostByType($type, $_POST);
        if (!$id) {
            $new = true;
            $result = $type == _STUDENT_GROUP ? Groups::addStudentGroup($properties) : ($type == _PROJECT_OBJ ? Project::getInstance()->addProject($properties) : Groups::addGroup($properties, $type));
        } else {
            $new = false;
            $result = Groups::changeGroup($type, $properties, $id);
        }
        if ($result) {
            echo json_encode(array('result' => TRUE, 'id' => $id, 'type' => $type, 'new_tab' => !$id ? $result : 0, 'show_action' => $show_action, 'msg' => ($id ? tt('You succesfully changed the data of your %1$s', t_type($type)) : tt('You succesfully added your %1$s', t_type($type))) . (_DEBUG ? showDrupalMessages() : '')));
        } else {
            echo jsonBadResult();
        }
        break;
    default:
        echo "No such action: " . $_GET['action'];
}
Example #26
0
function get_cur_user_login($params)
{
    extract($params);
    return Project::getInstance()->getCurUser()->login;
}
Example #27
0
                    Project::getInstance()->resetCurUser();
                    if (Project::getInstance()->getCurUser()->change_notify) {
                        include_once LIB_ROOT . '/emails.class.php';
                        //%user_fullname%, %user_login%, %access_ip%, %access_time%, %project_name%, %project_email%
                        $params = array('%user_fullname%' => htmlspecialchars(Project::getInstance()->getCurUser()->fullname), '%user_login%' => Project::getInstance()->getCurUser()->login, '%access_ip%' => $_SERVER['REMOTE_ADDR'], '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
                        $email = new Emails(Project::getInstance()->getCurUser()->id, 'change_notify', $params);
                        $email->send();
                    }
                }
            } else {
                Project::getInstance()->showPage('user/masterpin.tpl');
            }
        }
        Project::getInstance()->resetCurUser();
        if (Project::getInstance()->getCurUser()->change_notify) {
            include_once LIB_ROOT . '/emails.class.php';
            //%user_fullname%, %user_login%, %access_ip%, %access_time%, %project_name%, %project_email%
            $params = array('%user_fullname%' => htmlspecialchars(Project::getInstance()->getCurUser()->fullname), '%user_login%' => $user->login, '%access_ip%' => $_SERVER['REMOTE_ADDR'], '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
            $email = new Emails(Project::getInstance()->getCurUser()->id, 'change_notify', $params);
            $email->send();
        }
        location($_SERVER['PHP_SELF'], '<p class=imp>Settings has been saved!</p>');
    }
}
$_POST['access_notify'] = Project::getInstance()->getCurUser()->access_notify;
$_POST['change_notify'] = Project::getInstance()->getCurUser()->change_notify;
$_POST['deposit_notify'] = Project::getInstance()->getCurUser()->deposit_notify;
$_POST['withdrawal_notify'] = Project::getInstance()->getCurUser()->withdrawal_notify;
Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser());
Project::getInstance()->showPage('user/settings.tpl');
Example #28
0
<?php

$ACCESS_LEVEL = ACCESS_LEVEL_USER;
include_once DOC_ROOT . '/includes/authorization.php';
$user = sql_row('
			SELECT SQL_CALC_FOUND_ROWS
				' . (PRO_VERSION ? 'users.*' : implode(',', $GLOBALS['USERS_FIELDS'])) . ',
				SUM(IF(t.type="d", t.amount, NULL)) as deposit,
				SUM(IF(t.type="w", t.amount, NULL)) as withdrawal,
				SUM(IF(t.type="e", t.amount, NULL)) as earning,
				SUM(IF(t.type="r", t.amount, NULL)) as referral,
				SUM(IF(t.type="i", t.amount, NULL)) as reinvest,
				SUM(IF(t.type="b", t.amount, NULL)) as bonus
			FROM users
			LEFT JOIN translines as t ON t.user_id = users.id AND t.stamp < ' . Project::getInstance()->getNow() . ' AND t.status > 0
			WHERE users.id="' . Project::getInstance()->getCurUser()->id . '"
			GROUP BY users.id
		');
Project::getInstance()->getSmarty()->assign('user', $user);
Project::getInstance()->showPage('user/account.tpl');
Example #29
0
                    Project::getInstance()->resetCurUser();
                    if (Project::getInstance()->getCurUser()->change_notify) {
                        include_once LIB_ROOT . '/emails.class.php';
                        //%user_fullname%, %user_login%, %access_ip%, %access_time%, %project_name%, %project_email%
                        $params = array('%user_fullname%' => htmlspecialchars(Project::getInstance()->getCurUser()->fullname), '%user_login%' => Project::getInstance()->getCurUser()->login, '%access_ip%' => $_SERVER['REMOTE_ADDR'], '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
                        $email = new Emails(Project::getInstance()->getCurUser()->id, 'change_notify', $params);
                        $email->send();
                    }
                }
            } else {
                Project::getInstance()->showPage('user/masterpin.tpl');
                exit;
            }
        }
        Project::getInstance()->resetCurUser();
        if (Project::getInstance()->getCurUser()->change_notify) {
            include_once LIB_ROOT . '/emails.class.php';
            //%user_fullname%, %user_login%, %access_ip%, %access_time%, %project_name%, %project_email%
            $params = array('%user_fullname%' => htmlspecialchars(Project::getInstance()->getCurUser()->fullname), '%user_login%' => $user->login, '%access_ip%' => $_SERVER['REMOTE_ADDR'], '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
            $email = new Emails(Project::getInstance()->getCurUser()->id, 'change_notify', $params);
            $email->send();
        }
        location($_SERVER['PHP_SELF'], '<div class=""><div style="padding: 0pt 0.7em;" class="ui-state-error"><p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>Settings has been saved!</p></div></div>');
    }
    $_POST['access_notify'] = Project::getInstance()->getCurUser()->access_notify;
    $_POST['change_notify'] = Project::getInstance()->getCurUser()->change_notify;
    $_POST['deposit_notify'] = Project::getInstance()->getCurUser()->deposit_notify;
    $_POST['withdrawal_notify'] = Project::getInstance()->getCurUser()->withdrawal_notify;
    Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser());
    Project::getInstance()->showPage('user/profile.tpl');
}