-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddResource.php
More file actions
executable file
·68 lines (55 loc) · 1.65 KB
/
addResource.php
File metadata and controls
executable file
·68 lines (55 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* @package Language Manager By Team PayPlans
*
* @copyright Copyright (C) 2009 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later;
* @Author Jitendra Khatri
* @contact payplans@readybytes.in
*
*/
const _JEXEC = 1;
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', 1);
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', dirname(__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_LIBRARIES . '/import.legacy.php';
require_once JPATH_LIBRARIES . '/cms.php';
// Load the configuration
require_once JPATH_CONFIGURATION . '/configuration.php';
jimport('joomla.filesystem.folder');
class addResource extends JApplicationCli
{
//Function contains script for adding Resource Entry
public function doExecute()
{
$this->out('Do you want to add Resource(Name of Main files.) : (y/n)');
$add = $this->in();
($add == 'y') ? $this->out('Enter Name of your Resource File :') : die('Bye');
$fileName = $this->in();
if($fileName)
{
for(; ; )
{
$this->out('Enter version of your Resource File :');
$version = $this->in();
break;
}
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->insert('#__resource');
$query->set("`file_name`='$fileName', `version`='$version'");
$db->setQuery($query);
$db->query();
}
}
JApplicationCli::getInstance('addResource')->execute();