Changeset 6891 for extensions/AMetaData/amd_root.class.inc.php
- Timestamp:
- Sep 13, 2010, 8:40:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/amd_root.class.inc.php
r6734 r6891 23 23 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); 24 24 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); 25 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); 25 26 26 27 include_once('amd_jpegmetadata.class.inc.php'); … … 48 49 'groups', 49 50 'user_tags_label', 50 'user_tags_def'); 51 'user_tags_def', 52 'tags_values'); 51 53 $this->setTablesList($tableList); 52 54 … … 66 68 //parent::__destruct(); 67 69 } 68 69 70 70 71 /* --------------------------------------------------------------------------- … … 85 86 'amd_FillDataBaseContinuously' => "y", 86 87 'amd_FillDataBaseIgnoreSchemas' => array(), 88 'amd_UseMetaFromHD' => "y", 87 89 88 90 // theses options can be set manually … … 178 180 public function doRandomAnalyze() 179 181 { 180 $sql="SELECT tai.imageId, ti.path FROM ".$this->tables['images']." tai182 $sql="SELECT tai.imageId, ti.path, ti.has_high FROM ".$this->tables['images']." tai 181 183 LEFT JOIN ".IMAGES_TABLE." ti ON tai.imageId = ti.id 182 184 WHERE tai.analyzed = 'n' … … 190 192 while($row=pwg_db_fetch_assoc($result)) 191 193 { 192 $this->analyzeImageFile($path."/".$row['path'], $row['imageId']); 194 if($row['has_high']===true and $this->config['amd_UseMetaFromHD']=='y') 195 { 196 $this->analyzeImageFile($path."/".dirname($row['path'])."/pwg_high/".basename($row['path']), $row['imageId']); 197 } 198 else 199 { 200 $this->analyzeImageFile($path."/".$row['path'], $row['imageId']); 201 } 193 202 } 194 203 … … 234 243 } 235 244 236 $sqlInsert="";245 //$sqlInsert=""; 237 246 $massInsert=array(); 238 247 $nbTags=0; … … 272 281 { 273 282 $nbTags++; 274 if($sqlInsert!="") $sqlInsert.=", ";275 $sqlInsert.="($imageId, '$numId', '".addslashes($value)."')";283 //if($sqlInsert!="") $sqlInsert.=", "; 284 //$sqlInsert.="($imageId, '$numId', '".addslashes($value)."')"; 276 285 $massInsert[]="('$imageId', '$numId', '".addslashes($value)."') "; 277 286 } … … 291 300 pwg_query($sql); 292 301 302 unset($massInsert); 293 303 294 304 return("$imageId=$nbTags;"); … … 398 408 if(!is_null($buildValue['value'])) 399 409 { 410 $buildValue['value']=addslashes($buildValue['value']); 400 411 $inserts[]=$buildValue; 401 412 $num++; … … 483 494 if(isset($values[$rule['value']]) and 484 495 !preg_match('/'.$rule['conditionValue'].'/i', $values[$rule['value']])) $ok=true; 496 break; 497 case '^%': 498 if(isset($values[$rule['value']]) and 499 preg_match('/^'.$rule['conditionValue'].'/i', $values[$rule['value']])) $ok=true; 500 break; 501 case '!^%': 502 if(isset($values[$rule['value']]) and 503 !preg_match('/^'.$rule['conditionValue'].'/i', $values[$rule['value']])) $ok=true; 504 break; 505 case '$%': 506 if(isset($values[$rule['value']]) and 507 preg_match('/'.$rule['conditionValue'].'$/i', $values[$rule['value']])) $ok=true; 508 break; 509 case '!$%': 510 if(isset($values[$rule['value']]) and 511 !preg_match('/'.$rule['conditionValue'].'$/i', $values[$rule['value']])) $ok=true; 485 512 break; 486 513 } … … 557 584 } 558 585 559 560 586 /** 561 587 * This function : … … 569 595 * @return String : the value prepared 570 596 */ 571 protectedfunction prepareValueForDisplay($value, $translatable=true, $separator=", ")597 static public function prepareValueForDisplay($value, $translatable=true, $separator=", ") 572 598 { 573 599 global $user; … … 720 746 } 721 747 748 722 749 } // amd_root class 723 750 724 751 725 752 753 Class AMD_functions { 754 /** 755 * return all HTML&JS code necessary to display a dialogbox to choose 756 * a metadata 757 */ 758 static public function dialogBoxMetadata() 759 { 760 global $template, $prefixeTable; 761 762 $tables=array( 763 'used_tags' => $prefixeTable.'amd_used_tags', 764 'selected_tags' => $prefixeTable.'amd_selected_tags', 765 ); 766 767 $template->set_filename('metadata_choose', 768 dirname(__FILE__).'/templates/amd_dialog_metadata_choose.tpl'); 769 770 $datas=array( 771 'urlRequest' => 'plugins/'.basename(dirname(__FILE__)).'/amd_ajax.php', 772 'tagList' => array(), 773 ); 774 775 /* 776 * build tagList 777 */ 778 $sql="SELECT ut.name, ut.numId, ut.tagId 779 FROM ".$tables['used_tags']." ut 780 JOIN ".$tables['selected_tags']." st ON st.tagId = ut.tagId 781 ORDER BY tagId"; 782 $result=pwg_query($sql); 783 if($result) 784 { 785 while($row=pwg_db_fetch_assoc($result)) 786 { 787 $datas['tagList'][]=Array( 788 'tagId' => $row['tagId'], 789 'name' => L10n::get($row['name']), 790 'numId' => $row['numId'] 791 ); 792 } 793 } 794 795 $template->assign('datas', $datas); 796 unset($data); 797 798 return($template->parse('metadata_choose', true)); 799 } 800 } 801 802 803 726 804 ?>
Note: See TracChangeset
for help on using the changeset viewer.