Exemplo n.º 1
0
function scan()
{
    // Check setting
    $sql = "SELECT set FROM cubit.picking_slip_setting";
    $setting_rslt = db_exec($sql) or errDie("Unable to retrieve setting.");
    $setting = pg_fetch_result($setting_rslt, 0);
    if ($setting == "n") {
        header("Location: picking_slip_settings.php");
    }
    $invoice = array("invoice" => "Scan Invoice");
    list($barcode) = array_values(flashRed($invoice));
    $sordid = decrypt_barcode($barcode);
    if (empty($sordid) || !is_numeric($sordid)) {
        $sordid = 0;
    }
    // Has this invoice been scanned before
    $sql = "SELECT id FROM cubit.pslip_scans WHERE sordid='{$sordid}'";
    $scan_rslt = db_exec($sql) or errDie("Unable to retrieve scans.");
    $sql = "SELECT sordid FROM cubit.sorders WHERE sordid='{$sordid}'";
    $sorder_rslt = db_exec($sql) or errDie("Unable to retrieve sales order.");
    if (pg_num_rows($sorder_rslt)) {
        $reason = "";
        if (pg_num_rows($scan_rslt)) {
            $reason = "DUPLICATE (No reason)";
        }
        $sql = "\n\t\t\tINSERT INTO cubit.pslip_scans (\n\t\t\t\tsordid, timestamp, userid, reason\n\t\t\t) VALUES (\n\t\t\t\t'{$sordid}', current_timestamp, '" . USER_ID . "', '{$reason}'\n\t\t\t)";
        db_exec($sql) or errDie("Unable to record scan.");
    } else {
        return scan_error();
    }
    if (pg_num_rows($scan_rslt)) {
        $scan_id = pglib_lastid("cubit.pslip_scans", "id");
        return reason($scan_id);
    }
    return dispatch($sordid);
}
Exemplo n.º 2
0
echo "So your name is {$who}.<br>" . "You want to meet at {$where} on {$when} hours for {$duration} {$hours} because {$why}.<br>" . "I think I {$am_free_or_busy}<br>" . "You can be contacted at {$email},<br>" . "which to me looks to be {$a_valid_email} therefore I {$may_or_may_not} try to respond.";
?>
                <input type="hidden" name="email" value="<?php 
echo email();
?>
"/>
                <input type="hidden" name="duration" value="<?php 
echo duration();
?>
"/>
                <input type="hidden" name="when" value="<?php 
echo when();
?>
"/>
                <input type="hidden" name="why" value="<?php 
echo reason();
?>
"/>
                <input type="hidden" name="who" value="<?php 
echo name();
?>
"/>
                <input type="hidden" name="where" value="<?php 
echo place();
?>
"/>
                <input type="hidden" name="email" value="<?php 
echo email();
?>
"/>
                <input class="submit" type="submit" value="Submit">
Exemplo n.º 3
0
function problem($reason = NULL, $title = NULL)
{
    global $smarty;
    $tit = isset($title) ? $title : title($reason);
    $smarty->assign("pagetitle", $tit);
    $smarty->assign("template", "accessdenied.tpl");
    $smarty->assign("reason", reason($reason));
    $smarty->assign("help", help("accessdenied"));
    $smarty->assign("menu_button", menu_buttons());
    $smarty->display("main.tpl");
    die;
}
Exemplo n.º 4
0
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<link href='http://fonts.googleapis.com/css?family=Josefin+Sans' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" type="text/css" href="dine.css?v=0.1">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
        <script src='https://www.google.com/recaptcha/api.js'></script>
    </head>
	<body id="plate">
        <div id="text">
            <?php 
$who = name();
$where = place();
$when = when();
$duration = duration();
$email = email();
$why = reason();
$mail_text = "Who:   {$who}\r\n" . "Where: {$where}\r\n" . "When:  {$when}\r\n" . "Duration: {$duration} hour(s) \r\n" . "Email: {$email}\r\n" . "Reason: {$why}\r\n";
if (verify_captcha()) {
    send_mail($mail_text, $email, $who);
    echo "Mail sent, now you must wait for me to respond.";
} else {
    echo "Captcha failed, I don't dine with robots";
}
?>
        </div>
    </body>
</html>
Exemplo n.º 5
0
?>
  <table width="100%" cellpadding="0" cellspacing="0" border="0" class="list">
   <tr height="24" bgcolor="#a2c4fe">
    <th id="sort_menu"><div><?php 
echo show_sort('Name', 'name', 'light');
?>
</div></th>
    <th align="left" width="75">&nbsp;<?php 
echo show_sort('Size', 'size', 'light');
?>
</th>
   <!-- <th align="left">&nbsp;Actions</th> -->
   </tr>
   <?
     if($res) light_show_filelist();
     else echo '<tr height=50 bgcolor="#eeeeee"><td colspan=3><div align="center">Directory could not be opened.'.reason().'</div></td></tr>';
  ?>
  </table>

  <script> if(document.getElementById){ document.getElementById('sort_menu').innerHTML =  '<div style="float: left;<?php 
echo sizeof($dirs) + sizeof($files) > 0 ? '' : ' visibility: hidden;';
?>
" id="all_div"><input type="checkbox" name="all" id="all" align="left" onclick="select_all(this);"><label for="all"> (this page)</label></div>' + document.getElementById('sort_menu').innerHTML; }</script>
  <?php 
echo $pg;
?>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td class="n">
  <input type="hidden" name="DIR" value="<?php 
echo htmlspecialchars($_SESSION['DIR']);
?>
Exemplo n.º 6
0
 function list_r()
 {
     global $db, $reason, $r_name, $gp_reason_plus, $gp_reason_min;
     $reason = 1;
     nav();
     $gp_r_plus = 0;
     $gp_r_min = 0;
     echo "<table border=\"1\" width=\"70%\" id=\"table1\" cellpadding=\"0\" cellspacing=\"1\">" . "<tr><td align=\"center\" width=\"5%\"><span lang=\"ru\">№</span></td>" . "<td align=\"left\" width=\"75%\">Reason</td>" . "<td align=\"center\" width=\"10%\"><span lang=\"ru\">сумма в плюс</span></td>" . "<td align=\"center\" width=\"10%\"><span lang=\"ru\">сумма в минус</span></td>" . "</tr>" . "";
     while ($reason != 62) {
         r($reason);
         reason($reason);
         echo "<tr><td align=\"center\" width=\"5%\">{$reason}</td>" . "<td align=\"left\" width=\"75%\">{$r_name}</td>" . "<td align=\"center\" width=\"10%\">{$gp_reason_plus}</td>" . "<td align=\"center\" width=\"10%\">{$gp_reason_min}</td>" . "</tr>";
         $gp_r_plus = $gp_r_plus + $gp_reason_plus;
         $gp_r_min = $gp_r_min + $gp_reason_min;
         $reason = ++$reason;
     }
     echo "<tr><td align=\"center\" width=\"5%\">==</td>" . "<td align=\"left\" width=\"75%\">Итого:</td>" . "<td align=\"center\" width=\"10%\"><b>{$gp_r_plus}</b></td>" . "<td align=\"center\" width=\"10%\"><b>{$gp_r_min}</b></td>" . "</tr>";
     echo "</table>";
     footer();
 }
Exemplo n.º 7
0
                        $email_content = mb_ereg_replace('{reportcache21}', tr('reportcache21'), $email_content);
                        $email_content = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $email_content);
                        mb_send_mail($cache_owner['email'], tr('reportcache08') . " " . $cache['wp_oc'], $email_content, $emailheaders);
                        // send email to cache reporter
                        $emailheaders = "Content-Type: text/plain; charset=utf-8\r\n";
                        $emailheaders .= "From: " . $site_name . " <{$octeam_email}>\r\n";
                        $email_content = read_file($stylepath . '/email/newreport_reporter.email');
                        $email_content = mb_ereg_replace('{server}', $absolute_server_URI, $email_content);
                        $email_content = mb_ereg_replace('{reportcache10}', tr('reportcache10'), $email_content);
                        $email_content = mb_ereg_replace('{reportcache11}', tr('reportcache11'), $email_content);
                        $email_content = mb_ereg_replace('{reportcache12}', tr('reportcache12'), $email_content);
                        $email_content = mb_ereg_replace('{reportcache14}', tr('reportcache14'), $email_content);
                        $email_content = mb_ereg_replace('{reportcache15}', tr('reportcache15'), $email_content);
                        $email_content = mb_ereg_replace('{reportcache17}', tr('reportcache17'), $email_content);
                        $email_content = mb_ereg_replace('{reportcache20}', tr('reportcache20'), $email_content);
                        $email_content = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $email_content);
                        $email_content = mb_ereg_replace('{date}', date($datetimeFormat), $email_content);
                        $email_content = mb_ereg_replace('{cachename}', $cache['name'], $email_content);
                        $email_content = mb_ereg_replace('{cache_wp}', $cache['wp_oc'], $email_content);
                        $email_content = mb_ereg_replace('{cacheid}', $cacheid, $email_content);
                        $email_content = mb_ereg_replace('{reason}', reason($_POST['reason']), $email_content);
                        $email_content = mb_ereg_replace('{text}', strip_tags($_POST['text']), $email_content);
                        mb_send_mail($cache_reporter['email'], tr('reportcache09') . " " . $cache['wp_oc'], $email_content, $emailheaders);
                        //echo($cache_owner['email']. "[OC PL] Zgłoszono problem dotyczący Twojej skrzynki". $email_content. $emailheaders);
                    }
                }
            }
        }
    }
    tpl_BuildTemplate();
}
Exemplo n.º 8
0
 } else {
     $timef1 = null;
 }
 if (DateTime::createFromFormat('Y-m-j', getVal(@$_POST['timef2'])) !== FALSE) {
     $timef2 = getVal(@$_POST['timef2']);
 } else {
     $timef2 = null;
 }
 $freson = getVal(@$_POST['freson']);
 $other_sch = intval(getVal(@$_POST['other_sch']));
 $Elec_reg2 = intval(getVal(@$_POST['Elec_reg2']));
 $proof = intval(getVal(@$_POST['proof']));
 $marks1 = electorial_marks(0, @$Elec_reg2);
 $marks3 = extra_doc(@$proof);
 $marks41 = StayedFor($timef1, $timef2);
 $marks42 = reason(@$freson);
 $marks43 = nearforeign($marks1 + $marks3, $other_sch);
 $markst = $marks41 + $marks42 + $marks43;
 if ($_POST['submit'] == "Submit") {
     $sql = "INSERT INTO foreigntravel_marks " . "(Application_ID, Category_ID, JurneyFrom, JurneyTo, Reason, School_Count, Electoral_only_One_Years, Proofs_Count, Marks_Duration, Marks_Reason, Marks_School, Marks_Total)" . "VALUES ('{$app}', '{$cat}', '{$timef1}', '{$timef2}', '{$freson}', '{$other_sch}', '{$Elec_reg2}', '{$proof}', '{$marks41}', '{$marks42}', '{$marks43}', '{$markst}') " . "ON DUPLICATE KEY UPDATE JurneyFrom = VALUES (JurneyFrom),JurneyTo = VALUES (JurneyTo),Reason = VALUES (Reason),School_Count = VALUES (School_Count)," . "Electoral_only_One_Years = VALUES (Electoral_only_One_Years),Proofs_Count = VALUES (Proofs_Count),Marks_Duration = VALUES (Marks_Duration),Marks_Reason = VALUES (Marks_Reason),Marks_School = VALUES (Marks_School),Marks_Total = VALUES (Marks_Total);";
     $retval = mysql_query($sql);
     if (!$retval) {
         die('Could not enter data: ' . mysql_error());
     } else {
         $sql2 = "UPDATE application SET Marks = {$markst} WHERE Application_ID ={$app};";
         $set = mysql_query($sql2);
         if (!$set) {
             die('Could not enter data: ' . mysql_error());
         }
         header("location: UnsetSession_SelectionPanel.php");
     }
Exemplo n.º 9
0
/**
 * update_dolphin is a system function for Dolphin.php . You need to specify the function to print errors, if they happen. update_dolphin requires $_REQUEST['act'] to be set to 'upload-new' or 'download-new', and returns NEED_UPLOAD if it needs to show the upload form (it happens if it cannot download the archive from site). The upload form must contain an input field with name "files[]". If all is ok, returns TRUE, otherwise returns string, containing error description or special NEED_UPLOAD. You need to check for TRUE using === operator.
 *
 * @param string $print_err_func
 * @return mixed
 */
function update_dolphin($print_err_func)
{
	if(IS_DEVELOPER) return 'This operation is not permitted for you';
	
	ini_set('display_errors', 'On');
		
	/* disable attempts to download the archive with Dolphin.php by itself */
	if(!CAN_SELFUPDATE) $_REQUEST['act'] = 'upload-new';

	$tmp  =get_tmp_dir();
	if(!$tmp) return 'No suitable temp directory found';
	$tmp = abs_path($tmp);
	$root = abs_path(ROOT);
			
	if(!$tmp || $tmp == $root || substr($tmp, 0, strlen($root)) == $root)
	{
		/* TODO: write normal answer if $tmp is ROOT or subdirectory of ROOT */
		return 'Update is impossible. '.reason();
	}
	
	chdir($tmp);
	
	if(empty($_FILES['files']) && $_REQUEST['act']!='download-new')
	{
		return NEED_UPLOAD;
	}
	
	if($_REQUEST['act']!='download-new') upload_files($tmp);
	else
	{
		$build = file_get_contents(MASTER_SITE.'files/dolphin-build.txt');
		
		$errtext = 'It seems that your server does not allow outgoing connections for PHP scripts, or '.MASTER_SITE.' is down. Try to upload archive with '.SNAME.' manually.';
		
		if(!$build) return NEED_UPLOAD;
		
		if(BUILD >= $build) return 'Your build is up-to-date';
		
		$dolphin = file_get_contents(MASTER_SITE.'files/dolphin-current.zip');
		
		if(!$dolphin) return NEED_UPLOAD;
		
		if(!d_file_put_contents($tmp.'/dolphin-current.zip', $dolphin)) return 'Cannot write '.show_file($tmp.'/dolphin-current.zip','file').' ('.$tmp.'/dolphin-current.zip).'.reason();
	}
	
	$f = $tmp.'/dolphin-current.zip';
	if(!file_exists($f)) return '<b>dolphin-current.zip</b> was not found';
	d_copy(ROOT.'/config.php',$cfg_old=$tmp.'/dolphin_config.php');
	
	require_once(ROOT.'/system/libs/pclzip.php');

	umask(0);
	/* note, that we check if extracting is possible _before_ deleting ROOT */
	$e=new PclZip($f);
	
	//echo '<!--';
	//echo 'file: '.$f.'<br>';
	
	// some hosters require PHP files and folders with PHP scripts to have special rights, so we need to
	// save rights for some essensial files
	
	$tochmod = array('','system','index.php','system/download.php','system/preview.php');
	$rights = array();
	foreach($tochmod as $v) $rights[ROOT.'/'.$v] = get_rights(ROOT.'/'.$v);
	
	d_remove(ROOT);
	//echo 'Removed ROOT.<br>';
	d_mkdir(ROOT,777);
	setwritable(ROOT);
	//echo 'Created ROOT.<br>';
	//echo 'ROOT is writable: '.(is_writable(ROOT) ? 'true' : 'false').'<br>';
	chdir(ROOT);
	//echo 'Changed directory to ROOT.<br>';
	//echo '-->';
	
	if(!$e->extract('.')) return '<b>dolphin-current.zip</b> could not be extracted. Upload the new version <b>via FTP</b>. Here are the contents of your <b>config.php</b>:<pre>'.htmlspecialchars(d_file_get_contents($cfg_old)).'</pre>';
	
	foreach($rights as $k=>$v) d_chmod($k,$v);
	
	if(!empty($_POST['save-login']) || $_REQUEST['act']=='download-new')
	{	
		/* delete BUILD, VERSION and NAME from config.php, they are now in core.php for compatibilty */
		$conf = d_file_get_contents($cfg_old);
		$conf = preg_replace('/define\\(\'(BUILD|VERSION|NAME)\'.*\\)\\;/sU','',$conf);
		d_file_put_contents(ROOT.'/config.php', $conf);
		
		$core = d_file_get_contents(ROOT.'/system/core.php');
		if(!$core)
		{
			$build = "undefined";
		}else
		{
			preg_match("/define\\('BUILD'\\,([0-9]+)\\)/is", $core, $m);
			$build = $m[1];
		}
		
		//echo '<!--Writing new information about build: '.$build.' and '.$version.'<br>-->';
	}
	
	d_unlink($f);
	//echo '<!-- Deleting archive<br> -->';
	
	if($build!='undefined' && $build > BUILD)
	{
		d_unlink($cfg_old);
		return true;
	}
	
	return 'Update did not complete successfully. Please upload the new version <b>via FTP</b>. Here are the contents of your previous <b>config.php</b>:<pre>'.htmlspecialchars(d_file_get_contents($cfg_old)).'</pre>';
}
function reason_update()
{
    extract($_REQUEST);
    if (is_numeric($namount)) {
        $sql = "INSERT INTO cubit.recon_balance_ct (supid, reason_id, amount)\n\t\t\t\tVALUES ('{$supid}', '{$nreason_id}', '{$namount}')";
        db_exec($sql) or errDie("Unable to add entry.");
    }
    if (isset($amount)) {
        foreach ($amount as $bal_id => $value) {
            if (is_numeric($value)) {
                $sql = "UPDATE cubit.recon_balance_ct SET reason_id='{$oreason_id}', \n\t\t\t\t\t\t\tamount='{$value}' WHERE id='{$bal_id}'";
                db_exec($sql) or errDie("Unable to add entry.");
            }
        }
    }
    if (isset($remove)) {
        foreach ($remove as $bal_id => $value) {
            $sql = "DELETE FROM cubit.recon_balance_ct WHERE id='{$bal_id}'";
            db_exec($sql) or errDie("Unable to remove reason.");
        }
    }
    return reason();
}
Exemplo n.º 11
0
<?php

require "functions.php";
echo "<table>";
$handle = fopen("free_text", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        $_GET["why"] = $line;
        $reason = reason();
        $subject_swap = swap_subjects($reason);
        echo "<tr><td>{$line}</td><td>{$subject_swap}</td></tr>";
    }
    fclose($handle);
} else {
    echo "<tr><td>error opening the file</td></tr>";
}
echo "</table>";
Exemplo n.º 12
0
		
		$_RESULT = array(
		'dirs'   => $_SESSION['DIRS'],
		'files'  => $_SESSION['FILES'],
		'end'    => $end,
		'success' => $success,
		);
	}
	break;
case 'zip':
	$_RESULT = add_to_zip($fz);
	if(!$_RESULT) echo 'Could not add to zip.'.reason();
	break;
case 'unzip':
	$_RESULT = unzip_files(array($f), $_REQUEST['mode']);
	if(!$_RESULT) echo 'Could not extract files.'.reason();
	break;
case 'update':
	$_REQUEST['act'] = 'download-new'; /* for correct work of update_dolphin() */
	$_RESULT = update_dolphin(create_function('$cmd','return true;'))===true;
	break;
case 'ping':
	$_RESULT = 'pong';
	break;
case 'handletab':
	$cmd = ltrim($_REQUEST['cmd']);
	
	$parts = explode(' ', $cmd);
	
	if(sizeof($parts) <= 1) /* autocomplete command */
	{