Проблем при вземането на key от array

UmriWe

Registered
За много години пичове. Искам да помоля за малко помощ от ваша страна, че много съм зациклил над тоя проблем.. Знам, че е някаква малка грешка, но не мога да я открия ;р А.. Проблема е следния: Скрипта не може да генерира променливата ($key), която попринцип трябва да приема ИД на масива.. Ето го и кода (:
PHP:
Class movies_list extends Connection implements IDisplayMethods {

    function __construct() {
        $this->left = '';
        $this->right = '';
        $this->content = '';
        $this->lang = $_SESSION["lang_site"];
        Connection::__construct();
        $this->panel = new LeftRightPanel();
        $this->users = new users_login();
    }

    function getContent() {
        $this->content = $this->displayMovies();
        return $this->content;
    }

    function getLeftPart() {

        $this->left = $this->panel->ShowLefPart();
        return $this->left;
    }

    function getRightPart() {
        $this->right = $this->panel->Show_RightPart();
        return $this->right;
    }

    static function getMovieArray() {
        return array(
            1 =>
            array(
                "bg" => "",
                "eng" => "",
                "thumbnail" => "1_eng_Blagoevo_military_capm.png",
                "filename" => "1_eng_Blagoevo_military_capm.flv"),
            2 =>
            array(
                "bg" => "",
                "eng" => "",
                "thumbnail" => "",
                "filename" => "")
        );
    }

    static function getMovieArrayTR() {
        return array(
                       1 =>
            array(
                "bg" => "",
                "eng" => "",
                "thumbnail" => "1_eng_Blagoevo_military_capm.png",
                "filename" => "1_eng_Blagoevo_military_capm.flv"),
            2 =>
            array(
                "bg" => "",
                "eng" => "",
                "thumbnail" => "",
                "filename" => "")
        );
    }

    function displayMovies() {
        $username = '';
        $username = $this->users->getUsername();

        $moviesArrayTR = movies_list::getMovieArrayTR();
        $moviesArray = movies_list::getMovieArray();
        $page = 0;
        $moviesperpage = 6;
        $pagesintotal = count($moviesArray) / $moviesperpage;
        if (isset($_REQUEST["page"])) {
            $page = $_REQUEST["page"];
        }
        // echo "PAGE:$page"; exit;
        $moviesArray = array_slice($moviesArray, $page * $moviesperpage, $moviesperpage); //show 3 per page
        $moviesArrayTR = array_slice($moviesArrayTR, $page * $moviesperpage, $moviesperpage); //show 3 per page
        //select users activations with valid date
        $sql_activations = "SELECT * FROM activations WHERE type='movies' AND username='$username' AND activation_date > '" . date('Y-m-d H:i:s', time() - (3600 * 24 * 3)) . "'";
        $stmt_user_permission = $this->query_fetch($sql_activations);
        $activeMovieArrays = array();
        foreach ($stmt_user_permission as $key => $value) {
            $activeMovieArrays[] = $value['catid'];
            $movielang = $value['lang'];
            $movieatpage = $value['at_page'];
        }
        if (!isset($page)) {
            $moviepagea = 0;
        } else {
            $moviepagea = $page;
        }

        require('template/movies.php');
    }

    function getCurentRecipes($catid=0) {

        $rows_recipes = $this->query_fetch("SELECT * FROM recipes WHERE catid='$catid'");
        return $rows_recipes;
    }

}

?>
Ето го и темплейта ;р
Код:
  <div class="left contentWidth">
      <div class="ReklamniSlogani"><?php echo_text("MOVIES_TITLE1");?></div>
      <div class="clearfix betweenText">
        <font style="color: #FFF;" class="headerrText">
            <a href="http://macrofactor.com" class="headerrText"><?php echo_text("MOVIES_TITLE_HOME");?></a> 
            » <a href="http://macrofactor.com/konsultacii/" class="headerrText"><?php echo_text("MOVIES_TITLE2");?></a>   
        </font>
      </div>
      <font style="color: #FFF;" class="headerrText">
      
      <div class="clearfix">
          <table border="0" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td height="11" width="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/left_top_content.gif" height="11" width="11"></td>
                    <td background="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/bg_top_content.gif" height="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/blank.gif" height="1" width="1"></td>
                    <td height="11" width="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/right_top_content.gif" height="11" width="11"></td>
                </tr>
                <tr>
                    <td background="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/bg_left_content.gif" width="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/blank.gif" height="1" width="11"></td>
                    <td bgcolor="#FFFFFF">
                        <div style="margin: 14px 0px; color:red; font-size: 18px; font-weight: bold; text-align: center;">
						<?php echo_text("MOVIES_TITLE3"); ?>
						</div>
						<br><br>
						<table>
						<tr>
							<td width="50%">
								<div style="margin: 14px 0px; color:red; font-size: 18px; font-weight: bold; text-align: center;">
<?php echo_text("MOVIES_HEAD_DOCUMENTARY"); ?><br /><br />
									<?php echo_text("MOVIES_TITLE4"); ?>

								</div>
							</td>
							<td rowspan="2" bgcolor="gray"> 
							</td>
							<td width="50%">
								<div style="margin: 14px 0px; color:red; font-size: 18px; font-weight: bold; text-align: center;">
Belgesel film<br />
"Bulgaristan Yıkım ve yağma!"<br /><br />
									<?php echo_text("MOVIES_TITLE5"); ?>
								</div>
							</td>
						</tr>
						<tr><td>
							
							<table  cellpadding="10">
							<?php 
								$i = 0;
								if($this->lang == "tr")
								{
								$titlelang = "eng";
								}else{
								$titlelang = $this->lang;
								}
								foreach ($moviesArray as $value){ 
									$key = $value["key"];
									?>
									<tr><td width="50%"  valign="top">
										<?php
										if (in_array($key,$activeMovieArrays)) { ?>
											<a href="index.php?module=movies&action=play&movieid=<?php echo $key;?>" style="font-size:14px;">
												<font color="green" style="float:left; margin:0 1em 1em 0;">
										<img src="http://macrofactor.com/recepti/media/images/elems/bullet3.gif" /> <?php echo_text("MOVIES_LABEL_SERIES"); ?>
													<?php echo $value[$titlelang] ;?>
												</font>
												<br><center><img border="0" width="100" src="<?php echo MOVIE_PATH.$value["thumbnail"]; ?>"/></center>
											</a> 
										<?php } else {	?>
											<a href="" rel="<?php echo $key ;?>" name="<?php echo $username;?>" class="<?php echo ((!empty($username)) ? 'movies_dialog_open' : 'show_not_log'); ?>" style="font-size:14px;">
												<font style="vertical-align: text-top;"><img src="http://macrofactor.com/recepti/media/images/elems/bullet3.gif" /> <?php echo_text("MOVIES_LABEL_SERIES"); ?>
												<?php echo $value[$titlelang];?></font>
												<br><center><img border="0" width="100" src="<?php echo MOVIE_PATH.$value["thumbnail"]; ?>"/></center>
											</a> 
										<? } ?>
									</td></tr>
									<? 
									$i++;
								} ?>
								</table>
								</td><td valign="top">
								
								<table  cellpadding="10">
							<?php 
								$i = 0;
								$titlelang = $this->lang;
								foreach ($moviesArrayTR as $value){ 
									$key = $value["key"];
									?>
									<tr><td width="50%" valign="top">
										<?php
										if (in_array($key,$activeMovieArraysTR)) {?>
											
											<a href="index.php?module=movies&action=play&subslang=tr&movieid=<?php echo $key;?>" style="font-size:14px">
												<font color="green" style="float:left; margin:0 1em 1em 0;">
													<img src="http://macrofactor.com/recepti/media/images/elems/bullet3.gif" /> <?php echo_text("MOVIES_LABEL_SERIES"); ?>
													<?php echo $value[$titlelang] ;?>
												</font>
												<br><center><img border="0" width="100" src="<?php echo MOVIE_PATH.$value["thumbnail"]; ?>"/></center>
											</a> 
										<?php } else { ?>
                                                                                    
											<a href="" name="<?php echo $username;?>" rel="<?php echo $key; ?>" class="<?php echo ((!empty($username)) ? 'movies_dialog_open_tr' : 'show_not_log'); ?>" style="font-size:14px">
											<img src="http://macrofactor.com/recepti/media/images/elems/bullet3.gif" /> <font style="vertical-align: text-top;"><?php echo_text("MOVIES_LABEL_SERIES"); ?>
												<?php echo $value[$titlelang];?></font>
												<br><center><img border="0" width="100" src="<?php echo MOVIE_PATH.$value["thumbnail"]; ?>"/></center>
											</a> 
										<? } ?>
									</td></tr>
									<? 
									// if (($i%2) ==1){
										// echo "</tr>";
									// }
									$i++;
								} ?>
								</table>
								<br>
								<br>
								<div style="padding:15;font-size: 14px;color:red;" align="center" width="100%" >
									Türkçe altyazılı yeni seri birkaç gün bekleyin.
								</div>
								</td>
							</tr>
						</table>
						<br>
						<br>
						<div style="padding:15;" align="center" width="100%">
						<?php 
						for ($i=0 ; $i<$pagesintotal ; $i++){
							$spancolor="#DBCAB0";
							$textcolor="black";
							if ($page == $i){
								$spancolor="#3C3932";
								$textcolor="white";
							}							
							?>
							<span STYLE="padding:4px; background-color: <?php echo $spancolor; ?>; ">
								<a href="index.php?module=movies&action=list&page=<?php echo $i; ?>" bgcolor="gray">
									<font color="<?php echo $textcolor; ?>">
										<b><?php echo $i+1 ; ?></b>
									</font>
								</a>
							</span>
								<?php if ($i+1 < $pagesintotal) { 
									echo " | ";
								 }
						} ?>
						</div>
						<br>
						<br>
						<br>
                        <div class="CursorPointer2" style="text-align:center; color:#f21020;" onclick="location.href='/p/reklama/';"><?php echo_text("MOVIES_LABEL_BOTTOMAD");?></div>
                        <div class="clear Vraz10"></div>
                    </td>
                    <td background="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/bg_right_content.gif" width="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/blank.gif" height="1" width="11"/></td>
                </tr>
                <tr>
                    <td height="11" width="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/left_bottom_content.gif" height="11" width="11"/></td>
                    <td background="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/bg_bottom_content.gif" height="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/blank.gif" height="1" width="1"/></td>
                    <td height="11" width="11"><img src="<?php echo SITE_HTTP_PATH ;?>/media/images/elems/right_bottom_content.gif" height="11" width="11"/></td>
                </tr>
            </tbody>
        </table>
  </div>

 
  </font></div><font style="color: #FFF;" class="headerrText"></font>
  
  <div id="movies_dialog" title="<?php echo_text("MOVIES_LABEL_ACTIVATION");?>" style="display: none;">
        <?php echo_text("MOVIES_LABEL_ACTIVATION2");?><br /><?php echo_text("MOVIES_LABEL_ACTIVATION3");?>
		<div class="error_activation" style="color: red;"></div>
        <?php echo_text("GLOBAL_POPUP_CODE");?><input type="text" id="code"/>
        <input type="submit" id="movies_payment" value="<?php echo_text("GLOBAL_POPUP_ACTIVATE");?>"/>
        <input type="hidden"  id="movie_category_activation"/><br />
	<input type="hidden"  id="movie_lang" value="eng"/><br />
	<input type="hidden"  id="movie_at_page" value="<?php echo $moviepagea; ?>"/><br />
	<?php echo_text("MOVIES_MAKEPAYMENT"); ?>:
4.80 BGN. (EUR 2.40), (USD 3.30), (GBP 2.09) , (CHF 3.17), (TRY 6,046), (DKK 18.25), (NOK 18.88), (SEK 22.13) including VAT<br />
                <a href="" id="movie_paypal">
	<?php
	foreach(range(1, 10) as $num){
	echo "<img src='".SITE_HTTP_PATH."/media/images/cards/medium/$num.png' /> ";
	}
	?>
	</a>

    </div>
  <div id="movies_dialog_tr" title="<?php echo_text("MOVIES_LABEL_ACTIVATION");?>" style="display: none;">
        <?php echo_text("MOVIES_LABEL_ACTIVATION2");?><br /><?php echo_text("MOVIES_LABEL_ACTIVATION3");?>

		<div class="error_activation" style="color: red;"></div>
                <img src="<?php echo SITE_HTTP_PATH ;?>/media/images/flags/flag_tr.png" width="24" heigh="24" border="0"/> <font style="padding-top: 3px; position: absolute;"><b>- Metin TXT MCFR kısa numarası 6662 SMS göndermek Türkiye'den ise. <br />  SMS başına fiyat - 10 TRY</b></font><br /><br />
        <?php echo_text("GLOBAL_POPUP_CODE");?><input type="text" id="code_tr"/>
        <input type="submit" id="movies_payment_tr" value="<?php echo_text("GLOBAL_POPUP_ACTIVATE");?>"/>
        <input type="hidden"  id="movie_category_activation_tr"/><br />
	<input type="hidden"  id="movie_lang_tr" value="tr"/><br />
	<input type="hidden"  id="movie_at_page_tr" value="<?php echo $moviepagea; ?>"/><br />
	<?php echo_text("MOVIES_MAKEPAYMENT"); ?>:
4.80 BGN. (EUR 2.40), (USD 3.30), (GBP 2.09) , (CHF 3.17), (TRY 6,046), (DKK 18.25), (NOK 18.88), (SEK 22.13) including VAT<br />
        <a href="" id="movie_paypal_tr">
	<?php
	foreach(range(1, 10) as $num){
	echo "<img src='".SITE_HTTP_PATH."/media/images/cards/medium/$num.png' /> ";
	}
	?>
	</a>

    </div>
Благодаря ви предварително :)
 

Back
Горе