PHP unserialize Examples

PHP unserialize - 30 examples found. These are the top rated real world PHP examples of unserialize extracted from open source projects. You can rate examples to help us improve the quality of examples.
 public function testSerialization()
 {
     $expression = new ParsedExpression('25', new ConstantNode('25'));
     $serializedExpression = serialize($expression);
     $unserializedExpression = unserialize($serializedExpression);
     $this->assertEquals($expression, $unserializedExpression);
 }
function list_ressource($automount)
{
    $sock = new sockets();
    $datas = $sock->getFrameWork("cmd.php?B64-dirdir=" . base64_encode("/automounts/{$automount}"));
    $files = unserialize(base64_decode(trim($datas)));
    if (!is_array($files)) {
        $_GET["cyrus-brows-comp"] = "/automounts/{$automount}";
        list_ressources2();
        return;
    }
    $html = "<table style='width:80%'>";
    if (is_array($files)) {
        while (list($num, $ligne) = each($files)) {
            if (!preg_match("#backup\\.[0-9\\-]+#", $ligne)) {
                continue;
            }
            $md5 = md5($num);
            $ligne = str_replace("backup.", "", $ligne);
            $js = "SelectMountRestoreLevel2('{$md5}','{$num}')";
            $html = $html . "\n\t\t\t<tr " . CellRollOver($js, "{select_this_container}") . ">\n\t\t\t\t<td with=1%><img src='img/folder-32-sh\tare.png'>\n\t\t\t\t<td width=99%><span style='font-size:14px'>{$ligne}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2><div id='{$md5}'><hr></div></td>\n\t\t\t</tR>\n\t\t\t\t\t\n\t\t\t";
        }
    }
    $html = $html . "</table>";
    return $html;
}
 function __construct()
 {
     add_action('admin_menu', array($this, 'admin_menu'));
     add_action('widgetopts_module_cards', array($this, 'visibility'));
     add_action('widgetopts_module_cards', array($this, 'devices'));
     add_action('widgetopts_module_cards', array($this, 'alignment'));
     add_action('widgetopts_module_cards', array($this, 'hide_title'));
     add_action('widgetopts_module_cards', array($this, 'classes'));
     add_action('widgetopts_module_cards', array($this, 'logic'));
     add_action('widgetopts_module_cards', array($this, 'links'));
     add_action('widgetopts_module_cards', array($this, 'fixed'));
     add_action('widgetopts_module_cards', array($this, 'columns'));
     add_action('widgetopts_module_cards', array($this, 'roles'));
     add_action('widgetopts_module_cards', array($this, 'dates'));
     add_action('widgetopts_module_cards', array($this, 'styling'));
     add_action('widgetopts_module_cards', array($this, 'animation'));
     add_action('widgetopts_module_cards', array($this, 'taxonomies'));
     add_action('widgetopts_module_cards', array($this, 'shortcodes'));
     add_action('widgetopts_module_cards', array($this, 'disable_widgets'));
     add_action('widgetopts_module_cards', array($this, 'permission'));
     add_action('widgetopts_module_cards', array($this, 'siteorigin'));
     // add_action( 'widgetopts_module_cards', array( $this, 'suggest' ) );
     add_action('widgetopts_module_sidebar', array($this, 'upgrade_pro'));
     add_action('widgetopts_module_sidebar', array($this, 'optin'));
     add_action('widgetopts_module_sidebar', array($this, 'support_box'));
     add_action('widgetopts_module_sidebar', array($this, 'more_plugins'));
     // add_action( 'widgetopts_module_cards', array( $this, 'upsell_pro' ) );
     add_action('wp_ajax_widgetopts_ajax_settings', array($this, 'ajax_request'));
     // add_action( 'admin_init' , array(&$this,'on_load_page' ));
     $this->settings = unserialize(get_option('widgetopts_tabmodule-settings'));
 }
Example #4
0
 /**
  **	信息编辑
  **/
 public function detail()
 {
     $id = trim($this->input['id']);
     if (!$id) {
         $this->errorOutput(OBJECT_NULL);
     }
     $info = array();
     $info['files'] = array();
     $info = $this->messagereceived->detail($id);
     $info['files'] = $this->messagereceived->detailfiles($id);
     $info['picture'] = array();
     $info['video'] = array();
     $info['annex'] = array();
     foreach ($info['files'] as $key => $value) {
         if ($value['typeid'] == 1) {
             $info['picture'][] = $value['host'] . $value['dir'] . $value['filepath'] . $value['filename'];
         }
         if ($value['typeid'] == 2) {
             $video_array = array();
             $video_vid = array();
             $video_vid = unserialize($value['backup']);
             $video_array['vid'] = $video_vid['vid'];
             $video_array['pic'] = $video_vid['pic'];
             $video_array['url'] = $value['host'] . $value['dir'] . "/" . $value['filepath'];
             $info['video'][] = $video_array;
         }
         if ($value['typeid'] == 3) {
             $info['annex'][] = $value;
         }
     }
     $this->addItem($info);
     $this->output();
 }
Example #5
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once dirname(__FILE__) . '/sfLimeHarness.class.php';
     $h = new sfLimeHarness(array('force_colors' => isset($options['color']) && $options['color'], 'verbose' => isset($options['trace']) && $options['trace']));
     $h->addPlugins(array_map(array($this->configuration, 'getPluginConfiguration'), $this->configuration->getPlugins()));
     $h->base_dir = sfConfig::get('sf_test_dir');
     $status = false;
     $statusFile = sfConfig::get('sf_cache_dir') . '/.test_all_status';
     if ($options['only-failed']) {
         if (file_exists($statusFile)) {
             $status = unserialize(file_get_contents($statusFile));
         }
     }
     if ($status) {
         foreach ($status as $file) {
             $h->register($file);
         }
     } else {
         // filter and register all tests
         $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
         $h->register($this->filterTestFiles($finder->in($h->base_dir), $arguments, $options));
     }
     $ret = $h->run() ? 0 : 1;
     file_put_contents($statusFile, serialize($h->get_failed_files()));
     if ($options['xml']) {
         file_put_contents($options['xml'], $h->to_xml());
     }
     return $ret;
 }
 protected function _getAll()
 {
     $result = array();
     $_temp = array();
     global $wpdb;
     $key_prefix = $this->_getOptionName('');
     $terms = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE '{$key_prefix}%'");
     foreach ($terms as $term) {
         if (is_serialized($term->option_value)) {
             $_term = unserialize($term->option_value);
             $key = str_replace($key_prefix, '', $term->option_name);
             if (trim($_term['description'])) {
                 $_temp[$_term['description']][] = array('key' => $key, 'term' => $_term);
             } else {
                 $_temp[] = array('key' => $key, 'term' => $_term);
             }
         }
     }
     ksort($_temp);
     foreach ($_temp as $temp) {
         if (!isset($temp['key'])) {
             foreach ($temp as $t) {
                 $result[$t['key']] = $t['term'];
             }
         } else {
             $result[$temp['key']] = $temp['term'];
         }
     }
     return $result;
 }
Example #7
0
 /**
  * Set column referrer
  *
  * @param string $data The source data.
  * @return string
  */
 public static function setReferrer($data)
 {
     // unserialize
     $data = unserialize($data);
     // return correct data
     return isset($data['server']['HTTP_REFERER']) ? '<a href="' . $data['server']['HTTP_REFERER'] . '">' . $data['server']['HTTP_REFERER'] . '</a>' : '';
 }
Example #8
0
 public function indexOp()
 {
     //查询会员及其附属信息
     $result = parent::pointshopMInfo(true);
     $member_info = $result['member_info'];
     unset($result);
     $model_member = Model('member');
     //获得会员升级进度
     $membergrade_arr = $model_member->getMemberGradeArr(true, $member_info['member_exppoints'], $member_info['level']);
     Tpl::output('membergrade_arr', $membergrade_arr);
     //处理经验值计算说明文字
     $exppoints_rule = C("exppoints_rule") ? unserialize(C("exppoints_rule")) : array();
     $ruleexplain_arr = array();
     $exppoints_rule['exp_orderrate'] = floatval($exppoints_rule['exp_orderrate']);
     if ($exppoints_rule['exp_orderrate'] > 0) {
         $ruleexplain_arr['exp_order'] = "经验值以有效购物金额作为计算标准,有效购物金额{$exppoints_rule['exp_orderrate']}元=1经验值;";
         $exp_ordermax = intval($exppoints_rule['exp_ordermax']);
         if ($exp_ordermax > 0) {
             $ruleexplain_arr['exp_order'] .= "单个订单最多获得{$exppoints_rule['exp_ordermax']}经验值;";
         }
     }
     $exppoints_rule['exp_login'] = intval($exppoints_rule['exp_login']);
     if ($exppoints_rule['exp_login'] > 0) {
         $ruleexplain_arr['exp_login'] = "会员每天第一次登录获得{$exppoints_rule['exp_login']}经验值;";
     }
     $exppoints_rule['exp_comments'] = intval($exppoints_rule['exp_comments']);
     if ($exppoints_rule['exp_comments'] > 0) {
         $ruleexplain_arr['exp_comments'] = "进行一次订单商品评价将获得{$exppoints_rule['exp_comments']}经验值;";
     }
     Tpl::output('ruleexplain_arr', $ruleexplain_arr);
     //分类导航
     $nav_link = array(0 => array('title' => L('homepage'), 'link' => SHOP_SITE_URL), 1 => array('title' => L('nc_pointprod'), 'link' => urlShop('pointshop', 'index')), 2 => array('title' => '我的成长进度'));
     Tpl::output('nav_link_list', $nav_link);
     Tpl::showpage('pointgrade');
 }
Example #9
0
 private function _dataInLocalLog()
 {
     $modelGameOperateLog = $this->_getGlobalData('Model_GameOperateLog', 'object');
     $this->_loadCore('Help_SqlSearch');
     //载入sql工具
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($modelGameOperateLog->tName());
     $helpSqlSearch->set_conditions("game_server_id=" . intval($_REQUEST['server_id']));
     $helpSqlSearch->set_conditions("operate_type=" . self::LOGTYPE);
     $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE);
     $helpSqlSearch->set_orderBy('Id desc');
     $sql = $helpSqlSearch->createSql();
     $data = $modelGameOperateLog->select($sql);
     $users = $this->_getGlobalData('user_index_id');
     //获得所有用户的数组
     foreach ($data as &$sub) {
         $sub['user_id'] = $users[$sub['user_id']];
         $sub['create_time'] = date('Y-m-d H:i:s', $sub['create_time']);
         $sub['URL_del'] = $this->_urlLockAccountDel($sub['game_user_id'], $sub['game_user_account'], $sub['game_user_nickname']);
         $sub['info'] = unserialize($sub['info']);
         $sub['endTime'] = $sub['info']['FromGame']['endTime'];
     }
     $this->_assign['dataList'] = $data;
     $this->_loadCore('Help_Page');
     //载入分页工具
     $conditions = $helpSqlSearch->get_conditions();
     $helpPage = new Help_Page(array('total' => $modelGameOperateLog->findCount($conditions), 'perpage' => PAGE_SIZE));
     $this->_assign['pageBox'] = $helpPage->show();
 }
Example #10
0
 public function __construct()
 {
     parent::_initialize();
     $this->token = $this->_get('token');
     $this->wecha_id = $this->wecha_id;
     if (!$this->token) {
         $product_cart_model = M('product_cart');
         $out_trade_no = $this->_get('out_trade_no');
         $order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
         if (!$order) {
             $order = $product_cart_model->where(array('id' => intval($this->_get('out_trade_no'))))->find();
         }
         $this->token = $order['token'];
     }
     $payConfig = M('Alipay_config')->where(array('token' => $this->token))->find();
     $payConfigInfo = unserialize($payConfig['info']);
     $this->payConfig = $payConfigInfo['weixin'];
     if (ACTION_NAME == 'pay' || ACTION_NAME == 'new_pay') {
         if (empty($this->payConfig['is_old'])) {
             $this->new_pay();
             exit;
         } else {
             $this->pay();
             exit;
         }
     }
 }
Example #11
0
 protected function setUp()
 {
     $this->_data['PRODUCT'] = unserialize(file_get_contents(PATH_DADOS . 'products.reg'));
     $this->_data['PROVIDERS'] = unserialize(file_get_contents(PATH_DADOS . 'providers.reg'));
     $this->_data['SECTOR'] = unserialize(file_get_contents(PATH_DADOS . 'sector.reg'));
     $this->_data['TURNOVERS'] = unserialize(file_get_contents(PATH_DADOS . 'turnovers.reg'));
 }
Example #12
0
 public function testSerialization()
 {
     $router = \Phalcon\DI::getDefault()->getShared('router');
     $serialized = serialize($router);
     $unserialized = unserialize($serialized);
     $this->assertEquals($unserialized, $router);
 }
Example #13
0
 public function viewthread_modoption()
 {
     global $_G;
     if (!$_G['adminid']) {
         return false;
     }
     $usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']);
     if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) {
         if (self::$util->isfounder($_G['member']) == false) {
             return false;
         }
     }
     $tid = $_G['tid'];
     $title = urlencode(trim($_G['forum_thread']['subject']));
     $post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1);
     include_once libfile('function/discuzcode');
     $content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message']));
     $content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content);
     $content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content);
     $content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content);
     $content = strip_tags(discuzcode($content, 0, 0, 0));
     $content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content);
     $content = str_replace('&nbsp;', ' ', $content);
     $content = urlencode(cutstr($content, 50, ''));
     include template('qqgroup:push');
     return trim($return);
 }
 /**
  * Gets the visible reports of this content type for the viewing user.
  *
  * @see XenForo_ReportHandler_Abstract:getVisibleReportsForUser()
  */
 public function getVisibleReportsForUser(array $reports, array $viewingUser)
 {
     $reportsByUser = array();
     foreach ($reports as $reportId => $report) {
         $info = unserialize($report['content_info']);
         $reportsByUser[$info['profile_user_id']][] = $reportId;
     }
     $users = XenForo_Model::create('XenForo_Model_User')->getUsersByIds(array_keys($reportsByUser), array('join' => XenForo_Model_User::FETCH_USER_PRIVACY, 'followingUserId' => $viewingUser['user_id']));
     $userProfileModel = XenForo_Model::create('XenForo_Model_UserProfile');
     foreach ($reportsByUser as $userId => $userReports) {
         $remove = false;
         if (isset($users[$userId]) && !$userProfileModel->canViewFullUserProfile($users[$userId], $null, $viewingUser)) {
             $remove = true;
         } else {
             if (!XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'editAny') && !XenForo_Permission::hasPermission($viewingUser['permissions'], 'profilePost', 'deleteAny')) {
                 $remove = true;
             }
         }
         if ($remove) {
             foreach ($userReports as $reportId) {
                 unset($reports[$reportId]);
             }
         }
     }
     return $reports;
 }
Example #15
0
function Main()
{
    //header('Content-Type: text/html; charset=iso-8859-1');
    if (isset($_SESSION['casores']) && $_SESSION['casores'] > 0) {
        if ($_POST['k']) {
            $idnodo = $_POST['k'];
            $res = new Resolucao();
            $res->setCodcaso($_SESSION['casores']);
            $hash = $res->BuscaConteudoPelaChave($idnodo);
            if ($hash != false) {
                $res->RegistraVisitaNodo($idnodo);
                if ($hash->ContainsKey("fim")) {
                    if ($hash->getValue("fim") == "S") {
                        // É fim do caso. Deve atualizar status
                        $u = unserialize($_SESSION['usu']);
                        $res->setCodusuario($u->getCodigo());
                        $res->setCodresolucao($_SESSION['codresolucao']);
                        if (!$res->ConcluiResolucao()) {
                            echo $res->getErro();
                        }
                    }
                }
                echo Comuns::Idioma($hash->ToXML());
            } else {
                die(Comuns::Idioma("ERRO: @lng[hash retornou false]"));
            }
        } else {
            die(Comuns::Idioma("ERRO: @lng[Conteúdo não informado]"));
        }
    } else {
        die(Comuns::Idioma("ERRO: @lng[Caso não encontrado]"));
    }
}
Example #16
0
 protected function fetchObjectFromCache($key)
 {
     if (false === ($result = unserialize($this->cache->get($this->getHierarchyKey($key))))) {
         return [false, null];
     }
     return $result;
 }
Example #17
0
 /**
  * @test
  */
 public function shouldDeserialize()
 {
     $helper = new SamlSpInfoHelper();
     $expectedSamlSpInfo = $helper->getSamlSpInfo();
     $unserializedSamlSpInfo = unserialize(serialize($expectedSamlSpInfo));
     $this->assertEquals($expectedSamlSpInfo, $unserializedSamlSpInfo);
 }
Example #18
0
 /**
  * 初始化权限系统
  */
 protected function initAuth()
 {
     $this->config->load('allow');
     $this->allow = $this->config->item('allow');
     foreach ($this->allow as $key => $value) {
         $allow[$key] = $value['auth'];
     }
     if ($this->user['username'] != 'admin') {
         $this->load->model('Groups_model', 'groups');
         $groups = $this->groups->get($this->user['groups']);
         $auth = unserialize($groups->auth);
         foreach ($allow as $ctrl => $value) {
             if (array_key_exists($ctrl, $auth)) {
                 foreach ($value as $func => $value) {
                     if (!in_array($func, $auth[$ctrl])) {
                         unset($allow[$ctrl][$func]);
                     }
                 }
             } else {
                 unset($allow[$ctrl]);
             }
         }
     }
     $this->data['auth'] = $this->auth = $allow;
 }
Example #19
0
 function cp_show_refine_search($catid)
 {
     global $wpdb;
     $fid = '';
     // get the category ids from all the form_cats fields.
     // they are stored in a serialized array which is why
     // we are doing a separate select. If the form is not
     // active, then don't return any cats.
     $results = $wpdb->get_results("SELECT ID, form_cats FROM {$wpdb->cp_ad_forms} WHERE form_status = 'active'");
     if ($results) {
         // now loop through the recordset
         foreach ($results as $result) {
             // put the form_cats into an array
             $catarray = unserialize($result->form_cats);
             // now search the array for the $catid which was passed in via the cat drop-down
             if (in_array($catid, $catarray)) {
                 $fid = $result->ID;
             }
             // when there's a catid match, grab the form id
         }
         // now we should have the formid so show the form layout based on the category selected
         $sql = $wpdb->prepare("SELECT f.field_label, f.field_name, f.field_type, f.field_values, f.field_perm, m.field_search, m.meta_id, m.field_pos, m.field_req, m.form_id " . "FROM {$wpdb->cp_ad_fields} f " . "INNER JOIN {$wpdb->cp_ad_meta} m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "AND f.field_type <> 'text area' " . "AND m.field_search = '1' " . "ORDER BY m.field_pos ASC", $fid);
         $results = $wpdb->get_results($sql);
         // echo $sql;
         //print_r($results);
         if ($results) {
             echo cp_refine_search_builder($results);
         }
         // loop through the custom form fields and display them
     }
 }
Example #20
0
 static function mark_review()
 {
     global $wpdb;
     $_watu = new WatuPRO();
     // this will only happen for logged in users
     if (!is_user_logged_in()) {
         return false;
     }
     $taking_id = $_watu->add_taking($_POST['exam_id'], 1);
     // select current data if any
     $marked_for_review = $wpdb->get_var($wpdb->prepare("SELECT marked_for_review FROM " . WATUPRO_TAKEN_EXAMS . "\n\t\t\tWHERE ID=%d", $taking_id));
     if (empty($marked_for_review)) {
         $marked_for_review = array("question_ids" => array(), "question_nums" => array());
     } else {
         $marked_for_review = unserialize($marked_for_review);
     }
     if ($_POST['act'] == 'mark') {
         $marked_for_review['question_ids'][] = $_POST['question_id'];
         $marked_for_review['question_nums'][] = $_POST['question_num'];
     } else {
         // unmark
         foreach ($marked_for_review['question_ids'] as $cnt => $id) {
             if ($id == $_POST['question_id']) {
                 unset($marked_for_review['question_ids'][$cnt]);
             }
         }
         foreach ($marked_for_review['question_nums'] as $cnt => $num) {
             if ($num == $_POST['question_num']) {
                 unset($marked_for_review['question_nums'][$cnt]);
             }
         }
     }
     // now save
     $wpdb->query($wpdb->prepare("UPDATE " . WATUPRO_TAKEN_EXAMS . " SET marked_for_review=%s WHERE ID=%d", serialize($marked_for_review), $taking_id));
 }
Example #21
0
function cron_verifyTiezi()
{
    global $m;
    $set = unserialize(option::get('plugin_verifyTiezi'));
    $today = date("Y-m-d");
    //准备:扫描verifyTiezi表中lastdo不是今天的,然后更新verifyTiezi_data表的remain
    $sy = $m->query("SELECT * FROM `" . DB_PREFIX . "verifyTiezi` WHERE `lastdo` != '{$today}';");
    while ($sx = $m->fetch_array($sy)) {
        $m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'verifyTiezi_data` SET `remain` = \'' . $sx['num'] . '\' WHERE `uid` = ' . $sx['uid']);
        $m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'verifyTiezi` SET `lastdo` = \'' . $today . '\' WHERE `uid` = ' . $sx['uid']);
    }
    //开始:计划任务
    $count = $m->once_fetch_array("SELECT COUNT(*) AS `c` FROM `" . DB_PREFIX . "verifyTiezi_data` WHERE `remain` > '0' LIMIT {$set['rem']};");
    if ($count['c'] == $set['rem']) {
        $y = rand_row(DB_PREFIX . 'verifyTiezi_data', 'id', $set['rem'], "`remain` > '0'");
    } else {
        $y = rand_row(DB_PREFIX . 'verifyTiezi_data', 'id', $count['c'], "`remain` > '0'");
    }
    //如果只有一条记录的兼容方案
    if (isset($y['url'])) {
        $y = array(0 => $y);
    }
    foreach ($y as $x) {
        if (!empty($x['pid']) && !empty($x['uid'])) {
            $u = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "verifyTiezi` WHERE `uid` = '{$x['uid']}'");
            $cont = unserialize($u['cont']);
            $remain = $x['remain'] - 1;
            $res = verifyTiezi_send($x['uid'], $x['url'], $x['pid'], rand_array($cont), $set['device']);
            $m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'verifyTiezi_data` SET `remain` = \'' . $remain . '\',`status` = \'' . $res['status'] . '\',`msg` = \'' . $res['msg'] . '\' WHERE `url` = \'' . $x['url'] . '\' AND `uid` = ' . $x['uid']);
            sleep($set['sleep']);
        }
    }
}
Example #22
0
 function init()
 {
     //Session field for sort
     if (@$_SESSION[$this->listObject->sessionPrefix . "_orderFieldsList"]) {
         $this->fieldsList = unserialize($_SESSION[$this->listObject->sessionPrefix . "_orderFieldsList"]);
     }
 }
Example #23
0
function sunrise_wpml_filter_queries($q)
{
    global $wpdb, $table_prefix, $current_blog;
    static $no_recursion;
    if (empty($current_blog) && empty($no_recursion)) {
        $no_recursion = true;
        if (preg_match("#SELECT \\* FROM {$wpdb->blogs} WHERE domain = '(.*)'#", $q, $matches)) {
            if (!$wpdb->get_row($q)) {
                $icl_blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
                foreach ($icl_blogs as $blog_id) {
                    $prefix = $blog_id > 1 ? $table_prefix . $blog_id . '_' : $table_prefix;
                    $icl_settings = $wpdb->get_var("SELECT option_value FROM {$prefix}options WHERE option_name='icl_sitepress_settings'");
                    if ($icl_settings) {
                        $icl_settings = unserialize($icl_settings);
                        if ($icl_settings && $icl_settings['language_negotiation_type'] == 2) {
                            if (in_array('http://' . $matches[1], $icl_settings['language_domains'])) {
                                $found_blog_id = $blog_id;
                                break;
                            }
                        }
                    }
                }
                if ($found_blog_id) {
                    $q = "SELECT * FROM {$wpdb->blogs} WHERE blog_id = '" . $found_blog_id . "'";
                }
            }
        }
        $no_recursion = false;
    }
    return $q;
}
 /**
  * Reference purchase summary
  *
  * @Route()
  * @Method({"GET", "POST"})
  * @Template()
  *
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction(Request $request)
 {
     $previouslyPostedData = null;
     // if we are not posting new data, and a request for $this->formType is stored in the session, prepopulate the form with the stored request
     $storedRequest = unserialize($request->getSession()->get($this->formType->getName()));
     if ($request->isMethod('GET') && $storedRequest instanceof Request) {
         $previouslyPostedData = $this->createForm($this->formType)->handleRequest($storedRequest)->getData();
     }
     $form = $this->createForm($this->formType, $previouslyPostedData);
     if ($request->isMethod('POST')) {
         $form->submit($request);
         if ($form->isValid()) {
             // Persist the case to IRIS
             /** @var ReferencingCase $case */
             $case = $form->getData()['case'];
             $this->irisEntityManager->persist($case);
             /** @var ReferencingApplication $application */
             foreach ($case->getApplications() as $application) {
                 // Always default
                 $application->setSignaturePreference(SignaturePreference::SCAN_DECLARATION);
                 $this->irisEntityManager->persist($application, array('caseId' => $case->getCaseId()));
                 // Persist each guarantor of the application
                 if (null !== $application->getGuarantors()) {
                     foreach ($application->getGuarantors() as $guarantor) {
                         $this->irisEntityManager->persist($guarantor, array('applicationId' => $application->getApplicationId()));
                     }
                 }
             }
             $request->getSession()->set('submitted-case', serialize($case));
             // Send the user to the success page
             return $this->redirect($this->generateUrl('barbon_hostedapi_agent_reference_newreference_tenancyagreement_index'), 301);
         }
     }
     return array('form' => $form->createView());
 }
function buildjs()
{
    $t = $_GET["t"];
    $time = time();
    $MEPOST = 0;
    $cachefile = $GLOBALS["PROGRESS_FILE"];
    $logsFile = $GLOBALS["LOG_FILE"];
    header("content-type: application/x-javascript");
    $tpl = new templates();
    $page = CurrentPageName();
    $array = unserialize(@file_get_contents($cachefile));
    $prc = intval($array["POURC"]);
    $title = $tpl->javascript_parse_text($array["TEXT"]);
    if ($prc == 0) {
        echo "\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}&key={$_GET["key"]}&filename=" . urlencode($_GET["filename"]) . "');\n}\nsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    $md5file = md5_file($logsFile);
    if ($md5file != $_GET["md5file"]) {
        echo "\n\tvar xStart{$time}= function (obj) {\n\t\tif(!document.getElementById('text-{$t}')){return;}\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){\n\t\t\tdocument.getElementById('text-{$t}').value=res;\n\t\t}\t\t\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$md5file}&key={$_GET["key"]}&filename=" . urlencode($_GET["filename"]) . "');\n\t}\t\t\n\t\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Filllogs', 'yes');\n\t\tXHR.appendData('filename','" . urlencode($_GET["filename"]) . "');\n\t\tXHR.appendData('key','" . urlencode($_GET["key"]) . "');\n\t\tXHR.appendData('t', '{$t}');\n\t\tXHR.setLockOff();\n\t\tXHR.sendAndLoad('{$page}', 'POST',xStart{$time},false); \n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    if ($prc > 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\tdocument.getElementById('title-{$t}').style.border='1px solid #C60000';\n\t\tdocument.getElementById('title-{$t}').style.color='#C60000';\n\t\t\$('#progress-{$t}').progressbar({ value: 100 });\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    if ($prc == 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLayersTabsAllAfter();\n\t\tRTMMailHide();\n\t\tCacheOff();\n\t\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    echo "\t\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}&key={$_GET["key"]}&filename=" . urlencode($_GET["filename"]) . "');\n\t}\n\tsetTimeout(\"Start{$time}()\",1500);\n";
    //Loadjs('$page?build-js=yes&t=$t&md5file={$_GET["md5file"]}');
}
function theme_front_enqueue_script()
{
    wp_enqueue_script('jquery');
    wp_enqueue_script("jquery-migrate");
    wp_enqueue_script('jquery-ui-core');
    wp_register_script('SFSIjqueryModernizr', SFSI_PLUGURL . 'js/shuffle/modernizr.custom.min.js', array('jquery'), '', true);
    wp_enqueue_script("SFSIjqueryModernizr");
    wp_register_script('SFSIjqueryShuffle', SFSI_PLUGURL . 'js/shuffle/jquery.shuffle.min.js', array('jquery'), '', true);
    wp_enqueue_script("SFSIjqueryShuffle");
    wp_register_script('SFSIjqueryrandom-shuffle', SFSI_PLUGURL . 'js/shuffle/random-shuffle-min.js', array('jquery'), '', true);
    wp_enqueue_script("SFSIjqueryrandom-shuffle");
    wp_register_script('SFSICustomJs', SFSI_PLUGURL . 'js/custom.js', array('jquery'), '', true);
    wp_enqueue_script("SFSICustomJs");
    /* end cusotm js */
    /* initilaize the ajax url in javascript */
    wp_localize_script('SFSICustomJs', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
    wp_localize_script('SFSICustomJs', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php'), 'plugin_url' => SFSI_PLUGURL));
    /* include CSS for front-end and backend  */
    wp_enqueue_style("SFSImainCss", SFSI_PLUGURL . 'css/sfsi-style.css');
    //including floating option css
    $option5 = unserialize(get_option('sfsi_section5_options', false));
    if ($option5['sfsi_disable_floaticons'] == 'yes') {
        wp_enqueue_style("disable_sfsi", SFSI_PLUGURL . 'css/disable_sfsi.css');
    }
}
function buildjs()
{
    $t = $_GET["t"];
    $time = time();
    $MEPOST = 0;
    header("content-type: application/x-javascript");
    $tpl = new templates();
    $page = CurrentPageName();
    $array = unserialize(@file_get_contents($GLOBALS["CACHEFILE"]));
    $prc = intval($array["POURC"]);
    $title = $tpl->javascript_parse_text($array["TEXT"]);
    $md5file = trim(md5_file($GLOBALS["LOGSFILES"]));
    echo "// CACHE FILE: {$GLOBALS["CACHEFILE"]} {$prc}%\n";
    echo "// LOGS FILE: {$GLOBALS["LOGSFILES"]} - {$md5file} " . strlen($md5file) . "\n";
    if ($prc == 0) {
        if (strlen($md5file) < 32) {
            echo "\n\t// PRC = {$prc} ; md5file={$md5file}\n\tfunction Start{$time}(){\n\t\t\tif(!RTMMailOpen()){return;}\n\t\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
            return;
        }
    }
    if ($md5file != $_GET["md5file"]) {
        echo "\n\tvar xStart{$time}= function (obj) {\n\t\tif(!document.getElementById('text-{$t}')){return;}\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){\n\t\t\tdocument.getElementById('text-{$t}').value=res;\n\t\t}\t\t\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$md5file}');\n\t}\t\t\n\t\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('Filllogs', 'yes');\n\t\tXHR.appendData('t', '{$t}');\n\t\tXHR.setLockOff();\n\t\tXHR.sendAndLoad('{$page}', 'POST',xStart{$time},false); \n\t}\n\tsetTimeout(\"Start{$time}()\",1000);";
        return;
    }
    if ($prc > 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\tdocument.getElementById('title-{$t}').style.border='1px solid #C60000';\n\t\tdocument.getElementById('title-{$t}').style.color='#C60000';\n\t\t\$('#progress-{$t}').progressbar({ value: 100 });\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    if ($prc == 100) {
        echo "\n\tfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\t\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\t\tRTMMailHide();\n\t}\n\tsetTimeout(\"Start{$time}()\",1000);\n\t";
        return;
    }
    echo "\t\nfunction Start{$time}(){\n\t\tif(!RTMMailOpen()){return;}\n\t\tdocument.getElementById('title-{$t}').innerHTML='{$title}';\n\t\t\$('#progress-{$t}').progressbar({ value: {$prc} });\n\t\tLoadjs('{$page}?build-js=yes&t={$t}&md5file={$_GET["md5file"]}');\n\t}\n\tsetTimeout(\"Start{$time}()\",1500);\n";
}
/** returns a hash of all extensions used on the system
 * @param boolean   Set to true if json should be returned, defaults to false
 * @return mixed    returns a hash of all extensions on system as array or json encoded
 * @description     returns a full extension map where the index is the extension number and the
 *                  value is what extension is using it. If there are duplicates defined, it will
 *                  only show one of the extensions as duplicates is an unacceptable error condition
 */
function framework_get_extmap($json = false)
{
    global $amp_conf;
    static $extmap = array();
    $extmap_serialized = '';
    // If aggresive mode, we get it each time
    //
    if (!$amp_conf['AGGRESSIVE_DUPLICATE_CHECK']) {
        $extmap_serialized = sql("SELECT `data` FROM `module_xml` WHERE `id` = 'extmap_serialized'", "getOne");
    }
    // Now make sure there was something there
    //
    if ($extmap_serialized) {
        $extmap = unserialize($extmap_serialized);
    }
    // At this point in aggresive mode we haven't gotten it, if not aggressive but
    // not found in the DB then we still don't have it so try again.
    //
    if (!empty($extmap)) {
        return $json ? json_encode($extmap) : $extmap;
    } else {
        $full_list = framework_check_extension_usage(true);
        foreach ($full_list as $module => $entries) {
            foreach ($entries as $exten => $stuff) {
                $extmap[$exten] = $stuff['description'];
            }
        }
        return $json ? json_encode($extmap) : $extmap;
    }
}
Example #29
0
/**
 * Gets the list of currently installed roster addons
 *
 * @return string formatted list of addons
 */
function makeAddonCredits()
{
    global $roster;
    if (count($roster->addon_data) == 0) {
        return;
    }
    $roster->tpl->assign_var('S_ADDON_CREDITS', true);
    foreach ($roster->addon_data as $addon) {
        // Save current locale array
        // Since we add all locales for localization, we save the current locale array
        // This is in case one addon has the same locale strings as another, and keeps them from overwritting one another
        $localetemp = $roster->locale->wordings;
        foreach ($roster->multilanguages as $lang) {
            $roster->locale->add_locale_file(ROSTER_ADDONS . $addon['basename'] . DIR_SEP . 'locale' . DIR_SEP . $lang . '.php', $lang);
        }
        $addon_name = isset($roster->locale->act[$addon['fullname']]) ? $roster->locale->act[$addon['fullname']] : $addon['fullname'];
        // Restore our locale array
        $roster->locale->wordings = $localetemp;
        unset($localetemp);
        $roster->tpl->assign_block_vars('addon_row', array('ROW_CLASS' => $roster->switch_row_class(), 'NAME' => $addon_name, 'VERSION' => $addon['version']));
        $addon_array = unserialize($addon['credits']);
        foreach ($addon_array as $addon_dev) {
            $roster->tpl->assign_block_vars('addon_row.addon_credit_row', array('NAME' => $addon_dev['name'], 'INFO' => $addon_dev['info']));
        }
    }
}
Example #30
0
function ninja_forms_import_form($data)
{
    global $wpdb;
    $form = unserialize($data);
    // change the update date to today
    $form['date_updated'] = date('Y-m-d H:i:s');
    // get the form fields
    $form_fields = $form['field'];
    unset($form['field']);
    $form = apply_filters('ninja_forms_before_import_form', $form);
    $form['data'] = serialize($form['data']);
    $wpdb->insert(NINJA_FORMS_TABLE_NAME, $form);
    $form_id = $wpdb->insert_id;
    $form['id'] = $form_id;
    if (is_array($form_fields)) {
        for ($x = 0; $x < count($form_fields); $x++) {
            $form_fields[$x]['form_id'] = $form_id;
            $form_fields[$x]['data'] = serialize($form_fields[$x]['data']);
            $old_field_id = $form_fields[$x]['id'];
            $form_fields[$x]['id'] = NULL;
            $wpdb->insert(NINJA_FORMS_FIELDS_TABLE_NAME, $form_fields[$x]);
            $form_fields[$x]['id'] = $wpdb->insert_id;
            $form_fields[$x]['old_id'] = $old_field_id;
            $form_fields[$x]['data'] = unserialize($form_fields[$x]['data']);
        }
    }
    $form['data'] = unserialize($form['data']);
    $form['field'] = $form_fields;
    do_action('ninja_forms_after_import_form', $form);
    return $form['id'];
}