Phrases: List view updates. Minor Adjustments: IVR Menus, Modules, Number Translations.

This commit is contained in:
Nate 2019-11-26 16:05:39 -07:00
parent e06f3c3221
commit cedfb1ad9e
5 changed files with 529 additions and 84 deletions

View File

@ -166,7 +166,7 @@ if (!class_exists('ivr_menu')) {
//clear the cache
if (is_array($ivr_menu_contexts) && @sizeof($ivr_menu_contexts) != 0) {
$ivr_menu_contexts = array_unique($ivr_menu_contexts, SORT_STRING);
$ivr_menu_contexts = array_unique($ivr_menu_contexts);
$cache = new cache;
foreach ($ivr_menu_contexts as $ivr_menu_context) {
$cache->delete("dialplan:".$dialplan_context);

View File

@ -965,8 +965,8 @@ if (!class_exists('modules')) {
}
//build the delete array
$x = 0;
if (is_array($modules) && @sizeof($modules) != 0) {
$x = 0;
foreach ($modules as $module_uuid => $module) {
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $module_uuid;
$x++;

View File

@ -167,7 +167,7 @@
}
echo th_order_by('number_translation_name', $text['label-number_translation_name'], $order_by, $order);
echo th_order_by('number_translation_enabled', $text['label-number_translation_enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('number_translation_description', $text['label-number_translation_description'], $order_by, $order, null, "class='hide-sm-dn'");
echo th_order_by('number_translation_description', $text['label-number_translation_description'], $order_by, $order, null, "class='hide-sm-dn' style='min-width: 50%;'");
if (permission_exists('number_translation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
@ -203,7 +203,7 @@
echo $text['label-'.$row['number_translation_enabled']];
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn' style='min-width: 50%;'>".escape($row['number_translation_description'])."&nbsp;</td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['number_translation_description'])."&nbsp;</td>\n";
if (permission_exists('number_translation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
Portions created by the Initial Developer are Copyright (C) 2018 - 2019
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -28,6 +28,8 @@
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
require_once "resources/functions/save_phrases_xml.php";
//check the permission
if (!permission_exists('phrase_view')) {
@ -39,113 +41,205 @@
$language = new text;
$text = $language->get();
//get the http get values and set them as php variables
//get posted data
if (is_array($_POST['phrases'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$phrases = $_POST['phrases'];
}
//copy the phrases
if (permission_exists('phrase_add')) {
if ($action == 'copy' && is_array($phrases) && @sizeof($phrases) != 0) {
//copy
$obj = new phrases;
$obj->copy($phrases);
//save the xml
save_phrases_xml();
//redirect
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//toggle the phrases
if (permission_exists('phrase_edit')) {
if ($action == 'toggle' && is_array($phrases) && @sizeof($phrases) != 0) {
//toggle
$obj = new phrases;
$obj->toggle($phrases);
//save the xml
save_phrases_xml();
//redirect
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//delete the phrases
if (permission_exists('phrase_delete')) {
if ($action == 'delete' && is_array($phrases) && @sizeof($phrases) != 0) {
//delete
$obj = new phrases;
$obj->delete($phrases);
//save the xml
save_phrases_xml();
//redirect
header('Location: phrases.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//add paging
require_once "resources/paging.php";
//add the search term
$search = strtolower($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "lower(phrase_name) like :search ";
$sql_search .= "or lower(phrase_enabled) like :search ";
$sql_search .= "or lower(phrase_description) like :search ";
$sql_search .= ") ";
$parameters['search'] = '%'.$search.'%';
}
//get phrases record count
$sql = "select count(*) from v_phrases ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= $sql_search;
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".$search;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page;
//get the list
$sql = str_replace('count(*)', '*', $sql);
$sql .= order_by($order_by, $order, 'phrase_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$phrases = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//include the header
require_once "resources/header.php";
$document['title'] = $text['title-phrases'];
//begin the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <b>".$text['header_phrases']."</b>\n";
echo " <br /><br />\n";
echo " ".$text['description-phrases']."\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>";
echo "<br />\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header_phrases']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
if (permission_exists('phrase_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'phrase_edit.php']);
}
if (permission_exists('phrase_add') && $phrases) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
if (permission_exists('phrase_edit') && $phrases) {
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
if (permission_exists('phrase_delete') && $phrases) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
echo "<form id='form_search' class='inline' method='get'>\n";
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'phrases.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
echo " </form>\n";
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
$sql = "select count(*) from v_phrases ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "or domain_uuid is null ";
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
echo $text['description-phrases']."\n";
echo "<br /><br />\n";
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
echo "<form id='form_list' method='post'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
$sql = str_replace('count(*)', '*', $sql);
$sql .= order_by($order_by, $order, 'phrase_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('phrase_add') || permission_exists('phrase_edit') || permission_exists('phrase_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($phrases ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
echo th_order_by('phrase_name', $text['label-name'], $order_by, $order);
echo th_order_by('phrase_language', $text['label-language'], $order_by, $order);
echo th_order_by('phrase_enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('phrase_description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('phrase_add')) {
echo "<a href='phrase_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
echo th_order_by('phrase_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
echo th_order_by('phrase_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn' style='min-width: 40%;'");
if (permission_exists('phrase_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</td>\n";
echo "</tr>\n";
if (is_array($result) && @sizeof($result) != 0) {
foreach($result as $row) {
$tr_link = (permission_exists('phrase_edit')) ? "href='phrase_edit.php?id=".$row['phrase_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['phrase_name'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['phrase_language'])."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.escape($row['phrase_enabled'])]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".escape($row['phrase_description'])."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (is_array($phrases) && @sizeof($phrases) != 0) {
$x = 0;
foreach($phrases as $row) {
if (permission_exists('phrase_edit')) {
echo "<a href='phrase_edit.php?id=".escape($row['phrase_uuid'])."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
$list_row_url = "phrase_edit.php?id=".urlencode($row['phrase_uuid']);
}
if (permission_exists('phrase_delete')) {
echo "<a href='phrase_delete.php?id=".escape($row['phrase_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('phrase_add') || permission_exists('phrase_edit') || permission_exists('phrase_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='phrases[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='phrases[$x][uuid]' value='".escape($row['phrase_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td>";
if (permission_exists('phrase_edit')) {
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['phrase_name'])."</a>";
}
else {
echo escape($row['phrase_name']);
}
echo " </td>\n";
echo " <td>".escape($row['phrase_language'])."&nbsp;</td>\n";
if (permission_exists('phrase_edit')) {
echo " <td class='no-link center'>";
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['phrase_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
}
else {
echo " <td class='center'>";
echo $text['label-'.$row['phrase_enabled']];
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['phrase_description'])."&nbsp;</td>\n";
if (permission_exists('phrase_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$c = $c ? 0 : 1;
$x++;
}
}
unset($result, $row);
echo "<tr>\n";
echo "<td colspan='4'>&nbsp;</td>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('phrase_add')) {
echo "<a href='phrase_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo "</td>\n";
echo "</tr>\n";
unset($phrases);
echo "</table>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<div align='center'>".$paging_controls."</div>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@ -0,0 +1,351 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//define the phrases class
if (!class_exists('phrases')) {
class phrases {
/**
* declare private variables
*/
private $app_name;
private $app_uuid;
private $permission_prefix;
private $list_page;
private $table;
private $uuid_prefix;
private $toggle_field;
private $toggle_values;
/**
* called when the object is created
*/
public function __construct() {
//assign private variables
$this->app_name = 'phrases';
$this->app_uuid = '5c6f597c-9b78-11e4-89d3-123b93f75cba';
$this->permission_prefix = 'phrase_';
$this->list_page = 'phrases.php';
$this->table = 'phrases';
$this->uuid_prefix = 'phrase_';
$this->toggle_field = 'phrase_enabled';
$this->toggle_values = ['true','false'];
}
/**
* called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* delete records
*/
public function delete($records) {
if (permission_exists($this->permission_prefix.'delete')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//delete multiple records
if (is_array($records) && @sizeof($records) != 0) {
//filter out unchecked phrases, build where clause for below
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
//get phrase languages
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, phrase_language as lang from v_".$this->table." ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$phrase_languages[$row['uuid']] = $row['lang'];
}
}
unset($sql, $parameters, $rows, $row);
}
//build the delete array
if (is_array($phrase_languages) && @sizeof($phrase_languages) != 0) {
$x = 0;
foreach ($phrase_languages as $phrase_uuid => $phrase_language) {
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $phrase_uuid;
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['phrase_details'][$x][$this->uuid_prefix.'uuid'] = $phrase_uuid;
$array['phrase_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
$x++;
}
}
//delete the checked rows
if (is_array($array) && @sizeof($array) != 0) {
//grant temporary permissions
$p = new permissions;
$p->add('phrase_details_delete', 'temp');
//execute delete
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->delete($array);
unset($array);
//revoke temporary permissions
$p->delete('phrase_details_delete', 'temp');
//clear the cache
$phrase_languages = array_unique($phrase_languages);
$cache = new cache;
foreach ($phrase_languages as $phrase_language) {
$cache->delete("languages:".$phrase_language);
}
//set message
message::add($text['message-delete']);
}
unset($records, $phrase_languages);
}
}
}
/**
* toggle records
*/
public function toggle($records) {
if (permission_exists($this->permission_prefix.'edit')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//toggle the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get current toggle state and language
foreach($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, phrase_language as lang from v_".$this->table." ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
$phrase_languages[] = $row['lang'];
}
}
unset($sql, $parameters, $rows, $row);
}
//build update array
$x = 0;
foreach($states as $uuid => $state) {
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
$x++;
}
//save the changes
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//clear the cache
$phrase_languages = array_unique($phrase_languages);
$cache = new cache;
foreach ($phrase_languages as $phrase_language) {
$cache->delete("languages:".$phrase_language);
}
//set message
message::add($text['message-toggle']);
}
unset($records, $states);
}
}
}
/**
* copy records
*/
public function copy($records) {
if (permission_exists($this->permission_prefix.'add')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->list_page);
exit;
}
//copy the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get checked records
foreach($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$record_uuids[] = $this->uuid_prefix."uuid = '".$record['uuid']."'";
}
}
//create insert array from existing data
if (is_array($record_uuids) && @sizeof($record_uuids) != 0) {
//primary table
$sql = "select * from v_".$this->table." ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "and ( ".implode(' or ', $record_uuids)." ) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$y = 0;
foreach ($rows as $x => $row) {
$primary_uuid = uuid();
//copy data
$array[$this->table][$x] = $row;
//overwrite
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $primary_uuid;
$array[$this->table][$x]['phrase_description'] = trim($row['phrase_description'].' ('.$text['label-copy'].')');
//details sub table
$sql_2 = "select * from v_phrase_details where phrase_uuid = :phrase_uuid";
$parameters_2['phrase_uuid'] = $row['phrase_uuid'];
$database = new database;
$rows_2 = $database->select($sql_2, $parameters_2, 'all');
if (is_array($rows_2) && @sizeof($rows_2) != 0) {
foreach ($rows_2 as $row_2) {
//copy data
$array['phrase_details'][$y] = $row_2;
//overwrite
$array['phrase_details'][$y]['phrase_detail_uuid'] = uuid();
$array['phrase_details'][$y]['phrase_uuid'] = $primary_uuid;
//increment
$y++;
}
}
unset($sql_2, $parameters_2, $rows_2, $row_2);
//create array of languages
$phrase_languages[] = $row['phrase_languages'];
}
}
unset($sql, $parameters, $rows, $row);
}
//save the changes and set the message
if (is_array($array) && @sizeof($array) != 0) {
//grant temporary permissions
$p = new permissions;
$p->add('phrase_detail_add', 'temp');
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//revoke temporary permissions
$p->delete('phrase_detail_add', 'temp');
//clear the cache
$phrase_languages = array_unique($phrase_languages);
$cache = new cache;
foreach ($phrase_languages as $phrase_language) {
$cache->delete("languages:".$phrase_language);
}
//set message
message::add($text['message-copy']);
}
unset($records);
}
}
} //method
} //class
}
?>