mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
- Added function isEmptyString to fhc_helper
- Added function isEmptyArray to fhc_helper - Adapted the code in application/* to use as much as possible this two new functions - Removed the php function empty almost everywhere
This commit is contained in:
@@ -48,7 +48,7 @@ class Phrases extends FHC_Controller
|
||||
*/
|
||||
public function view($phrase_id)
|
||||
{
|
||||
if (empty($phrase_id))
|
||||
if (!is_numeric($phrase_id))
|
||||
show_error('Invalid phrase_id parameter');
|
||||
|
||||
$phrase = $this->phraseslib->getPhrase($phrase_id);
|
||||
@@ -71,7 +71,7 @@ class Phrases extends FHC_Controller
|
||||
*/
|
||||
public function deltext($phrasentext_id, $phrase_id)
|
||||
{
|
||||
if (empty($phrasentext_id) || empty($phrase_id))
|
||||
if (!is_numeric($phrasentext_id) || !is_numeric($phrase_id))
|
||||
show_error('Invalid phrasentext_id or phrase_id parameter');
|
||||
|
||||
$phrase_inhalt = $this->phraseslib->delPhrasentext($phrasentext_id);
|
||||
@@ -86,7 +86,7 @@ class Phrases extends FHC_Controller
|
||||
*/
|
||||
public function edit($phrase_id = null)
|
||||
{
|
||||
if (empty($phrase_id)) return;
|
||||
if (!is_numeric($phrase_id)) return;
|
||||
|
||||
$phrase = $this->phraseslib->getPhrase($phrase_id);
|
||||
if ($phrase->error)
|
||||
|
||||
@@ -44,7 +44,7 @@ class Vorlage extends VileSci_Controller
|
||||
|
||||
public function view($vorlage_kurzbz = null)
|
||||
{
|
||||
if (empty($vorlage_kurzbz)) exit;
|
||||
if (isEmptyString($vorlage_kurzbz)) exit;
|
||||
|
||||
$vorlagentext = $this->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz);
|
||||
|
||||
@@ -61,7 +61,7 @@ class Vorlage extends VileSci_Controller
|
||||
|
||||
public function edit($vorlage_kurzbz = null)
|
||||
{
|
||||
if (empty($vorlage_kurzbz)) exit;
|
||||
if (isEmptyString($vorlage_kurzbz)) exit;
|
||||
|
||||
$vorlage = $this->vorlagelib->getVorlage($vorlage_kurzbz);
|
||||
|
||||
|
||||
@@ -147,27 +147,27 @@ class PrestudentMultiAssign extends VileSci_Controller
|
||||
// Load model prestudentm_model
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
if ($studiengang == '' || empty($studiengang))
|
||||
if ($studiengang == '' || isEmptyString($studiengang))
|
||||
{
|
||||
$studiengang = null;
|
||||
}
|
||||
|
||||
if ($studiensemester == '' || empty($studiensemester))
|
||||
if ($studiensemester == '' || isEmptyString($studiensemester))
|
||||
{
|
||||
$studiensemester = null;
|
||||
}
|
||||
|
||||
if ($aufnahmegruppe == '' || empty($aufnahmegruppe))
|
||||
if ($aufnahmegruppe == '' || isEmptyString($aufnahmegruppe))
|
||||
{
|
||||
$aufnahmegruppe = null;
|
||||
}
|
||||
|
||||
if ($reihungstest == '' || empty($reihungstest))
|
||||
if ($reihungstest == '' || isEmptyString($reihungstest))
|
||||
{
|
||||
$reihungstest = null;
|
||||
}
|
||||
|
||||
if ($stufe == '' || empty($stufe))
|
||||
if ($stufe == '' || isEmptyString($stufe))
|
||||
{
|
||||
$stufe = null;
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ class InfoCenter extends FHC_Controller
|
||||
if (isError($personexists))
|
||||
show_error($personexists->retval);
|
||||
|
||||
if (empty($personexists->retval))
|
||||
show_error('person does not exist!');
|
||||
if (!hasData($personexists))
|
||||
show_error('Person does not exist!');
|
||||
|
||||
$origin_page = $this->input->get(self::ORIGIN_PAGE);
|
||||
if ($origin_page == self::INDEX_PAGE)
|
||||
@@ -213,7 +213,7 @@ class InfoCenter extends FHC_Controller
|
||||
$person_id,
|
||||
'saveformalgep',
|
||||
array(
|
||||
empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
|
||||
isEmptyString($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
|
||||
is_null($timestamp) ? 'NULL' : $timestamp
|
||||
)
|
||||
);
|
||||
@@ -269,7 +269,7 @@ class InfoCenter extends FHC_Controller
|
||||
{
|
||||
$prestudent_id = $this->input->post('prestudentid');
|
||||
|
||||
if (empty($prestudent_id))
|
||||
if (isEmptyString($prestudent_id))
|
||||
$result = error('Prestudentid missing');
|
||||
else
|
||||
{
|
||||
@@ -278,14 +278,14 @@ class InfoCenter extends FHC_Controller
|
||||
$zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
|
||||
$zgvort = $this->input->post('zgvort');
|
||||
$zgvdatum = $this->input->post('zgvdatum');
|
||||
$zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
|
||||
$zgvdatum = isEmptyString($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
|
||||
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
|
||||
|
||||
//zgvmasterdata
|
||||
$zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
|
||||
$zgvmaort = $this->input->post('zgvmaort');
|
||||
$zgvmadatum = $this->input->post('zgvmadatum');
|
||||
$zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
|
||||
$zgvmadatum = isEmptyString($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
|
||||
$zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
|
||||
|
||||
$result = $this->PrestudentModel->update(
|
||||
@@ -1193,9 +1193,9 @@ class InfoCenter extends FHC_Controller
|
||||
$orgform = $prestudentstatus->orgform != '' ? ' ('.$prestudentstatus->orgform.')' : '';
|
||||
$geschlecht = $person->geschlecht == 'm' ? 'männlich' : 'weiblich';
|
||||
$geburtsdatum = date('d.m.Y', strtotime($person->gebdatum));
|
||||
$zgvort = !empty($prestudent->zgvort) ? ' in '.$prestudent->zgvort : '';
|
||||
$zgvnation = !empty($prestudent->zgvnation_bez) ? ', '.$prestudent->zgvnation_bez : '';
|
||||
$zgvdatum = !empty($prestudent->zgvdatum) ? ', am '.date_format(date_create($prestudent->zgvdatum), 'd.m.Y') : '';
|
||||
$zgvort = !isEmptyString($prestudent->zgvort) ? ' in '.$prestudent->zgvort : '';
|
||||
$zgvnation = !isEmptyString($prestudent->zgvnation_bez) ? ', '.$prestudent->zgvnation_bez : '';
|
||||
$zgvdatum = !isEmptyString($prestudent->zgvdatum) ? ', am '.date_format(date_create($prestudent->zgvdatum), 'd.m.Y') : '';
|
||||
|
||||
$dokumenteNachzureichenMail = $dokumenteMail = array();
|
||||
//convert documents to array so they can be parsed, and keeping only needed fields
|
||||
@@ -1208,8 +1208,8 @@ class InfoCenter extends FHC_Controller
|
||||
|
||||
foreach ($dokumenteNachzureichen as $dokument)
|
||||
{
|
||||
$anmerkung = !empty($dokument->anmerkung) ? ' | Anmerkung: '.$dokument->anmerkung : '';
|
||||
$nachgereichtam = !empty($dokument->nachgereicht_am) ? ' | wird nachgereicht bis '.date_format(date_create($dokument->nachgereicht_am), 'd.m.Y') : '';
|
||||
$anmerkung = !isEmptyString($dokument->anmerkung) ? ' | Anmerkung: '.$dokument->anmerkung : '';
|
||||
$nachgereichtam = !isEmptyString($dokument->nachgereicht_am) ? ' | wird nachgereicht bis '.date_format(date_create($dokument->nachgereicht_am), 'd.m.Y') : '';
|
||||
$dokumenteNachzureichenMail[] = array('dokument_bezeichnung' => $dokument->dokument_bezeichnung, 'anmerkung' => $anmerkung, 'nachgereicht_am' => $nachgereichtam);
|
||||
}
|
||||
|
||||
@@ -1270,7 +1270,7 @@ class InfoCenter extends FHC_Controller
|
||||
|
||||
$receiver = $prestudent->studiengangmail;
|
||||
|
||||
if (!empty($receiver))
|
||||
if (!isEmptyString($receiver))
|
||||
{
|
||||
//Freigabeinformationmail sent from default system mail to studiengang mail(s)
|
||||
$sent = $this->maillib->send('', $receiver, $subject, $email, '', null, null, 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Inhalt vollständig darzustellen.');
|
||||
|
||||
@@ -484,9 +484,9 @@ class DB_Model extends FHC_Model
|
||||
$tmpTable = trim($table);
|
||||
|
||||
// Check parameters
|
||||
if (empty($tmpTable)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
||||
if (isEmptyString($tmpTable)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
|
||||
|
||||
if (!empty($alias))
|
||||
if (!isEmptyString($alias))
|
||||
{
|
||||
$tmpTable .= ' AS '.$alias;
|
||||
}
|
||||
@@ -586,7 +586,7 @@ class DB_Model extends FHC_Model
|
||||
$result = array();
|
||||
|
||||
// String that represents the pgsql array, better if not empty
|
||||
if (!empty($string))
|
||||
if (!isEmptyString($string))
|
||||
{
|
||||
// Magic convertion
|
||||
preg_match_all(
|
||||
@@ -742,7 +742,7 @@ class DB_Model extends FHC_Model
|
||||
$result = null;
|
||||
|
||||
// If the query is empty don't lose time
|
||||
if (!empty($query))
|
||||
if (!isEmptyString($query))
|
||||
{
|
||||
// If there are parameters to bind to the query
|
||||
if (is_array($parametersArray) && count($parametersArray) > 0)
|
||||
|
||||
@@ -61,7 +61,7 @@ class FHC_Controller extends CI_Controller
|
||||
{
|
||||
$this->_controllerId = $this->input->get(self::FHC_CONTROLLER_ID);
|
||||
|
||||
if (!isset($this->_controllerId) || empty($this->_controllerId))
|
||||
if (!isset($this->_controllerId) || isEmptyString($this->_controllerId))
|
||||
{
|
||||
$this->_controllerId = uniqid(); // generate a unique id
|
||||
// Redirect to the same URL, but giving FHC_CONTROLLER_ID as HTTP GET parameter
|
||||
|
||||
@@ -148,3 +148,22 @@ function loadResource($path, $resources = null, $subdir = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given string is empty
|
||||
* Empty means that the parameter string is null or made of space, tab, vertical tab, line feed, carriage return
|
||||
* and form feed characters.
|
||||
*/
|
||||
function isEmptyString($string)
|
||||
{
|
||||
return ($string == null) || ($string != null && ctype_space($string) === true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given array is empty
|
||||
* Empty means that is null, or is not null and it is not an array, or it is an array but without elements
|
||||
*/
|
||||
function isEmptyArray($array)
|
||||
{
|
||||
return ($array == null) || ($array != null && !is_array($array) || (is_array($array) && count($array) == 0));
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ function _parseMailContent($vorlage_kurzbz, $vorlage_data)
|
||||
{
|
||||
// If the text and the subject of the template are not empty
|
||||
if (is_array($result->retval) && count($result->retval) > 0 &&
|
||||
!empty($result->retval[0]->text))
|
||||
!isEmptyString($result->retval[0]->text))
|
||||
{
|
||||
// Parses template text
|
||||
$parsedText = $ci->vorlagelib->parseVorlagetext($result->retval[0]->text, $vorlage_data);
|
||||
|
||||
@@ -236,9 +236,9 @@ class FiltersLib
|
||||
public function generateDatasetQuery($query, $filters)
|
||||
{
|
||||
$datasetQuery = 'SELECT * FROM ('.$query.') '.self::DATASET_TABLE_ALIAS;
|
||||
$trimed = trim($query);
|
||||
|
||||
// If the given query is valid and the parameter filters is an array
|
||||
if (!empty($trimed) && $filters != null && is_array($filters))
|
||||
if (!isEmptyString($query) && $filters != null && is_array($filters))
|
||||
{
|
||||
$where = ''; // starts building the SQL where clause
|
||||
|
||||
@@ -249,8 +249,7 @@ class FiltersLib
|
||||
|
||||
if ($filtersCounter > 0) $where .= ' AND '; // if it's NOT the last one
|
||||
|
||||
$trimed2 = trim($filterDefinition->name);
|
||||
if (!empty($trimed2)) // if the name of the applied filter is valid
|
||||
if (!isEmptyString($filterDefinition->name)) // if the name of the applied filter is valid
|
||||
{
|
||||
// ...build the condition
|
||||
$where .= '"'.$filterDefinition->name.'"'.$this->_getDatasetQueryCondition($filterDefinition);
|
||||
@@ -290,16 +289,15 @@ class FiltersLib
|
||||
public function getFilterName($filterJson)
|
||||
{
|
||||
$filterName = $filterJson->name; // always present, used as default
|
||||
$trimed = (isset($filterJson->namePhrase)?trim($filterJson->namePhrase):'');
|
||||
|
||||
// Filter name from phrases system
|
||||
if (isset($filterJson->namePhrase) && !empty($trimed))
|
||||
if (isset($filterJson->namePhrase) && !isEmptyString($filterJson->namePhrase))
|
||||
{
|
||||
// Loads the library to use the phrases system
|
||||
$this->_ci->load->library('PhrasesLib', array(self::FILTER_PHRASES_CATEGORY));
|
||||
|
||||
$tmpFilterNamePhrase = $this->_ci->phraseslib->t(self::FILTER_PHRASES_CATEGORY, $filterJson->namePhrase);
|
||||
$trimed2 = trim($tmpFilterNamePhrase);
|
||||
if (isset($tmpFilterNamePhrase) && !empty($trimed2)) // if is not null or an empty string
|
||||
if (isset($tmpFilterNamePhrase) && !isEmptyString($tmpFilterNamePhrase)) // if is not null or an empty string
|
||||
{
|
||||
$filterName = $tmpFilterNamePhrase;
|
||||
}
|
||||
@@ -339,9 +337,9 @@ class FiltersLib
|
||||
public function removeSelectedField($selectedField)
|
||||
{
|
||||
$removeSelectedField = false;
|
||||
$trimed = trim($selectedField);
|
||||
|
||||
// Checks the parameter selectedField
|
||||
if (isset($selectedField) && !empty($trimed))
|
||||
if (isset($selectedField) && !isEmptyString($selectedField))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
@@ -373,9 +371,9 @@ class FiltersLib
|
||||
public function addSelectedField($selectedField)
|
||||
{
|
||||
$removeSelectedField = false;
|
||||
$trimed = trim($selectedField);
|
||||
|
||||
// Checks the parameter selectedField
|
||||
if (isset($selectedField) && !empty($trimed))
|
||||
if (isset($selectedField) && !isEmptyString($selectedField))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
@@ -402,9 +400,9 @@ class FiltersLib
|
||||
public function removeAppliedFilter($appliedFilter)
|
||||
{
|
||||
$removeAppliedFilter = false;
|
||||
$trimed = trim($appliedFilter);
|
||||
|
||||
// Checks the parameter appliedFilter
|
||||
if (isset($appliedFilter) && !empty($trimed))
|
||||
if (isset($appliedFilter) && !isEmptyString($appliedFilter))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
@@ -490,9 +488,9 @@ class FiltersLib
|
||||
public function addFilter($filter)
|
||||
{
|
||||
$addFilter = false;
|
||||
$trimed = trim($filter);
|
||||
|
||||
// Checks the parameter filter
|
||||
if (isset($filter) && !empty($trimed))
|
||||
if (isset($filter) && !isEmptyString($filter))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
@@ -533,9 +531,9 @@ class FiltersLib
|
||||
public function saveCustomFilter($customFilterDescription)
|
||||
{
|
||||
$saveCustomFilter = false; // by default returns a failure
|
||||
$trimed = trim($customFilterDescription);
|
||||
|
||||
// Checks parameter customFilterDescription if not valid stop the execution
|
||||
if (!isset($customFilterDescription) || empty($trimed))
|
||||
if (!isset($customFilterDescription) || isEmptyString($customFilterDescription))
|
||||
{
|
||||
return $saveCustomFilter;
|
||||
}
|
||||
@@ -652,11 +650,10 @@ class FiltersLib
|
||||
*/
|
||||
private function _getFilterUniqueId($params)
|
||||
{
|
||||
$trimed = trim($params[self::FILTER_PAGE_PARAM]);
|
||||
if ($params != null
|
||||
&& is_array($params)
|
||||
&& isset($params[self::FILTER_PAGE_PARAM])
|
||||
&& !empty($trimed))
|
||||
&& !isEmptyString($params[self::FILTER_PAGE_PARAM]))
|
||||
{
|
||||
$filterUniqueId = $params[self::FILTER_PAGE_PARAM];
|
||||
}
|
||||
@@ -686,9 +683,9 @@ class FiltersLib
|
||||
private function _getDatasetQueryCondition($filterDefinition)
|
||||
{
|
||||
$condition = ''; // starts building the condition
|
||||
$trimed = trim($filterDefinition->operation);
|
||||
|
||||
// "operation" is a required property for the applied filter definition
|
||||
if (!empty($trimed))
|
||||
if (!isEmptyString($filterDefinition->operation))
|
||||
{
|
||||
// Checks what operation is required
|
||||
switch ($filterDefinition->operation)
|
||||
@@ -761,9 +758,9 @@ class FiltersLib
|
||||
break;
|
||||
}
|
||||
}
|
||||
$trimed = trim($condition);
|
||||
|
||||
// if the condition is valid
|
||||
if (!empty($trimed)) $condition = ' '.$condition; // add a white space before
|
||||
if (!isEmptyString($condition)) $condition = ' '.$condition; // add a white space before
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class MailLib
|
||||
if (!is_null($recipientBCC)) $this->ci->email->bcc($recipientBCC);
|
||||
$this->ci->email->subject($subject);
|
||||
$this->ci->email->message($message);
|
||||
if (!empty($altMessage)) $this->ci->email->set_alt_message($altMessage);
|
||||
if (!isEmptyString($altMessage)) $this->ci->email->set_alt_message($altMessage);
|
||||
|
||||
// Avoid printing on standard output ugly error messages
|
||||
$result = @$this->ci->email->send();
|
||||
@@ -151,7 +151,7 @@ class MailLib
|
||||
{
|
||||
$valid = false;
|
||||
|
||||
if (!empty($emailAddress))
|
||||
if (!isEmptyString($emailAddress))
|
||||
{
|
||||
$valid = filter_var($emailAddress, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ class MessageLib
|
||||
*/
|
||||
public function getMessage($msg_id, $person_id)
|
||||
{
|
||||
if (empty($msg_id))
|
||||
if (!is_numeric($msg_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
if (empty($person_id))
|
||||
if (!is_numeric($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_RECIPIENTS);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getMessage($msg_id, $person_id);
|
||||
@@ -59,7 +59,7 @@ class MessageLib
|
||||
*/
|
||||
public function getMessagesByUID($uid, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($uid))
|
||||
if (isEmptyString($uid))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getMessagesByUID($uid, $oe_kurzbz, $all);
|
||||
@@ -72,7 +72,7 @@ class MessageLib
|
||||
*/
|
||||
public function getMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($person_id))
|
||||
if (!is_numeric($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$msg = $this->ci->RecipientModel->getMessagesByPerson($person_id, $oe_kurzbz, $all);
|
||||
@@ -85,7 +85,7 @@ class MessageLib
|
||||
*/
|
||||
public function getSentMessagesByPerson($person_id, $oe_kurzbz = null, $all = false)
|
||||
{
|
||||
if (empty($person_id))
|
||||
if (!is_numeric($person_id))
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$msg = $this->ci->MessageModel->getMessagesByPerson($person_id, $oe_kurzbz, $all);
|
||||
@@ -98,7 +98,7 @@ class MessageLib
|
||||
*/
|
||||
public function getMessageByToken($token)
|
||||
{
|
||||
if (empty($token))
|
||||
if (isEmptyString($token))
|
||||
return $this->_error('', MSG_ERR_INVALID_TOKEN);
|
||||
|
||||
$result = $this->ci->RecipientModel->getMessageByToken($token);
|
||||
@@ -155,12 +155,12 @@ class MessageLib
|
||||
*/
|
||||
public function updateMessageStatus($message_id, $person_id, $status)
|
||||
{
|
||||
if (empty($message_id))
|
||||
if (!is_numeric($message_id))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_MSG_ID);
|
||||
}
|
||||
|
||||
if (empty($person_id))
|
||||
if (!is_numeric($person_id))
|
||||
{
|
||||
return $this->_error('', MSG_ERR_INVALID_USER_ID);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ class MessageLib
|
||||
if ($this->_checkReceiverId($receiver_id))
|
||||
{
|
||||
// If the text and the subject of the template are not empty
|
||||
if (!empty($subject) && !empty($body))
|
||||
if (!isEmptyString($subject) && !isEmptyString($body))
|
||||
{
|
||||
$result = $this->_saveMessage($sender_id, $receiver_id, $subject, $body, $relationmessage_id, $oe_kurzbz);
|
||||
// If no errors were occurred
|
||||
@@ -239,12 +239,12 @@ class MessageLib
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($subject))
|
||||
if (isEmptyString($subject))
|
||||
{
|
||||
$result = $this->_error('', MSG_ERR_SUBJECT_EMPTY);
|
||||
break;
|
||||
}
|
||||
elseif (empty($body))
|
||||
elseif (isEmptyString($body))
|
||||
{
|
||||
$result = $this->_error('', MSG_ERR_BODY_EMPTY);
|
||||
break;
|
||||
@@ -315,7 +315,7 @@ class MessageLib
|
||||
{
|
||||
// If the text and the subject of the template are not empty
|
||||
if (is_array($result->retval) && count($result->retval) > 0 &&
|
||||
!empty($result->retval[0]->text) && !empty($result->retval[0]->subject))
|
||||
!isEmptyString($result->retval[0]->text) && !isEmptyString($result->retval[0]->subject))
|
||||
{
|
||||
// Parses template text
|
||||
$parsedText = $this->ci->vorlagelib->parseVorlagetext($result->retval[0]->text, $data);
|
||||
@@ -349,12 +349,12 @@ class MessageLib
|
||||
$result = $this->_error('', MSG_ERR_TEMPLATE_NOT_FOUND);
|
||||
break;
|
||||
}
|
||||
elseif (empty($result->retval[0]->text))
|
||||
elseif (isEmptyString($result->retval[0]->text))
|
||||
{
|
||||
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
|
||||
break;
|
||||
}
|
||||
elseif (empty($result->retval[0]->subject))
|
||||
elseif (isEmptyString($result->retval[0]->subject))
|
||||
{
|
||||
$result = $this->_error('', MSG_ERR_INVALID_TEMPLATE);
|
||||
break;
|
||||
|
||||
@@ -300,12 +300,10 @@ class NavigationLib
|
||||
*/
|
||||
private function _getNavigationtPage($params)
|
||||
{
|
||||
//
|
||||
$trimed = trim($params[self::NAVIGATION_PAGE_PARAM]);
|
||||
if ($params != null
|
||||
&& is_array($params)
|
||||
&& isset($params[self::NAVIGATION_PAGE_PARAM])
|
||||
&& !empty($trimed))
|
||||
&& !isEmptyString($params[self::NAVIGATION_PAGE_PARAM]))
|
||||
{
|
||||
$navigationPage = $params[self::NAVIGATION_PAGE_PARAM];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class PhrasesLib
|
||||
*/
|
||||
public function getPhrase($phrase_id)
|
||||
{
|
||||
if (empty($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
if (isEmptyString($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
return $this->_ci->PhraseModel->load($phrase_id);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class PhrasesLib
|
||||
*/
|
||||
public function getPhraseInhalt($phrase_id)
|
||||
{
|
||||
if (empty($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
if (isEmptyString($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
return $this->_ci->PhrasentextModel->loadWhere(array('phrase_id' => $phrase_id));
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class PhrasesLib
|
||||
*/
|
||||
public function delPhrasentext($phrasentext_id)
|
||||
{
|
||||
if (empty($phrasentext_id)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
if (isEmptyString($phrasentext_id)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
return $this->_ci->PhrasentextModel->delete(array('phrasentext_id' => $phrasentext_id));
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class PhrasesLib
|
||||
*/
|
||||
public function savePhrase($phrase_id, $data)
|
||||
{
|
||||
if (empty($data)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
if (isEmptyString($data)) return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
return $this->_ci->PhraseModel->update($phrase_id, $data);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class PhrasesLib
|
||||
*/
|
||||
public function getPhrasentextById($phrasentext_id)
|
||||
{
|
||||
if (empty($phrasentext_id))
|
||||
if (isEmptyString($phrasentext_id))
|
||||
return error($this->_ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
|
||||
return $this->_ci->PhrasentextModel->load($phrasentext_id);
|
||||
@@ -170,7 +170,7 @@ class PhrasesLib
|
||||
*/
|
||||
public function parseVorlagetext($text, $data = array())
|
||||
{
|
||||
if (empty($text))
|
||||
if (isEmptyString($text))
|
||||
return error($this->_ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
|
||||
return $this->_ci->parser->parse_string($text, $data, true);
|
||||
@@ -193,13 +193,13 @@ class PhrasesLib
|
||||
for ($i = 0; $i < count($this->_phrases); $i++)
|
||||
{
|
||||
$_phrase = $this->_phrases[$i]; // single phrase
|
||||
$trimed = trim($_phrase->text);
|
||||
|
||||
// If the single phrase match the given parameters and is not an empty string
|
||||
if ($_phrase->category == $category
|
||||
&& $_phrase->phrase == $phrase
|
||||
&& $_phrase->orgeinheit_kurzbz == $orgeinheit_kurzbz
|
||||
&& $_phrase->orgform_kurzbz == $orgform_kurzbz
|
||||
&& (!empty($trimed)))
|
||||
&& !isEmptyString($_phrase->text))
|
||||
{
|
||||
if (!is_array($parameters)) $parameters = array(); // if params is not an array
|
||||
|
||||
@@ -243,7 +243,7 @@ class PhrasesLib
|
||||
|
||||
// Use the given language if present, otherwise retrives the language for the logged user
|
||||
$language = DEFAULT_LANGUAGE;
|
||||
if (count($parameters) == 2 && !empty($parameters[1]) && is_string($parameters[1]))
|
||||
if (count($parameters) == 2 && !isEmptyString($parameters[1]) && is_string($parameters[1]))
|
||||
{
|
||||
$language = $parameters[1];
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ class UDFLib
|
||||
*/
|
||||
public function UDFWidget($args, $htmlArgs = array())
|
||||
{
|
||||
if (!empty($args[UDFLib::SCHEMA_ARG_NAME]) && !empty($args[UDFLib::TABLE_ARG_NAME]))
|
||||
if ((isset($args[UDFLib::SCHEMA_ARG_NAME]) && !isEmptyString($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
&& (isset($args[UDFLib::TABLE_ARG_NAME]) && !isEmptyString($args[UDFLib::TABLE_ARG_NAME])))
|
||||
{
|
||||
// Loads the widget library
|
||||
$this->_ci->load->library('WidgetLib');
|
||||
@@ -72,7 +73,7 @@ class UDFLib
|
||||
loadResource(APPPATH.'widgets/udf');
|
||||
|
||||
// Default external block is true
|
||||
if (empty($args[UDFLib::FIELD_ARG_NAME]) && !isset($htmlArgs[HTMLWidget::EXTERNAL_BLOCK]))
|
||||
if (!isset($args[UDFLib::FIELD_ARG_NAME]) && !isset($htmlArgs[HTMLWidget::EXTERNAL_BLOCK]))
|
||||
{
|
||||
$htmlArgs[HTMLWidget::EXTERNAL_BLOCK] = true;
|
||||
}
|
||||
@@ -85,11 +86,11 @@ class UDFLib
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
if (!isset($args[UDFLib::SCHEMA_ARG_NAME]) || isEmptyString($args[UDFLib::SCHEMA_ARG_NAME]))
|
||||
{
|
||||
show_error(UDFLib::SCHEMA_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
if (empty($args[UDFLib::TABLE_ARG_NAME]))
|
||||
if (!isset($args[UDFLib::TABLE_ARG_NAME]) || isEmptyString($args[UDFLib::TABLE_ARG_NAME]))
|
||||
{
|
||||
show_error(UDFLib::TABLE_ARG_NAME.' parameter is missing!');
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class VorlageLib
|
||||
*/
|
||||
public function getVorlage($vorlage_kurzbz)
|
||||
{
|
||||
if (empty($vorlage_kurzbz))
|
||||
if (isEmptyString($vorlage_kurzbz))
|
||||
return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz);
|
||||
@@ -57,7 +57,7 @@ class VorlageLib
|
||||
*/
|
||||
public function saveVorlage($vorlage_kurzbz, $data)
|
||||
{
|
||||
if (empty($data))
|
||||
if (isEmptyArray($data))
|
||||
return error(MSG_ERR_INVALID_MSG_ID);
|
||||
|
||||
$vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data);
|
||||
@@ -72,7 +72,7 @@ class VorlageLib
|
||||
*/
|
||||
public function getVorlagetextByVorlage($vorlage_kurzbz)
|
||||
{
|
||||
if (empty($vorlage_kurzbz))
|
||||
if (isEmptyString($vorlage_kurzbz))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
|
||||
$vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz));
|
||||
@@ -90,7 +90,7 @@ class VorlageLib
|
||||
*/
|
||||
public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null)
|
||||
{
|
||||
if (empty($vorlage_kurzbz))
|
||||
if (isEmptyString($vorlage_kurzbz))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
|
||||
// Try to search the template with the given vorlage_kurzbz and other parameters if present
|
||||
@@ -200,7 +200,7 @@ class VorlageLib
|
||||
*/
|
||||
public function parseVorlagetext($text, $data = array())
|
||||
{
|
||||
if (empty($text))
|
||||
if (isEmptyString($text))
|
||||
return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false));
|
||||
$text = $this->ci->parser->parse_string($text, $data, true);
|
||||
return $text;
|
||||
|
||||
@@ -57,7 +57,7 @@ class WidgetLib
|
||||
loadResource($this->_widget_path.WidgetLib::DIR_HTML_WIDGETS);
|
||||
|
||||
// If config are given then initialize this lib with the given config
|
||||
if (!empty($config)) $this->initialize($config);
|
||||
if (!isEmptyArray($config)) $this->initialize($config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,8 +50,7 @@ class Ampel_model extends DB_Model
|
||||
*/
|
||||
public function execBenutzerSelect($benutzer_select)
|
||||
{
|
||||
$trimed = trim($benutzer_select);
|
||||
if (isset($benutzer_select) && !empty($trimed))
|
||||
if (isset($benutzer_select) && !isEmptyString($benutzer_select))
|
||||
{
|
||||
return $this->execQuery($benutzer_select);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class Akte_model extends DB_Model
|
||||
|
||||
$parametersArray = array($person_id);
|
||||
|
||||
if (!empty($dokument_kurzbz))
|
||||
if (!isEmptyString($dokument_kurzbz))
|
||||
{
|
||||
$query .= ' AND a.dokument_kurzbz = ?';
|
||||
array_push($parametersArray, $dokument_kurzbz);
|
||||
@@ -163,7 +163,7 @@ class Akte_model extends DB_Model
|
||||
|
||||
$parametersArray = array($person_id);
|
||||
|
||||
if (!empty($dokument_kurzbz))
|
||||
if (!isEmptyString($dokument_kurzbz))
|
||||
{
|
||||
$query .= ' AND a.dokument_kurzbz = ?';
|
||||
array_push($parametersArray, $dokument_kurzbz);
|
||||
|
||||
@@ -236,7 +236,7 @@ class Person_model extends DB_Model
|
||||
{
|
||||
$person = $persons->retval[$i];
|
||||
|
||||
if (!empty($person->sprache))
|
||||
if (!isEmptyString($person->sprache))
|
||||
{
|
||||
$language = $person->sprache;
|
||||
break;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="outputAkteContent/<?php echo $dokument->akte_id ?>"><?php echo empty($dokument->titel) ? $dokument->bezeichnung : $dokument->titel ?></a>
|
||||
<a href="outputAkteContent/<?php echo $dokument->akte_id ?>"><?php echo isEmptyString($dokument->titel) ? $dokument->bezeichnung : $dokument->titel ?></a>
|
||||
</td>
|
||||
<td><?php echo $dokument->dokument_bezeichnung ?></td>
|
||||
<td><?php echo date_format(date_create($dokument->erstelltam), 'd.m.Y') ?></td>
|
||||
|
||||
@@ -21,7 +21,7 @@ $this->load->view(
|
||||
</div>
|
||||
</div>
|
||||
<div id="data">
|
||||
<?php if (empty($data)): ?>
|
||||
<?php if ($data == null): ?>
|
||||
<?php echo $this->p->t('infocenter', 'keineZugangsvoraussetzungenTxt'); ?>
|
||||
<?php
|
||||
else:
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
<div class="form-group">
|
||||
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('global','datum') . ':'?></label>
|
||||
<?php
|
||||
$zgvdatum = empty($zgvpruefung->zgvdatum) ? "" : date_format(date_create($zgvpruefung->zgvdatum), 'd.m.Y');
|
||||
$zgvdatum = isEmptyString($zgvpruefung->zgvdatum) ? "" : date_format(date_create($zgvpruefung->zgvdatum), 'd.m.Y');
|
||||
if ($infoonly):
|
||||
echo $zgvdatum;
|
||||
else:
|
||||
@@ -188,7 +188,7 @@
|
||||
<div class="form-group">
|
||||
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ' ' . $this->p->t('global','datum') . ':'?></label>
|
||||
<?php
|
||||
$zgvmadatum = empty($zgvpruefung->zgvmadatum) ? "" : date_format(date_create($zgvpruefung->zgvmadatum), 'd.m.Y');
|
||||
$zgvmadatum = isEmptyString($zgvpruefung->zgvmadatum) ? "" : date_format(date_create($zgvpruefung->zgvmadatum), 'd.m.Y');
|
||||
if ($infoonly):
|
||||
echo $zgvmadatum;
|
||||
else:
|
||||
@@ -305,7 +305,7 @@
|
||||
<div class="col-lg-6 text-right">
|
||||
<?php
|
||||
$disabled = $disabledTxt = '';
|
||||
if (empty($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum))
|
||||
if (isEmptyString($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum))
|
||||
{
|
||||
$disabled = 'disabled';
|
||||
$disabledTxt = 'Die Bewerbung muss erst abgeschickt worden sein.';
|
||||
|
||||
@@ -12,8 +12,8 @@ class Reihungstest_widget extends DropdownWidget
|
||||
$parametersArray = array();
|
||||
// If the parameters studiengang or studiensemester are given and are not empty
|
||||
if (isset($widgetData) && is_array($widgetData)
|
||||
&& ((isset($widgetData['studiengang']) && !empty($widgetData['studiengang']))
|
||||
|| (isset($widgetData['studiensemester']) && !empty($widgetData['studiensemester']))))
|
||||
&& ((isset($widgetData['studiengang']) && !isEmptyString($widgetData['studiengang']))
|
||||
|| (isset($widgetData['studiensemester']) && !isEmptyString($widgetData['studiensemester']))))
|
||||
{
|
||||
if ($widgetData['studiengang'] != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user