This repository was archived by the owner on May 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetails.php
More file actions
147 lines (123 loc) · 4.05 KB
/
details.php
File metadata and controls
147 lines (123 loc) · 4.05 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* This is a Robots module for PyroCMS
*
* @author Jacob Albert Jolman
* @website http://www.odin-ict.nl
* @package PyroCMS
* @subpackage Robots Module
*/
class Module_Robots extends Module {
public $version = '1.0.1';
public function info()
{
return array(
'name' => array(
'en' => 'Robots',
'nl' => 'Robots'
),
'description' => array(
'en' => 'This is a Robots.txt module.',
'nl' => 'Dit is een robots.txt module voor PyroCMS'
),
'frontend' => TRUE,
'backend' => TRUE,
'skip_xss' => TRUE,
'menu' => 'utilities',
'author' => 'Jaap Jolman',
'roles' => array(
'admin_robots'
),
'sections' => array(
'robots' => array(
'name' => 'robots:menu:overview',
'uri' => 'admin/robots',
'shortcuts' => array(
array(
'name' => 'robots:menu:overview',
'uri' => 'admin/robots',
'class' => 'list'
)
)
)
)
);
}
public function install()
{
$txt = "";
$txt .= "# www.robotstxt.org/\n";
$txt .= "# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449\n";
$txt .= "User-agent: *\n";
$txt .= "Allow: /\n";
$txt .= "Sitemap: " . site_url('sitemap.xml');
$this->db->query("
CREATE TABLE IF NOT EXISTS `core_robots` (
`robots_id` INT NOT NULL AUTO_INCREMENT ,
`sites_id` INT(5) NOT NULL ,
`site_ref` VARCHAR(255) NOT NULL ,
`txt` TEXT,
PRIMARY KEY (`robots_id`, `sites_id`) )
ENGINE = InnoDB;");
if(!empty($this->site_ref))
{
$this->db->query("INSERT INTO `core_robots` (robots_id, sites_id, site_ref, txt) VALUES (null,(SELECT `id` FROM `core_sites` WHERE ref='" . $this->site_ref . "'), '" . $this->site_ref . "', '" . $txt . "');");
return TRUE;
}else{
//Get List of Sites
$sites = $this->db->query("SELECT * FROM `core_sites`")->result();
foreach($sites as $site)
{
$exists = $this->db->query("SELECT * FROM `core_robots` WHERE site_ref = '{$site->ref}'")->row();
if(empty($exists))
{
$this->db->query("INSERT INTO `core_robots` (robots_id, sites_id, site_ref, txt) VALUES (null,(SELECT `id` FROM `core_sites` WHERE ref='" . $site->ref . "'), '" . $site->ref . "', '" . $txt . "');");
}
}
return true;
}
return false;
}
public function uninstall()
{
$this->db->query("DELETE FROM `core_robots` WHERE sites_id=(SELECT `id` FROM `core_sites` WHERE ref='" . $this->site_ref . "');");
$this->db->delete('settings', array('module' => 'store'));
{
return TRUE;
}
}
public function upgrade($old_version)
{
$this->db->query("
CREATE TABLE IF NOT EXISTS `core_robots` (
`robots_id` INT NOT NULL AUTO_INCREMENT ,
`sites_id` INT(5) NOT NULL ,
`site_ref` VARCHAR(255) NOT NULL ,
`txt` TEXT,
PRIMARY KEY (`robots_id`, `sites_id`) )
ENGINE = InnoDB;");
$this->db->query("DELETE FROM `core_robots` WHERE sites_id=(SELECT `id` FROM `core_sites` WHERE ref='" . $this->site_ref . "');");
$this->db->delete('settings', array('module' => 'store'));
{
$uninstall = TRUE;
}
$txt = "";
$txt .= "# www.robotstxt.org/\n";
$txt .= "# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449\n";
$txt .= "User-agent: *\n";
$txt .= "Allow: /\n";
$txt .= "Sitemap: " . site_url('sitemap.xml');
$this->db->query("INSERT INTO `core_robots` (robots_id, sites_id, site_ref, txt) VALUES (null,(SELECT `id` FROM `core_sites` WHERE ref='" . $this->site_ref . "'), '" . $this->site_ref . "', '" . $txt . "');");
$install = TRUE;
if($uninstall == TRUE AND $install == TRUE):
return TRUE;
endif;
}
public function help()
{
// Return a string containing help info
// You could include a file and return it here.
return "No documentation has been added for this module.<br />Contact the module developer for assistance.";
}
}
/* End of file details.php */