Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 169 lines (141 sloc) 5.122 kb
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
1 <?php
2 /**
3 *
4 * @package Icy Phoenix
5 * @version $Id$
6 * @copyright (c) 2008 Icy Phoenix
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 *
9 */
10
11 /**
12 *
13 * @Extra credits for this file
14 * Smartor (smartor_xp@hotmail.com)
15 *
16 */
17
06ce0f8 @MightyGorgon Brand new version...
authored
18 define('IN_ICYPHOENIX', true);
19 if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
20 if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
21 include(IP_ROOT_PATH . 'common.' . PHP_EXT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
22
23 // Start session management
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
24 $user->session_begin();
25 //$auth->acl($user->data);
26 $user->setup();
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
27 // End session management
28
29 // Get general album information
06ce0f8 @MightyGorgon Brand new version...
authored
30 include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
31
32 // ------------------------------------
33 // Check the request
34 // ------------------------------------
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
35 $pic_id = request_var('pic_id', 0);
36 if ($pic_id <= 0)
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
37 {
38 message_die(GENERAL_ERROR, 'No pics specified');
39 }
40
41 // ------------------------------------
42 // Get this pic info and current Category Info
43 // ------------------------------------
44 $sql = "SELECT p.*, c.*
45 FROM ". ALBUM_TABLE ." AS p, ". ALBUM_CAT_TABLE ." AS c
46 WHERE p.pic_id = '$pic_id'
47 AND c.cat_id = p.pic_cat_id";
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
48 $result = $db->sql_query($sql);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
49 $thispic = $db->sql_fetchrow($result);
50
51 $cat_id = $thispic['cat_id'];
52 $album_user_id = $thispic['cat_user_id'];
53
54 $pic_filename = $thispic['pic_filename'];
55 $pic_thumbnail = $thispic['pic_thumbnail'];
56
57 if( empty($thispic) )
58 {
59 message_die(GENERAL_ERROR, $lang['Pic_not_exist']);
60 }
61
62 // ------------------------------------
63 // Check the permissions
64 // ------------------------------------
65 $album_user_access = album_permissions($album_user_id, $cat_id, ALBUM_AUTH_EDIT, $thispic);
66
67 if ($album_user_access['edit'] == 0)
68 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
69 if (!$user->data['session_logged_in'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
70 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
71 redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=album_edit.' . PHP_EXT . '?pic_id=' . $pic_id));
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
72 }
73 else
74 {
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
75 message_die(GENERAL_ERROR, $lang['Not_Authorized']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
76 }
77 }
78 else
79 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
80 if((!$album_user_access['moderator']) && ($user->data['user_level'] != ADMIN))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
81 {
09f38bc @MightyGorgon Another milestone almost achieved for new Icy Phoenix version: user/s…
authored
82 if ($thispic['pic_user_id'] != $user->data['user_id'])
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
83 {
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
84 message_die(GENERAL_ERROR, $lang['Not_Authorized']);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
85 }
86 }
87 }
88
89 /*
90 +----------------------------------------------------------
91 | Main work here...
92 +----------------------------------------------------------
93 */
94
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
95 $pic_title = request_post_var('pic_title', '', true);
96 $pic_desc = request_post_var('pic_desc', '', true);
97 $pic_desc = substr($pic_desc, 0, $album_config['desc_length']);
98
99 if(empty($pic_title))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
100 {
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
101 $html_status = ($config['allow_html']) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
102 $bbcode_status = ($config['allow_bbcode']) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
103 $bbcode_status = sprintf($bbcode_status, '<a href="' . append_sid('faq.' . PHP_EXT . '?mode=bbcode') . '" target="_blank">', '</a>');
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
104 $smilies_status = ($config['allow_smilies']) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
105 $formatting_status = '<br />' . $html_status . '<br />' . $bbcode_status . '<br />' . $smilies_status . '<br />';
106
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
107 $template->assign_vars(array(
108 'L_EDIT_PIC_INFO' => $lang['Edit_Pic_Info'],
109
110 'CAT_TITLE' => $thispic['cat_title'],
06ce0f8 @MightyGorgon Brand new version...
authored
111 'U_VIEW_CAT' => append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)),
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
112
113 'L_PIC_ID' => $lang['Pic_ID'],
114 'L_PIC_TITLE' => $lang['Pic_Image'],
115 'PIC_ID' => $pic_id,
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
116 'PIC_TITLE' => $thispic['pic_title'],
117 'PIC_DESC' => $thispic['pic_desc'],
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
118
119 'L_PIC_DESC' => $lang['Pic_Desc'],
1c23423 @MightyGorgon Latest updates for IP 1.3 RC2
authored
120 //'L_PLAIN_TEXT_ONLY' => $lang['Plain_text_only'],
121 'L_PLAIN_TEXT_ONLY' => $formatting_status,
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
122 'L_MAX_LENGTH' => $lang['Max_length'],
123
124 'L_UPLOAD_NO_TITLE' => $lang['Upload_no_title'],
125 'L_DESC_TOO_LONG' => $lang['Desc_too_long'],
126 'S_PIC_DESC_MAX_LENGTH' => $album_config['desc_length'],
127
128 'L_RESET' => $lang['Reset'],
129 'L_SUBMIT' => $lang['Submit'],
130
06ce0f8 @MightyGorgon Brand new version...
authored
131 'S_ALBUM_ACTION' => append_sid(album_append_uid('album_edit.' . PHP_EXT . '?pic_id=' . $pic_id)),
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
132 )
133 );
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
134 full_page_generation('album_edit_body.tpl', $lang['Album'], '', '');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
135 }
136 else
137 {
138 // --------------------------------
139 // Check posted info
140 // --------------------------------
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
141 if(empty($pic_title))
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
142 {
143 message_die(GENERAL_ERROR, $lang['Missed_pic_title']);
144 }
145
146 // --------------------------------
147 // Update the DB
148 // --------------------------------
149 $sql = "UPDATE ". ALBUM_TABLE ."
a4ea299 @MightyGorgon First commit with UTF-8 modifications, almost all files have been edi…
authored
150 SET pic_title = '" . $db->sql_escape($pic_title) . "', pic_desc= '" . $db->sql_escape($pic_desc) . "'
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
151 WHERE pic_id = '" . $pic_id . "'";
2d81429 @MightyGorgon New Icy Phoenix version based on some new core functions.php
authored
152 $result = $db->sql_query($sql);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
153
154 // --------------------------------
155 // Complete... now send a message to user
156 // --------------------------------
157 $message = $lang['Pics_updated_successfully'];
158
f0d7f4b @MightyGorgon Big commit with many changes.
authored
159 $redirect_url = append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id));
160 meta_refresh(3, $redirect_url);
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
161
06ce0f8 @MightyGorgon Brand new version...
authored
162 $message .= '<br /><br />' . sprintf($lang['Click_return_category'], '<a href="' . append_sid(album_append_uid('album_cat.' . PHP_EXT . '?cat_id=' . $cat_id)) . '">', '</a>');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
163
06ce0f8 @MightyGorgon Brand new version...
authored
164 $message .= '<br /><br />' . sprintf($lang['Click_return_album_index'], '<a href="' . append_sid('album.' . PHP_EXT) . '">', '</a>');
d07f25e @MightyGorgon git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46…
authored
165
166 message_die(GENERAL_MESSAGE, $message);
167 }
168
169 ?>
Something went wrong with that request. Please try again.