Exemplo n.º 1
0
 function get($args = array(), $page_id = 0)
 {
     if (!$this->_check_args($args, $page_id)) {
         return false;
     }
     if (is_array($args[0])) {
         $key = array_shift($args[0]);
         if (count($args[0]) == 0) {
             array_shift($args);
         }
     } else {
         $key = is_array($args) ? array_shift($args) : $args;
     }
     /*
      * There was a PHP notice on the line #35 of array to string conversion ($key was an array). It was impossible to me (Luka) to figure out the what 
      * would the correct thing to do is. The issue was with feature_area/optin(2)
      */
     if (is_array($key)) {
         $key = $key[0];
     }
     $name = '_' . OP_SN . '_' . $key;
     if (!isset($this->_options[$name])) {
         if ($page_id == 0) {
             $page_id = $this->_page_id;
         }
         $temp = get_post_meta($page_id, $name, true);
         $this->_options[$name] = mb_unserialize($temp);
     }
     return _op_traverse_array($this->_options[$name], $args);
 }
 function callback($data)
 {
     //	$request_data = get_post(NULL);
     $request_data = $data['request_data'];
     $return_data = json_decode($data['return_data']);
     $return_data = object_array($return_data);
     $CI =& get_instance();
     $CI->load->model('stream_model');
     $order_rs = $CI->stream_model->findByAttributes("order_bn = '" . $request_data['tid'] . "' and from_method='store.trade.reship.add'", 'stream_id desc');
     $reship_id = '';
     if ($order_rs) {
         $request_rs = mb_unserialize($order_rs['request_data']);
         $reship_id = $request_rs['reship_id'];
     }
     if ($return_data['rsp'] == 'succ') {
         //回调接口
         $callback_data = array();
         $callback_data['res'] = '';
         $callback_data['msg_id'] = $data['msg_id'];
         $callback_data['err_msg'] = '';
         $callback_data['data'] = json_encode(array('tid' => $request_data['tid'], 'reship_id' => $reship_id));
         $callback_data['sign'] = '';
         $callback_data['rsp'] = 'succ';
     } else {
         $callback_data = array();
         $callback_data['res'] = $return_data['res'];
         $callback_data['msg_id'] = $data['msg_id'];
         $callback_data['err_msg'] = '';
         $callback_data['data'] = json_encode(array('tid' => $request_data['tid'], 'reship_id' => $reship_id));
         $callback_data['sign'] = '';
         $callback_data['rsp'] = 'fail';
     }
     return array('callback_data' => $callback_data, 'callback_url' => $request_data['callback_url']);
 }
Exemplo n.º 3
0
 function _get_callback_data($request_data, $response_data, $return_data, $form_certi, $stream_id)
 {
     //回调
     $form_certi = $this->certi_model->findByAttributes(array('certi_name' => $form_certi));
     //请求方
     $callback_list = array();
     $request_data = mb_unserialize($request_data);
     $method_name = str_replace('.', '_', $request_data['method']);
     $node_type = $request_data['node_type'] == 'ecos.b2c' ? 'erp_to_ec' : 'ec_to_erp';
     $filenames = get_filenames('application/libraries/apiv/' . $node_type);
     foreach ($filenames as $key2 => $value2) {
         if ($method_name . '.php' == $value2) {
             $this->load->library('apiv/' . $node_type . '/' . $method_name);
             if (method_exists($this->{$method_name}, 'callback')) {
                 //发送回调
                 $callback_rs = $this->{$method_name}->callback(array('request_data' => $request_data, 'return_data' => $return_data, 'response_data' => $response_data, 'msg_id' => md5($stream_id)));
                 $now = time();
                 $callback_data = $callback_rs['callback_data'];
                 $callback_url = $callback_rs['callback_url'];
                 $callback_data['matrix_certi'] = $form_certi['certi_name'];
                 $callback_data['matrix_timestamp'] = $now;
                 $callback_data['sign'] = md5($form_certi['certi_name'] . $form_certi['certi_key'] . $now);
                 $callback_data['stream_id'] = $stream_id;
                 //$return_callback = $this->httpclient->set_timeout(15)->post($rs['callback_url'],$callback_data);//回调发送
                 $callback_list = array('url' => $callback_url, 'method' => 'POST', 'post_data' => $callback_data, 'header' => null, 'options' => array());
             }
         }
     }
     return $callback_list;
 }
Exemplo n.º 4
0
 public function load_from_resultset($rs)
 {
     $main = $rs[0];
     $this->id = $main->id;
     $this->element = $main->element;
     $this->template = $main->template;
     $this->name = $main->name;
     $this->type = $main->type;
     $this->options = mb_unserialize($main->options);
     $this->dvalue = $main->dvalue;
     $this->multilanguage = $main->multilanguage;
     $this->helper = $main->helper;
     $this->width = $main->width;
     $this->position = $main->position;
     $this->enabled = $main->enabled;
     // decimal format extra fields
     $this->precision = $main->precision;
     $this->prefix = $main->prefix;
     $this->suffix = $main->suffix;
     if ($this->type == 'date') {
         $this->dvalue = core_ts2date($this->dvalue, false);
     } else {
         if ($this->type == 'datetime') {
             $this->dvalue = core_ts2date($this->dvalue, true);
         }
     }
 }
Exemplo n.º 5
0
 public function get($name)
 {
     $strCache = $this->find('cache', array('cachename' => $name), 'cachevalue', 'cacheid DESC');
     return mb_unserialize(substr($strCache['cachevalue'], 10));
     //if (! $result = array_pop ( $result )) return FALSE;
     // if( substr($result, 0, 10) < time() ){$this->del($name);return FALSE;}
     //return mb_unserialize ( substr ( $result, 10 ) );
 }
Exemplo n.º 6
0
 public function getInvoice($id)
 {
     $row = $this->db()->row("\n            SELECT \n                bi.*,\n                u.uid,\n                u.login\n            FROM " . self::$_TABLE . " AS bi \n            INNER JOIN " . self::$_TABLE_USER . " AS u ON u.uid = bi.user_id\n            WHERE bi.id = ?i", $id);
     if ($row) {
         $row['fields'] = mb_unserialize($row['fields']);
     }
     return $row;
 }
Exemplo n.º 7
0
 public function get_style()
 {
     $model_setting = Model('setting');
     $list_setting = $model_setting->getListSetting();
     if ($list_setting['decoration_style'] != '') {
         $decoration_style = mb_unserialize($list_setting['decoration_style']);
     }
     $decoration_style = array_map("base64_decode", $decoration_style);
     return $decoration_style;
 }
 function select()
 {
     $result = $this->_performQuery('select');
     $array = array();
     foreach ($result as $row) {
         if (isset($row['file_array']) and !empty($row['file_array'])) {
             include_once 'functions/text_functions.php';
             $array[] = mb_unserialize($row['file_array']);
         }
     }
     return $array;
 }
Exemplo n.º 9
0
 public function load_from_resultset($rs)
 {
     $main = $rs[0];
     $this->id = $main->id;
     $this->website = $main->website;
     $this->title = $main->title;
     $this->file = $main->file;
     $this->sections = mb_unserialize($main->sections);
     $this->gallery = $main->gallery;
     $this->comments = $main->comments;
     $this->tags = $main->tags;
     $this->statistics = $main->statistics;
     $this->permission = $main->permission;
     $this->enabled = $main->enabled;
 }
 /**
  * Возвращает реквизиты заказчика из слепков
  * @return type
  */
 public function getReqv($emp_id = 0)
 {
     $fields = $this->db()->val("SELECT fields FROM {$this->TABLE} WHERE reserve_id = ?i", $this->reserve_id);
     if ($fields) {
         $reqv = mb_unserialize($fields);
     } elseif ($emp_id) {
         $reqvs = ReservesHelper::getInstance()->getUserReqvs($emp_id);
         if ($reqvs && $reqvs['form_type']) {
             $reqv = $reqvs[$reqvs['form_type']];
             $reqv['form_type'] = $reqvs['form_type'];
             $reqv['rez_type'] = $reqvs['rez_type'];
         }
     }
     return $reqv;
 }
Exemplo n.º 11
0
 public function getInvoice($id)
 {
     $row = $this->db()->row('
         SELECT 
             bi.*,
             u.uid,
             u.login
         FROM ' . self::$_TABLE . ' AS bi 
         INNER JOIN ' . self::$_TABLE_USER . ' AS u ON u.uid = bi.user_id
         WHERE bi.id = ?i', $id);
     if ($row) {
         $row['fields'] = mb_unserialize($row['fields']);
     }
     return $row;
 }
Exemplo n.º 12
0
 public function load_from_resultset($rs)
 {
     global $theme;
     $main = $rs[0];
     $this->id = $main->id;
     $this->website = $main->website;
     $this->code = $main->code;
     $this->title = $main->title;
     $this->notes = $main->notes;
     // serialized (pre nv 2.1) or json object? (>= 2.1)
     // this compatibility fix will be removed in a future version!
     if (substr($main->blocks, 0, 2) == 'a:') {
         $this->blocks = mb_unserialize($main->blocks);
         for ($b = 0; $b < count($this->blocks); $b++) {
             if (is_numeric($this->blocks[$b])) {
                 $this->blocks[$b] = array("type" => "block", "id" => $this->blocks[$b]);
             } else {
                 if (!empty($this->blocks[$b])) {
                     // block group block or block type?
                     if (is_array($theme->block_groups)) {
                         foreach ($theme->block_groups as $key => $bg) {
                             for ($i = 0; $i < count($bg->blocks); $i++) {
                                 if ($bg->blocks[$i]->id == $this->blocks[$b]) {
                                     $this->blocks[$b] = array("type" => "block_group_block", "id" => $this->blocks[$b]);
                                 }
                             }
                         }
                     }
                     // final case, we assume it's a block type
                     if (!is_array($this->blocks[$b])) {
                         $this->blocks[$b] = array("type" => "block_type", "id" => $this->blocks[$b]);
                     }
                 }
             }
         }
     } else {
         $this->blocks = json_decode($main->blocks, true);
     }
 }
Exemplo n.º 13
0
 public function load_from_resultset($rs)
 {
     $main = $rs[0];
     $this->id = $main->id;
     $this->website = $main->website;
     $this->association = $main->association;
     $this->category = $main->category;
     $this->embedding = $main->embedding;
     $this->template = $main->template;
     $this->date_to_display = empty($main->date_to_display) ? '' : $main->date_to_display;
     $this->date_published = empty($main->date_published) ? '' : $main->date_published;
     $this->date_unpublish = empty($main->date_unpublish) ? '' : $main->date_unpublish;
     $this->date_created = $main->date_created;
     $this->date_modified = $main->date_modified;
     $this->galleries = mb_unserialize($main->galleries);
     $this->comments_enabled_to = $main->comments_enabled_to;
     $this->comments_moderator = $main->comments_moderator;
     $this->access = $main->access;
     $this->permission = $main->permission;
     $this->author = $main->author;
     $this->views = $main->views;
     $this->votes = $main->votes;
     $this->score = $main->score;
     $this->position = $main->position;
     $this->dictionary = webdictionary::load_element_strings('item', $this->id);
     $this->paths = path::loadElementPaths('item', $this->id);
     // to get the array of groups first we remove the "g" character
     $groups = str_replace('g', '', $main->groups);
     $this->groups = explode(',', $groups);
     if (!is_array($this->groups)) {
         $this->groups = array($groups);
     }
     if ($this->association == 'free') {
         $this->category = '';
     }
 }
Exemplo n.º 14
0
 /** Prepares the db_array for the item
  *
  * @param $db_array Contains the data from the database
  *
  * @return array Contains prepared data ( textfunctions applied etc. )
  */
 function _buildItem($db_array)
 {
     include_once 'functions/text_functions.php';
     $db_array['extras'] = mb_unserialize($db_array['extras']);
     return parent::_buildItem($db_array);
 }
Exemplo n.º 15
0
function themo_import_post_meta($postmeta, $post_id, $post)
{
    // Sometimes you want to import files from a source domain. If we do this, we need to replace the URL in the meta data.
    $find = "http://www.pixelglow.ro/themes/planuswp-v2.1/wp-content/uploads/";
    // Search url
    $upload_dir = wp_upload_dir();
    // Replace URL
    $replace = $upload_dir['baseurl'];
    // upload url of the local site.
    // Watch out for newlines inside of serialized data when importing from XML, they will break the import.
    // I've found that the XML leaves a discrepancy of how many chars are in the serialized string. I add 1 extra for each line break.
    $find2 = "\n";
    // look for newline
    $replace2 = "\n ";
    // replace newline + 1 extra char (Hack you say? Yes I am aware.)
    // Multidimensional array loop
    foreach ($postmeta as $key => $value) {
        foreach ($value as $sub_key => $sub_value) {
            // If this is serialized data we need to unserialize to find / replace.
            if (is_serialized($sub_value)) {
                $reserialize = true;
                $sub_value = str_replace($find2, $replace2, $sub_value);
                // Clean up
                $sub_value = mb_unserialize($sub_value);
                // unserialize
            } else {
                $reserialize = false;
            }
            $sub_value = str_replace($find, $replace, $sub_value);
            // Find / replace value 1
            if (is_array($sub_value)) {
                // We may nned to go even deeper...
                foreach ($sub_value as $sub_sub_key => $sub_sub_value) {
                    $sub_value[$sub_sub_key] = str_replace($find, $replace, $sub_sub_value);
                    // Find and replace value 1
                    $sub_value[$sub_sub_key] = str_replace($find2, $replace2, $sub_value[$sub_sub_key]);
                    // Find and replace value 2
                    if (is_array($sub_sub_value)) {
                        // We may nned to go even DEEPER..!
                        foreach ($sub_sub_value as $sub_sub_sub_key => $sub_sub_sub_value) {
                            $sub_value[$sub_sub_key][$sub_sub_sub_key] = str_replace($find, $replace, $sub_sub_sub_value);
                            // Find and replace value 1
                            $sub_value[$sub_sub_key][$sub_sub_sub_key] = str_replace($find2, $replace2, $sub_value[$sub_sub_key][$sub_sub_sub_key]);
                            // Find and replace value 2
                        }
                    }
                }
            }
            // If we unserialized then serialize back up again.
            if ($reserialize) {
                $value[$sub_key] = serialize($sub_value);
            } else {
                $value[$sub_key] = $sub_value;
            }
        }
        $postmeta[$key] = $value;
    }
    return $postmeta;
}
Exemplo n.º 16
0
 function backupDataFromXMLObject($xml_object)
 {
     $major_success = true;
     if (isset($xml_object) and !empty($xml_object)) {
         foreach ($xml_object->children() as $xml_item) {
             $data_array = array();
             foreach ($xml_item->children() as $xml_element) {
                 $value = utf8_decode((string) $xml_element);
                 if ($xml_element->getName() == 'extras') {
                     include_once 'functions/text_functions.php';
                     $value = mb_unserialize($value);
                 }
                 if (!empty($value)) {
                     $value = str_replace('lt_commsy_export', '<', $value);
                     $value = str_replace('gt_commsy_export', '>', $value);
                     $value = str_replace('and_commsy_export', '&', $value);
                     $data_array[$xml_element->getName()] = $value;
                 }
             }
             if (isset($data_array) and !empty($data_array)) {
                 $success = $this->_updateFromBackup($data_array);
                 $major_success = $major_success and $success;
             }
         }
     }
     return $major_success;
 }
Exemplo n.º 17
0
 /** get session item
  * this method returns a session item
  *
  * @param string session_id the session id
  *
  * @return object cs_session_item the session item
  */
 function get($session_id)
 {
     // don't delete session on every site request
     if (1 == rand(1, 100)) {
         $this->deleteOldSessions();
     }
     if (!empty($session_id) and !empty($this->_cache_object[$session_id])) {
         $session_item = $this->_cache_object[$session_id];
     } else {
         $session_arrays = array();
         $session_item = NULL;
         $query = 'SELECT session_value FROM session WHERE session_id="' . encode(AS_DB, $session_id) . '";';
         $this->_last_query = $query;
         $result = $this->_db_conntector->performQuery($query);
         if (!isset($result)) {
             include_once 'functions/error_functions.php';
             trigger_error('Problems selecting session values for: ' . $session_id . '.', E_USER_WARNING);
         } elseif (!empty($result[0])) {
             include_once 'classes/cs_session_item.php';
             $session_item = new cs_session_item();
             $session_item->setSessionID($session_id);
             $session = $result[0];
             if (!empty($session['session_value'])) {
                 if (strstr($session['session_value'], 'cs_mail_obj')) {
                     // must included here, because this objects could get out of the session
                     include_once 'classes/cs_mail_obj.php';
                 }
                 include_once 'functions/text_functions.php';
                 $session_array = mb_unserialize($session['session_value']);
             } else {
                 $session_array = array();
             }
             $session_item->_data = $session_array;
             if ($this->_cache_on) {
                 $this->_cache_object[$session_id] = $session_item;
             }
         }
     }
     return $session_item;
 }
Exemplo n.º 18
0
 public function getFields()
 {
     return mb_unserialize($this->_data['fields']);
 }
Exemplo n.º 19
0
try {
    $orderModel = TServiceOrderModel::model();
    $orderData = $orderModel->getCard($order_id, $uid);
    if (!$orderData || !$orderModel->isStatusEmpClose() || !$orderModel->isReserve()) {
        throw new Exception('None');
    }
    $reserveInstance = $orderModel->getReserve();
    if (!$reserveInstance->isAllowPayout($uid) || !$reserveInstance->isFrlAllowFinance()) {
        throw new Exception('Not isAllowPayout');
    }
    $reservesPayout = new ReservesPayoutTest();
    $reserve_id = $reserveInstance->getID();
    $reservesPayout->getPayoutReqv($reserve_id);
    $data_reqv = $reservesPayout->getPayoutReqv($reserve_id);
    if ($data_reqv) {
        $reqv = mb_unserialize($data_reqv['fields']);
        if ($reqv) {
            $type = $data_reqv['pay_type'];
            $reqv['skr_destinationCardSynonim'] = '246a784938d65740aa6cd175a179121c0cdef707_scn';
            $res = $reservesPayout->updateReqv($reserve_id, $reqv);
            var_dump($res);
            exit;
        }
    }
    /*
        $sum = $reserveInstance->getPayoutSum();
        
        $res = $reservesPayout->getUserReqvs($uid, $type, $sum);
        
        var_dump($res);
    */
Exemplo n.º 20
0
 public function getPayoutsInfo()
 {
     require_once ABS_PATH . '/classes/reserves/ReservesPayout.php';
     $reservesPayout = new ReservesPayout();
     $payoutList = $reservesPayout->getPayouts($this->getID());
     if ($payoutList) {
         foreach ($payoutList as $key => $payoutItem) {
             $payoutList[$key]['price'] = tservices_helper::cost_format($payoutItem['price'], true);
             $payoutList[$key]['status_txt'] = self::$_payout_status_txt[$payoutItem['status']];
             $payoutList[$key]['error'] = $payoutItem['error'] == 0 ? 'нет' : $payoutItem['error'];
             $payoutList[$key]['date'] = date('d.m.Y H:i', strtotime($payoutItem['date']));
             $payoutList[$key]['last'] = $payoutItem['last'] ? date('d.m.Y H:i', strtotime($payoutItem['last'])) : ' — ';
             $payoutList[$key]['techmessage'] = $payoutList[$key]['techmessage'] ? $payoutList[$key]['techmessage'] : ' — ';
         }
     }
     $payoutReqv = $reservesPayout->getPayoutReqv($this->getID());
     if ($payoutReqv) {
         require_once ABS_PATH . '/classes/reserves/ReservesPayoutPopup.php';
         $payoutReqv['pay_type_txt'] = ReservesPayoutPopup::$payments_short_text[$payoutReqv['pay_type']];
         $payoutReqv['date'] = date('d.m.Y H:i', strtotime($payoutReqv['date']));
         $payoutReqv['last'] = $payoutReqv['last'] ? date('d.m.Y H:i', strtotime($payoutReqv['last'])) : ' — ';
         $payoutReqv['fields'] = mb_unserialize($payoutReqv['fields']);
         $payoutReqv['is_bank'] = $payoutReqv['pay_type'] == ReservesPayoutPopup::PAYMENT_TYPE_BANK;
         $payoutReqv['is_allow_change_status'] = $payoutReqv['is_bank'] && !$this->isStatusPayPayed();
     }
     $payoutLog = $reservesPayout->getErrorLog($this->getID());
     $payouts = array('list' => $payoutList, 'reqv' => $payoutReqv, 'log' => $payoutLog);
     return $payouts;
 }
Exemplo n.º 21
0
 function getCountPlugin($plugin, $start, $end)
 {
     $retour = 0;
     $query = "SELECT " . $this->addDatabasePrefix($this->_db_table) . ".email," . $this->addDatabasePrefix($this->_db_table) . ".extras FROM " . $this->addDatabasePrefix($this->_db_table) . " WHERE";
     if (!empty($this->_context_array_limit) and count($this->_context_array_limit) > 0) {
         $query .= " context_id IN (" . implode(',', encode(AS_DB, $this->_context_array_limit)) . ")";
     } elseif (!empty($this->_room_limit)) {
         $query .= " context_id = '" . encode(AS_DB, $this->_room_limit) . "'";
     }
     $query .= " and " . $this->addDatabasePrefix($this->_db_table) . ".extras LIKE '%LASTLOGIN_" . mb_strtoupper($plugin) . "%' and user.creation_date < '" . encode(AS_DB, $end) . "'";
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result)) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems counting all accounts.', E_USER_WARNING);
     } else {
         $retour_array = array();
         include_once 'functions/text_functions.php';
         foreach ($result as $rs) {
             $extra_array = array();
             if (!empty($rs['extras'])) {
                 $extra_array = mb_unserialize($rs['extras']);
                 if (!empty($extra_array['LASTLOGIN_' . mb_strtoupper($plugin)]) and $extra_array['LASTLOGIN_' . mb_strtoupper($plugin)] > $start) {
                     $retour_array[] = $rs['email'];
                 }
             }
         }
         unset($result);
         if (!empty($retour_array)) {
             $retour_array = array_unique($retour_array);
             $retour = count($retour_array);
         }
     }
     return $retour;
 }
Exemplo n.º 22
0
       class="b-button b-button_flat b-button_flat_green b-button_margbot_30 b-button_margtop_30" 
       onClick="yaCounter6051055.reachGoal('add_new_tu');">
        Добавить услугу
    </a>
    <?php 
}
?>
    <div class="b-layout b-layout_padtop_20 b-layout__cf">
    <?php 
if (count($data)) {
    ?>
        <?php 
    foreach ($data as $el) {
        $url = sprintf('/tu/%d/%s.html', $el['id'], tservices_helper::translit($el['title']));
        $edit_url = sprintf('/users/%s/tu/edit/%d/', $user->login, $el['id']);
        $videos = !empty($el['videos']) ? mb_unserialize($el['videos']) : array();
        $video = count($videos) ? current($videos) : NULL;
        ?>
        <figure class="i-pic i-pic_port_z-index_inherit <?php 
        if ($user->is_pro == 'f') {
            ?>
i-pic_tu<?php 
        } else {
            ?>
i-pic_tu-col-4<?php 
        }
        ?>
">

            <a href="<?php 
        if ($el['is_blocked'] == 't') {
Exemplo n.º 23
0
  */
 $query = mysql_query("SELECT * FROM `" . $pixelpost_db_prefix . "localization`");
 $row = mysql_fetch_array($query, MYSQL_ASSOC);
 /**
  * Unserialize the defualt language array using the UTF8 safe unserialize function, mb_unserialize.
  *
  */
 $pp_supp_lang = mb_unserialize(stripslashes($row['pp_supp_lang']));
 /**
  * If a user supplied language array exists,
  * Unserialize the user language array using the UTF8 safe unserialize function, mb_unserialize,
  * and merge with the default pixelpost array.
  *
  */
 if (!empty($row['user_supp_lang'])) {
     $user_supp_lang = mb_unserialize(stripslashes($row['user_supp_lang']));
     $pp_supp_lang = array_merge($pp_supp_lang, $user_supp_lang);
 }
 //var_dump($pp_supp_lang);
 /**
  * Sort Array By Second Index (SABSI)
  *
  */
 $pp_supp_lang = sabsi($pp_supp_lang, 1);
 $i = 0;
 $pp_available_langs = '';
 foreach ($pp_supp_lang as $lang => $parts) {
     $i++;
     $className = $i % 2 ? 'cellTwo' : 'cellOne';
     $delete = $parts[0] != 'EN' ? '<td class="' . $className . '" align="center"><input type="checkbox" name="delete[]" value="' . $parts[0] . '" /></td>' : '<td></td>';
     $pp_available_langs .= '
Exemplo n.º 24
0
 /**
  * Массив в свойства обьекта.
  * 
  * @param type $data
  *
  * @return bool
  */
 public function arrayToFieldsProps($data = array())
 {
     if (!count($data)) {
         return false;
     }
     foreach ($data as $key => $value) {
         if (in_array($key, $this->_default_fields_schema)) {
             if (in_array($key, $this->_serialized_fields) && $value) {
                 $value = mb_unserialize($value);
             }
             $this->{$key} = $value;
         }
     }
     return true;
 }
 public function index()
 {
     //Load the language file for this module
     $this->language->load('module/tg_themegloballite_settings');
     //Set the title from the language file $_['heading_title'] string
     $this->document->setTitle('TG Themeglobal Pro Theme Options');
     //Load the settings model. You can also add any other models you want to load here.
     $this->load->model('setting/setting');
     $config_data = array('main_layout', 'page_width', 'max_width', 'add_to_compare_text', 'add_to_wishlist_text', 'add_to_cart_text', 'mycart_text', 'welcome_text', 'more_details_text', 'category_text', 'search_text', 'sale_text', 'product_per_pow', 'product_per_pow2', 'product_scroll_latest', 'product_scroll_featured_category', 'product_scroll_featured', 'product_scroll_bestsellers', 'product_scroll_specials', 'product_scroll_related', 'display_text_sale', 'type_sale', 'display_rating', 'display_add_to_compare', 'display_add_to_wishlist', 'display_add_to_cart', 'quick_view', 'category_page_display_quickview', 'category_page_display_add_to_wishlist', 'product_image_effect', 'default_list_grid', 'refine_search_style', 'refine_image_width', 'refine_image_height', 'refine_search_number', 'product_image_zoom', 'position_image_additional', 'product_social_share', 'customfooter', 'colors_status', 'body_font_text', 'body_font_links', 'body_font_links_hover', 'body_price_text', 'body_price_old_text', 'headlines_product_strong_text_color', 'headlines_active_text_color', 'product_name_text_color', 'product_name_text_color_hover', 'body_background_color', 'top_bar_backgroud', 'top_bar_border', 'top_menu_links_hover', 'top_menu_color', 'top_menu_links', 'top_search_icon_background', 'menu_links_hover', 'menu_links', 'menu_submenu_links', 'menu_submenu_links_hover', 'menu_border', 'mobile_icon_background', 'mobile_icon_text', 'mobile_menu_links', 'mobile_menu_links_hover', 'mobile_submenu_links', 'mobile_submenu_links_hover', 'mobile_menu_background', 'mobile_menu_border', 'slider_bullet_color', 'slider_bullet_hover_color', 'column_text_color', 'column_headlines_color', 'column_text_color', 'column_hover_text_color', 'breadcrumb_text_color', 'breadcrumb_hover_text_color', 'sale_color_text', 'sale_border', 'sale_background', 'to_top_color_text', 'to_top_background', 'ratings_background', 'ratings_active_background', 'buttons_color_text', 'buttons_background', 'buttons_border', 'buttons_hover_color_text', 'buttons_hover_background', 'buttons_hover_border', 'carousel_bullets_background', 'carousel_active_bullets_background', 'customfooter_color_text', 'customfooter_hover_color_text', 'customfooter_color_heading', 'customfooter_icon_color', 'customfooter_border_color', 'customfooter_background_color', 'social_icon_background', 'social_icon_color', 'social_border_color', 'social_hover_icon_background', 'social_hover_icon_color', 'social_hover_border_color', 'widget_facebook_background', 'widget_twitter_background', 'widget_custom_background', 'background_status', 'body_background', 'body_background_background', 'body_background_subtle_patterns', 'body_background_position', 'body_background_repeat', 'body_background_attachment', 'font_status', 'categories_bar', 'categories_bar_weight', 'categories_bar_px', 'headlines', 'headlines_weight', 'headlines_px', 'headlines_px_medium', 'footer_headlines', 'footer_headlines_weight', 'footer_headlines_px', 'footer_column', 'footer_column_weight', 'footer_column_px', 'body_font', 'body_font_px', 'body_font_weight', 'top_header_font', 'top_header_font_px', 'top_header_font_weight', 'product_name', 'product_name_weight', 'product_name_px', 'button_font', 'button_font_weight', 'button_font_px', 'custom_price', 'custom_price_weight', 'custom_price_px', 'custom_price_px_old_price', 'product_image_zoom', 'product_scroll_latest', 'product_scroll_featured', 'product_scroll_bestsellers', 'product_scroll_specials', 'product_scroll_related', 'custom_code_css_status', 'custom_code_css', 'custom_code_javascript_status', 'custom_code_js', 'refine_image_width', 'refine_image_height', 'payment_status', 'payment', 'widget_facebook_status', 'widget_facebook_id', 'widget_facebook_position', 'widget_twitter_status', 'widget_twitter_id', 'widget_twitter_user_name', 'widget_twitter_position', 'widget_twitter_limit', 'widget_custom_status', 'widget_custom_content', 'widget_custom_position');
     foreach ($config_data as $conf) {
         $data[$conf] = false;
     }
     function removeDir($path)
     {
         $dir = new DirectoryIterator($path);
         foreach ($dir as $fileinfo) {
             if ($fileinfo->isFile() || $fileinfo->isLink()) {
                 unlink($fileinfo->getPathName());
             } elseif (!$fileinfo->isDot() && $fileinfo->isDir()) {
                 removeDir($fileinfo->getPathName());
             }
         }
         rmdir($path);
     }
     // themegloballite MUTLI STORE
     if (isset($this->request->post['store_id'])) {
         $data['store_id'] = $this->request->post['store_id'];
     } else {
         $data['store_id'] = $this->config->get('d_store_id');
     }
     $data['stores'] = array();
     $this->load->model('setting/store');
     $results = $this->model_setting_store->getStores();
     $data['stores'][] = array('name' => 'Default', 'href' => '', 'store_id' => 0);
     foreach ($results as $result) {
         $data['stores'][] = array('name' => $result['name'], 'href' => $result['url'], 'store_id' => $result['store_id']);
     }
     if (isset($_GET['store_id'])) {
         $data['store_id'] = $_GET['store_id'];
     } else {
         if (isset($_GET['submit'])) {
             $data['store_id'] = $data['store_id'];
         } else {
             if (isset($this->request->post['store_id'])) {
                 $data['store_id'] = $this->request->post['store_id'];
             } else {
                 $data['store_id'] = 0;
             }
         }
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $data['array'] = array('d_store_id' => $this->request->post['store_id']);
         $this->model_setting_setting->editSetting('d_id_store', $data['array']);
     }
     // END MULTISTORE
     $data['setting_skin'] = $this->model_setting_setting->getSetting('themegloballite_skin', $data['store_id']);
     if ($data['store_id'] == 0) {
         $data['edit_skin_store'] = 'default';
     } else {
         $data['edit_skin_store'] = $data['store_id'];
     }
     if (isset($data['setting_skin']['themegloballite_skin'])) {
         $data['active_skin'] = $data['setting_skin']['themegloballite_skin'];
     } else {
         $data['active_skin'] = 'default';
     }
     if (!file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin'] . '')) {
         $data['active_skin'] = false;
     }
     if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/')) {
         $data['skins'] = array();
         $dir = opendir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/');
         while (false !== ($file = readdir($dir))) {
             if (is_dir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $file) && $file != '.' && $file != '..') {
                 $data['skins'][] = $file;
             }
         }
     }
     if (isset($data['setting_skin']['themegloballite_skin'])) {
         $data['active_skin_edit'] = $data['setting_skin']['themegloballite_skin'];
     } else {
         $data['active_skin_edit'] = 'default';
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (isset($_POST['button-edit']) || isset($_POST['button-delete'])) {
             $data['active_skin_edit'] = $this->request->post['skin'];
         }
     }
     if (isset($this->request->post['save_skin']) && !isset($_POST['button-edit']) && !isset($_POST['button-delete'])) {
         $data['active_skin_edit'] = $this->request->post['save_skin'];
     }
     if (isset($_GET['skin_edit'])) {
         $data['active_skin_edit'] = $_GET['skin_edit'];
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (isset($_POST['button-active'])) {
             $save_themegloballite_skin = array('themegloballite_skin' => $this->request->post['skin']);
             $this->model_setting_setting->editSetting('themegloballite_skin', $save_themegloballite_skin, $this->request->post['store_id']);
             $this->session->data['success'] = $this->language->get('text_success');
             $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
         }
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (isset($_POST['add-skin'])) {
             if (is_writable(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/') && (is_writable(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') || !file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/'))) {
                 if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') && filetype(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') == 'dir') {
                 } else {
                     mkdir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/', 0777);
                 }
                 if ($this->request->post['add-skin-name'] != '') {
                     if (!file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/')) {
                         mkdir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/', 0777);
                         file_put_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/settings.json', json_encode($config_data));
                         mkdir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/js/', 0777);
                         file_put_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/js/custom_code.js', ' ');
                         mkdir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/css/', 0777);
                         file_put_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $this->request->post['add-skin-name'] . '/css/custom_code.css', ' ');
                         $this->session->data['success'] = $this->language->get('text_success');
                         $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
                     }
                 }
             }
             $this->session->data['error_warning'] = 'You need to set CHMOD 777 for all folder and subfolder in catalog/view/theme/' . $this->config->get('config_template') . '/skins!';
             $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
         }
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (isset($_POST['button-save'])) {
             if (is_writable(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins') && is_writable(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store']) && is_writable(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'])) {
                 if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') && filetype(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') == 'dir' && file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '')) {
                     file_put_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/settings.json', json_encode($this->request->post));
                     // Custom js
                     file_put_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/js/custom_code.js', $this->request->post['custom_code_js']);
                     // Custom css
                     file_put_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/css/custom_code.css', $this->request->post['custom_code_css']);
                     $this->session->data['success'] = $this->language->get('text_success');
                     $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true&skin_edit=' . $data['active_skin_edit'] . '', 'token=' . $this->session->data['token'], 'SSL'));
                 }
             }
             $this->session->data['error_warning'] = 'You need to set CHMOD 777 for all folder and subfolder in catalog/view/theme/' . $this->config->get('config_template') . '/skins!';
             $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
         }
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (isset($_POST['button-delete'])) {
             if (is_writable(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins')) {
                 if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') && filetype(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/') == 'dir' && file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '')) {
                     if ($data['active_skin_edit'] != $data['active_skin']) {
                         removeDir(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '');
                         $this->session->data['success'] = $this->language->get('text_success');
                         $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
                     }
                 }
             } else {
                 $this->session->data['error_warning'] = 'You need to set CHMOD 777 for all folder and subfolder in catalog/view/theme/' . $this->config->get('config_template') . '/skins!';
                 $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
             }
             $this->session->data['error_warning'] = $this->language->get('text_warning2');
             $this->response->redirect($this->url->link('module/tg_themegloballite_settings&submit=true', 'token=' . $this->session->data['token'], 'SSL'));
         }
     }
     if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/settings.json')) {
         $template = json_decode(file_get_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/settings.json'), true);
         if (isset($template)) {
             foreach ($template as $option => $value) {
                 if ($option != 'store_id') {
                     $data[$option] = $value;
                 }
             }
         }
     }
     if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/js/custom_code.js')) {
         $data['custom_code_js'] = file_get_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/js/custom_code.js');
     }
     if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/css/custom_code.css')) {
         $data['custom_code_css'] = file_get_contents(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/skins/store_' . $data['edit_skin_store'] . '/' . $data['active_skin_edit'] . '/css/custom_code.css');
     }
     $data['text_image_manager'] = 'Image manager';
     $data['token'] = $this->session->data['token'];
     $text_strings = array('heading_title');
     foreach ($text_strings as $text) {
         $data[$text] = $this->language->get($text);
     }
     // Revolution slider
     if (isset($_POST['install_tg_tglite_revolution_slider'])) {
         $dir = '../data_sample/themegloballite/tg_tglite_revolution_slider.php';
         function mb_unserialize($serial_str)
         {
             $out = preg_replace('!s:(\\d+):"(.*?)";!se', "'s:'.strlen('\$2').':\"\$2\";'", $serial_str);
             return unserialize($out);
         }
         if (is_file($dir)) {
             $data = mb_unserialize(file_get_contents($dir));
             if (is_array($data)) {
                 $output = array();
                 $output["tg_tglite_revolution_slider_module"] = $data;
                 $this->model_setting_setting->editSetting("tg_tglite_revolution_slider", $output);
             }
         }
         include '../data_sample/themegloballite/tg_tglite_revolution_slider_query.php';
         $this->session->data['success'] = $this->language->get('text_success');
         $this->response->redirect($this->url->link('module/tg_themegloballite_settings', 'token=' . $this->session->data['token'], 'SSL'));
     }
     // OpenCart Default Module
     if (isset($_POST['install_tg_other_module'])) {
         // LATEST INSTALL
         $query = $this->db->query("\n\t\t\t\t\t\tINSERT INTO `" . DB_PREFIX . "module` (`module_id`, `name`, `code`, `setting`) VALUES\n\t\t\t\t\t\t(34, 'Home Page Content Top', 'latest', 'a:5:{s:4:\"name\";s:21:\"Home Page Content Top\";s:5:\"limit\";s:2:\"10\";s:5:\"width\";s:3:\"200\";s:6:\"height\";s:3:\"200\";s:6:\"status\";s:1:\"1\";}'),\n\t\t\t\t\t\t(35, 'Category Page Column Left', 'latest', 'a:5:{s:4:\"name\";s:25:\"Category Page Column Left\";s:5:\"limit\";s:1:\"8\";s:5:\"width\";s:2:\"60\";s:6:\"height\";s:2:\"60\";s:6:\"status\";s:1:\"1\";}'),\n\t\t\t\t\t\t(36, 'Home Page Content Bottom', 'carousel', 'a:5:{s:4:\"name\";s:24:\"Home Page Content Bottom\";s:9:\"banner_id\";s:1:\"8\";s:5:\"width\";s:3:\"100\";s:6:\"height\";s:3:\"100\";s:6:\"status\";s:1:\"1\";}');\n\t\t\t\t\t");
         $query = $this->db->query("\n\t\t\t\t\t\tINSERT INTO `" . DB_PREFIX . "layout_module` (`layout_module_id`, `layout_id`, `code`, `position`, `sort_order`) VALUES\n\t\t\t\t\t\t(100, 1, 'latest.34', 'content_top', 0), \n\t\t\t\t\t\t(101, 3, 'latest.35', 'column_left', 2)\n\t\t\t\t\t");
         // INFORMATION INSTALL
         $output["information_status"] = 1;
         $this->model_setting_setting->editSetting("information", $output);
         $query = $this->db->query("\n\t\t\t\t\t\t\tINSERT INTO `" . DB_PREFIX . "layout_module` (`layout_module_id`, `layout_id`, `code`, `position`, `sort_order`) VALUES\n\t\t\t\t\t\t\t(102, 3, 'information', 'column_left', 4);\n\t\t\t\t\t\t\t");
         // CATEGORY INSTALL
         $output["category_status"] = 1;
         $this->model_setting_setting->editSetting("category", $output);
         $query = $this->db->query("\n\t\t\t\t\t\t\tINSERT INTO `" . DB_PREFIX . "layout_module` (`layout_module_id`, `layout_id`, `code`, `position`, `sort_order`) VALUES\n\t\t\t\t\t\t\t(103, 3, 'category', 'column_left', 0),\n\t\t\t\t\t\t\t(104, 2, 'category', 'column_left', 0),\n\t\t\t\t\t\t\t(105, 5, 'category', 'column_left', 0),\n\t\t\t\t\t\t\t(106, 1, 'carousel.36', 'content_bottom', 0);\n\t\t\t\t\t\t\t");
         $this->session->data['success'] = $this->language->get('text_success');
         $this->response->redirect($this->url->link('module/tg_themegloballite_settings', 'token=' . $this->session->data['token'], 'SSL'));
     }
     if (isset($this->session->data['error_warning'])) {
         $data['error_warning'] = $this->session->data['error_warning'];
         unset($this->session->data['error_warning']);
     } elseif (isset($this->error['warning'])) {
         $data['error_warning'] = $this->error['warning'];
     } else {
         $data['error_warning'] = '';
     }
     if (isset($this->session->data['success'])) {
         $data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $data['success'] = '';
     }
     $data['action'] = $this->url->link('module/tg_themegloballite_settings', 'token=' . $this->session->data['token'], 'SSL');
     $data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'));
     $data['breadcrumbs'][] = array('text' => 'Modules', 'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
     $data['breadcrumbs'][] = array('text' => 'ThemeGlobal Theme Options', 'href' => $this->url->link('module/beamstore', 'token=' . $this->session->data['token'], 'SSL'));
     // Multilanguage
     $this->load->model('localisation/language');
     $data['languages'] = $this->model_localisation_language->getLanguages();
     // No image
     $this->load->model('tool/image');
     $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
     $data['header'] = $this->load->controller('common/header');
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['footer'] = $this->load->controller('common/footer');
     //Send the output.
     $this->response->setOutput($this->load->view('module/tg_themegloballite_settings.tpl', $data));
 }
Exemplo n.º 26
0
function XMLToArray($xml)
{
    if ($xml instanceof SimpleXMLElement) {
        $children = $xml->children();
        $return = null;
    } else {
        $xml = simplexml_load_string($xml);
        if ($xml instanceof SimpleXMLElement) {
            $children = $xml->children();
        } else {
            $children = array();
        }
        $return = null;
    }
    foreach ($children as $element => $value) {
        if (strstr($element, 'XML_')) {
            $element_begin = mb_substr($element, 0, 4);
            if ($element_begin = 'XML_') {
                $element = mb_substr($element, 4);
            }
        }
        if ($value instanceof SimpleXMLElement) {
            $counter = 0;
            foreach ($value->children() as $children) {
                $counter++;
            }
            if ($counter > 0) {
                $return[$element] = XMLToArray($value);
            } else {
                if (!empty($element) and $element == 'extras') {
                    $value = mb_unserialize(utf8_decode((string) $value));
                } elseif (isset($value)) {
                    // convert > and < to their html entities (gt; and &lt;)
                    if (strstr($value, "%CS_AND;")) {
                        $value = mb_ereg_replace("%CS_AND;", "&", $value);
                    }
                    if (strstr($value, "%CS_LT;")) {
                        $value = mb_ereg_replace("%CS_LT;", "<", $value);
                    }
                    if (strstr($value, "%CS_GT;")) {
                        $value = mb_ereg_replace("%CS_GT;", ">", $value);
                    }
                    $value = utf8_decode($value);
                    // needed for PHP5
                } else {
                    $value = '';
                }
                if (!isset($return[$element])) {
                    if (is_array($value)) {
                        $return[$element] = $value;
                    } else {
                        $return[$element] = (string) $value;
                    }
                } else {
                    if (!is_array($return[$element])) {
                        $return[$element] = array($return[$element], (string) $value);
                    } else {
                        $return[$element][] = (string) $value;
                    }
                }
            }
        }
    }
    if (is_array($return)) {
        return $return;
    } else {
        return false;
    }
}
Exemplo n.º 27
0
 /**
  * В каждой строке списка типовых услуг добавляет массив видео-клипов
  *
  * @param array $rows
  * @param $src_attrs имя атрибута, где указана информация о видео-клипах
  * @param $dest_attr имя атрибута, в котором будет сохранён список видео-клипов
  * @return $this
  */
 public function readVideos(&$rows, $src_attrs, $dest_attr)
 {
     if (empty($src_attrs) || empty($dest_attr)) {
         return $this;
     }
     foreach ($rows as &$row) {
         $row[$dest_attr] = mb_unserialize($row[$src_attrs]);
     }
     return $this;
 }
Exemplo n.º 28
0
 /**
  * Создает и возвращает экземпляр класса
  * @param type $className
  * @param type $classParams
  * @return object
  */
 private function getClass($className, $classParams)
 {
     $parameters = mb_unserialize($classParams);
     require_once "{$className}.php";
     $reflectionClass = new ReflectionClass($className);
     $class = $reflectionClass->newInstanceArgs($parameters);
     return $class;
 }
Exemplo n.º 29
0
 public function load_from_resultset($rs)
 {
     $main = $rs[0];
     $this->id = $main->id;
     $this->name = $main->name;
     // the fields below give an absoulte path to the website: protocol://subdomain.domain/folder
     $this->protocol = $main->protocol;
     $this->subdomain = $main->subdomain;
     $this->domain = $main->domain;
     $this->folder = $main->folder;
     $this->word_separator = value_or_default($main->word_separator, '_');
     $this->redirect_to = $main->redirect_to;
     $this->wrong_path_action = $main->wrong_path_action;
     $this->wrong_path_redirect = $main->wrong_path_redirect;
     $this->empty_path_action = $main->empty_path_action;
     $this->languages = mb_unserialize($main->languages);
     $this->languages_published = array_filter(mb_unserialize($main->languages_published));
     $this->date_format = $main->date_format;
     $this->tinymce_css = $main->tinymce_css;
     $this->resize_uploaded_images = $main->resize_uploaded_images;
     $this->comments_enabled_for = $main->comments_enabled_for;
     $this->comments_default_moderator = $main->comments_default_moderator;
     $this->share_files_media_browser = $main->share_files_media_browser;
     $this->additional_scripts = $main->additional_scripts;
     $this->permission = $main->permission;
     $this->block_types = mb_unserialize($main->block_types);
     $this->homepage = $main->homepage;
     $this->default_timezone = $main->default_timezone;
     $this->metatag_description = json_decode($main->metatag_description, true);
     $this->metatag_keywords = json_decode($main->metatag_keywords, true);
     $this->metatags = json_decode($main->metatags, true);
     $this->favicon = $main->favicon;
     $this->mail_mailer = $main->mail_mailer;
     $this->mail_server = $main->mail_server;
     $this->mail_port = $main->mail_port;
     $this->mail_security = $main->mail_security;
     $this->mail_user = $main->mail_user;
     $this->mail_address = $main->mail_address;
     $this->mail_password = $main->mail_password;
     $this->theme = $main->theme;
     $this->theme_options = json_decode($main->theme_options);
     $this->aliases = json_decode($main->aliases, true);
     $this->contact_emails = mb_unserialize($main->contact_emails);
     if (!is_array($this->contact_emails)) {
         $this->contact_emails = array();
     }
     if (!is_array($this->languages)) {
         $this->languages = array();
     }
     $this->languages_list = array_keys($this->languages);
     date_default_timezone_set($this->default_timezone);
 }
Exemplo n.º 30
0
 /** Prepares the db_array for the item
  *
  * @param $db_array Contains the data from the database
  *
  * @return array Contains prepared data ( textfunctions applied etc. )
  */
 function _buildItem($db_array)
 {
     include_once 'functions/text_functions.php';
     $db_array['recurrence_pattern'] = mb_unserialize($db_array['recurrence_pattern']);
     return parent::_buildItem($db_array);
 }