예제 #1
0
 private function validate()
 {
     if (preg_match('/http/', $this->options['src'])) {
         if (!remoteFileExists($this->options['src'])) {
             $this->options['src'] = WWW_ROOT . '/img/' . $this->options['error_image_path'];
             $this->init($this->options);
             return;
         }
     } else {
         if (!is_file($this->options['src'])) {
             $this->options['src'] = WWW_ROOT . '/img/' . $this->options['error_image_path'];
             $this->init($this->options);
             return;
         }
     }
     $valid_extensions = array('.gif', '.jpg', '.jpeg', '.png');
     if (!in_array(strtolower($this->file_extension), $valid_extensions)) {
         $this->error = 1;
         $this->error_detail = 'File ' . $this->options['src'] . ' is not a supported image type';
         return;
     }
 }
예제 #2
0
foreach ($rc_images as $value) {
    $exists = remoteFileExists(base_url($value->path));
    if ($exists) {
        $status = false;
    }
}
$i = 0;
if ($status) {
    echo '<div style="height:100px;"></div>';
}
?>
                        <div class="carousel-inner img-thumbnail" role="listbox">
                            <!-- First slide -->
                            <?php 
foreach ($rc_images as $value) {
    $exists = remoteFileExists(base_url($value->path));
    if ($exists) {
        ?>

                                    <div class="item <?php 
        echo $i == 0 ? 'active' : '';
        ?>
">
                                        <img src="<?php 
        echo base_url($value->path);
        ?>
" alt="" class="img-responsive" />
                                        <div class="carousel-caption">

                                        </div>
                                    </div>
예제 #3
0
    if ($_POST['type'] == 'YOUTUBE') {
        $data = get_youtube_data($_POST['file']);
        $tn = $data['thumbnail'];
        $title = yasDB_clean($data['title']);
        $desc = yasDB_clean($data['description']);
        $keywords = yasDB_clean($data['keywords']);
        if (isset($_POST['name'])) {
            $name = yasDB_clean($_POST['name']);
        } else {
            if (isset($_SESSION['user'])) {
                $name = $_SESSION['user'];
            } else {
                $name = '';
            }
        }
        if (remoteFileExists($tn) === true) {
            $thumb = 'img/' . preg_replace('#\\W#', '', $title) . rand(0, pow(10, 5)) . '.' . get_file_extension($tn);
            download_file($tn, $setting['sitepath'] . '/' . $thumb);
        } else {
            $thumb = '';
        }
    }
    yasDB_insert("INSERT INTO games (title, description, category, thumbnail, keywords, file, height, width, type, active) values ('{$title}', '{$desc}', " . intval($_POST['category']) . ", '{$thumb}', '{$keywords}', '{$file}', {$height}, {$width}, '" . yasDB_clean($_POST['type']) . "', 1)", false);
    if (isset($_SESSION['user'])) {
        $user = yasDB_clean($_SESSION['user']);
        //yasDB_update("UPDATE `user` set videos = videos +1 WHERE username = '******'"); // add a video to users profile
    }
    echo '<center>Media successfully added!</font><br/>';
    echo '<a href="index.php?">Click here to proceed</a></center>';
} else {
    ?>
예제 #4
0
파일: sample2.php 프로젝트: neequole/sp2
include "class/user_stud.php";
include "class/user_admin.php";
include "class/booking.php";
include "class/event.php";
include "class/bookingclass.php";
include "../include/config.php";
?>

<?php 
$method = $_SERVER['REQUEST_METHOD'];
$uri = $_SERVER['REQUEST_URI'];
date_default_timezone_set('Asia/Manila');
//check if METHOD exists
if (isset($method) && $method != "" && ($method == "POST" || $method == "GET" || $method == "PUT")) {
    //check URI exists
    $exists = remoteFileExists("http://localhost" . $uri);
    if ($exists) {
        //check if class exists
        $resource = explode("/", $uri);
        //@return [0] => "" [1] => app folder [2] => web service subfolder [3] => file loc [4] => object class
        if (!isset($resource[4]) || $resource[4] == "") {
            echo "Error in CLASS";
        } else {
            if (class_exists($resource[4])) {
                if ($resource[4] == "UserStudent") {
                    if (isset($resource[5]) && $resource[5] != "") {
                        //[5] => User Id || username
                        $results = array();
                        if ($method == "GET") {
                            if (is_numeric($resource[5])) {
                                $results['student'] = UserStudent::getUserById($resource[5]);
예제 #5
0
        //if request was ok, check response code
        $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        if ($statusCode == 200) {
            $ret = true;
        }
    }
    curl_close($curl);
    return $ret;
}
//filename of the url file
$filename = "test.txt";
//populate array with file contents
$lines = file($filename, FILE_IGNORE_NEW_LINES);
//loop through the urls and add the results to an array
foreach ($lines as $value) {
    $exists = remoteFileExists($value);
    if ($exists) {
        $res[] = $value . " Live";
    } else {
        $res[] = $value . " Dead";
    }
}
//write the results to a txt file
$file = fopen("output.txt", "w");
foreach ($res as $value) {
    fwrite($file, $value . ",");
}
fclose($file);
//let the user know it is done
echo "Done";
?>
예제 #6
0
echo '</pre>';
*/
foreach ($forums as $parent_id => $forum) {
    if ($roster->auth->getAuthorized($forum['access'])) {
        $roster->tpl->assign_block_vars('forums', array('FORUM_ID' => $forum['forumid'], 'LOCKED' => $forum['locked'], 'TITLE' => $forum['title']));
    }
    foreach ($forum['forums'] as $forum_id => $data) {
        if ($roster->auth->getAuthorized($data['access'])) {
            $is_read = false;
            //$functions->get_topic_tracking($forum['forum_id'], $forum['topicid'], $forum['r_date']);
            $icon = '';
            if (!empty($data['icon'])) {
                if (file_exists($roster->config['img_url'] . 'class/' . $data['icon'] . '.png')) {
                    $icon = $roster->config['img_url'] . 'class/' . $data['icon'] . '.png';
                } else {
                    if (remoteFileExists($roster->config['interface_url'] . 'Interface/Icons/' . $data['icon'] . '.png')) {
                        $icon = $roster->config['interface_url'] . 'Interface/Icons/' . $data['icon'] . '.png';
                    } else {
                        $icon = $roster->config['img_url'] . '40X40_Blank_Icon_black.jpg';
                    }
                }
            } else {
                $icon = $roster->config['img_url'] . '40X40_Blank_Icon_black.jpg';
            }
            $roster->tpl->assign_block_vars('forums.subforum', array('FORUM_ID' => $data['forumid'], 'LOCKED' => $data['locked'], 'FORUM_URL' => makelink('guild-' . $addon['basename'] . '-forum&amp;id=' . $data['forumid']), 'TITLE' => $data['title'], 'POSTS' => $data['posts'], 'TOPICS' => $data['topics'], 'L_POSTER' => isset($data['t_poster']) ? $data['t_poster'] : '', 'L_POST_TIME' => isset($data['t_time']) ? date("F j, Y, g:i a", $data['t_time']) : '', 'ICON' => $icon, 'READ' => $is_read, 'LOCKED' => $forum['locked'] == 1 ? true : false, 'IMAGEL' => $forum['locked'] == 1 ? '_locked' : '', 'DESC' => $data['desc']));
        }
    }
}
function remoteFileExists($url)
{
    $curl = curl_init($url);
                 $ubication->url = $url;
                 echo generateJSONSpecieTiles($specie_object, $url);
             } else {
                 if (remoteFileExists($LOCATION_OCCURRENCES_FILES . "/gap_" . $specieDAO->getCropCode(str_replace(" ", "_", strtolower($genepool)), 1) . "/gap_richness/MPS/gap-richness/" . "gap-richnessscaleTestImage.png")) {
                     $url = $LOCATION_OCCURRENCES_FILES . "/gap_" . $specieDAO->getCropCode(str_replace(" ", "_", strtolower($genepool)), 1) . "/gap_richness/MPS/gap-richness/";
                     // Asignando url
                     $ubication->url = $url;
                     echo generateJSONSpecieTiles($specie_object, $url);
                 } else {
                     if (remoteFileExists($LOCATION_OCCURRENCES_FILES . "/gap_" . $specieDAO->getCropCode(str_replace(" ", "_", strtolower($genepool)), 1) . "/gap_richness/LPS/gap-richness/" . "gap-richnessscaleTestImage.png")) {
                         $url = $LOCATION_OCCURRENCES_FILES . "/gap_" . $specieDAO->getCropCode(str_replace(" ", "_", strtolower($genepool)), 1) . "/gap_richness/LPS/gap-richness/";
                         // Asignando url
                         $ubication->url = $url;
                         echo generateJSONSpecieTiles($specie_object, $url);
                     } else {
                         if (remoteFileExists($LOCATION_OCCURRENCES_FILES . "/gap_" . $specieDAO->getCropCode(str_replace(" ", "_", strtolower($genepool)), 1) . "/gap_richness/NFCR/gap-richness/" . "gap-richnessscaleTestImage.png")) {
                             $url = $LOCATION_OCCURRENCES_FILES . "/gap_" . $specieDAO->getCropCode(str_replace(" ", "_", strtolower($genepool)), 1) . "/gap_richness/NFCR/gap-richness/";
                             // Asignando url
                             $ubication->url = $url;
                             echo generateJSONSpecieTiles($specie_object, $url);
                         } else {
                             // No cumple ninguna de las condiciones, se envia resultado vacio.
                             $data['no_data'] = 1;
                             echo json_encode($data);
                         }
                     }
                 }
             }
             break;
     }
 }
예제 #8
0
 public function exists($image)
 {
     $link = $this->getLink($image, 50);
     return remoteFileExists($link);
 }
예제 #9
0
파일: api.php 프로젝트: samundrak/fadkit
function checkFacebook_data()
{
    //if(!in_array('mod_rewrite', apache_get_modules()))
    //exit('Mod Rewrite Must be enable on your server inorder to complete installation.');
    htaMaker('__src/__license/');
    htaMaker('install/');
    htaMaker('__src/');
    htaMaker('__src/__data/');
    try {
        if (file_exists('__src/__license/license.ls')) {
            $licenseFile = '__src/__license/license.ls';
        } else {
            $licenseFile = '__license/license.ls';
            include 'install/admin/index.php';
            exit;
        }
    } catch (Exception $e) {
        if (file_exists('__src/__license/license.ls')) {
            $licenseFile = '__src/__license/license.ls';
        } else {
            $licenseFile = '__src/__license/license.ls';
            include 'install/admin/index.php';
            exit;
        }
    }
    try {
        $fileOpen = file_get_contents($licenseFile);
        $licensed = json_decode($fileOpen, true);
        foreach ($licensed as $license) {
            if (empty($license) || strchr($license, ' ')) {
                exit("<p style='background-color:red;color:white;width:auto;'>Some values are Empty!</p>");
            }
        }
        //$licensePath = 'http://www.soosal.com/fb/account/__json_files__/'.md5($licensed['key']).'.json';
        //Where the login details will be saved
        $licensePath = '../secret.json';
        //End
        if (function_exists('curl_init')) {
            function remoteFileExists($url)
            {
                $curl = curl_init($url);
                curl_setopt($curl, CURLOPT_NOBODY, true);
                $result = curl_exec($curl);
                $ret = false;
                if ($result !== false) {
                    $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
                    if ($statusCode == 200) {
                        $ret = true;
                    }
                }
                curl_close($curl);
                return $ret;
            }
            $exists = remoteFileExists($licensePath);
            if ($exists) {
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $licensePath);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $getJson = curl_exec($ch);
                curl_close($ch);
                $s_license = json_decode($getJson, true);
                foreach ($s_license as $s_licensed) {
                    if (empty($s_licensed) || strchr($s_licensed, ' ')) {
                        echo 1;
                        unlink($licenseFile);
                        exit("<p style='background-color:red;color:white;width:auto;'> Some values are Empty!</p>");
                    }
                    if ($s_licensed == 1 || $s_licensed == 2) {
                        break;
                    }
                    if (!in_array($s_licensed, $licensed)) {
                        echo 2;
                        unlink($licenseFile);
                        exit("<p style='background-color:red;color:white;width:auto;'>Some value Didn\\'t match</p>");
                    }
                }
                if ($s_license['sts'] == 1) {
                    if (!file_exists('__src/__data/config.json')) {
                        include 'install/active.php';
                        /*MAIL USER OF SUCESS INSTALL*/
                        $txt = "Hello" . $s_license['admin'] . ",\n You have Suceesfully installed this app.\n You can now use this app.\n \n ThankYou!";
                        // Use wordwrap() if lines are longer than 70 characters
                        $txt = wordwrap($txt, 70);
                        // Send email
                        mail($s_license['email'], "App Installed", $txt);
                        /**/
                    }
                } else {
                    throw new Exception("<p style='background-color:red;color:white;width:auto;'>You are not licensed user!</p>");
                }
            } else {
                throw new Exception("<p style='background-color:red;color:white;width:auto;'>You haven\\'t entered correct license key or Did you download this from another source?</p>");
                exit;
            }
        } else {
            throw new Exception("<p style='background-color:red;color:white;width:auto;'>Curl must be enabled to install this APP</p>");
            exit;
        }
    } catch (Exception $e) {
        unlink($licenseFile);
        echo $e->getMessage();
        exit;
    }
}