示例#1
0
 /**
  * @return mixed
  */
 public function index()
 {
     if (Input::has('folder')) {
         $username = request('user', auth()->id());
         $entity = $this->folders->getByName($username, request('folder'));
     } else {
         $groupName = request('group', 'all');
         $entity = $this->groups->requireByName($groupName);
     }
     $type = request('type', 'all');
     $canSortBy = ['comments', 'uv', 'created_at', 'frontpage_at'];
     $orderBy = in_array(request('sort'), $canSortBy) ? request('sort') : null;
     $builder = $entity->contents($type, $orderBy)->with('group', 'user');
     // Time filter
     $time = request('time');
     if ($time) {
         $builder->fromDaysAgo($time);
     }
     // Domain filter
     $domain = request('domain');
     if ($domain) {
         $builder->where('domain', $domain);
     }
     // User filter
     if (Input::has('user')) {
         $user = User::name(request('user'))->firstOrFail();
         $builder->where('user_id', $user->getKey());
     }
     $perPage = Input::has('per_page') ? between(request('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
function time_ago_in_words($time)
{
    $from_time = strtotime($time);
    $to_time = strtotime(gmd());
    $distance_in_minutes = round(($to_time - $from_time) / 60);
    if ($distance_in_minutes < 0) {
        return (string) $distance_in_minutes . 'E';
    }
    if (between($distance_in_minutes, 0, 1)) {
        return '1 minute';
    } elseif (between($distance_in_minutes, 2, 44)) {
        return $distance_in_minutes . ' minutes';
    } elseif (between($distance_in_minutes, 45, 89)) {
        return '1 hour';
    } elseif (between($distance_in_minutes, 90, 1439)) {
        return round($distance_in_minutes / 60) . ' hours';
    } elseif (between($distance_in_minutes, 1440, 2879)) {
        return '1 day';
    } elseif (between($distance_in_minutes, 2880, 43199)) {
        return round($distance_in_minutes / 1440) . ' days';
    } elseif (between($distance_in_minutes, 43200, 86399)) {
        return '1 month';
    } elseif (between($distance_in_minutes, 86400, 525959)) {
        return round($distance_in_minutes / 43200) . ' months';
    } elseif ($distance_in_minutes > 525959) {
        return number_format(round($distance_in_minutes / 525960, 1), 1) . ' years';
    }
}
示例#3
0
 public function index()
 {
     $folderName = Input::get('folder');
     $groupName = Input::has('group') ? shadow(Input::get('group')) : 'all';
     $className = 'Strimoid\\Models\\Folders\\' . studly_case($folderName ?: $groupName);
     if (Input::has('folder') && !class_exists('Folders\\' . studly_case($folderName))) {
         $user = Input::has('user') ? User::findOrFail(Input::get('user')) : Auth::user();
         $folder = Folder::findUserFolderOrFail($user->getKey(), Input::get('folder'));
         if (!$folder->public && (Auth::guest() || $user->getKey() != Auth::id())) {
             App::abort(404);
         }
         $builder = $folder->entries();
     } elseif (class_exists($className)) {
         $fakeGroup = new $className();
         $builder = $fakeGroup->entries();
         $builder->orderBy('sticky_global', 'desc');
     } else {
         $group = Group::name($groupName)->firstOrFail();
         $group->checkAccess();
         $builder = $group->entries();
         // Allow group moderators to stick contents
         $builder->orderBy('sticky_group', 'desc');
     }
     $builder->with(['user', 'group', 'replies', 'replies.user'])->orderBy('created_at', 'desc');
     $perPage = Input::has('per_page') ? between(Input::get('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
 public function singleDisplay($name, Request $request)
 {
     dd($request->getRequestUri());
     $product = between("/", "/", $request->getRequestUri());
     $data = Category::getSingleItem($name);
     // dd($data);
     return view('product_display.single', ['data' => $data, 'config' => ['route' => "/{$product}/{$name}", 'header' => $name]]);
 }
示例#5
0
function namesArtist($r)
{
    $pubd = array();
    foreach ($r['hits']['hits'] as $ev) {
        array_push($pubd, between('Artiste :', 'Matériaux :', $ev['_source']['pubDate']));
    }
    return $pubd;
}
示例#6
0
 /**
  * How far to separate the slice from the rest of the pie.
  * from 0.0 (not at all) to 1.0 (the pie's radius).
  *
  * @param float offset
  * @return \slice
  */
 public function offset($offset)
 {
     if (is_float($offset) && between($offset, 0.0, 1.0)) {
         $this->offset = $offset;
     } else {
         $this->type_error(__FUNCTION__, 'float', 'where 0.0 < $offset < 0.1');
     }
     return $this;
 }
示例#7
0
 private function index($data, $db, $sdb)
 {
     $data = str_get_html($data);
     foreach ($data->find('.even, .odd') as $result) {
         $title = $result->find('.cellMainLink', 0)->plaintext;
         $url = 'https://kat.cr' . $result->find('.cellMainLink', 0)->href;
         $m = $result->find('div.iaconbox', 0);
         $hash = strtoupper(between($m, 'magnet:?xt=urn:btih:', '&dn='));
         $size = round(strToBytes($result->find('td.nobr', 0)->plaintext) / 1024);
         $seeds = $result->find('td.green', 0)->plaintext;
         $peers = $result->find('td.red', 0)->plaintext;
         $date = strtotime($result->find('td', 3)->title);
         $uploader = $result->find('a.plain', 1)->plaintext;
         $files = $result->find('td', 2)->plaintext;
         if (!$result->find('span.block')) {
             continue;
         }
         $cdata = $result->find('span.block', 0)->find('strong', 0)->plaintext;
         if (strstr($cdata, 'Movies')) {
             $type = 'movies';
         } elseif (strstr($cdata, 'Games')) {
             $type = 'games';
         } elseif (strstr($cdata, 'Music')) {
             $type = 'music';
         } elseif (strstr($cdata, 'Applications')) {
             $type = 'software';
         } elseif (strstr($cdata, 'TV')) {
             $type = 'tv';
         } elseif (strstr($cdata, 'XXX')) {
             $type = 'p**n';
         } elseif (strstr($cdata, 'Anime')) {
             $type = 'anime';
         } elseif (strstr($cdata, 'Books')) {
             $type = 'books';
         } else {
             $type = 'other';
         }
         $type = Rivr::getType($type);
         $cdate = time();
         $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;");
         if ($query->num_rows) {
             $this->updated++;
             $info = $query->fetch_assoc();
             Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         } else {
             $this->added++;
             Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         }
     }
     $data->clear();
     unset($data);
 }
示例#8
0
function organizer_check_collision($frame, $date, $events)
{
    $collidingevents = array();
    foreach ($events as $event) {
        $framefrom = $frame['from'] + $date;
        $frameto = $frame['to'] + $date;
        $eventfrom = $event->timestart;
        $eventto = $eventfrom + $event->timeduration;
        if (between($framefrom, $eventfrom, $eventto) || between($frameto, $eventfrom, $eventto) || between($eventfrom, $framefrom, $frameto) || between($eventto, $framefrom, $frameto) || $framefrom == $eventfrom || $eventfrom == $eventto) {
            $collidingevents[] = $event;
        }
    }
    return $collidingevents;
}
/**
 * Present a list of choices to user, return choice
 * @param Command $command The command requesting input
 * @param array $choices List of choices
 * @param int $default Default choice (1-array size), -1 to abort
 * @param string $abort String to tag on end for aborting selection
 * @return int -1 if abort selected, otherwise one greater than $choice index
 *        (in other words, choosing $choice[0] returns 1)
 * @throws InvalidArgumentException If argument is invalid
 */
function pick_from_list(Command $command, $title, array $choices, $default = 0, $abort = null)
{
    if ($abort) {
        $choices[] = $abort;
    }
    $numChoices = count($choices);
    if (!$numChoices) {
        throw new \InvalidArgumentException("Must have at least one choice");
    }
    if ($default == -1 && empty($abort)) {
        throw new \InvalidArgumentException('Cannot use default=-1 without $abort option');
    }
    if (!between($default, -1, $numChoices)) {
        throw new \InvalidArgumentException("Invalid value, default={$default}");
    }
    $question = "Please enter a number between 1-{$numChoices}";
    if ($default > 0) {
        $question .= " (default is {$default})";
    } elseif ($default < 0) {
        $question .= " (enter to abort)";
        $default = $numChoices;
    }
    $question .= ':';
    while (1) {
        $command->line('');
        $command->info($title);
        $command->line('');
        for ($i = 0; $i < $numChoices; $i++) {
            $command->line($i + 1 . ". " . $choices[$i]);
        }
        $command->line('');
        $answer = $command->ask($question);
        if ($answer == '') {
            $answer = $default;
        }
        if (between($answer, 1, $numChoices)) {
            if ($abort and $answer == $numChoices) {
                $answer = -1;
            }
            return (int) $answer;
        }
        // Output wrong choice
        $command->line('');
        $formatter = $command->getHelperSet()->get('formatter');
        $block = $formatter->formatBlock('Invalid entry!', 'error', true);
        $command->line($block);
    }
}
示例#10
0
 public function index()
 {
     if (Input::has('folder')) {
         $username = request('user', auth()->id());
         $entity = $this->folders->getByName($username, request('folder'));
     } else {
         $groupName = request('group', 'all');
         $entity = $this->groups->getByName($groupName);
     }
     $sortBy = in_array(request('sort'), ['uv', 'created_at']) ? request('sort') : 'created_at';
     $builder = $entity->comments($sortBy)->with(['user', 'group', 'replies', 'replies.user']);
     // Time filter
     if (Input::has('time')) {
         $builder->fromDaysAgo(request('time'));
     }
     $perPage = Input::has('per_page') ? between(request('per_page'), 1, 100) : 20;
     return $builder->paginate($perPage);
 }
示例#11
0
 protected function fetchPPTs($dataTag2, $delimiter1, $delimiter2)
 {
     $ppts = [];
     $i = 0;
     foreach ($this->rawHtml->find($dataTag2) as $element) {
         $long_name = $this->textCaptions[$i];
         $dimensions = between($delimiter1, $delimiter2, $long_name);
         $this->_name[$i] = trim(between($delimiter1, $delimiter2, $long_name));
         $this->type[$i] = strtoupper($this->_name[$i]);
         $this->length[$i] = $this->replaceString(trim(str_take(5, $dimensions)));
         $this->width[$i] = $this->replaceString(trim(str_rtake(6, $dimensions)));
         $this->thickness[$i] = NULL;
         $this->_description[$i] = $this->_name[$i] . ' (' . $this->length[$i] . 'X' . $this->width[$i] . ')';
         dd($this->_name[$i], $this->length[$i], $this->width[$i], $this->thickness[$i]);
         $this->remoteImgUrl[$i] = $element->{"data-orig-file"};
         $ext = after_last(".", $this->remoteImgUrl[$i]);
         $this->photoName[$i] = sprintf("%s-%s", time(), create_slug(str_replace(":", "-", $this->_name[$i])) . ".{$ext}");
         $this->photoPath[$i] = sprintf("%s/%s", self::imgBasePath, $this->photoName[$i]);
         $this->photoTPath[$i] = sprintf("%s/tn-%s", self::imgBasePath, $this->photoName[$i]);
         $i++;
     }
 }
function fddbSuche($gtin)
{
    //$gtin = "4388844009943";
    $gtin = preg_replace('/[^0-9]+/', '', $gtin);
    $data = curlData("http://fddb.mobi/search/?lang=de&cat=mobile-de&search=" . $gtin);
    $resultblock = between("<!-- %sresultblock% //-->", "<!-- %eresultblock% //-->", $data);
    $link = between("window.location.href = '", "';", $data);
    $area = between("<b>100 g:</b>", "<b>1 Packung:</b>", $data);
    if ($link != false && strlen($gtin) >= 13) {
        $werte = array("energy" => preg_replace('/[^0-9,.]+/', '', before("(", $area)), "calories" => preg_replace('/[^0-9,.]+/', '', between("(", ")", $area)), "fat" => preg_replace('/[^0-9,.]+/', '', between("Fett: ", "KH:", $area)), "carbonhydrate" => preg_replace('/[^0-9,.]+/', '', between("KH: ", "<br>", $area)));
        //$werte = array("Energie", "Energie1", "Fett", "Kohlenhydrate");
        $naerhwerte = "";
        foreach ($werte as $key => $value) {
            $naerhwerte[$key]["value"] = preg_replace('/[^0-9]+/', '', $werte[$key]);
            $naerhwerte[$key]["currencie"] = preg_replace('/[^a-zA-Z]+/', '', $werte[$key]);
        }
        $result = array("sourecName" => "fddb", "link" => $link, "gtin" => $gtin, "nutriTable" => $werte, "titel" => between("<a href='" . $link . "'><b>", '</b></a>', $resultblock));
        $graph = new EasyRdf_Graph();
        $namespace = new EasyRdf_Namespace();
        $namespace->set('rezept', "http://manke-hosting.de/ns-syntax#");
        buildTree($graph, $result["link"], $result, 'rezept');
        echo $graph->serialise("turtle");
    }
}
示例#13
0
 public function testBetweenExceptionel2()
 {
     $this->assertEquals("", between("DESCRIPTION:", "ipsum", ""));
 }
示例#14
0
/**
 * @param int $min
 * @param int $max
 * @return \Closure
 */
function notBetween($min, $max)
{
    return negate(between($min, $max));
}
示例#15
0
文件: between.php 项目: manelio/woolr
$options = array('u1' => $u1, 'u2' => $u2, 'type' => $type, 'types' => array('posts', 'comments'));
echo '<div id="newswrap"><!-- between.php -->';
Haanga::Load('between.html', compact('options'));
if ($id1 > 0 && $id2 > 0) {
    $all = array();
    $to = array();
    $sorted = array();
    $rows = 0;
    if (isset($_GET['id']) && !empty($_GET['id'])) {
        $sorted = explode(',', @gzuncompress(@base64_decode($_GET['id'])));
        $show_thread = true;
    } else {
        $show_thread = false;
        $rows = -1;
        $to[0] = between($id1, $id2, $type, $prefix, $page_size, $offset);
        $to[1] = between($id2, $id1, $type, $prefix, $page_size, $offset);
        foreach ($to as $e) {
            foreach ($e as $k => $v) {
                $all[$k] = $v;
            }
        }
        $keys = array_keys($all);
        sort($keys, SORT_NUMERIC);
        foreach ($keys as $k) {
            $a = $all[$k];
            sort($a, SORT_NUMERIC);
            foreach ($a as $e) {
                if (!in_array($e, $sorted) && !in_array($e, $keys)) {
                    $sorted[] = $e;
                }
            }
 private function index($data, $type, $db, $sdb)
 {
     $data = str_get_html($data);
     if (!$data->find('.table2')) {
         return;
     }
     $data = $data->find('.table2', 0);
     if (!$data->find('tr')) {
         continue;
     }
     foreach ($data->find('tr') as $result) {
         $tt = $result->find('.tt-name');
         if (!$tt) {
             continue;
         }
         $title = $result->find('.tt-name', 0)->find('a', 1)->plaintext;
         $url = 'https://www.limetorrents.cc' . $result->find('.tt-name', 0)->find('a', 1)->href;
         $m = $result->find('.tt-name', 0)->find('a', 0)->href;
         $hash = strtoupper(between($m, 'torrent/', '.torrent'));
         $size = round(strToBytes($result->find('td', 2)->plaintext) / 1024);
         $seeds = $result->find('.tdseed', 0)->plaintext;
         $peers = $result->find('.tdleech', 0)->plaintext;
         $date = strtotime('-' . str_replace(' ago', '', $result->find('td', 1)->plaintext));
         $uploader = '';
         $files = 0;
         $cdate = time();
         $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;");
         if ($query->num_rows) {
             $this->updated++;
             $info = $query->fetch_assoc();
             Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         } else {
             $this->added++;
             Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         }
     }
     $data->clear();
     unset($data);
 }
示例#17
0
    $f = flip('map', [$x, $y]);
    $c = compose($f, 'plus');
    return $c($z) !== [$x + $z, $y + $z];
}, 'compose8' => function ($x, $y) {
    $c = compose(with($x), 'plus');
    return $c($y) !== $x + $y;
}, 'sum' => function () {
    return sum($xs = range(0, mt_rand(1, 100))) !== array_reduce($xs, 'plus', 0);
}, 'random1' => function () {
    return !is_int(random(null));
}, 'mem1' => function () {
    return mem('true') <= 0;
}, 'upto1' => function ($n) {
    return count(upto($n % 100)) !== $n % 100;
}, 'between1' => function () {
    return between(5, 10) !== [5, 6, 7, 8, 9, 10];
}, 'b_then' => function ($n) {
    return branch(thunk($n), null, thunk(true), null) !== $n;
}, 'b_else' => function ($n) {
    return branch(null, thunk($n), thunk(false), null) !== $n;
}, 'until1' => function ($n) {
    $x = $n % 8;
    return until(function ($args) use($x) {
        list($m, $arr) = $args;
        return [$m === $x, [$m + 1, snoc($m, $arr)]];
    }, [0, []]) !== [$x + 1, upto($x + 1)];
}, 'trampoline1' => function ($n) {
    $x = $n % 8;
    return trampoline(y(function ($f, $m, $n, $_) {
        return $m < $n ? [false, $f($m + 1, $n)] : [true, $m];
    }, 0, $x)) !== $x;
示例#18
0
 /** Fonction qui remplis un tableau de cours.
  *  Utilise icalendar.
  */
 public function getCours()
 {
     /* Parse l'ics*/
     $nb = 0;
     $tab = array();
     $ical = new SG_iCalReader($this->ICS);
     $query = new SG_iCal_Query();
     $evts = $ical->getEvents();
     $data = array();
     if (!is_array($evts)) {
         echo "ERREUR, d'initialisation des evenements.";
         echo '<br>$evts= ' . $evts;
     }
     foreach ($evts as $id => $ev) {
         $jsEvt = array("id" => $id + 1, "title" => $ev->getProperty('summary'), "start" => $ev->getStart(), "end" => $ev->getEnd(), "allDay" => $ev->isWholeDay(), "location" => $ev->getProperty('location'), "description" => $ev->getProperty('description'));
         if (isset($ev->recurrence)) {
             $count = 0;
             $start = $ev->getStart();
             $freq = $ev->getFrequency();
             if ($freq->firstOccurrence() == $start) {
                 $data[] = $jsEvt;
             }
             while (($next = $freq->nextOccurrence($start)) > 0) {
                 if (!$next or $count >= 1000) {
                     break;
                 }
                 $count++;
                 $start = $next;
                 $jsEvt["start"] = $start;
                 $jsEvt["end"] = $start + $ev->getDuration();
                 $data[] = $jsEvt;
             }
         } else {
             $data[] = $jsEvt;
         }
         $String2 = htmlentities($jsEvt["description"], ENT_QUOTES, "UTF-8");
         $String = nl2br($String2);
         $sum = htmlentities($jsEvt["title"], ENT_QUOTES, "UTF-8");
         $sum2 = nl2br($sum);
         $Matiere = between('Mati&egrave;re : ', '<br />', $String);
         $prof = between('Personnel : ', '<br />', $String);
         $promo = between('Groupe : ', 'Groupe ', $String);
         $tmp = between('Groupe :', 'Salle ', $String);
         $sous_groupe = rtrim(trim(stripslashes(after('-', $tmp))));
         if ($sous_groupe == "") {
             $sous_groupe = "0";
         }
         $tabGroupe = array();
         $promo = trim($promo);
         $tmp_groupe = between('Groupe :', 'Salle', $String2);
         //--> 'INFO 2 Groupe 2\, INFO 2 Groupe 3'
         // echo $tmp.'<br/>';
         $tmp_tab = explode(",", $tmp_groupe);
         foreach ($tmp_tab as $g) {
             if (strpos($g, 'TP') !== FALSE) {
                 $tmp = between("TP ", "-", $String2);
             } else {
                 $tmp = after($promo . ' Groupe ', $g);
                 $tmp = trim(stripslashes($tmp));
                 // Enlève antislash et les espaces
                 if ($tmp == "") {
                     $tmp = "0";
                 }
             }
             array_push($tabGroupe, $tmp);
         }
         $type = before(' -', $sum2);
         $salle = between('Salle : ', '<br />', $String);
         $date_debut = $jsEvt['start'];
         $date_fin = $jsEvt['end'];
         $date = new DateTime('@' . $date_debut);
         /* Instancie les BEANs*/
         $cours = new Cours();
         $cours->setDateDebut($date_debut);
         $cours->setMatiere($Matiere);
         $cours->setDateFin($date_fin);
         $cours->setType($type);
         $cours->setProf($prof);
         $cours->setSalle($salle);
         foreach ($tabGroupe as $g) {
             $Groupe = new Groupe();
             $Groupe->setSousGroupe($sous_groupe[0]);
             $Groupe->setNumero($g);
             $Groupe->setPromo($promo);
             $cours->setGroupe($Groupe);
         }
         $cours->setId();
         $tab[$nb++] = $cours;
         sort($tab);
         // Noé
         array_push($this->tab_cours, $cours);
     }
 }
示例#19
0
 private function AddColumnByDataType($coldata)
 {
     $name = $coldata["Field"];
     $typedata = $coldata["Type"];
     $null = $coldata["Null"];
     $key = $coldata["Key"];
     $default = $coldata["Default"];
     $extra = $coldata["Extra"];
     $type = before('(', $typedata);
     $data = between('(', ')', $typedata);
     $info = after(')', $typedata);
     $migrationCall = '$table->';
     switch (strtoupper($type)) {
         //      $table->bigIncrements('id');	Incrementing ID (primary key) using a "UNSIGNED BIG INTEGER" equivalent.
         //      $table->bigInteger('votes');	BIGINT equivalent for the database.
         case 'BIGINT':
             if (strpos(strtoupper($extra), "AUTO_INCREMENT") > -1) {
                 $migrationCall .= 'bigIncrements(\'' . $name . '\')';
             } else {
                 $migrationCall .= 'bigInteger(\'' . $name . '\')';
             }
             break;
             //      $table->binary('data');	BLOB equivalent for the database.
         //      $table->binary('data');	BLOB equivalent for the database.
         case 'BINARY':
             $migrationCall .= 'binary(\'' . $name . '\')';
             break;
         case 'BIT':
             $migrationCall .= 'boolean(\'' . $name . '\')';
             if ($default != "") {
                 $default = strpos($default, '0') > -1 ? "0" : "1";
             }
             break;
             //      $table->boolean('confirmed');	BOOLEAN equivalent for the database.
         //      $table->boolean('confirmed');	BOOLEAN equivalent for the database.
         case 'BOOLEAN':
             $migrationCall .= 'boolean(\'' . $name . '\')';
             break;
             //      $table->char('name', 4);	CHAR equivalent with a length.
         //      $table->char('name', 4);	CHAR equivalent with a length.
         case 'CHAR':
             $migrationCall .= 'char(\'' . $name . '\', ' . $data . ')';
             break;
             //      $table->date('created_at');	DATE equivalent for the database.
         //      $table->date('created_at');	DATE equivalent for the database.
         case 'DATE':
             $migrationCall .= 'date(\'' . $name . '\')';
             break;
             //      $table->dateTime('created_at');	DATETIME equivalent for the database.
         //      $table->dateTime('created_at');	DATETIME equivalent for the database.
         case 'DATETIME':
             $migrationCall .= 'dateTime(\'' . $name . '\')';
             break;
             //      $table->decimal('amount', 5, 2);	DECIMAL equivalent with a precision and scale.
         //      $table->decimal('amount', 5, 2);	DECIMAL equivalent with a precision and scale.
         case 'DECIMAL':
             $migrationCall .= 'decimal(\'' . $name . '\', ' . $data . ')';
             break;
             //      $table->double('column', 15, 8);	DOUBLE equivalent with precision, 15 digits in total and 8 after the decimal point.
         //      $table->double('column', 15, 8);	DOUBLE equivalent with precision, 15 digits in total and 8 after the decimal point.
         case 'DOUBLE':
             $migrationCall .= 'double(\'' . $name . '\', ' . $data . ')';
             break;
             //      $table->enum('choices', ['foo', 'bar']);	ENUM equivalent for the database.
         //      $table->enum('choices', ['foo', 'bar']);	ENUM equivalent for the database.
         case 'ENUM':
             $migrationCall .= 'enum(\'' . $name . '\', [' . $data . '])';
             break;
             //      $table->float('amount');	FLOAT equivalent for the database.
         //      $table->float('amount');	FLOAT equivalent for the database.
         case 'FLOAT':
             $migrationCall .= 'float(\'' . $name . '\')';
             break;
             //      $table->increments('id');	Incrementing ID (primary key) using a "UNSIGNED INTEGER" equivalent.
             //      $table->integer('votes');	INTEGER equivalent for the database.
         //      $table->increments('id');	Incrementing ID (primary key) using a "UNSIGNED INTEGER" equivalent.
         //      $table->integer('votes');	INTEGER equivalent for the database.
         case 'INT':
             if (strpos(strtoupper($extra), "AUTO_INCREMENT") > -1) {
                 $migrationCall .= 'increments(\'' . $name . '\')';
             } else {
                 $migrationCall .= 'integer(\'' . $name . '\')';
             }
             break;
             //      $table->json('options');	JSON equivalent for the database.
         //      $table->json('options');	JSON equivalent for the database.
         case 'JSON':
             $migrationCall .= 'json(\'' . $name . '\')';
             break;
             //      $table->jsonb('options');	JSONB equivalent for the database.
         //      $table->jsonb('options');	JSONB equivalent for the database.
         case 'JSONB':
             $migrationCall .= 'jsonb(\'' . $name . '\')';
             break;
             //      $table->longText('description');	LONGTEXT equivalent for the database.
         //      $table->longText('description');	LONGTEXT equivalent for the database.
         case 'LONGTEXT':
             $migrationCall .= 'longText(\'' . $name . '\')';
             break;
             //      $table->mediumInteger('numbers');	MEDIUMINT equivalent for the database.
         //      $table->mediumInteger('numbers');	MEDIUMINT equivalent for the database.
         case 'MEDIUMINT':
             $migrationCall .= 'mediumInteger(\'' . $name . '\')';
             break;
             //      $table->mediumText('description');	MEDIUMTEXT equivalent for the database.
         //      $table->mediumText('description');	MEDIUMTEXT equivalent for the database.
         case 'MEDIUMTEXT':
             $migrationCall .= 'mediumText(\'' . $name . '\')';
             break;
             //      $table->morphs('taggable');	Adds INTEGER taggable_id and STRING taggable_type.
         //      $table->morphs('taggable');	Adds INTEGER taggable_id and STRING taggable_type.
         case 'MORPHS':
             $migrationCall .= 'morphs(\'' . $name . '\')';
             break;
             //      $table->nullableTimestamps();	Same as timestamps(), except allows NULLs.
         //      $table->nullableTimestamps();	Same as timestamps(), except allows NULLs.
         case 'NULL_TIMESTAMPS':
             $migrationCall .= 'nullableTimestamps()';
             break;
             //      $table->rememberToken();	Adds remember_token as VARCHAR(100) NULL.
         //      $table->rememberToken();	Adds remember_token as VARCHAR(100) NULL.
         case 'REMEMBER':
             $migrationCall .= 'rememberToken()';
             break;
             //      $table->smallInteger('votes');	SMALLINT equivalent for the database.
         //      $table->smallInteger('votes');	SMALLINT equivalent for the database.
         case 'SMALLINT':
             $migrationCall .= 'smallInteger(\'' . $name . '\')';
             break;
             //      $table->softDeletes();	Adds deleted_at column for soft deletes.
         //      $table->softDeletes();	Adds deleted_at column for soft deletes.
         case 'SOFTDELETES':
             $migrationCall .= 'softDeletes()';
             break;
             //      $table->string('email');	VARCHAR equivalent column.
             //      $table->string('name', 100);	VARCHAR equivalent with a length.
         //      $table->string('email');	VARCHAR equivalent column.
         //      $table->string('name', 100);	VARCHAR equivalent with a length.
         case 'VARCHAR':
             if ($data != "") {
                 $migrationCall .= 'string(\'' . $name . '\', ' . $data . ')';
             } else {
                 $migrationCall .= 'string(\'' . $name . '\')';
             }
             break;
             //      $table->text('description');	TEXT equivalent for the database.
         //      $table->text('description');	TEXT equivalent for the database.
         case 'TEXT':
             $migrationCall .= 'text(\'' . $name . '\')';
             break;
             //      $table->time('sunrise');	TIME equivalent for the database.
         //      $table->time('sunrise');	TIME equivalent for the database.
         case 'TIME':
             $migrationCall .= 'time(\'' . $name . '\')';
             break;
             //      $table->tinyInteger('numbers');	TINYINT equivalent for the database.
         //      $table->tinyInteger('numbers');	TINYINT equivalent for the database.
         case 'TINYINT':
             if ($data == 1) {
                 $migrationCall .= 'boolean(\'' . $name . '\')';
             } else {
                 $migrationCall .= 'tinyInteger(\'' . $name . '\')';
             }
             break;
             //      $table->timestamp('added_on');	TIMESTAMP equivalent for the database.
         //      $table->timestamp('added_on');	TIMESTAMP equivalent for the database.
         case 'TIMESTAMP':
             $migrationCall .= 'timestamp(\'' . $name . '\')';
             break;
             //      $table->timestamps();	Adds created_at and updated_at columns.
         //      $table->timestamps();	Adds created_at and updated_at columns.
         case 'TIMESTAMPS':
             $migrationCall .= 'timestamps()';
             break;
             //      $table->uuid('id');
         //      $table->uuid('id');
         case 'YEAR':
             $migrationCall .= 'tinyInteger(\'' . $name . '\')';
             break;
         case 'UUID':
             $migrationCall .= 'uuid(\'' . $name . '\')';
             break;
         default:
             return false;
     }
     if (strpos(strtoupper($info), " UNSIGNED") > -1) {
         $migrationCall .= "->unsigned()";
     }
     if (strtoupper($null) == "YES") {
         $migrationCall .= "->nullable()";
     }
     if ($default != "") {
         if ($default == "CURRENT_TIMESTAMP") {
             $migrationCall .= "->useCurrent()";
             //Needs on update use current_timestamp feature if in extra
         } else {
             $migrationCall .= "->default('" . addslashes($default) . "')";
         }
     }
     return $migrationCall;
 }
示例#20
0
 public function profile()
 {
     $this->load->library('form_validation');
     $text = '';
     $this->form_validation->set_rules('avatar_usage', '', 'trim|required');
     if ($this->form_validation->run()) {
         $status = $this->users_global->setAvatarSetting($this->input->post('facebook_profile'), $this->input->post('google_profile'), $this->input->post('twitter_profile'), $this->input->post('avatar_usage'), 'avatar_file');
         if ($status['error'] > 0) {
             $text = '&info=' . translate('Fields succefully updated, error occured during file upload, please check file weight and try again.');
         }
     }
     $this->load->library('form_validation');
     if ($this->input->post('user_name') || $this->input->post('user_surname') || $this->input->post('user_state') || $this->input->post('user_town') || $this->input->post('bio')) {
         set_user_meta('name', $this->input->post('user_name'));
         set_user_meta('surname', $this->input->post('user_surname'));
         set_user_meta('state', $this->input->post('user_state'));
         set_user_meta('town', $this->input->post('user_town'));
         set_user_meta('bio', $this->input->post('bio'));
         $this->url->redirect($this->url->site_url() . '?notice=profile-updated' . $text);
     }
     if ($this->input->post('dashboard_theme') || $this->input->post('user_oldpass') || $this->input->post('user_newpass') || $this->input->post('user_confirmnewpass')) {
         if ($this->input->post('user_oldpass')) {
             $info = '';
             if ($this->input->post('user_newpass') == $this->input->post('user_confirmnewpass')) {
                 $result = current_user()->updainitsword($this->input->post('user_oldpass'), $this->input->post('user_newpass'));
                 if ($result) {
                     $info = '&info=' . __('Password has been changed');
                 } else {
                     $info = '&info=' . __('Error occured while changing password. Check if your old password doesn\'t match the new one');
                 }
             } else {
                 $info = '&info=' . __('Error occured while changing password. The new password and the confirmation doesn\'t match.');
             }
         }
         set_user_meta('dashboard_theme', between(0, 6, $dashboard_theme = $this->input->post('dashboard_theme')) ? $dashboard_theme : 0);
         $this->url->redirect($this->url->site_url() . '?notice=profile-updated' . $info);
     }
     // Admin Widget Section
     if (riake('widget_action', $_POST) || riake('widget_namespace', $_POST)) {
         $this->users_global->setAdminWidgets($_POST);
         $this->url->redirect(array('admin', 'profile?notice=done'));
     }
     if ($this->input->post('reset_account')) {
         current_user()->reset();
         $this->url->redirect(array('admin', 'profile?notice=user-meta-has-been-reset'));
     }
     set_page('title', riake('site_name', $this->options) . ' | ' . ucfirst(current_user('PSEUDO')) . ' &raquo; ' . translate('My Profile'));
     set_page('description', translate('My Profile'));
     $this->load->the_view('admin/profile/body');
 }
示例#21
0
echo '<li> images : ' . $value['_source']['images'] . '</li></br>';
$imgs = $value['_source']['images'];
$img = explode(" ", $imgs);
foreach ($img as $i) {
    echo '<img src=' . $i . '></br>';
}
echo '</br>';
echo '<li> pubDate :' . $value['_source']['pubDate'] . '</li></br>';
// '<h1>'.substr($value['_source']['pubDate'],strpos($value['_source']['pubDate'],'Artiste :')+strlen('Artiste :'),strlen($value['_source']['pubDate'])-strlen('Artiste :')-strlen(substr($value['_source']['pubDate'],strpos('Matériaux :')))).'</h1></br>';
echo '<h1>' . between('Artiste :', 'Matériaux :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . between('Matériaux :', 'Support :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . between('Support :', 'Format :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . between('Format :', 'Style :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . between('Style :', 'Prix :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . between('Prix :', 'Conversion :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . between('Conversion :', 'Référence :', $value['_source']['pubDate']) . '</h1></br>';
echo '<h1>' . after('Référence :', $value['_source']['pubDate']) . '</h1></br>';
echo '<li> body :' . $value['_source']['body'] . '</li></br>';
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($value['_source']['body']);
libxml_clear_errors();
//echo $doc->saveHTML();
$xpath = new DOMXpath($doc);
//$elements = $xpath->query("/div[@class='tableau-description-node']");
//if (!is_null($elements)) {   title
foreach ($xpath->query('//h1[@class="title"]') as $div) {
    //????
    echo '<p>11111111111111111111111111111111111111111</p>';
    echo '<p>' . $div->textContent . '</p>';
    echo "<br/>";
示例#22
0
/*
7/28/10 Added inclusion of startup.inc.php for checking of network status and setting of file name variables to support no-maps versions of scripts.
*/
error_reporting(E_ALL);
@session_start();
require_once $_SESSION['fip'];
//7/28/10
function between($in_str, $start_str, $end_str, $begin = 0)
{
    // returns string between two given values
    $temp1 = stripos($in_str, $start_str, $begin);
    // position of start_str
    $temp2 = stripos($in_str, $end_str, $temp1);
    // position of end_str
    return !$temp1 || !$temp2 ? FALSE : substr($in_str, $temp1 + strlen($start_str), $temp2 - $temp1 - strlen($start_str));
}
$note_lhe = "<note>";
$note_rhe = "</note>";
$headline_lhe = "<headline>";
$headline_rhe = "</headline>";
$description_lhe = "<description>";
$description_rhe = "</description>";
$wx_data = file_get_contents('wxalert.xml');
$note = between($wx_data, $note_lhe, $note_rhe);
dump($note);
$headline = between($wx_data, $headline_lhe, $headline_rhe);
$description = between($wx_data, $description_lhe, $description_rhe);
dump($description);
?>
 
示例#23
0
include "../include/dictionary2.php";
$_lon1 = getQUERY("lon1");
$_lat1 = getQUERY("lat1");
$_lon2 = getQUERY("lon2");
$_lat2 = getQUERY("lat2");
opendb();
$cntItem = dlookup("select count(*) from line_history_fast where lon1='" . $_lon1 . "' and lat1='" . $_lat1 . "' and lon2='" . $_lon2 . "' and lat2='" . $_lat2 . "'");
if ($cntItem > 0) {
    $dsLine = query("select id, linestr from line_history_fast where lon1='" . $_lon1 . "' and lat1='" . $_lat1 . "' and lon2='" . $_lon2 . "' and lat2='" . $_lat2 . "'");
    print pg_fetch_result($dsLine, 0, "linestr") . '^$' . pg_fetch_result($dsLine, 0, "id");
} else {
    //$line = getLineCoordsF($_lon1, $_lat1, $_lon2, $_lat2);
    $url = 'http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluubn1682g%2C25%3Do5-90as5f&callback=renderAdvancedNarrative&outFormat=json&routeType=fastest&timeType=1&enhancedNarrative=false&maxLinkId=10000&shapeFormat=raw&generalize=0&locale=en_GB&unit=k&drivingStyle=2&highwayEfficiency=21.0&from=' . $_lat1 . ',' . $_lon1 . '&to=' . $_lat2 . ',' . $_lon2;
    $items = '';
    $obj = file_get_contents($url);
    $json = between('(', ')', $obj);
    $jsonData = rtrim($json, "");
    $results = json_decode($jsonData);
    $dist = $results->route->distance;
    $time = $results->route->time;
    $lonlat = $results->route->shape->shapePoints;
    for ($i = 0; $i < sizeof($lonlat); $i++) {
        $items .= "%@";
        $items .= $lonlat[$i + 1] . "#" . $lonlat[$i];
        $i++;
    }
    $fin = $items . "^\$" . $dist . "^\$" . $time;
    $_id = dlookup("insert into line_history_fast (lon1, lat1, lon2, lat2, linestr) values ('" . $_lon1 . "','" . $_lat1 . "','" . $_lon2 . "','" . $_lat2 . "','" . $fin . "') RETURNING id;");
    print $fin . '^$' . $_id;
}
function after($this, $inthat)
示例#24
0
include "../infos/config.inc.php";
// on inclu le fichier de config
$status = 0;
$ping = 0;
//	on test si google est joignable
if (!($sock = @fsockopen('www.google.fr', 80, $num, $error, 5))) {
    // si non on met $status à 0
    echo 'HORS LIGNE</br>';
    $status = 0;
} else {
    // si non on met $status à 1
    echo 'OK</br>';
    $status = 1;
    // on fait une mesure du ping
    $ping_res = shell_exec('ping -c 4 www.google.com');
    $ping = between('time=', ' ms', $ping_res);
    echo 'ping= ' . $ping . ' ms';
}
// requete MySQL pour stocker les résultats les données de la BDD
// echo" </br>$host, $login, $passe, $bdd ";
@mysql_connect($host, $login, $passe) or die("Impossible de se connecter à la base de données");
@mysql_select_db("{$bdd}") or die("Impossible de se connecter à la base de données");
//requete pour récupérer la dernière consommation instantanée
//Envoie de la requete
$SQL = "INSERT INTO  `domotique`.`internet_connex` (`id`, `date_time`, `status`, `ping`) VALUES ( NULL , NOW(), '{$status}',  '{$ping}') ";
//Execution de la requete
mysql_query($SQL) or die('Erreur SQL !' . $SQL . '<br>' . mysql_error());
//on quitte la BDD
mysql_close();
function after($this, $inthat)
{
示例#25
0
    $answer2 = str_replace('!@#', '(euros)', $answer2);
    $answer3 = between($html, 'context.jsonArray.popups.pod_0300.push( {"stringified": "', '",');
    $answer3 = str_replace("\\'", "'", $answer3);
    $answer3 = str_replace('\\/', '/', $answer3);
    $answer4 = between($html, 'context.jsonArray.popups.pod_0700.push( {"stringified": "', '",');
    $answer4 = str_replace("\\'", "'", $answer4);
    $answer4 = str_replace('\\/', '/', $answer4);
    if (empty($answer2) && empty($answer3) && empty($answer4)) {
        die;
    }
    if (empty($answer1)) {
        die;
    } else {
        echo '<b>Answer:</b> ';
        echo str_replace('\\n', '<br/>', $answer1);
    }
    if (!empty($answer2)) {
        echo '<div id="pod1">' . str_replace('\\n', '<br/>', $answer2) . '</div>';
    }
    if (!empty($answer3)) {
        echo '<div id="pod2">' . str_replace('\\n', '<br/>', $answer3) . '</div>';
    }
    if (!empty($answer4)) {
        echo '<br/><div id="pod3">' . str_replace('\\n', '<br/>', $answer4) . '</div>';
    }
    echo '<br/>';
    $answer5 = between($html, 'context.jsonArray.popups.pod_0800.push( {"stringified": "', '",');
    if (!empty($answer5)) {
        echo '<div id="pod4">' . str_replace('\\n', '<br/>', $answer5) . '</div>';
    }
}
示例#26
0
     echo layout_defaultblock('404, NOT FOUND', '', file_get_contents('./content/404.txt'));
     break;
 case 'docs':
     $text = '';
     $file = str_replace(array("/", ".."), "", $_GET["file"]);
     if ($file == "") {
         $file = "index.html";
     }
     $text = @file_get_contents('./adminguide/current/doc/adminguide/' . $file);
     if ($text == '') {
         header("HTTP/1.0 404 Not Found");
         echo layout_header();
         echo layout_defaultblock('404, NOT FOUND', '', file_get_contents('./content/404.txt'));
     } else {
         echo layout_header();
         $title = between("TITLE\n>", "</TITLE", $text);
         echo layout_defaultblock($title, $link, $text);
     }
     break;
 case 'download':
     $version = "";
     if ($_GET["version"] == "1.0") {
         $version = "1.0";
     }
     if ($_GET["version"] == "1.1") {
         $version = "1.1";
     }
     if ($_GET["version"] == "1.2") {
         $version = "1.2";
     }
     if ($_GET["version"] == "2.0") {
 private function index($data, $db, $sdb)
 {
     $data = str_get_html($data);
     if (!$data->find('#searchResult')) {
         return;
     }
     $data = $data->find('#searchResult', 0);
     foreach ($data->find('tr') as $result) {
         if (!$result->find('.detLink')) {
             continue;
         }
         $title = $result->find('.detLink', 0)->plaintext;
         $url = explode('/', 'https://thepiratebay.se' . $result->find('.detLink', 0)->href);
         array_pop($url);
         $url = implode('/', $url);
         $magnet = $result->find('td', 1);
         $magnet = $magnet->find('a', 1)->href;
         $hash = strtoupper(between($magnet, 'magnet:?xt=urn:btih:', '&dn='));
         $size = str_replace('&nbsp;', ' ', $result->find('.detDesc', 0)->plaintext);
         $words = mb_split('iB', $size);
         $words2 = mb_split('\\s', $words[0]);
         $length = count($words2);
         $size = $words2[$length - 2] . ' ' . $words2[$length - 1] . 'B';
         $size = round(strToBytes($size) / 1024);
         $seeds = $result->find('td', 2)->plaintext;
         $peers = $result->find('td', 3)->plaintext;
         $date = str_replace('&nbsp;', ' ', $result->find('.detDesc', 0)->plaintext);
         $date = str_replace('-', '/', between($date, 'Uploaded ', ', Size'));
         $date = strtotime($date);
         $uploader = $result->find('a.detDesc');
         if ($uploader) {
             $uploader = $uploader[0]->plaintext;
         }
         $cdata = $result->find('a', 1)->href;
         $cdata2 = $result->find('a', 0)->href;
         if (strstr($cdata, 'browse/201') || strstr($cdata, 'browse/207')) {
             $type = 'movies';
         } elseif (strstr($cdata2, 'browse/400')) {
             $type = 'games';
         } elseif (strstr($cdata, 'browse/101')) {
             $type = 'music';
         } elseif (strstr($cdata2, 'browse/300')) {
             $type = 'software';
         } elseif (strstr($cdata, 'browse/205') || strstr($cdata, 'browse/208')) {
             $type = 'tv';
         } elseif (strstr($cdata2, 'browse/500')) {
             $type = 'p**n';
         } else {
             $type = 'other';
         }
         $type = Rivr::getType($type);
         $cdate = time();
         $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;");
         if ($query->num_rows) {
             $this->updated++;
             $info = $query->fetch_assoc();
             Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         } else {
             $this->added++;
             Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader);
         }
     }
     $data->clear();
     unset($data);
 }
            break;
        case 'YMSG':
            $user = between($line, 'USER:'******'HASH:');
            $password = padpw(between($line, 'HASH: ', '  - '));
            $info = between($line, '  - ', false);
            PrintCapItem($proto, $target, $user, $password, $info);
            break;
        case 'DHCP':
            break;
            // Just add any other protocols to hide to this list
        // Just add any other protocols to hide to this list
        default:
            if (strpos($line, ' : ') != 0 && strpos($line, 'PASS') != 0) {
                $target = between($line, ' : ', ' -&gt; USER:'******'USER: '******'  PASS:'******'PASS:'******'<TR><TD>' . $proto . '</td><td colspan="3">' . $line . '</TD></TR>';
            }
    }
}
//Call the PHP script with a ?debug on the end to see the trash lines.
if (isset($_GET[debug])) {
    ?>
<tfoot>
	<tr><th colspan=4>Debug messages</th></tr>
<?php 
    echo $trash;
    ?>
示例#29
0
<?php

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
// @mysql_connect("localhost",'root','Mimin0');
// @mysql_select_db("shemale_embeds");
$content = fileGetContentz("http://cart.bilsteinus.com/search/setting=4600%20Series%20(Sport)");
$content = between('<h3 class="productlink">', '<script type="text/javascript">', $content);
$items = array();
foreach ($content as $key => $cont) {
    $pos = strpos($cont, "<a href='");
    $pos1 = strpos($cont, "'>");
    $text = substr($cont, $pos, $pos1 - $pos);
    $text = str_replace("<a href='", "", $text);
    $items[] = "http://cart.bilsteinus.com" . $text;
}
print_r($items);
/*$items = array('24-000321','47-217522','24-001861','24-001960');
*/
$array_data = array();
foreach ($items as $key => $item) {
    $old_number = "";
    $content = fileGetContentz($item);
    $pos = strpos($content, 'b>Part Number:</b>');
    $pos1 = strpos($content, '<span style="color: red">Series</span>');
    $part_number = substr($content, $pos, $pos1 - $pos);
    $part_number = str_replace('b>Part Number:</b>', "", $part_number);
    $part_number = str_replace('<br /><br /><b>', "", $part_number);
    $old_number = trim(str_replace('<b>Old Part Number</b>: ', "", $part_number));
    $part_number = trim(str_replace('<br />', "", $part_number));
 public function testBetween()
 {
     $this->assertTrue(between(2, 1, 3));
     $this->assertTrue(between(2, 1, 2));
     $this->assertFalse(between(3, 1, 2));
     $this->assertFalse(between(3, 1, 2, true));
     $this->assertFalse(between(2, 1, 2, false));
 }