Location: PHPKode > projects > ICamp Codebase > videowiki_0.7/video.php
<?php
	

//header('Content-Type: text/html; charset=utf-8');

/**
 * 		Set Errors reporting.	
 */
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Europe/Vilnius');
ini_set('display_errors', 1);
// Set the include path
        set_include_path(
              dirname(__FILE__) . '/library'
            . PATH_SEPARATOR
            . get_include_path()
        );

/**
 * 		Zend Loader
 */
require('Zend/Loader.php');


/**
 * 		Requered Classes
 */
Zend_Loader::loadClass('Zend_Config_Ini');
Zend_Loader::loadClass('Zend_Controller_Front');
Zend_Loader::loadClass('Zend_Db');
Zend_Loader::loadClass('Zend_Db_Table');
Zend_Loader::loadClass('Zend_View');
Zend_Loader::loadClass('Zend_Registry');
Zend_Loader::loadClass('Zend_Debug');
Zend_Loader::loadClass('Zend_Auth');
Zend_Loader::loadClass('Zend_Form');


/**
 * 		Config Ini
 */
$config = new Zend_Config_Ini('app/etc/config.ini', 'DevelopmentMode');

/*
 * 		Setup Controllers
 */
$db = Zend_Db::factory($config->database->adapter, $config->database->params->toArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);


	
	$found = false;
	$title="";
	$namespace="";
	$author="";

	  if(array_key_exists("title", $_GET))
        $title=$_GET['title'];
    
    if(array_key_exists("namespace", $_GET))
        $namespace=$_GET['namespace'];
        
    if(array_key_exists("author", $_GET))
        $author=$_GET['author'];
	
  //$row = $db->fetchAll('SELECT site_catalog_id FROM site_data WHERE value = HARD');

  $db = Zend_Registry::get('db');

	$tmp1 = $db->fetchAll('SELECT * FROM `site_data` as sd, `site_catalog` as sc  WHERE sd.`value`="'.$title.'" AND sc.`name`="'.$namespace.'" AND sd.`site_catalog_id`=sc.`site_catalog_id`');	
  $tmp2 = $db->fetchAll('SELECT * FROM `site_data` as sd, `site_catalog` as sc  WHERE sd.`value`="'.$author.'" AND sc.`name`="'.$namespace.'" AND sd.`site_catalog_id`=sc.`site_catalog_id`');	

  foreach ($tmp1 as $elem1){
			foreach ($tmp2 as $elem2){	
        		if ($elem1['site_catalog_id'] == $elem2['site_catalog_id']){
        		   $found=true;
        		   $url= $elem1['site_catalog_id'];
        		   $location = $config->webhost;
        		   $addurl = $location."list/video/id/".$url;
        		   header("Location: $addurl"); 
               exit;
            }
      }
	}
	
	if ($found==false){	
  $location = $config->webhost;
	$addurl = $location."addvideo?namespace=".$namespace."&title=".$title."&author=".$author;
  header("Location: $addurl"); 
  exit;
  }
	


	//print "asdasd";
	
	
?>
Return current item: ICamp Codebase