update php headers to phpdoc style (and some fixes)
This commit is contained in:
parent
c4972a4a8e
commit
a92e6ec8af
31 changed files with 641 additions and 650 deletions
|
@ -2,7 +2,7 @@ xxx.xx.xx
|
|||
- [ ] Add public page of the list of know urls and in/visible status
|
||||
- [ ] Add passworded links
|
||||
- [ ] fix deprecated external service
|
||||
- [ ] update php header to phpdoc style
|
||||
- [x] update php header to phpdoc style
|
||||
- [x] fix post page options display
|
||||
|
||||
2021.08.28 - pre release
|
||||
|
|
22
_admin.php
22
_admin.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return null;
|
||||
|
|
22
_define.php
22
_define.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
22
_install.php
22
_install.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return;
|
||||
|
|
22
_prepend.php
22
_prepend.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return;
|
||||
|
|
22
_public.php
22
_public.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return;
|
||||
|
@ -43,7 +43,6 @@ $this->addUserAction(
|
|||
/* description */ __('delete the version number')
|
||||
);
|
||||
|
||||
|
||||
# Delete only dc version and plugin files from pluginsBeforeDelete
|
||||
# Keep table
|
||||
|
||||
|
|
22
_widgets.php
22
_widgets.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
<author>Jean-Christian Denis and contributors</author>
|
||||
<desc>Use, create and serve short url on your blog</desc>
|
||||
<file>https://github.com/JcDenis/kUtRL/releases/download/v2021.08.28/plugin-kUtRL.zip</file>
|
||||
<da:dcmin>2.19</da:dcmin>
|
||||
<da:details>http://plugins.dotaddict.org/dc2/details/kUtRL</da:details>
|
||||
<da:section></da:section>
|
||||
<da:support>https://github.com/JcDenis/kUtRL</da:support>
|
||||
</module>
|
||||
</modules>
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
# This file is used with plugin activityReport
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
# This file contents class to acces local short links records
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
class kutrlLinkslist
|
||||
{
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
# Generic class for shorten link service
|
||||
# A service class must extends this one
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
# This file contents class to shorten url pass through wiki
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
# This file takes records from plugin dcMiniUrl
|
||||
# and inserts them into plugin kUtRL.
|
||||
|
@ -19,118 +19,117 @@ if (!defined('DC_CONTEXT_ADMIN')){return;}
|
|||
$miniurl_patch = new dcMiniUrl2kUtRL($core);
|
||||
if ($miniurl_patch->parseRecords())
|
||||
{
|
||||
try
|
||||
{
|
||||
$core->plugins->deactivateModule('dcMiniUrl');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
//$core->error->add($e->getMessage());
|
||||
}
|
||||
try
|
||||
{
|
||||
$core->plugins->deactivateModule('dcMiniUrl');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
//$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
class dcMiniUrl2kUtRL
|
||||
{
|
||||
public $core;
|
||||
public $core;
|
||||
|
||||
public $k_tb;
|
||||
public $m_tb;
|
||||
public $k_tb;
|
||||
public $m_tb;
|
||||
|
||||
public function __construct($core)
|
||||
{
|
||||
$this->core = $core;
|
||||
$this->con = $core->con;
|
||||
$this->k_tb = $core->prefix.'kutrl';
|
||||
$this->m_tb = $core->prefix.'miniurl';
|
||||
}
|
||||
public function __construct($core)
|
||||
{
|
||||
$this->core = $core;
|
||||
$this->con = $core->con;
|
||||
$this->k_tb = $core->prefix.'kutrl';
|
||||
$this->m_tb = $core->prefix.'miniurl';
|
||||
}
|
||||
|
||||
public function parseRecords()
|
||||
{
|
||||
$rs = $this->con->select(
|
||||
'SELECT * FROM '.$this->m_tb.' '
|
||||
);
|
||||
public function parseRecords()
|
||||
{
|
||||
$rs = $this->con->select(
|
||||
'SELECT * FROM '.$this->m_tb.' '
|
||||
);
|
||||
|
||||
while ($rs->fetch())
|
||||
{
|
||||
if ($rs->miniurl_type == 'customurl' || $rs->miniurl_type == 'miniurl')
|
||||
{
|
||||
if ($this->exists($rs)) continue;
|
||||
while ($rs->fetch())
|
||||
{
|
||||
if ($rs->miniurl_type == 'customurl' || $rs->miniurl_type == 'miniurl')
|
||||
{
|
||||
if ($this->exists($rs)) continue;
|
||||
|
||||
$this->insertKutrl($rs);
|
||||
$this->insertLocal($rs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->insertOther($rs);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$this->insertKutrl($rs);
|
||||
$this->insertLocal($rs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->insertOther($rs);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function insertKutrl($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
$cur->kut_service = 'kutrl';
|
||||
$cur->kut_type = 'local';
|
||||
$cur->kut_counter = 0;
|
||||
$cur->kut_password = null;
|
||||
private function insertKutrl($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
$cur->kut_service = 'kutrl';
|
||||
$cur->kut_type = 'local';
|
||||
$cur->kut_counter = 0;
|
||||
$cur->kut_password = null;
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
|
||||
private function insertLocal($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
$cur->kut_service = 'local';
|
||||
$cur->kut_type = $rs->miniurl_type == 'customurl' ?
|
||||
'localcustom' : 'localnormal';
|
||||
private function insertLocal($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
$cur->kut_service = 'local';
|
||||
$cur->kut_type = $rs->miniurl_type == 'customurl' ?
|
||||
'localcustom' : 'localnormal';
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
|
||||
private function insertOther($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
private function insertOther($rs)
|
||||
{
|
||||
$cur = $this->common($rs);
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
|
||||
private function common($rs)
|
||||
{
|
||||
$cur = $this->con->openCursor($this->k_tb);
|
||||
$this->con->writeLock($this->k_tb);
|
||||
$cur->kut_id = $this->nextId();
|
||||
$cur->blog_id = $rs->blog_id;
|
||||
$cur->kut_service = 'unknow';
|
||||
$cur->kut_type = $rs->miniurl_type;
|
||||
$cur->kut_hash = $rs->miniurl_id;
|
||||
$cur->kut_url = $rs->miniurl_str;
|
||||
$cur->kut_dt = $rs->miniurl_dt;
|
||||
$cur->kut_counter = $rs->miniurl_counter;
|
||||
$cur->kut_password = $rs->miniurl_password;
|
||||
private function common($rs)
|
||||
{
|
||||
$cur = $this->con->openCursor($this->k_tb);
|
||||
$this->con->writeLock($this->k_tb);
|
||||
$cur->kut_id = $this->nextId();
|
||||
$cur->blog_id = $rs->blog_id;
|
||||
$cur->kut_service = 'unknow';
|
||||
$cur->kut_type = $rs->miniurl_type;
|
||||
$cur->kut_hash = $rs->miniurl_id;
|
||||
$cur->kut_url = $rs->miniurl_str;
|
||||
$cur->kut_dt = $rs->miniurl_dt;
|
||||
$cur->kut_counter = $rs->miniurl_counter;
|
||||
$cur->kut_password = $rs->miniurl_password;
|
||||
|
||||
return $cur;
|
||||
}
|
||||
return $cur;
|
||||
}
|
||||
|
||||
private function exists($rs)
|
||||
{
|
||||
$chk = $this->con->select(
|
||||
'SELECT kut_hash FROM '.$this->k_tb.' '.
|
||||
"WHERE blog_id = '".$rs->blog_id."' ".
|
||||
"AND kut_service = 'local' ".
|
||||
"AND kut_hash = '".$rs->miniurl_id."' "
|
||||
);
|
||||
return !$chk->isEmpty();
|
||||
}
|
||||
private function exists($rs)
|
||||
{
|
||||
$chk = $this->con->select(
|
||||
'SELECT kut_hash FROM '.$this->k_tb.' '.
|
||||
"WHERE blog_id = '".$rs->blog_id."' ".
|
||||
"AND kut_service = 'local' ".
|
||||
"AND kut_hash = '".$rs->miniurl_id."' "
|
||||
);
|
||||
return !$chk->isEmpty();
|
||||
}
|
||||
|
||||
private function nextId()
|
||||
{
|
||||
return $this->con->select(
|
||||
'SELECT MAX(kut_id) FROM '.$this->k_tb.' '
|
||||
)->f(0) + 1;
|
||||
}
|
||||
private function nextId()
|
||||
{
|
||||
return $this->con->select(
|
||||
'SELECT MAX(kut_id) FROM '.$this->k_tb.' '
|
||||
)->f(0) + 1;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')){return;}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
|
@ -1,121 +1,120 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')){return;}
|
||||
|
||||
class suprKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = array(
|
||||
'id' => 'supr',
|
||||
'name' => 'su.pr StumbleUpon',
|
||||
'home' => 'http://su.pr',
|
||||
protected $config = array(
|
||||
'id' => 'supr',
|
||||
'name' => 'su.pr StumbleUpon',
|
||||
'home' => 'http://su.pr',
|
||||
|
||||
'url_api' => 'http://su.pr/api/',
|
||||
'url_base' => 'http://su.pr/',
|
||||
'url_min_len' => 23
|
||||
);
|
||||
'url_api' => 'http://su.pr/api/',
|
||||
'url_base' => 'http://su.pr/',
|
||||
'url_min_len' => 23
|
||||
);
|
||||
|
||||
private $args = array(
|
||||
'version' => '1.0',
|
||||
'format' => 'xml',
|
||||
'login' => '',
|
||||
'apiKey' => ''
|
||||
);
|
||||
private $args = array(
|
||||
'version' => '1.0',
|
||||
'format' => 'xml',
|
||||
'login' => '',
|
||||
'apiKey' => ''
|
||||
);
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['login'] = $this->settings->kutrl_srv_supr_login;
|
||||
$this->args['apiKey'] = $this->settings->kutrl_srv_supr_apikey;
|
||||
}
|
||||
protected function init()
|
||||
{
|
||||
$this->args['login'] = $this->settings->kutrl_srv_supr_login;
|
||||
$this->args['apiKey'] = $this->settings->kutrl_srv_supr_apikey;
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_supr_login',$_POST['kutrl_srv_supr_login']);
|
||||
$this->settings->put('kutrl_srv_supr_apikey',$_POST['kutrl_srv_supr_apikey']);
|
||||
}
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_supr_login',$_POST['kutrl_srv_supr_login']);
|
||||
$this->settings->put('kutrl_srv_supr_apikey',$_POST['kutrl_srv_supr_apikey']);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">'.__('Login:').'<br />'.
|
||||
form::field(array('kutrl_srv_supr_login'),50,255,$this->settings->kutrl_srv_supr_login).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
sprintf(__('This is your login to sign up to %s'),$this->config['name']).
|
||||
'</p>'.
|
||||
'<p><label class="classic">'.__('API Key:').'<br />'.
|
||||
form::field(array('kutrl_srv_supr_apikey'),50,255,$this->settings->kutrl_srv_supr_apikey).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
sprintf(__('This is your personnal %s API key. You can find it on your account page.'),$this->config['name']).
|
||||
'</p>';
|
||||
}
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">'.__('Login:').'<br />'.
|
||||
form::field(array('kutrl_srv_supr_login'),50,255,$this->settings->kutrl_srv_supr_login).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
sprintf(__('This is your login to sign up to %s'),$this->config['name']).
|
||||
'</p>'.
|
||||
'<p><label class="classic">'.__('API Key:').'<br />'.
|
||||
form::field(array('kutrl_srv_supr_apikey'),50,255,$this->settings->kutrl_srv_supr_apikey).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
sprintf(__('This is your personnal %s API key. You can find it on your account page.'),$this->config['name']).
|
||||
'</p>';
|
||||
}
|
||||
|
||||
public function testService()
|
||||
{
|
||||
if (empty($this->args['login']) || empty($this->args['apiKey']))
|
||||
{
|
||||
$this->error->add(__('Service is not well configured.'));
|
||||
return false;
|
||||
}
|
||||
public function testService()
|
||||
{
|
||||
if (empty($this->args['login']) || empty($this->args['apiKey']))
|
||||
{
|
||||
$this->error->add(__('Service is not well configured.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$args = $this->args;
|
||||
$arg['longUrl'] = $this->url_test;
|
||||
if (!($response = self::post($this->url_api.'shorten',$args,true)))
|
||||
{
|
||||
$this->error->add(__('Failed to call service.'));
|
||||
return false;
|
||||
}
|
||||
$args = $this->args;
|
||||
$arg['longUrl'] = $this->url_test;
|
||||
if (!($response = self::post($this->url_api.'shorten',$args,true)))
|
||||
{
|
||||
$this->error->add(__('Failed to call service.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$rsp = simplexml_load_string($response);
|
||||
$rsp = simplexml_load_string($response);
|
||||
|
||||
$status = (string) $rsp->statusCode;
|
||||
if ($status != 'OK') {
|
||||
$err_no = (integer) $rsp->errorCode;
|
||||
$err_msg = (integer) $rsp->errorMessage;
|
||||
$this->error->add(sprintf(__('An error occured with code %s and message "%s"'),$err_no,$err_msg));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$status = (string) $rsp->statusCode;
|
||||
if ($status != 'OK') {
|
||||
$err_no = (integer) $rsp->errorCode;
|
||||
$err_msg = (integer) $rsp->errorMessage;
|
||||
$this->error->add(sprintf(__('An error occured with code %s and message "%s"'),$err_no,$err_msg));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createHash($url,$hash=null)
|
||||
{
|
||||
$args = $this->args;
|
||||
$args['longUrl'] = $url;
|
||||
public function createHash($url,$hash=null)
|
||||
{
|
||||
$args = $this->args;
|
||||
$args['longUrl'] = $url;
|
||||
|
||||
if (!($response = self::post($this->url_api.'shorten',$args,true)))
|
||||
{
|
||||
$this->error->add(__('Failed to call service.'));
|
||||
return false;
|
||||
}
|
||||
if (!($response = self::post($this->url_api.'shorten',$args,true)))
|
||||
{
|
||||
$this->error->add(__('Failed to call service.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$rsp = simplexml_load_string($response);
|
||||
$rsp = simplexml_load_string($response);
|
||||
|
||||
$status = (string) $rsp->statusCode;
|
||||
if ($status != 'OK') {
|
||||
$err_no = (integer) $rsp->errorCode;
|
||||
$err_msg = (integer) $rsp->errorMessage;
|
||||
$this->error->add(sprintf(__('An error occured with code %s and message "%s"'),$err_no,$err_msg));
|
||||
return false;
|
||||
}
|
||||
$status = (string) $rsp->statusCode;
|
||||
if ($status != 'OK') {
|
||||
$err_no = (integer) $rsp->errorCode;
|
||||
$err_msg = (integer) $rsp->errorMessage;
|
||||
$this->error->add(sprintf(__('An error occured with code %s and message "%s"'),$err_no,$err_msg));
|
||||
return false;
|
||||
}
|
||||
|
||||
$rs = new ArrayObject();
|
||||
$rs->hash = (string) $rsp->results[0]->nodeKeyVal->hash;
|
||||
$rs->url = (string) $rsp->results[0]->nodeKeyVal->nodeKey;
|
||||
$rs->type = $this->id;
|
||||
$rs = new ArrayObject();
|
||||
$rs->hash = (string) $rsp->results[0]->nodeKeyVal->hash;
|
||||
$rs->url = (string) $rsp->results[0]->nodeKeyVal->nodeKey;
|
||||
$rs->type = $this->id;
|
||||
|
||||
return $rs;
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,127 +1,126 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')){return;}
|
||||
|
||||
class trimKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = array(
|
||||
'id' => 'trim',
|
||||
'name' => 'tr.im',
|
||||
'home' => 'http://tr.im',
|
||||
protected $config = array(
|
||||
'id' => 'trim',
|
||||
'name' => 'tr.im',
|
||||
'home' => 'http://tr.im',
|
||||
|
||||
'url_api' => 'http://api.tr.im/v1/',
|
||||
'url_base' => 'http://tr.im/',
|
||||
'url_min_len' => 25
|
||||
);
|
||||
'url_api' => 'http://api.tr.im/v1/',
|
||||
'url_base' => 'http://tr.im/',
|
||||
'url_min_len' => 25
|
||||
);
|
||||
|
||||
private $args = array(
|
||||
'username' => '',
|
||||
'password' => ''
|
||||
);
|
||||
private $args = array(
|
||||
'username' => '',
|
||||
'password' => ''
|
||||
);
|
||||
|
||||
private $api_rate_time = 0;
|
||||
private $api_rate_time = 0;
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['username'] = $this->settings->kutrl_srv_trim_username;
|
||||
$this->args['password'] = $this->settings->kutrl_srv_trim_password;
|
||||
protected function init()
|
||||
{
|
||||
$this->args['username'] = $this->settings->kutrl_srv_trim_username;
|
||||
$this->args['password'] = $this->settings->kutrl_srv_trim_password;
|
||||
|
||||
$this->api_rate_time = (integer) $this->settings->kutrl_srv_trim_apiratetime;
|
||||
}
|
||||
$this->api_rate_time = (integer) $this->settings->kutrl_srv_trim_apiratetime;
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_trim_username',$_POST['kutrl_srv_trim_username']);
|
||||
$this->settings->put('kutrl_srv_trim_password',$_POST['kutrl_srv_trim_password']);
|
||||
}
|
||||
public function saveSettings()
|
||||
{
|
||||
$this->settings->put('kutrl_srv_trim_username',$_POST['kutrl_srv_trim_username']);
|
||||
$this->settings->put('kutrl_srv_trim_password',$_POST['kutrl_srv_trim_password']);
|
||||
}
|
||||
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">'.__('Login:').'<br />'.
|
||||
form::field(array('kutrl_srv_trim_username'),50,255,$this->settings->kutrl_srv_trim_username).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
__('This is your login to sign up to tr.im.').
|
||||
'</p>'.
|
||||
'<p><label class="classic">'.__('Password:').'<br />'.
|
||||
form::field(array('kutrl_srv_trim_password'),50,255,$this->settings->kutrl_srv_trim_password).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
__('This is your password to sign up to tr.im.').
|
||||
'</p>';
|
||||
}
|
||||
public function settingsForm()
|
||||
{
|
||||
echo
|
||||
'<p><label class="classic">'.__('Login:').'<br />'.
|
||||
form::field(array('kutrl_srv_trim_username'),50,255,$this->settings->kutrl_srv_trim_username).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
__('This is your login to sign up to tr.im.').
|
||||
'</p>'.
|
||||
'<p><label class="classic">'.__('Password:').'<br />'.
|
||||
form::field(array('kutrl_srv_trim_password'),50,255,$this->settings->kutrl_srv_trim_password).
|
||||
'</label></p>'.
|
||||
'<p class="form-note">'.
|
||||
__('This is your password to sign up to tr.im.').
|
||||
'</p>';
|
||||
}
|
||||
|
||||
public function testService()
|
||||
{
|
||||
if (empty($this->args['username']) || empty($this->args['password']))
|
||||
{
|
||||
$this->error->add(__('Service is not well configured.'));
|
||||
return false;
|
||||
}
|
||||
if (time() < $this->api_rate_time + 300) // bloc service within 5min on API rate limit
|
||||
{
|
||||
$this->error->add(__('Prevent service rate limit.'));
|
||||
return false;
|
||||
}
|
||||
if (!($rsp = self::post($this->url_api.'verify.xml',$this->args,true,true)))
|
||||
{
|
||||
$this->error->add(__('Service is unavailable.'));
|
||||
return false;
|
||||
}
|
||||
$r = simplexml_load_string($rsp);
|
||||
public function testService()
|
||||
{
|
||||
if (empty($this->args['username']) || empty($this->args['password']))
|
||||
{
|
||||
$this->error->add(__('Service is not well configured.'));
|
||||
return false;
|
||||
}
|
||||
if (time() < $this->api_rate_time + 300) // bloc service within 5min on API rate limit
|
||||
{
|
||||
$this->error->add(__('Prevent service rate limit.'));
|
||||
return false;
|
||||
}
|
||||
if (!($rsp = self::post($this->url_api.'verify.xml',$this->args,true,true)))
|
||||
{
|
||||
$this->error->add(__('Service is unavailable.'));
|
||||
return false;
|
||||
}
|
||||
$r = simplexml_load_string($rsp);
|
||||
|
||||
if ($r['code'] == 200)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
$this->error->add(__('Authentication to service failed.'));
|
||||
return false;
|
||||
}
|
||||
if ($r['code'] == 200)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
$this->error->add(__('Authentication to service failed.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
public function createHash($url,$hash=null)
|
||||
{
|
||||
$arg = $this->args;
|
||||
$arg['url'] = $url;
|
||||
public function createHash($url,$hash=null)
|
||||
{
|
||||
$arg = $this->args;
|
||||
$arg['url'] = $url;
|
||||
|
||||
if (!($rsp = self::post($this->url_api.'trim_url.xml',$arg,true,true)))
|
||||
{
|
||||
$this->error->add(__('Service is unavailable.'));
|
||||
return false;
|
||||
}
|
||||
if (!($rsp = self::post($this->url_api.'trim_url.xml',$arg,true,true)))
|
||||
{
|
||||
$this->error->add(__('Service is unavailable.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$r = simplexml_load_string($rsp);
|
||||
$r = simplexml_load_string($rsp);
|
||||
|
||||
# API rate limit
|
||||
if ($r['code'] == 425)
|
||||
{
|
||||
$this->settings->put('kutrl_srv_trim_apiratetime',time());
|
||||
# API rate limit
|
||||
if ($r['code'] == 425)
|
||||
{
|
||||
$this->settings->put('kutrl_srv_trim_apiratetime',time());
|
||||
|
||||
$this->error->add(__('Service rate limit exceeded.'));
|
||||
return false;
|
||||
}
|
||||
if (isset($r->trimpath))
|
||||
{
|
||||
$rs = new ArrayObject();
|
||||
$rs->hash = $r->trimpath;
|
||||
$rs->url = $url;
|
||||
$rs->type = $this->id;
|
||||
$this->error->add(__('Service rate limit exceeded.'));
|
||||
return false;
|
||||
}
|
||||
if (isset($r->trimpath))
|
||||
{
|
||||
$rs = new ArrayObject();
|
||||
$rs->hash = $r->trimpath;
|
||||
$rs->url = $url;
|
||||
$rs->type = $this->id;
|
||||
|
||||
return $rs;
|
||||
}
|
||||
$this->error->add(__('Unreadable service response.'));
|
||||
return false;
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
$this->error->add(__('Unreadable service response.'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
|
|
22
index.php
22
index.php
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of kUtRL, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
/**
|
||||
* @brief kUtRL, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Jean-Christian Denis and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
return;
|
||||
|
|
|
@ -14,4 +14,3 @@
|
|||
if (!defined('DC_RC_PATH')) { return; }
|
||||
|
||||
$__resources['help']['kUtRL'] = dirname(__FILE__).'/help/help.html';
|
||||
?>
|
|
@ -519,4 +519,3 @@ $GLOBALS['__l10n']['Service:'] = 'Service :';
|
|||
|
||||
#index.php:539
|
||||
$GLOBALS['__l10n']['Delete selected short links'] = 'Effacer les liens sélectionnés';
|
||||
|
||||
|
|
|
@ -14,4 +14,3 @@
|
|||
if (!defined('DC_RC_PATH')) { return; }
|
||||
|
||||
$__resources['help']['kUtRL'] = dirname(__FILE__).'/help/help.html';
|
||||
?>
|
Loading…
Reference in a new issue