/**
	 * quickbox::__construct()
	 *
	 * @param array $init Initialization configuration
	 *
	 * Constructor which basically creates quickbox
	 * and readies it for doing things.
	 */
	public function __construct ($init)
	{
		# We need to include initialize the config class because it allows us to get and
		# set configuration variables without using a global
		require $init['quickbox/path'] . '/classes/core/config.class.php';
		config::init($init);
		define(DEBUG, config::get('debug'));
		# Start a database connection
		$this->db = new database();
		try
		{
			$this->db->init();
		} catch (Exception $e)
		{
			trigger_error(text::get('system/fatalError',$e->getMessage()), E_USER_ERROR);
		}
		require $init['quickbox/path'] . '/classes/core/metaclass.class.php';
		metaclass::init($this->db);
		# Put the post and get variables into a private for later use.
		$_POST = $_POST;
		$this->qbGet = $_GET;
		# Start the session, giving it the database connection.
		$this->qbSession = new session($this->db);
		if ($this->qbGet['page'] == 'logout')
		{
			$this->qbSession->logout();
		}
		$this->qbSession->checkCookie();
		if (strlen($_POST['user']) > 0 && $_POST['login'] == 1)
		{
			$this->qbErrors['login'] = $this->qbSession->login($_POST['user'], $_POST['password']);
		}
		$this->qbPage = ($_GET['page'] ? janitor::cleanData($_GET['page']) : 'home');
	}
	public function login ($user, $password)
	{
		$safeUser = janitor::cleanData($user, 'sql');
		$query = new query();
		$query->select()->from('userUsers')->joinLeft('userGroups', 'userUsers.group', 'id')->where('username', $user)->limit(
		'1');
		$result = $this->sDb->query($query);
		if ($this->sDb->numRows($result) > 0)
		{
			$row = $this->sDb->assoc($result);
			$safePassword = janitor::passwd($password, $row['salt']);
			if ($safePassword['passwd'] == $row['password'])
			{
				$this->user = $user;
				$this->userData = $row;
				$this->setCookie($user, $row['email']);
				$this->setSession($safeUser);
				return false;
			} else
			{
				return text::get('login/failedLogin');
			}
		} else
		{
			return text::get('login/failedLogin');
		}
	}
Exemple #3
0
	function form ($action, $method = 'post', $id = null, $invalid = false, $title = false, $submitted = false)
	{
		$this->header .= '<form action="' . $action . '" method="' . $method . '"' . ($id ? " id=\"$id\"" : null) . '><fieldset>';
		if ($title)
		{
			$this->header .= '<h2>' . $title . '</h2>';
		}
		if ($submitted)
		{
			$this->header .= '<br/>';
			if (count($invalid) > 0)
			{
				$this->header .= '<h6>' . text::get('validation/errorsProcessing') . '</h6><br/>';
				foreach ($invalid as $k => $v)
				{
					$this->header .= '<p class="error">' . $v . '</p>';
				}
			} else
			{
				$this->header .= '<p class="success">' . text::get('validation/success') . '</p>';
			}
		}
		$this->footer .= '
	<p>
	      <button type="submit" class="button positive">
      	<img src="' . config::get(
		'site/htmlRoot') . 'css/blueprint/plugins/buttons/icons/tick.png" alt="Save"/> ' . text::get('form/save') . '
      </button>
      		  	  <button type="reset" class="button negative">
  	    <img src="' .
		 config::get('site/htmlRoot') . 'qbres/images/no.png" alt="Reset"/> ' . text::get(
		'form/reset') . '
  	  </button></p>
</fieldset></form>';
	}
    echo "access denied";
    exit;
}
//get http post variables and set them to php variables
$reference_language = $_SESSION['domain']['language']['code'];
$target_language = check_str($_GET["target_language"]);
$app_target = 'resources';
if (count($_POST) > 0) {
    //set the variables
    $reference_language = check_str($_POST["reference_language"]);
    $target_language = check_str($_POST["target_language"]);
    $app_target = check_str($_POST["app_target"]);
}
//collect languages
$language = new text();
$language_text = $language->get('all', $app_target, true);
foreach ($language_text as $lang_label => $lang_codes) {
    $language_labels[] = $lang_label;
    $reference_text[$lang_label] = $lang_codes[$reference_language];
    $target_text[$lang_label] = $lang_codes[$target_language];
}
sort($language_labels);
if ($app_target != 'resources') {
    $global_text = $language->get($reference_language, 'resources', true);
}
unset($language_text);
//add multi-lingual support
$text = $language->get();
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$app_list;
Exemple #5
0
			if (recording_audio.currentTime > 0) {
				value = (100 / recording_audio.duration) * recording_audio.currentTime;
			}
			recording_progress.style.width = value + "%";
		}

</script>

<!--{head}-->

</head>

<?php 
//add multi-lingual support
$language = new text();
$text = $language->get(null, 'themes/default');
?>

<body onload="<?php 
echo $onload;
?>
">

	<div id='message_container' class='message_container_mood_default'></div>
	<div id='message_text' class='message_container_text_default'></div>

	<?php 
//logged in show the domains block
if (strlen($_SESSION["username"]) > 0 && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
    ?>
		<div id="domains_container">
Exemple #6
0
<hr class="space"/>
<div class="span-8 prepend-1 int_content">

<h1><?php echo text::get('auth/notAuthTitle') ?></h1>
<p><?php echo text::get('auth/notAuth') ?></p>

  <?php
		include $this->tplPathComponent('loginBox');
		?>
</div>
	/**
	 * database::query()
	 *
	 * @param string $query The query to be fed to the database.
	 * @return mixed Returns the result of the query.
	 */
	public function query ($query)
	{
		global $totalquery;
		$totalquery++;
		if ($result = mysql_query($query, $this->connection))
		{
			return $result;
		} else
		{
			if (config::get('debug'))
			{
				$debugdata = debug_backtrace();
				$debugData = $debugdata[0]['file'] . ', line ' . $debugdata[0]['line'];
			}
			trigger_error(
					text::get('system/dbError') . (config::get('debug') ? ' ' . mysql_error() . '<br/>[ Called from: ' .
							 $debugData . ' ]<br/>' : null), E_USER_ERROR);
			return false;
		}
	}
 public function select()
 {
     //build the list of categories
     $music_on_hold_dir = $_SESSION["switch"]["sounds"]["dir"] . "/music";
     if (count($_SESSION['domains']) > 1) {
         $music_on_hold_dir = $music_on_hold_dir . "/" . $_SESSION['domain_name'];
     }
     //add multi-lingual support
     $language = new text();
     $text = $language->get($_SESSION['domain']['language']['code'], 'app/music_on_hold');
     //start the select
     $select = "\t<select class='formfld' name='" . $this->select_name . "' id='" . $this->select_name . "' style='width: auto;'>\n";
     $select .= "\t\t<option value='' style='font-style: italic;'>" . $text['opt-default'] . "</option>\n";
     //categories
     $array = glob($music_on_hold_dir . "/*/*", GLOB_ONLYDIR);
     //list the categories
     $moh_xml = "";
     foreach ($array as $moh_dir) {
         //set the directory
         $moh_dir = substr($moh_dir, strlen($music_on_hold_dir . "/"));
         //get and set the rate
         $sub_array = explode("/", $moh_dir);
         $moh_rate = end($sub_array);
         //set the name
         $moh_name = $moh_dir;
         $moh_name = substr($moh_dir, 0, strlen($moh_name) - strlen($moh_rate));
         $moh_name = rtrim($moh_name, "/");
         if (count($_SESSION['domains']) > 1) {
             $moh_value = "local_stream://" . $_SESSION['domain_name'] . "/" . $moh_name;
         } else {
             $moh_value = "local_stream://" . $moh_name;
         }
         $options[$moh_value] = str_replace('_', ' ', $moh_name);
     }
     if (sizeof($options) > 0) {
         foreach ($options as $moh_value => $moh_name) {
             $select .= "<option value='" . $moh_value . "' " . ($this->select_value == $moh_value ? 'selected="selected"' : null) . ">" . $moh_name . "</option>\n";
         }
     }
     //recordings
     $recordings_dir = $_SESSION['switch']['recordings']['dir'] . "/" . $_SESSION['domain_name'] . "/";
     if ($dh = opendir($recordings_dir)) {
         $tmp_selected = false;
         $files = array();
         //$select .= "<optgroup label='recordings'>\n";
         while ($file = readdir($dh)) {
             if ($file != "." && $file != ".." && $file[0] != '.') {
                 if (is_dir($recordings_dir . $file)) {
                     //this is a directory
                 } else {
                     if ($this->select_value == $recordings_dir . $file && strlen($this->select_value) > 0) {
                         $tmp_selected = true;
                         $select .= "\t\t<option value='" . $recordings_dir . $file . "' selected='selected'>" . $file . "</option>\n";
                     } else {
                         $select .= "\t\t<option value='" . $recordings_dir . $file . "'>" . $file . "</option>\n";
                     }
                 }
             }
         }
         closedir($dh);
         //$select .= "</optgroup>\n";
     }
     //add additional options
     $select .= $this->select_options;
     //end the select and return it
     $select .= "\t</select>\n";
     return $select;
 }
Exemple #9
0
		recording_audio = document.getElementById('recording_audio_'+recording_id);
		var recording_progress = document.getElementById('recording_progress_'+recording_id);
		var value = 0;
		if (recording_audio.currentTime > 0) {
			value = (100 / recording_audio.duration) * recording_audio.currentTime;
		}
		recording_progress.style.width = value + "%";
	}
</script>

</head>

<?php 
//add multi-lingual support
$language = new text();
$text = $language->get(null, 'themes/minimized');
// set message_onload
if (strlen($_SESSION['message']) > 0) {
    $message_text = addslashes($_SESSION['message']);
    $message_mood = $_SESSION['message_mood'];
    $message_delay = $_SESSION['message_delay'];
    $onload .= "display_message('" . $message_text . "'";
    $onload .= $message_mood != '' ? ", '" . $message_mood . "'" : ", 'default'";
    if ($message_delay != '') {
        $onload .= ", '" . $message_delay . "'";
    }
    $onload .= "); ";
    unset($_SESSION['message'], $_SESSION['message_mood'], $_SESSION['message_delay']);
}
?>
 public function get()
 {
     //add multi-lingual support
     $language = new text();
     $text = $language->get(null, 'app/music_on_hold');
     //get moh records, build array
     $sql = "select ";
     $sql .= "d.domain_name, m.* ";
     $sql .= "from v_music_on_hold as m ";
     $sql .= "left join v_domains as d ON d.domain_uuid = m.domain_uuid ";
     $sql .= "where (m.domain_uuid = '" . $this->domain_uuid . "' or m.domain_uuid is null) ";
     $sql .= "order by m.domain_uuid desc, music_on_hold_rate asc, music_on_hold_name asc";
     $prep_statement = $this->db->prepare(check_sql($sql));
     $prep_statement->execute();
     return $prep_statement->fetchAll(PDO::FETCH_NAMED);
 }
Exemple #11
0
 public function select($name, $selected)
 {
     //add multi-lingual support
     $language = new text();
     $text = $language->get();
     //start the select
     $select = "<select class='formfld' name='" . $name . "' id='" . $name . "' style='width: auto;'>\n";
     //music list
     if (count($this->music_list) > 0) {
         $select .= "\t<optgroup label='" . $text['label-music_on_hold'] . "'>\n";
         $previous_name = '';
         foreach ($this->music_list as $row) {
             if ($previous_name != $row['music_on_hold_name']) {
                 $name = '';
                 if (strlen($row['domain_uuid']) > 0) {
                     $name = $row['domain_name'] . '/';
                 }
                 $name .= $row['music_on_hold_name'];
                 $select .= "\t\t<option value='local_stream://" . $name . "' " . ($selected == "local_stream://" . $name ? 'selected="selected"' : null) . ">" . $row['music_on_hold_name'] . "</option>\n";
             }
             $previous_name = $row['music_on_hold_name'];
         }
         $select .= "\t</optgroup>\n";
     }
     //recordings
     if (sizeof($this->recordings_list) > 0) {
         $select .= "\t<optgroup label='" . $text['label-recordings'] . "'>";
         foreach ($this->recordings_list as $recording_value => $recording_name) {
             $select .= "\t\t<option value='" . $recording_value . "' " . ($selected == $recording_value ? 'selected="selected"' : '') . ">" . $recording_name . "</option>\n";
         }
         $select .= "\t</optgroup>\n";
     }
     //ringbacks
     if (sizeof($this->ringbacks) > 0) {
         $selected_ringback = $selected;
         $selected_ringback = preg_replace('/\\A\\${/', "", $selected_ringback);
         $selected_ringback = preg_replace('/}\\z/', "", $selected_ringback);
         $select .= "\t<optgroup label='" . $text['label-ringback'] . "'>";
         //$select .= "		<option value='default_ringback'".(($selected == "default_ringback") ? ' selected="selected"' : '').">".$text['label-default']." (".$this->default_ringback_label.")</option>\n";
         foreach ($this->ringbacks as $ringback_value => $ringback_name) {
             $select .= "\t\t<option value='\${" . $ringback_value . "}'" . ($selected_ringback == $ringback_value ? ' selected="selected"' : '') . ">" . $ringback_name . "</option>\n";
         }
         $select .= "\t</optgroup>\n";
         unset($selected_ringback);
     }
     //end the select and return it
     $select .= "</select>\n";
     return $select;
 }
Exemple #12
0
<hr class="space"/>
<div class="span-8 prepend-1 int_content">
<h1><?php echo text::get('system/404title') ?></h1>

<p><?php echo text::get('system/404text') ?>.</p></div>
	public function makeTable ($fields = false)
	{
		if (! $fields)
		{
			$fields[] = 'id';
			foreach ($this->definitions as $k => $v)
			{
				if ($v['ontable'])
				{
					$fields[] = $k;
				}
				if ($v['linkfield'])
				{
					$linkfield = $k;
				}
			}
		}
		$fields2['id'] = "ID";
		foreach ($fields as $v)
		{
			$fields2[$v] = $this->definitions[$v]['title'];
		}
		$fields2['delete'] = "";
		$table = new table($fields2, array (
			'class' => 'span-16'
		));
		$fieldsList = metaclass::getItems($this->table, $fields, $this->keyField);
		foreach ($fieldsList as $k => $v)
		{
			$v['delete'] = text::get('form/delete');
			$table->addRow($v, 
					array (
						$linkfield => array (
							'type' => 'link' , 
							'href' => $this->urlbase . '?id=' . $v['id']
						) , 
						'delete' => array (
							'type' => 'link' , 
							'href' => 'javascript:deleteitem(\'' . $v['id'] . '\',\'' . janitor::cleanData(
									$v['title']) . '\',\'' . $this->urlbase . '\')'
						)
					));
		}
		return $table->output();
	}
	/**
	 * Makes sure a class file is loaded. If it cannot, skip it. If it can, add it to the list of loaded classes.
	 * This doesn't return anything. It either loads the class and proceeds, sees the class is loaded and proceeds,
	 * or fails to find the class and throws an exception.
	 *
	 * @param string $class Name of the class.
	 * @param string $rel Extra path to the class, used for datatypes primarily.
	 */
	public static function loadClass ($class, $rel = null)
	{
		try
		{
			$classString = ($rel ? $rel . '/' : null) . $class;
			if (! in_array($classString, metaclass::$classesLoaded))
			{
				$siteMetaPath = config::get('site/path') . '/metaclasses/' . ($rel ? $rel . '/' : null) . $class . '.class.php';
				$quickboxMetaPath = config::get('quickbox/path') . '/metaclasses/' . ($rel ? $rel . '/' : null) . $class .
						 '.class.php';
				$path = file_exists($siteMetaPath) ? $siteMetaPath : $quickboxMetaPath;
				if (file_exists($path))
				{
					# Require the $class file path.
					require_once $path;
					metaclass::$classesLoaded[] = $classString;
				} else
				{
					# If the class file is missing, we're f****d.
					throw new Exception(text::get('metaclass/missingClassFile', $class));
				}
			}
		} catch (Exception $e)
		{
			trigger_error($e->getMessage(), E_USER_ERROR);
		}
	}
 /**
  * Get the destination menu
  * @var string $destination_type can be ivr, dialplan, call_center_contact or bridge
  * @var string $destination_name - current name
  * @var string $destination_value - current value
  */
 public function select($destination_type, $destination_name, $destination_value)
 {
     //remove special characters from the name
     $destination_id = str_replace("]", "", $destination_name);
     $destination_id = str_replace("[", "_", $destination_id);
     //add additional
     if (if_group("superadmin")) {
         $response = "<script>\n";
         $response .= "var Objs;\n";
         $response .= "\n";
         $response .= "function changeToInput" . $destination_id . "(obj){\n";
         $response .= "\ttb=document.createElement('INPUT');\n";
         $response .= "\ttb.type='text';\n";
         $response .= "\ttb.name=obj.name;\n";
         $response .= "\ttb.className='formfld';\n";
         $response .= "\ttb.setAttribute('id', '" . $destination_id . "');\n";
         $response .= "\ttb.setAttribute('style', '" . $select_style . "');\n";
         if ($onchange != '') {
             $response .= "\ttb.setAttribute('onchange', \"" . $onchange . "\");\n";
             $response .= "\ttb.setAttribute('onkeyup', \"" . $onchange . "\");\n";
         }
         $response .= "\ttb.value=obj.options[obj.selectedIndex].value;\n";
         $response .= "\tdocument.getElementById('btn_select_to_input_" . $destination_id . "').style.visibility = 'hidden';\n";
         $response .= "\ttbb=document.createElement('INPUT');\n";
         $response .= "\ttbb.setAttribute('class', 'btn');\n";
         $response .= "\ttbb.setAttribute('style', 'margin-left: 4px;');\n";
         $response .= "\ttbb.type='button';\n";
         $response .= "\ttbb.value=\$('<div />').html('&#9665;').text();\n";
         $response .= "\ttbb.objs=[obj,tb,tbb];\n";
         $response .= "\ttbb.onclick=function(){ Replace" . $destination_id . "(this.objs); }\n";
         $response .= "\tobj.parentNode.insertBefore(tb,obj);\n";
         $response .= "\tobj.parentNode.insertBefore(tbb,obj);\n";
         $response .= "\tobj.parentNode.removeChild(obj);\n";
         $response .= "\tReplace" . $destination_id . "(this.objs);\n";
         $response .= "}\n";
         $response .= "\n";
         $response .= "function Replace" . $destination_id . "(obj){\n";
         $response .= "\tobj[2].parentNode.insertBefore(obj[0],obj[2]);\n";
         $response .= "\tobj[0].parentNode.removeChild(obj[1]);\n";
         $response .= "\tobj[0].parentNode.removeChild(obj[2]);\n";
         $response .= "\tdocument.getElementById('btn_select_to_input_" . $destination_id . "').style.visibility = 'visible';\n";
         if ($onchange != '') {
             $response .= "\t" . $onchange . ";\n";
         }
         $response .= "}\n";
         $response .= "</script>\n";
         $response .= "\n";
     }
     //set default to false
     $select_found = false;
     $response .= "\t<select name='" . $destination_name . "' id='" . $destination_id . "' class='formfld' style='" . $select_style . "' onchange=\"" . $onchange . "\">\n";
     $response .= "\t\t\t<option value=''></option>\n";
     foreach ($this->destinations as $row) {
         $name = $row['name'];
         $label = $row['label'];
         $destination = $row['field']['destination'];
         //add multi-lingual support
         if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/" . $name . "/app_languages.php")) {
             $language2 = new text();
             $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/' . $name);
         }
         if (count($row['result']['data']) > 0 and strlen($row['select_value'][$destination_type]) > 0) {
             $response .= "\t\t<optgroup label='" . $text2['title-' . $label] . "'>\n";
             $label2 = $label;
             foreach ($row['result']['data'] as $data) {
                 $select_value = $row['select_value'][$destination_type];
                 $select_label = $row['select_label'];
                 foreach ($row['field'] as $key => $value) {
                     if ($key == 'destination' and is_array($value)) {
                         if ($value['type'] == 'csv') {
                             $array = explode($value['delimiter'], $data[$key]);
                             $select_value = str_replace("\${destination}", $array[0], $select_value);
                             $select_label = str_replace("\${destination}", $array[0], $select_label);
                         }
                     } else {
                         if (strpos($value, ',') !== false) {
                             $keys = explode(",", $value);
                             foreach ($keys as $k) {
                                 if (strlen($data[$k]) > 0) {
                                     $select_value = str_replace("\${" . $key . "}", $data[$k], $select_value);
                                     if (strlen($data['label']) == 0) {
                                         $select_label = str_replace("\${" . $key . "}", $data[$k], $select_label);
                                     } else {
                                         $label = $data['label'];
                                         $select_label = str_replace("\${" . $key . "}", $text2['option-' . $label], $select_label);
                                     }
                                 }
                             }
                         } else {
                             $select_value = str_replace("\${" . $key . "}", $data[$key], $select_value);
                             if (strlen($data['label']) == 0) {
                                 $select_label = str_replace("\${" . $key . "}", $data[$key], $select_label);
                             } else {
                                 $label = $data['label'];
                                 $select_label = str_replace("\${" . $key . "}", $text2['option-' . $label], $select_label);
                             }
                         }
                         //application: hangup
                         if (strlen($data['application']) > 0) {
                             $select_value = str_replace("transfer", $data['application'], $select_value);
                         }
                     }
                 }
                 $select_value = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_value);
                 $select_value = str_replace("\${context}", $_SESSION['context'], $select_value);
                 //to do: context can come from the array
                 $select_label = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_label);
                 $select_label = str_replace("\${context}", $_SESSION['context'], $select_label);
                 $select_label = trim($select_label);
                 if ($select_value == $destination_value) {
                     $selected = "selected='selected' ";
                     $select_found = true;
                 } else {
                     $selected = '';
                 }
                 if ($label2 == 'destinations') {
                     $select_label = format_phone($select_label);
                 }
                 $response .= "\t\t\t<option value='" . $select_value . "' " . $selected . ">" . $select_label . "</option>\n";
             }
             $response .= "\t\t</optgroup>\n";
             unset($text);
         }
     }
     if (!$select_found) {
         $destination_label = str_replace(":", " ", $destination_value);
         $destination_label = str_replace("menu-exec-app:", " ", $destination_label);
         $response .= "\t\t\t<option value='" . $destination_value . "' selected='selected'>" . trim($destination_label) . "</option>\n";
     }
     $response .= "\t</select>\n";
     if (if_group("superadmin")) {
         $response .= "<input type='button' id='btn_select_to_input_" . $destination_id . "' class='btn' name='' alt='back' onclick='changeToInput" . $destination_id . "(document.getElementById(\"" . $destination_id . "\"));this.style.visibility = \"hidden\";' value='&#9665;'>";
     }
     //return the formatted destinations
     return $response;
 }
Exemple #16
0
		recording_audio = document.getElementById('recording_audio_'+recording_id);
		var recording_progress = document.getElementById('recording_progress_'+recording_id);
		var value = 0;
		if (recording_audio.currentTime > 0) {
			value = (100 / recording_audio.duration) * recording_audio.currentTime;
		}
		recording_progress.style.width = value + "%";
	}
</script>

</head>

<?php 
//add multi-lingual support
$language = new text();
$text = $language->get(null, 'themes/enhanced');
// set message_onload
if (strlen($_SESSION['message']) > 0) {
    $message_text = addslashes($_SESSION['message']);
    $message_mood = $_SESSION['message_mood'];
    $message_delay = $_SESSION['message_delay'];
    $onload .= "display_message('" . $message_text . "'";
    $onload .= $message_mood != '' ? ", '" . $message_mood . "'" : ", 'default'";
    if ($message_delay != '') {
        $onload .= ", '" . $message_delay . "'";
    }
    $onload .= "); ";
    unset($_SESSION['message'], $_SESSION['message_mood'], $_SESSION['message_delay']);
}
?>
			window.location= url + "<?php
			echo janitor::getUrlString("&delete=")?>" + id
		}
	}
	// -->
</script>


<?php if($_GET['mode'] != 'single' && !$_GET['id']): ?>

<h5><button type="button" onclick="window.location= '<?php
echo $tData['baseurl']?>?mode=single'" class="button neutral"><img src="<?php
		 echo config::get('site/htmlRoot')?>qbres/images/new.png"/> <?php echo text::get('scaffold/createnew') ?></button></h5>
<hr />

<?php
echo $tData['table']?>


<?php else: ?>
<h5><button type="button" onClick="window.location = '<?php
echo $tData['baseurl']?>?mode='" class="button neutral"> <img src="<?php
		 echo config::get('site/htmlRoot')?>qbres/images/back.png"/><?php echo text::get('scaffold/returntoitems') ?></button></h5>

<hr />

<?php
echo $tData['form']?>

<?php endif; ?>
Exemple #18
0
 public function schema($format)
 {
     //set the global variable
     global $db, $db_type, $db_name, $db_username, $db_password;
     global $db_host, $db_path, $db_port, $upgrade_data_types, $text;
     //get the PROJECT PATH
     include "root.php";
     //add multi-lingual support
     if (!isset($text)) {
         $language = new text();
         $text = $language->get(null, 'core/upgrade');
     }
     //PHP PDO check if table or column exists
     //check if table exists
     // SELECT * FROM sqlite_master WHERE type='table' AND name='v_cdr'
     //check if column exists
     // SELECT * FROM sqlite_master WHERE type='table' AND name='v_cdr' AND sql LIKE '%caller_id_name TEXT,%'
     //aditional information
     // http://www.sqlite.org/faq.html#q9
     //postgresql
     //list all tables in the database
     // SELECT table_name FROM pg_tables WHERE schemaname='public';
     //check if table exists
     // SELECT * FROM pg_tables WHERE schemaname='public' AND table_name = 'v_groups'
     //check if column exists
     // SELECT attname FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'v_cdr') AND attname = 'caller_id_name';
     //mysql
     //list all tables in the database
     // SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = 'fusionpbx'
     //check if table exists
     // SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema = 'fusionpbx' AND TABLE_NAME = 'v_groups'
     //check if column exists
     // SELECT * FROM information_schema.COLUMNS where TABLE_SCHEMA = 'fusionpbx' AND TABLE_NAME = 'v_cdr' AND COLUMN_NAME = 'context'
     //oracle
     //check if table exists
     // SELECT TABLE_NAME FROM ALL_TABLES
     //get the $apps array from the installed apps from the core and mod directories
     $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
     $x = 0;
     foreach ($config_list as &$config_path) {
         include $config_path;
         $x++;
     }
     //update the app db array add exists true or false
     $sql = '';
     foreach ($apps as $x => &$app) {
         foreach ($app['db'] as $y => &$row) {
             if (is_array($row['table'])) {
                 $table_name = $row['table']['text'];
             } else {
                 $table_name = $row['table'];
             }
             if (strlen($table_name) > 0) {
                 //check if the table exists
                 if ($this->db_table_exists($db, $db_type, $db_name, $table_name)) {
                     $apps[$x]['db'][$y]['exists'] = 'true';
                 } else {
                     $apps[$x]['db'][$y]['exists'] = 'false';
                 }
                 //check if the column exists
                 foreach ($row['fields'] as $z => $field) {
                     if ($field['deprecated'] == "true") {
                         //skip this field
                     } else {
                         if (is_array($field['name'])) {
                             $field_name = $field['name']['text'];
                         } else {
                             $field_name = $field['name'];
                         }
                         if (strlen(field_name) > 0) {
                             if ($this->db_column_exists($db, $db_type, $db_name, $table_name, $field_name)) {
                                 //found
                                 $apps[$x]['db'][$y]['fields'][$z]['exists'] = 'true';
                             } else {
                                 //not found
                                 $apps[$x]['db'][$y]['fields'][$z]['exists'] = 'false';
                             }
                         }
                         unset($field_name);
                     }
                 }
                 unset($table_name);
             }
         }
     }
     //prepare the variables
     $sql_update = '';
     $var_uuid = $_GET["id"];
     //add missing tables and fields
     foreach ($apps as $x => &$app) {
         foreach ($app['db'] as $y => &$row) {
             if (is_array($row['table'])) {
                 $table_name = $row['table']['text'];
                 if (!$this->db_table_exists($db, $db_type, $db_name, $row['table']['text'])) {
                     $row['exists'] = "true";
                     //testing
                     //if (db_table_exists($db, $db_type, $db_name, $row['table']['deprecated'])) {
                     if ($db_type == "pgsql") {
                         $sql_update .= "ALTER TABLE " . $row['table']['deprecated'] . " RENAME TO " . $row['table']['text'] . ";\n";
                     }
                     if ($db_type == "mysql") {
                         $sql_update .= "RENAME TABLE " . $row['table']['deprecated'] . " TO " . $row['table']['text'] . ";\n";
                     }
                     if ($db_type == "sqlite") {
                         $sql_update .= "ALTER TABLE " . $row['table']['deprecated'] . " RENAME TO " . $row['table']['text'] . ";\n";
                     }
                     //}
                 }
             } else {
                 $table_name = $row['table'];
             }
             //check if the table exists
             if ($row['exists'] == "true") {
                 if (count($row['fields']) > 0) {
                     foreach ($row['fields'] as $z => $field) {
                         if ($field['deprecated'] == "true") {
                             //skip this field
                         } else {
                             //get the data type
                             if (is_array($field['type'])) {
                                 $field_type = $field['type'][$db_type];
                             } else {
                                 $field_type = $field['type'];
                             }
                             //get the field name
                             if (is_array($field['name'])) {
                                 $field_name = $field['name']['text'];
                             } else {
                                 $field_name = $field['name'];
                             }
                             //find missing fields and add them
                             if ($field['deprecated'] == "true") {
                                 //skip this row
                             } else {
                                 if (!is_array($field['name'])) {
                                     if ($field['exists'] == "false") {
                                         $sql_update .= "ALTER TABLE " . $table_name . " ADD " . $field['name'] . " " . $field_type . ";\n";
                                     }
                                 }
                             }
                             //rename fields where the name has changed
                             if (is_array($field['name'])) {
                                 if ($this->db_column_exists($db, $db_type, $db_name, $table_name, $field['name']['deprecated'])) {
                                     if ($db_type == "pgsql") {
                                         $sql_update .= "ALTER TABLE " . $table_name . " RENAME COLUMN " . $field['name']['deprecated'] . " to " . $field['name']['text'] . ";\n";
                                     }
                                     if ($db_type == "mysql") {
                                         $field_type = str_replace("AUTO_INCREMENT PRIMARY KEY", "", $field_type);
                                         $sql_update .= "ALTER TABLE " . $table_name . " CHANGE " . $field['name']['deprecated'] . " " . $field['name']['text'] . " " . $field_type . ";\n";
                                     }
                                     if ($db_type == "sqlite") {
                                         //a change has been made to the field name
                                         $apps[$x]['db'][$y]['rebuild'] = 'true';
                                     }
                                 }
                             }
                             //change the data type if it has been changed
                             //if the data type in the app db array is different than the type in the database then change the data type
                             if ($upgrade_data_types) {
                                 $db_field_type = $this->db_column_data_type($db, $db_type, $db_name, $table_name, $field_name);
                                 $field_type_array = explode("(", $field_type);
                                 $field_type = $field_type_array[0];
                                 if (trim($db_field_type) != trim($field_type) && strlen($db_field_type) > 0) {
                                     if ($db_type == "pgsql") {
                                         if (strtolower($field_type) == "uuid") {
                                             $sql_update .= "ALTER TABLE " . $table_name . " ALTER COLUMN " . $field_name . " TYPE uuid USING\n";
                                             $sql_update .= "CAST(regexp_replace(" . $field_name . ", '([A-Z0-9]{4})([A-Z0-9]{12})', E'\\1-\\2')\n";
                                             $sql_update .= "AS uuid);\n";
                                         } else {
                                             if ($db_field_type = "integer" && strtolower($field_type) == "serial") {
                                                 //field type has not changed
                                             } elseif ($db_field_type = "timestamp without time zone" && strtolower($field_type) == "timestamp") {
                                                 //field type has not changed
                                             } elseif ($db_field_type = "timestamp without time zone" && strtolower($field_type) == "datetime") {
                                                 //field type has not changed
                                             } elseif ($db_field_type = "integer" && strtolower($field_type) == "numeric") {
                                                 //field type has not changed
                                             } elseif ($db_field_type = "character" && strtolower($field_type) == "char") {
                                                 //field type has not changed
                                             } else {
                                                 //$sql_update .= "-- $db_type, $db_name, $table_name, $field_name ".db_column_data_type ($db, $db_type, $db_name, $table_name, $field_name)."<br>";
                                                 $sql_update .= "ALTER TABLE " . $table_name . " ALTER COLUMN " . $field_name . " TYPE " . $field_type . ";\n";
                                             }
                                         }
                                     }
                                     if ($db_type == "mysql") {
                                         $type = explode("(", $db_field_type);
                                         if ($type[0] == $field_type) {
                                             //do nothing
                                         } elseif ($field_type == "numeric" && $type[0] == "decimal") {
                                             //do nothing
                                         } else {
                                             $sql_update .= "ALTER TABLE " . $table_name . " modify " . $field_name . " " . $field_type . ";\n";
                                         }
                                         unset($type);
                                     }
                                     if ($db_type == "sqlite") {
                                         //a change has been made to the field type
                                         $apps[$x]['db'][$y]['rebuild'] = 'true';
                                     }
                                 }
                             }
                         }
                     }
                     unset($column_array);
                 }
             } else {
                 //create table
                 if (!is_array($row['table'])) {
                     $sql_update .= $this->db_create_table($apps, $db_type, $row['table']);
                 }
             }
         }
     }
     //rebuild and populate the table
     foreach ($apps as $x => &$app) {
         foreach ($app['db'] as $y => &$row) {
             if (is_array($row['table'])) {
                 $table_name = $row['table']['text'];
             } else {
                 $table_name = $row['table'];
             }
             if ($row['rebuild'] == "true") {
                 if ($db_type == "sqlite") {
                     //start the transaction
                     //$sql_update .= "BEGIN TRANSACTION;\n";
                     //rename the table
                     $sql_update .= "ALTER TABLE " . $table_name . " RENAME TO tmp_" . $table_name . ";\n";
                     //create the table
                     $sql_update .= $this->db_create_table($apps, $db_type, $table_name);
                     //insert the data into the new table
                     $sql_update .= $this->db_insert_into($apps, $db_type, $table_name);
                     //drop the old table
                     $sql_update .= "DROP TABLE tmp_" . $table_name . ";\n";
                     //commit the transaction
                     //$sql_update .= "COMMIT;\n";
                 }
             }
         }
     }
     // initialize response variable
     $response = '';
     //display results as html
     if ($format == "html") {
         //show the database type
         $response .= "<strong>" . $text['header-database_type'] . ": " . $db_type . "</strong><br /><br />";
         //start the table
         $response .= "<table width='100%' border='0' cellpadding='20' cellspacing='0'>\n";
         //show the changes
         if (strlen($sql_update) > 0) {
             $response .= "<tr>\n";
             $response .= "<td class='row_style1' colspan='3'>\n";
             $response .= "<br />\n";
             $response .= "<strong>" . $text['label-sql_changes'] . ":</strong><br />\n";
             $response .= "<pre>\n";
             $response .= $sql_update;
             $response .= "</pre>\n";
             $response .= "<br />\n";
             $response .= "</td>\n";
             $response .= "</tr>\n";
         }
         //list all tables
         $response .= "<tr>\n";
         $response .= "<th>" . $text['label-table'] . "</th>\n";
         $response .= "<th>" . $text['label-exists'] . "</th>\n";
         $response .= "<th>" . $text['label-details'] . "</th>\n";
         $response .= "<tr>\n";
         //build the html while looping through the app db array
         $sql = '';
         foreach ($apps as &$app) {
             foreach ($app['db'] as $row) {
                 if (is_array($row['table'])) {
                     $table_name = $row['table']['text'];
                 } else {
                     $table_name = $row['table'];
                 }
                 $response .= "<tr>\n";
                 //check if the table exists
                 if ($row['exists'] == "true") {
                     $response .= "<td valign='top' class='row_style1'>" . $table_name . "</td>\n";
                     $response .= "<td valign='top' class='vncell' style='padding-top: 3px;'>" . $text['option-true'] . "</td>\n";
                     if (count($row['fields']) > 0) {
                         $response .= "<td class='row_style1'>\n";
                         //show the list of columns
                         $response .= "<table border='0' cellpadding='10' cellspacing='0'>\n";
                         $response .= "<tr>\n";
                         $response .= "<th>" . $text['label-name'] . "</th>\n";
                         $response .= "<th>" . $text['label-type'] . "</th>\n";
                         $response .= "<th>" . $text['label-exists'] . "</th>\n";
                         $response .= "</tr>\n";
                         foreach ($row['fields'] as $field) {
                             if ($field['deprecated'] == "true") {
                                 //skip this field
                             } else {
                                 if (is_array($field['name'])) {
                                     $field_name = $field['name']['text'];
                                 } else {
                                     $field_name = $field['name'];
                                 }
                                 if (is_array($field['type'])) {
                                     $field_type = $field['type'][$db_type];
                                 } else {
                                     $field_type = $field['type'];
                                 }
                                 $response .= "<tr>\n";
                                 $response .= "<td class='row_style1' width='200'>" . $field_name . "</td>\n";
                                 $response .= "<td class='row_style1'>" . $field_type . "</td>\n";
                                 if ($field['exists'] == "true") {
                                     $response .= "<td class='row_style0' style=''>" . $text['option-true'] . "</td>\n";
                                     $response .= "<td>&nbsp;</td>\n";
                                 } else {
                                     $response .= "<td class='row_style1' style='background-color:#444444;color:#CCCCCC;'>" . $text['option-false'] . "</td>\n";
                                     $response .= "<td>&nbsp;</td>\n";
                                 }
                                 $response .= "</tr>\n";
                             }
                         }
                         unset($column_array);
                         $response .= "\t</table>\n";
                         $response .= "</td>\n";
                     }
                 } else {
                     $response .= "<td valign='top' class='row_style1'>{$table_name}</td>\n";
                     $response .= "<td valign='top' class='row_style1' style='background-color:#444444;color:#CCCCCC;'><strong>" . $text['label-exists'] . "</strong><br />" . $text['option-false'] . "</td>\n";
                     $response .= "<td valign='top' class='row_style1'>&nbsp;</td>\n";
                 }
                 $response .= "</tr>\n";
             }
         }
         unset($prep_statement);
         //end the list of tables
         $response .= "</table>\n";
         $response .= "<br />\n";
     }
     //loop line by line through all the lines of sql code
     $x = 0;
     if (strlen($sql_update) == 0 && $format == "text") {
         $response .= "\t" . $text['label-schema'] . ":\t\t\t" . $text['label-no_change'] . "\n";
     } else {
         if ($format == "text") {
             $response .= "\t" . $text['label-schema'] . "\n";
         }
         //$db->beginTransaction();
         $update_array = explode(";", $sql_update);
         foreach ($update_array as $sql) {
             if (strlen(trim($sql))) {
                 try {
                     $db->query(trim($sql));
                     if ($format == "text") {
                         $response .= "\t{$sql}\n";
                     }
                 } catch (PDOException $error) {
                     $response .= "\terror: " . $error->getMessage() . "\tsql: {$sql}<br/>";
                 }
             }
         }
         //$db->commit();
         $response .= "\n";
         unset($file_contents, $sql_update, $sql);
     }
     //handle response
     //if ($output == "echo") {
     //	echo $response;
     //}
     //else if ($output == "return") {
     return $response;
     //}
 }
Exemple #19
0
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('zoiper')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//get the https values and set as variables
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add multi-lingual support
$language = new text();
$text = $language->get($_SESSION['domain']['language']['code'], 'app/zoiper');
//begin the content
require_once "resources/header.php";
require_once "resources/paging.php";
if ($is_included != "true") {
    echo "\t\t<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
    echo "\t\t<tr>\n";
    echo "\t\t<td align='left'><b>" . $text['title'] . "</b><br>\n";
    echo "\t\t\t" . $text['description-2'] . "\n";
    echo "\t\t\t" . $text['description-3'] . " \n";
    echo "\t\t</td>\n";
    echo "\t\t</tr>\n";
    echo "\t\t</table>\n";
    echo "\t\t<br />";
}
$sql = "select * from v_extensions ";
	Contributor(s):
	Mark J Crane <*****@*****.**>
	James Rose <*****@*****.**>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('ring_group_forward')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get($_SESSION['domain']['language']['code'], 'app/ring_groups');
require_once "resources/header.php";
require_once "resources/paging.php";
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show the content
if (!$is_included) {
    echo "<table width='100%' border='0'>\n";
    echo "\t<tr>\n";
    echo "\t\t<td width='50%' align='left' nowrap='nowrap'><b>" . $text['title'] . "</b></td>\n";
    echo "\t\t<td width='50%' align='right'>&nbsp;</td>\n";
    echo "\t</tr>\n";
    echo "\t<tr>\n";
    echo "\t\t<td align='left' colspan='2'>\n";
    echo "\t\t\t" . $text['description'] . "<br /><br />\n";
Exemple #21
0
	for the specific language governing rights and limitations under the
	License.

	The Original Code is FusionPBX

	The Initial Developer of the Original Code is
	Mark J Crane <*****@*****.**>
	Portions created by the Initial Developer are Copyright (C) 2008-2012
	the Initial Developer. All Rights Reserved.

	Contributor(s):
	Mark J Crane <*****@*****.**>
*/
//add multi-lingual support
$language = new text();
$text = $language->get(null, 'core/user_settings');
//get action, if any
if (isset($_REQUEST['action'])) {
    $action = check_str($_REQUEST['action']);
}
//retrieve parse reset key
if ($action == 'define') {
    $key = $_GET['key'];
    $key_part = explode('|', decrypt($_SESSION['login']['password_reset_key']['text'], $key));
    $username = $key_part[0];
    $domain_uuid = $key_part[1];
    $password_submitted = $key_part[2];
    //get current salt, see if same as submitted salt
    $sql = "select password from v_users where domain_uuid = '" . $domain_uuid . "' and username = '******'";
    $prep_statement = $db->prepare(check_sql($sql));
    $prep_statement->execute();
Exemple #22
0
	James Rose <*****@*****.**>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//permissions
if (permission_exists('exec_view')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
// load editor preferences/defaults
$setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = $_SESSION["editor"]["theme"]["text"] != '' ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
$setting_invisibles = $_SESSION["editor"]["invisibles"]["boolean"] != '' ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
$setting_indenting = $_SESSION["editor"]["indent_guides"]["boolean"] != '' ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
$setting_numbering = $_SESSION["editor"]["line_numbers"]["boolean"] != '' ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
$setting_preview = $_SESSION["editor"]["live_preview"]["boolean"] != '' ? $_SESSION["editor"]["live_preview"]["boolean"] : 'true';
//get the html values and set them as variables
$handler = $_REQUEST["handler"] != '' ? trim($_REQUEST["handler"]) : (permission_exists('exec_switch') ? 'switch' : null);
$cmd = trim($_POST["cmd"]);
//set editor moder
switch ($handler) {
    case 'php':
        $mode = 'php';
        break;
	Copyright (C) 2016 All Rights Reserved.
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_key_add') || permission_exists('device_key_edit')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get($_SESSION['domain']['language']['code'], 'app/devices');
//include the device class
//require_once "app/devices/resources/classes/device.php";
//get the vendor functions
$sql = "SELECT v.name as vendor_name, f.name, f.value ";
$sql .= "FROM v_device_vendors as v, v_device_vendor_functions as f ";
$sql .= "WHERE v.device_vendor_uuid = f.device_vendor_uuid ";
$sql .= "AND f.device_vendor_function_uuid in ";
$sql .= "(";
$sql .= "\tSELECT device_vendor_function_uuid FROM v_device_vendor_function_groups ";
$sql .= "\tWHERE device_vendor_function_uuid = f.device_vendor_function_uuid ";
$sql .= "\tAND ( ";
if (is_array($_SESSION['groups'])) {
    $x = 0;
    foreach ($_SESSION['groups'] as $row) {
        if ($x == 0) {
<?php # Standard login / user status box for use on main page ?>




<?php if($this->tData['session']['user'] !== false): ?>

<p><?php echo text::get('login/loggedInAs',array($this->tData['session']['user'],$tData['pagePrefix']. 'logout'))?></p>

<?php else: ?>
<form action="<?php echo $PHP_SELF; ?>" method="post">

<h3>Login</h3>
	<?php if($tData['errors']['login']):?>
<p class="error"><?php echo $tData['errors']['login']?></p>
<?php endif;?>

	<p><input type="hidden" name="login" value="1" /> <label
	for="login_user">User</label><br />
<input type="text" id="login_user" class="text" style="width: 150px"
	name="user" /></p>
<p><label for="login_password">Password</label><br />
<input type="password" id="login_password" class="text"
	style="width: 150px" name="password" /></p>
<p>
<button type="submit">Login</button>
</p>
</form>

<?php endif; ?>
Exemple #25
-1
	function formField ($name, $title, $value = null, $linkfield, $properties)
	{
		$cvs = metaclass::getClassVars($properties['requirements']['real']);
		if (metaclass::$db->tableExists($cvs['table']))
		{
			$query = new query();
			$query->select(array (
				'id' , 
				'title'
			))->from($cvs['table']);
			$result = metaclass::$db->query($query);
			$return .= '<label for="' . $name . '">
							' . $title . '
						</label><br/>
						<select  id="' . $name . '" name="' . $name . '">';
			while ($row = metaclass::$db->assoc($result))
			{
				$return .= '<option value="' . $row['id'] . '"' . ($row['id'] == $value ? ' selected' : null) . '>' .
						 $row['title'] . '</option>';
			}
			$return .= '</select>
						<br/>';
		} else
		{
			$return .= '<label for="' . $name . '">
							' . $title . '
						</label><br/>';
			$return .= '<p class="error">' . text::get('form/foreignTableNotExist', $cvs['title']) . '</p>';
		}
		return $return;
	}