Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
o0johntam0o committed Nov 24, 2014
1 parent 45e7fb3 commit 9ef42bc
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 60 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -23,8 +23,6 @@ Quick Ads alows you to:

* Auto-scroll

* 100% xHTML valid

(Previous version: https://github.com/o0johntam0o/phpBB-Quick-Ads)

## Requirement
Expand Down
12 changes: 10 additions & 2 deletions ext/o0johntam0o/quickads/acp/main_module.php
Expand Up @@ -214,8 +214,16 @@ function main($id, $mode)
trigger_error('FORM_INVALID');
}

$quick_ads_name = $this->db->sql_escape(utf8_normalize_nfc($this->request->variable('quick_ads_add_new', '', true)));
$quick_ads_sql = 'INSERT INTO ' . $this->table_prefix . 'quick_ads(ads_text, ads_name) VALUES("","' . $quick_ads_name . '")';
$quick_ads_sql = array(
'ads_name' => utf8_normalize_nfc($this->request->variable('quick_ads_name_new', 'Undefined', true)),
'ads_pos' => $this->request->variable('quick_ads_pos_new', 2),
'ads_text' => utf8_normalize_nfc($this->request->variable('quick_ads_text_new', '', true)),
'ads_width' => ($this->request->variable('quick_ads_width_new', 50) < 0) ? 0 : $this->request->variable('quick_ads_width_new', 50),
'ads_height' => ($this->request->variable('quick_ads_height_new', 50) < 0) ? 0 : $this->request->variable('quick_ads_height_new', 50),
'ads_bg_color' => utf8_normalize_nfc($this->request->variable('quick_ads_bg_color_new', '#ffffff')),
);
$quick_ads_sql = 'INSERT INTO ' . $this->table_prefix . 'quick_ads ' . $this->db->sql_build_array('INSERT', $quick_ads_sql);

$this->db->sql_query($quick_ads_sql);

$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'QUICK_ADS_LOG_MSG');
Expand Down
44 changes: 41 additions & 3 deletions ext/o0johntam0o/quickads/adm/style/acp_quick_ads.html
Expand Up @@ -95,9 +95,47 @@ <h1>{L_QUICK_ADS_TITLE}</h1>
</fieldset>
<!-- ELSE --><!--// endif mode = index -->
<fieldset>
<legend>{L_QUICK_ADS_NEW_ADS}</legend>
<dl>
<dt><label for="quick_ads_name_new">{L_QUICK_ADS_NAME}:</label></dt>
<dd>
<input type="text" maxlength="30" size="20" name="quick_ads_name_new" value="{L_QUICK_ADS_NEW_ADS_NAME}" id="quick_ads_name_new" />
</dd>
</dl>
<dl>
<dt><label for="quick_ads_pos_new">{L_QUICK_ADS_POS}:</label></dt>
<dd>
<select name="quick_ads_pos_new" id="quick_ads_pos_new">
<option value="0" selected="selected">{L_DISABLE}</option>
<option value="1">{L_QUICK_ADS_TOP}</option>
<option value="2">{L_QUICK_ADS_BOTTOM}</option>
<option value="3">{L_QUICK_ADS_LEFT}</option>
<option value="4">{L_QUICK_ADS_RIGHT}</option>
</select>
</dd>
</dl>
<dl>
<dt><label for="quick_ads_bg_color_new">{L_QUICK_ADS_BG_COLOR}:</label></dt>
<dd>
<input type="text" size="6" name="quick_ads_bg_color_new" value="#ffffff" id="quick_ads_bg_color_new" />
</dd>
</dl>
<dl>
<dt><label for="quick_ads_text_new">{L_QUICK_ADS_TEXT}:</label></dt>
<dd>
<textarea name="quick_ads_text_new" id="quick_ads_text_new" rows="2" cols="40" ></textarea>
</dd>
</dl>
<dl>
<dt><label for="quick_ads_width_new">{L_QUICK_ADS_SIZE}:</label></dt>
<dd>
<input type="text" maxlength="4" size="4" name="quick_ads_width_new" value="0" id="quick_ads_width_new" />
&nbsp;x&nbsp;
<input type="text" maxlength="4" size="4" name="quick_ads_height_new" value="0" id="quick_ads_height_new" />
</dd>
</dl>
<p class="submit-buttons">
<input type="text" maxlength="30" size="20" name="quick_ads_add_new" value="{L_QUICK_ADS_ADD_FIELD_NAME}" />
<input class="button1" type="submit" name="add_field" value="{L_QUICK_ADS_ADD_FIELD}" />
<input class="button1" type="submit" name="add_field" value="{L_QUICK_ADS_NEW_ADS}" />
</p>
</fieldset>

Expand Down Expand Up @@ -155,7 +193,7 @@ <h1>{L_QUICK_ADS_TITLE}</h1>
<dl>
<dt><label for="quick_ads_bg_color_{quick_ads_row.QUICK_ADS_ID}">{L_QUICK_ADS_BG_COLOR}:</label><br /><span>{L_QUICK_ADS_BG_COLOR_EXPLAIN}</span></dt>
<dd>
<input type="text" size="4" name="quick_ads_bg_color_{quick_ads_row.QUICK_ADS_ID}" value="{quick_ads_row.QUICK_ADS_BG_COLOR}" id="quick_ads_bg_color_{quick_ads_row.QUICK_ADS_ID}" />
<input type="text" size="6" name="quick_ads_bg_color_{quick_ads_row.QUICK_ADS_ID}" value="{quick_ads_row.QUICK_ADS_BG_COLOR}" id="quick_ads_bg_color_{quick_ads_row.QUICK_ADS_ID}" />
</dd>
</dl>
<dl>
Expand Down
4 changes: 2 additions & 2 deletions ext/o0johntam0o/quickads/language/en/quick_ads.php
Expand Up @@ -103,8 +103,8 @@
'QUICK_ADS_PRIORITY' => 'Priority (Integer)',
'QUICK_ADS_PRIORITY_EXPLAIN' => 'The <strong>lower</strong> number, the <strong>higher</strong> priority',

'QUICK_ADS_ADD_FIELD' => 'New Ads',
'QUICK_ADS_ADD_FIELD_NAME' => 'Ads name',
'QUICK_ADS_NEW_ADS' => 'New Ads',
'QUICK_ADS_NEW_ADS_NAME' => 'Ads name',
'QUICK_ADS_DEL_FIELD' => 'Delete this Ads',
'QUICK_ADS_DEL_FIELD_EXPLAIN' => '<strong style="color:#ff0000">Note: this action can not be undo</strong>',

Expand Down
4 changes: 2 additions & 2 deletions ext/o0johntam0o/quickads/language/vi/quick_ads.php
Expand Up @@ -103,8 +103,8 @@
'QUICK_ADS_PRIORITY' => 'Độ ưu tiên (Dạng số nguyên)',
'QUICK_ADS_PRIORITY_EXPLAIN' => 'Số <strong>càng thấp</strong>, độ ưu tiên <strong>càng cao</strong>',

'QUICK_ADS_ADD_FIELD' => 'Thêm Ads',
'QUICK_ADS_ADD_FIELD_NAME' => 'Tên Ads',
'QUICK_ADS_NEW_ADS' => 'Thêm Ads',
'QUICK_ADS_NEW_ADS_NAME' => 'Tên Ads',
'QUICK_ADS_DEL_FIELD' => 'Xóa Ads này',
'QUICK_ADS_DEL_FIELD_EXPLAIN' => '<strong style="color:#ff0000">Chú ý: hoạt động này sẽ không thể phục hồi</strong>',

Expand Down
88 changes: 39 additions & 49 deletions ext/o0johntam0o/quickads/migrations/release_1_0_0.php
@@ -1,27 +1,17 @@
<?php

/**
*
* @package phpBB Extension - Quick Ads
* Quick Ads extension for the phpBB Forum Software package
*
* @copyright (c) 2014 o0johntam0o
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/

namespace o0johntam0o\quickads\migrations;

class release_1_0_0 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->config['quick_ads_version']) && version_compare($this->config['quick_ads_version'], '1.0.0', '>=');
}

static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\dev');
}

public function update_schema()
{
return array(
Expand All @@ -47,7 +37,7 @@ public function update_schema()
),
);
}

public function revert_schema()
{
return array(
Expand All @@ -56,41 +46,41 @@ public function revert_schema()
),
);
}

public function update_data()
{
return array(
array('config.add', array('quick_ads_version', '1.0.0')),
array('config.add', array('quick_ads_enable', 1)),
array('config.add', array('quick_ads_allow_bot', 0)),
array('config.add', array('quick_ads_custom_id', 'quick_ads_')),
array('config.add', array('quick_ads_zindex', 100)),
array('config.add', array('quick_ads_closebt', 1)),
array('config.add', array('quick_ads_cookie', 1)),
array('config.add', array('quick_ads_cookie_time', 5)),
array('config.add', array('quick_ads_wmin_left', 0)),
array('config.add', array('quick_ads_hmin_left', 0)),
array('config.add', array('quick_ads_wmin_right', 0)),
array('config.add', array('quick_ads_hmin_right', 0)),
array('config.add', array('quick_ads_wmin_top', 0)),
array('config.add', array('quick_ads_hmin_top', 0)),
array('config.add', array('quick_ads_wmin_bottom', 0)),
array('config.add', array('quick_ads_hmin_bottom', 0)),

array('module.add', array(
'acp',
'ACP_CAT_DOT_MODS',
'QUICK_ADS_TITLE'
)),
public function update_data()
{
return array(
array('config.add', array('quick_ads_version', '1.0.0')),
array('config.add', array('quick_ads_enable', 1)),
array('config.add', array('quick_ads_allow_bot', 0)),
array('config.add', array('quick_ads_custom_id', 'quick_ads_')),
array('config.add', array('quick_ads_zindex', 100)),
array('config.add', array('quick_ads_closebt', 1)),
array('config.add', array('quick_ads_cookie', 1)),
array('config.add', array('quick_ads_cookie_time', 5)),
array('config.add', array('quick_ads_wmin_left', 0)),
array('config.add', array('quick_ads_hmin_left', 0)),
array('config.add', array('quick_ads_wmin_right', 0)),
array('config.add', array('quick_ads_hmin_right', 0)),
array('config.add', array('quick_ads_wmin_top', 0)),
array('config.add', array('quick_ads_hmin_top', 0)),
array('config.add', array('quick_ads_wmin_bottom', 0)),
array('config.add', array('quick_ads_hmin_bottom', 0)),

array('module.add', array(
'acp',
'ACP_CAT_DOT_MODS',
'QUICK_ADS_TITLE'
)),

array('module.add', array(
'acp',
'QUICK_ADS_TITLE',
array(
'module_basename' => '\o0johntam0o\quickads\acp\main_module',
'modes' => array('quick_ads_config', 'quick_ads_config_details'),
),
)),
);
}
array('module.add', array(
'acp',
'QUICK_ADS_TITLE',
array(
'module_basename' => '\o0johntam0o\quickads\acp\main_module',
'modes' => array('quick_ads_config', 'quick_ads_config_details'),
),
)),
);
}
}

0 comments on commit 9ef42bc

Please sign in to comment.