Beispiel #1
0
 /**
  * Delegated implementation of the old settings hook.
  */
 public static function settings()
 {
     $ret = array('#type' => 'fieldset', '#title' => t('Search filtering'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $ret[Sanitization::VARVALIDATION] = array('#type' => 'radios', '#title' => t('How should search strings be validated to prevent spamming ZG blocks ?'), '#default_value' => Sanitization::getValidationType(), '#options' => array(Sanitization::NO => t('No validation performed: record and display every search'), Sanitization::RECORD => t('Do not record searches containing HTML'), Sanitization::DISPLAY => t('Do not display searches containing HTML, but store them')), '#description' => t('<p>Recommended value is "Do not record HTML": spammers may abuse ZG by submitting links via scripts.</p>'));
     $ret[Sanitization::VARRECORDEMPTY] = array('#type' => 'checkbox', '#title' => t('Should Zeitgeist record empty searches ?'), '#default_value' => static::isEmptySearchRecorded(), '#description' => t('Zeitgeist normally records empty searches, but some of them can be spurious and not represent actual searches, but just clicks on search links by spiders, and some webmasters can wish to ignore them. Whatever this setting, they are never displayed in the "latest searches" block.'));
     return $ret;
 }
 public function createCbr()
 {
     $chapterImageDir = $this->_mangaInfo->getOutputDir() . 'images/' . $this->_chapterInfo->getNumber() . '/';
     if (!is_dir($chapterImageDir)) {
         consoleLineError("Chapter image dir {$chapterImageDir} not found!");
         exit;
     }
     $cbrDirPath = $this->_mangaInfo->getCbrDirPath();
     if (!is_dir($cbrDirPath)) {
         consoleLineError("Cbr dir {$cbrDirPath} not found!");
         exit;
     }
     $cNum = $this->_chapterInfo->getNumber();
     $cTitle = $this->_chapterInfo->getTitle();
     $mSlug = $this->_mangaInfo->getSlug();
     $cbrFileName = '[' . $mSlug . '-' . str_pad($cNum, 6, '0', STR_PAD_LEFT) . '] - ' . Sanitization::stripNonwordCharachters($cTitle, '-', 'lower') . '.cbr';
     $shellCommand = "rar a \"{$cbrDirPath}{$cbrFileName}\" {$chapterImageDir}*.jpg";
     $this->_chapterInfo->setCbrFileName($cbrFileName);
     if ($this->shouldPrintRarOutput()) {
         consoleLineInfo(shell_exec($shellCommand));
     } else {
         shell_exec($shellCommand);
     }
     consoleLinePurple("Created CBR file: " . $cbrFileName);
     if (file_exists($cbrDirPath . $cbrFileName)) {
         //shell_exec("notify-send --hint int:transient:1 -u low -t 2000 \".cbr created\" \"CBR file {$cbrFileName} created!\"");
     }
 }
 /**
  * @param bool $original
  *
  * @return null
  */
 public function getNumber($original = false)
 {
     if ($original) {
         return trim($this->_number);
     } else {
         return Sanitization::stripNonwordCharachters(trim($this->_number));
     }
 }
Beispiel #4
0
 /**
  * Stores a search.
  *
  * @param string $keys
  *   The search query.
  * @param string $kind
  *   The search type.
  * @param int $timestamp
  *   The search submission timestamp.
  */
 public static function store($keys, $kind, $timestamp = NULL)
 {
     // Make sure we do want to store an empty search.
     $do_store = empty($keys) ? Sanitization::isEmptySearchRecorded() : TRUE;
     if (!$do_store || !Sanitization::validate($keys, 'save')) {
         return;
     }
     if (!isset($timestamp)) {
         $timestamp = REQUEST_TIME;
     }
     $search = (object) array('search' => $keys, 'category' => $kind, 'ts' => $timestamp);
     drupal_write_record(static::TABLE, $search);
     // Since we added a new record, block contents may have changed.
     Cache::clearAll();
 }