Esempio n. 1
0
File: upload.php Progetto: hpie/hpie
 function check_image_ext($extension)
 {
     if (preg_Match("/jpg|JPG|JPEG|GIF|gif|png|PNG/", $extension)) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 public function __call($func, $args)
 {
     // Getters and setters
     $matches = array();
     if (preg_Match('/^(get|set)([A-Z].*)$/', $func, $matches)) {
         $type = $matches[1];
         $property = lcfirst($matches[2]);
         if (!property_exists($this, $property)) {
             throw new \Exception($property . ' doesn\'t exist');
         }
         if ($type == 'get') {
             return $this->{$property};
         } else {
             return $this->{$property} = $args[0];
         }
     } else {
         throw new \Exception(__CLASS__ . ' has no method ' . $func);
     }
 }
Esempio n. 3
0
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/cloudfunctions.inc.php';
// Get city and state from request
if (isset($_GET['city']) && isset($_GET['state']) && preg_match("/^[A-Za-z\\+ ]{1,}\$/", $_GET['city']) && preg_Match("/^[A-Z]{2}\$/", $_GET['state'])) {
    $currentCity = urldecode($_GET['city']);
    $currentState = urldecode($_GET['state']);
} else {
    $currentCity = null;
    $currentState = null;
}
// Create access object
$sdb = new AmazonSDB();
// Fetch city list
$cities = getCities($sdb);
// If City and State supplied, generate list of items
$itemCat = array();
if ($currentCity != '' && $currentState != '') {
    // Fetch list of items
    $items = getItems($sdb, $currentCity, $currentState);
Esempio n. 4
0
function perf()
{
    static $t;
    unset($_ENV['header'], $_ENV['c']);
    GT('perf1');
    if (preg_match('~(js|css)$|(js|lastmod)\\.php~', SU) || isset($_POST['ajax'])) {
        return;
    }
    #
    //todo:ne pas executer cette fonction si header<>200 sur la page
    $x = $GLOBALS['pi'];
    if ($x['extension']) {
        #peut être vide..
        if (in_Array($x['extension'], explode(',', 'php,htm,html,fr,org,com,info,ch,tv'))) {
        } else {
            return;
        }
        #extension non autorisée
    }
    #cl('perf,j9:'.J9.','.$t.','.SU.','.print_r(,1));
    #if(!preg_match('~\.(html?|php)$~',U))return;
    if (Preg_Match("~glob=~", Q)) {
        $t = 7;
    } elseif (e(',forceperf', 1) or J9) {
        null;
    } elseif (is_numeric(H) || $t || RS == 404 || e('noperf', 1) || isset($_ENV['noperf']) || $_GET['re'] . $_GET['noperf'] . $_GET['np'] || strpos(U, '%2B%2B') || strlen(U) > 80) {
        $t = 1;
    } elseif (Preg_Match("~(js|jsr|css|rss|sm|redir)\$~", Q)) {
        $t = 2;
    } elseif (preg_match("~Tag\\.php|url(\\.|\\()data|image(/|-)png|base64|\\.(png|js|css|jsx?|jpe?g|gif|bmp|gif|ico|htc|sm)\$~", U)) {
        $t = 3;
    } elseif (!isgoodurl()) {
        $t = 4;
    } elseif (Preg_Match("~editor\\.php|officia|Tag|rss|data|xml|/(CIEL|admin|2001|adm)/|(gss|css.*)\$~i", SU) || preg_Match('~/z/~i', SU) && !preg_Match('~\\/sex|video~i', U)) {
        $t = 5;
    }
    if (preg_match("~base64|%27|\\+~", u)) {
        $t = 6;
    }
    if ($t) {
        Av('t', $t);
        return;
    }
    #FPC(ERLOGS,"noperf:$t\n",1);
    GT('fin');
    $t = 1;
    if (in_array(H, array('ben', 'localhost', '127.0.0.1'))) {
        av('H', $_ENV);
        kill();
    }
    #even if cached,if(j9)return;
    if (q) {
        null;
    } else {
        $f0 = TMP . "perf/" . trim(str_replace(array('http://', '/'), array('', '§'), SU), '§') . ".db";
        $f = TMP . "perf/" . mu . ".db";
        if (is_file($f0)) {
            rename($f0, $f);
        }
        #transition, beaucoup plus simple au final
        $x = FGC($f);
        #Faire correspondre avec fichier "mu" plutôt !!! @todo
        if (isset($_ENV['yt']['mots'])) {
            $x['mots'] = $_ENV['yt']['mots'];
        }
        $x['Memo'] = Memuse();
        #;
        $def = array('tim', 'nb', 'db');
        foreach ($def as $v) {
            if (!isset($x[$v])) {
                $x[$v] = 0;
            }
        }
        if ($x['tim'] > 9999999999) {
            $x['tim'] = $x['nb'] = 0;
        }
        #si bug gettime
        #if(!is_numeric($x['tim']))$x['tim']=0;$x['tim']+=$time;#err
        if (!is_numeric($x['nb'])) {
            $x['nb'] = 1;
        }
        $x['nb'] = $x['nb'] + 1;
        $x['avg'] = ceil($x['tim'] / $x['nb']);
        unset($x['calc'], $x['gen']);
        #if avg>800 db(,'prio'); et on peut créer fichier fpdata avec cette valeur avg afin de charger plus souvent, plus durablement le système de cache pour soulager les pages mettant bcp de temps à être pondues !!!!
        $x['db'] = explode(',', str_replace('Array', '', $x['db']));
        $x['db'] = Array_unique($x['db']);
        $x['db'] = implode(',', $x['db']);
        if (function_exists('sys_getloadavg')) {
            $sysload = implode('#', sys_getloadavg());
            $x['sys'] = date("H:i:s") . ">" . $sysload;
        }
        if (e('erver:pre', 1)) {
        } else {
            FPC($f, $x);
            Touch($f, $x['avg']);
        }
    }
    $x['db'] .= ",fin:" . $_ENV['lasttime'];
    $x['cachepath'] = CACHEPATH;
    if (!j9) {
        return;
    }
    Addurl();
    #les urls dont on s'en tape
    $edit = $y2 = null;
    #FAP(logs.'Vitale.db',Array('cp'=>cachepath,'sfn'=>$_SERVER['SCRIPT_FILENAME']));
    #$x=FGC(TMP.'cont/'.$mu.'.contenu');
    $f = TMP . 'cont/' . MU . '.contenu';
    if (is_file($f)) {
        $y = FGC($f);
        $_ENV['args'] .= " :muc:{$y['id']},len:" . $_ENV['x'];
        $edit .= "<button onclick=\"edt('?zp={$y['id']}');return false;\">e:muc:{$y['id']}</button>";
    } elseif (is_file(TMP . 'cont/' . MU)) {
        $y = FGC(TMP . 'cont/' . MU);
        e("e:mu:{$y}");
        #contient l'identifiant de la page
        $t = sql5("select sql_cache * from p.zpages2 where id={$y}");
        if ($t) {
            $edit .= "<button onclick=\"edt('?zp={$y}');return false;\">e:mu:{$y}</button>";
        } else {
            unlink(TMP . 'cont/' . MU);
        }
        #unlink si l'identifiant sql n'existe pas :)
    } elseif (isset($_POST['create'])) {
        #£todo:bad: right, that's bad, we're checking in this function, globally, if we have some postdata to edit this page contents
        $y = sql5("select id from p.zpages2 where url=\"" . SU . "\"");
        if (!$y) {
            $y = sql5("insert into p.zpages2(url)values(\"" . SU . "\")");
            if ($y) {
                FPC(TMP . 'cont/' . mu, $y);
            }
        }
    } elseif (!RU) {
        $edit .= "<form method=post><input type=hidden name=create value=1><input type=submit value=create></form>";
    }
    if (1) {
        $edit .= "<button accesskey='e' onclick=\"edt('?sfn=1');return false;\">kod</button>";
    }
    Arsort($_ENV['dbt']);
    unset($_ENV['c'], $_ENV['Adbt']);
    $x = Array_merge($_ENV, $x);
    if (is_file(CACHEPATH)) {
        $dif = " age:" . (filemtime(CACHEPATH) - NOW) . "";
    }
    if (is_Array($x['Memo'])) {
        $x['Memo'] = implode(',', $x['Memo']);
    }
    #$y=Pre($x,'nude=1');pre2console($y);
    if (isset($_ENV['debug'])) {
        $y2 = Pre($_ENV['debug'], 'nude=1');
        pre2console($y2);
    }
    #if(J11)$y=print_r(debug_backtrace(),1).$y;
    if (!strpos($_ENV['args'], 'nocss') && !AJAX) {
        $base = $x;
        header('Bs: ' . fixSer($x), 1);
        header('Cdebug: ' . str_replace(array("\r", "\n"), array('', '*'), print_r($base, 1)), 1);
        echo "\n\n<script>var y='" . jsonEnc($base) . "';var cinfo=JSON.parse(y);console.info('cinfo',cinfo);</script>";
        //todo JS debugging into header
    }
    #y.replace(/\"\"/gi,'*'),if(z2)console.info(\"%c\"+z2,'color:blue;font:10px Trebuchet MS');
    #[\"Perf:$sysload:$_ENV[lasttime] ms-\"+z]
    #.replace(/\\n +\(\\n/g,'(\\n').replace(/\\nArray\\n\(\\n\[/g,'\\nArray:\['),z2=\"$y2\".replace(/\\n +\(\\n/g,'(\\n').replace(/\\nArray\\n\(\\n\[/g,'\\nArray:\[');
    #console.info([%cPerf:$sysload:$_ENV[lasttime] ms-\"+z,'color:blue;font:10px Consolas');
    if (e('shutd')) {
        Null;
    } else {
        kill();
    }
    #Si une autre fonction de shutdown a été rajoutée par dessus - sinon fin de tout ( appel à die recursif dans foncshutdown ) !
}