Example #1
0
function clean_stristr($title, $content)
{
    // Strips out tags (after converting special chars), whitespace and trailing ellipses (...s).
    $title = trim(preg_replace('/\\s+/', '', strip_tags(htmlspecialchars_decode($title, ENT_QUOTES))), ".");
    $content = trim(preg_replace('/\\s+/', '', strip_tags(htmlspecialchars_decode($content, ENT_QUOTES))), ".");
    return mb_stristr($content, $title) !== FALSE;
}
 /**
  * @param        $haystack
  * @param        $needle
  * @param bool   $caseSensitive
  * @param string $encoding
  *
  * @return bool
  *
  * @author Andreas Glaser
  */
 public static function contains($haystack, $needle, $caseSensitive = true, $encoding = 'UTF-8')
 {
     if ($caseSensitive === false) {
         return mb_stristr($haystack, $needle, null, $encoding) !== false;
     }
     return mb_strstr($haystack, $needle, null, $encoding) !== false;
 }
Example #3
0
function changeWikis2 ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis2($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,'$COMMSY_ROOM_ID') and !mb_stristr($str,'session_name') ) {
            $str = str_replace(array("\r\n", "\r"), "\n", $str);
            $str_array = explode("\n",$str);
            $str_out = '';
            foreach ( $str_array as $value ) {
               $str_out .= $value.LF;
               if ( mb_stristr($value, '$COMMSY_ROOM_ID = "') ) {
                  $str_out .= 'session_name(\'SESSID-\'.$COMMSY_ROOM_ID);'.LF;
               }
            }
            if ( !empty($str_out) ) {
               file_put_contents($directory.'/'.$entry,trim($str_out));
            }
         }
         update_progress_bar($count);
      }
   }
}
 /**
  * StringFirstOccurrence
  */
 public function execute()
 {
     if ($this->isCaseInsensitive()) {
         return mb_stristr($this->getValue(), $this->needle, $this->beforeNeedle);
     } else {
         return mb_strstr($this->getValue(), $this->needle, $this->beforeNeedle);
     }
 }
Example #5
0
 protected function _generateField(&$field_id, &$field)
 {
     global $NFORM_CONFIG;
     $this->_processField($field);
     // Data management
     $label = $field_id;
     if (array_key_exists('label', $field)) {
         $label = $field['label'];
     }
     $required = '';
     if (array_key_exists('flags', $field)) {
         if (mb_stristr($field['flags'], 'required') !== false) {
             $required = '<span class="' . $NFORM_CONFIG['class_prefix'] . 'required">' . $NFORM_CONFIG['required_symbol'] . '</span>';
         }
     }
     $type = 'string';
     if (array_key_exists('type', $field)) {
         $type = $field['type'];
     }
     // Generate
     $tmp = '<div id="' . $NFORM_CONFIG['class_prefix'] . 'row_' . $field_id . '" class="' . $NFORM_CONFIG['class_prefix'] . 'row">' . "\r\n";
     $tmp .= "\t" . '<label for="' . $NFORM_CONFIG['id'] . $field_id . '">' . $label . $required . '</label>' . "\r\n";
     if ($type == 'plaintext') {
         $tmp .= "\t" . '<textarea';
     } else {
         if ($type == 'password') {
             $tmp .= "\t" . '<input type="password"';
         } else {
             $tmp .= "\t" . '<input type="text"';
         }
     }
     $tmp .= ' name="' . $field_id . '"';
     $tmp .= ' id="' . $NFORM_CONFIG['id'] . $field_id . '"';
     if ($this->_tabindex !== false) {
         $this->_tabindex++;
         $tmp .= ' tabindex="' . $this->_tabindex . '"';
     }
     if (array_key_exists('maxlength', $field)) {
         $tmp .= ' maxlength="' . $field['maxlength'] . '"';
     }
     if (array_key_exists('title', $field)) {
         $tmp .= ' title="' . $field['title'] . '"';
     }
     if ($type == 'plaintext') {
         $tmp .= '></textarea>' . "\r\n";
     } else {
         $tmp .= ' />' . "\r\n";
     }
     // message
     $tmp .= "\t" . '<div class="' . $NFORM_CONFIG['class_prefix'] . 'message" id="' . $NFORM_CONFIG['id'] . 'message_' . $field_id . '">';
     $tmp .= '</div>' . "\r\n";
     $tmp .= '</div>' . "\r\n";
     $this->_content .= $tmp;
 }
 private static function keywordFinder($lastTweets, $keywords)
 {
     $tweets = json_decode($lastTweets);
     foreach ($tweets as $key => $tweet) {
         foreach ($keywords as $key => $keyword) {
             if (mb_stristr($tweet->text, $keyword->keyname) != FALSE) {
                 return $tweet;
             }
         }
     }
 }
Example #7
0
 public function output()
 {
     $results = array();
     foreach ($this->commands as $command) {
         if ($this->search != null && !@mb_stristr($command['name'] . ' ' . $command['keys'], $this->search)) {
             continue;
         }
         $results[] = array('title' => $command['name'], 'arg' => $command['action'], 'icon' => $command['icon']);
     }
     $results[] = array('title' => 'Controls', 'subtitle' => 'Access this menu at any time by typing `c`', 'icon' => 'include/images/info.png');
     return $results;
 }
Example #8
0
 /**
  *
  * @return string url
  */
 public function getLogo()
 {
     $files = $this->attachedFiles;
     if ($files !== null) {
         foreach ($files as $file) {
             if (mb_stristr(self::LOGO, $file->name)) {
                 return $file->url;
             }
         }
     }
     return false;
 }
Example #9
0
function compareWithSearchText($search_text, $value) {
	if(mb_stristr($value, $search_text)) {
		$marker_color = getMarkerColor();
		if($marker_color === 'green') {
			$replace = '(:mainsearch_text_green:)$0(:mainsearch_text_green_end:)';
		} else if($marker_color === 'yellow') {
			$replace = '(:mainsearch_text_yellow:)$0(:mainsearch_text_yellow_end:)';
		}
		
		$value = preg_replace('~' . preg_quote($search_text, '/') . '~iu', $replace, $value);
	}
	
	return $value;
}
Example #10
0
 public function includeClass($name)
 {
     if (!empty($this->_class_array[$name]['switchable']) and $this->_class_array[$name]['switchable'] and !empty($this->_design_folder) and !empty($this->_class_array[$name]['folder']) and !mb_stristr($this->_class_array[$name]['folder'], '/' . $this->_design_folder . '/')) {
         $this->_class_array[$name]['folder'] .= $this->_design_folder . '/';
     }
     if (empty($this->_class_array[$name]['folder'])) {
         trigger_error('don\'t know where class ' . $name . ' is', E_USER_ERROR);
     } elseif (empty($this->_class_array[$name]['filename'])) {
         trigger_error('don\'t know the filename of ' . $name, E_USER_ERROR);
     } elseif (!file_exists($this->_class_array[$name]['folder'] . $this->_class_array[$name]['filename'])) {
         trigger_error('file ' . $this->_class_array[$name]['folder'] . $this->_class_array[$name]['filename'] . ' does not exist', E_USER_ERROR);
     } else {
         include_once $this->_class_array[$name]['folder'] . $this->_class_array[$name]['filename'];
     }
 }
Example #11
0
function changeWikis ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'commsy_config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,'authuser.php') and !mb_stristr($str,'authusercommsy.php') ) {
            $str = str_replace('include_once("$FarmD/scripts/authuser.php");','include_once("$FarmD/cookbook/authusercommsy.php");'.LF.'include_once("$FarmD/scripts/authuser.php");',$str);
            file_put_contents($directory.'/'.$entry,$str);
         }
         update_progress_bar($count);
      }
   }
}
Example #12
0
 function isClean($filename, $orig_filename = '')
 {
     $ret_val = true;
     if (!empty($filename) and file_exists($filename)) {
         // call scanner on file
         if (isset($this->_php) and !empty($this->_php) and $this->_php) {
             // viren scanning with PHP - clamscan - lib
             if ($virus_name = cl_scanfile($filename)) {
                 if (!empty($orig_filename)) {
                     $filename_text = $orig_filename;
                 } else {
                     $filename_text = $filename;
                 }
                 if (mb_strtoupper($virus_name, 'UTF-8') != 'OVERSIZED.ZIP') {
                     $this->_virus_name = $virus_name;
                     $this->_output = $this->_translator->getMessage('VIRUS_VIRUS_FOUND', $virus_name, $filename_text);
                     unlink($filename);
                     $ret_val = false;
                 }
             }
         } elseif (file_exists($this->_path . "/" . $this->_bin)) {
             // viren scanning with shell command
             $output = shell_exec($this->_path . "/" . $this->_bin . " " . escapeshellcmd($filename . " | grep FOUND"));
             if ($output != '' and mb_stristr($output, 'FOUND')) {
                 // maybe its only the filename, so remove it from output
                 $output = str_replace($filename . ': ', "", $output);
                 if (mb_stristr($output, 'FOUND') and !mb_stristr($output, 'Oversized.Zip')) {
                     // still a 'FOUND' in output?
                     $ret_val = false;
                     $virus_name = str_replace(' FOUND', "", $output);
                     $this->_virus_name = $virus_name;
                     if (!empty($orig_filename)) {
                         $filename_text = $orig_filename;
                     } else {
                         $filename_text = $filename;
                     }
                     $this->_output = $this->_translator->getMessage('VIRUS_VIRUS_FOUND', $virus_name, $filename_text);
                     unlink($filename);
                 }
             }
         } else {
             $ret_val = false;
             $this->_output = $this->_translator->getMessage('VIRUS_SCANNER_NOT_FOUND', $this->_path . "/" . $this->_bin);
         }
     }
     return $ret_val;
 }
 public function actionGetHTML()
 {
     $environment = $this->_environment;
     $translator = $environment->getTranslationObject();
     $files = array();
     if (isset($_GET['iid']) and $_GET['iid'] != 'NEW') {
         $item_manager = $environment->getItemManager();
         $item = $item_manager->getItem($_GET['iid']);
         $file_list_files = $item->getFileList();
         if (!$file_list_files->isEmpty()) {
             $file = $file_list_files->getFirst();
             while ($file) {
                 if (mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'png') or mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'jpg') or mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'jpeg') or mb_stristr(mb_strtolower($file->getFilename(), 'UTF-8'), 'gif')) {
                     $files[$file->getFileID()] = $file->getFilename();
                 }
                 $file = $file_list_files->getNext();
             }
         }
     }
     $temp_files_upload = array();
     $file_manager = $environment->getFileManager();
     $file_list_files_upload = $file_manager->getTempItemListBySessionID($environment->getSessionID());
     $file_item = $file_list_files_upload->getFirst();
     while ($file_item) {
         $files[$file_item->getFileID()] = $file_item->getFilename();
         $file_item = $file_list_files_upload->getNext();
     }
     unset($file_manager);
     $html = '';
     $html .= '<script type="text/javascript" src="javascript/jQuery/jquery-1.4.1.min.js"></script>' . LF;
     $html .= '<script type="text/javascript" src="javascript/jQuery/commsy/commsy_ckeditor.js"></script>' . LF;
     $html .= '<div style="text-align:center; widht:100%;">';
     $html .= '<br/><br/>' . LF;
     $html .= '<form id="ckeditor_file_form">' . LF;
     $html .= '<input type="hidden" id="ckeditor_file_func_number" value="' . $_GET['CKEditorFuncNum'] . '" />' . LF;
     $html .= '<select id="ckeditor_file_select">' . LF;
     foreach ($files as $id => $filename) {
         $link = 'commsy.php/' . $filename . '?cid=' . $environment->getCurrentContextID() . '&mod=material&fct=getfile&iid=' . $id;
         $html .= '<option name="ckeditor_file" value="' . $link . '">' . $filename . '</option>' . LF;
     }
     $html .= '</select>' . LF;
     $html .= '<br/><br/>' . LF;
     $html .= '<input type="submit" value="' . $translator->getMessage('COMMON_CHOOSE_BUTTON') . '">' . LF;
     $html .= '</form>' . LF;
     $html .= '</div>';
     echo $html;
 }
Example #14
0
 function find($needle, $ignoreCase = false, $reverse = false)
 {
     if ($ignoreCase) {
         if ($reverse) {
             $this->__invar = mb_strrichr($this->__invar, $needle);
         } else {
             $this->__invar = mb_stristr($this->__invar, $needle);
         }
     } else {
         if ($reverse) {
             $this->__invar = mb_strrchr($this->__invar, $needle);
         } else {
             $this->__invar = mb_strstr($this->__invar, $needle);
         }
     }
     return $this;
 }
 public function output()
 {
     $results = array();
     foreach ($this->countries as $country) {
         if ($this->search != null && !@mb_stristr($country['name'] . ' ' . $country['code'], $this->search)) {
             continue;
         }
         $currentResult = array('title' => $country['name'], 'subtitle' => "Set your country to “{$country['code']}.”", 'arg' => 'country⟩' . $country['code'], 'autocomplete' => 'Country Code ⟩' . $country['name']);
         $results[] = $currentResult;
     }
     if ($results == null) {
         $results[] = array('title' => 'Could not find country', 'subtitle' => 'We are looking for a country called "' . $this->search . '"', 'autocomplete' => 'Country Code ⟩', 'valid' => 'no');
     } else {
         usort($results, array($this, 'countrySort'));
     }
     return $results;
 }
 public function save($form_data, $additional = array())
 {
     $room_config = $form_data['room_config'];
     // prepare sorting array
     $sorting = array();
     $num_latest_dummies = 0;
     foreach ($room_config as $config) {
         switch ($config['type']) {
             case 'title':
                 $sorting[] = '-1$$' . $config['value'];
                 $num_latest_dummies = 0;
                 break;
             case 'room':
                 $sorting[] = $config['value'];
                 $num_latest_dummies = 0;
                 break;
             case 'dummy':
                 $sorting[] = '-3';
                 $num_latest_dummies++;
                 break;
         }
     }
     // remove all tailing dummies per title
     $sorting = array_reverse($sorting);
     $is_before_title = true;
     foreach ($sorting as $key => $id) {
         // if dummy
         if ($id == '-3' && $is_before_title) {
             unset($sorting[$key]);
             // if title
         } elseif (mb_stristr($id, '-1$$')) {
             $is_before_title = true;
         } else {
             $is_before_title = false;
         }
     }
     $sorting = array_reverse($sorting);
     // save
     $current_user = $this->_environment->getCurrentUserItem();
     $own_room_item = $current_user->getOwnRoom();
     $own_room_item->setCustomizedRoomIDArray($sorting);
     $own_room_item->save();
     // set return
     $this->_popup_controller->setSuccessfullItemIDReturn($own_room_item->getItemID());
 }
Example #17
0
 /** get errorbox as HTML
  * this method returns the errorbox in HTML-Code
  *
  * @return string errorbox view as HMTL
  */
 function asHTML()
 {
     $html = '';
     $html .= '<!-- BEGIN OF ERRORBOX -->' . LF;
     if (!$this->_width and ($this->_environment->inPortal() or $this->_environment->inServer())) {
         $text = 'width: 60%;';
     } elseif ($this->_width and !mb_stristr($this->_width, 'em') and !mb_stristr($this->_width, '%')) {
         $width = round($this->_width / 12, 0);
         $text = ' width: ' . $width . 'em;';
     } elseif (mb_stristr($this->_width, 'em') or mb_stristr($this->_width, '%')) {
         $text = ' width: ' . $this->_width;
     } else {
         $text = 'width: 35em;';
     }
     $html .= '<div style="width:100%; text-align:center; padding-top:5px; padding-bottom:0px;">' . LF;
     $html .= '<center>' . LF;
     $html .= '<table style="border: 2px solid #FF0000; margin: 0px; ' . $text . '" summary="Layout">' . LF;
     if (!empty($this->_title)) {
         $html .= '   <tr><td style="text-align: left;">' . LF;
         #$html .= '<img src="images/warn.gif" style="vertical-align: top; text-align: left; padding-left: 0px; padding-right: 10px;" alt="'.$this->_translator->getMessage('RUBRIC_WARN_CHANGER').'"></img>'.LF;
         $html .= '<span style="font-size:12pt; font-weight:bold">' . $this->_title . '</span>' . LF;
         if (!empty($this->_description)) {
             $html .= '      <span>(' . $this->_description . ')</span>' . LF;
         }
         $html .= '   </td></tr>' . LF;
     }
     $html .= '   <tr>' . LF;
     $html .= '      <td style="text-align: left;">' . $this->_text . '</td>' . LF;
     $html .= '   </tr>' . LF;
     if ($this->_with_login) {
         $html .= '   <tr>' . LF;
         $html .= '      <td style="text-align: left;">' . LF;
         $html .= '         <form method="post" action="' . curl($this->_environment->getCurrentContextID(), 'context', 'login') . '" name="login">' . LF;
         // TBD
         $html .= '         </form>' . LF;
         $html .= '      </td>' . LF;
         $html .= '   </tr>' . LF;
     }
     $html .= '</table>' . LF;
     $html .= '</center>' . LF;
     $html .= '</div>' . LF;
     $html .= '<!-- END OF ERRORBOX -->' . LF . LF;
     return $html;
 }
 protected function getNodesWithText($search_for, $xml)
 {
     $nodes = array();
     #only works with us_EN, bad americano!
     // 			$nodes = array_merge($nodes, $this->getSpecificNodeWithText('label',$search_for, $xml));
     // 			$nodes = array_merge($nodes, $this->getSpecificNodeWithText('comment',$search_for, $xml));
     //get the nodes
     $nodes = array_merge($nodes, $xml->xpath('//label'));
     $nodes = array_merge($nodes, $xml->xpath('//comment'));
     //filter the nodes
     $found = array();
     $helper = Mage::helper('adminhtml');
     foreach ($nodes as $node) {
         if (mb_stristr($helper->__((string) $node), $search_for) !== false) {
             $found[] = $node;
         }
     }
     return $found;
 }
Example #19
0
 public function __construct($options)
 {
     $this->search = $options['search'];
     $this->currentURI = $options['URIs'][$options['depth'] - 1];
     $explodedURI = explode(":", $this->currentURI);
     $this->type = $explodedURI[1];
     $this->rawType = $this->type == "artist" ? "album" : "track";
     $fetcher = new JsonFetcher("http://ws.spotify.com/lookup/1/.json?uri={$this->currentURI}&extras={$this->rawType}detail");
     $json = $fetcher->run();
     $this->title = $json->{$this->type}->name;
     $this->raw = array();
     if ($this->rawType == "album") {
         $albums = array();
         $this->query = implode(" ⟩", $options['args']);
         foreach ($json->artist->albums as $key => $value) {
             $value = $value->album;
             if (in_array($value->name, $albums)) {
                 continue;
             }
             $currentResult['title'] = $value->name;
             $currentResult['type'] = 'album';
             $currentResult['href'] = $value->href;
             if ($this->search != '' && !mb_stristr($currentResult['title'], $this->search)) {
                 continue;
             }
             $this->raw[] = $currentResult;
             $albums[] = $value->name;
         }
     } else {
         foreach ($json->album->tracks as $key => $value) {
             $currentResult['title'] = $value->name;
             $currentResult['type'] = 'track';
             $currentResult['href'] = $value->href;
             $currentResult['number'] = $value->{'track-number'};
             $currentResult['popularity'] = $value->popularity;
             $currentResult['length'] = $value->length;
             if ($this->search != '' && !mb_stristr($currentResult['title'], $this->search)) {
                 continue;
             }
             $this->raw[] = $currentResult;
         }
     }
 }
 /** get the item of the list view as HTML
  * this method returns the single item in HTML-Code
  *
  * overwritten method form the upper class
  *
  * @return string item as HMTL
  */
 function _getItemAsHTML($item)
 {
     $context_item = $this->_environment->getCurrentContextItem();
     $html = '                     <td width="25%" style="vertical-align: baseline; padding-bottom:10px;">' . LF;
     if (!$context_item->isClosed() or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'archive') or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'preferences')) {
         $html .= '                        ' . '<span style="font-weight:bold">' . $item->getLink() . '</span>' . LF;
     } else {
         $html .= '                        ' . '<span style="font-weight:bold">' . $item->getTitle() . '</span>' . LF;
     }
     $html .= '                     <br/>' . LF;
     $html .= '                     <span style="width:70%; vertical-align: baseline;">' . LF;
     if (!$context_item->isClosed() or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'archive') or mb_stristr($item->getLink(), 'configuration') and mb_stristr($item->getLink(), 'preferences')) {
         $html .= '                        ' . $item->getLinkIcon() . ' ' . $item->getDescription() . LF;
     } else {
         $html .= '                        ' . $item->getIcon() . ' ' . $item->getDescription() . LF;
     }
     $html .= '                     </span></td>' . LF;
     return $html;
 }
Example #21
0
function changeWikis ($directory,$count) {
   global $c_commsy_path_file;
   if ( empty($c_commsy_path_file) ) {
      @include_once('../../etc/cs_config.php');
   }
   $str2 = file_get_contents($c_commsy_path_file.'/etc/pmwiki/wiki_config.php');
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ($entry != '.' and $entry != '..' and is_dir($directory.'/'.$entry)) {
         changeWikis($directory.'/'.$entry,$count);
      } elseif (is_file($directory.'/'.$entry) and $entry == 'config.php') {
         $str = file_get_contents($directory.'/'.$entry);
         if ( mb_stristr($str,"include_once('commsy_config.php');") and !empty($str2) ) {
            file_put_contents($directory.'/'.$entry,trim($str2));
         }
         update_progress_bar($count);
      }
   }
}
 /**
  *
  * @param string $url
  * @return self
  */
 protected static function setDomains($url)
 {
     self::$baseFolder = '';
     if (empty(self::$homeUrl)) {
         self::$homeUrl = rtrim(StringHelper::dirname($_SERVER['PHP_SELF']), '/');
     }
     if (empty(self::$baseFolder)) {
         if ($str = mb_stristr(self::$homeUrl, 'admin', TRUE)) {
             self::$baseFolder = $str . "admin";
         }
         if ($str == false && !empty(self::$homeUrl)) {
             self::$baseFolder = rtrim(self::$homeUrl, '/');
         }
         self::$baseFolder = rtrim(self::$baseFolder, '/');
     }
     $url = StringHelper::byteSubstr($url, StringHelper::byteLength(self::$baseFolder), StringHelper::byteLength($url));
     self::$domains = explode('/', ltrim($url, '/'));
     return self::$domains;
 }
Example #23
0
 public static function get_companies_info($input)
 {
     $lists = array();
     foreach (self::$companies as $keys => $values) {
         if (mb_stristr($values['company'], $input)) {
             unset($values['id']);
             $lists[] = $values;
         }
     }
     //如果通过名称取不到值则通过键名
     if (count($lists) == 0) {
         foreach (self::$companies as $keys => $values) {
             if (mb_stristr($values['code'], $input)) {
                 unset($values['id']);
                 $lists[] = $values;
             }
         }
     }
     return $lists;
 }
Example #24
0
function runFilesInDir ($directory) {
   $directory_handle  = opendir($directory);
   $do = false;

   while (false !== ($entry = readdir($directory_handle))) {
      if ( $entry != '.'
           and $entry != '..'
           and !mb_stristr($entry,'CVSROOT')
           and !mb_stristr($entry,'lib')
           and !mb_stristr($entry,'TestSource')
           and !mb_stristr($entry,'var')
           and !mb_stristr($entry,'CVS')
           and is_dir($directory.'/'.$entry)
         ) {
         $do = $do or runFilesInDir($directory.'/'.$entry);
      } elseif (is_file($directory.'/'.$entry) and preg_match('~\.php$~u',$entry)) {
         $do = $do or del_dos_line_feeds($directory.'/'.$entry);
      }
   }
   return $do;
}
 public function output()
 {
     $results = array();
     foreach ($this->albums as $key => $current) {
         $currentResult = array('title' => $current['name'], 'subtitle' => "Browse this {$current['type']}", 'valid' => 'no', 'autocomplete' => "{$this->currentURI} ⟩ {$current['uri']} ⟩ {$this->query} ⟩{$this->search}⟩", 'copy' => $this->currentURI, 'icon' => "include/images/album.png");
         if ($this->search != '' && !mb_stristr($currentResult['title'], $this->search)) {
             continue;
         }
         $results[] = $currentResult;
     }
     $scope['title'] = $this->name;
     $scope['subtitle'] = "Browse this {$this->type} in Spotify";
     $scope['arg'] = "spotify⟩activate (open location \"{$this->currentURI}\")";
     $scope['autocomplete'] = $this->originalQuery;
     $scope['copy'] = $this->currentURI;
     $scope['icon'] = "include/images/{$this->type}.png";
     if ($this->search == null) {
         array_unshift($results, $scope);
     } else {
         array_push($results, $scope);
     }
     return $results;
 }
Example #26
0
function changeWikis2 ($directory,$count) {
   $directory_handle  = opendir($directory);
   while ( false !== ($entry = readdir($directory_handle)) ) {
      if ( $entry != '.'
           and $entry != '..'
           and is_dir($directory.'/'.$entry)
           and !mb_stristr($entry, 'uploads')
           and !is_link($directory.'/'.$entry)
         ) {
         changeWikis2($directory.'/'.$entry,$count);
      } elseif ( is_file($directory.'/'.$entry)
                 and !stristr($entry,'.jpg')
                 and !stristr($entry,'.jpeg')
                 and !stristr($entry,'.gif')
                 and !stristr($entry,'.png')
                 and !stristr($entry,'.ico')
               ) {
         $file_contents = file_get_contents($directory.'/'.$entry);
         $file_contents = iconv('ISO-8859-1', 'UTF-8', $file_contents);
         file_put_contents($directory . '/' . $entry, $file_contents);
      }
   }
}
Example #27
0
 public function run()
 {
     $username = $this->aOptions['username'];
     $password = $this->aOptions['password'];
     $lastDataTimeAsStr = date("D M j H:i:s +0000 Y", $this->aOptions['last_data_time']);
     $bot = new Twitter($username, $password);
     $messages = $bot->directMessages->direct_messages(array('since' => $lastDataTimeAsStr));
     if (!is_array($messages)) {
         return;
     }
     // Now sort the messages so that the oldest is first
     // We do this because we want messages to be echoed back out to
     // Twitter in the same order as they were received.
     $messages = array_reverse($messages);
     $badPhrases = array('Thanks for following', 'Thank you for following', 'danke, dass Du meinen Tweets folgst', 'myexquisitefoods');
     foreach ($messages as $message) {
         $sender = $message->sender->screen_name;
         $status = trim($message->text);
         $isBad = false;
         foreach ($badPhrases as $phrase) {
             if (mb_stristr($status, $phrase)) {
                 $isBad = true;
                 break;
             }
         }
         if ($isBad) {
             continue;
         }
         $this->aOptions['last_data_time'] = strtotime($message->created_at);
         //          $output = ( isset($this->aOptions['sender_is_private']) && 1 == $this->aOptions['sender_is_private'] )
         //                  ? $status
         //                  : "@$sender says \"$status\"";
         $output = 'kapowatch' == $username || 'neilisannoyedby' == $username ? $status : "@{$sender} says \"{$status}\"";
         //          $output = "@$sender says \"$status\"";
         $bot->status->update($output);
     }
 }
 public function output()
 {
     $results = array();
     foreach ($this->tracks as $key => $current) {
         $explicit = $current['explicit'] ? " (explicit)" : "";
         $currentResult = array('title' => "{$current['number']}. {$current['name']}", 'subtitle' => $this->prettifyTime($current['duration']) . $explicit, 'valid' => 'yes', 'arg' => "spotify⟩play track \"{$current['uri']}\" in context \"{$this->currentURI}\"", 'copy' => $current['uri'], 'icon' => "include/images/track.png");
         if ($this->search != '' && !mb_stristr($currentResult['title'], $this->search)) {
             continue;
         }
         $results[] = $currentResult;
     }
     $scope['title'] = $this->name;
     $scope['subtitle'] = "Browse this {$this->type} in Spotify";
     $scope['arg'] = "spotify⟩activate (open location \"{$this->currentURI}\")";
     $scope['autocomplete'] = $this->originalQuery;
     $scope['copy'] = $this->currentURI;
     $scope['icon'] = "include/images/{$this->type}.png";
     if ($this->search == null) {
         array_unshift($results, $scope);
     } else {
         array_push($results, $scope);
     }
     return $results;
 }
Example #29
0
 protected function _parseLine(&$line)
 {
     $line = trim($line);
     if ($line == '') {
         return;
     }
     if (mb_stristr($line, ':') === false) {
         return;
     }
     $tmp = explode(':', $line);
     $key = trim($tmp[0]);
     $value = trim($tmp[1]);
     if ($key == '') {
         return;
     }
     if ($value == '') {
         $this->block_key = $key;
         return;
     }
     if (!$this->_validKey($key)) {
         return;
     }
     $this->block_storage[$this->block_key][$key] = $value;
 }
if ($javascript == '1') {
    $session->setValue('javascript', 1);
} elseif ($javascript == '-1') {
    $session->setValue('javascript', -1);
}
if ($https == '1') {
    $session->setValue('https', 1);
} elseif ($https == '-1') {
    $session->setValue('https', -1);
}
if ($flash == '1') {
    $session->setValue('flash', 1);
} elseif ($flash == '-1') {
    $session->setValue('flash', -1);
}
// save portal id in session to be sure, that user didn't
// switch between portals
if ($environment->inServer()) {
    $session->setValue('commsy_id', $environment->getServerID());
} else {
    $session->setValue('commsy_id', $environment->getCurrentPortalID());
}
// external tool
if (mb_stristr($_SERVER['PHP_SELF'], 'homepage.php')) {
    $session->setToolName('homepage');
}
// auth_source
if (empty($auth_source)) {
    $auth_source = $authentication->getAuthSourceItemID();
}
$session->setValue('auth_source', $auth_source);