Esempio n. 1
0
function contact_plugin()
{
    if (isset($_POST['submit'])) {
        $username = $_POST['username'];
        $subject = $_POST['subject'];
        $message = $_POST['content'];
        echo "<br/>";
        echo "<br/>";
        echo "<br/>";
        echo "<br/>";
        echo $username;
        if (is_valid($subject, $message) == false) {
            echo "</br></br></br>";
            echo $subject . "</br>";
            echo $message;
            $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
            mail("*****@*****.**", $subject, $message, $headers);
        }
    }
    echo '<div class="contain">';
    echo '<form action="" method="post">';
    echo '<div class="form-group">';
    echo '<label>Enter Your name</label>';
    echo '<input  name="username" class="form-control" id="un" required ">';
    echo '<label>Topic</label>';
    echo '<input  name="subject" class="form-control" id="un" required ">';
    echo '<label>Message</label>';
    echo '<textarea class="form-control" rows="5" name="content" id="comment"></textarea>';
    echo '<div id="button1">';
    echo '<button name="submit" type="submit" class="btn btn-primary btn-block">Submit</button>';
    echo '</div>';
    echo '</div>';
    echo '</form>';
    echo '</div>';
}
Esempio n. 2
0
function next_password($codes)
{
    $codes = increase($codes);
    while (!is_valid($codes)) {
        $codes = increase($codes);
    }
    return $codes;
}
 public function get($slug)
 {
     if (is_valid($slug)) {
         $this->ttpl->set('title', 'Hello, world');
         $this->ttpl->set('content', 'Load an article that matches the slug: ' . $slug);
     } else {
         $this->not_found();
     }
 }
 public function upload($file, $options = array())
 {
     $options['return_error'] = false;
     $ret = Uploader::upload($file, $options);
     $preloaded = new PreloadedFile(Cloudinary::signedPreloadedImage($ret));
     if ($this->verifyUpload && !$preloaded . is_valid()) {
         throw new \Exception("Error! Couldn't verify cloudinary response!");
     }
     $this->identifier = $preloaded->extendedIdentifier();
 }
Esempio n. 5
0
function get_wet()
{
    $wet_url = 'http://121.42.31.195:9071/WIFPa/ResourceData.xml/0001000054f08cfa?ResourceID=4';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $wet_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $wet_data = curl_exec($ch);
    curl_close($ch);
    $wet_reg = '/<resvalue>(.*?)<\\/resvalue>/';
    $wet_ret = is_valid($wet_data, $wet_reg);
    $tag_start_len = strlen('<resvalue>');
    $tag_end_len = strlen('<\\/resvalue>');
    $gross_len = strlen($wet_ret);
    $wet_len = $gross_len - $tag_start_len - $tag_end_len;
    $wet_ret = substr($wet_ret, $tag_start_len, $wet_len + 1);
    return $wet_ret;
}
/**
 * Display the series cast
 */
function show_cast()
{
    global $apikey, $w, $id;
    $url = "http://api.trakt.tv/show/summary.json/{$apikey}/{$id}/extended";
    $show = $w->request($url);
    $show = json_decode($show);
    if (is_valid($show)) {
        $w->result('cast', '', 'Back ...', '', 'icons/back.png', 'no', 'id:' . $id . ':summary');
        foreach ($show->people->actors as $actor) {
            $w->result('cast', '', $actor->character, $actor->name, 'icons/actor.png', 'no');
        }
    }
}
Esempio n. 7
0
                    case "getIndic":
                        $rt->getIndic();
                        break;
                    case "getData":
                        if (isset($_GET['idgraphe'])) {
                            $rt->getData($_GET['idgraphe']);
                        }
                        break;
                    case "getBoilerMode":
                        if (isset($_GET['way'])) {
                            $rt->getBoilerMode($_GET['way']);
                        }
                        break;
                    case "setBoilerMode":
                        if (isset($_GET['mode']) && isset($_GET['way'])) {
                            $rt->setBoilerMode($_GET['mode']);
                            break;
                        }
                }
                break;
        }
    }
} else {
    if (!is_ajax()) {
        echo '<pre>xmlhttprequest needed ! </pre>';
    }
    if (!is_valid()) {
        header("Content-type: text/json; charset=utf-8");
        echo '{"response": false,"apiToken": "invalid"}';
    }
}
Esempio n. 8
0
  <TR>
            <TD width="10" vAlign=top</TD>
          <TD width="740" vAlign=top colspan="2">

      &nbsp;&nbsp;<IMG SRC="images/menu/textmenu_member.gif" BORDER="0">
				<TABLE width="740" align=center cellSpacing=0 cellPadding=0 border=0>
				<TR>
					<TD height="1" class="dotline" ></TD>
				</TR>
      <TR><td>
<?php 
$user_login = stripslashes($_POST['user_login']);
$user_login = mysql_real_escape_string($_POST['user_login']);
$pwd_login = stripslashes($_POST['pwd_login']);
$pwd_login = mysql_real_escape_string($_POST['pwd_login']);
if (is_valid($user_login) == true && is_valid($pwd_login) == true) {
    $Username = preg_replace('/"/i', '\\"', $user_login);
    $Password = preg_replace("/'/i", "\\'", $pwd_login);
    anti_injection($Username, $Password, $IPADDRESS);
    //ÃкºÊÁÒªÔ¡àÊÃÔÁ maxsite 1.10 ¾Ñ²¹Òâ´Â www.narongrit.net
    if (USE_CAPCHA) {
        if ($_SESSION['security_code'] != $_POST['security_code'] or empty($_POST['security_code'])) {
            echo "<script language='javascript'>";
            echo "alert('" . _JAVA_CAPTCHA_NOACC . "')";
            echo "</script>";
            echo "<script language='javascript'>javascript:history.go(-1)</script>";
            //		echo "		if(".$_SESSION['security_code']." != ".$_POST['security_code']." OR empty(".$_POST['security_code'].")) {";
            exit;
        }
    }
    if (isset($Username) and isset($Password)) {
Esempio n. 9
0
if ($row && $row->user_id == $_SESSION['user_id']) {
    $ok = true;
}
if (isset($_SESSION['source_browser'])) {
    $ok = true;
}
$view_reinfo = "";
if ($ok == true) {
    if ($row->user_id != $_SESSION['user_id']) {
        $view_mail_link = "<a href='mail.php?to_user={$row->user_id}&title={$MSG_SUBMIT} {$id}'>Mail the auther</a>";
    }
    mysql_free_result($result);
    $sql = "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`='" . $id . "'";
    $result = mysql_query($sql);
    $row = mysql_fetch_object($result);
    if ($row && ($OJ_SHOW_DIFF || is_valid($row->error))) {
        $view_reinfo = htmlspecialchars(str_replace("\n\r", "\n", $row->error));
    }
    mysql_free_result($result);
} else {
    mysql_free_result($result);
    $view_errors = "I am sorry, You could not view this message!";
    require "template/" . $OJ_TEMPLATE . "/error.php";
    exit(0);
}
/////////////////////////Template
require "template/" . $OJ_TEMPLATE . "/reinfo.php";
/////////////////////////Common foot
if (file_exists('./include/cache_end.php')) {
    require_once './include/cache_end.php';
}
Esempio n. 10
0
<?php

require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$request = Request::createFromGlobals();
if (is_valid($request)) {
    sendHipchatMessage($request);
}
/**
 * Verification request + calcul signature
 */
function is_valid($request)
{
    $payload = $request->getContent();
    if (empty($payload)) {
        returnResponse('empty payload', 400);
        return false;
    }
    //Bignou calcul signature Gihub
    if (!isGithubSignatureValid($request)) {
        returnResponse('invalid github signature', 400);
        return false;
    }
    //verif valid payload
    if (null === json_decode($payload)) {
        returnResponse('invalid json body', 400);
        return false;
    }
Esempio n. 11
0
function mx_mnfanmed($page, $option, $action)
{
    global $mxuser;
    mx_showhtmlpage('fanmed');
    $subs = $mxuser->getsub();
    // TODO: search active subs only
    //error_log('subs:'.print_r($subs,true));
    $artists = array();
    foreach ($subs as $sub) {
        if (is_valid($sub)) {
            $artists[] = $sub->artistid;
        }
    }
    echo mx_showmediastr($artists, 'fanmed');
}
Esempio n. 12
0
    // check all chars are valid
    if (!preg_match("/^[-+*\\/.\\d]+\$/", $expr)) {
        return false;
    } elseif (preg_match("/^[+*\\/.]{2,}\$/", $expr)) {
        return false;
    } elseif (preg_match("/^[-]{3,}\$/", $expr)) {
        return false;
    } elseif (preg_match("/^[+*\\/.]/", $expr)) {
        return false;
    } elseif (preg_match("/[-+*\\/.]\$/", $expr)) {
        return false;
    }
    return true;
}
$expr = trim($_GET["expr"]);
if (is_valid($expr)) {
    $expr = str_replace("--", "+", $expr);
    if (preg_match("/\\/[0]/", $expr)) {
        // does NOT handle cases such as 1/0.5
        echo "Division by zero error!";
    } else {
        $invalid = eval("\$ans={$expr};");
        if ($invalid) {
            echo "Invalid expression!";
        } else {
            echo $expr . " = " . $ans;
        }
    }
} else {
    echo "Invalid expression!";
}
Esempio n. 13
0
}
function get_nameid($xml)
{
    $xpath = new DOMXPath($xml);
    $xpath->registerNamespace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol");
    $xpath->registerNamespace("saml", "urn:oasis:names:tc:SAML:2.0:assertion");
    //$query = "/samlp:Response/saml:Assertion/saml:Subject/saml:NameID";
    $query = "/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute";
    $entries = $xpath->query($query);
    return $entries->item(0)->nodeValue;
}
function genToken()
{
    return mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
}
if (is_valid($document, $x509certificate)) {
    //echo htmlentities($documentStr);
    $authedUser = get_nameid($document);
    $desiredUser = $_COOKIE['userId'];
    if ($authedUser != $desiredUser) {
        echo "Sorry, you want to log in to '{$desiredUser}' but it looks like you are '{$authedUser}'. Please go away.";
        die;
    } else {
        $token = genToken();
        $categories = json_encode(explode(',', $_COOKIE['scope']));
        $redis->set('token:' . $_COOKIE['userId'] . ':' . $token, $categories);
        //echo 'redis->set(token:'.$_COOKIE['userId'].':'.$token.', '.$categories;
        //echo 'Location: '.$_COOKIE['redirectUri'].'#access_token='.urlencode($token);
        header('Location: ' . $_COOKIE['redirectUri'] . '#access_token=' . urlencode($token));
    }
} else {
Esempio n. 14
0
if ($row && $row->user_id == $_SESSION['user_id']) {
    $ok = true;
}
if (isset($_SESSION['source_browser'])) {
    $ok = true;
}
$view_reinfo = "";
if ($ok == true) {
    if ($row->user_id != $_SESSION['user_id']) {
        $view_mail_link = "<a href='mail.php?to_user={$row->user_id}&title={$MSG_SUBMIT} {$id}'>Mail the auther</a>";
    }
    mysqli_free_result($result);
    $sql = "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`='" . $id . "'";
    $result = mysqli_query($mysqli, $sql);
    $row = mysqli_fetch_object($result);
    if ($row && ($OJ_SHOW_DIFF || $OJ_TEST_RUN || is_valid($row->error))) {
        $view_reinfo = htmlentities(str_replace("\n\r", "\n", $row->error), ENT_QUOTES, "UTF-8");
    }
    mysqli_free_result($result);
} else {
    mysqli_free_result($result);
    $view_errors = "I am sorry, You could not view this message!";
    require "template/" . $OJ_TEMPLATE . "/error.php";
    exit(0);
}
/////////////////////////Template
require "template/" . $OJ_TEMPLATE . "/reinfo.php";
/////////////////////////Common foot
if (file_exists('./include/cache_end.php')) {
    require_once './include/cache_end.php';
}
Esempio n. 15
0
    if (mydb::cxn()->error != '') {
        die("Retrieving valid YEARs failed: " . mydb::cxn()->error . "<br>\n" . $query);
    }
    while ($row = $result->fetch_assoc()) {
        if ($row['year'] == $year) {
            return 1;
        }
    }
    return 0;
    //Year is NOT valid or else function would have returned 1 by now
}
//************** MAIN **************************************
if ($_GET['year'] == "current") {
    $_GET['year'] = date('Y');
}
if (is_valid($_GET['year'])) {
    $year = $_GET['year'];
} else {
    $year = 0;
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Roster :: Siskiyou Rappel Crew</title>

<?php 
Esempio n. 16
0
$id = "{${'ADR' . $invt_num}}_1";
$G1V = is_valid($id, $data);
settype($G1V, 'float');
$data = exec("cat /run/shm/metern{${'ADR' . $invt_num}}.txt | egrep \"^{${'ADR' . $invt_num}}_2\\(\" | egrep \"\\*A\\)\$\"");
$id = "{${'ADR' . $invt_num}}_2";
$G1A = is_valid($id, $data);
settype($G1A, 'float');
$data = exec("cat /run/shm/metern{${'ADR' . $invt_num}}.txt | egrep \"^{${'ADR' . $invt_num}}\\(\" | egrep \"\\*W\\)\$\"");
$id = "{${'ADR' . $invt_num}}";
$G1P = is_valid($id, $data);
settype($G1P, 'float');
$data = exec("cat /run/shm/metern{${'ADR' . $invt_num}}.txt | egrep \"^{${'ADR' . $invt_num}}_3\\(\" | egrep \"\\*Hz\\)\$\"");
$id = "{${'ADR' . $invt_num}}_3";
$FRQ = is_valid($id, $data);
settype($FRQ, 'float');
$EFF = (double) 0.0;
$INVT = null;
$BOOT = null;
$data = exec("cat /run/shm/metern{${'ADR' . $invt_num}}.txt | egrep \"^{${'ADR' . $invt_num}}\\(\" | egrep \"\\*Wh\\)\$\"");
$id = "{${'ADR' . $invt_num}}";
$KWHT = is_valid($id, $data);
settype($KWHT, 'float');
$KWHT = $KWHT / 1000;
if ($KWHT != 0) {
    $RET = 'OK';
} else {
    $RET = 'NOK';
}
if ($DEBUG != 0) {
    echo "G1V = {$G1V}, G1A = {$G1A}, G1P = {$G1P}, FRQ = {$FRQ}, EFF = {$EFF}, KWHT = {$KWHT}";
}
//AQUISIZIONE DATI
$mem_id = $_GET['MEM_ID'];
//dell'utente da modificare
$mem_hash = pack('H*', $mem_id);
list($user_hash, $user_id) = get_my_info($SNAME);
if (!$_SESSION[$SNAME]['sess_auth']) {
    $url = "login.php";
    echo "<tr><td><center>" . $lang['sign_login'] . "<br>";
    echo "" . $lang['reply_loginred'] . "</center></td></tr><script language=\"javascript\" type='text\\javasript'>setTimeout('delayer()', 1500);\nfunction delayer(){ window.location='{$url}';}</script>";
    include "end.php";
    exit(0);
}
//POSTBACK PAGE
if ($_POST['MEM_ID']) {
    $is_post_back = 1;
    if ($user_id != $_POST['MEM_ID'] && !is_valid($_POST['privkey'])) {
        echo '<tr><td>
		<table cellspacing="0" width="100%">
		<tr>
		<td valign="top" class="nopad" width="24%">' . show_menu() . '</td>
		<td class="nopad" width="1%"><!-- --></td>
		<!-- Start main CP area -->
		<td valign="top" class="nopad" width="75%">
			<div id="ucpcontent">
			<div class="maintitle">' . $lang['optsign_welcome'] . '</div>' . show_private_form($_POST) . '</div></td></tr></table>';
    } else {
        if (!$core) {
            $core = new CoreSock();
        }
        $IDENTIFICATORE = md5($_SESSION[$SNAME]['sess_password'] . $_SESSION[$SNAME]['sess_nick']);
        // = identificatore dell'utente nella tabella localmember. easadecimale
Esempio n. 18
0
     $shTempPathArray = $path_array;
     $shSaveRequestURIBackup = $shPageInfo->shSaveRequestURI;
     if (!empty($shLastBit)) {
         // if URl does not end with a /
         $shTempPathArray[] = '';
         // add one
         $shPageInfo->shSaveRequestURI .= '/';
     } else {
         unset($shTempPathArray[count($shTempPathArray) - 1]);
         // if it ends with a /, remove it
         rtrim($shPageInfo->shSaveRequestURI, '/');
     }
     $shQueryString = $sef_ext->revert($shTempPathArray, $pos);
     // warning : revert may do a 301 to same url with correct case !
     $shPageInfo->shSaveRequestURI = $shSaveRequestURIBackup;
     if (is_valid($shQueryString)) {
         //let's redirect to this new URL
         $dest = str_replace($GLOBALS['shConfigLiveSite'] . $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode], '', $shPageInfo->URI->url);
         $dest = JString::trim(str_replace($GLOBALS['shConfigLiveSite'], '', $dest), '/');
         _log('Redirecting to same with trailing slash added');
         shRedirect($GLOBALS['shConfigLiveSite'] . $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] . $dest . (empty($shLastBit) ? '' : '/'));
     }
 }
 // V 1.3.1 : check for aliases
 $path = $sefConfig->shEncodeUrl ? shUrlEncode($path) : $path;
 shCheckCustomRedirects($path, $shPageInfo);
 // check Joomla 1.5 sef redirect to sh404sef redirect
 if (empty($shPageInfo->autoRedirectsDisabled) && $sefConfig->shRedirectJoomlaSefToSef) {
     // get current URI and router
     $jUri = clone $uri;
     $shRouter =& $mainframe->getRouter();
Esempio n. 19
0
function security_test_arg()
{
    // now, all arguments must be in validargs
    foreach ($_GET as $value) {
        if (!is_valid($value)) {
            hacker_gaught();
        }
    }
    foreach ($_POST as $value) {
        if (!is_valid($value)) {
            hacker_gaught();
        }
    }
}
Esempio n. 20
0
    <?php 
/* Define global field array for use in custom error messages */
$requiredField = array('amount' => 'amount', 'unit' => 'unit');
/* Define validation rule messages */
$errorMessage = array('no_amount' => 'You did not enter an amount', 'no_unit' => 'You did not enter a unit to convert to', 'num_above_zero' => 'The entered amount must be numeric and greater than zero');
/* Define error array */
$errors = array();
/* If the convert button was pressed */
if (isset($_POST['convert'])) {
    /* Check if an amount has been entered */
    if (!is_valid(sanitize_input($_POST[$requiredField['amount']]))) {
        array_push($errors, [$requiredField['amount'] => $errorMessage['no_amount']]);
    }
    /* If an amount has been entered and is valid, check if numeric and greater than zero */
    if (is_valid(sanitize_input($_POST[$requiredField['amount']])) && !is_num_above_zero($_POST[$requiredField['amount']])) {
        array_push($errors, [$requiredField['amount'] => $errorMessage['num_above_zero']]);
    }
    /* Check if a unit has been selected */
    if ($_POST[$requiredField['unit']] == 'default') {
        array_push($errors, [$requiredField['unit'] => $errorMessage['no_unit']]);
    }
    /* If there are no errors, convert! */
    if (!has_items($errors)) {
        /* Send the submitted values to the convert function */
        $convertedValue = ConvertLiquid($_POST[$requiredField['amount']], $_POST[$requiredField['unit']]);
    }
} else {
    if (isset($_POST['reset'])) {
        unset($errors);
    }
Esempio n. 21
0
<?php

/**
Luhn algorithm

1、从卡号最后一位数字开始,偶数位乘以2,如果乘以2的结果是两位数,将结果减去9。
2、把所有数字相加,得到总和。
3、如果信用卡号码是合法的,总和可以被10整除。
*/
function is_valid($s)
{
    $s = strrev(preg_replace('~[^\\d]~', '', $s));
    $sum = 0;
    for ($i = 0, $j = strlen($s); $i < $j; $i++) {
        if ($i % 2 == 0) {
            $val = $s[$i];
        } else {
            $val = $s[$i] * 2;
            if ($val > 9) {
                $val -= 9;
            }
        }
        $sum += $val;
    }
    return $sum % 10 == 0;
}
print_r(is_valid('41111111 1111 1113'));
Esempio n. 22
0
do {
    $order[$i]++;
    if ($order[$i] > $max) {
        $order[$i] = 0;
        $j = $i - 1;
        while ($j >= 0) {
            $order[$j]++;
            if ($order[$j] > $max) {
                $order[$j] = 0;
                $j--;
            } else {
                break;
            }
        }
        if ($j < 0) {
            break;
        }
    }
    if (!is_valid($order)) {
        continue;
    }
    echo implode('-', $order) . "\n";
    $positions = array_combine($persons, $order);
    $current = calculate_overall($happiness, $positions);
    if ($current > $sum) {
        $sum = $current;
        $totals = $positions;
    }
} while ($i);
print_r($totals);
var_dump($sum);
Esempio n. 23
0
if ($row && $row->user_id == $_SESSION['user_id']) {
    $ok = true;
}
if (isset($_SESSION['source_browser'])) {
    $ok = true;
}
$view_reinfo = "";
if ($ok == true) {
    if ($row->user_id != $_SESSION['user_id']) {
        $view_mail_link = "<a href='mail.php?to_user={$row->user_id}&title={$MSG_SUBMIT} {$id}'>Mail the auther</a>";
    }
    mysql_free_result($result);
    $sql = "SELECT `error` FROM `compileinfo` WHERE `solution_id`='" . $id . "'";
    $result = mysql_query($sql);
    $row = mysql_fetch_object($result);
    if ($row && is_valid($row->error)) {
        $view_reinfo = htmlspecialchars(str_replace("\n\r", "\n", $row->error));
    }
    mysql_free_result($result);
} else {
    mysql_free_result($result);
    $view_errors = "I am sorry, You could not view this message!";
    require "template/" . $OJ_TEMPLATE . "/error.php";
    exit(0);
}
/////////////////////////Template
require "template/" . $OJ_TEMPLATE . "/ceinfo.php";
/////////////////////////Common foot
if (file_exists('./include/cache_end.php')) {
    require_once './include/cache_end.php';
}
Esempio n. 24
0
echo show_escapes(HtmlSpecialChars($test['address']));
?>
</a></nobr></p>
	<p class="isemail_result isemail_expected"><?php 
echo is_valid($test['expected']);
?>
</p>

	<p class="isemail_result isemail_<?php 
echo $test['result_strict'] == $test['expected'] ? '' : 'un';
?>
expected"><?php 
echo is_valid($test['result_strict']);
?>
</p>
	<p class="isemail_result isemail_<?php 
echo $test['result_public'] == $test['expected'] ? '' : 'un';
?>
expected"><?php 
echo is_valid($test['result_public']);
?>
</p>
</div>

<? } ?>

<p style="clear: both; padding-bottom: 50px;">&nbsp;</p>

</body>
</html>
Esempio n. 25
0
    static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
    {
        if (!isset($_POST['albumid']) and !is_object($albumobj)) {
            echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
            echo "</div></body></html>";
            exit;
        }
        global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
        //getting the image to start with
        if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
            $imagenumber = $_POST['imagenumber'] - 1;
            // slideshows starts with 0, but zp with 1.
        } elseif (is_object($imageobj)) {
            makeImageCurrent($imageobj);
            $imagenumber = imageNumber() - 1;
        } else {
            $imagenumber = 0;
        }
        // set pagenumber to 0 if not called via POST link
        if (isset($_POST['pagenr'])) {
            $pagenumber = sanitize_numeric($_POST['pagenr']);
        } else {
            $pagenumber = 0;
        }
        // getting the number of images
        if (!empty($_POST['numberofimages'])) {
            $numberofimages = sanitize_numeric($_POST['numberofimages']);
        } elseif (is_object($albumobj)) {
            $numberofimages = $albumobj->getNumImages();
        }
        //getting the album to show
        if (!empty($_POST['albumid']) and !is_object($albumobj)) {
            $albumid = sanitize_numeric($_POST['albumid']);
        } elseif (is_object($albumobj)) {
            $albumid = $albumobj->id;
        } else {
            $albumid = -1;
        }
        // setting the image size
        if (!empty($width) and !empty($height)) {
            $width = sanitize_numeric($width);
            $height = sanitize_numeric($height);
        } else {
            $width = getOption("slideshow_width");
            $height = getOption("slideshow_height");
        }
        $option = getOption("slideshow_mode");
        // jQuery Cycle slideshow config
        // get slideshow data
        $gallery = new Gallery();
        if ($albumid <= 0) {
            // search page
            $dynamic = 2;
            $search = new SearchEngine();
            $params = $_POST['preserve_search_params'];
            $search->setSearchParams($params);
            $images = $search->getImages(0);
            $searchwords = $search->words;
            $searchdate = $search->dates;
            $searchfields = $search->fields;
            $page = $search->page;
            if (empty($_POST['imagenumber'])) {
                $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
                $album = new Album($gallery, $albumq['folder']);
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
                //$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
            } else {
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
            }
            $albumtitle = gettext('Search');
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = new Album($gallery, $albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!checkAlbumPassword($albumq['folder'], $hint)) {
                echo gettext("This album is password protected!");
                exit;
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
        // slideshow display section
        switch ($option) {
            case "jQuery":
                $validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
                ?>
					<script type="text/javascript">
						$(document).ready(function(){
							$(function() {
								var ThisGallery = '<?php 
                echo html_encode($albumtitle);
                ?>
';
								var ImageList = new Array();
								var TitleList = new Array();
								var DescList = new Array();
								var ImageNameList = new Array();
								var DynTime=(<?php 
                echo getOption("slideshow_timeout");
                ?>
) * 1.0;	// force numeric
								<?php 
                for ($imgnr = 0, $cntr = 0, $idx = $imagenumber; $imgnr < $numberofimages; $imgnr++, $idx++) {
                    if ($dynamic) {
                        $filename = $images[$idx]['filename'];
                        $album = new Album($gallery, $images[$idx]['folder']);
                        $image = newImage($album, $filename);
                    } else {
                        $filename = $images[$idx];
                        $image = newImage($album, $filename);
                    }
                    $ext = is_valid($filename, $validtypes);
                    if ($ext) {
                        makeImageCurrent($image);
                        $img = getCustomSizedImageMaxSpace($width, $height);
                        //$img = WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . pathurlencode($image->album->name) . '&i=' . urlencode($filename) . '&s=' . $imagesize;
                        echo 'ImageList[' . $cntr . '] = "' . $img . '";' . "\n";
                        echo 'TitleList[' . $cntr . '] = "' . js_encode($image->getTitle()) . '";' . "\n";
                        if (getOption("slideshow_showdesc")) {
                            $desc = $image->getDesc();
                            $desc = str_replace("\r\n", '<br />', $desc);
                            $desc = str_replace("\r", '<br />', $desc);
                            echo 'DescList[' . $cntr . '] = "' . js_encode($desc) . '";' . "\n";
                        } else {
                            echo 'DescList[' . $cntr . '] = "";' . "\n";
                        }
                        if ($idx == $numberofimages - 1) {
                            $idx = -1;
                        }
                        echo 'ImageNameList[' . $cntr . '] = "' . urlencode($filename) . '";' . "\n";
                        $cntr++;
                    }
                }
                echo "\n";
                $numberofimages = $cntr;
                ?>
								var countOffset = <?php 
                echo $imagenumber;
                ?>
;
								var totalSlideCount = <?php 
                echo $numberofimages;
                ?>
;
								var currentslide = 2;
			
								function onBefore(curr, next, opts) {
									//$(next).parent().animate({opacity: 0});

									if (opts.timeout != DynTime) {
										opts.timeout = DynTime;
									}
									if (!opts.addSlide)
										return;
							
									var currentImageNum = currentslide;
									currentslide++;
									if (currentImageNum == totalSlideCount) {
										opts.addSlide = null;
										return;
									}
									var relativeSlot = (currentslide + countOffset) % totalSlideCount;
									if (relativeSlot == 0) {relativeSlot = totalSlideCount;}
									var htmlblock = "<span class='slideimage'><h4><strong>" + ThisGallery + ":</strong> ";
									htmlblock += TitleList[currentImageNum]  + " (" + relativeSlot + "/" + totalSlideCount + ")</h4>";
									htmlblock += "<img src='" + ImageList[currentImageNum] + "'/>";
									htmlblock += "<p class='imgdesc'>" + DescList[currentImageNum] + "</p></span>";
									opts.addSlide(htmlblock);

								}
			
								function onAfter(curr, next, opts){
									<?php 
                if (!isMyALbum($album->name, ALL_RIGHTS)) {
                    ?>
									//Only register at hit count the first time the image is viewed.
									if ($(next).attr( 'viewed') != 1) {
										$.get("<?php 
                    echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                    ?>
/slideshow/slideshow-counter.php?album=<?php 
                    echo pathurlencode($album->name);
                    ?>
&img="+ImageNameList[opts.currSlide]);
										$(next).attr( 'viewed', 1 );
									}
									<?php 
                }
                ?>

									//THE MISSING LINE
									$(next).parent().height(
										$(next).find('img').height() + $(next).find('p').height() + $(next).find('h4').height() + 40
									); //.animate({opacity: 1}, 'normal', 'linear');
									//getOption('slideshow_onafter'); //make it generic
									//END MISSING LINE
								}
			
								$('#slides').cycle({
										fx:     '<?php 
                echo getOption("slideshow_effect");
                ?>
',
										speed:   <?php 
                echo getOption("slideshow_speed");
                ?>
,
										timeout: DynTime,
										next:   '#next',
										prev:   '#prev',
										cleartype: 1,
										before: onBefore,
										after: onAfter
								});
			
								$('#speed').change(function () {
									DynTime = this.value;
									return false;
								});
			
								$('#pause').click(function() { $('#slides').cycle('pause'); return false; });
								$('#play').click(function() { $('#slides').cycle('resume'); return false; });
							});
			
						});	// Documentready()
			
						</script>
						<div id="slideshow" align="center">
						<?php 
                // 7/21/08dp
                if ($speedctl) {
                    echo '<div id="speedcontrol">';
                    // just to keep it away from controls for sake of this demo
                    $minto = getOption("slideshow_speed");
                    while ($minto % 500 != 0) {
                        $minto += 100;
                        if ($minto > 10000) {
                            break;
                        }
                        // emergency bailout!
                    }
                    $dflttimeout = getOption("slideshow_timeout");
                    /* don't let min timeout = speed */
                    $thistimeout = $minto == getOption("slideshow_speed") ? $minto + 250 : $minto;
                    echo 'Select Speed: <select id="speed" name="speed">';
                    while ($thistimeout <= 60000) {
                        // "around" 1 minute :)
                        echo "<option value={$thistimeout} " . ($thistimeout == $dflttimeout ? " selected='selected'>" : ">") . round($thistimeout / 1000, 1) . " sec</option>";
                        /* put back timeout to even increments of .5 */
                        if ($thistimeout % 500 != 0) {
                            $thistimeout -= 250;
                        }
                        $thistimeout += $thistimeout < 1000 ? 500 : ($thistimeout < 10000 ? 1000 : 5000);
                    }
                    echo "</select> </div>";
                }
                if (!is_object($albumobj)) {
                    // disable controls if calling the slideshow directly on homepage for example
                    ?>
						<div id="controls">
						<div><span><a href="#" id="prev"
							title="<?php 
                    echo gettext("Previous");
                    ?>
"></a></span> <a
							href="<?php 
                    echo $returnpath;
                    ?>
" id="stop"
							title="<?php 
                    echo gettext("Stop and return to album or image page");
                    ?>
"></a>
						<a href="#" id="pause"
							title="<?php 
                    echo gettext("Pause (to stop the slideshow without returning)");
                    ?>
"></a>
						<a href="#" id="play" title="<?php 
                    echo gettext("Play");
                    ?>
"></a> <a
							href="#" id="next" title="<?php 
                    echo gettext("Next");
                    ?>
"></a>
						</div>
						</div>
						<?php 
                }
                ?>
						<div id="slides" class="pics">
						<?php 
                if ($cntr > 1) {
                    $cntr = 1;
                }
                for ($imgnr = 0, $idx = $imagenumber; $imgnr <= $cntr; $idx++) {
                    if ($idx >= $numberofimages) {
                        $idx = 0;
                    }
                    if ($dynamic) {
                        $folder = $images[$idx]['folder'];
                        $dalbum = new Album($gallery, $folder);
                        $filename = $images[$idx]['filename'];
                        $image = newImage($dalbum, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename);
                    } else {
                        $folder = $album->name;
                        $filename = $images[$idx];
                        //$filename = $animage;
                        $image = newImage($album, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename);
                    }
                    $ext = is_valid($filename, $validtypes);
                    if ($ext) {
                        $imgnr++;
                        echo "<span class='slideimage'><h4><strong>" . $albumtitle . gettext(":") . "</strong> " . $image->getTitle() . " (" . ($idx + 1) . "/" . $numberofimages . ")</h4>";
                        if ($ext == "3gp") {
                            echo '</a>
												<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
												<param name="src" value="' . $imagepath . '"/>
												<param name="autoplay" value="false" />
												<param name="type" value="video/quicktime" />
												<param name="controller" value="true" />
												<embed src="' . $imagepath . '" width="352" height="304" autoplay="false" controller"true" type="video/quicktime"
												pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
												</object>
												<a>';
                        } elseif ($ext == "mov") {
                            echo '</a>
									 			<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="640" height="496" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
										 		<param name="src" value="' . $imagepath . '"/>
										 		<param name="autoplay" value="false" />
										 		<param name="type" value="video/quicktime" />
										 		<param name="controller" value="true" />
										 		<embed src="' . $imagepath . '" width="640" height="496" autoplay="false" controller"true" type="video/quicktime"
										 		pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
												</object>
												<a>';
                        } else {
                            makeImageCurrent($image);
                            printCustomSizedImageMaxSpace($alt = '', $width, $height, NULL, NULL, false);
                            //echo "<img src='".WEBPATH."/".ZENFOLDER."/i.php?a=".urlencode($folder)."&i=".urlencode($filename)."&s=".$imagesize."' alt='".html_encode($image->getTitle())."' title='".html_encode($image->getTitle())."' />\n";
                        }
                        if (getOption("slideshow_showdesc")) {
                            $desc = $image->getDesc();
                            $desc = str_replace("\r\n", '<br />', $desc);
                            $desc = str_replace("\r", '<br />', $desc);
                            echo "<p class='imgdesc'>" . $desc . "</p>";
                        }
                        echo "</span>";
                    }
                }
                break;
            case "flash":
                if ($heading) {
                    echo "<span class='slideimage'><h4><strong>" . $albumtitle . "</strong> (" . $numberofimages . " images) | <a style='color: white' href='" . $returnpath . "' title='" . gettext("back") . "'>" . gettext("back") . "</a></h4>";
                }
                echo "<span id='slideshow'></span>";
                ?>
 
					<script type="text/javascript">
					$("#slideshow").flashembed({
						  src:'<?php 
                echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                ?>
/flowplayer/FlowPlayerLight.swf',
						  width:<?php 
                echo getOption("slideshow_flow_player_width");
                ?>
,
						  height:<?php 
                echo getOption("slideshow_flow_player_height");
                ?>
						},
						{config: {
						  autoPlay: true,
						  useNativeFullScreen: true,
						  playList: [
													<?php 
                echo "\n";
                $count = 0;
                foreach ($images as $animage) {
                    if ($dynamic) {
                        $folder = $animage['folder'];
                        $filename = $animage['filename'];
                        $salbum = new Album($_zp_gallery, $folder);
                        $image = newImage($salbum, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($salbum->name) . "/" . urlencode($filename);
                    } else {
                        $folder = $album->name;
                        $filename = $animage;
                        $image = newImage($album, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . pathurlencode($filename);
                    }
                    $ext = is_valid($filename, array('jpg', 'jpeg', 'gif', 'png', 'flv', 'mp3', 'mp4'));
                    if ($ext) {
                        if ($ext == "flv" || $ext == "mp3" || $ext == "mp4") {
                            $duration = "";
                        } else {
                            $duration = ", duration: " . getOption("slideshow_speed") / 10;
                        }
                        if ($count > 0) {
                            echo ",\n";
                        }
                        echo "{ url: '" . FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename) . "'" . $duration . " }";
                        $count++;
                    }
                }
                echo "\n";
                ?>
												],
						  showPlayListButtons: true,
						  showStopButton: true,
						  controlBarBackgroundColor: 0,
						 	showPlayListButtons: true,
						 	controlsOverVideo: 'ease',
						 	controlBarBackgroundColor: '<?php 
                echo getOption('flow_player_controlbarbackgroundcolor');
                ?>
',
						  controlsAreaBorderColor: '<?php 
                echo getOption('flow_player_controlsareabordercolor');
                ?>
'
						}}
				  );
					</script> 
					<?php 
                echo "</span>";
                echo "<p>";
                printf(gettext("Click on %s on the right in the player control bar to view full size."), "<img style='position: relative; top: 4px; border: 1px solid gray' src='" . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . "/slideshow/flowplayerfullsizeicon.png' />");
                echo "</p>";
                break;
        }
        ?>
			</div>
		</div>
			<?php 
    }
Esempio n. 26
0
        }
        // Check that interest rate is numeric and not negative
        if ($label == $labels['interest']) {
            if (is_valid($_POST[$label]) && is_num_not_negative($_POST[$label]) == false) {
                echo "<li>" . $labels['interest'] . $rules['numeric_not_negative'] . "</li>";
            }
        }
        // Check for valid phone number
        if ($label == $labels['phone']) {
            if (is_valid($_POST[$label]) && is_valid_phone($_POST[$label]) == false) {
                echo "<li>" . $labels['phone'] . $rules['valid_phone'] . "</li>";
            }
        }
        // Check for valid email address
        if ($label == $labels['email']) {
            if (is_valid($_POST[$label]) && is_valid_email($_POST[$label]) == false) {
                echo "<li>" . $labels['email'] . $rules['valid_email'] . "</li>";
            }
        }
        // Check for empty checkbox array
        if ($label == $labels['contactTime']) {
            if ($_POST[$label] == []) {
                echo "<li>" . 'Since ' . $_POST[$labels['contactMethod']] . $rules['valid_contact_time'] . "</li>";
            }
        }
    }
    ?>

                    </ul>

                    <p>Please use the back button of your browser to navigate to the previous page, correct these errors and submit again.</p>
Esempio n. 27
0
if ($row && $row->user_id == $_SESSION['user_id']) {
    $ok = true;
}
if (isset($_SESSION['source_browser'])) {
    $ok = true;
}
if ($ok == true) {
    if ($row->user_id != $_SESSION['user_id']) {
        echo "<a href='mail.php?to_user={$row->user_id}&title={$MSG_SUBMIT} {$id}'>Mail the auther</a>";
    }
    echo "<pre id='errtxt'>";
    mysql_free_result($result);
    $sql = "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`='" . $id . "'";
    $result = mysql_query($sql);
    $row = mysql_fetch_object($result);
    if (is_valid($row->error)) {
        echo htmlspecialchars(str_replace("\n\r", "\n", $row->error));
    }
    echo "</pre>";
    echo "<div id='errexp'>Explain:</div>";
    mysql_free_result($result);
} else {
    mysql_free_result($result);
    echo "I am sorry, You could not view this message!";
}
?>
<script>
   var pats=new Array();
   var exps=new Array();
   pats[0]=/A Not allowed system call.* /;
   exps[0]="使用了系统禁止的操作系统调用,看看是否越权访问了文件或进程等资源";
 unset($msg);
 $salah = false;
 if (!$salah) {
     if (empty($f2_name)) {
         $msg = "Error: Please fill input field <u>Name</u>!";
         $salah = true;
     }
 }
 if (!$salah) {
     if (empty($f2_comment)) {
         $msg = "Error: Please fill input field <u>Comment</u>!";
         $salah = true;
     }
 }
 if (!$salah) {
     if (!is_valid($f2_comment)) {
         $msg = "Error: Input <u>Comment</u> Invalid!";
         $salah = true;
     }
 }
 if (!$salah) {
     if (strlen($f2_comment) > 1000) {
         $msg = "Error: Field <u>Comment</u> must be less than 1000 character!";
         $salah = true;
     }
 }
 if (!$salah) {
     if (md5($HTTP_POST_VARS['data']) == $HTTP_POST_VARS['md5']) {
         /*bugs, readed by spambot*/
         session_register("sesi_gambar");
     } else {