示例#1
0
文件: imgmos.php 项目: bthurvi/oophp
/**
 * Output an image together with last modified header.
 *
 * @param string $file as path to the image.
 * @param boolean $verbose if verbose mode is on or off.
 */
function outputImage($file, $verbose)
{
    $info = getimagesize($file);
    !empty($info) or errorMessage("The file doesn't seem to be an image.");
    $mime = $info['mime'];
    $lastModified = filemtime($file);
    $gmdate = gmdate("D, d M Y H:i:s", $lastModified);
    if ($verbose) {
        verbose("Memory peak: " . round(memory_get_peak_usage() / 1024 / 1024) . "M");
        verbose("Memory limit: " . ini_get('memory_limit'));
        verbose("Time is {$gmdate} GMT.");
    }
    if (!$verbose) {
        header('Last-Modified: ' . $gmdate . ' GMT');
    }
    if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
        if ($verbose) {
            verbose("Would send header 304 Not Modified, but its verbose mode.");
            exit;
        }
        //die(strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) . " not modified $lastModified");
        header('HTTP/1.0 304 Not Modified');
    } else {
        if ($verbose) {
            verbose("Would send header to deliver image with modified time: {$gmdate} GMT, but its verbose mode.");
            exit;
        }
        header('Content-type: ' . $mime);
        readfile($file);
    }
    exit;
}
示例#2
0
function RequiredFields($getvars, $requiredfields, $echoErr = true)
{
    $error_fields = '';
    if (count($getvars) < count($requiredfields)) {
        $error = implode(",", $requiredfields);
        if ($echoErr) {
            errorMessage(errorCode::$generic_param_missing . $error, errorCode::$generic_param_missing_code);
        }
        //die();
        return 0;
    }
    // echo json_encode(array(
    // 	$getvars
    // ));
    foreach ($requiredfields as $field) {
        if (!isset($getvars[$field]) || strlen(trim($getvars[$field])) <= 0) {
            $error = true;
            $error_fields .= $field . ', ';
        }
    }
    if (isset($error) && $echoErr) {
        errorMessage(errorCode::$generic_param_missing . $error_fields, errorCode::$generic_param_missing_code);
        //die();
        return 0;
    }
    return 1;
}
示例#3
0
/**
 *  Checks to see if the given string is nothing but letters or numbers and is
 *  shorter then a certain length.
 */
function isValid($string)
{
    for ($a = 0; $a < strlen($string); $a++) {
        $char = substr($string, $a, 1);
        $isValid = false;
        // Numbers 0-9
        for ($b = 48; $b <= 57; $b++) {
            if ($char == chr($b)) {
                $isValid = true;
            }
        }
        //Uppercase A to Z
        if (!$isValid) {
            for ($b = 65; $b <= 90; $b++) {
                if ($char == chr($b)) {
                    $isValid = true;
                }
            }
        }
        //Lowercase a to z
        if (!$isValid) {
            for ($b = 97; $b <= 122; $b++) {
                if ($char == chr($b)) {
                    $isValid = true;
                }
            }
        }
        if (!$isValid) {
            return errorMessage();
        }
    }
    return "";
}
示例#4
0
function processUpload($file, $username = null)
{
    if (!$username) {
        $username = fpCurrentUsername();
    }
    $tmpFile = $file["tmp_name"];
    $mimeType = $file["type"];
    $filename = utf8_decode($file["name"]);
    $filename = cleanupFilename($filename);
    $getcwd = getcwd();
    $freeSpace = disk_free_space("/");
    $uploaded = is_uploaded_file($tmpFile);
    $message = "OK";
    if (!$uploaded) {
        return errorMessage("Uploaded file not found.");
    }
    //verify file type
    if (!startsWith($mimeType, "image")) {
        return errorMessage("Uploaded file {$filename} is not an image. ({$mimeType})");
    }
    //move file to destination dir
    $dataRoot = getConfig("upload._diskPath");
    $dataRootUrl = getConfig("upload.baseUrl");
    createDir($dataRoot, $username);
    $uploadDir = combine($dataRoot, $username);
    $uploadedFile = combine($dataRoot, $username, $filename);
    $filesize = filesize($tmpFile);
    $success = move_uploaded_file($tmpFile, $uploadedFile);
    debug("move to {$uploadedFile}", $success);
    if (!$success) {
        return errorMessage("Cannot move file into target dir.");
    }
    return processImage($uploadDir, $filename);
}
function RequiredFields($getvars, $requiredfields, $echoErr = true)
{
    if (count($getvars) < count($requiredfields)) {
        $error = implode(",", $requiredfields);
        if ($echoErr) {
            errorMessage(errorCode::$generic_param_missing . $error, errorCode::$generic_param_missing_code);
        }
        //die();
        return 0;
    }
    foreach ($requiredfields as $key) {
        if (array_key_exists($key, $getvars)) {
            if (isset($getvars[$key])) {
            } else {
                $error = implode(",", $requiredfields);
            }
        } else {
            $error = implode(",", $requiredfields);
        }
    }
    if (isset($error) && $echoErr) {
        errorMessage(errorCode::$generic_param_missing . $error, errorCode::$generic_param_missing_code);
        //die();
        return 0;
    }
    return 1;
}
示例#6
0
/**
=head1 NAME
func_conditions.php - management of lists of constraits
=head1 SYNOPSIS
to be included once by PHP scripts that show constraints to be selected from
=head1 DESCRIPTION
When attributes are queried against that are shared between forms,
then the associated code should move into this file. The constraint themselves
are defined as an array of ("name","SQL code") pairs. This shall help to reduce
the amount of redundant code between web forms.
=head1 AUTHORS
Steffen ME<ouml>ller <*****@*****.**>
=head1 COPYRIGHT
Universities of Rostock and LE<uuml>beck, 2003-2009
=cut
*/
function print_condition_form_element($conditionList, $prompt, $condition, $radioOrCheckbox = "checkbox")
{
    if (empty($condition)) {
        $condition = array();
    }
    echo "<p>{$prompt}<br>";
    echo "<table>";
    if ("radio" == "{$radioOrCheckbox}") {
        echo "<tr>";
        echo "<td nowrap valign=top><input type={$radioOrCheckbox} name=condition[] value=\"\"";
        if (0 == count($condition)) {
            echo " checked";
        }
        echo ">";
        echo " neither :</td><td><i>don't perform</i></td>";
        echo "</tr>\n";
    } elseif ("checkbox" != "{$radioOrCheckbox}") {
        errorMessage("print_condition_form_element: unknown type '{$radioOrCheckbox}'.");
        exit;
    }
    foreach ($conditionList as $n => $c) {
        //print_r($c);
        echo "<tr>";
        echo "<td nowrap valign=top><input type={$radioOrCheckbox} name=condition[] value=\"{$n}\"";
        if (in_array($n, $condition)) {
            echo " checked";
        }
        echo ">";
        echo " {$n} :</td><td><i>" . $c["description"] . "</i></td>";
        echo "</tr>\n";
    }
    echo "</table>\n";
    echo "</p>";
}
示例#7
0
function _wobi_addWebseedfiles($torrent_file_path, $relative_path, $httplocation, $hash)
{
    $prefix = WOBI_PREFIX;
    $fd = fopen($torrent_file_path, "rb") or die(errorMessage() . "File upload error 1</p>");
    $alltorrent = fread($fd, filesize($torrent_file_path));
    fclose($fd);
    $array = BDecode($alltorrent);
    // Add in Bittornado HTTP seeding spec
    //
    //add information into database
    $info = $array["info"] or die("Invalid torrent file.");
    $fsbase = $relative_path;
    // We need single file only!
    mysql_query("INSERT INTO " . $prefix . "webseedfiles (info_hash,filename,startpiece,endpiece,startpieceoffset,fileorder) values (\"{$hash}\", \"" . mysql_real_escape_string($fsbase) . "\", 0, " . (strlen($array["info"]["pieces"]) / 20 - 1) . ", 0, 0)");
    // Edit torrent file
    //
    $data_array = $array;
    $data_array["httpseeds"][0] = WOBI_URL . "/seed.php";
    //$data_array["url-list"][0] = $httplocation;
    $to_write = BEncode($data_array);
    //write torrent file
    $write_httpseed = fopen($torrent_file_path, "wb");
    fwrite($write_httpseed, $to_write);
    fclose($write_httpseed);
    //add in piecelength and number of pieces
    $query = "UPDATE " . $prefix . "summary SET piecelength=\"" . $info["piece length"] . "\", numpieces=\"" . strlen($array["info"]["pieces"]) / 20 . "\" WHERE info_hash=\"" . $hash . "\"";
    quickQuery($query);
}
function modulus($a, $b)
{
    if (b == 0) {
        return "Error: You cannot divide by 0\n";
    } elseif (is_numeric($a) && is_numeric($b)) {
        return $a % $b;
    } else {
        return errorMessage($a, $b);
    }
}
function modulus($a, $b)
{
    if (!validateAB($a, $b)) {
        return errorMessage($a, $b, 'not a number');
    } elseif (validateZero($b)) {
        return errorMessage($a, $b, 'dividing by zero');
    } else {
        return $a % $b;
    }
}
示例#10
0
 public function __construct($maxWidth, $maxHeight)
 {
     //
     // Get the incoming arguments
     //
     $src = isset($_GET['src']) ? $_GET['src'] : null;
     $verbose = isset($_GET['verbose']) ? true : null;
     $saveAs = isset($_GET['save-as']) ? $_GET['save-as'] : null;
     $quality = isset($_GET['quality']) ? $_GET['quality'] : 60;
     $ignoreCache = isset($_GET['no-cache']) ? true : null;
     $newWidth = isset($_GET['width']) ? $_GET['width'] : null;
     $newHeight = isset($_GET['height']) ? $_GET['height'] : null;
     $cropToFit = isset($_GET['crop-to-fit']) ? true : null;
     $sharpen = isset($_GET['sharpen']) ? true : null;
     $grayscale = isset($_GET['grayscale']) ? true : null;
     $sepia = isset($_GET['sepia']) ? true : null;
     $pathToImage = realpath(IMG_PATH . $src);
     //
     // Validate incoming arguments
     //
     is_dir(IMG_PATH) or $this->errorMessage('The image dir is not a valid directory.');
     is_writable(CACHE_PATH) or $this->errorMessage('The cache dir is not a writable directory.');
     isset($src) or $this->errorMessage('Must set src-attribute.');
     preg_match('#^[a-z0-9A-Z-_\\.\\/]+$#', $src) or $this->errorMessage('Filename contains invalid characters.');
     substr_compare(IMG_PATH, $pathToImage, 0, strlen(IMG_PATH)) == 0 or $this->errorMessage('Security constraint: Source image is not directly below the directory IMG_PATH.');
     is_null($saveAs) or in_array($saveAs, array('png', 'jpg', 'jpeg', 'gif')) or $this->errorMessage('Not a valid extension to save image as');
     is_null($quality) or is_numeric($quality) and $quality > 0 and $quality <= 100 or $this->errorMessage('Quality out of range');
     is_null($newWidth) or is_numeric($newWidth) and $newWidth > 0 and $newWidth <= $maxWidth or $this->errorMessage('Width out of range');
     is_null($newHeight) or is_numeric($newHeight) and $newHeight > 0 and $newHeight <= $maxHeight or $this->errorMessage('Height out of range');
     is_null($cropToFit) or $cropToFit and $newWidth and $newHeight or errorMessage('Crop to fit needs both width and height to work');
     //
     // Get the incoming arguments
     //
     $this->maxWidth = $maxWidth;
     $this->maxHeight = $maxHeight;
     $this->src = $src;
     $this->verbose = $verbose;
     $this->saveAs = $saveAs;
     $this->quality = $quality;
     $this->ignoreCache = $ignoreCache;
     $this->newWidth = $newWidth;
     $this->newHeight = $newHeight;
     $this->cropToFit = $cropToFit;
     $this->sharpen = $sharpen;
     $this->grayscale = $grayscale;
     $this->sepia = $sepia;
     $this->pathToImage = $pathToImage;
     $this->fileExtension = pathinfo($pathToImage)['extension'];
 }
function userExists($loginDetails, $errorMsg)
{
    $DBConnection = new DBHander();
    $DBConnection->connectToDB();
    if ($DBConnection->userExists($loginDetails)) {
        $errorMsg = "";
        errorMessage($errorMsg);
        $validUser = $_POST['login'];
        $_SESSION['validUser'] = $validUser[0];
        header("Location: home.php");
    } else {
        $errorMsg = "Invalid username and/or password";
        errorMessage($errorMsg);
    }
}
示例#12
0
function storeImages($sizes, $photo_id)
{
    for ($i = 0; $i < count($sizes); $i++) {
        // echo "This is sizes src : ".$sizes[$i]->src."<br></br>" ;
        // echo "This is sizes width : ".$sizes[$i]->width."<br></br>" ;
        // echo "This is sizes height : ".$sizes[$i]->height."<br></br>" ;
        // echo "This is sizes type : ".$sizes[$i]->type."<br></br>" ;
        // echo "This is sizes type : ".$photo_id."<br></br>" ;
        // echo "<img src=\"".$sizes[$i]->src."\" >";
        $sql = "INSERT INTO IMAGES (PID, SRC, WIDTH, HEIGHT, TYPE) \n    VALUES ('" . $photo_id . "','" . mysql_real_escape_string($sizes[$i]->src) . "','" . $sizes[$i]->width . "','" . $sizes[$i]->height . "','" . mysql_real_escape_string($sizes[$i]->type) . "')";
        $res = mysql_query($sql);
        $msg = $res ? successMessage("Uploaded and saved to IMAGES.") : errorMessage("Problem in saving to IMAGES");
        echo "=== : " . $photo_id . "  : " . $msg . " <br>";
    }
}
示例#13
0
/**
* Project:		positweb
* File name:	dao.php
* Description:	database access
* PHP version 5, mysql 5.0
*
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
*
* @author       Antonio Alcorn
* @copyright    Humanitarian FOSS Project@Trinity (http://hfoss.trincoll.edu), Copyright (C) 2009.
* @package		posit
* @subpackage
* @tutorial
* @license  http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
* @version
*/
function dbConnect()
{
    $host = DB_HOST;
    $user = DB_USER;
    $pass = DB_PASS;
    $db_name = DB_NAME;
    try {
        $db = new PDO("mysql:host={$host};dbname={$db_name}", $user, $pass);
    } catch (PDOException $e) {
        errorMessage("Database error: " . $e->getMessage());
        die;
    }
    mysql_connect($host, $user, $pass);
    mysql_select_db($db_name);
    return $db;
}
示例#14
0
/**

=head1 NAME

func_phenotypes.php - helper routines to retrieve phenotype information

=head1 SYNOPSIS

functionality on retrieving phenotype data with a recurrent use

=head1 DESCRIPTION

THe classical phenotypes are frequently used as covariates, but
they also have a life ontheir own.

=cut

/
**

=head2 list_phenotypes

=over 4

=item $dbh

data base handle to the expression QTL table with the phenotype correlations

=back

=cut
*/
function list_markers($dbh)
{
    $queryMarkers = "SELECT DISTINCT marker,chr,cmorgan_rqtl as cM FROM map ORDER BY chr,cM";
    $result = mysqli_query($dbh, $queryMarkers);
    if (empty($result)) {
        mysqli_close($dbh);
        errorMessage("Error: " . mysqli_error($dbh) . "</p><p>" . $queryPhenotypes . "</p>");
        //echo "LinkLocal: "; print_r($linkLocal);
        exit;
    }
    $markers = array();
    while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)) {
        $markers[$line["marker"]] = $line["marker"] . " " . $line["chr"] . ":" . $line["cM"];
    }
    mysqli_free_result($result);
    return $markers;
}
示例#15
0
/**

=head1 NAME

func_phenotypes.php - helper routines to retrieve phenotype information

=head1 SYNOPSIS

functionality on retrieving phenotype data with a recurrent use

=head1 DESCRIPTION

THe classical phenotypes are frequently used as covariates, but
they also have a life ontheir own.

=cut

/
**

=head2 list_phenotypes

=over 4

=item $dbh

data base handle to the expression QTL table with the phenotype correlations

=back

=cut
*/
function list_phenotypes($dbh)
{
    $queryPhenotypes = "SELECT DISTINCT phen FROM trait_phen_cor";
    $queryPhenotypes .= " LIMIT 1000";
    # just to be on the save side
    $result = mysqli_query($dbh, $queryPhenotypes);
    if (empty($result)) {
        mysqli_close($dbh);
        errorMessage("Error: " . mysqli_error($dbh) . "</p><p>" . $queryPhenotypes . "</p>");
        //echo "LinkLocal: "; print_r($linkLocal);
        exit;
    }
    $phenotypes = array();
    while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)) {
        array_push($phenotypes, $line["phen"]);
    }
    mysqli_free_result($result);
    return $phenotypes;
}
示例#16
0
                    echo $key;
                    ?>
" myID="<?php 
                    echo $crew;
                    ?>
" class="delete"><strong>Remove Award</strong></a>
				</td>
			</tr>
		
		<?php 
                }
            }
        } else {
            echo "<tr class='fontLarge orange'>";
            echo "<td colspan='4'>";
            echo "<strong>There are no awards to remove!</strong>";
            echo "</td>";
            echo "</tr>";
        }
        ?>
		</table>
	</div>
	
	<?php 
    }
    ?>
	
<?php 
} else {
    errorMessage("remove crew award");
}
 /**
  * Delete a user account.
  *
  * @since 2.0.0
  * @access public
  * @param int $UserID Unique ID.
  * @param string $Method Type of deletion to do (delete, keep, or wipe).
  */
 public function delete($UserID = '', $Method = '')
 {
     $this->permission('Garden.Users.Delete');
     $Session = Gdn::session();
     if ($Session->User->UserID == $UserID) {
         trigger_error(errorMessage("You cannot delete the user you are logged in as.", $this->ClassName, 'FetchViewLocation'), E_USER_ERROR);
     }
     $this->addSideMenu('dashboard/user');
     $this->title(t('Delete User'));
     $RoleModel = new RoleModel();
     $AllRoles = $RoleModel->getArray();
     // By default, people with access here can freely assign all roles
     $this->RoleData = $AllRoles;
     $UserModel = new UserModel();
     $this->User = $UserModel->getID($UserID);
     try {
         $CanDelete = true;
         $this->EventArguments['CanDelete'] =& $CanDelete;
         $this->EventArguments['TargetUser'] =& $this->User;
         // These are all the 'effective' roles for this delete action. This list can
         // be trimmed down from the real list to allow subsets of roles to be
         // edited.
         $this->EventArguments['RoleData'] =& $this->RoleData;
         $UserRoleData = $UserModel->getRoles($UserID)->resultArray();
         $RoleIDs = array_column($UserRoleData, 'RoleID');
         $RoleNames = array_column($UserRoleData, 'Name');
         $this->UserRoleData = ArrayCombine($RoleIDs, $RoleNames);
         $this->EventArguments['UserRoleData'] =& $this->UserRoleData;
         $this->fireEvent("BeforeUserDelete");
         $this->setData('CanDelete', $CanDelete);
         $Method = in_array($Method, array('delete', 'keep', 'wipe')) ? $Method : '';
         $this->Method = $Method;
         if ($Method != '') {
             $this->View = 'deleteconfirm';
         }
         if ($this->Form->authenticatedPostBack() && $Method != '') {
             $UserModel->delete($UserID, array('DeleteMethod' => $Method));
             $this->View = 'deletecomplete';
         }
     } catch (Exception $Ex) {
         $this->Form->addError($Ex);
     }
     $this->render();
 }
示例#18
0
     $query .= "AND module_trait_moduleMembership.MM_" . $modcolour . " >= " . $mm;
 }
 if (!empty($gs)) {
     $query .= "AND module_trait_pheno_geneSignificance.GS_" . $cli . " >= " . $gs;
 }
 if (!empty($LODmin)) {
     $query .= "AND qtl.LOD >= " . $LODmin . " ";
 }
 if (empty($order)) {
     $order .= "trait.chromosome ASC, trait_id, qtl.LOD DESC";
 }
 $query .= "ORDER BY {$order}";
 $rec_query = mysqli_query($linkLocali, $query);
 echo "<p><small>query: {$query}</small></p>\n";
 if (0 != mysqli_errno($linkLocali)) {
     errorMessage("Could not execute query:" . mysqli_error($linkLocali));
     mysqli_close($linkLocali);
     include "footer.php";
     exit;
 }
 echo "<table border=1 cellspacing=0 width=100%>";
 echo "<thead align>";
 echo "<tr bgcolor=yellow>";
 echo "<th>Trait ID</th>";
 echo "<th nowrap>Chromosome<br />Position (Mbp)</th>";
 echo "<th nowrap>Expression<br />mean +- sd</th>";
 echo "<th>Function</th><th>Gene Significane<br />({$clinical})</th>";
 echo "<th>Module Membership<br />({$modcolour})</th>";
 if (!FALSE === strpos($query, "athway")) {
     echo "<th>Pathway</th>";
 }
示例#19
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
if (isset($_POST['restore'])) {
    if (full_remove('../filter/wiris') and copy('../lib/weblib.php.old', '../lib/weblib.php') and unlink('./install.php')) {
        echo translate('System restored. Please, delete pluginwiris directory manually now.'), ' <a href="..">', translate('Go to my moodle'), '</a>.<br /><br />';
        echo errorMessage();
    } else {
        echo translate("Plugin WIRIS Installer hasn't write permisions on"), ' ../filter/wiris or ../lib/weblib.php or ./install.php<br /><br />';
        echo errorMessage();
    }
}
示例#20
0
文件: index.php 项目: neas5791/dbpo
<?php

$thispage = 'category';
?>
<!-- https://github.com/spbooks/PHPMYSQL5/blob/master/chapter4/listjokes/jokes.html.php -->
<?php 
include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/magicquote.inc.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/helper.inc.php';
// output messages to html
if (isset($_GET['invalid'])) {
    $comment = errorMessage($_GET['invalid']);
}
// launch add form
if (isset($_POST['add'])) {
    $pagetitle = 'New Category';
    $action = 'addform';
    $id = '';
    $category = '';
    $description = '';
    $button = 'Add category';
    include $_SERVER['DOCUMENT_ROOT'] . '/' . $thispage . '/form.html.php';
    exit;
}
// launch edit form
if (isset($_POST['edit'])) {
    // check that there is a selection
    if ($_POST['select'] == 0) {
        header('Location: ./?invalid=3');
        exit;
    }
    include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
示例#21
0
/**
 * Created by PhpStorm.
 * User: hoanvo
 * Date: 12/15/15
 * Time: 4:59 PM
 */
require "libs/config.php";
include "master-pages/header.php";
$sql = "SELECT * FROM " . TABLE_POSTS;
try {
    $stmt = $DB->prepare($sql);
    $stmt->execute();
    $pagesResults = $stmt->fetchAll();
} catch (Exception $ex) {
    echo errorMessage($ex->getMessage());
}
?>

<div class="container logo" xmlns="http://www.w3.org/1999/html">
    <div class="row">
        <img src="web-resources/img/logo.png" width="350px;"/>
    </div>
</div>

<div class="container">
    <div class="row">
        <div class="col-lg-12">
            <div id="slider1_container" style="visibility: hidden; position: relative; margin: 0 auto; width: 1140px; height: 667px; overflow: hidden;">
                <!-- Loading Screen -->
                <div u="loading" style="position: absolute; top: 0px; left: 0px;">
示例#22
0
 /**
  * Adds to the "To" recipient collection.
  *
  * @param mixed $RecipientEmail An email (or array of emails) to add to the "To" recipient collection.
  * @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
  * an array of email addresses, this value will be ignored.
  */
 public function to($RecipientEmail, $RecipientName = '')
 {
     if ($RecipientName != '' && c('Garden.Email.OmitToName', false)) {
         $RecipientName = '';
     }
     if (is_string($RecipientEmail)) {
         if (strpos($RecipientEmail, ',') > 0) {
             $RecipientEmail = explode(',', $RecipientEmail);
             // trim no need, PhpMailer::AddAnAddress() will do it
             return $this->to($RecipientEmail, $RecipientName);
         }
         if ($this->PhpMailer->SingleTo) {
             return $this->addTo($RecipientEmail, $RecipientName);
         }
         if (!$this->_IsToSet) {
             $this->_IsToSet = true;
             $this->addTo($RecipientEmail, $RecipientName);
         } else {
             $this->cc($RecipientEmail, $RecipientName);
         }
         return $this;
     } elseif (is_object($RecipientEmail) && property_exists($RecipientEmail, 'Email') || is_array($RecipientEmail) && isset($RecipientEmail['Email'])) {
         $User = $RecipientEmail;
         $RecipientName = val('Name', $User);
         $RecipientEmail = val('Email', $User);
         $UserID = val('UserID', $User, false);
         if ($UserID !== false) {
             // Check to make sure the user can receive email.
             if (!Gdn::userModel()->checkPermission($UserID, 'Garden.Email.View')) {
                 $this->Skipped[] = $User;
                 return $this;
             }
         }
         return $this->to($RecipientEmail, $RecipientName);
     } elseif ($RecipientEmail instanceof Gdn_DataSet) {
         foreach ($RecipientEmail->resultObject() as $Object) {
             $this->to($Object);
         }
         return $this;
     } elseif (is_array($RecipientEmail)) {
         $Count = count($RecipientEmail);
         if (!is_array($RecipientName)) {
             $RecipientName = array_fill(0, $Count, '');
         }
         if ($Count == count($RecipientName)) {
             $RecipientEmail = array_combine($RecipientEmail, $RecipientName);
             foreach ($RecipientEmail as $Email => $Name) {
                 $this->to($Email, $Name);
             }
         } else {
             trigger_error(errorMessage('Size of arrays do not match', 'Email', 'To'), E_USER_ERROR);
         }
         return $this;
     }
     trigger_error(errorMessage('Incorrect first parameter (' . getType($RecipientEmail) . ') passed to function.', 'Email', 'To'), E_USER_ERROR);
 }
示例#23
0
                            } else {
                                $_SESSION['2factor'] = 3;
                                $page = 'views/core/2factor.php';
                            }
                        }
                    } else {
                        $page = 'views/core/2factor.php';
                    }
                }
            }
            if ($debug) {
                if ($currentPage == 'debug') {
                    $page = "views/debug/debug.php";
                } elseif ($currentPage == 'phpinfo') {
                    $page = "views/debug/phpinfo.php";
                } elseif ($currentPage == 'debuglogs') {
                    $page = "views/debug/logs.php";
                } elseif ($currentPage == 'phplogs') {
                    $page = "views/debug/phplogs.php";
                }
            }
            include "views/templates/template.php";
        } else {
            include "views/core/login.php";
        }
    } else {
        $err = errorMessage(2, $lang);
    }
} else {
    include 'views/firstTime.php';
}
示例#24
0
文件: addjp.php 项目: anodyne/sms
				<td class="narrowLabel tableCellLabel">Content</td>
				<td>&nbsp;</td>
				<td><textarea name="postContent" class="desc" rows="15"></textarea></td>
			</tr>
			<tr>
				<td colspan="3" height="20"></td>
			</tr>
			
			<?php 
    if ($missionCount > "0") {
        ?>
			<tr>
				<td colspan="2">&nbsp;</td>
				<td>
					<input type="image" src="<?php 
        echo path_userskin;
        ?>
buttons/add.png" name="action" class="button" value="Add" />
				</td>
			</tr>
			<?php 
    }
    ?>
		</table>
		</form>
	</div>
	
<?php 
} else {
    errorMessage("add joint post");
}
示例#25
0
 /**
  *
  */
 public function renderMaster()
 {
     // Build the master view if necessary
     if (in_array($this->_DeliveryType, array(DELIVERY_TYPE_ALL))) {
         $this->MasterView = $this->masterView();
         // Only get css & ui components if this is NOT a syndication request
         if ($this->SyndicationMethod == SYNDICATION_NONE && is_object($this->Head)) {
             $CssAnchors = AssetModel::getAnchors();
             $this->EventArguments['CssFiles'] =& $this->_CssFiles;
             $this->fireEvent('BeforeAddCss');
             $ETag = AssetModel::eTag();
             $CombineAssets = c('Garden.CombineAssets');
             $ThemeType = isMobile() ? 'mobile' : 'desktop';
             // And now search for/add all css files.
             foreach ($this->_CssFiles as $CssInfo) {
                 $CssFile = $CssInfo['FileName'];
                 if (!array_key_exists('Options', $CssInfo) || !is_array($CssInfo['Options'])) {
                     $CssInfo['Options'] = array();
                 }
                 $Options =& $CssInfo['Options'];
                 // style.css and admin.css deserve some custom processing.
                 if (in_array($CssFile, $CssAnchors)) {
                     if (!$CombineAssets) {
                         // Grab all of the css files from the asset model.
                         $AssetModel = new AssetModel();
                         $CssFiles = $AssetModel->getCssFiles($ThemeType, ucfirst(substr($CssFile, 0, -4)), $ETag);
                         foreach ($CssFiles as $Info) {
                             $this->Head->addCss($Info[1], 'all', true, $CssInfo);
                         }
                     } else {
                         $Basename = substr($CssFile, 0, -4);
                         $this->Head->addCss(url("/asset/css/{$ThemeType}/{$Basename}-{$ETag}.css", '//'), 'all', false, $CssInfo['Options']);
                     }
                     continue;
                 }
                 $AppFolder = $CssInfo['AppFolder'];
                 $LookupFolder = !empty($AppFolder) ? $AppFolder : $this->ApplicationFolder;
                 $Search = AssetModel::CssPath($CssFile, $LookupFolder, $ThemeType);
                 if (!$Search) {
                     continue;
                 }
                 list($Path, $UrlPath) = $Search;
                 if (isUrl($Path)) {
                     $this->Head->AddCss($Path, 'all', val('AddVersion', $Options, true), $Options);
                     continue;
                 } else {
                     // Check to see if there is a CSS cacher.
                     $CssCacher = Gdn::factory('CssCacher');
                     if (!is_null($CssCacher)) {
                         $Path = $CssCacher->get($Path, $AppFolder);
                     }
                     if ($Path !== false) {
                         $Path = substr($Path, strlen(PATH_ROOT));
                         $Path = str_replace(DS, '/', $Path);
                         $this->Head->addCss($Path, 'all', true, $Options);
                     }
                 }
             }
             // Add a custom js file.
             if (arrayHasValue($this->_CssFiles, 'style.css')) {
                 $this->addJsFile('custom.js');
                 // only to non-admin pages.
             }
             $Cdns = array();
             if (!c('Garden.Cdns.Disable', false)) {
                 $Cdns = array('jquery.js' => "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js");
             }
             // And now search for/add all JS files.
             $this->EventArguments['Cdns'] =& $Cdns;
             $this->fireEvent('AfterJsCdns');
             $this->Head->addScript('', 'text/javascript', false, array('content' => $this->definitionList(false)));
             foreach ($this->_JsFiles as $Index => $JsInfo) {
                 $JsFile = $JsInfo['FileName'];
                 if (!is_array($JsInfo['Options'])) {
                     $JsInfo['Options'] = array();
                 }
                 $Options =& $JsInfo['Options'];
                 if (isset($Cdns[$JsFile])) {
                     $JsFile = $Cdns[$JsFile];
                 }
                 $AppFolder = $JsInfo['AppFolder'];
                 $LookupFolder = !empty($AppFolder) ? $AppFolder : $this->ApplicationFolder;
                 $Search = AssetModel::JsPath($JsFile, $LookupFolder, $ThemeType);
                 if (!$Search) {
                     continue;
                 }
                 list($Path, $UrlPath) = $Search;
                 if ($Path !== false) {
                     $AddVersion = true;
                     if (!isUrl($Path)) {
                         $Path = substr($Path, strlen(PATH_ROOT));
                         $Path = str_replace(DS, '/', $Path);
                         $AddVersion = val('AddVersion', $Options, true);
                     }
                     $this->Head->addScript($Path, 'text/javascript', $AddVersion, $Options);
                     continue;
                 }
             }
         }
         // Add the favicon.
         $Favicon = C('Garden.FavIcon');
         if ($Favicon) {
             $this->Head->setFavIcon(Gdn_Upload::url($Favicon));
         }
         // Make sure the head module gets passed into the assets collection.
         $this->addModule('Head');
     }
     // Master views come from one of four places:
     $MasterViewPaths = array();
     if (strpos($this->MasterView, '/') !== false) {
         $MasterViewPaths[] = combinePaths(array(PATH_ROOT, str_replace('/', DS, $this->MasterView) . '.master*'));
     } else {
         if ($this->Theme) {
             // 1. Application-specific theme view. eg. root/themes/theme_name/app_name/views/
             $MasterViewPaths[] = combinePaths(array(PATH_THEMES, $this->Theme, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
             // 2. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/
             $MasterViewPaths[] = combinePaths(array(PATH_THEMES, $this->Theme, 'views', $this->MasterView . '.master*'));
         }
         // 3. Plugin default. eg. root/plugin_name/views/
         $MasterViewPaths[] = combinePaths(array(PATH_ROOT, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
         // 4. Application default. eg. root/app_name/views/
         $MasterViewPaths[] = combinePaths(array(PATH_APPLICATIONS, $this->ApplicationFolder, 'views', $this->MasterView . '.master*'));
         // 5. Garden default. eg. root/dashboard/views/
         $MasterViewPaths[] = combinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', $this->MasterView . '.master*'));
     }
     // Find the first file that matches the path.
     $MasterViewPath = false;
     foreach ($MasterViewPaths as $Glob) {
         $Paths = safeGlob($Glob);
         if (is_array($Paths) && count($Paths) > 0) {
             $MasterViewPath = $Paths[0];
             break;
         }
     }
     $this->EventArguments['MasterViewPath'] =& $MasterViewPath;
     $this->fireEvent('BeforeFetchMaster');
     if ($MasterViewPath === false) {
         trigger_error(errorMessage("Could not find master view: {$this->MasterView}.master*", $this->ClassName, '_FetchController'), E_USER_ERROR);
     }
     /// A unique identifier that can be used in the body tag of the master view if needed.
     $ControllerName = $this->ClassName;
     // Strip "Controller" from the body identifier.
     if (substr($ControllerName, -10) == 'Controller') {
         $ControllerName = substr($ControllerName, 0, -10);
     }
     // Strip "Gdn_" from the body identifier.
     if (substr($ControllerName, 0, 4) == 'Gdn_') {
         $ControllerName = substr($ControllerName, 4);
     }
     $this->setData('CssClass', $this->Application . ' ' . $ControllerName . ' ' . $this->RequestMethod . ' ' . $this->CssClass, true);
     // Check to see if there is a handler for this particular extension.
     $ViewHandler = Gdn::factory('ViewHandler' . strtolower(strrchr($MasterViewPath, '.')));
     if (is_null($ViewHandler)) {
         $BodyIdentifier = strtolower($this->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::alphaNumeric(strtolower($this->RequestMethod)));
         include $MasterViewPath;
     } else {
         $ViewHandler->render($MasterViewPath, $this);
     }
 }
示例#26
0
文件: addaward.php 项目: anodyne/sms
</strong><br />
					<span class="fontSmall"><?php 
            printText($awardDesc);
            ?>
</span>
				</td>
				<td width="10%" align="center">
					<a href="#" rel="facebox" myAward="<?php 
            echo $awardid;
            ?>
" myID="<?php 
            echo $crew;
            ?>
" class="add"><strong>Give Award</strong></a>
				</td>
			</tr>
	
		<?php 
        }
        ?>
		</table>
	</div>
	
	<?php 
    }
    ?>

<?php 
} else {
    errorMessage("add crew award");
}
示例#27
0
文件: docking.php 项目: anodyne/sms
            ?>
"><strong>View</strong></a>
						</td>
						<td align="center">
							<a href="#" rel="facebox" myAction="delete" myID="<?php 
            echo $v2['id'];
            ?>
" class="delete"><strong>Delete</strong></a></td>
						<td align="center">
							<a href="#" rel="facebox" myAction="edit" myID="<?php 
            echo $v2['id'];
            ?>
" class="edit"><strong>Edit</strong></a></td>
					</tr>	
					<?php 
        }
        ?>
				</table>
					
				<?php 
    }
    ?>
			</div>
		</div>
		
	</div>
	
<?php 
} else {
    errorMessage("docked ship management");
}
					<?php 
errorMessage($this->bioError);
?>
				</div>
				<div class="medium-6 columns">
					<label for="profile-image">Proile Image: </label>
					<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
					<input type="file" class="button tiny" name="profile-image" id="profile-image">
					<?php 
errorMessage($this->profileImageError);
?>
				</div>
				<div class="columns">
					<input type="submit" class="button tiny" value="Add new staff member" name="add-staff">
					<?php 
errorMessage($this->staffErrorMessage);
// If there is a message to display
$this->foundationAlert($this->staffSuccessMessage, 'success');
?>
				</div>
			</div>
		</form>
	</div>
</div>

<div class="row" id="add-deal">
	<div class="columns">
		<h2>Add a new Deal</h2>
		<form action="index.php?page=account#add-deal" method="post" enctype="multipart/form-data">
			<div class="row">
				<div class="large-6 columns">
示例#29
0
    ?>
</th>
                    <th> <?php 
    echo $lang['edit'];
    ?>
</th>
                </tr>
                </thead>
                <tbody>
                <?php 
    while ($row = mysqli_fetch_assoc($result_of_query)) {
        echo "<tr>";
        echo "<td class='hidden-xs'>" . $row["wantedID"] . "</td>";
        echo "<td>" . $row["wantedName"] . "</td>";
        echo "<td class='hidden-xs'>" . $row["wantedBounty"] . "</td>";
        echo "<td class='hidden-xs'>" . yesNo($row["active"], $lang) . "</td>";
        echo "<td><a class='btn btn-primary btn-xs' href='editWanted/" . $row["wantedID"] . "'>";
        echo "<i class='fa fa-pencil'></i></a></td>";
        echo "</tr>";
    }
    echo "</tbody></table>";
    ?>
                </tbody>
                <br>
            </table>
        </div>
    </div>
<?php 
} else {
    echo errorMessage(3, $lang);
}
示例#30
0
    $element = Form::textarea($name, $value, ['placeholder' => $placeholder, 'class' => 'form-control', 'id' => $name]);
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            {$element}" . errorMessage($name) . "</div>";
});
Form::macro('selectField', function ($name, $options, $value, $label) {
    $element = Form::select($name, $options, $value, ['class' => 'form-control']);
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            {$element}" . errorMessage($name) . "</div>";
});
Form::macro('multiSelectField', function ($name, $options, $value = null, $label) {
    $element = Form::select($name, $options, $value, ['class' => 'form-control multiselect', 'multiple']);
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            {$element}" . errorMessage($name) . "</div>";
});
Form::macro('selectTag', function ($name, $id, $label) {
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>\n            <input id='{$id}' class='form-control' name='{$name}'/>" . errorMessage($name) . "</div>";
});
Form::macro('fileField', function ($name, $label) {
    return "<div class='form-group " . errorClass($name) . "'>\n            <label class='control-label' for='{$name}'>{$label}</label>" . Form::file($name) . errorMessage($name) . "</div>";
});
Form::macro('submitField', function ($value = 'Submit', $btn_style = 'btn btn-primary') {
    return "<div class='form-group'>\n            <button type='submit' class='{$btn_style}'>{$value}</button>\n            </div>";
});
if (!function_exists('errorMessage')) {
    function errorMessage($name)
    {
        if ($errors = Session::get('errors')) {
            return $errors->first($name, '<p class="help-block">:message</p>');
        }
        return "<p class='help-block' id='{$name}'></p>";
    }
}
if (!function_exists('errorClass')) {
    function errorClass($name)