Permalink
Browse files

Added include/constants.php file.

Added FORUM_SUBJECT_MAXIMUM_LENGTH constants.
  • Loading branch information...
1 parent 50d745a commit 2a5631e5138a4e081831dc1c1501b639905b5114 @dimkalinux dimkalinux committed Feb 19, 2012
Showing with 23 additions and 18 deletions.
  1. +1 −1 edit.php
  2. +18 −0 include/constants.php
  3. +1 −14 include/essentials.php
  4. +1 −1 misc.php
  5. +1 −1 moderate.php
  6. +1 −1 post.php
View
@@ -89,7 +89,7 @@
if ($subject == '')
$errors[] = $lang_post['No subject'];
- else if (utf8_strlen($subject) > 70)
+ else if (utf8_strlen($subject) > FORUM_SUBJECT_MAXIMUM_LENGTH)
$errors[] = $lang_post['Too long subject'];
else if ($forum_config['p_subject_all_caps'] == '0' && check_is_all_caps($subject) && !$forum_page['is_admmod'])
$subject = utf8_ucwords(utf8_strtolower($subject));
View
@@ -0,0 +1,18 @@
+<?php
+
+// Define the version and database revision that this code was written for
+define('FORUM_VERSION', '1.4.2');
+define('FORUM_DB_REVISION', 5);
+
+// Define a few commonly used constants
+define('FORUM_UNVERIFIED', 0);
+define('FORUM_ADMIN', 1);
+define('FORUM_GUEST', 2);
+
+// Define avatars type
+define('FORUM_AVATAR_NONE', 0);
+define('FORUM_AVATAR_GIF', 1);
+define('FORUM_AVATAR_JPG', 2);
+define('FORUM_AVATAR_PNG', 3);
+
+define('FORUM_SUBJECT_MAXIMUM_LENGTH', 70);
@@ -10,9 +10,7 @@
if (!defined('FORUM_ROOT'))
exit('The constant FORUM_ROOT must be defined and point to a valid PunBB installation root directory.');
-// Define the version and database revision that this code was written for
-define('FORUM_VERSION', '1.4.2');
-define('FORUM_DB_REVISION', 5);
+require FORUM_ROOT.'include/constants.php';
// Record the start time (will be used to calculate the generation time for the page)
list($usec, $sec) = explode(' ', microtime());
@@ -132,17 +130,6 @@
require FORUM_CACHE_DIR.'cache_hooks.php';
}
-// Define a few commonly used constants
-define('FORUM_UNVERIFIED', 0);
-define('FORUM_ADMIN', 1);
-define('FORUM_GUEST', 2);
-
-// Define avatars type
-define('FORUM_AVATAR_NONE', 0);
-define('FORUM_AVATAR_GIF', 1);
-define('FORUM_AVATAR_JPG', 2);
-define('FORUM_AVATAR_PNG', 3);
-
// A good place to add common functions for your extension
($hook = get_hook('es_essentials')) ? eval($hook) : null;
View
@@ -233,7 +233,7 @@
if ($subject == '')
$errors[] = $lang_misc['No e-mail subject'];
- else if (utf8_strlen($subject) > 70)
+ else if (utf8_strlen($subject) > FORUM_SUBJECT_MAXIMUM_LENGTH)
$errors[] = $lang_misc['Too long e-mail subject'];
if ($message == '')
View
@@ -291,7 +291,7 @@
if ($new_subject == '')
message($lang_post['No subject']);
- else if (utf8_strlen($new_subject) > 70)
+ else if (utf8_strlen($new_subject) > FORUM_SUBJECT_MAXIMUM_LENGTH)
message($lang_post['Too long subject']);
// Get data from the new first post
View
@@ -121,7 +121,7 @@
if ($subject == '')
$errors[] = $lang_post['No subject'];
- else if (utf8_strlen($subject) > 70)
+ else if (utf8_strlen($subject) > FORUM_SUBJECT_MAXIMUM_LENGTH)
$errors[] = $lang_post['Too long subject'];
else if ($forum_config['p_subject_all_caps'] == '0' && check_is_all_caps($subject) && !$forum_page['is_admmod'])
$errors[] = $lang_post['All caps subject'];

3 comments on commit 2a5631e

@Shutnik

а в сообщении об ошибке так и осталось 70?

@dimkalinux
Member

Еще не везде заменил. Например, в maxlength атрибутах инпутов.

@ashcs
Member
ashcs commented on 2a5631e Jun 11, 2012

исправлено:
b2ea2ef

Please sign in to comment.