示例#1
0
 /**
  * 
  * @param WOOOF $wo
  * @param VO_TblPersonProfile $obj
  * @return false | id
  */
 public static function savePersonProfile(WOOOF $wo, VO_TblPersonProfile &$obj)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ");
     $t1 = new WOOOF_dataBaseTable($wo->db, 'person_profiles');
     if (!$t1->constructedOk) {
         return false;
     }
     if ($wo->hasContent($obj->id)) {
         // update
         $obj->updatedDateTime = WOOOF::currentGMTDateTime();
         $res = $t1->updateRowFromArraySimple($obj->toArray());
         if ($res === FALSE) {
             return false;
         }
     } else {
         // insert
         $obj->isDeleted = '0';
         $obj->createdDateTime = WOOOF::currentGMTDateTime();
         $obj->updatedDateTime = $obj->createdDateTime;
         $newId = $t1->insertRowFromArraySimple($obj->toArray());
         if ($newId === FALSE) {
             return false;
         }
         $obj->id = $newId;
     }
     return $obj->id;
 }
示例#2
0
 /**
  *
  * @param WOOOF $wo
  * @param array $in
  * @return false | flagged item type
  */
 public static function saveFlagItem(WOOOF $wo, $movieramaUserId, $in)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ");
     //find if user has already flagged the movie once before
     $tblFlagItems = new WOOOF_dataBaseTable($wo->db, 'flag_items');
     if (!$tblFlagItems->constructedOk) {
         return false;
     }
     $res = $tblFlagItems->getResult(['whatId' => $in['whatId'], 'whatType' => $in['whatType'], 'flaggedByUserId' => $movieramaUserId, 'flagStatus' => 'P', 'isDeleted' => '0'], '', '', '', '', false, true);
     if ($res === FALSE) {
         return false;
     }
     foreach ($tblFlagItems->resultRows as $aFlagItem) {
         $tblFlagItemUpdate = new VO_TblFlagItems($aFlagItem);
         $tblFlagItemUpdate->flagText = $in['flagText'];
         $res = self::save($wo, $tblFlagItemUpdate, 'U');
         if ($res === FALSE) {
             return false;
         }
         return $res;
     }
     $tblFlagItemInsert = new VO_TblFlagItems();
     $tblFlagItemInsert->whatType = $in['whatType'];
     $tblFlagItemInsert->whatId = $in['whatId'];
     $tblFlagItemInsert->flaggedByUserId = $movieramaUserId;
     $tblFlagItemInsert->flagText = $in['flagText'];
     $tblFlagItemInsert->flagStatus = 'P';
     $res = self::save($wo, $tblFlagItemInsert, 'I');
     if ($res === FALSE) {
         return false;
     }
     return $res;
 }
示例#3
0
 public static function get(WOOOF $wo, $paramCode, $evenDeleted = false)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $p_param = trim(strtoupper($paramCode));
     if (isset(self::$params[$paramCode])) {
         return self::$params[$paramCode][0];
     }
     $t1 = new WOOOF_dataBaseTable($wo->db, 'sys_params');
     if (!$t1->constructedOk) {
         return false;
     }
     $wheres = ['code' => $paramCode];
     if (!$evenDeleted) {
         $wheres['isDeleted'] = 0;
     }
     $res = $t1->getResult($wheres, 'code');
     if ($res === FALSE) {
         return false;
     }
     if ($res['rowsFetched'] !== 1) {
         $wo->logError(self::_ECP . "0010 {$res['rowsFetched']} records found for [{$paramCode}]");
         return false;
     }
     $paramRec = $t1->resultRows[0];
     $l_val = self::convertToType($paramRec['paramValue'], $paramRec['paramDataType']);
     self::$params[$paramCode] = array($l_val, $paramRec['paramDataType']);
     return $l_val;
 }
示例#4
0
<?php

$__isSiteBuilderPage = true;
$__actualPath = dirname($_SERVER['SCRIPT_FILENAME']);
$__actualPath = dirname($__actualPath);
require_once $__actualPath . '/setup.inc.php';
$requestedAction = 'edit';
$pageLocation = '1';
$wo = new WOOOF();
$table = new WOOOF_dataBaseTable($wo->db, $_GET['table']);
if (isset($_GET['submit']) && $_GET['submit'] == 'Submit') {
    for ($du = 0; $du < count($_GET['chk']); $du++) {
        $desr = $wo->db->query('select * from __columnMetaData where tableId=\'' . $table->getTableId() . '\' and id=\'' . $wo->cleanUserInput($_GET['chk'][$du]) . '\'');
        $de = $wo->db->fetchAssoc($desr);
        $c = '';
        //print_r($de);
        //echo 'INSERT INTO __columnMetaData set
        $wo->db->query('INSERT INTO __columnMetaData set 
id=\'' . $wo->db->getNewId('__columnMetaData') . '\',
tableId=\'' . $table->getTableId() . '\',
name=\'' . $wo->db->escape(trim($de['name' . $c] . $_GET['suplec'])) . '\',
description=\'' . $wo->db->escape(trim($de['description' . $c] . $_GET['suple'])) . '\',
type=\'' . $wo->db->escape(trim($de['type' . $c])) . '\',
length=\'' . $wo->db->escape(trim($de['length' . $c])) . '\',
notNull=\'' . $wo->db->escape(trim($de['notNull' . $c])) . '\',
presentationType=\'' . $wo->db->escape(trim($de['presentationType' . $c])) . '\',
isReadOnly=\'' . $wo->db->escape(trim($de['isReadOnly' . $c])) . '\',
isInvisible=\'' . $wo->db->escape(trim($de['isInvisible' . $c])) . '\',
appearsInLists=\'' . $wo->db->escape(trim($de['appearsInLists' . $c])) . '\',
isASearchableProperty=\'' . $wo->db->escape(trim($de['isASearchableProperty' . $c])) . '\',
isReadOnlyAfterFirstUpdate=\'' . $wo->db->escape(trim($de['isReadOnlyAfterFirstUpdate' . $c])) . '\',
    }
}
if (isset($_GET['__address'])) {
    $address = $wo->cleanUserInput($_GET['__address']);
} elseif (isset($_POST['__address'])) {
    $address = $wo->cleanUserInput($_POST['__address']);
}
if (isset($_GET['action'])) {
    $_GET['action'] = $wo->cleanUserInput($_GET['action']);
} elseif (isset($_POST['action'])) {
    $_GET['action'] = $wo->cleanUserInput($_POST['action']);
} else {
    $_GET['action'] = '';
}
$table = new WOOOF_dataBaseTable($wo->db, '', $_POST['table']);
$pictureTable = new WOOOF_dataBaseTable($wo->db, $tableName);
echo '<html>
<head>
<link rel="stylesheet" type="text/css" href="css/admin.css">
      <script src="jquery-1.9.1.js"></script>
      <script src="jquery-ui.js"></script>
      <script src="jquery.bpopup.min.js"></script>
      <script>
function confirmDelete(url)
        {
          $(\'#titleModal\').html(\'Πρόκειται να γίνει μη αναστρέψιμη διαγραφή!\')
          $(\'#textModal\').html(\'Σίγουρα θέλετε να προχωρήσετε στην διαγραφή του αντικειμένου; Η κίνηση αυτή δεν αντιστρέφεται...\');
          window.confirmedURLToGo = url;
          $(\'#modal\').addClass(\'redBorder\');
          $(\'#modal\').bPopup();
        }
示例#6
0
         //echo $targetRow['title'] .'<br/>'. $before['title'] .'<br/>';
         $wo->db->query('update ' . $table->getTableName() . ' set ' . $ordering . '=\'' . $targetRow[$ordering] . '\' where id=\'' . $before['id'] . '\'');
         $wo->db->query('update ' . $table->getTableName() . ' set ' . $ordering . '=\'' . $before[$ordering] . '\' where id=\'' . $targetRow['id'] . '\'');
     }
     if ($header != '') {
         header($header);
     } else {
         header('Location: administration.php?action=read&__address=1_' . $table->getTableId() . $extraURLBit);
     }
     doTheExit();
 } else {
     if ($action == 'moveDown' && count($addressItems) == 3) {
         $targetRow = $wo->db->getRow($table->getTableName(), $addressItems[2]);
         $ordering = $table->getOrderingColumnForListings();
         if ($table->getGroupedByTable() != '') {
             $table2 = new WOOOF_dataBaseTable($wo->db, $table->getGroupedByTable());
             if ($table2->getAdminPresentation() == WOOOF_tablePresentationTypes::CompositeTree) {
                 if ($targetRow[$table->getLocalGroupColumn()] != '-1') {
                     $header = 'Location: administration.php?action=edit&__address=1_' . $table2->getTableId() . '_' . $targetRow[$table->getLocalGroupColumn()] . '&parentNode=' . $targetRow[$table->getLocalGroupColumn()];
                 } else {
                     $header = 'Location: improvedTree.php?action=read&__address=1_' . $table2->getTableId() . '&parentNode=' . $targetRow[$table->getLocalGroupColumn()];
                 }
             } else {
                 if (stripos($table2->getTablesGroupedByThis(), $table->getTableName()) !== null && $_GET['from'] == 'edit') {
                     $header = 'Location: administration.php?action=edit&__address=1_' . $table2->getTableId() . '_' . $targetRow[$table->getLocalGroupColumn()];
                 } else {
                     $header = '';
                 }
             }
             $extraURLBit = '&wooofParent=' . $targetRow[$table->getLocalGroupColumn()] . '&' . $table->getLocalGroupColumn() . '=' . $targetRow[$table->getLocalGroupColumn()];
             $extraQueryBit = ' and ' . $table->getLocalGroupColumn() . '=\'' . $targetRow[$table->getLocalGroupColumn()] . '\' ';
示例#7
0
 /**
  *
  * @param WOOOF $wo
  * @param string $id for record to be deleted
  * @param string $action ('unLike' | 'unHate')
  * @return id of row deleted
  */
 public static function deleteOpinion(WOOOF $wo, $id, $action)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  Delete Movie Opinion");
     if (!$wo->hasContent($id)) {
         $wo->logError(self::_ECP . "1909 No value provided for [id]");
         return false;
     }
     $tblUserMovieOpinions = new WOOOF_dataBaseTable($wo->db, 'movierama_user_movies_opinions');
     if (!$tblUserMovieOpinions->constructedOk) {
         return false;
     }
     //find movie id to update counter
     $movieOpinionRec = $wo->db->getRow('movierama_user_movies_opinions', $id);
     if ($movieOpinionRec === FALSE) {
         return false;
     }
     $res = $tblUserMovieOpinions->deleteRow($id);
     if ($res === FALSE) {
         return false;
     }
     if ($action === 'unLike') {
         $decreaseLike = self::updateCounter($wo, $movieOpinionRec['movieId'], 'noOfLikes', '-1');
         if ($decreaseLike === FALSE) {
             return false;
         }
     } else {
         if ($action === 'unHate') {
             $decreaseHate = self::updateCounter($wo, $movieOpinionRec['movieId'], 'noOfHates', '-1');
             if ($decreaseHate === FALSE) {
                 return false;
             }
         }
     }
     return $id;
 }
示例#8
0
 /**
  *
  * @param WOOOF $wo
  * @param id $evaluationId
  * @param id $requestorUserId
  * @return bool
  */
 public static function calcResults(WOOOF $wo, $evaluationId, $requestorUserId)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     if (!$wo->hasContent($evaluationId)) {
         $wo->logError(self::_ECP . "5389 No value for evaluation id to calc results");
         return false;
     }
     $isSelfEvalOwner = self::isEvaluationOwner($wo, $evaluationId, $requestorUserId);
     if ($isSelfEvalOwner === FALSE) {
         return false;
     }
     if ($isSelfEvalOwner === 0) {
         $wo->logError(self::_ECP . "5399 I am sorry you cannot request to calc results of the evaluation you are not the owner");
         return false;
     }
     $tblEvalutionResults = new WOOOF_dataBaseTable($wo->db, 'evaluation_results');
     if (!$tblEvalutionResults->constructedOk) {
         return false;
     }
     //first delete all previous results for this evaluationId
     $res = $tblEvalutionResults->getResult(['evaluationId' => $evaluationId, 'isDeleted' => '0'], '', '', '', '', false, true);
     if ($res === FALSE) {
         return false;
     }
     foreach ($tblEvalutionResults->resultRows as $aRow) {
         $res = $tblEvalutionResults->deleteRow($aRow['id']);
         if ($res === FALSE) {
             return false;
         }
     }
     //save new results
     $sql = "select evaluationCriteriaId, avg(theValue) as avg, count(*) as count\n\t\t\tfrom evaluation_answers\n\t\t\twhere evaluationId = '{$evaluationId}'\n\t\t\tgroup by evaluationCriteriaId";
     $succ = $wo->db->getResultByQuery($sql, true, false);
     if ($succ === FALSE) {
         return FALSE;
     }
     foreach ($wo->db->resultRows as $aEvalResult) {
         $tblEvalResultInsert = new VO_TblEvaluationResults();
         $tblEvalResultInsert->evaluationId = $evaluationId;
         $tblEvalResultInsert->evaluationCriteriaId = $aEvalResult['evaluationCriteriaId'];
         $tblEvalResultInsert->theValue = $aEvalResult['avg'];
         $tblEvalResultInsert->theCount = $aEvalResult['count'];
         $res = self::saveResults($wo, $tblEvalResultInsert);
         if ($res === FALSE) {
             return false;
         }
     }
     //update final score and final count on evaluations table
     $tblEvaluations = new WOOOF_dataBaseTable($wo->db, 'evaluations');
     if (!$tblEvaluations->constructedOk) {
         return false;
     }
     //first get the evaluation
     $evalRow = $wo->db->getRow('evaluations', $evaluationId);
     $sql = "\n\t\t\tselect\n\t\t\t\tsum(\n\t\t\t\t\tevr.theValue \n\t\t\t\t\t* \n\t\t\t\t\tevc.weight \n\t\t\t\t\t/ \n\t\t\t\t\t(\t\n\t\t\t\t\t\tselect sum(evc2.weight) \n\t\t\t\t\t\tfrom  evaluation_criteria evc2 \n\t\t\t\t\t\twhere evc2.evaluationId = '{$evaluationId}'\n\t\t\t\t\t) \n\t\t\t\t) * 10 as finalScore, MAX(evr.theCount) as finalCount\n\t\t\tfrom\n\t\t\t\tevaluation_results evr,\n\t\t\t\tevaluation_criteria evc\n\t\t\twhere\n\t\t\t\tevr.evaluationId = '{$evaluationId}' and\n\t\t\t\tevc.id = evr.evaluationCriteriaId\t\t\n\t\t";
     $succ = $wo->db->getResultByQuery($sql, true, false);
     if ($succ === FALSE) {
         return FALSE;
     }
     foreach ($wo->db->resultRows as $aEval) {
         $tblEvalUpdate = new VO_TblEvaluations($evalRow);
         $tblEvalUpdate->finalScore = $aEval['finalScore'];
         $tblEvalUpdate->finalCount = $aEval['finalCount'];
         $res = self::save($wo, $tblEvalUpdate);
         if ($res === FALSE) {
             return false;
         }
     }
     return true;
 }
示例#9
0
 public static function createViewFor(WOOOF $wo, $p_database, $p_objectName)
 {
     $t = new WOOOF_dataBaseTable($wo->db, $p_objectName);
     if (!$t->constructedOk) {
         return FALSE;
     }
     if ($t->getIsView() == '1') {
         return '';
     }
     $sql = "\n\t\t\tselect \n";
     return 'What?';
 }
示例#10
0
 /**
  * 
  * @param string $rowId
  * @return boolean
  */
 public function deleteRow($rowId, $callLevel = 1)
 {
     // CAUTION: infinite recursion is possible!
     // Static properties:
     // $deleteRowFilesToRemove;	// array( id =>isImage, ... )
     // $deleteRowRowIds;		// array( table => array( rowId, ... ), ... )
     $wo = WOOOF::$instance;
     $wo->debug("deleteRow: {$this->tableName} [{$rowId}] [{$callLevel}]");
     if ($callLevel == 1) {
         $this::$deleteRowFilesToRemove = array();
         $this::$deleteRowRowIds = array();
     }
     if (isset($this::$deleteRowRowIds[$this->tableName][$rowId])) {
         $wo->logError(self::_ECP . "0530 deleteRow: Detected cycle on {$this->tableName}.{$rowId}");
         return true;
         // break the cycle
     }
     // add to memory
     $this::$deleteRowRowIds[$this->tableName] = $rowId;
     $theRow = $this->getRow($rowId);
     if ($theRow === FALSE) {
         return FALSE;
     }
     if ($theRow === NULL) {
         $wo->logError(self::_ECP . "0540 Delete row [{$rowId}] not found");
         return false;
     }
     if ($this->hasDeletedColumn) {
         $res = $this->dataBase->query('update ' . $this->tableName . ' set isDeleted=\'1\' where id=\'' . WOOOF::$instance->cleanUserInput($rowId) . '\'');
         if ($res === FALSE) {
             return FALSE;
         }
     } else {
         if ($this->hasGhostTable) {
             //TODO: ghost table stuf goes here
         }
         // antonis
         // Handle possible File (externalFiles entries) and Picture fields
         // Remove any relevant external files as well.
         for ($i = 0; $i < count($this->columns) / 2; $i++) {
             $metadata = $this->columns[$i]->getColumnMetaData();
             if ($metadata['presentationType'] == WOOOF_columnPresentationTypes::picture or $metadata['presentationType'] == WOOOF_columnPresentationTypes::file) {
                 WOOOF_Util::do_dump($metadata['name']);
                 // add to memory
                 $this::$deleteRowFilesToRemove[] = array($theRow[$metadata['name']], $metadata['presentationType'] == WOOOF_columnPresentationTypes::picture);
             }
             // file or image field
         }
         // for all columns
         $res = $this->dataBase->query('delete from ' . $this->tableName . ' where id=\'' . WOOOF::$instance->cleanUserInput($rowId) . '\'');
         if ($res === FALSE) {
             return FALSE;
         }
     }
     // antonis
     // Handle possible Detail records
     //
     // CAUTION: tablesGroupedByThis should be the space separated list of all tables with groupedByTable == this.table
     // CAUTION: this is manually done in dbManager
     //
     if ($wo->hasContent($this->tablesGroupedByThis)) {
         $subTableNames = explode(' ', $this->tablesGroupedByThis);
         foreach ($subTableNames as $aSubTableName) {
             $subTable = new WOOOF_dataBaseTable($wo->db, $aSubTableName);
             if (!$subTable->constructedOk) {
                 return FALSE;
             }
             if ($subTable->groupedByTable != $this->tableName) {
                 $wo->logError(self::_ECP . "0550 SubTable name mismatch!");
                 return FALSE;
             }
             $res = $subTable->getResult(array($subTable->localGroupColumn => $rowId), null, null, null, null, true, false);
             if ($res === FALSE) {
                 return FALSE;
             }
             foreach ($subTable->resultRows as $aSubTableRow) {
                 $succ = $subTable->deleteRow($aSubTableRow['id'], $callLevel + 1);
                 if ($succ === FALSE) {
                     return FALSE;
                 }
             }
         }
         // foreach subTable
     }
     // there exist sub tables
     if (isset($this->resultRows[$rowId])) {
         foreach ($this->resultRows as $key => $value) {
             if ($value['id'] == $rowId) {
                 unset($this->resultRows[$key]);
             }
         }
     }
     if ($callLevel == 1) {
         $wo->debug("deleteRow: Completed for all cases.");
         foreach ($this::$deleteRowFilesToRemove as $aFileData) {
             $succ = WOOOF_ExternalFiles::deleteExternalFile($wo, $aFileData[0], $aFileData[1]);
             // ???ignore false results (like failing to delete row from externaal file.
         }
         //debug
         //echo WOOOF_Util::do_dump($this::$deleteRowFilesToRemove);
         //echo WOOOF_Util::do_dump($this::$deleteRowRowIds);
     }
     return TRUE;
 }
示例#11
0
<?php

/*
 */
if (!isset($table)) {
    $__isAdminPage = true;
    $__actualPath = dirname($_SERVER['SCRIPT_FILENAME']);
    $__actualPath = dirname($__actualPath);
    require_once $__actualPath . '/setup.inc.php';
    $requestedAction = 'read';
    $pageLocation = '1';
    $pageTitle = 'Administration Back End';
    $wo = new WOOOF();
    $table = new WOOOF_dataBaseTable($wo->db, 'categories');
    $addressItems = explode('_', $wo->cleanUserInput($_GET['__address']));
}
$counter = 0;
while ($table->columns[$counter]->getAppearsInLists() != '1') {
    $counter++;
}
$path = '';
foreach ($table->columns as $key => $value) {
    $column = $value->getColumnMetaData();
    if ($column['appearsInLists']) {
        $columnsToShow = $column['name'];
    }
}
if (count($addressItems) == 2 || $addressItems[2] == '') {
    $whereClauses['parent_id'] = '-1';
    $table->getResult($whereClauses, 'ord');
    //$innerStuff ='<div id="listTitle"><a href="administration.php?action=edit&__address=1_'. $table->getTableId() .'_&wooofParent=-1">Προσθήκη '. $table->getTableDescription() .'</a></div>';
示例#12
0
 public function view($in)
 {
     $wo = $this->wo;
     $tableName = $this->tableName;
     if (!WOOOF::hasContent($tableName)) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, "1000 No value for tableName");
         return false;
     }
     $showDetails = $wo->getFromArray($in, '_showDetails', true);
     $tplContentTop = '';
     $tplContent = '';
     $tplErrorMessage = '';
     $tplMessage = '';
     $wo->debug("Generic.show for '{$tableName}'.");
     $table = new WOOOF_dataBaseTable($wo->db, $tableName);
     if (!$table->constructedOk) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, "1010 Failed to init '{$tableName}'!");
         return false;
     }
     // form html
     // $htmlFragment = '';
     $id = $wo->getFromArray($in, '_id');
     $tplContentTop .= "<h1>'{$tableName}' View for [{$id}]</h1>";
     // Show the data
     //
     $formBody = $table->presentRowReadOnly($id);
     if ($formBody === FALSE) {
         $tplContent .= "Failed to perform 'view'!";
         $tplErrorMessage .= $wo->getLastErrorAsStringAndClear() . '<br>';
     } else {
         $tplContent .= $formBody;
     }
     return array('contentTop' => $tplContentTop, 'content' => $tplContent, 'errorMessage' => $tplErrorMessage, 'message' => $tplMessage);
 }
示例#13
0
        } else {
            $showIdInAdminLists = '';
        }
        $showIdInAdminForms = $table->getShowIdInAdminForms();
        if ($showIdInAdminForms == '1') {
            $showIdInAdminForms = ' checked';
        } else {
            $showIdInAdminForms = '';
        }
    } else {
        if (isset($_POST['submit'])) {
            if ($_POST['action'] == 'new') {
                $table = $wo->db->getEmptyTable();
                $succ = $table->updateMetaDataFromPost();
            } elseif ($_POST['action'] == 'edit') {
                $table = new WOOOF_dataBaseTable($wo->db, $_POST['table']);
                $succ = $table->updateMetaDataFromPost();
            }
            if ($succ === FALSE) {
                $wo->db->rollback();
                $wo->handleShowStopperError();
            }
            $wo->db->commit();
            header("Location: dbManager.php?tm={$tm}#" . $_POST['table']);
            exit;
        }
    }
}
$content = '<br/><a href="dbManager.php?tm=' . $tm . '#' . $tableName . '" class="normalTextCyan">Back to Main Page</a><br/><br/><form method="POST" action="editTable.php"><input type="hidden" name="action" value="' . $action . '"><input type="hidden" name="table" value="' . $_GET['table'] . '">
    <table>
        <tr><td align="right">Table Name</td><td align="left"><input type="text" id="tableName" name="tableName" value="' . $tableName . '" autofocus></td></tr>
示例#14
0
 /**
  * getDomainValues get the data values for a requested domain/subdomain
  * 
  * @param WOOOD $wo -- the initialized instance of WOOOF to use
  * @param string $value  -- the value to check
  * @param string $requestedDomain  -- the domain whose values we want to retrieve
  * @param string $requestedSubDomain -- optional -- if the domain is split in subdomains, the requested subdomain should be specified here. If there are subdomains in the domain and no subdomain is specified all the values will be returned regardless of subdomain bu a warning will be written to the debug log. 
  * @param string $mandatory -- optional -- if the given value must have content or not
  * 
  * @return boolean TRUE for valid input.
  */
 public static function validateId(WOOOF $wo, $value, $requestedDomain, $requestedSubDomain = '', $mandatory = TRUE)
 {
     if (!$wo->hasContent($value) && $mandatory) {
         return FALSE;
     }
     $domain = $wo->db->getRowByColumn('__domains', 'code', $requestedDomain);
     if ($domain === FALSE) {
         return FALSE;
     } elseif (!isset($domain['id'])) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, self::_ECP . '0301 Requested domain [' . $wo->cleanUserInput($requestedDomain) . '] doesn\'t exist in the database!');
         return FALSE;
     }
     $domainData = new WOOOF_dataBaseTable($wo->db, '__domain_values');
     if (!$domainData->constructedOk) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, self::_ECP . '0302 Internal failure. Failed to construct instance of __domain_values!');
         return FALSE;
     }
     $whereClauses['domainId'] = $domain['id'];
     if ($wo->hasContent($requestedSubDomain)) {
         $subDomainsR = $wo->db->query('select subDomain from __domain_values where domainId = \'' . $wo->db->escape($domain['id']) . '\' and subDomain = \'' . $wo->db->escape($requestedSubDomain) . '\'');
         if (!$wo->db->getNumRows($subDomainsR)) {
             $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, self::_ECP . '0204 Requested subdomain [' . $wo->cleanUserInput($requestedSubDomain) . '] doesn\'t exist in the database!');
             return FALSE;
         }
         $whereClauses['subDomain'] = $requestedSubDomain;
     }
     $whereClauses['active'] = '1';
     $whereClauses['domainValueCode'] = $value;
     $howManyResults = $domainData->getResult($whereClauses);
     if ($howManyResults === FALSE) {
         $wo->log(WOOOF_loggingLevels::WOOOF_ERROR, self::_ECP . '0303 Operation failed in result retrieval from domain values.');
         return FALSE;
     }
     if ($howManyResults['rowsFetched'] == 0) {
         return FALSE;
     }
     return TRUE;
 }
示例#15
0
<?php

$__isAdminPage = true;
$__isSiteBuilderPage = true;
$__actualPath = dirname($_SERVER['SCRIPT_FILENAME']);
$__actualPath = dirname($__actualPath);
require_once $__actualPath . '/setup.inc.php';
$requestedAction = 'read';
$pageLocation = '1';
$pageTitle = 'Administration Back End';
$wo = new WOOOF();
$table = new WOOOF_dataBaseTable($wo->db, $_GET['table']);
$fragment = $table->constructAdministrationFragment();
echo '<div class="itemEditForm"><form method="POST" action="administration.php" enc-type="multipart/form-data"><input type="hidden" name="__address" value="1_' . $table->getTableId() . '_@@@id@@@"><input type="hidden" name="action" value="insert">';
echo $fragment[0];
echo '<section class="formFields">
      <div class="adminButton"><input type="submit" name="submit" value="Εισαγωγή"></div>
      </section></form></div>';
echo '<a href="buildTblCode.php?table=' . $_GET['table'] . '&class=">Get Tbl Code (fill-in class name first)...</a>';
exit;
示例#16
0
$tm = WOOOF::getCurrentDateTime();
$content = '';
if (!isset($_GET['table']) && !isset($_POST['table'])) {
    header("Location: dbManager.php?tm={$tm}");
    exit;
} else {
    if (isset($_GET['table']) && $_GET['table'] == '' || isset($_POST['table']) && $_POST['table'] == '') {
        header("Location: dbManager.php?tm={$tm}");
        exit;
    }
}
if (isset($_POST['table'])) {
    $_GET['table'] = $_POST['table'];
}
//used in order to be sure that the requested table exists
$t = new WOOOF_dataBaseTable($wo->db, $_GET['table']);
if ($t->getIsView() == '1') {
    header("Location: dbManager.php?tm={$tm}");
    exit;
}
$noOfColumns = 9;
// must be < 10
if (isset($_POST['submit']) && $_POST['submit'] == 'create') {
    for ($c = 1; $c <= $noOfColumns; $c++) {
        if ($_POST['name' . $c] != '') {
            if (!isset($_POST['notNull' . $c]) || $_POST['notNull' . $c] != '1') {
                $_POST['notNull' . $c] = '0';
            }
            if (!isset($_POST['isReadOnly' . $c]) || $_POST['isReadOnly' . $c] != '1') {
                $_POST['isReadOnly' . $c] = '0';
            }