$allDays = '0%';
            } else {
                $allDays = $remainDays / (double) $allDays * 100 . '%';
            }
            echo '<div id="progress" class="graph"><div id="bar" style="width:' . $allDays . '">' . wrapText($remainDays . ' days') . '</div></div>';
        } else {
            wrapText($row->status);
        }
        ?>
			 </td>
             <td><?php 
        wrapText($row->description);
        ?>
</td>
             <td><?php 
        wrapText($row->note);
        ?>
</td>
             
             <td class="tools">
			 <!-- tool box -->
			 <span><?php 
        echo anchor('projects_controller/enter_hours/' . $row->id, 'Enter Hours', 'class="hours_button"');
        ?>
</span>
			 <?php 
        if ($row->owner_id == $this->native_session->userdata('user_id')) {
            ?>
			 <span><?php 
            echo anchor('projects_controller/edit_project/' . $row->id . '/2', '<span>V</span>', 'class="view_button"');
            ?>
Beispiel #2
0
function textFilter($text, $size, $wrap, $urls, $bbcodes, $eofs, $admin, $shorten = 0)
{
    if (get_magic_quotes_gpc() == 0) {
        $text = addslashes($text);
    }
    if (($admin == 1 or isset($GLOBALS['isMod']) and $GLOBALS['isMod'] == 1) and isset($GLOBALS['adminHTML']) and $GLOBALS['adminHTML']) {
        $text = trim($text);
    } else {
        $text = htmlspecialchars(trim($text), ENT_QUOTES);
    }
    $text = str_replace(array('\\&#039;', '\\&quot;', chr(92) . chr(92) . chr(92) . chr(92), chr(92) . chr(92), '&amp;#', '$'), array('&#039;', '&quot;', '&#92;&#92;', '&#92;', '&#', '&#036;'), $text);
    $text = convert_entities($text);
    if (isset($GLOBALS['l_meta']) and substr_count(strtolower($GLOBALS['l_meta']), 'utf-8') == 0) {
        $text = str_replace(array('“', '”', '‘', '’', '…'), array('&quot;', '&quot;', '&#039;', '&#039;', '...'), $text);
    }
    if (substr_count($text, '&#9') > 0) {
        $text = preg_replace("@&#9[0-9]{2,};@", '', $text);
    }
    if (!$bbcodes) {
        $text = enCodeBB($text, $admin);
        $text = str_replace('><img src=', '> <img src=', $text);
    }
    if ($urls and !$bbcodes) {
        $text = urlMaker($text);
    }
    $text = wrapText($wrap, $text);
    $sce = FALSE;
    if (isset($GLOBALS['simpleCodes'])) {
        foreach ($GLOBALS['simpleCodes'] as $e) {
            if (substr_count($text, $e) > 0) {
                $sce = TRUE;
                break;
            }
        }
    }
    if (trim(strip_tags($text)) == '' and !$sce) {
        return '';
    }
    if ($size and strlen($text) > $size) {
        $text = special_substr($text, $size);
        if ($shorten > 0 and strlen($text) > $shorten) {
            $text = substr($text, 0, $shorten);
        }
        if (substr_count($text, '&') > 0) {
            /* Avoid special symbols extract */
            $tmpArr = explode('&', $text);
            $last = sizeof($tmpArr) - 1;
            if ($last > 0) {
                if (substr_count($tmpArr[$last], ';') == 0) {
                    array_pop($tmpArr);
                }
                $text = implode('&', $tmpArr);
            }
        }
    }
    if ($eofs and !isset($GLOBALS['disableLineBreaks'])) {
        while (substr_count($text, "\r\n\r\n\r\n\r\n") > 4) {
            $text = str_replace("\r\n\r\n\r\n\r\n", "\r\n", $text);
        }
        while (substr_count($text, "\n\n\n\n") > 4) {
            $text = str_replace("\n\n\n\n", "\n", $text);
        }
        $text = str_replace(array("\r\n", "\n"), '<br />', $text);
    }
    while (substr($text, -1) == chr(92)) {
        $text = substr($text, 0, strlen($text) - 1);
    }
    return $text;
}
 >
             <td><?php 
        echo $counter + 1;
        echo form_hidden('id', $row->id);
        ?>
</td>
             <td><?php 
        wrapText($row->name);
        ?>
</td>
             <td><?php 
        wrapText($row->username);
        ?>
</td>
             <td><?php 
        wrapText($row->email);
        ?>
</td>
             <td class="tools">
			 <!-- tool box -->
			 <span><?php 
        echo anchor('users_controller/linkUser/' . $this->native_session->userdata('project') . '/' . $row->id, '[+Add]', 'class="hours_button"');
        ?>
</span>
			 </td>
         </tr>
		 
		 <?php 
        $counter = $counter + 1;
        ?>
         <?php 
Beispiel #4
0
     $errorMSG = $l_signIn;
     $title .= $l_forbidden;
     $loginError = 2;
     $displayFormElements = array('userData' => 1, 'topicTitle' => 1, 'postText' => 1);
     $antiWarn = $l_fixData;
     include $pathToFiles . 'bb_func_posthold.php';
     return;
 } else {
     require_once $pathToFiles . 'bb_func_txt.php';
     $reqTxt = 1;
     if (get_magic_quotes_gpc() == 1) {
         $user_usr = stripslashes($user_usr);
     }
     $user_usr = str_replace(array('|', '&amp;#'), array('', '&#'), $user_usr);
     $user_usr = special_substr($user_usr, 35);
     $user_usr = wrapText(15, $user_usr);
     $fake = 0;
     if (isset($disallowNames) and is_array($disallowNames)) {
         foreach ($disallowNames as $dn) {
             if (strtolower($user_usr) == strtolower($dn)) {
                 $fake = 1;
                 include $pathToFiles . "lang/{$lang}.php";
                 $user_usr = $l_anonymous;
                 break;
             }
         }
     }
     if ($fake == 0) {
         if (isset($disallowNamesIndex) and is_array($disallowNamesIndex)) {
             foreach ($disallowNamesIndex as $dn) {
                 if (substr_count(strtolower($user_usr), strtolower($dn)) > 0) {
function textFilter($text, $size, $wrap, $urls, $bbcodes, $eofs, $admin)
{
    $text = trim(chop(htmlspecialchars($text, ENT_QUOTES)));
    $text = str_replace('\\&#039;', '&#039;', $text);
    $text = str_replace('\\&quot;', '&quot;', $text);
    $text = str_replace(chr(92) . chr(92) . chr(92) . chr(92), '&#92;&#92;', $text);
    $text = str_replace(chr(92) . chr(92), '&#92;', $text);
    $text = str_replace('&amp;#', '&#', $text);
    $text = str_replace('$', '&#036;', $text);
    if ($urls and !$bbcodes) {
        $text = urlMaker($text, $wrap);
    }
    if (!$bbcodes) {
        $text = enCodeBB($text, $admin);
        $text = str_replace('><img src=', '> <img src=', $text);
    }
    //echo $text;
    $text = wrapText($wrap, $text);
    //echo "<br><br>\n\n".$text;
    //exit;
    if ($size) {
        if (strlen($text) > $size) {
            $text = substr($text, 0, $size);
            //Avoid special symbols extract
            $tmpArr = explode('&', $text);
            $last = sizeof($tmpArr) - 1;
            if ($last > 0) {
                if (substr_count($tmpArr[$last], ';') == 0) {
                    array_pop($tmpArr);
                }
                $text = implode('&', $tmpArr);
            }
        }
    }
    if ($eofs) {
        while (substr_count($text, "\r\n\r\n\r\n\r\n") > 4) {
            $text = str_replace("\r\n\r\n\r\n\r\n", "\r\n", $text);
        }
        while (substr_count($text, "\n\n\n\n") > 4) {
            $text = str_replace("\n\n\n\n", "\n", $text);
        }
        $text = str_replace("\n", '<br>', $text);
        $text = str_replace("\r", '', $text);
    }
    while (substr($text, -1) == chr(92)) {
        $text = substr($text, 0, strlen($text) - 1);
    }
    return $text;
}
function sign(int $num) : int
{
    return $num <=> 0;
}
function wrapText(string $text, int $len) : string
{
    $realLen = strlen($text);
    switch ($len <=> $realLen) {
        case -1:
            return substr($text, 0, $len - 3) . '...';
        case 0:
            return $text;
        case 1:
            return $text . str_repeat(' ', $len - $realLen);
    }
}
$items = [[5, 5], [1, 0], [0, 1]];
print "\nspaceship demo operator\n";
foreach ($items as $item) {
    print sprintf("%d <=> %d result is %d\n", $item[0], $item[1], spaceship($item[0], $item[1]));
}
$items = ['This is a very little example', 'This is a short message', 'When I have time I can write more and more'];
print "\nwrap text with spaceship operator\n";
foreach ($items as $item) {
    print sprintf("[%s]\n", wrapText($item, 29));
}
print "\nuse of spaceship to figure out the math sign\n";
for ($i = 0; $i < 5; $i++) {
    $value = rand(-5, 5);
    print sprintf("The sign of %d is %d\n", $value, sign($value));
}
Beispiel #7
0
             if (isset($_FILES['file']) && $_FILES['file']['name'] != '') {
                 $imgfile = $_FILES['file']['tmp_name'];
                 $handle = fopen($imgfile, "r");
                 $imgbinary = fread(fopen($imgfile, "r"), filesize($imgfile));
                 $base64encoded = base64_encode($imgbinary);
                 if ($wrapcount != 0) {
                     $base64encoded = wrapText($base64encoded, $wrapcount);
                 }
                 if (preg_match("/image\\/(jpg|jpeg|png|gif|bmp)/", $_FILES['file']['type'], $hits)) {
                     $smarty->assign('presrcdata', 'data:image/' . $hits[1] . ';base64,');
                 }
                 $smarty->assign('base64encoded', $base64encoded);
             } elseif (isset($_POST['text'])) {
                 $base64encoded = base64_encode($_POST['text']);
                 if ($wrapcount != 0) {
                     $base64encoded = wrapText($base64encoded, $wrapcount);
                 }
                 $smarty->assign('base64encoded', $base64encoded);
             }
         }
         $smarty->assign('path', $template_dir . "/base64encode.tpl");
     }
     break;
 case 'roman':
     $breadcrumbs->addElement($lang->get('roman'), makeURL($mod, array('mode' => 'roman')));
     if (isset($_POST['send'])) {
         $decnumber = (int) $_POST['decnumber'];
         $romannumber = $_POST['romannumber'];
         if ($decnumber > 0) {
             $smarty->assign('romannumber', getRomanFromDec($decnumber));
             $smarty->assign('decnumber', $decnumber);