当前位置: 首页>>代码示例>>PHP>>正文


PHP returnData函数代码示例

本文整理汇总了PHP中returnData函数的典型用法代码示例。如果您正苦于以下问题:PHP returnData函数的具体用法?PHP returnData怎么用?PHP returnData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了returnData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchClassData

function fetchClassData($year, $db)
{
    $statement = $db->prepare("SELECT DISTINCT(name) FROM UWISE.donors WHERE year = :year");
    $statement->execute(array(':year' => $year));
    $row = $statement->fetchAll();
    returnData($row);
}
开发者ID:bk110w,项目名称:endowment,代码行数:7,代码来源:functions.php

示例2: makeRequest

 /**
     Querys the database with the given request.
     @param string $query db query.
     @return string
     **/
 public function makeRequest($query)
 {
     $content = file_get_contents($this->_url . urlencode($query));
     if ($content === false) {
         returnData('Influxdb not reachable', 1, 'Influxdb not reachable');
     } else {
         return json_decode($content, true)['results'];
     }
 }
开发者ID:simonmeggle,项目名称:histou,代码行数:14,代码来源:database.php

示例3: testDb

function testDb()
{
    global $Dbc, $debug, $message, $success;
    if (!empty($_POST['email']) && emailValidate($_POST['email']) && !empty($_POST['firstName']) && !empty($_POST['lastName']) && !empty($_POST['password']) && passwordValidate($_POST['password'])) {
        destroySession();
        $email = trim($_POST['email']);
        $pass = sha1(trim($_POST['password']));
        $firstName = trim($_POST['firstName']);
        $lastName = trim($_POST['lastName']);
        $rememberMeCode = sha1($email);
        $Dbc->beginTransaction();
        try {
            $stmt = $Dbc->prepare("SELECT getUserIdByEmail(?) AS 'userId'");
            $stmt .= $stmt->execute(array($email));
            while ($row = $stmt->fetch()) {
                $debug->add('$row[\'userId\']: ' . $row['userId']);
                $debug->printArray($row, '$row');
                if (empty($row['userId'])) {
                    //There are no users with the email address, so continue.
                    pdoError(__LINE__, $stmt, 1);
                    $stmt = $Dbc->prepare("INSERT INTO\n\tusers\nSET\n\tprimaryEmail = ?,\n\tuserPassword = ?,\n\tfirstName = ?,\n\tlastName = ?,\n\tjoinDate = ?");
                    if ($stmt->execute(array($email, $pass, $firstName, $lastName, DATETIME))) {
                        $debug->add('last id: ' . $Dbc->lastInsertId());
                    } else {
                        pdoError(__LINE__, $stmt);
                    }
                } else {
                    $message .= 'That email address is already associated with an account. Please enter a different email address.<br>';
                }
            }
        } catch (PDOException $e) {
            //Rollback occurs automatically if an exception is thrown.
            error(__LINE__, '', '<pre>' . $e . '</pre>');
            pdoError(__LINE__);
        }
    } elseif (empty($_POST['email'])) {
        $debug->add('email is empty on line ' . __LINE__ . '');
        $message .= 'Please enter an email address.';
    } elseif (!emailValidate($_POST['email'])) {
        $message .= 'Please enter a valid email address.';
        $debug->add('Email address is not valid.');
    } elseif (empty($_POST['firstName'])) {
        $debug->add('first name is empty on line ' . __LINE__ . '.');
        $message .= 'Please enter a First Name.';
    } elseif (empty($_POST['lastName'])) {
        $debug->add('last name is empty on line ' . __LINE__ . '.');
        $message .= 'Please enter a Last Name.';
    } elseif (empty($_POST['password'])) {
        $debug->add('password is empty on line ' . __LINE__ . '.');
        $message .= 'Please enter a password.';
    } else {
        $debug->add('Something is missing.');
    }
    returnData();
}
开发者ID:mark-orussa,项目名称:Adrlist,代码行数:55,代码来源:testMethods.php

示例4: parsIni

/**
Parses the configuration file.
@param string $filename Path to the configuration file.
@return null.
**/
function parsIni($filename)
{
    if (empty($filename) || !file_exists($filename)) {
        returnData("", 1, "Configuration not found: " . $filename);
    }
    $config = parse_ini_file($filename, true);
    setConstant("DEFAULT_SOCKET_TIMEOUT", $config['general']['socketTimeout'], 10);
    setConstant("INFLUX_URL", $config['influxdb']['influxdbUrl'], "http://127.0.0.1:8086/query?db=icinga");
    setConstant("INFLUX_FIELDSEPERATOR", $config['influxdb']['influxFieldseperator'], "&");
    setConstant("DEFAULT_TEMPLATE_FOLDER", $config['folder']['defaultTemplateFolder'], "histou/templates/default/");
    setConstant("CUSTOM_TEMPLATE_FOLDER", $config['folder']['customTemplateFolder'], "histou/templates/custom/");
}
开发者ID:simonmeggle,项目名称:histou,代码行数:17,代码来源:basic.php

示例5: storeData

 function storeData($library_id, $command, $table, $values)
 {
     $event_tables = array('answers', 'borrows', 'open_scores', 'permissions', 'supports', 'belongs', 'transactions');
     $entity_tables = array('roots', 'branches', 'users', 'authors', 'publications', 'objects', 'matches', 'files');
     if (count($values) > 0 && (in_array($table, $event_tables) || in_array($table, $entity_tables))) {
         $query = '';
         $values = join(',', $values);
         if ($command == 'insert') {
             $query = "insert ignore into {$table} values {$values}";
         } else {
             if ($command == 'update') {
                 $query = "replace into {$table} values {$values}";
             } else {
                 if ($command == 'delete') {
                     $query = "delete from {$table} where id in ({$values})" . (in_array($table, $event_tables) ? " and library_id = {$library_id}" : '');
                 } else {
                     returnData('Invalid Db Command');
                 }
             }
         }
         DB::query($query);
     }
 }
开发者ID:nournia,项目名称:ketabkhaane-server,代码行数:23,代码来源:backend.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $count = Category::destroy($id);
     if ($count > 0) {
         return returnData(true, [], true);
     }
     return returnData(false, [], true);
 }
开发者ID:gavin66,项目名称:blog,代码行数:14,代码来源:CategoryController.php

示例7: returnData

            }
        }
        returnData($data);
        saveData($data);
        break;
    case 'DELETE':
        $index = 0;
        $i = 0;
        foreach ($data as $val) {
            if ($val['ranges']['0']['start'] == $jsonObj['ranges']['0']['start'] && $val['ranges']['0']['startOffset'] == $jsonObj['ranges']['0']['startOffset'] && $val['ranges']['0']['end'] == $jsonObj['ranges']['0']['end'] && $val['ranges']['0']['endOffset'] == $jsonObj['ranges']['0']['endOffset'] && $val['quote'] == $jsonObj['quote']) {
                $index = $i;
            }
            $i++;
        }
        unset($data[$index]);
        returnData($data);
        saveData($data);
        break;
}
/* TODO 
-> authentication
-> multi-users
*/
/**/
function saveData($data)
{
    $data = json_encode($data);
    file_put_contents('data.json', $data);
}
function returnData($data)
{
开发者ID:ASGdev,项目名称:annotatorjs-simple-backend,代码行数:31,代码来源:index.php

示例8: define

<?php

/*
 * Copyright (c) 2006/2007 Flipperwing Ltd. (http://www.flipperwing.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
/**
 * @author andy.scholz@gmail.com
 * @copyright (c)2006-2007 Flipperwing Ltd.
 */
// Set flag that this is a parent file
define('_VALID_MOS', 1);
require_once "../../init.php";
require_once $csModelsDir . "/JUser.php";
$filter = new Filter($_REQUEST);
$obj = new JUser(&$database);
$results = $obj->listObjects($filter);
returnData($results);
开发者ID:bthamrin,项目名称:gwtwindowmanager,代码行数:29,代码来源:list.php

示例9: returnOK

function returnOK($message = null, $attributes = null)
{
    returnData(new RemoteStatus(STATUS_OK, $message, $attributes));
}
开发者ID:bthamrin,项目名称:gwtwindowmanager,代码行数:4,代码来源:init.php

示例10: parsArgs

/**
Parses the GET parameter.
@return null.
**/
function parsArgs()
{
    if (isset($_GET['host']) && !empty($_GET['host'])) {
        define("HOST", $_GET["host"]);
    } else {
        returnData('Hostname is missing!', 1, 'Hostname is missing!');
    }
    if (isset($_GET['service']) && !empty($_GET['service'])) {
        define("SERVICE", $_GET["service"]);
    } else {
        define("SERVICE", "");
    }
    if (isset($_GET['debug'])) {
        Debug::enable();
    }
    if (isset($_GET['height']) && !empty($_GET['height'])) {
        define("HEIGHT", $_GET["height"]);
    } else {
        define("HEIGHT", "400px");
    }
    if (isset($_GET['legend']) && !empty($_GET['legend'])) {
        if ($_GET["legend"] == "true") {
            define("LEGEND_SHOW", true);
        } else {
            define("LEGEND_SHOW", false);
        }
    } else {
        define("LEGEND_SHOW", true);
    }
}
开发者ID:simonmeggle,项目名称:histou,代码行数:34,代码来源:index.php

示例11: getFolderInfo

function getFolderInfo($requestingUserId, $folderId)
{
    /*
    Get a folder's information as it relates to a user. The name, created date, modified date, creator, modifier, folderRoleId, and it's lists in an array(listId=>listname).
    $userId = (int) the id of the requesting user. This is to verify the user has role of Member (1) or greater.
    $folderId = (int) the id of the folder.
    Returns (array) of the lists in the folder and the user's role, otherwise (boolean) false. Use === false to check for failure as it's possible a list could be named "0".
    */
    global $debug, $message, $success, $Dbc;
    $output = '';
    try {
        if (empty($requestingUserId)) {
            throw new Adrlist_CustomException('', '$requestingUserId is empty.');
        } elseif (empty($folderId)) {
            throw new Adrlist_CustomException('', '$folderId is empty.');
        }
        $requestingUserId = intThis($requestingUserId);
        $folderId = intThis($folderId);
        //Get the folder's name.
        $stmt = $Dbc->prepare("SELECT\n\tfolders.folderName AS 'folderName',\n\tfolders.cId AS 'cId',\n\tfolders.created AS 'created',\n\tfolders.mId AS 'mId',\n\tfolders.modified AS 'modified',\n\tlists.listId AS 'listId',\n\tlists.listName AS 'listName',\n\tuserFolderSettings.folderRoleId AS 'folderRoleId'\nFROM\n\tuserFolderSettings\nJOIN\n\tfolders ON userFolderSettings.folderId = folders.folderId\nLEFT JOIN\n\tlists ON lists.folderId = userFolderSettings.folderId\nWHERE\n\tuserFolderSettings.userId = ? AND\n\tuserFolderSettings.folderId = ?");
        $params = array($requestingUserId, $folderId);
        $stmt->execute($params);
        $folderArray = array();
        $listArray = array();
        $foundRecords = false;
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            if ($row['folderName'] === '' || $row['folderName'] === NULL) {
                pdoError(__LINE__, $stmt, $params, true);
                return false;
            }
            $folderArray['folderName'] = $row['folderName'];
            $folderArray['cId'] = $row['cId'];
            $folderArray['created'] = $row['created'];
            $folderArray['mId'] = $row['mId'];
            $folderArray['modified'] = $row['modified'];
            $folderArray['folderRoleId'] = empty($row['folderRoleId']) ? 0 : $row['folderRoleId'];
            $listArray[] = array($row['listId'] => $row['listName']);
            $foundRecords = true;
        }
        if (!$foundRecords) {
            return false;
        } else {
            $folderArray['listArray'] = $listArray;
            return $folderArray;
        }
    } catch (Adrlist_CustomException $e) {
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
        if (MODE !== '') {
            returnData();
        }
    }
    return false;
}
开发者ID:mark-orussa,项目名称:Adrlist,代码行数:54,代码来源:functions.php

示例12: foreach

        if ($favourites != "") {
            $list .= '<div id="favourites"><table border="2"><tr><th><center><div id="title">Game</div></center></th><th><center><div id="title">Remove</div></center></th></tr>';
            foreach ($arr as $id) {
                if ($id != "") {
                    $data = mysql_fetch_array(mysql_query("SELECT * FROM gmes WHERE id = '{$id}'"));
                    $gme_name = $data['gme_name'];
                    $list .= '<tr><td><div id="gmeName"><a id="link" href="' . $mirrorUrl . '?ext=/scripts/PlaySWF.php?id=' . $id . '">' . $gme_name . '</a></div></td><td><a id="x" href="javascript:removeFav(' . $id . ')"><center>Remove</center></a></td></tr>';
                }
            }
            $list .= "</div></table>";
            $list = base64_encode($list);
            returnData($list);
            break;
        }
        break;
    case "removeRequest":
        $id = secureForDB($_POST['id']);
        mysql_query("UPDATE requests SET hidden = '1' WHERE id = '{$id}'");
        $q = mysql_query("SELECT * FROM requests WHERE hidden = '0'");
        if (!mysql_num_rows($q) == 0) {
            $tbl = '<div id="requests"><table border="1"><tr><th>Game Name</th><th>Username</th><th>Email</th><th>Date</th><th>Remove</th></tr>';
            while ($row = mysql_fetch_array($q)) {
                $tbl .= '<tr><td><a href="' . $row['game_url'] . '">' . $row['game_name'] . '</a></td><td>' . $row['username'] . '</td><td>' . $row['email'] . '</td><td>' . $row['date'] . '</td><td><a id="remove" href="javascript:removeRequest(' . $row['id'] . ');">X</a></td></tr>';
            }
            $tbl .= "</table>";
            returnData(base64_encode($tbl));
        } else {
            returnData(base64_encode("There are currently no requests"));
        }
        break;
}
开发者ID:ManselD,项目名称:Old-PHP-Game-Site,代码行数:31,代码来源:JqueryDo.php

示例13: buildTRT

function buildTRT()
{
    //The total running time of all adr lines, according to the TC in and out points. Lines with malformed or missing TC are not counted.
    global $debug, $message, $success, $Dbc;
    try {
        $output = '';
        $Dbc->beginTransaction();
        $stmt = $Dbc->prepare("SELECT\n\tlineId as 'lineId',\n\ttcIn as 'tcIn',\n\ttcOut as 'tcOut'\nFROM\n\tlinesTable\nWHERE\n\tlistId = ? AND\n\ttcIn <> ? AND\n\ttcOut <> ?");
        $params = array($_SESSION['listId'], '', '');
        $stmt->execute($params);
        $rowsFound = 0;
        $hours = 0;
        $minutes = 0;
        $seconds = 0;
        $frames = 0;
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            //Validate the tc first.
            $output .= 'In: ' . $row['tcIn'] . ', Out: ' . $row['tcOut'] . '<br>';
            $tcInNumbers = str_replace(':', '', $row['tcIn']);
            $tcOutNumbers = str_replace(':', '', $row['tcOut']);
            $thisCount = $tcOutNumbers - $tcInNumbers;
            if ($thisCount < 0) {
                return 'The TC Out value is earlier than the TC In value for line ID: ' . $row['lineId'] . '.<br>';
            } else {
                $hours = $count += $thisCount;
            }
            $tcInArray = splitTC($row['tcIn']);
            $tcOutArray = splitTC($row['tcOut']);
            $rowsFound++;
        }
        if (!$rowsFound) {
            $output .= 'There were no valid time code fields.';
        }
        $Dbc->commit();
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
        if (MODE == 'buildTRT') {
            returnData();
        } else {
            return $output;
        }
    }
    if (MODE == 'buildTRT') {
        returnData();
    } else {
        return $output;
    }
}
开发者ID:mark-orussa,项目名称:Adrlist,代码行数:48,代码来源:reportMethods.php

示例14: buildTimeZones

    public static function buildTimeZones()
    {
        //Build a drop down list of times every 15 minutes. This function is dependent on date_default_timezone_set('UTC').
        global $debug, $message, $success, $Dbc, $returnThis;
        $output = '';
        try {
            if (empty($_POST['timestampMilliseconds'])) {
                throw new Adrlist_CustomException('', '$_POST[\'timestamp\'] is empty.');
            } elseif (empty($_POST['offsetMinutes'])) {
                throw new Adrlist_CustomException('', '$_POST[\'offsetMinutes\'] is empty.');
            }
            $label = empty($_POST['label']) ? 'Time Zone' : $_POST['label'];
            $jsTimestamp = round(($_POST['timestampMilliseconds'] - $_POST['offsetMinutes'] * 1000 * 60) / 1000);
            $debug->add('$_POST[\'timestampMilliseconds\']: ' . $_POST['timestampMilliseconds'] . '<br>
	$_POST[\'offsetMinutes\']: ' . $_POST['offsetMinutes'] . '<br>
	$jsTimestamp: ' . "{$jsTimestamp}.");
            $now = time();
            $timeZones = DateTimeZone::listIdentifiers();
            $potentialTimeZones = array();
            $allTimeZones = array();
            foreach ($timeZones as $timeZone) {
                //Use the DateTime class to determine the local time for $location.
                $dt = new DateTime('@' . $now);
                //Accepts a strtotime() string.
                $dt->setTimeZone(new DateTimeZone($timeZone));
                //Change to a different timezone.
                //$timestamp = $dt->format('U');
                $formatted = $dt->format('M j, g:i A');
                $timestamp = strtotime($formatted);
                $allTimeZones[$timeZone] = $timestamp . ', ' . $formatted;
                if (abs($timestamp - $jsTimestamp) < 450) {
                    //7 1/2 minutes
                    $potentialTimeZones[] = $timeZone;
                }
            }
            //$debug->printArray($allTimeZones,'$allTimeZones');
            //$debug->printArray($potentialTimeZones,'$potentialTimeZones');
            //If the user is logged in, select their current timezone.
            if (!empty($_SESSION['userId'])) {
                $checkStmt = $Dbc->prepare("SELECT\n\ttimeZone AS 'timeZone'\nFROM\n\tuserSiteSettings\nWHERE\n\tuserId = ?");
                $checkStmt->execute(array($_SESSION['userId']));
                $row = $checkStmt->fetch(PDO::FETCH_ASSOC);
                $selectedTimeZone = $row['timeZone'];
            } else {
                $selectedTimeZone = '';
            }
            $output .= '<div class="ui-field-contain">';
            $output .= '<label for="timeZoneSelect" class="select">' . $label . '</label>
<select name="timeZoneSelect" id="timeZoneSelect" data-mini="false" data-inline="true">';
            foreach ($potentialTimeZones as $timeZone) {
                $output .= '<option value="' . $timeZone . '"';
                if ($selectedTimeZone && $timeZone == $selectedTimeZone) {
                    $output .= ' selected="selected"';
                } elseif ($timeZone == 'America/Los_Angeles') {
                    $output .= ' selected="selected"';
                }
                $output .= '>' . Adrlist_Time::timeZoneDisplay($timeZone) . '</option>';
            }
            $output .= '</select>
</div>';
            $success = true;
            $returnThis['timeZones'] = $output;
        } catch (Adrlist_CustomException $e) {
        } catch (PDOException $e) {
            error(__LINE__, '', '<pre>' . $e . '</pre>');
        }
        if (MODE == 'buildTimeZones') {
            returnData();
        } else {
            return $output;
        }
    }
开发者ID:mark-orussa,项目名称:Adrlist,代码行数:72,代码来源:Time.php

示例15: saveSettings

function saveSettings()
{
    //Save the user's settings.
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        if (empty($_POST['timeZone'])) {
            throw new Adrlist_CustomException('', '$_POST[\'timeZone\'] is empty.');
        } elseif (empty($_POST['dateFormat'])) {
            throw new Adrlist_CustomException('', '$_POST[\'dateFormat\'] is empty.');
        } elseif (!isset($_POST['viewListOnLogin'])) {
            throw new Adrlist_CustomException('', '$_POST[\'viewListOnLogin\'] is not set.');
        } elseif (!isset($_POST['defaultShowCharacterColors'])) {
            throw new Adrlist_CustomException('', '$_POST[\'defaultShowCharacterColors\'] is not set.');
        }
        $debug->add('$_POST[\'dateFormat\']: ' . $_POST['dateFormat'] . '<br>
$_POST[\'viewListOnLogin\']: ' . $_POST['viewListOnLogin'] . '<br>
$_POST[\'defaultShowCharacterColors\']: ' . $_POST['defaultShowCharacterColors']);
        //Get the dateFormat.
        $dateFormatArray = Adrlist_Time::getDateFormats();
        list($dateFormat, $example) = $dateFormatArray[$_POST['dateFormat']];
        $_SESSION['dateFormat'] = $dateFormat;
        $viewListOnLogin = $_POST['viewListOnLogin'] === 'true' ? 1 : 0;
        $defaultShowCharacterColors = $_POST['defaultShowCharacterColors'] === 'true' ? 1 : 0;
        $debug->add('viewListOnLogin: ' . "{$viewListOnLogin}" . '<br>
defaultShowCharacterColors: ' . "{$defaultShowCharacterColors}.");
        $stmt = $Dbc->prepare("UPDATE\n\tuserSiteSettings\nSET\n\ttimeZone = ?,\n\tdateFormatId = ?,\n\tviewListOnLogin = ?,\n\tdefaultShowCharacterColors = ?\nWHERE\n\tuserSiteSettings.userId = ?");
        $params = array($_POST['timeZone'], $_POST['dateFormat'], $viewListOnLogin, $defaultShowCharacterColors, $_SESSION['userId']);
        $stmt->execute($params);
        $message .= 'Saved Settings';
        $success = MODE == 'saveSettings' ? true : $success;
        //It's okay if no lines were updated by these queries.
    } catch (Adrlist_CustomException $e) {
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'saveSettings') {
        returnData();
    }
}
开发者ID:mark-orussa,项目名称:Adrlist,代码行数:40,代码来源:myAccountMethods.php


注:本文中的returnData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。