removed : custom fields
This commit is contained in:
parent
9b52663d32
commit
aeb8a51330
3 changed files with 0 additions and 153 deletions
|
@ -1,90 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
Plugin Name: Custom Fields Beta for ClipBucket
|
|
||||||
Description: Add custom fields in your video upload form :)
|
|
||||||
Author: Arslan Hassan
|
|
||||||
Author Website: http://clip-bucket.com/
|
|
||||||
ClipBucket Version: 2
|
|
||||||
Version: 1.0
|
|
||||||
Website: http://clip-bucket.com/
|
|
||||||
Plugin Type: global
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
define('CUSTOM_FIELDS_MOD',TRUE);
|
|
||||||
|
|
||||||
if(!function_exists('add_custom_field'))
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Function used to add custom field in upload form
|
|
||||||
*/
|
|
||||||
function add_custom_field($array)
|
|
||||||
{
|
|
||||||
global $db,$LANG;
|
|
||||||
foreach($array as $key=>$attr)
|
|
||||||
{
|
|
||||||
|
|
||||||
if($key=='name' || $key=='title')
|
|
||||||
{
|
|
||||||
if(empty($attr))
|
|
||||||
e(sprintf(lang('cust_field_err'),$key));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!error_list())
|
|
||||||
{
|
|
||||||
if(!empty($attr))
|
|
||||||
{
|
|
||||||
$fields_array[] = 'custom_field_'.$key;
|
|
||||||
$value_array[] = mysql_clean($attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($key=='db_field')
|
|
||||||
{
|
|
||||||
$db->execute("ALTER TABLE ".tbl('video')." ADD `".$attr."` TEXT NOT NULL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!error_list())
|
|
||||||
$db->insert(tbl("custom_fields"),$fields_array,$value_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used add fields in upload form
|
|
||||||
*/
|
|
||||||
function load_form_fields()
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
$results = $db->select(tbl("custom_fields"),"*");
|
|
||||||
if(count($results[0])>0)
|
|
||||||
{
|
|
||||||
foreach($results as $result)
|
|
||||||
{
|
|
||||||
$name = $result['custom_field_name'];
|
|
||||||
foreach($result as $field => $value)
|
|
||||||
{
|
|
||||||
$field_array[$name][substr($field,13,strlen($field))] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count($field_array)>0)
|
|
||||||
return false;
|
|
||||||
return $field_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Adding Admin Menu
|
|
||||||
add_admin_menu('Custom Fields','Add New Custom Field','add_custom_fields.php');
|
|
||||||
add_admin_menu('Custom Fields','Manage Custom Fields','manage_custom_fields.php');
|
|
||||||
|
|
||||||
if(load_form_fields())
|
|
||||||
register_custom_form_field(load_form_fields());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,48 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file is used to install custom fields mod
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once('../includes/common.php');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function install_custom_fields()
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
$db->Execute(
|
|
||||||
"CREATE TABLE `clipbucket_svn`.`".tbl('custom_fields')."` (
|
|
||||||
`custom_field_list_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
|
||||||
`custom_field_title` TEXT NOT NULL ,
|
|
||||||
`custom_field_type` TEXT NOT NULL ,
|
|
||||||
`custom_field_name` TEXT NOT NULL ,
|
|
||||||
`custom_field_id` TEXT NOT NULL ,
|
|
||||||
`custom_field_value` TEXT NOT NULL ,
|
|
||||||
`custom_field_hint_1` TEXT NOT NULL ,
|
|
||||||
`custom_field_db_field` TEXT NOT NULL ,
|
|
||||||
`custom_field_required` ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'no',
|
|
||||||
`custom_field_validate_function` TEXT NOT NULL ,
|
|
||||||
`custom_field_invalid_err` TEXT NOT NULL ,
|
|
||||||
`custom_field_display_function` TEXT NOT NULL ,
|
|
||||||
`custom_field_anchor_before` TEXT NOT NULL ,
|
|
||||||
`custom_field_anchor_after` TEXT NOT NULL ,
|
|
||||||
`custom_field_hint_2` TEXT NOT NULL ,
|
|
||||||
`date_added` DATETIME NOT NULL
|
|
||||||
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;");
|
|
||||||
|
|
||||||
$db->Execute(
|
|
||||||
"INSERT INTO `".tbl('phrases')."` (
|
|
||||||
`id` ,
|
|
||||||
`lang_iso` ,
|
|
||||||
`varname` ,
|
|
||||||
`text`
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
NULL , 'en', 'cust_field_err', 'Invalid \'%s\' field value'
|
|
||||||
)");
|
|
||||||
|
|
||||||
}
|
|
||||||
install_custom_fields();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('../includes/common.php');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file is used to install Embed Video Mod
|
|
||||||
*/
|
|
||||||
|
|
||||||
function uninstall_embed_video_mode()
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
$db->Execute("DELETE FROM ".tbl('phrases')." WHERE varname='cust_field_err'");
|
|
||||||
$db->Execute("DROP TABLE `".tbl('custom_fields')."`");
|
|
||||||
}
|
|
||||||
uninstall_embed_video_mode();
|
|
||||||
?>
|
|
Loading…
Add table
Reference in a new issue