Changeset 4512
- Timestamp:
- Dec 18, 2009, 10:08:21 PM (14 years ago)
- Location:
- branches/2.0
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/include/ws_functions.inc.php
r4510 r4512 856 856 return new PwgError(401, 'Access denied'); 857 857 } 858 if (!$service->isPost()) 859 { 860 return new PwgError(405, "This method requires HTTP POST"); 861 } 858 862 $params['image_id'] = array_map( 'intval',$params['image_id'] ); 859 863 if ( empty($params['image_id']) ) … … 866 870 return new PwgError(WS_ERR_INVALID_PARAM, "Invalid level"); 867 871 } 872 868 873 $query = ' 869 874 UPDATE '.IMAGES_TABLE.' … … 886 891 // type {thumb, file, high} 887 892 // position 888 893 889 894 if (!is_admin() || is_adviser() ) 890 895 { … … 951 956 { 952 957 unlink($output_filepath); 953 958 954 959 if (is_file($output_filepath)) 955 960 { … … 958 963 } 959 964 } 960 965 961 966 $upload_dir = PHPWG_ROOT_PATH.'upload/buffer'; 962 967 $pattern = '/'.$original_sum.'-'.$type.'/'; 963 968 $chunks = array(); 964 969 965 970 if ($handle = opendir($upload_dir)) 966 971 { … … 983 988 984 989 $i = 0; 985 990 986 991 foreach ($chunks as $chunk) 987 992 { 988 993 $string = file_get_contents($chunk); 989 994 990 995 if (function_exists('memory_get_usage')) { 991 996 ws_logfile('[merge_chunks] memory_get_usage on chunk '.++$i.': '.memory_get_usage()); 992 997 } 993 998 994 999 if (!file_put_contents($output_filepath, $string, FILE_APPEND)) 995 1000 { … … 997 1002 exit(); 998 1003 } 999 1004 1000 1005 unlink($chunk); 1001 1006 } … … 1015 1020 1016 1021 $upload_dir = dirname($file_path); 1017 1022 1018 1023 if (!is_dir($upload_dir)) { 1019 1024 umask(0000); … … 1102 1107 // 1103 1108 $update = array(); 1104 1109 1105 1110 if ('high' == $params['type']) 1106 1111 { … … 1121 1126 { 1122 1127 $update['id'] = $params['image_id']; 1123 1128 1124 1129 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 1125 1130 mass_updates( … … 1840 1845 exit(); 1841 1846 } 1842 1847 1843 1848 $query = ' 1844 1849 SELECT … … 1858 1863 exit(); 1859 1864 } 1860 1865 1861 1866 $to_update_cat_ids = array(); 1862 1867 1863 1868 // in case of replace mode, we first check the existing associations 1864 1869 $query = ' … … 1885 1890 } 1886 1891 } 1887 1892 1888 1893 $new_cat_ids = array_diff($cat_ids, $existing_cat_ids); 1889 1894 if (count($new_cat_ids) == 0) … … 1891 1896 return true; 1892 1897 } 1893 1898 1894 1899 if ($search_current_ranks) 1895 1900 { … … 1915 1920 $current_rank_of[$cat_id] = 0; 1916 1921 } 1917 1922 1918 1923 if ('auto' == $rank_on_category[$cat_id]) 1919 1924 { … … 1922 1927 } 1923 1928 } 1924 1929 1925 1930 $inserts = array(); 1926 1931 1927 1932 foreach ($new_cat_ids as $cat_id) 1928 1933 { … … 1936 1941 ); 1937 1942 } 1938 1943 1939 1944 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 1940 1945 mass_inserts( … … 1943 1948 $inserts 1944 1949 ); 1945 1950 1946 1951 update_category($new_cat_ids); 1947 1952 } … … 2002 2007 ); 2003 2008 } 2004 2009 2005 2010 } 2006 2011 … … 2012 2017 return true; 2013 2018 } 2014 2019 2015 2020 file_put_contents( 2016 2021 $conf['ws_log_filepath'], -
branches/2.0/template-common/scripts.js
r3009 r4512 71 71 } 72 72 73 74 function blockToggleDisplay(headerId, contentId) 75 { 76 var revHeader = document.getElementById(headerId); 77 var revContent = document.getElementById(contentId); 78 79 if (revContent.style.display == 'none') 80 { 81 revContent.style.display = 'block'; 82 revHeader.className = 'instructionBlockHeaderExpanded'; 83 } 84 else 85 { 86 revContent.style.display = 'none'; 87 revHeader.className = 'instructionBlockHeaderCollapsed'; 88 } 89 } 73 90 74 91 … … 91 108 }; 92 109 93 function blockToggleDisplay(headerId, contentId)94 {95 var revHeader = document.getElementById(headerId);96 var revContent = document.getElementById(contentId);97 98 if (revContent.style.display == 'none')99 {100 revContent.style.display = 'block';101 revHeader.className = 'instructionBlockHeaderExpanded';102 }103 else104 {105 revContent.style.display = 'none';106 revHeader.className = 'instructionBlockHeaderCollapsed';107 }108 }109 110 110 111 111 PwgWS.prototype = { … … 130 130 this.transport.onreadystatechange = this.onStateChange.pwgBind(this); 131 131 132 var url = this.urlRoot; 133 url += "ws.php?format=json&method="+method; 132 var url = this.urlRoot+"ws.php?format=json"; 133 134 var body = "method="+method; 134 135 if (parameters) 135 136 { … … 139 140 { 140 141 for (var i=0; i<parameters[property].length; i++) 141 url+= "&"+property+"[]="+encodeURIComponent(parameters[property][i]);142 body += "&"+property+"[]="+encodeURIComponent(parameters[property][i]); 142 143 } 143 144 else 144 url += "&"+property+"="+encodeURIComponent(parameters[property]); 145 } 146 } 147 this.transport.open(this.options.method, url, this.options.async); 148 this.transport.send(null); 145 body += "&"+property+"="+encodeURIComponent(parameters[property]); 146 } 147 } 148 149 if (this.options.method == "POST" ) 150 { 151 this.transport.open(this.options.method, url, this.options.async); 152 this.transport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 153 this.transport.send(body); 154 } 155 else 156 { 157 url += "&"+body; 158 this.transport.open(this.options.method, url, this.options.async); 159 this.transport.send(null); 160 } 149 161 }, 150 162 -
branches/2.0/template/yoga/picture.tpl
r2903 r4512 216 216 "pwg.images.setPrivacyLevel", {image_id: id, level:level} , 217 217 { 218 method: "POST", 218 219 onFailure: function(num, text) { selectElement.disabled = false; alert(num + " " + text); }, 219 220 onSuccess: function(result) { selectElement.disabled = false; } -
branches/2.0/ws.php
r4459 r4512 137 137 'level' => array('maxValue'=>$conf['available_permission_levels']), 138 138 ), 139 'sets the privacy levels for the images '139 'sets the privacy levels for the images (POST method only)' 140 140 ); 141 141 … … 279 279 array( 280 280 'image_id' => array(), 281 281 282 282 'name' => array('default' => null), 283 283 'author' => array('default' => null), … … 298 298 <br/><b>multiple_value_mode</b> can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories' 299 299 ); 300 300 301 301 $service->addMethod( 302 302 'pwg.categories.setInfo', … … 304 304 array( 305 305 'category_id' => array(), 306 306 307 307 'name' => array('default' => null), 308 308 'comment' => array('default' => null),
Note: See TracChangeset
for help on using the changeset viewer.