function __construct($seek_search_params, $search_position)
 {
     $this->search_position = $search_position;
     if (is_string($seek_search_params)) {
         parse_str($seek_search_params, $query_params);
     } else {
         $query_params = $seek_search_params;
     }
     $search = Search::from_params($query_params);
     $search->maxrecs = 3;
     $prev_item_num = $this->search_position > 1 ? $this->search_position - 1 : null;
     $current_result_index = $this->search_position - 1;
     $search->start = array(0, max(1, $current_result_index));
     $results = $search->results();
     if ($this->search_position > 1) {
         $this->previous_item = get_item($results[0]['collection'], $results[0]['pointer']);
         $this->previous_item['query_string'] .= "&search_position=" . ($this->search_position - 1);
     }
     if ($this->search_position < $search->total) {
         $next_result_index = $this->search_position > 1 ? 2 : 1;
         $this->next_item = get_item($results[$next_result_index]['collection'], $results[$next_result_index]['pointer']);
         $this->next_item['query_string'] .= "&amp;search_position=" . ($this->search_position + 1);
     }
     $this->total_items = $search->total;
 }
 function indexAction()
 {
     global $site;
     $request = $site->mvc->getRequest();
     $login = get_item($_SESSION, 'login');
     switch ($request->type) {
         case 'get':
             $site->enqueueStyle('console');
             $site->enqueueScript('console');
             if ($this->checkLogin($login)) {
                 $this->view->render('/index-page');
             } else {
                 $this->view->render('/login-page');
             }
             break;
         case 'post':
             if ($this->checkLogin($login)) {
                 $code = $request->post('code');
                 $code = preg_replace('/^\\s*\\<\\?php/', '', $code);
                 $code = preg_replace('/\\?\\>\\s*$/', '', $code);
                 eval($code);
             } else {
                 $password = md5($request->post('password'));
                 if ($this->checkLogin($password)) {
                     $_SESSION['login'] = $password;
                     $site->redirectTo($site->urlTo('/console'));
                 } else {
                     $site->redirectTo($site->urlTo('/console?msg=400'));
                 }
             }
             break;
     }
 }
function insert_user($added_name, $password, $gradyear, $email, $type, $status = '')
{
    if (!$password) {
        srand(time());
        $password = rand(0, 999999);
    }
    if (!$email) {
        $email = $added_name . "@grinnell.edu";
    }
    $crpassword = User::hashPassword($password);
    $dbh = db_connect();
    $myrow = array("", $added_name, "", $crpassword, $email, "", "", "", "", "", "", $gradyear, "70", "14", "", "", $type, "", "", 0);
    add_row($dbh, "accounts", $myrow);
    mysql_query("UPDATE accounts SET created = NOW() WHERE\n\t\t\tusername = '******'");
    $added_id = get_item($dbh, "userid", "accounts", "username", $added_name);
    mysql_query("INSERT INTO plans (user_id) VALUES ({$added_id})");
    add_row($dbh, "display", array($added_id, "6", "7"));
    foreach (array(2, 4, 6, 8, 14, 15, 16) as $opt_link) {
        $myrow = array($added_id, $opt_link);
        add_row($dbh, "opt_links", $myrow);
    }
    $myrow = array($added_id, $status);
    add_row($dbh, "perms", $myrow);
    return array($password, $email);
}
function cleanText($plan, &$planlove = array())
{
    $plan = htmlspecialchars($plan);
    //take out html
    //fix the dollar sign error- by josh
    //$plan = preg_replace("(\|(\w\s)*)\$
    $plan = preg_replace("/((\\[\\w*\\],?){8})(?=[^ ,])/s", "\$1 ", $plan);
    $plan = preg_replace("/\n/s", "<br>", $plan);
    $plan = preg_replace("/\\&lt\\;hr\\&gt\\;/si", "</p><hr><p class=\"sub\">", $plan);
    // replace the first </p> that we just inserted erroneously
    //$plan = preg_replace("</p>", "", $plan, 1);
    $plan = '<p class="sub">' . $plan . '</p>';
    $plan = preg_replace("/\\&lt\\;b\\&gt\\;(.*?)\\&lt\\;\\/b\\&gt\\;/si", "<b>\\1</b>", $plan);
    //allow stuff in the bold tag back in
    $plan = preg_replace("/\\&lt\\;tt\\&gt\\;(.*?)\\&lt\\;\\/tt\\&gt\\;/si", "<tt>\\1</tt>", $plan);
    $plan = preg_replace("/\\&lt\\;pre\\&gt\\;(.*?)\\&lt\\;\\/pre\\&gt\\;/si", "</p><pre class=\"sub\">\\1</pre><p class=\"sub\">", $plan);
    $plan = preg_replace("/\\&lt\\;strike\\&gt\\;(.*?)\\&lt\\;\\/strike\\&gt\\;/si", "<span class=\"strike\">\\1</span><!--strike-->", $plan);
    $plan = preg_replace("/\\&lt\\;s\\&gt\\;(.*?)\\&lt\\;\\/s\\&gt\\;/si", "<s>\\1</s>", $plan);
    $plan = preg_replace("/\\&lt\\;i\\&gt\\;(.*?)\\&lt\\;\\/i\\&gt\\;/si", "<i>\\1</i>", $plan);
    //allow stuff in the italics tag back in
    $plan = preg_replace("/\\&lt\\;u\\&gt\\;(.*?)\\&lt\\;\\/u\\&gt\\;/si", "<span class=\"underline\">\\1</span><!--u-->", $plan);
    //allow stuff in the underline tag back in
    $plan = preg_replace("/\\&lt\\;a.+?href=.&quot\\;(.+?).&quot\\;&gt\\;(.+?)&lt\\;\\/a&gt\\;/si", "<a href=\"\\1\" class=\"onplan\">\\2</a>", $plan);
    //$plan = preg_replace("/\&lt\;a.href=.&quot\;(.+).&quot\;/si", "EEE",$plan);
    preg_match_all("/\\[([^\\[\\]]*?)\\]/s", $plan, $mymatches);
    //get an array of everything in brackets
    foreach ($mymatches[1] as $mycheck) {
        //echo '<!-- ' ."/\[$mycheck\]/s" . ' -->' . "\n";
        if (!isset($checked[$mycheck])) {
            //check for plan with username
            $dbh = db_connect();
            if ($item = get_item($dbh, "username", "accounts", "username", $mycheck)) {
                $planlove[] = $mycheck;
                $plan = preg_replace("/\\[" . preg_quote($mycheck, '/') . "\\]/s", "[<a href=\"read.php?searchname={$item}\" class=\"planlove\">{$mycheck}</a>]", $plan);
                //change all occurences of person on plan
            } else {
                if (preg_match('/^\\d+$/', $mycheck) && ($item = get_item($dbh, "messageid", "subboard", "messageid", $mycheck))) {
                    $plan = preg_replace("/\\[" . preg_quote($mycheck, "/") . "\\]/s", "[<a href=\"board_messages.php?messagenum={$item}#{$item}\" class=\"boardlink\">{$mycheck}</a>]", $plan);
                }
                if (preg_match("/^(http|https|mailto):/", $mycheck)) {
                    if (strrpos($mycheck, "|")) {
                        preg_match("/(.+?)\\|(.+)/si", $mycheck, $love_replace);
                        // Here, we need to escape $'s so they don't get treated as back-references
                        $love_replace[2] = addcslashes($love_replace[2], "\$");
                        $plan = preg_replace("/\\[" . preg_quote($mycheck, "/") . "\\]/s", "<a href=\"{$love_replace['1']}\" class=\"onplan\">{$love_replace['2']}</a>", $plan);
                    } else {
                        $plan = preg_replace("/\\[" . preg_quote($mycheck, "/") . "\\]/s", "<a href=\"{$mycheck}\" class=\"onplan\">{$mycheck}</a>", $plan);
                    }
                }
            }
            $checked[$mycheck] = 1;
            //mark checked values as checked, so don't have to check again
        }
        //if (!$checked[$mycheck])
    }
    //foreach ($mymatches[1] as $mycheck)
    $plan = trim($plan);
    return $plan;
}
function update_item($item_id)
{
    set_lock_state(True, $item_id);
    $item = get_item($item_id);
    $item['fields']['description'] .= test_results();
    put_item($item_id, $item);
    set_lock_state(False, $item_id);
}
 /**
  * Use the object in the provided position, subtracting the
  * @param  int $pos    Explicit position of the object in the array.
  * @param  int $amount Amount you want to use.
  * @return int         Amount actually used.
  */
 public function use_item($pos, $amount)
 {
     if (get_item($pos) !== null) {
         return $this->inventory[$pos]->UseItem($amount);
     } else {
         return -1;
     }
 }
Example #7
0
 private function checkitem($userdata, $param, $key)
 {
     if (get_item($userdata, $param) && !isempty($userdata[$param])) {
         return 0;
     }
     $this->set_message(sprintf(lang('account.param.empty'), $param) . '<br />');
     return 1;
 }
Example #8
0
function print_work_order_listing()
{
    global $path_to_root, $wo_types_array;
    $item = $_POST['PARAM_0'];
    $location = $_POST['PARAM_1'];
    $open_only = $_POST['PARAM_2'];
    $comments = $_POST['PARAM_3'];
    $orientation = $_POST['PARAM_4'];
    $destination = $_POST['PARAM_5'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($item == '') {
        $items = _('All');
    } else {
        $row = get_item($item);
        $items = $row['description'];
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $open = $open_only == 1 ? _('Yes') : _('No');
    $cols = array(0, 100, 120, 165, 210, 275, 315, 375, 385, 440, 495, 555);
    $headers = array(_('Type'), '#', 'Reference', _('Location'), _('Item'), _('Required'), _('Manufactured'), ' ', _('Date'), _('Required By'), _('Closed'));
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'left', 'left', 'left', 'left');
    $params = array(0 => $comments, 1 => array('text' => _('Items'), 'from' => $items, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 3 => array('text' => _('Open Only'), 'from' => $open, 'to' => ''));
    $rep = new FrontReport(_('Work Order Listing'), "WorkOrderListing", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($item, $open_only, $location);
    while ($trans = db_fetch($res)) {
        $rep->TextCol(0, 1, $wo_types_array[$trans['type']]);
        $rep->TextCol(1, 2, $trans['id'], -1);
        $rep->TextCol(2, 3, $trans['wo_ref'], -1);
        $rep->TextCol(3, 4, $trans['location_name'], -1);
        $rep->TextCol(4, 5, $trans['description'], -1);
        $dec = get_qty_dec($trans['stock_id']);
        $rep->AmountCol(5, 6, $trans['units_reqd'], $dec);
        $rep->AmountCol(6, 7, $trans['units_issued'], $dec);
        $rep->TextCol(7, 8, '', -1);
        $rep->TextCol(8, 9, sql2date($trans['date_']), -1);
        $rep->TextCol(9, 10, sql2date($trans['required_by']), -1);
        $rep->TextCol(10, 11, $trans['closed'] ? ' ' : _('No'), -1);
        $rep->NewLine();
    }
    $rep->Line($rep->row);
    $rep->End();
}
 static function getData($token, $divider = '.')
 {
     global $site;
     $ret = false;
     $key = $site->getGlobal('token_salt');
     $parts = explode($divider, $token);
     $ret = get_item($parts, 0);
     return $ret;
 }
Example #10
0
 public function index()
 {
     $data['email'] = get_item($_POST, 'email');
     $data['password'] = get_item($_POST, 'password');
     view::load_view('default/standard/header');
     view::load_view('default/standard/menu');
     view::load_view('default/login/form', $data);
     view::load_view('default/standard/footer');
 }
Example #11
0
 public function password()
 {
     $encrypt = new encryption();
     $data['email'] = get_item($_POST, 'email');
     $data['title'] = lang('title.password');
     view::load_view('default/standard/header', $data);
     view::load_view('default/standard/menu');
     view::load_view('default/login/password', $data);
     view::load_view('default/standard/footer');
 }
Example #12
0
function print_bill_of_material()
{
    global $path_to_root;
    $frompart = $_POST['PARAM_0'];
    $topart = $_POST['PARAM_1'];
    $comments = $_POST['PARAM_2'];
    $orientation = $_POST['PARAM_3'];
    $destination = $_POST['PARAM_4'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $cols = array(0, 50, 305, 375, 445, 515);
    $headers = array(_('Component'), _('Description'), _('Loc'), _('Wrk Ctr'), _('Quantity'));
    $aligns = array('left', 'left', 'left', 'left', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart));
    $rep = new FrontReport(_('Bill of Material Listing'), "BillOfMaterial", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($frompart, $topart);
    $parent = '';
    while ($trans = db_fetch($res)) {
        if ($parent != $trans['parent']) {
            if ($parent != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['parent']);
            $desc = get_item($trans['parent']);
            $rep->TextCol(1, 2, $desc['description']);
            $parent = $trans['parent'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $dec = get_qty_dec($trans['component']);
        $rep->TextCol(0, 1, $trans['component']);
        $rep->TextCol(1, 2, $trans['CompDescription']);
        //$rep->TextCol(2, 3, $trans['loc_code']);
        //$rep->TextCol(3, 4, $trans['workcentre_added']);
        $wc = get_work_centre($trans['workcentre_added']);
        $rep->TextCol(2, 3, get_location_name($trans['loc_code']));
        $rep->TextCol(3, 4, $wc['name']);
        $rep->AmountCol(4, 5, $trans['quantity'], $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Example #13
0
function process_purchase($id)
{
    $user_id = wp_get_current_user()->ID;
    $currency = get_currency_available();
    $item = get_item($id);
    $price = $item->price;
    if (intval($price) > intval($currency)) {
        return false;
    } else {
        $purchase_id = create_purchase($user_id);
        create_line_item($purchase_id, $id, $price);
        $cost = floatval($price) * -1;
        bonus_points_to_wallet($user_id, $cost);
        return true;
    }
}
function print_assets_list()
{
    global $path_to_root;
    $frompart = $_POST['PARAM_0'];
    $topart = $_POST['PARAM_1'];
    $comments = $_POST['PARAM_2'];
    $destination = $_POST['PARAM_3'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $cols = array(0, 50, 305, 375, 445, 515);
    $headers = array(_('Asset Type'), _('Asset name'), _('Serial Number'), _('Purchase Date'), _('Purchase Value'));
    $aligns = array('left', 'left', 'left', 'left', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart));
    $rep = new FrontReport(_('Assets Listing'), "AssetList", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($frompart, $topart);
    $parent = '';
    while ($trans = db_fetch($res)) {
        if ($parent != $trans['asset_type_name']) {
            if ($parent != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 2, $trans['asset_type_name']);
            $desc = get_item($trans['asset_type_name']);
            $parent = $trans['asset_type_name'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $dec = get_qty_dec($trans['asset_id']);
        $rep->TextCol(0, 1, $trans['asset_type_name']);
        $rep->TextCol(1, 2, $trans['asset_name']);
        $rep->TextCol(2, 3, $trans['asset_serial']);
        $rep->TextCol(3, 4, $trans['purchase_date']);
        $rep->AmountCol(4, 5, $trans['purchase_value'], $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
Example #15
0
function print_bill_of_material()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $frompart = $_REQUEST['PARAM_0'];
    $topart = $_REQUEST['PARAM_1'];
    $comments = $_REQUEST['PARAM_2'];
    $dec = user_qty_dec();
    $cols = array(0, 50, 305, 375, 445, 515);
    $headers = array(tr('Component'), tr('Description'), tr('Loc'), tr('Wrk Ctr'), tr('Quantity'));
    $aligns = array('left', 'left', 'left', 'left', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Component'), 'from' => $frompart, 'to' => $topart));
    $rep = new FrontReport(tr('Bill of Material Listing'), "BillOfMaterial.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $res = getTransactions($frompart, $topart);
    $parent = '';
    while ($trans = db_fetch($res)) {
        if ($parent != $trans['parent']) {
            if ($parent != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['parent']);
            $desc = get_item($trans['parent']);
            $rep->TextCol(1, 2, $desc['description']);
            $parent = $trans['parent'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $trans['component']);
        $rep->TextCol(1, 2, $trans['CompDescription']);
        $rep->TextCol(2, 3, $trans['loc_code']);
        $rep->TextCol(3, 4, $trans['workcentre_added']);
        $rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
    }
    $rep->Line($rep->row - 4);
    $rep->End();
}
 function chainController($controllerClass)
 {
     global $site;
     $request = $site->mvc->getRequest();
     $params = get_item($request->parts, 2, 'index');
     $params = explode('/', $params);
     $action = get_item($params, 0, 'index');
     $id = get_item($params, 1, 0);
     if (class_exists($controllerClass)) {
         $controller = new $controllerClass();
         $method = "{$action}Action";
         $method = str_replace(' ', '', ucwords(str_replace('-', ' ', $method)));
         $method[0] = strtolower($method[0]);
         if (method_exists($controller, $method)) {
             $controller->view = $this->view;
             $controller->{$method}($id);
         } else {
             $site->errorMessage("The specified action does not exist in the controller.");
         }
     } else {
         $site->errorMessage("The specified controller does not exist.");
     }
 }
Example #17
0
function add_item($i, $title, $parent)
{
    $uuid = uniqid();
    if ($s = $i->prepare("INSERT INTO ITEMS (PUBLIC_ID, TITLE, PARENT, OWNER) VALUES (?,?,?,?)")) {
        if (!$parent) {
            $parent = null;
        }
        $s->bind_param("ssii", $uuid, $title, $parent, $_SESSION['user-id']);
        if ($s->execute()) {
            // Query success
            return get_item($i, $uuid);
        } else {
            // Execution Failure
            error_log("New item execution error: There wasn error while adding a new item: {$i->error}");
            json_error("There wasn error while adding the new item");
        }
        $s->close();
    } else {
        // Preparation Failure
        error_log("New item preparation error: There was an error while adding a new item: {$i->error}");
        json_error("There was an error while adding the new item");
    }
}
Example #18
0
function move_item_up($table_name, $current_id, $group_query)
{
    $last_item = get_item($table_name, "sequence", $current_id, $group_query, "previous");
    $sequence = db_fetch_cell("select sequence from {$table_name} where id={$current_id}");
    $sequence_last = db_fetch_cell("select sequence from {$table_name} where id={$last_item}");
    db_execute("update {$table_name} set sequence={$sequence_last} where id={$current_id}");
    db_execute("update {$table_name} set sequence={$sequence} where id={$last_item}");
}
<?php

$error = get_item($_GET, 'error');
$site->getParts(array('shared/header_html', 'sticky-footer/header'));
?>

		<section>
			<div class="inner boxfix-vert">
				<div class="margins">
					<h3>NORM User Login</h3>
					<br>
					<!--  -->
					<?php 
if ($error) {
    ?>
						<div class="message message-error"><?php 
    echo $error;
    ?>
</div>
					<?php 
}
?>
					<!--  -->
					<div class="row">
						<div class="col col-4">
							<form action="" method="post">
								<div class="form-fields">
									<div class="form-group">
										<label for="user" class="control-label">User name</label>
										<input type="text" name="user" id="user" class="form-control input-block">
									</div>
Example #20
0
function item_moveup() {
	/* ================= input validation ================= */
	input_validate_input_number(get_request_var("id"));
	input_validate_input_number(get_request_var("graph_template_id"));
	/* ==================================================== */

	global $graph_item_types;

	$arr = get_graph_group($_GET["id"]);
	$next_id = get_graph_parent($_GET["id"], "previous");

	if ((!empty($next_id)) && (isset($arr{$_GET["id"]}))) {
		move_graph_group($_GET["id"], $arr, $next_id, "previous");
	}elseif (ereg("(GPRINT|VRULE|HRULE|COMMENT)", $graph_item_types{db_fetch_cell("select graph_type_id from graph_templates_item where id=" . $_GET["id"])})) {
		/* this is so we know the "other" graph item to propagate the changes to */
		$last_item = get_item("graph_templates_item", "sequence", $_GET["id"], "graph_template_id=" . $_GET["graph_template_id"] . " and local_graph_id=0", "previous");

		move_item_up("graph_templates_item", $_GET["id"], "graph_template_id=" . $_GET["graph_template_id"] . " and local_graph_id=0");

		db_execute("update graph_templates_item set sequence=" . db_fetch_cell("select sequence from graph_templates_item where id=" . $_GET["id"]) . " where local_graph_template_item_id=" . $_GET["id"]);
		db_execute("update graph_templates_item set sequence=" . db_fetch_cell("select sequence from graph_templates_item where id=" . $last_item). " where local_graph_template_item_id=" . $last_item);
	}
}
Example #21
0
	<link rel="stylesheet" type="text/css" media="screen" href="css/board.css" />

	<script type="text/javascript">//<![CDATA[
		var setups = {
			' . $setup_javascript . '
		};
	/*]]>*/</script>

	<script type="text/javascript" src="scripts/board.js">></script>
	<script type="text/javascript" src="scripts/stats.js">></script>
';
$hints = array('View ' . GAME_NAME . ' Player and Setup statistics.', 'Click on Setup table row to view setup.');
$contents = '';
// grab the wins and losses for the players
$list = Game::get_player_stats_list();
$table_meta = array('sortable' => true, 'no_data' => '<p>There are no player stats to show</p>', 'caption' => 'Player Stats', 'init_sort_column' => array(1 => 1));
$table_format = array(array('Player', 'username'), array('<abbr title="Silver | Red | Total">Wins</abbr>', '[[[white_wins]]]&nbsp;|&nbsp;[[[black_wins]]]&nbsp;|&nbsp;[[[wins]]]'), array('<abbr title="Silver | Red | Total">Draws</abbr>', '[[[white_draws]]]&nbsp;|&nbsp;[[[black_draws]]]&nbsp;|&nbsp;[[[draws]]]'), array('<abbr title="Silver | Red | Total">Losses</abbr>', '[[[white_losses]]]&nbsp;|&nbsp;[[[black_losses]]]&nbsp;|&nbsp;[[[losses]]]'), array('Win-Loss', '###([[[wins]]] - [[[losses]]])', null, ' class="color"'), array('Win %', '###((0 != ([[[wins]]] + [[[losses]]])) ? perc([[[wins]]] / ([[[wins]]] + [[[losses]]]), 1) : 0)'), array('Last Online', '###date(Settings::read(\'long_date\'), strtotime(\'[[[last_online]]]\'))', null, ' class="date"'));
$contents .= get_table($table_format, $list, $table_meta);
// setups already pulled above
$table_meta = array('sortable' => true, 'no_data' => '<p>There are no setup stats to show</p>', 'caption' => 'Setup Stats');
$table_format = array(array('SPECIAL_CLASS', 'true', 'setup'), array('SPECIAL_HTML', 'true', ' id="s_[[[setup_id]]]"'), array('Setup', 'name'), array('Used', 'used'), array('Silver Wins', 'white_wins'), array('Red Wins', 'black_wins'), array('Draws', 'draws'), array('Reflection', 'reflection'), array('Created', '###date(Settings::read(\'long_date\'), strtotime(\'[[[created]]]\'))', null, ' class="date"'), array('Creator', '###((0 == [[[created_by]]]) ? \'Admin\' : $GLOBALS[\'_PLAYERS\'][[[[created_by]]]])'));
$contents .= get_table($table_format, $setups, $table_meta);
$contents .= <<<EOF

\t<div id="setup_display"></div>

EOF;
echo get_header($meta);
echo get_item($contents, $hints, $meta['title']);
call($GLOBALS);
echo get_footer();
            echo format_price($deal["limit_price"]);
            ?>
</td><td><?php 
            echo $deal["deal_days"];
            ?>
</td><td><?php 
            echo to_date($deal["create_time"]);
            ?>
</td><td><?php 
            echo get_edit($deal["is_edit"], $deal);
            ?>
</td><td><?php 
            echo get_status($deal["is_effect"]);
            ?>
</td><td class="op_action"><div class="viewOpBox_demo"> <?php 
            echo get_item($deal["id"], $deal);
            ?>
&nbsp; <?php 
            echo get_edit_1($deal["id"], $deal);
            ?>
&nbsp;<a href="javascript: foreverdel('<?php 
            echo $deal["id"];
            ?>
')">彻底删除</a>&nbsp;</div><a href="javascript:void(0);" class="opration"><span>操作</span><i></i></a></td></tr><?php 
        }
    }
} else {
    echo "";
}
?>
<tr><td colspan="12" class="bottomTd"> &nbsp;</td></tr></table>
Example #23
0
function lang($key)
{
    global $lang;
    $text = get_item($lang, $key);
    return !isempty($text) ? $text : $key;
}
Example #24
0
<?php

$url_project = $_SERVER["QUERY_STRING"];
$current_url = current(explode("&sort", $url_project));
$maxRows_Recordset1 = get_item('maxrows_project');
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
    $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$sortlist = "project_lastupdate";
if (isset($_GET['sort'])) {
    $sortlist = $_GET['sort'];
}
$orderlist = "DESC";
if (isset($_GET['order'])) {
    $orderlist = $_GET['order'];
}
$colinputtitle_Recordset1 = "";
if (isset($_GET['inputtitle'])) {
    $colinputtitle_Recordset1 = $_GET['inputtitle'];
}
if ($pagetabs == "mprj" || $pagetabs == "jprj") {
    $prjtouser = $_SESSION['MM_uid'];
    if (isset($_GET['ptouser'])) {
        $prjtouser = $_GET['ptouser'];
    }
} else {
    $prjtouser = 0;
}
$prjtouser = GetSQLValueString($prjtouser, "int");
Example #25
0
         $message = new InfoText('Style Set', 'Success');
         $thispage->append($message);
     }
     //if $style=custome, else
 }
 populate_page($thispage, $dbh, $idcookie);
 $my_result = mysql_query("Select style,descr From \n\t\t\t\t  style");
 //get currently available styles and their descriptions
 while ($new_row = mysql_fetch_row($my_result)) {
     $mystyles[] = $new_row;
 }
 $css = get_item($dbh, "stylesheet", "stylesheet", "userid", $idcookie);
 if ($css) {
     $customstyle = "checked";
 } else {
     $intcheck[get_item($dbh, "style", "display", "userid", $idcookie)] = " checked";
     //get the style that the user currently has selected, and set it to start out checked
 }
 $custom_style_form = new Form('styleform', true);
 $custom_style_form->action = 'styles.php';
 $custom_style_form->method = 'POST';
 $custom_style_form->title = 'Style Options';
 $thispage->append($custom_style_form);
 $item = new HiddenInput('part', '1');
 $custom_style_form->append($item);
 //begin the form
 $o = 0;
 while ($mystyles[$o][0]) {
     $item = new RadioInput('style', $mystyles[$o][0]);
     $item->checked = strtolower($intcheck[$mystyles[$o][0]]) == ' checked';
     $name_and_desc = $mystyles[$o][1];
Example #26
0
        $thispage->append($message);
    }
} else {
    if ($_GET['token']) {
        $session = get_item($dbh, 'session', 'tentative_accounts', 'token', $token);
        if (!$session) {
            $message = new AlertText('That doesn\'t seem to be a valid or unexpired token, please try again or <a href="mailto:grinnellplans@gmail.com">Email</a> us.', 'Token not recognized');
            $thispage->append($message);
            $thispage->append(show_form());
        } else {
            $data = unserialize($session);
            $username = $data['username'];
            $type = $data['type'];
            $year = $data['year'];
            $email = $username . '@' . $domain;
            if (get_item($dbh, 'username', 'accounts', 'username', $username)) {
                $message = new AlertText("A plan with the username {$username} already exists, meaning this token has been used.  If you are the owner of that email, your password was given to you when you first clicked the link.  If you've lost the password, or for anything else, <a href=\"mailto:{$admin_email}\">Email us</a>.", 'Plan exists');
                $thispage->append($message);
                $thispage->append(show_form());
            } else {
                $results = insert_user($username, '', $year, $email, $type);
                $password = $results[0];
                $message = new InfoText("Your account has been created!  Your username is {$username} and your initial password is {$password}." . '  Go <a href="http://www.grinnellplans.com/">Here</a> to test them out.', 'Plan Created');
                $thispage->append($message);
                $message = "A new plan has been created with \nusername:  {$username}\nGrad Year: {$year}\n{$username} self-identifies as {$type}.";
                send_mail($admin_email, "Plan Created: {$username}", $message);
                $message = "Your account has been created!  Your username is {$username} and your initial password is {$password}. Go to http://www.grinnellplans.com/ to get started.\n";
                send_mail($email, "Plan Created", $message);
            }
        }
    } else {
Example #27
0
function check_item_data()
{
    global $SysPrefs, $allow_negative_prices;
    $is_inventory_item = is_inventory_item(get_post('stock_id'));
    if (!get_post('stock_id_text', true)) {
        display_error(_("Item description cannot be empty."));
        set_focus('stock_id_edit');
        return false;
    } elseif (!check_num('qty', 0) || !check_num('Disc', 0, 100)) {
        display_error(_("The item could not be updated because you are attempting to set the quantity ordered to less than 0, or the discount percent to more than 100."));
        set_focus('qty');
        return false;
    } elseif (!check_num('price', 0) && (!$allow_negative_prices || $is_inventory_item)) {
        display_error(_("Price for inventory item must be entered and can not be less than 0"));
        set_focus('price');
        return false;
    } elseif (isset($_POST['LineNo']) && isset($_SESSION['Items']->line_items[$_POST['LineNo']]) && !check_num('qty', $_SESSION['Items']->line_items[$_POST['LineNo']]->qty_done)) {
        set_focus('qty');
        display_error(_("You attempting to make the quantity ordered a quantity less than has already been delivered. The quantity delivered cannot be modified retrospectively."));
        return false;
    } elseif ($is_inventory_item && $_SESSION['Items']->trans_type != ST_SALESORDER && $_SESSION['Items']->trans_type != ST_SALESQUOTE && !$SysPrefs->allow_negative_stock()) {
        $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], $_POST['OrderDate']);
        if (input_num('qty') > $qoh) {
            $stock = get_item($_POST['stock_id']);
            display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:") . " " . $stock['stock_id'] . " - " . $stock['description'] . " - " . _("Quantity On Hand") . " = " . number_format2($qoh, get_qty_dec($_POST['stock_id'])));
            return false;
        }
        return true;
    }
    $cost_home = get_standard_cost(get_post('stock_id'));
    // Added 2011-03-27 Joe Hunt
    $cost = $cost_home / get_exchange_rate_from_home_currency($_SESSION['Items']->customer_currency, $_SESSION['Items']->document_date);
    if (input_num('price') < $cost) {
        $dec = user_price_dec();
        $curr = $_SESSION['Items']->customer_currency;
        $price = number_format2(input_num('price'), $dec);
        if ($cost_home == $cost) {
            $std_cost = number_format2($cost_home, $dec);
        } else {
            $price = $curr . " " . $price;
            $std_cost = $curr . " " . number_format2($cost, $dec);
        }
        display_warning(sprintf(_("Price %s is below Standard Cost %s"), $price, $std_cost));
    }
    return true;
}
Example #28
0
 public function get_item()
 {
     $item_id = $this->input->post('item_id');
     $site = $this->input->post('site');
     $this->ebay_config['siteToUseID'] = get_site_id($site);
     $this->ebay_config['callName'] = 'GetItem';
     $this->load->library('ebayapi/EbaySession', $this->ebay_config);
     $xml = get_item($this->appToken, $item_id);
     $resp = $this->xmlRequest($this->ebaysession, $xml);
     $data = item_to_array($resp);
     echo json_encode($data);
 }
Example #29
0
function move_item_up($table_name, $current_id, $group_query) {
	$last_item = get_item($table_name, "sequence", $current_id, $group_query, "previous");

	$sequence = db_fetch_cell("select sequence from $table_name where id=$current_id");
	$sequence_last = db_fetch_cell("select sequence from $table_name where id=$last_item");
	db_execute("update $table_name set sequence=$sequence_last where id=$current_id");
	db_execute("update $table_name set sequence=$sequence where id=$last_item");
}
Example #30
0
<html>
<body>
<?php 
require "dbfunctions.php";
$dbh = db_connect();
if ($username) {
    $usersid = get_item($dbh, "userid", "accounts", "username", $username);
    if ($mysubmit) {
        $newmessage = preg_replace("/\n/s", "<br>", $newmessage);
        $newmessage = addslashes($newmessage);
        set_item($dbh, "accounts", "spec_message", $newmessage, "userid", $usersid);
        echo "Private message for <b>" . $username . "</b> set to:<br><br>" . stripslashes(stripslashes($newmessage));
    } else {
        //not submitted, so show spec_message
        $spec_message = get_item($dbh, "spec_message", "accounts", "userid", $usersid);
        ?>
<form action="changespec.php" method="POST">
<textarea name="newmessage" cols="70" rows="14" wrap="physical">
<?php 
        echo $spec_message;
        ?>
</textarea><br>
<input type="hidden" name="mysubmit" value="1">
<input type="hidden" name="username" value="<?php 
        echo $username;
        ?>
">
<input type="submit" value="Change Private Message">
</form>
<?php