<?php
/**
 * This file is to upload the videos
 *
 * This file is having VideoActivate class to upload the videos
 *
 * PHP version 5.0
 *
 * @category	Anova
 * @package		Members
 * @author 		senthil_52ag05
 * @copyright 	Copyright (c) 2008 {@link http://www.agriya.com Agriya Infoway}
 * @license		http://www.agriya.com Agriya Infoway Licence
 * @version		SVN: $Id: $
 * @since 		2008-06-12
 *
 **/
require_once('../common/configs/config.inc.php');
require_once('../common/configs/config_ans_video.inc.php');
require_once('../common/configs/config_encoder.inc.php');
$CFG['mods']['include_files'][] = 'common/classes/class_FormHandler.lib.php';
$CFG['mods']['include_files'][] = 'common/classes/class_AnsVideoUpload.lib.php';
$CFG['mods']['include_files'][] = 'common/classes/class_Image.lib.php';
$CFG['mods']['include_files'][] = 'common/classes/swiftmailer/lib/EasySwift.php';
$CFG['lang']['include_files'][] =	'languages/%s/common/email_notify.inc.php';
$CFG['mods']['include_files'][] = 'common/classes/class_ftp.lib.php';
$CFG['mods']['is_include_only']['non_html_header_files'] = true;
$CFG['auth']['is_authenticate'] = false;
$CFG['html']['is_use_header'] = false;
$CFG['html']['is_use_footer'] = false;
require_once($CFG['site']['project_path'].'common/application_top.inc.php');
/**
 * VideoActivate
 *
 * @package
 * @author selvaraj_35ag05
 * @copyright Copyright (c) 2008
 * @version $Id: $
 * @access public
 **/

set_time_limit(0);
class VideoActivate extends VideoUploadLib
	{
		public function populateVideoDetailsForEncode()
			{
				$sql = 'SELECT video_id, content_id, user_id, video_for FROM '.$this->CFG['db']['tbl']['ans_video'].' WHERE video_encoded_status=\'No\'';

				$stmt = $this->dbObj->Prepare($sql);
				$rs = $this->dbObj->Execute($stmt);
				    if (!$rs)
					    trigger_db_error($this->dbObj);

				if($rs->PO_RecordCount())
					{
						while($row = $rs->FetchRow())
						    {
						    	$CFG['user']['name'] = 'admin/cron';
								$CFG['user']['user_id'] = '000';
								if ($this->CFG['debug']['store_log'])
									{
										$this->createErrorLogFile($row['video_for']);
									}

								$this->externalVideoEncode($row['video_id']);

								if ($this->CFG['debug']['store_log'])
									{
										$this->closeErrorLogFile();
									}
							}
					}
			}
	}
//<<<<<-------------- Class VideoActivate begins ---------------//
//-------------------- Code begins -------------->>>>>//
$VideoActivate = new VideoActivate();
$VideoActivate->setDBObject($db);
$VideoActivate->makeGlobalize($CFG, $LANG);
//default form fields and values...
if(!$CFG['admin']['ans_videos']['video_auto_encode'])
	{
		$VideoActivate->populateVideoDetailsForEncode();
	}
#require_once($CFG['site']['project_path'].'common/application_bottom.inc.php');
?>