Lines Matching full:if

47  * If the $input string does not contain enough elements, the missing elements will be
48 * filled up with the $default value. If the input string contains more elements, the last
64 * Checks if the given input is blank
82 if (is_null($in)) return true;
83 if (is_array($in)) return $in === [];
84 if ($in === "\0") return true;
85 if ($trim && trim($in) === '') return true;
86 if ((string) $in !== '') return false;
121 if (trim($user) == '' || trim($session) == '') return '';
129 * @return bool success if the token matched
135 if (!$INPUT->server->str('REMOTE_USER')) return true; // no logged in user, no need for a check
137 if (is_null($token)) $token = $INPUT->str('sectok');
138 if (getSecurityToken() != $token) {
148 * @param bool $print if true print the field, otherwise html of the field is returned
156 if ($print) echo $ret;
181 if ($INPUT->server->has('REMOTE_USER')) {
186 if ($info['perm'] == AUTH_ADMIN) {
193 // if some outside auth were used only REMOTE_USER is set
194 if (empty($info['userinfo']['name'])) {
205 if ($htmlClient) {
243 if ($REV) {
244 //check if current revision was meant
245 if ($info['exists'] && ($info['currentrev'] == $REV)) {
259 if ($info['exists']) {
272 if ($REV) {
278 // cache most recent changelog line in metadata if missing and still valid
279 if ($revinfo !== false) {
285 if ($revinfo !== false && $revinfo['date'] != $info['lastmod']) {
292 if ($revinfo !== false) {
309 if ($draft->isDraftAvailable()) {
323 if (!is_array($JSINFO)) {
380 if ($key[0] == '_') continue;
381 if ($val === '' && $skipEmptyStrings) continue;
382 if ($white) $url .= ' ';
403 if ($crumbs != null) return $crumbs;
414 if ($ACT != 'show' || $INFO['perm'] < AUTH_READ || isHiddenPage($ID) || !file_exists($file)) {
421 if (useHeading('navigation')) {
424 if ($title) {
430 if (isset($crumbs[$ID])) {
472 if ($conf['useslash'] && $conf['userewrite']) {
481 if ($ue) {
506 if (is_array($urlParameters)) {
507 if (isset($urlParameters['rev']) && !$urlParameters['rev']) unset($urlParameters['rev']);
508 if (isset($urlParameters['at']) && $conf['date_at_format']) {
515 if ($id === '') {
519 if ($absolute) {
525 if ($conf['userewrite'] == 2) {
527 if ($urlParameters) $xlink .= '?' . $urlParameters;
530 if ($urlParameters) $xlink .= '?' . $urlParameters;
533 if ($urlParameters) $xlink .= $separator . $urlParameters;
536 if ($urlParameters) $xlink .= '?' . $urlParameters;
545 * Handles URL rewriting if enabled. Follows the style of wl().
558 if (is_array($urlParameters)) {
566 if ($abs) {
572 if ($conf['userewrite'] == 2) {
574 if ($urlParameters) $xlink .= $sep . $urlParameters;
577 if ($urlParameters) $xlink .= '?' . $urlParameters;
580 if ($urlParameters) $xlink .= $sep . $urlParameters;
589 * Will return a link to the detail page if $direct is false
596 * @param bool $direct link to detail page if false
605 if (!$isexternalimage) {
609 if (is_array($more)) {
613 if ($w || $h || $isexternalimage) {
617 if (isset($more['cache']) && $more['cache'] == 'cache') unset($more['cache']);
618 if (empty($more['w'])) unset($more['w']);
619 if (empty($more['h'])) unset($more['h']);
620 if (isset($more['id']) && $direct) unset($more['id']);
621 if (isset($more['rev']) && !$more['rev']) unset($more['rev']);
625if (preg_match_all('/\b(w|h)=(\d*)\b/', $more, $matches, PREG_SET_ORDER) || $isexternalimage) {
638 if ($abs) {
645 if ($isexternalimage) {
655 if ($direct) {
656 if ($conf['userewrite'] == 1) {
668 if ($conf['userewrite']) {
670 if ($more) $xlink .= '?' . $more;
699 * returns true if the text contains any bad words
710 * [user] - username (if logged in)
711 * [mail] - mail address (if logged in)
712 * [name] - real name (if logged in)
714 * @param string $text - optional text to check, if not given the globals are used
715 * @return bool - true if a spam word was found
731 if (!$conf['usewordblock']) return false;
733 if (!$text) $text = "$PRE $TEXT $SUF $SUM";
755 if (empty($block)) continue;
758 if (count($re) && preg_match('#(' . implode('|', $re) . ')#si', $text, $matches)) {
763 if ($INPUT->server->str('REMOTE_USER')) {
780 * - The custom IP header if $conf[client_ip_header] is set.
781 * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxies].
783 * - 0.0.0.0 if all else fails.
785 * The 'client_ip_header' config value should only be set if the header
791 * @param bool $single If set only a single IP is returned.
793 * @return string Returns an IP address if 'single' is true, or a comma-separated list
805 * Check if the browser is on a mobile device
812 * @return bool if true, client is mobile browser; otherwise false
819 if ($INPUT->server->has('HTTP_X_WAP_PROFILE')) return true;
821 if (preg_match('/wap\.|\.wap/i', $INPUT->server->str('HTTP_ACCEPT'))) return true;
823 if (!$INPUT->server->has('HTTP_USER_AGENT')) return false;
838 if (preg_match("/$uamatches/i", $INPUT->server->str('HTTP_USER_AGENT'))) return true;
844 * check if a given link is interwiki link
851 if (preg_match('/^[a-zA-Z0-9\.]+>/u', $link)) return true;
858 * If $conf['dnslookups'] is disabled it simply returns the input string
868 if (!$conf['dnslookups']) return $ips;
873 if (is_array($ips)) {
884 * Checks if a given page is currently locked.
902 if (!file_exists($lock)) return false;
905 if ((time() - filemtime($lock)) > $conf['locktime']) {
912 if ($ip == $INPUT->server->str('REMOTE_USER') || (session_id() && $session === session_id())) {
932 if ($conf['locktime'] == 0) {
937 if ($INPUT->server->str('REMOTE_USER')) {
945 * Unlock a page if it was locked by the user
948 * @return bool true if a lock was removed
958 if (file_exists($lock)) {
960 if ($ip == $INPUT->server->str('REMOTE_USER') || $session == session_id()) {
983 // if the text is not valid UTF-8 we simply assume latin1
986 if (!Clean::isUtf8($text)) $text = Conversion::fromLatin1($text);
1049 if (is_array($id)) $id = $id[0];
1060 if ($evt->advise_before(true)) {
1062 if (empty($data['tpl'])) {
1063 // if the before event did not set a template file, try to find one
1064 if (empty($data['tplfile'])) {
1066 if (file_exists($path . '/_template.txt')) {
1072 if (file_exists($path . '/__template.txt')) {
1083 if ($data['doreplace']) parsePageTemplate($data);
1192 // Make range zero-based, use defaults if marker is missing
1208 * lines between sections if needed (used on saving).
1220 if ($pretty) {
1221 if (
1227 if (
1255 if (!$data) return; // save was cancelled (for no changes or by a plugin)
1262 // if useheading is enabled, purge the cache of all linking pages
1263 if (useHeading('content')) {
1307 // decide if there is something to do, eg. whom to mail
1308 if ($who == 'admin') {
1309 if (empty($conf['notify'])) return false; //notify enabled?
1313 if (!actionOK('subscribe')) return false; //subscribers enabled?
1314if ($conf['useacl'] && $INPUT->server->str('REMOTE_USER') && $minor) return false; //skip minors
1322 if (empty($to)) return false;
1346 if (!$INPUT->server->has('HTTP_REFERER')) {
1352 if (!array_key_exists('host', $url)) return '';
1353if (!preg_match('/(google|bing|yahoo|ask|duckduckgo|babylon|aol|yandex)/', $url['host'])) return '…
1356 if (!array_key_exists('query', $url)) return '';
1360 if (isset($query['q'])) {
1369 if (!$q) return '';
1370 // ignore if query includes a full URL
1371 if (str_contains($q, '//')) return '';
1414 if ($ago > 24 * 60 * 60 * 30 * 12 * 2) {
1417 if ($ago > 24 * 60 * 60 * 30 * 2) {
1420 if ($ago > 24 * 60 * 60 * 7 * 2) {
1423 if ($ago > 24 * 60 * 60 * 2) {
1426 if ($ago > 60 * 60 * 2) {
1429 if ($ago > 60 * 2) {
1452 if (is_null($dt)) $dt = time();
1454 if (!$format) $format = $conf['dformat'];
1530 * in the middle to shorten but only if at least $min chars are
1543 if ($max < $min) return $keep;
1545 if ($len <= $max) return $keep . $short;
1603 if ($username === null) {
1605 if ($textonly) {
1614 if ($evt->advise_before(true)) {
1615 if (empty($data['name'])) {
1616 if ($auth instanceof AuthPlugin) {
1619 if ($conf['showuseras'] != 'loginname' && isset($info) && $info) {
1638 if (!$data['textonly'] && empty($data['link']['url'])) {
1639 if (in_array($conf['showuseras'], ['email_link', 'username_link'])) {
1640 if (!isset($info) && $auth instanceof AuthPlugin) {
1643 if (isset($info) && $info) {
1644 if ($conf['showuseras'] == 'email_link') {
1647 if (is_null($xhtml_renderer)) {
1650 if ($xhtml_renderer->interwiki === []) {
1657 if ($exists !== null) {
1658 if ($exists) {
1674 if ($data['textonly']) {
1678 if (is_null($xhtml_renderer)) {
1703 if (!$conf['license']) return '';
1704 if (!is_array($license[$conf['license']])) return '';
1708 if (str_starts_with($conf['license'], 'cc-')) {
1712 if (file_exists(DOKU_INC . $src)) return $src;
1718 * Checks if the given amount of memory is available
1720 * If the memory_get_usage() function is not available the
1733 if (empty($limit)) return true; // no limit set!
1734 if ($limit == -1) return true; // unlimited
1739 // get used memory if possible
1740 if (function_exists('memory_get_usage')) {
1746 if ($used + $mem > $limit) {
1772 if (isset($MSG) && count($MSG) && !defined('NOSESSION')) {
1781 // check if running on IIS < 6 with CGI-PHP
1782 if (
1794 if (defined('DOKU_UNITTEST')) {
1797 if ($testRequest !== null) {
1831 if ($val === false) {
1861 * @return string|false the SVG content, false if the file couldn't be loaded
1866 if ($file === '') return false;
1867 if (!file_exists($file)) return false;
1868 if (filesize($file) > $maxsize) return false;
1869 if (!is_readable($file)) return false;
1876 if (!str_starts_with($content, '<svg ')) return false;