Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
WordPress_SexHackMe_Plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
WordPress_SexHackMe_Plugin
Commits
6e8e3146
Commit
6e8e3146
authored
Jul 31, 2022
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed Integrate google drive and add rclone support for gdrive
parent
a9baca30
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
152 deletions
+133
-152
functions-rclone.php
includes/admin/functions-rclone.php
+45
-0
class-admin.php
includes/class-admin.php
+19
-0
class-integrate-google-drive.php
includes/class-integrate-google-drive.php
+0
-149
sexhackme.php
sexhackme.php
+2
-2
gallery.php
templates/admin/gallery.php
+1
-1
rclone.php
templates/admin/rclone.php
+66
-0
No files found.
includes/admin/functions-rclone.php
0 → 100644
View file @
6e8e3146
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
wp_SexHackMe
;
// Exit if accessed directly
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
function
rclone_adminpage
()
{
sh_get_template
(
'admin/rclone.php'
);
}
function
rclone_settings_section
()
{
echo
"<h2>SexHackMe RClone Settings</h2>"
;
}
function
rclone_active
()
{
global
$sh_rclone
;
return
$sh_rclone
->
is_enabled
();
}
?>
includes/class-admin.php
View file @
6e8e3146
...
...
@@ -78,6 +78,14 @@ if(!class_exists('SH_Admin')) {
add_action
(
'update_option'
,
'\wp_SexHackMe\SH_Admin::update_gallery_slug'
,
10
,
3
);
//register_setting('sexhackme-gallery-settings', 'sexhack_gallery_slug');
}
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/admin/functions-rclone.php'
)
)
{
include_once
SH_PLUGIN_DIR_PATH
.
'includes/admin/functions-rclone.php'
;
add_settings_section
(
'sexhackme-rclone-settings'
,
' '
,
'wp_SexHackMe\rclone_settings_section'
,
'sexhackme-rclone-settings'
);
register_setting
(
'sexhackme-rclone-settings'
,
'sexhack_rclone_path'
);
register_setting
(
'sexhackme-rclone-settings'
,
'sexhack_rclone_gdrive_name'
);
register_setting
(
'sexhackme-rclone-settings'
,
'sexhack_rclone_gdrive_shared'
);
}
}
public
static
function
update_gallery_slug
(
$option
,
$old
,
$new
)
...
...
@@ -156,6 +164,17 @@ if(!class_exists('SH_Admin')) {
}
// Add RClone interface
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/admin/functions-rclone.php'
)
)
{
add_submenu_page
(
'sexhackme-settings'
,
'RClone'
,
'RClone'
,
'manage_options'
,
'rclone'
,
'wp_SexHackMe\rclone_adminpage'
);
}
// Add Video tags and categories subpages to Video edit menu
//if(in_array('sexhack_video', get_post_types())
//{
...
...
includes/class-integrate-google-drive.php
deleted
100644 → 0
View file @
a9baca30
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
wp_SexHackMe
;
use
\IGD\Account
;
use
\IGD\App
;
// Exit if accessed directly
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
if
(
!
class_exists
(
'SH_GDrive'
))
{
class
SH_GDrive
{
function
__construct
()
{
add_filter
(
'sh_download_url_filter'
,
array
(
$this
,
'get_download_url'
));
}
function
get_download_url
(
$file
)
{
$active
=
Account
::
get_active_account
();
if
(
!
$active
)
return
$file
;
$account_id
=
$active
[
'id'
];
if
(
!
(
$file
&&
is_string
(
$file
)
&&
strlen
(
$file
)
>
3
))
return
$file
;
if
(
function_exists
(
'igd_fs'
)
)
{
// Integrate Google Drive Plugin is installed and active, so, filter it!
if
((
strlen
(
$file
)
>
9
)
&&
(
strncmp
(
$file
,
"gdrive://"
,
9
)
===
0
))
{
$gpath
=
substr
(
$file
,
9
);
if
(
strncmp
(
$gpath
,
'/'
,
1
)
===
0
)
$gpath
=
substr
(
$file
,
10
);
$gparts
=
explode
(
'/'
,
$gpath
);
if
(
count
(
$gparts
)
>
0
)
{
$parent
=
false
;
$gfile
=
false
;
$success
=
false
;
$igd
=
App
::
instance
(
$account_id
);
// Try root first
foreach
(
$gparts
as
$k
=>
$part
)
{
if
(
$k
==
0
)
{
$gdo
=
$igd
->
get_files
(
array
(
'q'
=>
"
{
$part
}
in name"
),
'root'
,
false
);
}
else
{
$gdo
=
$igd
->
get_files
(
array
(
'q'
=>
"name='
{
$part
}
"
),
$parent
,
false
);
}
if
(
!
is_array
(
$gdo
)
||
(
count
(
$gdo
)
<
1
)
||
array_key_exists
(
'error'
,
$gdo
))
break
;
$parent
=
false
;
foreach
(
$gdo
as
$g
)
{
if
(
$g
[
'name'
]
==
$part
)
{
$parent
=
$g
[
'id'
];
$gf
=
$g
;
}
}
if
(
!
$parent
)
break
;
if
(
count
(
$gparts
)
-
1
==
$k
)
$success
=
true
;
}
// Then try on the shared with me folder
if
(
!
$success
)
{
foreach
(
$gparts
as
$k
=>
$part
)
{
if
(
$k
==
0
)
{
$gdo
=
$igd
->
get_files
(
array
(
'q'
=>
"parents='' and sharedWithMe=true and '
{
$part
}
' in name"
),
'shared'
,
false
);
}
else
{
$gdo
=
$igd
->
get_files
(
array
(
'q'
=>
"name='
{
$part
}
"
),
$parent
,
false
);
}
if
(
!
is_array
(
$gdo
)
||
(
count
(
$gdo
)
<
1
)
||
array_key_exists
(
'error'
,
$gdo
))
{
if
(
$k
==
0
)
{
$gdo
=
$igd
->
get_files
(
array
(
'q'
=>
"parents='' and sharedWithMe=true and '
{
$part
}
' in name"
),
'shared'
,
true
);
}
else
{
$gdo
=
$igd
->
get_files
(
array
(
'q'
=>
"name='
{
$part
}
"
),
$parent
,
true
);
}
}
if
(
!
is_array
(
$gdo
)
||
(
count
(
$gdo
)
<
1
)
||
array_key_exists
(
'error'
,
$gdo
))
break
;
$parent
=
false
;
foreach
(
$gdo
as
$g
)
{
if
(
$g
[
'name'
]
==
$part
)
{
$parent
=
$g
[
'id'
];
$gf
=
$g
;
}
}
}
}
if
(
count
(
$gparts
)
-
1
==
$k
)
$success
=
true
;
if
(
$success
)
$gfile
=
$gf
;
if
(
$gfile
&&
(
$gfile
[
'type'
]
!=
'application/vnd.google-apps.folder'
))
{
$file
=
"https://drive.google.com/uc?export=download&confirm=t&id="
.
$gfile
[
'id'
];
//$file="https://drive.google.com/open?action=igd-wc-download&id=".$gfile['id'];
}
}
}
}
return
$file
;
}
}
new
SH_Gdrive
;
}
?>
sexhackme.php
View file @
6e8e3146
...
...
@@ -395,8 +395,8 @@ if(!class_exists('SexHackMe_Plugin')) {
/* Unlock integration class */
$this
->
file_include
(
'includes/class-unlock-support.php'
);
/*
integrate google drive plugin database support
*/
$this
->
file_include
(
'includes/class-
integrate-google-driv
e.php'
);
/*
Rclone support for gdrive and other clouds
*/
$this
->
file_include
(
'includes/class-
rclon
e.php'
);
/* Video */
$this
->
file_include
(
'includes/class-video.php'
);
...
...
templates/admin/gallery.php
View file @
6e8e3146
...
...
@@ -69,7 +69,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
echo
'>'
.
esc_html
(
$page
->
post_title
)
.
' ( ID: '
.
esc_attr
(
$page
->
ID
)
.
')'
.
'</option>'
;
}
?>
</select>
<p
class=
"description"
>
Select
Gallery
page
</p>
<p
class=
"description"
>
Select
Video not found
page
</p>
</td>
</tr>
...
...
templates/admin/rclone.php
0 → 100644
View file @
6e8e3146
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
// Exit if accessed directly
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
global
$sh_rclone
;
?>
<div
class=
"wrap"
>
<?php
do_settings_sections
(
'sexhackme-rclone-settings'
);
?>
<?php
if
(
!
wp_SexHackMe\rclone_active
())
{
?>
<p>
Rclone isn't installed on your server and/or shell_exec() isn't enabled.
</p>
<p>
Please install rclone and enable shell_exec() if you would like to use this feature
</p>
<?php
}
?>
<form
method=
"post"
action=
"/wp-admin/options.php"
>
<?php
settings_fields
(
'sexhackme-rclone-settings'
);
?>
<table
class=
"form-table"
>
<tr>
<td>
<label>
rclone executable path
</label>
<input
type=
'text'
name=
'sexhack_rclone_path'
value=
'
<?php
echo
$sh_rclone
->
get_path
();
?>
'
>
</td>
</tr>
<tr><td><h4>
Google Drive Support:
</h4></td></tr>
<tr>
<td>
<label>
Select Google Drive remote if any:
</label>
<select
name=
"sexhack_rclone_gdrive_name"
>
<option
value=
"0"
>
Choose...
</option>
<?php
foreach
(
$sh_rclone
->
get_remotes
()
as
$remote
)
{
$selected
=
""
;
if
(
$remote
==
get_option
(
'sexhack_rclone_gdrive_name'
,
false
))
$selected
=
"selected"
;
if
(
$remote
)
echo
"<option value='"
.
$remote
.
"'
$selected
>"
.
$remote
.
"</option>"
;
}
?>
</select>
<label>
Use shared with me?
</label>
<input
type=
"checkbox"
name=
"sexhack_rclone_gdrive_shared"
value=
'1'
<?php
if
(
get_option
(
'sexhack_rclone_gdrive_shared'
,
false
))
echo
"checked"
;
?>
>
</td>
</tr>
</table>
<?php
submit_button
();
?>
</form>
</div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment