<?php
/**
 * This file is to upload the musics
 *
 * This file is having AudioActivate class to upload the musics
 *
 * PHP version 5.0
 *
 * @category	Anova
 * @package		Members
 * @author 		selvaraj_35ag05
 * @copyright 	Copyright (c) 2006 {@link http://www.agriya.com Agriya Infoway}
 * @license		http://www.agriya.com Agriya Infoway Licence
 * @version		SVN: $Id: $
 * @since 		2008-03-16
 *
 **/
require_once('../common/config.inc.php');
require_once('../common/configs/config_ans_audio.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/phpmailer/class_PHPMailer.lib.php';
$CFG['lang']['include_files'][] = 'common/email_templates/languages/%s/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');
/**
 * AudioActivate
 *
 * @package
 * @author selvaraj_35ag05
 * @copyright Copyright (c) 2008
 * @version $Id: $
 * @access public
 **/

set_time_limit(0);
class AudioActivate extends VideoUploadLib
	{
		public function populateAudioDetailsForEncode()
			{
				$sql = 'SELECT audio_id, content_id, user_id, audio_for FROM '.$this->CFG['db']['tbl']['ans_audio'].
						' WHERE audio_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['audio_for']);
									}

								$this->externalAudioEncode($row['audio_id']);

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