function processing()
 {
     global $sModule;
     global $sFfmpegPath;
     global $sModulesPath;
     global $sFilesPath;
     $iFilesCount = getSettingValue($sModule, "processCount");
     if (!is_numeric($iFilesCount)) {
         $iFilesCount = 2;
     }
     $iFailedTimeout = getSettingValue($sModule, "failedTimeout");
     if (!is_numeric($iFailedTimeout)) {
         $iFailedTimeout = 1;
     }
     $iFailedTimeout *= 86400;
     $sDbPrefix = DB_PREFIX . ucfirst($sModule);
     $iCurrentTime = time();
     //remove all tokens older than 10 minutes
     getResult("DELETE FROM `" . $sDbPrefix . "Tokens` WHERE `Date`<'" . ($iCurrentTime - 600) . "'");
     getResult("UPDATE `" . $sDbPrefix . "Files` SET `Date`='" . $iCurrentTime . "', `Status`='" . VC_STATUS_FAILED . "' WHERE `Status`='" . VC_STATUS_PROCESSING . "' AND `Date`<'" . ($iCurrentTime - $iFailedTimeout) . "'");
     $rResult = getResult("SELECT * FROM `" . $sDbPrefix . "Files` WHERE `Status`='" . VC_STATUS_PENDING . "' ORDER BY `ID` LIMIT " . $iFilesCount);
     for ($i = 0; $i < mysql_num_rows($rResult); $i++) {
         $aFile = mysql_fetch_assoc($rResult);
         if (!_convert($aFile['ID'])) {
             getResult("UPDATE `" . $sDbPrefix . "Files` SET `Status`='" . VC_STATUS_FAILED . "' WHERE `ID`='" . $aFile['ID'] . "'");
         }
     }
 }
function getBlockedUsers($sBlockerId)
{
    $aUsers = array();
    $rResult = getResult("SELECT `Profile` FROM `sys_block_list` WHERE `ID`='" . $sBlockerId . "'");
    while ($aUser = mysql_fetch_assoc($rResult)) {
        $aUsers[] = $aUser['Profile'];
    }
    return $aUsers;
}
Example #3
0
 function processing()
 {
     global $sModule;
     global $sFfmpegPath;
     global $sModulesPath;
     global $sFilesPath;
     $iFilesCount = getSettingValue($sModule, "processCount");
     if (!is_numeric($iFilesCount)) {
         $iFilesCount = 2;
     }
     $iFailedTimeout = getSettingValue($sModule, "failedTimeout");
     if (!is_numeric($iFailedTimeout)) {
         $iFailedTimeout = 1;
     }
     $iFailedTimeout *= 86400;
     $sDbPrefix = DB_PREFIX . ucfirst($sModule);
     $iCurrentTime = time();
     do {
         //remove all tokens older than 10 minutes
         if (!getResult("DELETE FROM `" . $sDbPrefix . "Tokens` WHERE `Date`<'" . ($iCurrentTime - 600) . "'")) {
             break;
         }
         if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Date`='" . $iCurrentTime . "', `Status`='" . STATUS_FAILED . "' WHERE `Status`='" . STATUS_PROCESSING . "' AND `Date`<'" . ($iCurrentTime - $iFailedTimeout) . "'")) {
             break;
         }
         $rResult = getResult("SELECT * FROM `" . $sDbPrefix . "Files` WHERE `Status`='" . STATUS_PENDING . "' ORDER BY `ID` LIMIT " . $iFilesCount);
         if (!$rResult) {
             break;
         }
         for ($i = 0; $i < mysql_num_rows($rResult); $i++) {
             $aFile = mysql_fetch_assoc($rResult);
             if (convertVideo($aFile['ID'])) {
                 $sType = 'bx_videos';
                 //album counter & cover update
                 if (getSettingValue($sModule, "autoApprove") == TRUE_VAL) {
                     $oAlbum = new BxDolAlbums($sType);
                     $oAlbum->updateObjCounterById($aFile['ID']);
                     if (getParam($oAlbum->sAlbumCoverParam) == 'on') {
                         $oAlbum->updateLastObjById($aFile['ID']);
                     }
                 }
                 //tags & categories parsing
                 $oTag = new BxDolTags();
                 $oTag->reparseObjTags($sType, $aFile['ID']);
                 $oCateg = new BxDolCategories($aFile['Owner']);
                 $oCateg->reparseObjTags($sType, $aFile['ID']);
             } else {
                 if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Status`='" . STATUS_FAILED . "' WHERE `ID`='" . $aFile['ID'] . "'")) {
                     break;
                 }
             }
         }
     } while (false);
 }
Example #4
0
function contactInfo($db, $call)
{
    $contacts = '';
    $q3 = "SELECT  contact, validity " . "FROM ares_contact_info " . "WHERE `type` = 4 AND `call`='" . $call . "'";
    //echo "<p>[" . $q3 . "]</p>\n";
    $r3 = getResult($q3, $db);
    if ($row3 = getRow($r3, $db)) {
        $contacts = $row3[0];
    }
    echo $contacts . ", ";
}
/**
* Delete file
* @param $sFile - file identificator
* @return $bResult - result of operation (true/false)
*/
function deleteFile($sFile)
{
    global $sFilesPath;
    getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID`='" . $sFile . "'");
    getResult("DELETE FROM `" . MODULE_DB_PREFIX . "PlayLists` WHERE `FileId`='" . $sFile . "'");
    parseTags($sFile);
    $sFileName = $sFilesPath . $sFile;
    $bResult = @unlink($sFileName . PLAY_EXTENSION);
    $bResult = @unlink($sFileName . SAVE_EXTENSION);
    $bResult = @unlink($sFileName . IMAGE_EXTENSION);
    return $bResult;
}
function post($sTable, $sId, $sAuthor, $sParent, $sMood, $sFileId)
{
    global $sIncPath;
    global $sModule;
    global $sHomeUrl;
    require $sIncPath . "content.inc.php";
    $sText = getEmbedCode($sModule, "player", array('id' => $sFileId, 'file' => TRUE_VAL));
    $sText = str_replace($sHomeUrl, "[ray_url]", $sText);
    $sSql = "INSERT INTO `" . $sTable . "`(`cmt_parent_id`, `cmt_object_id`, `cmt_author_id`, `cmt_text`, `cmt_mood`, `cmt_time`) VALUES('" . $sParent . "', '" . $sId . "', '" . $sAuthor . "', '" . $sText . "', '" . $sMood . "', NOW())";
    getResult($sSql);
    return getLastInsertId();
}
function updateCascade($cascade, $auth, $blockID, $xmlData)
{
    $id = array('id' => $blockID, 'type' => 'block');
    $readParams = array('authentication' => $auth, 'identifier' => $id);
    $blockRead = $cascade->read($readParams);
    $asset = $blockRead->readReturn->asset->xmlBlock;
    $asset->xml = $xmlData;
    $editParams = array('authentication' => $auth, 'asset' => array('xmlBlock' => $asset));
    $cascade->edit($editParams);
    $result = $cascade->__getLastResponse();
    getResult($result, $asset->name);
}
function post($sTable, $sId, $sAuthor, $sParent, $sMood, $sFileId)
{
    global $sIncPath;
    global $sModule;
    global $sHomeUrl;
    $sText = getEmbedCode($sModule, "player", array('id' => $sFileId));
    $sText = str_replace($sHomeUrl, "[ray_url]", $sText);
    $sSql = "INSERT INTO `" . $sTable . "`(`cmt_parent_id`, `cmt_object_id`, `cmt_author_id`, `cmt_text`, `cmt_mood`, `cmt_time`) VALUES('" . $sParent . "', '" . $sId . "', '" . $sAuthor . "', '" . $sText . "', '" . $sMood . "', NOW())";
    getResult($sSql);
    $iCommentId = getLastInsertId();
    getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Description`='" . $iCommentId . "' WHERE `ID`='" . $sFileId . "'");
    return $iCommentId;
}
Example #9
0
 function getResult($dir, &$retArray)
 {
     foreach (glob($dir . "/*") as $filePath) {
         if (is_dir($filePath)) {
             array_push($retArray, '<li data-options="attributes:{file_path:\'\'}, state:\'closed\'">');
             array_push($retArray, '<span>' . basename($filePath) . '</span>');
             array_push($retArray, '<ul>');
             getResult($filePath, $retArray);
             array_push($retArray, '</ul>');
             array_push($retArray, '</li>');
         } else {
             array_push($retArray, '<li data-options="attributes:{file_path:\'' . $filePath . '\'}">');
             array_push($retArray, '<span>' . basename($filePath) . '</span>');
             array_push($retArray, '</li>');
         }
     }
 }
Example #10
0
function contactInfo($db, $call)
{
    $contacts = '';
    $q3 = "SELECT ares_contact_type, contact, validity, A.type " . "FROM ares_contact_info A, ares_contact_type B " . "WHERE A.type = B.type AND A.call='" . $call . "'";
    //echo "<p>" . $q3 . ",/p>\n";
    $r3 = getResult($q3, $db);
    while ($row3 = getRow($r3, $db)) {
        $xx = $row3[1];
        if ($row3[3] < 4) {
            $xx = formatNumber($row3[1]);
        }
        if ($row3[2] == 1) {
            $contacts = $contacts . $row3[0] . ": <b>" . $xx . "</b><br>";
        } else {
            $contacts = $contacts . $row3[0] . ": " . $xx . "<br>";
        }
    }
    echo $contacts;
}
Example #11
0
/**
 * get online users
 * @param aRange - users IDs range to select from
 * @param $bInRange - get users that in(not in) range
 */
function getOnline($aRange = array(), $bInRange = true)
{
    require_once BX_DIRECTORY_PATH_INC . "db.inc.php";
    $iMin = getParam("member_online_time");
    $sInRange = $bInRange ? "IN" : "NOT IN";
    $sWhere = " WHERE `UserStatus`!='" . USER_STATUS_OFFLINE . "' AND `DateLastNav`>SUBDATE(NOW(), INTERVAL " . $iMin . " MINUTE) ";
    if (isset($aRange) && count($aRange) > 0) {
        $sQuery = "SELECT `ID` FROM `Profiles`" . $sWhere . "AND `ID` " . $sInRange . " (" . implode(",", $aRange) . ") ORDER BY `ID`";
    } else {
        $sQuery = "SELECT `ID` FROM `Profiles`" . $sWhere . "ORDER BY `ID`";
    }
    $rOnline = getResult($sQuery);
    $aOnline = array();
    while ($aUser = mysql_fetch_array($rOnline)) {
        $aOnline[] = $aUser['ID'];
    }
    return $aOnline;
}
Example #12
0
function removeFile($sFileId)
{
    global $sFilesPath;
    @getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Messages` WHERE `ID`='" . $sFileId . "'");
    @unlink($sFilesPath . $sFileId . ".file");
}
Example #13
0
}
if (!defined('CURRENT_CATEGORY')) {
    define('CURRENT_CATEGORY', 'athletica_tech');
}
if (!defined('CURRENT_PAGE')) {
    define('CURRENT_PAGE', 'results');
}
require_once ROOT_PATH . 'lib/inc.init.php';
require_once ROOT_PATH . 'lib/cls.result_tech.php';
$events = getEvents(CFG_CURRENT_MEETING, CFG_CURRENT_EVENT);
$type = $glb_types_results[$events['disc_type']];
$wind = $events['event_wind'];
$result_id = $_GET['result'];
$athlete_id = $_GET['athlete'];
$attempt = $_GET['attempt'];
$result = getResult($result_id);
$athlete = getAthleteDetails($athlete_id, false, 'ath_pos', 0, true);
?>
<script type="text/javascript">
    $(document).ready(function(){
        $('button').button();
        
         $('#result_edit_result, #result_edit_wind').keyup(function(){
            validate();   
        });
        
        $('#result_edit_result').blur(function(){
            var res = $(this).val();
            
            if (res) {
                $.ajax({
Example #14
0
    $Q2 = "SELECT MAX(`PERIOD`) FROM `arpsc_ecrept` " . "WHERE `county`='" . $row1[0] . "'";
    $last = singleResult($Q2, $db);
    $Q3 = "SELECT `ARESMEM` FROM `arpsc_ecrept` " . "WHERE `COUNTY`='" . $row1[0] . "' " . "AND `PERIOD`=" . $last;
    $latest = singleResult($Q3, $db);
    $Q4 = "SELECT `ARESMEM` FROM `arpsc_ecrept` " . "WHERE `COUNTY`='" . $row1[0] . "' " . "AND `PERIOD`=0";
    $zeroth = singleResult($Q4, $db);
    echo "<p>" . $row1[0] . ": " . $last . ", ";
    if ($latest == $zeroth) {
        echo $latest . ", " . $zeroth . "</p>\n";
    } else {
        if ($zeroth > 0) {
            echo "<b>" . $latest . ", " . $zeroth . "</b><br/>\n";
            $Q5 = 'UPDATE `arpsc_ecrept` SET `ARESMEM`=' . $latest . " WHERE `COUNTY`='" . $row1[0] . "' AND `PERIOD`=0";
            echo "---" . $Q5 . "---</p>\n";
            $R5 = getResult($Q5, $db);
        } else {
            echo "<span style=\"color: red;\">" . $latest . ", " . $zeroth . "</span><br />\n";
            $Q5 = "INSERT INTO `arpsc_ecrept` (PERIOD,COUNTY,ARESMEM,UPDATED) " . "VALUES(0,'" . $row1[0] . "'," . $latest . ",NOW());";
            echo "---" . $Q5 . "---</p>\n";
            $R5 = getResult($Q5, $db);
        }
    }
}
echo "  </div>\n";
sectLeaders($db);
footer($starttime, "2010-11-11", "\$Revision: 1.1 \$ - \$Date: 2010-11-11 10:12:48-04 \$");
?>
</div>
</body>
</html>
Example #15
0
<?php 
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<board>\n";
include "../ConDBi.php";
/*
==============================================
	POST VARS
==============================================
*/
$uid = $_POST["uid"];
$id = getID($application);
$title = $_POST["title"];
$content = $_POST["content"];
/*
==============================================
	INSERT REPLY
==============================================
*/
$stmt->prepare("INSERT INTO Board.board\n\t\t\t\t\tSELECT \n\t\t\t\t\t\t'', #uid(auto_increment)\n\t\t\t\t\t\tpid,\n\t\t\t\t\t\tapplication,\n\t\t\t\t\t\tcategory,\n\t\t\t\t\t\t\n\t\t\t\t\t\t?, #--> id\n\t\t\t\t\t\t?, #--> title\n\t\t\t\t\t\t?, #--> content\n\t\t\t\t\t\tnow(), #timestamp\n\t\t\t\t\t\t0, #hit\n\t\t\t\t\t\t\n\t\t\t\t\t\tCASE\n\t\t\t\t\t\t\tWHEN right_depth IS NULL THEN\n\t\t\t\t\t\t\t\tCONCAT(depth, 'A')\n\t\t\t\t\t\t\tELSE\n\t\t\t\t\t\t\t\tCONCAT(depth, CHAR(ASCII(right_depth) + 1))\n\t\t\t\t\t\tEND depth,\n\t\t\t\t\t\t1 #live\n\t\t\t\t\tFROM\n\t\t\t\t\t(\n\t\t\t\t\t\tSELECT B.application, B.category, B.pid, B.depth, right(D.depth, 1) right_depth\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\tBoard.board B LEFT OUTER JOIN Board.board D\n\t\t\t\t\t\t\t\tON B.pid = D.pid AND\n\t\t\t\t\t\t\t\t\tlength(D.depth) = length(B.depth) + 1 AND\n\t\t\t\t\t\t\t\t\tlocate(B.depth, D.depth) = 1\n\t\t\t\t\t\t\tWHERE B.uid = ? #parent uid -> as a role of fid\n\t\t\t\t\t\t\tORDER BY D.depth DESC LIMIT 1\n\t\t\t\t\t) P");
$stmt->bind_param("sssd", $id, $title, $content, $uid);
$stmt->execute();
$result = getResult($stmt);
echo "\t<result>" . $result . "</result>\n";
echo "</board>";
$stmt->close();
$mysqli->close();
Example #16
0
function querySQL($statement)
{
    global $storno, $wait, $author, $cellid, $repeatid, $id, $value, $field, $searchquery;
    $today = date('Y-m-d');
    $yesterday = date('Y-m-d', time() - 86400);
    $before_yesterday = date('Y-m-d', time() - 172800);
    switch ($statement) {
        case 'availability':
            $result = query("SELECT reservation_time, SUM(reservation_pax) AS pax_total, COUNT(reservation_id) AS tbl_total\n\t\t\t\t\t\t\tFROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_hidden` = '0' \n\t\t\t\t\t\t\tAND `reservation_wait` = '0' \n\t\t\t\t\t\t\tAND `reservation_outlet_id` = '%d' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s'\n\t\t\t\t\t\t\tAND ( NOT `reservation_status` = 'DEP' AND NOT `reservation_status` = 'NSW')\n\t\t\t\t\t\t\tAND `reservation_id` != '%d'\n\t\t\t\t\t\t\tGROUP BY `reservation_time`\n\t\t\t\t\t\t\tORDER BY `reservation_time` ASC", $_SESSION['outletID'], $_SESSION['selectedDate'], $_SESSION['resID']);
            return getRowList($result);
            break;
        case 'passerby_availability':
            $result = query("SELECT reservation_time, SUM(reservation_pax) AS passerby_total\n\t\t\t\t\t\t\tFROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_hidden` = '0' \n\t\t\t\t\t\t\tAND `reservation_wait` = '0' \n\t\t\t\t\t\t\tAND `reservation_outlet_id` = '%s' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s'\n\t\t\t\t\t\t\tAND ( NOT `reservation_status` = 'DEP' AND NOT `reservation_status` = 'NSW')\n\t\t\t\t\t\t\tAND `reservation_hotelguest_yn` = 'PASS'\n\t\t\t\t\t\t\tGROUP BY `reservation_time`\n\t\t\t\t\t\t\tORDER BY `reservation_time` ASC", $_SESSION['outletID'], $_SESSION['selectedDate']);
            return getRowList($result);
            break;
        case 'maxcapacity':
            $out1 = array();
            $result = query("SELECT outlet_max_capacity, outlet_max_tables, passerby_max_pax FROM `outlets` \n\t\t\t\t\t\t\tWHERE `outlet_id`='%d'", $_SESSION['outletID']);
            $out1 = getRowListarray($result);
            $result = query("SELECT outlet_child_tables, outlet_child_capacity, outlet_child_passer_max_pax FROM `maitre` \n\t\t\t\t\t\t\tWHERE `maitre_outlet_id`='%d' \n\t\t\t\t\t\t\tAND `maitre_date`='%s'", $_SESSION['outletID'], $_SESSION['selectedDate']);
            $out2 = getRowListarray($result);
            if (is_array($out1) && is_array($out2)) {
                return array_merge($out1, $out2);
            } else {
                return $out1;
            }
            break;
        case 'passerby_max_pax':
            $result = query("SELECT sum(reservation_pax) FROM reservations \n\t\t\t\t\t\t\tWHERE `reservation_date`='%s' \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND `reservation_hidden`=0 \n\t\t\t\t\t\t\tAND `reservation_wait`=0 \n\t\t\t\t\t\t\tAND `reservation_hotelguest_yn`='PASS' \n\t\t\t\t\t\t\t", $_SESSION['selectedDate'], $_SESSION['outletID']);
            return getResult($result);
            break;
        case 'max_id':
            $result = query("SELECT MAX(reservation_id) FROM reservations\n\t\t\t\t\t\t\tWHERE `reservation_date`='%s' \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND `reservation_hidden`=0 \n\t\t\t\t\t\t\t", $_SESSION['selectedDate'], $_SESSION['outletID']);
            return getResult($result);
            break;
        case 'standard_outlet':
            $result = query("SELECT outlet_id FROM `outlets` \n\t\t\t\t\t\t\tWHERE `property_id` = '%d' \n\t\t\t\t\t\t\tAND ( `saison_year` = 0 OR `saison_year` = YEAR(NOW()) )\n\t\t\t\t\t\t\tAND saison_start <= '%d' \n\t\t\t\t\t\t\tAND saison_end >= '%d' \n\t\t\t\t\t\t\tORDER BY outlet_id LIMIT 1", $_SESSION['property'], $_SESSION['selectedDate_saison'], $_SESSION['selectedDate_saison']);
            return getResult($result);
            break;
        case 'web_standard_outlet':
            $result = query("SELECT outlet_id FROM `outlets` \n\t\t\t\t\t\t\tWHERE `property_id` = '%d' \n\t\t\t\t\t\t\tAND ( `saison_year` = 0 OR `saison_year` = YEAR(NOW()) )\n\t\t\t\t\t\t\tAND `webform` ='1' \n\t\t\t\t\t\t\tORDER BY outlet_name DESC LIMIT 1", $_SESSION['property']);
            return getResult($result);
            break;
        case 'num_outlets':
            $result = query("SELECT COUNT(*) FROM `outlets` \n\t\t\t\t\t\t\tWHERE ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\t\t\tAND `property_id` ='%d'\n\t\t\t\t\t\t\tAND `webform` = '1'", $_SESSION['selectedDate_year'], $_SESSION['property']);
            return getResult($result);
            break;
        case 'check_web_outlet':
            $result = query("SELECT COUNT(*) FROM `outlets` \n\t\t\t\t\t\t\tWHERE ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\t\t\tAND `outlet_id` ='%d'\n\t\t\t\t\t\t\tAND `webform` = '1'", $_SESSION['selectedDate_year'], $_SESSION['outletID']);
            return getResult($result);
            break;
        case 'property_id_outlet':
            $result = query("SELECT `property_id` FROM `outlets` \n\t\t\t\t\t\t\tWHERE `outlet_id` ='%d'", $_SESSION['outletID']);
            return getResult($result);
            break;
        case 'security_outlet':
            $result = query("SELECT COUNT(*) FROM `outlets` \n\t\t\t\t\t\t\tWHERE ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\t\t\tAND `property_id` ='%d'\n\t\t\t\t\t\t\tAND `outlet_id` ='%d'\n ", $_SESSION['selectedDate_year'], $_SESSION['property'], $_SESSION['outletID']);
            return getResult($result);
            break;
        case 'db_outlet':
            $result = query("SELECT outlet_name FROM `outlets` WHERE `outlet_id` ='%d' AND `property_id` ='%d' LIMIT 1", $_SESSION['outletID'], $_SESSION['property']);
            return getResult($result);
            break;
        case 'db_prop_pic':
            $result = query("SELECT img_filename FROM `properties` WHERE `id` ='%d' LIMIT 1", $_SESSION['property']);
            return getResult($result);
            break;
        case 'db_property':
            $result = query("SELECT name FROM `properties` WHERE `id` ='%d' LIMIT 1", $_SESSION['property']);
            return getResult($result);
            break;
        case 'db_outlets':
            $result = query("SELECT * FROM `outlets` \n\t\t\t\t\t\t\tWHERE ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\t\t\tAND `property_id` ='%d' \n\t\t\t\t\t\t\tORDER BY outlet_name", $_SESSION['selectedDate_year'], $_SESSION['property']);
            return getRowList($result);
            break;
        case 'db_outlets_web':
            $result = query("SELECT outlet_id, outlet_name, outlet_description, cuisine_style, saison_start, saison_end \n\t\t\t\t\t\t\tFROM `outlets` \n\t\t\t\t\t\t\tWHERE ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\t\t\tAND `property_id` ='%d'\n\t\t\t\t\t\t\tAND `webform` = '1'\n\t\t\t\t\t\t\tORDER BY outlet_name", $_SESSION['selectedDate_year'], $_SESSION['property']);
            return getRowList($result);
            break;
        case 'db_all_outlets':
            $result = query("SELECT outlet_id, outlet_name, outlet_description, cuisine_style, \n\t\t\t\t\t\t\toutlet_max_capacity, outlet_max_tables, outlet_open_time, outlet_close_time, \n\t\t\t\t\t\t\tsaison_start, saison_end, saison_year, webform, avg_duration \n\t\t\t\t\t\t\tFROM `outlets` \n\t\t\t\t\t\t\tWHERE `property_id` ='%d' \n\t\t\t\t\t\t\tAND ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\t\t\tORDER BY saison_year ASC, outlet_name ASC", $_SESSION['property'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'db_all_outlets_old':
            $result = query("SELECT  outlet_id, outlet_name, outlet_description, cuisine_style, \n\t\t\t\t\t\t\toutlet_max_capacity, outlet_max_tables, outlet_open_time, outlet_close_time, \n\t\t\t\t\t\t\tsaison_start, saison_end, saison_year, webform, avg_duration \n\t\t\t\t\t\t\tFROM `outlets` \n\t\t\t\t\t\t\tWHERE `property_id` ='%d' \n\t\t\t\t\t\t\tAND `saison_year` < '%d'\n\t\t\t\t\t\t\tAND `saison_year` != 0\n\t\t\t\t\t\t\tORDER BY saison_year ASC, outlet_name ASC", $_SESSION['property'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'db_outlet_info':
            $result = query("SELECT outlet_id, outlet_name, property_id, outlet_description, outlet_description_en,\t \n\t\t\t\t\t\tcuisine_style, property_id, outlet_max_capacity, outlet_max_tables, outlet_open_time, \t \n\t\t\t\t\t\toutlet_close_time, outlet_timestamp, outlet_closeday, saison_start, saison_end,  \t  \t \n\t\t\t\t\t\tsaison_year, webform, limit_password, confirmation_email, passerby_max_pax, avg_duration,\t \n\t\t\t\t\t\t1_open_time,1_close_time, 2_open_time,2_close_time, \t \n\t\t\t\t\t\t3_open_time,3_close_time, 4_open_time,4_close_time, \t \n\t\t\t\t\t\t5_open_time, 5_close_time, 6_open_time, 6_close_time, \t \n\t\t\t\t\t\t0_open_time, 0_close_time, 1_open_break, 1_close_break, \t \n\t\t\t\t\t\t2_open_break, 2_close_break, 3_open_break, 3_close_break, \t \n\t\t\t\t\t\t4_open_break, 4_close_break, 5_open_break, 5_close_break, \t \n\t\t\t\t\t\t6_open_break, 6_close_break, 0_open_break, 0_close_break\n\t\t\t\t\t\t\tFROM `outlets` \n\t\t\t\t\t\t\tWHERE `outlet_id` ='%d' \n\t\t\t\t\t\t\tAND `property_id` ='%d' ", $_SESSION['outletID'], $_SESSION['property']);
            return getRowListarray($result);
            break;
        case 'outlet_info':
            $result = query("SELECT * FROM `outlets` \n\t\t\t\t\t\t\tLEFT JOIN `properties` on outlets.property_id = properties.id \n\t\t\t\t\t\t\tWHERE `outlet_id` ='%d'\n\t\t\t\t\t\t\tAND `property_id` ='%d' \n\t\t\t\t\t\t\tLIMIT 1", $_SESSION['outletID'], $_SESSION['property']);
            return getRowList($result);
            break;
        case 'db_propery_events':
            $result = query("SELECT id, outlet_id, subject,\n\t\t\tdescription, event_date, start_time, end_time,\n\t\t\tadvertise_start, price \n\t\t\t\t\t\t\tFROM `events` \n\t\t\t\t\t\t\tWHERE `property_id` ='%d' \n\t\t\t\t\t\t\tORDER BY `event_date` DESC", $_SESSION['property']);
            return getRowList($result);
            break;
        case 'db_outlet_events':
            $result = query("SELECT id, outlet_id, subject,\n\t\t\tdescription, event_date, start_time, end_time,\n\t\t\tadvertise_start, price \n\t\t\t\t\t\t\tFROM `events` \n\t\t\t\t\t\t\tWHERE `outlet_id` ='%d' \n\t\t\t\t\t\t\tORDER BY `event_date` DESC", $_SESSION['outletID']);
            return getRowList($result);
            break;
        case 'event_data_single':
            $result = query("SELECT id, outlet_id, property_id, subject,\n\t\t\tdescription, event_date, start_time, end_time,\n\t\t\tadvertise_start, price \n\t\t\t\t\t\t\tFROM `events` \n\t\t\t\t\t\t\tWHERE `id` ='%d' \n\t\t\t\t\t\t\tLIMIT 1", $_SESSION['eventID']);
            return getRowListarray($result);
            break;
        case 'event_advertise':
            $result = query("SELECT events.id, events.outlet_id, events.property_id, events.subject, \n\t\t\tevents.description, events.event_date, events.start_time, events.end_time,\n\t\t\tevents.advertise_start, events.price, outlets.outlet_name FROM `events`\n\t\t\t\t\t\tLEFT JOIN `outlets` ON events.outlet_id = outlets.outlet_id\n\t\t\t\t\t\tWHERE DATE_SUB(`event_date`,INTERVAL `advertise_start` DAY) <= '%s'\n\t\t\t\t\t\tAND `event_date` > '%s'\n\t\t\t\t\t\tAND outlets.property_id ='%d' \n\t\t\t\t\t\tORDER BY advertise_start ASC", $_SESSION['selectedDate'], $_SESSION['selectedDate'], $_SESSION['property']);
            return getRowList($result);
            break;
        case 'event_advertise_web':
            $result = query("SELECT events.id, events.outlet_id, events.property_id, events.subject,\n\t\t\tevents.description, events.event_date, events.start_time, events.end_time,\n\t\t\tevents.advertise_start, events.price, outlets.outlet_name FROM `events`\n\t\t\t\t\t\tLEFT JOIN `outlets` ON events.outlet_id = outlets.outlet_id\n\t\t\t\t\t\tWHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM `events` ) \n\t\t\t\t\t\tAND DATE_SUB(`event_date`,INTERVAL `advertise_start` DAY) <= CURDATE()\n\t\t\t\t\t\tAND `event_date` >= CURDATE()\n\t\t\t\t\t\tAND `event_date` >= '%s'\n\t\t\t\t\t\tAND `webform` = '1'\n\t\t\t\t\t\tORDER BY advertise_start,event_date ASC\n\t\t\t\t\t\tLIMIT 5", $_SESSION['selectedDate']);
            return getRowList($result);
            break;
        case 'event_data_day':
            $result = query("SELECT id, outlet_id, property_id, subject,\n\t\t\t\t\t\tdescription, event_date, start_time, end_time,\n\t\t\t\t\t\tadvertise_start, price \n\t\t\t\t\t\tFROM `events` \n\t\t\t\t\t\tWHERE `event_date` ='%s' \n\t\t\t\t\t\tAND `outlet_id` ='%d' \n\t\t\t\t\t\tAND `property_id` ='%d'", $_SESSION['selectedDate'], $_SESSION['outletID'], $_SESSION['property']);
            return getRowList($result);
            break;
        case 'user_data':
            $result = query("SELECT userID,username,realname,password,email,role,\n\t\t  \t\t\t\t\tproperty_id,active,confirm_code,last_ip,last_login,created,modified \n\t\t\t\t\t\t\tFROM `plc_users` \n\t\t\t\t\t\t\tWHERE `userID` ='%d' \n\t\t\t\t\t\t\tLIMIT 1", $_SESSION['userID']);
            return getRowListarray($result);
            break;
        case 'user_confirm_code':
            $result = query("UPDATE `plc_users` SET confirm_code = '%s', active = '0' \n\t\t\t\t\t\t\t\tWHERE `userID` ='%d' LIMIT 1", $_SESSION['confHash'], $id);
            return $result;
            break;
        case 'check_confirm_code':
            $result = query("SELECT active,confirm_code FROM `plc_users` WHERE confirm_code='%s'", $_SESSION['confHash']);
            return getRowListarray($result);
            break;
        case 'user_confirm_activate':
            $result = query("UPDATE `plc_users` SET confirm_code = '', active = '1' \n\t\t\t\t\t\t\t\tWHERE confirm_code='%s'", $_SESSION['confHash']);
            return $result;
            break;
        case 'maitre_info':
            $result = query("SELECT maitre_id, maitre_outlet_id,\n\t\t\t\t\t\t\tmaitre_date, maitre_comment_day,\n\t\t\t\t\t\t\tmaitre_comment_day_timestamp, maitre_comment_day_name,\n\t\t\t\t\t\t\tmaitre_timestamp, maitre_ip,\n\t\t\t\t\t\t\tmaitre_author, outlet_child_tables,\n\t\t\t\t\t\t\toutlet_child_capacity, outlet_capacity_timestamp,\n\t\t\t\t\t\t\toutlet_child_passer_max_pax, outlet_child_dayoff \n\t\t\t\t\t\t\tFROM `maitre` \n\t\t\t\t\t\t\tWHERE `maitre_outlet_id` ='%d' \n\t\t\t\t\t\t\tAND `maitre_date`='%s' \n\t\t\t\t\t\t\tLIMIT 1", $_SESSION['outletID'], $_SESSION['selectedDate']);
            return getRowList($result);
            break;
        case 'maitre_dayoffs':
            $result = query("SELECT `maitre_date` FROM `maitre` \n\t\t\t\t\t\t\tWHERE `outlet_child_dayoff` = 'ON'\n\t\t\t\t\t\t\tAND YEAR(maitre_date) = '%s'\n\t\t\t\t\t\t\tAND `maitre_outlet_id` ='%d' \n\t\t\t\t\t\t\tORDER BY `maitre_date` ASC", date('Y'), $_SESSION['outletID']);
            return getRowList($result);
            break;
        case 'outlet_closedays':
            $result = query("SELECT `outlet_closeday` FROM `outlets` \n\t\t\t\t\t\t\tWHERE `outlet_id` ='%d' \n\t\t\t\t\t\t\t", $_SESSION['outletID']);
            return getResult($result);
            break;
        case 'db_all_users':
            $result = query("SELECT userID,username,realname,password,email,role,\n\t\t  \t\t\t\t\tproperty_id,active,confirm_code,last_ip,last_login,created,modified\n\t\t\t\t\t\t\tFROM `plc_users` ORDER BY `username`");
            return getRowList($result);
            break;
        case 'db_prp_users':
            $result = query("SELECT userID,username,realname,password,email,role,\n\t\t  \t\t\t\t\tproperty_id,active,confirm_code,last_ip,last_login,created,modified \n\t\t\t\t\t\t\tFROM `plc_users`\n\t\t\t\t\t\t\tWHERE `property_id` ='%d'\n\t\t\t\t\t\t\tORDER BY `username`", $_SESSION['property']);
            return getRowList($result);
            break;
        case 'recent':
            $result = query("SELECT reservation_id, reservation_bookingnumber, reservation_outlet_id,\n\t\t\treservation_date, reservation_time, reservation_title,\n\t\t\treservation_guest_name, reservation_guest_adress, reservation_guest_city,\n\t\t\treservation_guest_email, reservation_guest_phone, reservation_pax,\n\t\t\treservation_hotelguest_yn, reservation_notes, reservation_booker_name,\n\t\t\treservation_timestamp, reservation_ip, reservation_hidden,\n\t\t\treservation_wait, repeat_id, reservation_bill,\n\t\t\treservation_discount, reservation_bill_paid, reservation_billet_sent,\n\t\t\treservation_parkticket, reservation_table, reservation_status,\n\t\t\treservation_advertise,reservation_referer \n\t\t\t\t\t\tFROM `reservations` \n\t\t\t\t\t\tWHERE reservation_outlet_id='%d' \n\t\t\t\t\t\tORDER BY reservation_timestamp DESC LIMIT 0,4", $_SESSION['outletID']);
            return getRowList($result);
            break;
        case 'tautologous':
            $result = query("SELECT count(*) FROM `reservations` WHERE reservation_date='%s' AND reservation_hidden=0 AND reservation_wait=0 AND reservation_guest_name='%s' ", $_SESSION['selectedDate'], $_SESSION['reservation_guest_name']);
            return getResult($result);
            break;
        case 'capability':
            $result = query("SELECT `%d` FROM `capabilities` WHERE `capability`='%s'", $_SESSION['role'], $_SESSION['capability']);
            return getResult($result);
            break;
        case 'capabilities':
            $result = query("SELECT `capability`,`1`,`2`,`3`,`4`,`5`,`6` FROM `capabilities`");
            //return getRowListarray($result);
            return $result;
            break;
        case 'reservation_info':
            $result = query("SELECT reservation_id, reservation_bookingnumber, reservation_outlet_id,\n\t\t\treservation_date, reservation_time, reservation_title,\n\t\t\treservation_guest_name, reservation_guest_adress, reservation_guest_city,\n\t\t\treservation_guest_email, reservation_guest_phone, reservation_pax,\n\t\t\treservation_hotelguest_yn, reservation_notes, reservation_booker_name,\n\t\t\treservation_timestamp, reservation_ip, reservation_hidden,\n\t\t\treservation_wait, repeat_id, reservation_bill,\n\t\t\treservation_discount, reservation_bill_paid, reservation_billet_sent,\n\t\t\treservation_parkticket, reservation_table, reservation_status,\n\t\t\treservation_advertise,reservation_referer,\n\t\t\toutlets.outlet_name,res_repeat.id,res_repeat.start_date,res_repeat.end_date \n\t\t\t\t\tFROM `reservations`\n\t\t\t\t\tLEFT JOIN `outlets` ON outlet_id = reservation_outlet_id\n\t\t\t\t\tLEFT JOIN `res_repeat` ON res_repeat.id = reservations.repeat_id  \n\t\t\t\t\tWHERE reservations.reservation_id = '%d' LIMIT 1", $_SESSION['resID']);
            return getRowList($result);
            break;
        case 'reservations':
            $result = query("SELECT reservation_id, reservation_bookingnumber, reservation_outlet_id,\n\t\t\treservation_date, reservation_time, reservation_title,\n\t\t\treservation_guest_name, reservation_guest_adress, reservation_guest_city,\n\t\t\treservation_guest_email, reservation_guest_phone, reservation_pax,\n\t\t\treservation_hotelguest_yn, reservation_notes, reservation_booker_name,\n\t\t\treservation_timestamp, reservation_ip, reservation_hidden,\n\t\t\treservation_wait, repeat_id, reservation_bill,\n\t\t\treservation_discount, reservation_bill_paid, reservation_billet_sent,\n\t\t\treservation_parkticket, reservation_table, reservation_status,\n\t\t\treservation_advertise,reservation_referer\n\t\t\t\t\t\t\tFROM `reservations` \n\t\t\t\t\t\t\tINNER JOIN `outlets` ON `outlet_id` = `reservation_outlet_id` \n\t\t\t\t\t\t\tWHERE `reservation_hidden` = '%d' \n\t\t\t\t\t\t\tAND `reservation_wait` = '%d' \n\t\t\t\t\t\t\tAND `reservation_outlet_id` = '%d' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s' \n\t\t\t\t\t\t\tORDER BY `reservation_time` ASC", $_SESSION['storno'], $_SESSION['wait'], $_SESSION['outletID'], $_SESSION['selectedDate']);
            return getRowList($result);
            break;
        case 'all_reservations':
            $result = query("SELECT reservation_id, reservation_bookingnumber, reservation_outlet_id,\n\t\t\treservation_date, reservation_time, reservation_title,\n\t\t\treservation_guest_name, reservation_guest_adress, reservation_guest_city,\n\t\t\treservation_guest_email, reservation_guest_phone, reservation_pax,\n\t\t\treservation_hotelguest_yn, reservation_notes, reservation_booker_name,\n\t\t\treservation_timestamp, reservation_ip, reservation_hidden,\n\t\t\treservation_wait, repeat_id, reservation_bill,\n\t\t\treservation_discount, reservation_bill_paid, reservation_billet_sent,\n\t\t\treservation_parkticket, reservation_table, reservation_status,\n\t\t\treservation_advertise,reservation_referer,outlets.outlet_name\n\t\t\t\t\t\t\tFROM `reservations` \n\t\t\t\t\t\t\tINNER JOIN `outlets` ON `outlet_id` = `reservation_outlet_id` \n\t\t\t\t\t\t\tWHERE `reservation_hidden` = '0' \n\t\t\t\t\t\t\tAND `reservation_wait` = '%d' \n\t\t\t\t\t\t\tAND `property_id` = '%d' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s' \n\t\t\t\t\t\t\tORDER BY `reservation_time` ASC", $_SESSION['wait'], $_SESSION['propertyID'], $_SESSION['selectedDate']);
            return getRowList($result);
            break;
        case 'search':
            $result = query("SELECT reservation_id, reservation_bookingnumber, reservation_outlet_id,\n\t\t\treservation_date, reservation_time, reservation_title,\n\t\t\treservation_guest_name, reservation_guest_adress, reservation_guest_city,\n\t\t\treservation_guest_email, reservation_guest_phone, reservation_pax,\n\t\t\treservation_hotelguest_yn, reservation_notes, reservation_booker_name,\n\t\t\treservation_timestamp, reservation_ip, reservation_hidden,\n\t\t\treservation_wait, repeat_id, reservation_bill,\n\t\t\treservation_discount, reservation_bill_paid, reservation_billet_sent,\n\t\t\treservation_parkticket, reservation_table, reservation_status,\n\t\t\treservation_advertise,reservation_referer, outlet_name \n\t\t\t\tFROM `reservations` \n\t\t\t\tINNER JOIN `outlets` ON `outlet_id` = `reservation_outlet_id` \n\t\t\t\tWHERE `property_id` = '%d' \n\t\t\t\tAND (`reservation_guest_name` LIKE '%s' \n\t\t\t\t\tOR `reservation_bookingnumber` LIKE '%s' \n\t\t\t\t\tOR `reservation_guest_phone` LIKE '%s') \n\t\t\t\tORDER BY reservation_guest_name ASC", $_SESSION['propertyID'], $searchquery, $searchquery, $searchquery);
            return getRowList($result);
            break;
        case 'reservation_visits':
            $result = query("SELECT COUNT(*) FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_guest_name`='%s' \n\t\t\t\t\t\t\tAND `reservation_hidden`=0", $_SESSION['reservation_guest_name']);
            return getResult($result);
            break;
        case 'reservation_last_visit':
            $result = query("SELECT `reservation_date` FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_guest_name` = '%s' \n\t\t\t\t\t\t\tAND `reservation_hidden` = 0 AND `reservation_date` <= now() \n\t\t\t\t\t\t\tORDER BY `reservation_timestamp` DESC", $_SESSION['reservation_guest_name']);
            return getResult($result);
            break;
        case 'reservation_history':
            $result = query("SELECT DISTINCT `reservation_notes` FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_guest_name`='%s' \n\t\t\t\t\t\t\tAND `reservation_hidden`=0 ORDER BY reservation_timestamp DESC", $_SESSION['reservation_guest_name']);
            return getRowList($result);
            break;
        case 'res_history':
            $result = query("SELECT id, reservation_id, author, timestamp\n\t\t\t\t\t\t\tFROM `res_history` \n\t\t\t\t\t\t\tWHERE `reservation_id`='%d' \n\t\t\t\t\t\t\tORDER BY id DESC", $_SESSION['resID']);
            return getRowList($result);
            break;
        case 'settings_inc':
            $result = query("SELECT id, property_id, language,\n\t\t\ttimezone, timeformat, timeintervall,\n\t\t\tdateformat, dateformat_short, datepickerformat,\n\t\t\tapp_name, max_menu, old_days,\n\t\t\tmanual_lines, contactform_color_scheme, contactform_background, \n\t\t\tguest_type_text_HG, guest_type_text_PASS, guest_type_text_WALK\n\t\t\t\t\t\t\tFROM `settings` \n\t\t\t\t\t\t\tWHERE `property_id` = '%d'", $_SESSION['property']);
            return getRowListarray($result);
            break;
        case 'timecontrol':
            $result = query("SELECT reservation_time, SUM(reservation_pax) AS paxsum FROM reservations \n\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0' AND `reservation_outlet_id`='%d' \n\t\t\t\t\t\tAND `reservation_date`='%s' GROUP BY reservation_time \n\t\t\t\t\t\tORDER BY paxsum DESC", $_SESSION['outletID'], $_SESSION['selectedDate']);
            return getRowListarray($result);
            break;
        case 'del_res_single':
            $result = query("UPDATE `reservations` \n\t\t\t\t\t\t\tSET `reservation_hidden`='1', `reservation_booker_name`='%s',\t`reservation_timestamp` = now()\n\t\t\t\t\t\t\tWHERE `reservation_id`='%d'", $author, $cellid);
            return $result;
            break;
        case 'alw_res_single':
            $result = query("UPDATE `reservations` SET `reservation_wait`='0',`reservation_timestamp` = now()\n\t\t\t\t\t\t\tWHERE `reservation_id`='%d'", $cellid);
            return $result;
            break;
        case 'del_res_multi':
            $result = query("UPDATE `reservations` \n\t\t\t\t\t\t\tSET `reservation_hidden`='1', `reservation_booker_name`='%s', `reservation_timestamp` = now() \n\t\t\t\t\t\t\tWHERE `repeat_id`='%d'", $author, $repeatid);
            return $result;
            break;
        case 'del_user':
            $result = query("DELETE FROM `plc_users` WHERE `userID`='%d' LIMIT 1", $cellid);
            return $result;
            break;
        case 'del_event':
            $result = query("DELETE FROM `events` WHERE `id`='%d' LIMIT 1", $cellid);
            return $result;
            break;
        case 'del_outlet':
            $result = query("DELETE FROM `outlets` WHERE `outlet_id`='%d' LIMIT 1", $cellid);
            return $result;
            break;
        case 'update_status':
            $result = query("UPDATE `reservations` \n\t\t\t\t\t\t\tSET `reservation_status`='%s' \n\t\t\t\t\t\t\tWHERE `reservation_id`='%d'", $value, $id);
            return $result;
            break;
        case 'update_maitre_dayoff':
            $result = query("INSERT INTO `maitre`\n\t\t\t\t \t\t\t\t(maitre_id,maitre_outlet_id,maitre_date,outlet_child_dayoff,maitre_ip,maitre_author) \n\t\t\t\t\t\t\t\tVALUES ('%d','%d','%s','%s','%s','%s') \n\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE \n\t\t\t\t\t\t\t\t`outlet_child_dayoff`='%s',\n\t\t\t\t\t\t\t\t`maitre_ip`='%s',\n\t\t\t\t\t\t\t\t`maitre_author`='%s'", $id, $_SESSION['outletID'], $_SESSION['selectedDate'], $value, $_SERVER['REMOTE_ADDR'], $_SESSION['u_fullname'], $value, $_SERVER['REMOTE_ADDR'], $_SESSION['u_fullname']);
            return $result;
            break;
        case 'inline_edit':
            $result = query("UPDATE `reservations` SET `%s`='%s' WHERE `reservation_id`='%d'", $field, $value, $id);
            return $result;
            break;
        case 'res_repeat':
            $result = query("INSERT INTO `res_repeat` (\n\t\t\t\tid, \n\t\t\t\tstart_date,\n\t\t\t\tend_date,\n\t\t\t\tcreate_by\n\t\t\t\t) VALUES (\n\t\t\t\t'%d',\n\t\t\t\t'%s',\n\t\t\t\t'%s',\n\t\t\t\t'%s')\n\t\t\t\tON DUPLICATE KEY UPDATE \n\t\t\t\tid='%d',\n\t\t\t\tstart_date='%s',\n\t\t\t\tend_date='%s',\n\t\t\t\tcreate_by='%s'", $repeatid, $_SESSION['reservation_date'], $_SESSION['recurring_date'], $_SESSION['author'], $repeatid, $_SESSION['reservation_date'], $_SESSION['recurring_date'], $_SESSION['author']);
            return mysql_insert_id();
            break;
        case 'statistic_month':
            $result = query("SELECT SUM(reservation_pax) AS paxsum FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0' \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND MONTH(reservation_date) = '%s'\n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'", $_SESSION['outletID'], $_SESSION['statistic_month'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'statistic_month_last':
            $result = query("SELECT SUM(reservation_pax) AS paxsum FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait`= 0 AND `reservation_hidden`= 0 \n\t\t\t\t\t\t\tAND `reservation_outlet_id` = '%d' \n\t\t\t\t\t\t\tAND MONTH(reservation_date) = '%s'\n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'", $_SESSION['outletID'], $_SESSION['statistic_month'], $_SESSION['selectedDate_year'] - 1);
            return getRowList($result);
            break;
        case 'statistic_week_def':
            $result = query("SELECT SUM(reservation_pax) AS paxsum FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait` = 0 AND `reservation_hidden` = 0 \n\t\t\t\t\t\t\tAND `reservation_outlet_id` ='%d' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s'", $_SESSION['outletID'], $_SESSION['statistic_week']);
            return getRowList($result);
            break;
        case 'statistic_week_def_noon':
            $result = query("SELECT SUM(reservation_pax) AS paxsum FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait` = 0 AND `reservation_hidden` = 0 \n\t\t\t\t\t\t\tAND `reservation_outlet_id` ='%d' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s'\n\t\t\t\t\t\t\tAND `reservation_time` < '%s'", $_SESSION['outletID'], $_SESSION['statistic_week'], $value);
            return getRowList($result);
            break;
        case 'statistic_week_def_evening':
            $result = query("SELECT SUM(reservation_pax) AS paxsum FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait` = 0 AND `reservation_hidden` = 0 \n\t\t\t\t\t\t\tAND `reservation_outlet_id` ='%d' \n\t\t\t\t\t\t\tAND `reservation_date` = '%s'\n\t\t\t\t\t\t\tAND `reservation_time` >= '%s'", $_SESSION['outletID'], $_SESSION['statistic_week'], $value);
            return getRowList($result);
            break;
        case 'statistic_type':
            $result = query("SELECT reservation_hotelguest_yn, SUM(reservation_pax) AS paxsum FROM `reservations`\n\t\t\t\t\t\t\tWHERE `reservation_wait`= 0 AND `reservation_hidden`= 0 \n\t\t\t\t\t\t\tAND `reservation_outlet_id` = '%d' \n\t\t\t\t\t\t\tAND MONTH(reservation_date) = '%s'\n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'\n\t\t\t\t\t\t\tGROUP BY `reservation_hotelguest_yn`", $_SESSION['outletID'], $_SESSION['statistic_month'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'statistic_weekday':
            $result = query("SELECT SUM(reservation_pax) AS paxsum FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0' \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND MONTH(reservation_date) = '%s'\n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'\n\t\t\t\t\t\t\tGROUP BY WEEKDAY(reservation_date)", $_SESSION['outletID'], $_SESSION['statistic_month'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'statistic_referer':
            $result = query("SELECT reservation_referer, COUNT(*) AS total FROM `reservations` \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0' \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND MONTH(reservation_date) = '%s'\n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'\n\t\t\t\t\t\t\tGROUP BY reservation_referer\n\t\t\t\t\t\t\tORDER BY total DESC\n\t\t\t\t\t\t\tLIMIT 0,7", $_SESSION['outletID'], $_SESSION['statistic_month'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'statistic_res_days':
            $result = query("SELECT ROUND(AVG(DATEDIFF(reservation_date,reservation_timestamp)),1)\n\t\t\t\t\t\t\tFROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0'  \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d'\n\t\t\t\t\t\t\tAND MONTH(reservation_date) = '%s' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s' \n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['statistic_month'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_guest_year':
            $result = query("SELECT SUM(reservation_pax) FROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0'  \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s' \n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_all_guest_year':
            $result = query("SELECT SUM(reservation_pax) FROM `reservations` \n\t\t\t\t\t\t\tINNER JOIN `outlets` ON `outlet_id` = `reservation_outlet_id` \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0'   \n\t\t\t\t\t\t\tAND `property_id` = '%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s' \n\t\t\t\t\t\t\t", $_SESSION['propertyID'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_cxl_year':
            $result = query("SELECT COUNT(*) FROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0'  \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s' \n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_booker_year':
            $result = query("SELECT COUNT(*) FROM (SELECT `reservation_id` FROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_hidden`= '1'  \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'\n\t\t\t\t\t\t\tGROUP BY `reservation_booker_name` ) groups \n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_wait_year':
            $result = query("SELECT COUNT(*) FROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '1'  \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s' \n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_online_year':
            $result = query("SELECT COUNT(*) FROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'\n\t\t\t\t\t\t\tAND `reservation_referer` != ''\n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['selectedDate_year']);
            return getResult($result);
            break;
        case 'statistic_top5_guest_year':
            $result = query("SELECT reservation_guest_name, COUNT(*) as total FROM `reservations`  \n\t\t\t\t\t\t\tWHERE `reservation_wait`= '0' AND `reservation_hidden`= '0'  \n\t\t\t\t\t\t\tAND `reservation_outlet_id`='%d' \n\t\t\t\t\t\t\tAND YEAR(reservation_date) = '%s'\n\t\t\t\t\t\t\tGROUP BY `reservation_guest_name`\n\t\t\t\t\t\t\tORDER BY total DESC\n\t\t\t\t\t\t\tLIMIT 0,7\n\t\t\t\t\t\t\t", $_SESSION['outletID'], $_SESSION['selectedDate_year']);
            return getRowList($result);
            break;
        case 'notifications':
            $result = query("SELECT outlet_name,reservation_guest_name,reservation_time FROM `reservations` \n\t\t\t\t\t\t\tINNER JOIN `outlets` ON `outlet_id` = `reservation_outlet_id` \n\t\t\t\t\t\t\tWHERE `reservation_hidden` = '0' \n\t\t\t\t\t\t\tAND `property_id` ='%d'\n\t\t\t\t\t\t\tAND `reservation_date` = '%s'\n\t\t\t\t\t\t\tAND DATE_SUB(NOW(),INTERVAL 1 minute) <= `reservation_timestamp`\n\t\t\t\t\t\t\tORDER BY `reservation_timestamp` ASC\n\t\t\t\t\t\t\tLIMIT 3", $_SESSION['property'], date('Y-m-d'));
            return getRowList($result);
            break;
        case 'all_properties':
            $result = query("SELECT id, name, street,\n\t\t\t\t\t\t\tzip, city, country,\n\t\t\t\t\t\t\tcontactperson, phone, fax,\n\t\t\t\t\t\t\temail, website, created,\n\t\t\t\t\t\t\timg_filename, logo_filename, \n\t\t\t\t\t\t\tstatus, social_fb, social_tw \n\t\t\t\t\t\t\tFROM `properties` ORDER BY name ASC");
            return getRowList($result);
            break;
        case 'select_properties':
            $result = query("SELECT id, name, street,\n\t\t\t\t\tzip, city, country,\n\t\t\t\t\tcontactperson, phone, fax,\n\t\t\t\t\temail, website, created,\n\t\t\t\t\timg_filename, logo_filename, \n\t\t\t\t\tstatus, social_fb, social_tw \n\t\t\t\t\tFROM `properties`\n\t\t\t\t\tWHERE `country` LIKE '%s'\n\t\t\t\t\tAND `city` LIKE '%s'\n\t\t\t\t\tORDER BY name ASC", $_SESSION['countryID'], $_SESSION['city']);
            return getRowList($result);
            break;
        case 'num_admin':
            $result = query("SELECT COUNT(*) FROM `plc_users` WHERE `role` ='1' OR `role` ='2'");
            return getResult($result);
            break;
        case 'property_info':
            $result = query("SELECT id, name, street,\n\t\t\t\t\tzip, city, country,\n\t\t\t\t\tcontactperson, phone, fax,\n\t\t\t\t\temail, website, created,\n\t\t\t\t\timg_filename, logo_filename, \n\t\t\t\t\tstatus, social_fb, social_tw\n\t\t\t\t\tFROM `properties` \n\t\t\t\t\tWHERE `id` ='%d'\n                    LIMIT 1", $_SESSION['propertyID']);
            return getRowListarray($result);
            break;
        case 'property_countries':
            $result = query("SELECT DISTINCT country FROM `properties` \n\t\t\t\t\tORDER BY country ASC");
            return getRowList($result);
            break;
        case 'property_countries_num':
            $result = query("SELECT DISTINCT country FROM `properties` \n\t\t\t\t\tORDER BY country ASC");
            return mysql_num_rows($result);
            break;
        case 'property_cities':
            $result = query("SELECT DISTINCT city,country FROM `properties`\n\t\t\t\t\tWHERE `country` ='%s'\n\t\t\t\t\tORDER BY city ASC", $_SESSION['countryID']);
            return getRowList($result);
            break;
        case 'property_cities_num':
            $result = query("SELECT DISTINCT city,country FROM `properties`\n\t\t\t\t\tWHERE `country` ='%s'\n\t\t\t\t\tORDER BY city ASC", $_SESSION['countryID']);
            return mysql_num_rows($result);
            break;
        case 'view_img':
            $result = query("SELECT img_filename FROM `properties` \n\t\t\t\t\tWHERE `id` ='%d'\n                                        LIMIT 1", $_SESSION['property']);
            return getResult($result);
            break;
        case 'featured_outlet':
            $result = query("SELECT outlet_id, outlet_name, outlet_description, outlet_description_en,\t \n\t\t\t\t\t\tcuisine_style, property_id, outlet_max_capacity, outlet_max_tables, outlet_open_time, \t \n\t\t\t\t\t\toutlet_close_time, outlet_timestamp, outlet_closeday, saison_start, saison_end,  \t  \t \n\t\t\t\t\t\tsaison_year, webform, confirmation_email, passerby_max_pax, avg_duration,\t \n\t\t\t\t\t\t1_open_time,1_close_time, 2_open_time,2_close_time, \t \n\t\t\t\t\t\t3_open_time,3_close_time, 4_open_time,4_close_time, \t \n\t\t\t\t\t\t5_open_time, 5_close_time, 6_open_time, 6_close_time, \t \n\t\t\t\t\t\t0_open_time, 0_close_time, 1_open_break, 1_close_break, \t \n\t\t\t\t\t\t2_open_break, 2_close_break, 3_open_break, 3_close_break, \t \n\t\t\t\t\t\t4_open_break, 4_close_break, 5_open_break, 5_close_break, \t \n\t\t\t\t\t\t6_open_break, 6_close_break, 0_open_break, 0_close_break \n\t\t\t\t\tFROM `outlets`\n\t\t\t\t\tWHERE outlet_id >= (SELECT FLOOR( MAX(outlet_id) * RAND()) FROM `outlets` ) \n\t\t\t\t\tAND ( `saison_year` = 0 OR `saison_year` = '%d' )\n\t\t\t\t\tAND `webform` = '1'\n\t\t\t\t\tORDER BY outlet_id LIMIT 1", $_SESSION['selectedDate_year']);
            return getRowListarray($result);
            break;
        case 'del_properties':
            $result = query("DELETE FROM `properties` WHERE `id`='%d' LIMIT 1", $cellid);
            return $result;
            break;
        case 'check_username':
            $result = query("SELECT username FROM `plc_users` WHERE `username`='%s'", $value);
            return $result;
            break;
        case 'check_unique_id':
            $result = query("SELECT COUNT(*) FROM `reservations` WHERE `reservation_bookingnumber`='%s'", $_SESSION['PWD']);
            return getResult($result);
            break;
        case 'store_unique_id':
            $result = query("UPDATE `reservations` SET reservation_bookingnumber = '' WHERE `reservation_date`<'%s'", $today);
            return $result;
            break;
        case 'sanitize_unique_id':
            $result = query("UPDATE `reservations` SET reservation_bookingnumber = '' WHERE `reservation_date`<'%s'", $before_yesterday);
            return $result;
            break;
        case 'cxl_list':
            $result = query("SELECT reservation_title, reservation_guest_name, reservation_timestamp, COUNT(*) AS count \n\t\t\t\t\t\t\tFROM `reservations`\n\t\t\t\t\t\t\tLEFT JOIN `outlets` ON outlet_id = reservation_outlet_id\n\t\t\t\t\t\t\tWHERE `reservation_hidden` = '1' \n\t\t\t\t\t\t\tAND `property_id` = '%d'\n\t\t\t\t\t\t\tGROUP BY `reservation_guest_name`\n\t\t\t\t\t\t\tORDER BY count DESC\n\t\t\t\t\t\t\tLIMIT 20", $_SESSION['propertyID']);
            return getRowList($result);
            break;
        case 'active_plugins':
            $plug = query("SELECT filename, action FROM `plugins` WHERE `action` = '1'");
            return getRowList($plug);
            break;
        case 'update_plugins':
            $result = query("UPDATE `plugins` SET `action` = '%d' WHERE `filename`='%s'", $value, $field);
            return $result;
            break;
        case 'count_plugins':
            $result = query("SELECT COUNT(*) FROM `plugins` WHERE `filename`='%s'", $field);
            return getResult($result);
            break;
        case 'get_plugins':
            $result = query("SELECT action FROM `plugins` WHERE `filename`='%s'", $field);
            return getResult($result);
            break;
        case 'insert_plugins':
            $result = query("INSERT INTO `plugins` (`filename`,`action`) VALUES ('%s','%d')", $field, $value);
            return $result;
            break;
        case 'user_activate':
            $result = query("UPDATE `plc_users` \n\t\t\t\t\t\t\tSET `active`='%d' \n\t\t\t\t\t\t\tWHERE `userID`='%d' LIMIT 1", $value, $id);
            return $result;
            break;
    }
}
Example #17
0
if ($period < 1) {
    $SQL = "SELECT MAX(`period`) FROM `netreport`";
    $period = singleResult($SQL, $db);
}
echo "    <center>\n";
$lastperiod = $period;
echo "<p><h1>Net History</h1></p>\n";
echo "<table width=\"90%\">\n";
echo "<tr><th align=\"left\">Period</th><th>QNI</th><th>QTC" . "</th><th>QTR</th><th>Sess</th><th>Hours</th></tr>\n";
for ($period = $lastperiod; $period > 71; $period--) {
    // Display the month name for this report
    $SQL = 'SELECT `lastday` FROM `periods` WHERE `periodno`=' . $period;
    $periodname = convertDate(singleResult($SQL, $db));
    // Get the actual report data for this period
    $SQL = 'SELECT B.`netfullname`,A.`QNI`,A.`QTC`,A.`QTR`,A.`sessions`,' . 'A.`updated`,A.`manhours`,A.`netid` ' . 'FROM `netreport` A, `nets` B ' . 'WHERE A.`period`=' . $period . ' AND A.`netID`=B.`netID` ' . 'ORDER BY `QTC` DESC, `QNI` DESC';
    $result = getResult($SQL, $db);
    // We will use rownum to keep track of light and dark rows
    $rownum = 1;
    // The following variables are used to calculate totals for the month
    $TQNI = 0;
    $TQTC = 0;
    $TQTR = 0;
    $TSess = 0;
    $TMH = 0;
    // Loop through the rows of the result
    while ($myrow = getRow($result, $db)) {
        // Update the latest data date, if necessary
        if ($myrow[5] > $maxdate) {
            $maxdate = $myrow[5];
        }
        // Calculate totals for the obvious ones
Example #18
0
    $ypos += 22;
}
$SQL2 = "SELECT `day_of_week`,`call` FROM `rep_liaisons` WHERE " . "`net`=3 ORDER BY `day_of_week`";
$res2 = getResult($SQL2, $db);
while ($row2 = getRow($res2, $db)) {
    $ypos = 43 + 22 * $row2[0];
    ImageString($image, $fontbody, 130, $ypos, $row2[1], $callcolor);
}
$SQL3 = "SELECT `day_of_week`,`call` FROM `rep_liaisons` WHERE " . "`net`=4 ORDER BY `day_of_week`";
$res3 = getResult($SQL3, $db);
while ($row3 = getRow($res3, $db)) {
    $ypos = 43 + 22 * $row3[0];
    ImageString($image, $fontbody, 220, $ypos, $row3[1], $callcolor);
}
$SQL4 = "SELECT `day_of_week`,`call` FROM `rep_nws` ORDER BY `day_of_week`";
$res4 = getResult($SQL4, $db);
while ($row4 = getRow($res4, $db)) {
    $ypos = 43 + 22 * $row4[0];
    ImageString($image, $fontbody, 300, $ypos, $row4[1], $callcolor);
}
// Black box around the image
ImageLine($image, 4, $ih - 1, $iw - 1, $ih - 1, $gray4);
ImageLine($image, 3, $ih - 2, $iw - 1, $ih - 2, $gray3);
ImageLine($image, 2, $ih - 3, $iw - 1, $ih - 3, $gray2);
ImageLine($image, 1, $ih - 4, $iw - 1, $ih - 4, $gray1);
ImageLine($image, $iw - 4, 1, $iw - 4, $ih - 4, $gray1);
ImageLine($image, $iw - 3, 2, $iw - 3, $ih - 3, $gray2);
ImageLine($image, $iw - 2, 3, $iw - 2, $ih - 2, $gray3);
ImageLine($image, $iw - 1, 4, $iw - 1, $ih - 1, $gray4);
ImageLine($image, 1, 1, $iw - 5, 1, $black);
ImageLine($image, $iw - 5, 1, $iw - 5, $ih - 5, $black);
Example #19
0
<?php

require_once 'ResultTree.php';
require_once 'mockresults.php';
// Get the mock result.
$result = getResult();
// Create our tree...
$tree = new ResultTree($result);
// Print out the tree.
print_r($tree->getTree());
// Print out the tree with a filter.
print_r($tree->getTree(4));
// Now print out the flat results.
print_r($tree->getFlat(0, TRUE));
// Now print out the flat results filtered.
print_r($tree->getFlat(4, TRUE));
Example #20
0
function writeSurveyForUser($array, $questionIndex, $row, $isSystemFeedback)
{
    $myqindex = $questionIndex;
    if ($questionIndex == 9) {
        $answerIndex = "q10";
    } else {
        $questionIndex = strval($questionIndex + 1);
        $answerIndex = "q" . $questionIndex;
    }
    echo "\"" . $array[$myqindex] . "\"\n";
    if ($isSystemFeedback == 1) {
        echo "\"" . getResult($row[$answerIndex]) . "\"\n";
    } else {
        echo "\"" . $row[$answerIndex] . "\"\n";
    }
}
Example #21
0
//
//    Generate a graph of a single county's FSD-212 results
//
include 'includes/session.inc';
include 'includes/functions.inc';
// Open the database
$db = mysql_connect($host, $dbuser, $dbpassword);
mysql_select_db($DatabaseName, $db);
// Get the requested county
$county = $_GET['county'];
//===========================================================================
// D a t a b a s e   D a t a
//===========================================================================
// Initialize the database query
$q3 = "SELECT `drillshrs`,`pseshrs`,`eopshrs`,`aresops`,`period` " . "FROM `arpsc_ecrept` WHERE `county`='" . $county . "' ORDER BY `period`";
$r3 = getResult($q3, $db);
$i = 0;
// Index into arrays to store results to graph
// Loop through all returned rows
while ($row3 = getRow($r3, $db)) {
    if ($row3[4] > 0) {
        $hours = $row3[0] + $row3[1] + $row3[2] + $row3[3];
        $i = $i + 1;
        $x[$i] = $row3[4];
        // Period
        $y[$i] = $hours;
        // Total hours
        $y1[$i] = $row3[0];
        // Drills
        $y2[$i] = $row3[1];
        // Public Service
Example #22
0
<?php

include 'functions.inc';
openHTML("Edit Memo", "memos Palm");
$db = openDatabase('myToDo');
$id = $_GET['item'];
echo "<p>Item: " . $id . "</p>\n";
$q1 = "SELECT A.`title`,A.`content`,A.`category`,B.`color` " . "FROM `memos` A, `categories` B " . "WHERE A.`memo_id`=" . $id . " AND  A.`category` = B.`cat_id`";
//echo "<p>[" . $q1 . "]</p>\n";
$r1 = getResult($q1, $db);
$row = mysql_fetch_row($r1);
echo "<form name=\"memo\" method=\"post\" action=\"memo2.php?item=" . $id . "\">\n";
echo "<b><input type=\"text\" name=\"title\" size=\"34\" value=\"" . $row[0] . "\" style=\"background-color: " . $row[3] . "; \" /></b>\n";
echo "<textarea name=\"content\" cols=\"36\" rows=\"40\">\n";
echo $row[1] . "\n";
echo "</textarea><br />\n";
echo "<p>&nbsp;</p>\n<center>\n";
echo "<input type=\"submit\" value=\"Submit\" style=\"font-size: 28pt; \">\n";
echo "<p>&nbsp;</p>\n";
echo "<a href=\"memo.php\">Back to list</a>\n";
echo "<p>&nbsp;</p>\n";
echo "</form>\n";
closeHTML();
         break;
     }
     if (is_uploaded_file($_FILES['Filedata']['tmp_name'])) {
         $sFilePath = $sFilesPath . $sSender . ".temp";
         @unlink($sFilePath);
         move_uploaded_file($_FILES['Filedata']['tmp_name'], $sFilePath);
         @chmod($sFilePath, 0644);
     }
     break;
 case 'initFile':
     $sFilePath = $sFilesPath . $sSender . ".temp";
     $sContents = parseXml($aXmlTemplates['result'], "msgErrorUpload", FAILED_VAL);
     if (empty($sSender) || !file_exists($sFilePath) || filesize($sFilePath) == 0) {
         break;
     }
     getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Messages`(`Sender`, `Recipient`, `Message`, `Type`, `When`) VALUES('" . $sSender . "', '" . $sRcp . "', '" . $sMessage . "', 'file', '" . time() . "')");
     $sFileName = getLastInsertId() . ".file";
     if (!@rename($sFilePath, $sFilesPath . $sFileName)) {
         break;
     }
     $sContents = parseXml($aXmlTemplates['result'], $sFileName, SUCCESS_VAL);
     break;
 case 'removeFile':
     $sId = str_replace(".file", "", $sId);
     removeFile($sId);
     break;
 case 'help':
     $sApp = isset($_REQUEST['app']) ? $_REQUEST['app'] : "user";
     $sContents = makeGroup("", "topics");
     $sFileName = $sModulesPath . $sModule . "/help/" . $sApp . ".xml";
     if (file_exists($sFileName)) {
Example #24
0
     doBoard('exit', $sId, $iBoardId);
     @unlink($sFilesPath . $sId . $sFileExtension);
     break;
 case 'checkBoardPassword':
     $sId = getValue("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "Boards` WHERE `ID`='" . $iBoardId . "' AND `Password`='" . $sPassword . "' LIMIT 1");
     if (empty($sId)) {
         $sContents = parseXml($aXmlTemplates['result'], "msgWrongRoomPassword", FAILED_VAL);
     } else {
         $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL);
     }
     break;
 case 'getOnlineUsers':
     //--- Check RayChatMessages table and drop autoincrement if it is possible. ---//
     $rResult = getResult("SELECT `ID` FROM `" . MODULE_DB_PREFIX . "CurrentUsers`");
     if (mysql_num_rows($rResult) == 0) {
         getResult("TRUNCATE TABLE `" . MODULE_DB_PREFIX . "CurrentUsers`");
     }
     //--- Update user's info and return info about all online users. ---//
     $sContents = refreshUsersInfo($sId);
     break;
 case 'update':
     $sContents = "";
     //--- update user's info ---//
     $sContents .= refreshUsersInfo($sId, 'update');
     //--- check for new rooms ---//
     $sContents .= makeGroup(getBoards('update', $sId), "boards");
     $sContents .= makeGroup(getBoards('updateUsers', $sId), "boardsUsers");
     break;
     /**
      * Transmit new Scene file from specified Board.
      * param - boardId
Example #25
0
echo "      <td class=\"" . $rowclass . "\">&nbsp; &nbsp;</td>\n";
$q6 = "SELECT COUNT(*) FROM `arpsc_ecrept` WHERE `period`=";
$testperiod = (int) $p9 + 1;
$q6 = $q6 . $testperiod;
$r6 = getResult($q6, $db);
$row6 = getRow($r6, $db);
if ($row6[0] > 0) {
    $url = "Summary.php?period=" . $testperiod;
    echo "      <td class=\"" . $rowclass . "\"><a href=\"" . $url . "\">Fwd 1m&gt;</a></td>\n";
} else {
    echo "      <td class=\"" . $rowclass . "\">Fwd 1m&gt;</td>\n";
}
$q6 = "SELECT COUNT(*) FROM `arpsc_ecrept` WHERE `period`=";
$testperiod = (int) $p9 + 3;
$q6 = $q6 . $testperiod;
$r6 = getResult($q6, $db);
$row6 = getRow($r6, $db);
if ($row6[0] > 0) {
    $url = "Summary.php?period=" . $testperiod;
    echo "      <td class=\"" . $rowclass . "\"><a href=\"" . $url . "\">Fwd 1Q&gt;&gt;</a></td>\n";
} else {
    echo "      <td class=\"" . $rowclass . "\">Fwd 1Q&gt;&gt;</td>\n";
}
echo "    </table>\n";
echo "    <p>&nbsp;</p>\n";
echo "    </center>";
echo "  </div>\n\n";
sectLeaders($db);
footer($starttime . "Z", $maxdate, "\$Revision: 1.0 \$ - \$Date: 2008-10-15 15:08:57-04 \$");
?>
</div>
Example #26
0
/**
 * Execute MySQL queries for specified widget.
 * @param sWidget - the name of the widget.
 */
function createDataBase($sWidget)
{
    global $sModulesPath;
    global $aErrorCodes;
    //--- Add info in the database ---//
    $sWidgetFile = $sWidget . "/install/install.sql";
    $sFileName = $sModulesPath . $sWidgetFile;
    $sModuleDBPrefix = DB_PREFIX . strtoupper(substr($sWidget, 0, 1)) . substr($sWidget, 1);
    if (!file_exists($sFileName)) {
        return getError($aErrorCodes[1], $sWidgetFile);
    }
    $rHandler = fopen($sFileName, "r");
    while (!feof($rHandler)) {
        $str = fgets($rHandler);
        if ($str[0] == "" || $str[0] == "#" || $str[0] == "-" && $str[1] == "-") {
            continue;
        }
        $str = str_replace("[module_db_prefix]", $sModuleDBPrefix, $str);
        if (strlen($str) > 5 ? strpos($str, ";", strlen($str) - 4) : strpos($str, ";")) {
            $sQuery .= $str;
        } else {
            $sQuery .= $str;
            continue;
        }
        if (!($res = getResult($sQuery))) {
            return $aErrorCodes[5];
        }
        $sQuery = "";
    }
    fclose($rHandler);
    return "";
}
  * New message for IM
  */
 case 'newMessage':
     //--- check online status of the recipient ---//
     $iContactRid = getContactId($sRspId, $sSndId);
     if (!empty($iContactRid)) {
         $sColor = $_REQUEST['color'] ? $_REQUEST['color'] : "0";
         $sBold = $_REQUEST['bold'] ? $_REQUEST['bold'] : FALSE_VAL;
         $sUnderline = $_REQUEST['underline'] ? $_REQUEST['underline'] : FALSE_VAL;
         $sItalic = $_REQUEST['italic'] ? $_REQUEST['italic'] : FALSE_VAL;
         $iSize = $_REQUEST['size'] ? $_REQUEST['size'] : 12;
         $sFont = $_REQUEST['font'] ? $_REQUEST['font'] : "Arial";
         $sStyle = serialize(array('color' => $sColor, 'bold' => $sBold, 'underline' => $sUnderline, 'italic' => $sItalic, 'smileset' => $sSmileset, 'size' => $iSize, 'font' => $sFont));
         $iContactSid = getContactId($sSndId, $sRspId);
         if (!empty($iContactSid)) {
             $rResult = getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Messages` (`ContactID`, `Message`, `Style`, `When`) VALUES ('" . $iContactSid . "', '" . $sMsg . "', '" . $sStyle . "', '" . time() . "')");
         }
     } else {
         $rResult = addPend($sSndId, $sRspId, $sMsg);
     }
     $sContents = parseXml($aXmlTemplates['result'], $rResult ? TRUE_VAL : FALSE_VAL);
     break;
 case 'help':
     $sApp = isset($_REQUEST['app']) ? $_REQUEST['app'] : "user";
     $sContents = makeGroup("", "topics");
     $sFileName = $sModulesPath . $sModule . "/help/" . $sApp . ".xml";
     if (file_exists($sFileName)) {
         $rHandle = @fopen($sFileName, "rt");
         $sContents = @fread($rHandle, filesize($sFileName));
         fclose($rHandle);
     }
Example #28
0
/**
* 执行SQL
*
* @param string $sql
* @param string $msg
* @param string $type
* @param string $countField
* @return int
*/
function sqlCount($sql, $msg = "", $type = "html", $countField = '*')
{
    $sql = $countField != "" ? @stristr($sql, "select t.* from") == false ? "select count(*) from (" . @str_ireplace("select * from", "select {$countField} from", $sql) . ") as _count_" : "select count(*) from (" . @str_ireplace("select t.* from", "select {$countField} from", $sql) . ") as _count_" : $sql;
    $res = getResult($sql, $msg, $type);
    $row = mysql_fetch_row($res);
    $row = $row[0];
    return $row;
}
Example #29
0
 $lc = singleResult($sqlc, $db);
 while ($row2 = getRow($r2, $db)) {
     //echo $district . ',' . $row2[0] . "<br>\n";
     $q3 = 'SELECT `aresmem`,`drillsnum`,`drillshrs`,`psesnum`,`pseshrs`,`eopsnum`,`eopshrs`,`aresopsnum`,`aresops` ' . "FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $period;
     $r3 = getResult($q3, $db);
     if ($row3 = getRow($r3, $db)) {
         $hours = $row3[2] + $row3[4] + $row3[6] + $row3[8];
         $value = $hours * 18.11;
         $lastperiod = $period - 1;
         $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $lastperiod;
         $r4 = getResult($q4, $db);
         if ($row4 = getRow($r4, $db)) {
             $change = $row3[0] - $row4[0];
         } else {
             $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=0";
             $r4 = getResult($q4, $db);
             if ($row4 = getRow($r4, $db)) {
                 $change = $row3[0] - $row4[0];
             } else {
                 $change = " ";
             }
         }
         echo "\t<tr>\n";
         if ($district != $olddistrict) {
             echo $district;
             $olddistrict = $district;
         }
         echo ',' . $row2[0] . ',' . round($hours) . ',' . round($value) . ',' . $row3[0] . ',' . $change . ',' . $row3[1] . ',' . $row3[2] . ',' . $row3[3] . ',' . $row3[4] . ',' . $row3[5] . ',' . $row3[6] . "<br .>\n";
     } else {
         if ($row2[0] == 'Arenac') {
             if ($district != $olddistrict) {
Example #30
0
     } else {
         $sContents = parseXml($aXmlTemplates['result'], "msgErrorScreenshot", FAILED_VAL);
     }
     break;
 case 'updateFile':
     $sCategoryUpdate = $sCategory == "0" ? "" : ", `Categories`='" . $sCategory . "'";
     getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Title`='" . $sTitle . "', `Tags`='" . $sTags . "', `Description`='" . $sDesc . "'" . $sCategoryUpdate . " WHERE `ID`='" . $sId . "' LIMIT 1");
     break;
     /**
      * set user's uploaded file time
      */
 /**
  * set user's uploaded file time
  */
 case 'updateFileTime':
     getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Time`='" . $sTime . "' WHERE `ID`='" . $sId . "'");
     $sContents = parseXml($aXmlTemplates['result'], TRUE_VAL);
     break;
 case 'post':
     $sSystem = isset($_REQUEST['system']) ? process_db_input($_REQUEST['system']) : "";
     $sAuthor = isset($_REQUEST['author']) ? process_db_input($_REQUEST['author']) : "";
     $sParent = isset($_REQUEST['parent']) ? process_db_input($_REQUEST['parent']) : "";
     $sMood = isset($_REQUEST['mood']) ? process_db_input($_REQUEST['mood']) : "";
     $sContents = "";
     $sResult = publishRecordedVideoFile($sAuthor);
     if ($sResult) {
         $sContents = post($sSystem, $sId, $sAuthor, $sParent, $sMood, $sResult);
     }
     $sContentsType = "text";
     break;
 case 'getToken':