Changeset 9449 for extensions/PWG_Stuffs/admin
- Timestamp:
- Mar 1, 2011, 1:00:44 PM (13 years ago)
- Location:
- extensions/PWG_Stuffs/admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PWG_Stuffs/admin/manage.inc.php
r9410 r9449 30 30 pwg_query(' 31 31 UPDATE ' . STUFFS_TABLE . ' 32 SET datas = "'.addslashes(serialize( array('hide' => isset($_POST['hidemb'])))).'"32 SET datas = "'.addslashes(serialize(!isset($_POST['hidemb']))).'" 33 33 WHERE id=0;'); 34 34 … … 60 60 $module['name'] = !empty($module['path']) ? $module['name'] : l10n('stuffs_main_block'); 61 61 62 $missing = false; 62 $missing_message = ''; 63 if ($module['path'] == PHPWG_PLUGINS_PATH.'piclens/stuffs_module/' and !file_exists(PICLENS_PATH.'stuffs_module/main.inc.php')) 64 { 65 $missing_message = l10n('stuffs_piclens_need_upgrade'); 66 } 63 67 if (!empty($module['path'])) 64 68 { 65 69 preg_match('#^'.preg_quote(PHPWG_PLUGINS_PATH).'([^/]*?)/#', $module['path'], $match); 66 $missing = !isset($pwg_loaded_plugins[$match[1]]); 70 if (!isset($pwg_loaded_plugins[$match[1]])) 71 { 72 $missing_message = l10n('stuffs_parent_plugin_is_missing'); 73 } 67 74 } 68 75 … … 80 87 'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&tab=edit_module&edit='.$module['id'], 81 88 'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&del=' . $module['id'] : '', 82 'MISSING' => $missing ,89 'MISSING' => $missing_message, 83 90 ) 84 91 ); 85 92 86 if (empty($module['path']) and !empty($module['datas']))93 if (empty($module['path'])) 87 94 { 88 $ datas= unserialize($module['datas']);89 $template->assign('HIDEMB', $datas['hide']);95 $show = unserialize($module['datas']); 96 $template->assign('HIDEMB', !$show); 90 97 } 91 98 } -
extensions/PWG_Stuffs/admin/template/manage.tpl
r9369 r9449 63 63 <input type="text" size="2" maxlength="2" value="{$module.WIDTH}" name="width[{$module.ID}]" > % 64 64 </li> 65 {if !$module.MISSING}65 {if empty($module.MISSING)} 66 66 <li><a href="{$module.U_EDIT}" title="{'stuffs_edit'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'stuffs_edit'|@translate}"/></a></li> 67 67 {/if} … … 78 78 </p> 79 79 80 {if $module.MISSING}81 <p style="margin-left: 30px;">{ 'stuffs_parent_plugin_is_missing'|@translate}</p>80 {if !empty($module.MISSING)} 81 <p style="margin-left: 30px;">{$module.MISSING}</p> 82 82 {elseif !empty($module.DESC)} 83 83 <p style="margin-left: 30px;"><i>{$module.DESC}</i></p> -
extensions/PWG_Stuffs/admin/template/new.tpl
r9369 r9449 3 3 </div> 4 4 5 <form method="post" action="" class=" general">5 <form method="post" action="" class="properties"> 6 6 7 <fieldset> 8 <legend>{'stuffs_add_mod'|@translate}</legend> 9 10 <table> 11 {foreach from=$add_module item=module} 12 <tr> 13 <td><input type="radio" value="{$module.MODULE_PATH}" name="module"/> 14 <b>{$module.NAME}</b> : {$module.DESC}</td> 15 </tr> 16 {/foreach} 17 </table> 18 <br> 19 <div style="text-align:center;"> 20 <input class="submit" name="addModule" type="submit" value="{'stuffs_add_mod'|@translate}" {$TAG_INPUT_ENABLED} /> 21 </div> 22 7 <fieldset id="indexDisplayConf" style="padding-top:25px;"> 8 <legend>{'stuffs_add_mod'|@translate}</legend> 9 <ul> 10 {foreach from=$add_module item=module} 11 <li> 12 <label> 13 <span class="property">{$module.NAME} <span style="font-weight:normal;">: {$module.DESC}</span></span> 14 <input type="radio" value="{$module.MODULE_PATH}" name="module"/> 15 </label> 16 </li> 17 {/foreach} 18 </ul> 23 19 </fieldset> 24 20 <p><input class="submit" name="addModule" type="submit" value="{'stuffs_add_mod'|@translate}"/></p> 25 21 </form> -
extensions/PWG_Stuffs/admin/upgrade.inc.php
r9410 r9449 5 5 global $prefixeTable, $conf; 6 6 7 $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'stuffs;';7 $query = 'SHOW FULL COLUMNS FROM '.STUFFS_TABLE.';'; 8 8 $result = array_from_query($query, 'Field'); 9 9 if ($result[5] == 'params') 10 10 { 11 $query = 'ALTER TABLE ' . $prefixeTable . 'stuffs11 $query = 'ALTER TABLE '.STUFFS_TABLE.' 12 12 MODIFY COLUMN name TEXT CHARACTER SET utf8 NOT NULL, 13 13 MODIFY COLUMN descr VARCHAR(255) CHARACTER SET utf8 default NULL, … … 30 30 pwg_query($query); 31 31 32 $query = 'SELECT id, name, type, params, datas FROM ' . $prefixeTable . 'stuffs;';32 $query = 'SELECT id, name, type, params, datas FROM '.STUFFS_TABLE.';'; 33 33 $result = pwg_query($query); 34 34 … … 76 76 } 77 77 78 $query = 'ALTER TABLE ' . $prefixeTable . 'stuffsDROP params;';78 $query = 'ALTER TABLE '.STUFFS_TABLE.' DROP params;'; 79 79 pwg_query($query); 80 80 … … 86 86 } 87 87 88 $query = 'SHOW FULL COLUMNS FROM ' . $prefixeTable . 'stuffs;';88 $query = 'SHOW FULL COLUMNS FROM '.STUFFS_TABLE.';'; 89 89 $result = array_from_query($query, 'Field'); 90 90 if ($result[4] != 'path') 91 91 { 92 $query = 'ALTER TABLE ' . $prefixeTable . 'stuffs 92 $path = $plugin['id']; 93 $conf['Stuffs'] = array(); 94 95 $query = 'ALTER TABLE '.STUFFS_TABLE.' 93 96 CHANGE `type` `path` VARCHAR( 255 ) NULL DEFAULT NULL, 94 97 ADD `level` TINYINT( 3 ) NOT NULL default "0" AFTER `groups`, … … 97 100 pwg_query($query); 98 101 99 $query = 'UPDATE ' . $prefixeTable . 'stuffs102 $query = 'UPDATE '.STUFFS_TABLE.' 100 103 SET on_root = "false" 101 WHERE on_cats = "false"104 WHERE on_cats <> "true" 102 105 ;'; 103 106 pwg_query($query); 104 107 105 $query = 'UPDATE ' . $prefixeTable . 'stuffs 106 SET path = CONCAT("'.PHPWG_ROOT_PATH.'", "plugins/PWG_Stuffs/", path, "/") 107 WHERE path <> "MainBlock" 108 $query = 'SELECT * FROM '.STUFFS_TABLE.';'; 109 $result = pwg_query($query); 110 111 while ($row = pwg_db_fetch_assoc($result)) 112 { 113 if ($row['path'] == 'Personal') 114 { 115 $data = unserialize($row['datas']); 116 $row['datas'] = serialize($data[0]); 117 } 118 if ($row['path'] == 'piclenswall') 119 { 120 $row['path'] = PHPWG_PLUGINS_PATH.'piclens/stuffs_module/'; 121 $conf['Stuffs']['piclens_upgrade'] = true; 122 } 123 elseif ($row['path'] != 'MainBlock') 124 { 125 $row['path'] = PHPWG_PLUGINS_PATH.$path.'/modules/'.$row['path'].'/'; 126 } 127 else 128 { 129 // Main Block 130 $row['path'] = null; 131 if (!empty($row['datas'])) 132 { 133 $data = unserialize($row['datas']); 134 $row['datas'] = serialize(!$data['hide']); 135 } 136 else 137 { 138 $row['datas'] = serialize(true); 139 } 140 } 141 142 $query = 'UPDATE '.STUFFS_TABLE.' 143 SET path = '.(is_null($row['path']) ? 'NULL' : '"'.$row['path'].'"').', 144 datas = "'.addslashes($row['datas']).'" 145 WHERE id = '.$row['id'].' 108 146 ;'; 109 pwg_query($query); 147 pwg_query($query); 148 } 110 149 111 $query = 'UPDATE ' . $prefixeTable . 'stuffs 112 SET path = NULL 113 WHERE path = "MainBlock" 114 ;'; 115 pwg_query($query); 116 117 $conf['Stuffs'] = array('level_perm' => false); 150 $conf['Stuffs']['level_perm'] = false; 118 151 119 152 $query = 'SELECT id 120 FROM '. $prefixeTable.'stuffs153 FROM '.STUFFS_TABLE.' 121 154 WHERE users <> "guest,generic,normal,admin,webmaster" 122 155 ;'; … … 125 158 126 159 $query = 'SELECT id 127 FROM '. $prefixeTable.'stuffs160 FROM '.STUFFS_TABLE.' 128 161 WHERE groups IS NOT NULL 129 162 ;'; … … 132 165 133 166 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 134 VALUES ("PWG_Stuffs" , "'.pwg_db_real_escape_string(serialize($conf['Stuffs'])).'" , "PWG Stuffs configuration");'; 135 pwg_query($query); 167 VALUES ("PWG_Stuffs" , "'.pwg_db_real_escape_string(serialize($conf['Stuffs'])).'" , "PWG Stuffs plugin configuration");'; 168 pwg_query($query); 169 } 170 171 // Display Piclens upgrade message 172 if (isset($conf['Stuffs']['piclens_upgrade']) and isset($menu)) 173 { 174 if (file_exists(PHPWG_PLUGINS_PATH.'piclens/stuffs_module/main.inc.php')) 175 { 176 unset($conf['Stuffs']['piclens_upgrade']); 177 } 178 else 179 { 180 if (get_db_plugins('active','piclens')) 181 { 182 global $page; 183 load_language('plugin.lang', STUFFS_PATH); 184 array_push($page['errors'], l10n('stuffs_piclens_need_upgrade')); 185 } 186 } 187 conf_update_param('PWG_Stuffs', pwg_db_real_escape_string(serialize($conf['Stuffs']))); 136 188 } 137 189
Note: See TracChangeset
for help on using the changeset viewer.