root/releases/0.1.2a/units/icons/function_add_icons.php

Revision 2, 2.1 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // Allow the user to add more icons
4         $numicons = db_query("select count(ident) as iconnum from icons where owner = " . $_SESSION['userid']);
5         $numicons = $numicons[0]->iconnum;
6         
7         if ($numicons < $_SESSION['icon_quota']) {
8
9             $body = <<< END
10             <p>
11                 <h2>Upload a new icon</h2>
12             </p>
13             <p>
14                 Icons must have maximum dimensions of 100x100 pixels, and may not be larger than 30k in filesize.
15                 They must be in JPEG, GIF or PNG format.  You may upload up to
16                 {$_SESSION['icon_quota']} icons in total.
17             </p>
18             <form action="" method="post" enctype="multipart/form-data">
19 END;
20             $name = "<label for=\"iconfile\">Icon to upload:</label>";
21             $column1 = "
22                         <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"30000\" />
23                         <input name=\"iconfile\" id=\"iconfile\" type=\"file\" />
24                         ";
25             $body .= run("templates:draw", array(
26                             'context' => 'databox',
27                             'name' => $name,
28                             'column1' => $column1
29                         )
30                         );
31             $name = "<label for=\"icondescription\">Icon description:</label>";
32             $column1 = "<input type=\"text\" name=\"icondescription\" id=\"icondescription\" value=\"\" />";
33             $body .= run("templates:draw", array(
34                             'context' => 'databox',
35                             'name' => $name,
36                             'column1' => $column1
37                         )
38                         );
39             $name = "<label for=\"icondefault\">Make this your default icon:</label>";
40             $column1 = "
41                             <select name=\"icondefault\" id=\"icondefault\">
42                                 <option value=\"yes\">Yes</option>
43                                 <option value=\"no\">No</option>
44                             </select>
45                         ";
46             $body .= run("templates:draw", array(
47                             'context' => 'databox',
48                             'name' => $name,
49                             'column1' => $column1
50                         )
51                         );
52             $body .= <<< END
53                         <p align="center"><input type="hidden" name="action" value="icons:add" />
54                             <input type="submit" value="Upload new icon" /></p>
55             </form>
56
57 END;
58         } else {
59             $body = <<< END
60             <p>
61                 Your icon quota is {$_SESSION['icon_quota']} and you have {$numicons} icons uploaded.
62                 You may not upload any more icons until you've deleted some.
63             </p>
64 END;
65         }
66
67     $run_result .= $body;
68         
69 ?>
Note: See TracBrowser for help on using the browser.