Lines Matching refs:this

75     $this->plugin = $plugin;
76 $this->imgDir = DOKU_REL.'lib/plugins/glossary/images/';
79 $this->cacheRootDir = $savedir."cache/glossary/";
80 $this->dataRootDir = $savedir.trim ($this->plugin->getConf ('dataDir').'/');
81 glossary::createDirIsNeeded ($this->cacheRootDir);
82 glossary::createDirIsNeeded ($this->dataRootDir);
83 $this->NS = cleanId (trim ($ns));
84 $this->md5ns = md5 ($this->NS);
85 $this->cacheDir = $this->cacheRootDir.$this->md5ns."/";
86 glossary::createDirIsNeeded ($this->cacheDir);
87 $this->dataDir = $this->dataRootDir.$this->md5ns."/";
88 glossary::createDirIsNeeded ($this->dataDir);
89 $this->sampleFile = $this->cacheDir."sample.cache";
90 $this->listFile = $this->cacheDir."list.cache";
91 $this->recentDays = $this->getConf ('recentDays');
92 $this->maxIP = $this->getConf ('maxIP');
93 $this->adminGroup = trim ($this->getConf ('adminGroup'));
94 $this->propGroup = trim ($this->getConf ('propGroup'));
95 $this->transSep = trim ($this->getConf ('transSep'));
99 return $this->plugin->getConf ($name);
102 return $this->plugin->getLang ($name);
108 return $this->plugin->localFN ($name);
113 if (isset ($this->message[$type]))
114 $this->message[$type] .= '<br/>';
115 $this->message[$type] .= $text;
121 $this->message ('notify', '<pre>'.$text.'</pre>');
125 $result = $this->oddEven [$even];
138 in_array ($this->adminGroup, $INFO ['userinfo']['grps']);
146 in_array ($this->propGroup, $INFO ['userinfo']['grps']);
153 $all = $this->readAllGlossary ($this->prop);
154 if (isset ($all[$this->md5id])) {
155 $this->message ('success', $this->getLang ('update'));
159 if ($this->testPropGroup ())
165 if ($count <= $this->maxIP) {
166 if ($count == $this->maxIP)
167 $this->message ('notify', $this->getLang ('lastIP'));
170 $this->message ('error', $this->getLang ('maxIP'));
179 $this->wordOk () || $this->translateOk () || $this->translateOk () || $this->ticketOk ();
196 $fileName = $dir.$this->configFile;
202 $this->lastNotification = $root->getElementsByTagName ("lastNotification")->item (0)->nodeValue;
203 …$this->lastNotificationReset = $root->getElementsByTagName ("lastNotificationReset")->item (0)->no…
208 if ($this->NS == false)
210 $fileName = $this->dataDir.$this->configFile;
211 @mkdir ($this->dataDir);
212 @chmod ($this->dataDir, 0775);
216 $root->appendChild ($xml->createElement ("nameSpace", htmlspecialchars ($this->NS)));
217 …$root->appendChild ($xml->createElement ("lastNotification", htmlspecialchars ($this->lastNotifica…
218 …$root->appendChild ($xml->createElement ("lastNotificationReset", htmlspecialchars ($this->lastNot…
226 if (!is_dir ($this->dataDir))
228 if ($this->NS == false)
231 $exclude_array = explode ("|", ".|..|".$this->configFile);
232 $pathDirObj = opendir ($this->dataDir);
236 $result[$regs[1]] = $this->readGlossary ($regs[1], $status, LOCK_SH);
244 $fileName = $this->dataDir.$status.$md5id.".xml";
251 $this->message ("error", "can't lock file ".$fileName.".");
259 foreach ($this->statusFields [$status] as $field)
266 $values['ns'] = $this->NS; // XXX compatibilité
270 foreach ($this->statusFields [$status] as $field)
273 $fileName = $this->dataDir.$status.$md5id.".xml";
280 $fileName = $this->dataDir.$status.$md5id.".xml";
286 $subDir = $this->dataRootDir.$md5ns."/";
290 $exclude_array = explode ("|", ".|..|".$this->configFile);
307 $this->md5id = md5 (trim ($request['ticket']));
308 $oldValues = $this->readGlossary ($this->md5id, $status, LOCK_SH);
310 foreach ($this->statusFields [$this->form] as $field) {
320 foreach ($this->statusFields [$this->hide] as $field)
323 $this->message ('success', $this->getLang ('readData'));
333 $this->printPollAjax (md5 (trim ($arg)));
338 $filename = $this->cacheDir."poll-".md5($md5id).".cache";
343 $poll = $this->readGlossary ($md5id, $this->poll, LOCK_SH);
344 list ($scoreVal, $scoreImg) = $this->getScore ($poll);
346 '<a onClick="glossaryPoll(this,\''.$md5id.'\',\'down\',\''.$this->NS.'\');">'.NL.
347 … ' <img src="'.$this->imgDir.'face-sad.png" /><span>'.$this->getLang ('tipPollDown').'</span>'.NL.
350 '<a onClick="glossaryPoll(this,\''.$md5id.'\',\'up\',\''.$this->NS.'\');">'.NL.
351 … ' <img src="'.$this->imgDir.'face-smile.png" /><span>'.$this->getLang ('tipPollUp').'</span>'.NL.
355 '<br/><b>'.$this->getLang ('notPolledYet').'</b>';
361 $scoreImg = '<img src="'.$this->imgDir.'score';
377 $all = $this->readAllGlossary ($this->def);
378 if (! isset ($all[$md5id]) || !in_array ($opinion, $this->statusFields [$this->poll])) {
379 $this->message ('error', $this->getLang ('noDef'));
382 $poll = $this->readGlossary ($md5id, $this->poll, LOCK_EX);
387 $this->writeGlossary ($md5id, $poll, $this->poll);
388 $this->message ('success', $this->getLang ('writePoll'));
389 @unlink ($this->cacheDir."poll-".md5($md5id).".cache");
390 $this->printPollAjax ($md5id);
395 $poll = $this->readGlossary ($md5id, $this->poll, LOCK_EX);
399 $this->writeGlossary ($md5id, $poll, $this->poll);
421 $cacheDir = $this->cacheRootDir.$nsMd5."/";
440 if (!$this->testNotEmpty ())
443 if ($this->ticketOk ()) {
444 if (!$this->updateRequest ($request, $status))
448 $this->md5id = md5 (trim ($request ['ticket']));
451 $this->message ('error', $this->getLang ('badCaptcha'));
454 if (!$this->wordOk ()) {
455 $this->message ('error', $this->getLang ('wordMandatory'));
458 if (!$this->translateOk ()) {
459 $this->message ('error', $this->getLang ('translateMandatory'));
469 $request['ns'] = $this->NS;
473 if ($status == $this->prop && $this->maxIP ($request))
475 $this->writeGlossary ($this->md5id, $request, $status);
476 … $this->message ('success', $this->getLang ('proposalRecorded').'<b>'.$request['ticket']."</b>.");
477 $this->adminNotification ($request, $status);
484 return $this->getGlosarySize ($this->def, $this->md5ns);
487 return $this->getGlosarySize ($this->prop, $this->md5ns);
490 return $this->getGlosarySize ($this->poll, $this->md5ns);
499 $this->manageRecord ($request, $this->prop, $needCaptcha);
504 ' <th><img src="'.$this->imgDir.'stop.png" /> '.$this->getLang ('word').'</th>'.NL.
505 … ' <th><img src="'.$this->imgDir.'one-way.png" /> '.$this->getLang ('translate').'</th>'.NL.
513 ' <th>'.$this->getLang ('why').'</th>'.NL.
516 ' <input type="hidden" name="glossary[ns]" value="'.$this->NS.'">'.NL.
517 …' <input type="submit" name="glossary[action]" value="'.$this->getLang (empty ($request['ti…
518 …ck="glossaryReset(this);glossaryUpdateProposalLabel(this.form)" value="'.$this->getLang ('new').'"…
524 ' '.$this->getLang ('ticketIfUpdate').NL.
538 if (file_exists ($this->sampleFile) &&
539 (time () - filemtime ($this->sampleFile) < $this->getConf ('sampleDelai'))) {
540 echo file_get_contents ($this->sampleFile);
544 $all = $this->readAllGlossary ($this->def);
549 foreach (explode ($this->transSep, $record['word']) as $word)
550 foreach (explode ($this->transSep, $record['translate']) as $translate) {
556 resolve_pageid ($this->NS, $pageId, $exists);
560 …'<div>'.$this->getLang ('word').'<br/><img src="'.$imgDir.'stop.png" align="left"/> <span class="g…
561 …'<div>'.$this->getLang ('translate').'<br/><img src="'.$imgDir.'one-way.png" align="left"/> <span …
562 file_put_contents ($this->sampleFile, $text);
570 @unlink ($this->listFile);
574 if ($this->testAdminGroup ()) {
577 …echo '<input value="'.$this->getLang ($action).'" onclick="javascript:glossarySendClear (\''.$acti…
580 if (file_exists ($this->listFile) &&
581 (time () - filemtime ($this->listFile) < $this->getConf ('listDelai'))) {
582 echo file_get_contents ($this->listFile);
586 $all = $this->readAllGlossary ($this->def);
587 $poll = $this->readAllGlossary ($this->poll);
593 …ossarySort(this,glossaryComparatorWord);"><span>'.$this->getLang ('tipWord').'</span><img src="'.$
594 …rt(this,glossaryComparatorTranslate);"><span>'.$this->getLang ('tipTranslate').'</span><img src="'…
595 …ossarySort(this,glossaryComparatorDate);"><span>'.$this->getLang ('tipDate').'</span><img src="'.$
596 …ossarySort(this,glossaryComparatorView);"><span>'.$this->getLang ('tipView').'</span><img src="'.$
597 …sarySort(this,glossaryComparatorScore);"><span>'.$this->getLang ('tipScore').'</span><img src="'.$
599 ' <th>'.$this->getLang ('why').'</th>'.NL.
600 ' <th><img src="'.$this->imgDir.'stop.png" /> '.$this->getLang ('word').'</th>'.NL.
603 …' <span>'.$this->getLang ('tipSearch').'</span><img src="'.$this->imgDir.'search.png" />'.N…
607 ' <th><img src="'.$this->imgDir.'one-way.png" /> '.$this->getLang ('translate').'</th>'.NL.
608 ' <th>'.$this->getLang ('poll').'</th>'.NL.
611 $recentTime = mktime (0, 0, 0, date ("n"), date ("j")-$this->recentDays, date ("Y"));
617 foreach (explode ($this->transSep, $record['word']) as $word)
618 foreach (explode ($this->transSep, $record['translate']) as $translate) {
624 resolve_pageid ($this->NS, $pageId, $exists);
631 $opacity = ($delta)/($this->recentDays+1);
633 $imgClock = '<img src="'.$this->imgDir.'clock.png" style="opacity:'.$opacity.';" />';
637 $poll [$md5id] = $this->incView ($md5id, $word);
641 list ($scoreVal, $scoreImg) = $this->getScore ($poll [$md5id]);
643 '<tr class="'.$this->nextOddEven ($even).'"'.NL.
648 …' <td class="why toolTip">'.$link.'<img src="'.$this->imgDir.'help.png"/><span>'.$this->getLang…
651 …' <td class="poll toolTip">'.$link.'<span>'.$this->getLang ('tipPoll').'</span>'.$scoreImg.'</a…
657 file_put_contents ($this->listFile, $text);
663 if (!$this->testAdminGroup ())
665 $this->manageRecord ($request, $this->def, false);
669 if (!$this->testAdminGroup ())
671 foreach (array ($this->prop, $this->def) as $status) {
675 $this->removeGlossary (md5 (trim ($ticket)), $status);
676 $this->message ('info', $ticket." ".$this->getLang ('ticketDeleted'));
677 if ($status == $this->def) {
679 resolve_pageid ($this->NS, $pageId, $exists);
682 $this->message ('info', $pageId." ".$this->getLang ('pageDeleted'));
691 $all = $this->readAllGlossary ($status);
697 foreach (array_diff ($this->statusFields [$status], array ("ns")) as $field)
699 ' <th>'.$this->getLang ($field).'</th>'.NL;
705 '<tr class="'.$this->nextOddEven ($even).'">'.NL.
711 if ($status == $this->def)
717 if ($status == $this->prop)
727 ' <input type="hidden" name="glossary[ns]" value="'.$this->NS.'">'.NL.
728 …' <input type="submit" name="glossary[action]" value="'.$this->getLang ('remove').'"/></td>…
742 ' <th><img src="'.$this->imgDir.'stop.png" /> '.$this->getLang ('word').'</th>'.NL.
743 … ' <th><img src="'.$this->imgDir.'one-way.png" /> '.$this->getLang ('translate').'</th>'.NL.
744 ' </tr><tr class="'.$this->oddEven [0].'">'.NL.
745 …' <td><input type="reset" onClick="glossaryReset(this)" value="'.$this->getLang ('new').'" />…
750 ' <th>'.$this->getLang ('ticket').'</th>'.NL.
751 ' <th>'.$this->getLang ('useTicket').'</th>'.NL.
752 ' </tr><tr class="'.$this->oddEven [0].'">'.NL.
754 ' <input type="hidden" name="glossary[operation]" value="'.$this->def.'update">'.NL.
755 ' <input type="hidden" name="glossary[ns]" value="'.$this->NS.'">'.NL.
756 …' <input type="submit" name="glossary[action]" value="'.$this->getLang ('update').'"/></td>…
766 if (!$this->ticketOk ())
771 $this->md5id = md5 ($pageId);
772 $values = $this->readGlossary ($this->md5id, $this->def, LOCK_SH);
775 resolve_pageid ($this->NS, $pageId, $exists);
778 $pageTpl = io_readfile ($this->localFN ('pageTemplate'));
779 $wordTpl = io_readfile ($this->localFN ('wordTemplate'));
780 $translateTpl = io_readfile ($this->localFN ('translateTemplate'));
782 foreach (explode ($this->transSep, $values['word']) as $word)
785 foreach (explode ($this->transSep, $values['word']) as $word)
790 '@@PROPOSITIONPAGE@@' => $this->getConf ('propositionPage'));
793 $this->message ('success', $this->getLang ('createPage'));
798 if (!$this->testAdminGroup ())
803 $subDir = $this->dataRootDir.$md5ns.'/';
804 $ns = $this->readConfig ($subDir);
805 … if ($this->getGlosarySize ($this->def, $md5ns)+$this->getGlosarySize ($this->prop, $md5ns) > 0)
806 $this->message ('error', $this->getLang ('glossaryNotEmpty').$ns." (".$md5ns.").");
812 if (!eregi ($this->poll.'(.*)\.xml$', $file, $regs))
816 @unlink ($subDir.$this->configFile);
818 $this->message ('success', $this->getLang ('glossaryRemoved').$ns." (".$md5ns.").");
824 if (!is_dir ($this->dataRootDir))
828 $pathDirObj = opendir ($this->dataRootDir);
830 $subDir = $this->dataRootDir.$file.'/';
833 $ns = $this->readConfig ($subDir);
836 $this->getGlosarySize ($this->def, $file),
837 $this->getGlosarySize ($this->prop, $file),
838 $this->getGlosarySize ($this->poll, $file));
850 '<tr class="'.$this->nextOddEven ($even).'">'.NL.
860 '<tr class="'.$this->nextOddEven ($even).'">'.NL.
863 …' <input type="submit" name="glossary[action]" value="'.$this->getLang ('remove').'"/></td>…
872 if (!$this->testAdminGroup ())
875 if ($request['operation'] == $this->prop."remove")
876 $this->manageRemove ($request);
877 $this->printManagedList ($this->prop);
878 $this->resetAdminNotification ();
882 if (!$this->testAdminGroup ())
885 if ($request['operation'] == $this->def."remove")
886 $this->manageRemove ($request);
887 if ($request['operation'] == $this->def."update") {
888 $this->manageUpdate ($request);
889 $this->createPage ($request);
891 $this->clearListFile ();
892 $this->printManagedForm ($request);
893 $this->printManagedList ($this->def);
897 if (!$this->testAdminGroup ())
901 $this->glossariesRemove ($request);
902 $this->printGlossariesList ();
907 $subDir = $this->dataRootDir.$this->md5ns.'/';
908 $this->readConfig ($subDir);
909 $this->lastNotificationReset = date ('YmdHis');
910 $this->writeConfig ();
914 $this->readConfig ($this->dataRootDir.$this->md5ns.'/');
915 if ($this->lastNotification <= $this->lastNotificationReset) {
916 $this->lastNotification = date ('YmdHis');
921 $mailSubject = $this->getLang ('notifySubject');
922 $mailContent = $this->getLang ('notifyContent');
926 if (in_array ($this->adminGroup, $userinfo ['grps'])) {
933 $this->writeConfig ();