Skip to content

Commit

Permalink
Remove dependency on Horde_Serialize
Browse files Browse the repository at this point in the history
Waste of resources, since it doesn't get us anything above using
json_*() directly.
  • Loading branch information
slusarz committed Nov 4, 2013
1 parent d0e3996 commit 95e333f
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 38 deletions.
6 changes: 3 additions & 3 deletions imp/lib/Ajax/Application.php
Expand Up @@ -99,7 +99,7 @@ protected function _init()

/* Make sure the viewport entry is initialized. */
$vp = isset($this->_vars->viewport)
? Horde_Serialize::unserialize($this->_vars->viewport, Horde_Serialize::JSON)
? json_decode($this->_vars->viewport)
: new stdClass;
$this->_vars->viewport = new Horde_Support_ObjectStub($vp);

Expand All @@ -112,7 +112,7 @@ protected function _init()

/* Check for global poll task. */
if (isset($this->_vars->poll)) {
$poll = Horde_Serialize::unserialize($this->_vars->poll, Horde_Serialize::JSON);
$poll = json_decode($this->_vars->poll);
$this->queue->poll(
empty($poll)
? $injector->getInstance('IMP_Ftree')->poll->getPollList()
Expand Down Expand Up @@ -241,7 +241,7 @@ public function viewPortData($change)
}

if ($vp->search) {
$search = Horde_Serialize::unserialize($vp->search, Horde_Serialize::JSON);
$search = json_decode($vp->search);
$args += array(
'search_buid' => isset($search->buid) ? $search->buid : null,
'search_unseen' => isset($search->unseen) ? $search->unseen : null
Expand Down
16 changes: 8 additions & 8 deletions imp/lib/Ajax/Application/Handler/Dynamic.php
Expand Up @@ -236,7 +236,7 @@ public function emptyMailbox()
*/
public function flagAll()
{
$flags = Horde_Serialize::unserialize($this->vars->flags, Horde_Serialize::JSON);
$flags = json_decode($this->vars->flags);
if (!$this->vars->mbox || empty($flags)) {
return false;
}
Expand Down Expand Up @@ -322,7 +322,7 @@ public function listMailboxes()
}

if (!$no_mbox) {
$mboxes = IMP_Mailbox::formFrom(Horde_Serialize::unserialize($this->vars->mboxes, Horde_Serialize::JSON));
$mboxes = IMP_Mailbox::formFrom(json_decode($this->vars->mboxes));
foreach ($mboxes as $val) {
if (!$val->inbox) {
$iterator->append(
Expand All @@ -343,7 +343,7 @@ public function listMailboxes()
$iterator->append($special);
} else {
$this->_base->queue->setMailboxOpt('expand', 1);
foreach (IMP_Mailbox::formFrom(Horde_Serialize::unserialize($this->vars->mboxes, Horde_Serialize::JSON)) as $val) {
foreach (IMP_Mailbox::formFrom(json_decode($this->vars->mboxes)) as $val) {
$iterator->append(IMP_Ftree_IteratorFilter::create(
$mask | IMP_Ftree_IteratorFilter::NO_UNEXPANDED,
$val->tree_elt
Expand Down Expand Up @@ -379,7 +379,7 @@ public function dynamicInit()
$this->_base->callAction('viewPort');

$this->vars->initial = 1;
$this->vars->mboxes = Horde_Serialize::serialize(array($this->vars->mbox), Horde_Serialize::JSON);
$this->vars->mboxes = json_encode(array($this->vars->mbox));
$this->listMailboxes();

$this->_base->queue->flagConfig();
Expand Down Expand Up @@ -500,7 +500,7 @@ public function flagMessages()
return false;
}

$flags = Horde_Serialize::unserialize($this->vars->flags, Horde_Serialize::JSON);
$flags = json_decode($this->vars->flags);

/* Check for non-system flags. If we find any, and the server supports
* CONDSTORE, we should make sure that these flags are only updated if
Expand Down Expand Up @@ -702,7 +702,7 @@ public function deleteAttach()

if (isset($this->vars->atc_indices)) {
$imp_compose = $injector->getInstance('IMP_Factory_Compose')->create($this->vars->imp_compose);
foreach (Horde_Serialize::unserialize($this->vars->atc_indices, Horde_Serialize::JSON) as $val) {
foreach (json_decode($this->vars->atc_indices) as $val) {
if (isset($imp_compose[$val])) {
$notification->push(sprintf(_("Deleted attachment \"%s\"."), Horde_Mime::decode($imp_compose[$val]->getPart()->getName(true))), 'horde.success');
unset($imp_compose[$val]);
Expand Down Expand Up @@ -930,7 +930,7 @@ public function addAttachmentCkeditor()
return new Horde_Core_Ajax_Response_Raw(
'<html>' .
Horde::wrapInlineScript(array(
'window.parent.CKEDITOR.tools.callFunction(' . $this->vars->CKEditorFuncNum . ',' . Horde_Serialize::serialize($url, Horde_Serialize::JSON) . ',' . Horde_Serialize::serialize($data, Horde_Serialize::JSON) . ')'
'window.parent.CKEDITOR.tools.callFunction(' . $this->vars->CKEditorFuncNum . ',' . json_encode($url) . ',' . json_encode($data) . ')'
)) .
'</html>',
'text/html'
Expand Down Expand Up @@ -1032,7 +1032,7 @@ public function createFlag()
}

$this->vars->add = true;
$this->vars->flags = Horde_Serialize::serialize(array($this->vars->flagname), Horde_Serialize::JSON);
$this->vars->flags = json_encode(array($this->vars->flagname));
$this->flagMessages();

$this->_base->queue->flagConfig();
Expand Down
4 changes: 2 additions & 2 deletions imp/lib/Ajax/Application/Handler/Mboxtoggle.php
Expand Up @@ -35,7 +35,7 @@ public function expandMailboxes()
{
if (!empty($this->vars->mboxes)) {
$GLOBALS['injector']->getInstance('IMP_Ftree')->expand(
IMP_Mailbox::formFrom(Horde_Serialize::unserialize($this->vars->mboxes, Horde_Serialize::JSON))
IMP_Mailbox::formFrom(json_decode($this->vars->mboxes))
);
}

Expand All @@ -60,7 +60,7 @@ public function collapseMailboxes()
$ftree->collapseAll();
} elseif (!empty($this->vars->mboxes)) {
$ftree->collapse(
IMP_Mailbox::formFrom(Horde_Serialize::unserialize($this->vars->mboxes, Horde_Serialize::JSON))
IMP_Mailbox::formFrom(json_decode($this->vars->mboxes))
);
}

Expand Down
2 changes: 1 addition & 1 deletion imp/lib/Ajax/Imple/AutoCompleter/Pretty.php
Expand Up @@ -75,7 +75,7 @@ public function generate(Horde_Core_Ajax_Imple_AutoCompleter $ac)
}

return 'new IMP_PrettyAutocompleter(' .
Horde_Serialize::serialize($dom_id, Horde_Serialize::JSON) . ',' .
json_encode($dom_id) . ',' .
'{' . implode(',', $this->_getOpts($ac)) . '})';
}

Expand Down
4 changes: 2 additions & 2 deletions imp/lib/Application.php
Expand Up @@ -211,7 +211,7 @@ public function menu($menu)
$menu->addArray(array(
'class' => '__noselection',
'icon' => 'imp-empty-trash',
'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your trash mailbox?"), Horde_Serialize::JSON, 'UTF-8') . ')',
'onclick' => 'return window.confirm(' . json_encode(_("Are you sure you wish to empty your trash mailbox?")) . ')',
'text' => _("Empty _Trash"),
'url' => $trash->url('mailbox')->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => $injector->getInstance('Horde_Token')->get('imp.mailbox')))
));
Expand All @@ -224,7 +224,7 @@ public function menu($menu)
$menu->addArray(array(
'class' => '__noselection',
'icon' => 'imp-empty-spam',
'onclick' => 'return window.confirm(' . Horde_Serialize::serialize(_("Are you sure you wish to empty your spam mailbox?"), Horde_Serialize::JSON, 'UTF-8') . ')',
'onclick' => 'return window.confirm(' . json_encode(_("Are you sure you wish to empty your spam mailbox?")) . ')',
'text' => _("Empty _Spam"),
'url' => $spam->url('mailbox')->add(array('actionID' => 'empty_mailbox', 'mailbox_token' => $injector->getInstance('Horde_Token')->get('imp.mailbox')))
));
Expand Down
7 changes: 3 additions & 4 deletions imp/lib/Basic/Search.php
Expand Up @@ -174,10 +174,9 @@ protected function _init()
/* Generate the search query if 'criteria_form' is present in the form
* data. */
if ($this->vars->criteria_form) {
$c_data = Horde_Serialize::unserialize($this->vars->criteria_form, Horde_Serialize::JSON);
$c_list = array();

foreach ($c_data as $val) {
foreach (json_decode($this->vars->criteria_form) as $val) {
switch ($val->t) {
case 'from':
case 'to':
Expand Down Expand Up @@ -300,7 +299,7 @@ protected function _init()
break;

case 'vfolder':
$form = Horde_Serialize::unserialize($this->vars->mboxes_form, Horde_Serialize::JSON);
$form = json_decode($this->vars->mboxes_form);
$q_ob = $imp_search->createQuery($c_list, array(
'id' => IMP_Mailbox::formFrom($this->vars->edit_query_vfolder),
'label' => $this->vars->search_label,
Expand All @@ -319,7 +318,7 @@ protected function _init()
break;

default:
$form = Horde_Serialize::unserialize($this->vars->mboxes_form, Horde_Serialize::JSON);
$form = json_decode($this->vars->mboxes_form);
$q_ob = $imp_search->createQuery($c_list, array(
'mboxes' => IMP_Mailbox::formFrom($form->mbox),
'subfolders' => IMP_Mailbox::formFrom($form->subfolder)
Expand Down
2 changes: 1 addition & 1 deletion imp/lib/Basic/Thread.php
Expand Up @@ -164,7 +164,7 @@ protected function _init()
));
$view->delete = Horde::link($delete_link, _("Delete Thread"), null, null, null, null, null, array('id' => 'threaddelete'));
$page_output->addInlineScript(array(
'$("threaddelete").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete all messages in this thread?"), Horde_Serialize::JSON) . ')) { e.stop(); } })'
'$("threaddelete").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete all messages in this thread?")) . ')) { e.stop(); } })'
), true);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion imp/lib/Dynamic/AddressList.php
Expand Up @@ -31,7 +31,7 @@ class IMP_Dynamic_AddressList
*/
public function parseAddressList($json)
{
$data = Horde_Serialize::unserialize($json, Horde_Serialize::JSON);
$data = json_decode($json);
$out = new Horde_Mail_Rfc822_List();

if (isset($data->g)) {
Expand Down
2 changes: 1 addition & 1 deletion imp/lib/Mime/Viewer/Html.php
Expand Up @@ -83,7 +83,7 @@ protected function _renderInline()
$page_output->addScriptPackage('IMP_Script_Package_Imp');

$data['js'] = array(
'IMP_JS.iframeInject("' . $uid . '", ' . Horde_Serialize::serialize($data['data'], Horde_Serialize::JSON) . ')'
'IMP_JS.iframeInject("' . $uid . '", ' . json_encode($data['data']) . ')'
);

if ($view == $registry::VIEW_SMARTMOBILE) {
Expand Down
6 changes: 3 additions & 3 deletions imp/lib/Prefs/Special/ImageReplacement.php
Expand Up @@ -56,7 +56,7 @@ public function update(Horde_Core_Prefs_Ui $ui)
$alist = new Horde_Mail_Rfc822_List(preg_split("/[\r\n]+/", $ui->vars->safe_addrs));
$alist->unique();

if ($GLOBALS['prefs']->setValue('image_replacement_addrs', Horde_Serialize::serialize($alist->bare_addresses, Horde_Serialize::JSON))) {
if ($GLOBALS['prefs']->setValue('image_replacement_addrs', json_encode($alist->bare_addresses))) {
$this->_addrlist = $alist;
return true;
}
Expand All @@ -70,7 +70,7 @@ public function update(Horde_Core_Prefs_Ui $ui)
public function safeAddrList()
{
if (!isset($this->_addrlist)) {
$alist = Horde_Serialize::unserialize($GLOBALS['prefs']->getValue('image_replacement_addrs'), Horde_Serialize::JSON);
$alist = json_decode($GLOBALS['prefs']->getValue('image_replacement_addrs'));
if (empty($alist)) {
$alist = array();
}
Expand All @@ -92,7 +92,7 @@ public function addSafeAddrList($address)
$alist->add($address);
$alist->unique();

return $GLOBALS['prefs']->setValue('image_replacement_addrs', Horde_Serialize::serialize($alist->bare_addresses, Horde_Serialize::JSON));
return $GLOBALS['prefs']->setValue('image_replacement_addrs', json_encode($alist->bare_addresses));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions imp/lib/Prefs/Special/PgpPrivateKey.php
Expand Up @@ -73,7 +73,7 @@ public function display(Horde_Core_Prefs_Ui $ui)
$view->viewprivate = Horde::link($pgp_url->copy()->add('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key');
$view->infoprivate = Horde::link($pgp_url->copy()->add('actionID', 'info_personal_private_key'), _("Information on Personal Private Key"), null, 'info_key');
$page_output->addInlineScript(array(
'$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
'$("delete_pgp_privkey").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'
), true);
} else {
$page_output->addScriptFile('pgp.js');
Expand All @@ -88,7 +88,7 @@ public function display(Horde_Core_Prefs_Ui $ui)

if (!empty($conf['pgp']['keylength'])) {
$page_output->addInlineScript(array(
'$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Key generation may take a long time to complete. Continue with key generation?"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
'$("create_pgp_key").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Key generation may take a long time to complete. Continue with key generation?")) . ')) { e.stop(); } })'
), true);
}

Expand Down
2 changes: 1 addition & 1 deletion imp/lib/Prefs/Special/SmimePrivateKey.php
Expand Up @@ -69,7 +69,7 @@ public function display(Horde_Core_Prefs_Ui $ui)

$view->viewprivate = Horde::link($smime_url->copy()->add('actionID', 'view_personal_private_key'), _("View Personal Private Key"), null, 'view_key');
$page_output->addInlineScript(array(
'$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . Horde_Serialize::serialize(_("Are you sure you want to delete your keypair? (This is NOT recommended!)"), Horde_Serialize::JSON, 'UTF-8') . ')) { e.stop(); } })'
'$("delete_smime_personal").observe("click", function(e) { if (!window.confirm(' . json_encode(_("Are you sure you want to delete your keypair? (This is NOT recommended!)")) . ')) { e.stop(); } })'
), true);
} elseif ($session->get('imp', 'file_upload')) {
$view->import = true;
Expand Down
4 changes: 2 additions & 2 deletions imp/lib/Search.php
Expand Up @@ -396,10 +396,10 @@ public function editUrl($id)

case $registry::VIEW_DYNAMIC:
return IMP_Dynamic_Mailbox::url()->setAnchor(
'search:' . Horde_Serialize::serialize(array(
'search:' . json_encode(array(
'edit_query' => 1,
'mailbox' => $mbox->form_to
), Horde_Serialize::JSON, 'UTF-8')
))
);
}
}
Expand Down
7 changes: 0 additions & 7 deletions imp/package.xml
Expand Up @@ -1340,13 +1340,6 @@
<max>3.0.0alpha1</max>
<exclude>3.0.0alpha1</exclude>
</package>
<package>
<name>Horde_Serialize</name>
<channel>pear.horde.org</channel>
<min>2.0.0</min>
<max>3.0.0alpha1</max>
<exclude>3.0.0alpha1</exclude>
</package>
<package>
<name>Horde_SpellChecker</name>
<channel>pear.horde.org</channel>
Expand Down

0 comments on commit 95e333f

Please sign in to comment.