* the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * "PCPIN Chat 6" is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * Get available languages list */ _pcpin_loadClass('language_expression'); $language_expression = new PCPIN_Language_Expression($session); $expressions = array(); $total_count = 0; if (!isset($language_id) || !is_scalar($language_id)) { $language_id = 0; } if (!isset($start_from) || !is_scalar($start_from)) { $start_from = 0; } if (!isset($max_results) || !is_scalar($max_results)) { $max_results = 100; } if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') { $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); if (!empty($language_id) && $l->_db_getList('id', 'id = ' . $language_id, 1)) {
/** * Create a copy of the language * @param string $src Source language ISO name * @param string $dst Destination language ISO name * @return boolean TRUE on success or FALSE on error */ function copyLanguage($from = '', $to = '') { $result = false; if ($from != '' && $to != '' && $this->_db_getList('id', 'iso_name = ' . $from, 1)) { $src_id = $this->_db_list[0]['id']; $this->_db_freeList(); $this->id = 0; $this->iso_name = strtolower($to); $this->name = substr(constant('PCPIN_ISO_LNG_' . strtoupper($to)), 3); $this->local_name = $this->name; $this->active = 'n'; if ($this->_db_insertObj()) { $result = true; $this->id = $this->_db_lastInsertID(); // Copy language expressions _pcpin_loadClass('language_expression'); $language_expression = new PCPIN_Language_Expression($this); $language_expression->_db_getList('language_id = ' . $src_id); $expressions = $language_expression->_db_list; $language_expression->_db_freeList(); foreach ($expressions as $expr) { $language_expression = new PCPIN_Language_Expression($this); $language_expression->_db_setObject($expr); $language_expression->language_id = $this->id; $language_expression->_db_insertObj(); } } } return $result; }